This is an automated email from the ASF dual-hosted git repository.
junhao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 4f7860c713 [hotfix] fix format table read filter bug (#6382)
4f7860c713 is described below
commit 4f7860c7139c3cda883b9afe8c7c9e86b99abf66
Author: jerry <[email protected]>
AuthorDate: Sat Oct 11 14:53:08 2025 +0800
[hotfix] fix format table read filter bug (#6382)
---
.../java/org/apache/paimon/table/format/FormatReadBuilder.java | 2 +-
.../java/org/apache/paimon/table/format/FormatTableRead.java | 10 ++++++++--
.../test/java/org/apache/paimon/catalog/CatalogTestBase.java | 4 ++--
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/table/format/FormatReadBuilder.java
b/paimon-core/src/main/java/org/apache/paimon/table/format/FormatReadBuilder.java
index c86559ff04..95df280d9d 100644
---
a/paimon-core/src/main/java/org/apache/paimon/table/format/FormatReadBuilder.java
+++
b/paimon-core/src/main/java/org/apache/paimon/table/format/FormatReadBuilder.java
@@ -151,7 +151,7 @@ public class FormatReadBuilder implements ReadBuilder {
@Override
public TableRead newRead() {
- return new FormatTableRead(readType(), this, filter, limit);
+ return new FormatTableRead(readType(), table.rowType(), this, filter,
limit);
}
protected RecordReader<InternalRow> createReader(FormatDataSplit
dataSplit) throws IOException {
diff --git
a/paimon-core/src/main/java/org/apache/paimon/table/format/FormatTableRead.java
b/paimon-core/src/main/java/org/apache/paimon/table/format/FormatTableRead.java
index c0610231aa..5406d0c1bf 100644
---
a/paimon-core/src/main/java/org/apache/paimon/table/format/FormatTableRead.java
+++
b/paimon-core/src/main/java/org/apache/paimon/table/format/FormatTableRead.java
@@ -37,6 +37,7 @@ import java.util.concurrent.atomic.AtomicLong;
public class FormatTableRead implements TableRead {
private final RowType readType;
+ private final RowType tableRowType;
private final Predicate predicate;
private final FormatReadBuilder read;
private final Integer limit;
@@ -44,7 +45,12 @@ public class FormatTableRead implements TableRead {
private boolean executeFilter = false;
public FormatTableRead(
- RowType readType, FormatReadBuilder read, Predicate predicate,
Integer limit) {
+ RowType readType,
+ RowType tableRowType,
+ FormatReadBuilder read,
+ Predicate predicate,
+ Integer limit) {
+ this.tableRowType = tableRowType;
this.readType = readType;
this.read = read;
this.predicate = predicate;
@@ -88,7 +94,7 @@ public class FormatTableRead implements TableRead {
Predicate predicate = this.predicate;
if (readType != null) {
- int[] projection =
readType.getFieldIndices(readType.getFieldNames());
+ int[] projection =
tableRowType.getFieldIndices(readType.getFieldNames());
Optional<Predicate> optional =
predicate.visit(new
PredicateProjectionConverter(projection));
if (!optional.isPresent()) {
diff --git
a/paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java
b/paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java
index c8a540319d..a515e96ae0 100644
--- a/paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java
+++ b/paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java
@@ -651,8 +651,8 @@ public abstract class CatalogTestBase {
catalog.createTable(identifier, schemaBuilder.build(), true);
FormatTable table = (FormatTable) catalog.getTable(identifier);
int[] projection = new int[] {1, 2};
- PredicateBuilder builder = new
PredicateBuilder(table.rowType().project(projection));
- Predicate predicate = builder.greaterOrEqual(0, 10);
+ PredicateBuilder builder = new PredicateBuilder(table.rowType());
+ Predicate predicate = builder.greaterOrEqual(1, 10);
int size = 2000;
int checkSize = 3;
InternalRow[] datas = new InternalRow[size];