sebastianliu commented on a change in pull request #82:
URL: https://github.com/apache/bahir-flink/pull/82#discussion_r438062144
##########
File path:
flink-connector-kudu/src/main/java/org/apache/flink/connectors/kudu/table/KuduTableSource.java
##########
@@ -109,12 +156,167 @@ public boolean isLimitPushedDown() {
for (int i = 0; i < ints.length; i++) {
fieldNames[i] = prevFieldNames.get(ints[i]);
}
- return new KuduTableSource(configBuilder, tableInfo, flinkSchema,
fieldNames);
+ return new KuduTableSource(configBuilder, tableInfo, flinkSchema,
predicates, fieldNames);
+ }
+
+ @Override
+ public TableSource<Row> applyPredicate(List<Expression> predicates) {
+ // try to convert Flink filter expressions to Kudu Filter Info
+ List<KuduFilterInfo> kuduPredicates = new
ArrayList<>(predicates.size());
+ List<Expression> unsupportedExpressions = new
ArrayList<>(predicates.size());
+ for (Expression pred : predicates) {
+ KuduFilterInfo kuduPred = toKuduFilterInfo(pred);
+ if (kuduPred != null) {
+ LOG.info("Predicate [{}] converted into KuduFilterInfo [{}]
and pushed into " +
+ "KuduTable [{}].", pred, kuduPred, tableInfo.getName());
+ kuduPredicates.add(kuduPred);
+ } else {
+ unsupportedExpressions.add(pred);
+ LOG.info("Predicate [{}] could not be pushed into
KuduFilterInfo for KuduTable [{}].",
+ pred, tableInfo.getName());
+ }
+ }
+ // update list of Flink expressions to unsupported expressions
+ predicates.clear();
+ predicates.addAll(unsupportedExpressions);
+ return new KuduTableSource(configBuilder, tableInfo, flinkSchema,
kuduPredicates, projectedFields);
+ }
+
+ /**
+ * Converts Flink Expression to KuduFilterInfo.
+ */
+ @Nullable
+ private KuduFilterInfo toKuduFilterInfo(Expression predicate) {
Review comment:
done
----------------------------------------------------------------
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:
[email protected]