From d0e4debb31c5ca1ec34f0f43649174e32c8085a9 Mon Sep 17 00:00:00 2001 From: WenjunMin Date: Wed, 25 Dec 2024 08:24:30 +0800 Subject: [PATCH] [core] optimize the binlog table read performance (#4773) --- .../org/apache/paimon/table/system/BinlogTable.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/table/system/BinlogTable.java b/paimon-core/src/main/java/org/apache/paimon/table/system/BinlogTable.java index 08eea468ea70..eafd37f1d717 100644 --- a/paimon-core/src/main/java/org/apache/paimon/table/system/BinlogTable.java +++ b/paimon-core/src/main/java/org/apache/paimon/table/system/BinlogTable.java @@ -110,14 +110,14 @@ public InnerTableRead withReadType(RowType readType) { @Override public RecordReader createReader(Split split) throws IOException { DataSplit dataSplit = (DataSplit) split; + InternalRow.FieldGetter[] fieldGetters = wrapped.rowType().fieldGetters(); + if (dataSplit.isStreaming()) { return new PackChangelogReader( dataRead.createReader(split), (row1, row2) -> new AuditLogRow( - readProjection, - convertToArray( - row1, row2, wrapped.rowType().fieldGetters())), + readProjection, convertToArray(row1, row2, fieldGetters)), wrapped.rowType()); } else { return dataRead.createReader(split) @@ -125,10 +125,7 @@ public RecordReader createReader(Split split) throws IOException { (row) -> new AuditLogRow( readProjection, - convertToArray( - row, - null, - wrapped.rowType().fieldGetters()))); + convertToArray(row, null, fieldGetters))); } }