title: Change the filename of the spark streaming output
body: <p>The below simple program reads from kafka stream and writes to CSV file every 5 mins, and its spark streaming. It generates file with the naming convention <strong>part-00000-f90bbc78-b847-41d4-9938-bdae89adb8eb.csv</strong>  , is there a way I can change the name to include a "DATETIMESTAMP" + GUID</p>
  
  <p>Please adivse. Thanks.</p>
  
  <p>I was able to find the list of options for DatastreamReader, but nothing for DatastreamWriter</p>
  
  <p><a href="https://spark.apache.org/docs/latest/api/java/org/apache/spark/sql/streaming/DataStreamReader.html#csv-java.lang.String-" rel="nofollow noreferrer">https://spark.apache.org/docs/latest/api/java/org/apache/spark/sql/streaming/DataStreamReader.html#csv-java.lang.String-</a></p>
  
  <pre><code>public static void main(String[] args) throws Exception {
  
      if (args.length == 0)
          throw new Exception("Usage program configFilename");
      String configFilename = args[0];
  
      addShutdownHook();
  
      ConfigLoader.loadConfig(configFilename);
      sparkSession = SparkSession
              .builder()
              .appName(TestKafka.class.getName())
              .master(ConfigLoader.getValue("master")).getOrCreate();
      SparkContext context = sparkSession.sparkContext();
      context.setLogLevel(ConfigLoader.getValue("logLevel"));
  
      SQLContext sqlCtx = sparkSession.sqlContext();
      System.out.println("Spark context established");
  
      DataStreamReader kafkaDataStreamReader = sparkSession.readStream()
              .format("kafka")
              .option("kafka.bootstrap.servers", ConfigLoader.getValue("brokers"))
              .option("group.id", ConfigLoader.getValue("groupId"))
              .option("subscribe", ConfigLoader.getValue("topics"))
              .option("failOnDataLoss", false);
      Dataset&lt;Row&gt; rawDataSet = kafkaDataStreamReader.load();
      rawDataSet.printSchema();
      rawDataSet.createOrReplaceTempView("rawEventView1");
  
      rawDataSet = rawDataSet.withColumn("rawEventValue", rawDataSet.col("value").cast("string"));
      rawDataSet.printSchema();
      rawDataSet.createOrReplaceTempView("eventView1");
      sqlCtx.sql("select * from eventView1")
              .writeStream()
              .format("csv")
              .option("header", "true")
              .option("delimiter", "~")
              .option("checkpointLocation", ConfigLoader.getValue("checkpointPath"))
              .option("path", ConfigLoader.getValue("recordsPath"))
              .outputMode(OutputMode.Append())
              .trigger(ProcessingTime.create(Integer.parseInt(ConfigLoader.getValue("kafkaProcessingTime"))
                      , TimeUnit.SECONDS))
              .start()
              .awaitTermination();
  }
  </code></pre>