diff --git a/lakesoul-flink/pom.xml b/lakesoul-flink/pom.xml
index ab4a469c5..58b174103 100644
--- a/lakesoul-flink/pom.xml
+++ b/lakesoul-flink/pom.xml
@@ -443,6 +443,8 @@ SPDX-License-Identifier: Apache-2.0
com.google.code.gson:gson
dev.failsafe:failsafe
com.google.protobuf:protobuf-java
+
+ io.substrait:core
org.apache.logging.log4j:*
diff --git a/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulLookupTableSource.java b/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulLookupTableSource.java
index da5816bf5..964dac8ed 100644
--- a/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulLookupTableSource.java
+++ b/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulLookupTableSource.java
@@ -234,6 +234,7 @@ public DynamicTableSource copy() {
this.optionParams);
lsts.projectedFields = this.projectedFields;
lsts.remainingPartitions = this.remainingPartitions;
+ lsts._filterPredicate = this._filterPredicate;
lsts.filter = this.filter;
return lsts;
}
diff --git a/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulOneSplitRecordsReader.java b/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulOneSplitRecordsReader.java
index 95997600b..a40adea13 100644
--- a/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulOneSplitRecordsReader.java
+++ b/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulOneSplitRecordsReader.java
@@ -6,6 +6,7 @@
import com.dmetasoul.lakesoul.LakeSoulArrowReader;
import com.dmetasoul.lakesoul.lakesoul.io.NativeIOReader;
+import io.substrait.proto.Plan;
import org.apache.arrow.vector.FieldVector;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.types.pojo.Schema;
@@ -73,7 +74,8 @@ public class LakeSoulOneSplitRecordsReader implements RecordsWithSplitIds row, with requested schema
private ArrowReader curArrowReaderRequestedSchema;
- private final FilterPredicate filter;
+ private final FilterPredicate _filterPredicate;
+ private final Plan filter;
public LakeSoulOneSplitRecordsReader(Configuration conf,
LakeSoulSplit split,
@@ -82,7 +84,8 @@ public LakeSoulOneSplitRecordsReader(Configuration conf,
List pkColumns,
boolean isStreaming,
String cdcColumn,
- FilterPredicate filter)
+ FilterPredicate _filterPredicate,
+ Plan filter)
throws Exception {
this.split = split;
this.skipRecords = split.getSkipRecord();
@@ -94,6 +97,7 @@ public LakeSoulOneSplitRecordsReader(Configuration conf,
this.isStreaming = isStreaming;
this.cdcColumn = cdcColumn;
this.finishedSplit = Collections.singleton(splitId);
+ this._filterPredicate = _filterPredicate;
this.filter = filter;
initializeReader();
recoverFromSkipRecord();
@@ -129,7 +133,11 @@ private void initializeReader() throws IOException {
}
if (filter != null) {
- reader.addFilter(filter.toString());
+ reader.addFilterProto(this.filter);
+ }
+
+ if (_filterPredicate !=null) {
+ reader.addFilter(_filterPredicate.toString());
}
LOG.info("Initializing reader for split {}, pk={}, partitions={}," +
diff --git a/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulSource.java b/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulSource.java
index 6f10d9bee..cd4ba7c1f 100644
--- a/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulSource.java
+++ b/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulSource.java
@@ -9,6 +9,7 @@
import com.dmetasoul.lakesoul.meta.DataOperation;
import com.dmetasoul.lakesoul.meta.LakeSoulOptions;
import com.dmetasoul.lakesoul.meta.entity.TableInfo;
+import io.substrait.proto.Plan;
import org.apache.flink.api.connector.source.*;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.core.fs.Path;
@@ -43,7 +44,9 @@ public class LakeSoulSource implements Source> remainingPartitions;
@Nullable
- FilterPredicate filter;
+ FilterPredicate _filterPredicate;
+ @Nullable
+ Plan filter;
public LakeSoulSource(TableId tableId,
RowType rowType,
@@ -52,7 +55,8 @@ public LakeSoulSource(TableId tableId,
List pkColumns,
Map optionParams,
@Nullable List