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



##########
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) {

Review comment:
       The one way to get the watermark strategy is to generate strategy by 
watermarkExpr in watermarkPushdownSpec, in which the "applyWatermark" is 
useless actually because we always regenerate strategy. And the code now is 
with this style.
   The another way I think better is that since the watermark strategy is in 
the dynamicTableSource now and we can add a function named 
"getWatermarkStrategy" to get it directly. But before I didn't do this plan 
because I think the "get" function should be added to the implement 
SupportsWatermarkPushDown, and it will change the implement's current style and 
cause more widely influence.
   Maybe I'd better do the second way?




-- 
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-unsubscr...@flink.apache.org

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


Reply via email to