spuru9 commented on code in PR #28556:
URL: https://github.com/apache/flink/pull/28556#discussion_r3485713216
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/rules/logical/MetadataFilterResultShapesITCase.java:
##########
@@ -302,4 +375,64 @@ public ScanRuntimeProvider
getScanRuntimeProvider(ScanContext runtimeProviderCon
return SourceProvider.of(source);
}
}
+
+ /**
+ * Source that supports both physical and metadata filter push-down.
Accepts all filters it
+ * receives, emits all rows (runtime Calc is the load-bearing filter for
remaining predicates).
+ */
+ static class MixedFilterTrackingSource extends
TableFactoryHarness.ScanSourceBase
+ implements SupportsReadingMetadata, SupportsFilterPushDown {
+
+ private DataType producedDataType;
+ private List<ResolvedExpression> acceptedPhysicalFilters = new
ArrayList<>();
+
+ MixedFilterTrackingSource() {
+ super(true);
+ }
+
+ @Override
+ public Map<String, DataType> listReadableMetadata() {
+ Map<String, DataType> metadata = new LinkedHashMap<>();
+ metadata.put("m0", INT());
+ metadata.put("m1", INT());
+ return metadata;
+ }
+
+ @Override
+ public void applyReadableMetadata(List<String> metadataKeys, DataType
producedDataType) {
+ this.producedDataType = producedDataType;
+ }
+
+ @Override
+ public boolean supportsMetadataFilterPushDown() {
+ return true;
+ }
+
+ @Override
+ public MetadataFilterResult
applyMetadataFilters(List<ResolvedExpression> metadataFilters) {
+ return MetadataFilterResult.of(metadataFilters,
Collections.emptyList());
+ }
+
+ @Override
+ public Result applyFilters(List<ResolvedExpression> filters) {
+ acceptedPhysicalFilters.addAll(filters);
+ return Result.of(Collections.emptyList(), filters);
+ }
Review Comment:
Can be simplified and the initisialisation of array dropped?
```suggestion
@Override
public Result applyFilters(List<ResolvedExpression> filters) {
return Result.of(Collections.emptyList(), filters);
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]