123avi commented on a change in pull request #7418: FLINK-11053 Documentation - 
update scala sample code for bucketing sink according
URL: https://github.com/apache/flink/pull/7418#discussion_r245919932
 
 

 ##########
 File path: docs/dev/connectors/filesystem_sink.md
 ##########
 @@ -117,11 +117,11 @@ input.addSink(sink);
 </div>
 <div data-lang="scala" markdown="1">
 {% highlight scala %}
-val input: DataStream[Tuple2[IntWritable, Text]] = ...
+val input: DataStream[(IntWritable, Text)] = ???
 
-val sink = new BucketingSink[String]("/base/path")
-sink.setBucketer(new DateTimeBucketer[String]("yyyy-MM-dd--HHmm", 
ZoneId.of("America/Los_Angeles")))
-sink.setWriter(new SequenceFileWriter[IntWritable, Text]())
+val sink = new BucketingSink[(IntWritable, Text)]("/base/path")
+sink.setBucketer(new DateTimeBucketer("yyyy-MM-dd--HHmm"))
+sink.setWriter(new StringWriter[(IntWritable, Text)]())
 
 Review comment:
   @hequn8128 still won't work since the `setWriter` accepts Writer with a 
single type e.g `T` and the SequenceFileWriter accepts two types `K,V`. The 
tuple `T` is still a single type. The following will not compile :
   ```
   val input: DataStream[(A, B)] = ???
     val sink = new BucketingSink[(A, B)]("/base/path")
     sink.setWriter(new SequenceFileWriter[A, B]())
   ```
   because the SequenceWriter in this example should accept a tuple i.e 
`[(A,B)]` but of course it should also accept a `V`. i.e 
`SequenceFileWriter[(A, B), V] `which is not matched to the accepted type of 
`Writer[(A,B)]`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to