yxu-valleytider commented on issue #9581: [FLINK-13864][streaming]: Modify the 
StreamingFileSink Builder interface to allow for easier subclassing of 
StreamingFileSink 
URL: https://github.com/apache/flink/pull/9581#issuecomment-526712227
 
 
   **Example subclass interface**
   
   ```
   public class CustomizedStreamingFileSink<INT> extends StreamingFileSink<INT> 
{
   
     private CustomizedStreamingFileSink(
       final BulkFormatBuilder<INT, ?, ?> bucketsBuilder, final long 
bucketCheckInterval) {
       super(bucketsBuilder, bucketCheckInterval);
       ...
     }
   
     // Retrieve a new bulk format builder 
     public static <INT> StreamingFileSink.BulkFormatBuilder<INT, String,
         ? extends CustomizedBulkFormatBuilder<INT, String, ?>> 
forBulkFormat(Path basePath, Factory<INT> writerFactory) {
       ...
       return new CustomizedBulkFormatBuilder(...)
     }
   
     .
     .
     .
   
     public static class CustomizedBulkFormatBuilder<INT, BucketIDT, TT extends 
CustomizedBulkFormatBuilder<INT, BucketIDT, TT>> extends 
StreamingFileSink.BulkFormatBuilder<INT, BucketIDT, TT> {
       public CustomizedBulkFormatBuilder(
           Path basePath, Factory<INT> writerFactory, BucketAssigner<INT, 
BucketIDT> assigner) {
         super(basePath, writerFactory, assigner);
       }
   
       public CustomizedStreamingFileSink<INT> build() {
         return new CustomizedStreamingFileSink(this, bucketCheckInterval);
       }
     }
   }
   ```
   
   One alternative is to make `private` members in 
`StreamingFileSink.BulkFormatBuilder` (or `StreamingFileSink.RowFormatBuilder`) 
`public` or `protected`, which is more hackish.  
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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