You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/10/25 01:52:53 UTC

[GitHub] [flink] xuyangzhong commented on a change in pull request #17537: [FLINK-19722][table-planner]Pushdown Watermark to SourceProvider (new Source)

xuyangzhong commented on a change in pull request #17537:
URL: https://github.com/apache/flink/pull/17537#discussion_r735210503



##########
File path: flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecTableSourceScan.java
##########
@@ -97,9 +104,40 @@ public DynamicTableSourceSpec getTableSourceSpec() {
             return createInputFormatTransformation(env, inputFormat, outputTypeInfo, operatorName);
         } else if (provider instanceof SourceProvider) {
             Source<RowData, ?, ?> source = ((SourceProvider) provider).createSource();
-            // TODO: Push down watermark strategy to source scan
-            return env.fromSource(
-                            source, WatermarkStrategy.noWatermarks(), operatorName, outputTypeInfo)
+            // don't use rowTypes from CatalogTable
+            // because the rowType number may be reduced by ProjectionPushDown
+            RowType sourceRowType = outputTypeInfo.toRowType();
+            SourceAbilityContext sourceAbilityContext =
+                    new SourceAbilityContext(planner.getFlinkContext(), sourceRowType);
+
+            WatermarkStrategy<RowData> watermarkStrategy = null;
+
+            if (tableSource instanceof SupportsWatermarkPushDown) {
+                for (SourceAbilitySpec sourceAbilitySpec :
+                        tableSourceSpec.getSourceAbilitySpecs()) {

Review comment:
       The 'sourceAbilitySpecs' is nullable. So I think only using Preconditions.checkNotNull is not enough. I will add a condition in "if" here: "&& tableSourceSpec.getSourceAbilitySpecs() != null" .




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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org