[ 
https://issues.apache.org/jira/browse/FLINK-9976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16560080#comment-16560080
 ] 

ASF GitHub Bot commented on FLINK-9976:
---------------------------------------

kl0u commented on a change in pull request #6437: [FLINK-9976][streaming] 
Remove unnecessary generic parameters
URL: https://github.com/apache/flink/pull/6437#discussion_r205851780
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/StreamingFileSink.java
 ##########
 @@ -205,33 +205,40 @@ private StreamingFileSink(
                        this.rollingPolicy = 
DefaultRollingPolicy.create().build();
                }
 
+               RowFormatBuilder(
 
 Review comment:
   This constructor can be `private`. Actually also the other constructor could 
be, as it is called by the enclosing class, but if it were to move the builder 
to a different file, then it would have a problem. So I would recommend to make 
the new constructor `private`.

----------------------------------------------------------------
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


> Odd signatures for streaming file sink format builders
> ------------------------------------------------------
>
>                 Key: FLINK-9976
>                 URL: https://issues.apache.org/jira/browse/FLINK-9976
>             Project: Flink
>          Issue Type: Bug
>          Components: Streaming Connectors
>    Affects Versions: 1.6.0
>            Reporter: Chesnay Schepler
>            Assignee: Chesnay Schepler
>            Priority: Major
>              Labels: pull-request-available
>
> There are 2 instances of apparently unnecessary generic parameters in the 
> format builders for the {{StreamingFileSink}}.
> Both these methods have a generic parameter for the BucketID type, however 
> the builder itself already has such a parameter. The methods use unchecked 
> casts to make the types fit, so we should be able to modify the signature to 
> use the builders parameter instead.
> {code}
> public static class RowFormatBuilder<IN, BucketID> extends 
> StreamingFileSink.BucketsBuilder<IN, BucketID> {
> ...
>       public <ID> StreamingFileSink.RowFormatBuilder<IN, ID> 
> withBucketerAndPolicy(final Bucketer<IN, ID> bucketer, final 
> RollingPolicy<IN, ID> policy) {
>               @SuppressWarnings("unchecked")
>               StreamingFileSink.RowFormatBuilder<IN, ID> reInterpreted = 
> (StreamingFileSink.RowFormatBuilder<IN, ID>) this;
>               reInterpreted.bucketer = Preconditions.checkNotNull(bucketer);
>               reInterpreted.rollingPolicy = 
> Preconditions.checkNotNull(policy);
>               return reInterpreted;
>       }
> ...
> {code}
> {code}
> public static class BulkFormatBuilder<IN, BucketID> extends 
> StreamingFileSink.BucketsBuilder<IN, BucketID> {
> ...
>       public <ID> StreamingFileSink.BulkFormatBuilder<IN, ID> 
> withBucketer(Bucketer<IN, ID> bucketer) {
>               @SuppressWarnings("unchecked")
>               StreamingFileSink.BulkFormatBuilder<IN, ID> reInterpreted = 
> (StreamingFileSink.BulkFormatBuilder<IN, ID>) this;
>               reInterpreted.bucketer = Preconditions.checkNotNull(bucketer);
>               return reInterpreted;
>       }
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to