From 8a89649cecb2e9c886e97cf7ef4a9baf4f1a0a7a Mon Sep 17 00:00:00 2001 From: "ranxianglei.rxl" Date: Tue, 15 Oct 2024 16:09:59 +0800 Subject: [PATCH] [format][orc] remove all isRepeating --- .../format/orc/reader/AbstractOrcColumnVector.java | 2 +- .../paimon/format/orc/reader/OrcBytesColumnVector.java | 5 ++--- .../format/orc/reader/OrcDecimalColumnVector.java | 3 +-- .../format/orc/reader/OrcDoubleColumnVector.java | 4 ++-- .../orc/reader/OrcLegacyTimestampColumnVector.java | 3 +-- .../paimon/format/orc/reader/OrcLongColumnVector.java | 10 +++++----- .../format/orc/reader/OrcTimestampColumnVector.java | 3 +-- 7 files changed, 13 insertions(+), 17 deletions(-) diff --git a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/AbstractOrcColumnVector.java b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/AbstractOrcColumnVector.java index 377ff37a2e68..0557a72230cc 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/AbstractOrcColumnVector.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/AbstractOrcColumnVector.java @@ -57,7 +57,7 @@ protected int rowMapper(int r) { @Override public boolean isNullAt(int i) { - return !vector.noNulls && vector.isNull[vector.isRepeating ? 0 : i]; + return !vector.noNulls && vector.isNull[rowMapper(i)]; } public static org.apache.paimon.data.columnar.ColumnVector createPaimonVector( diff --git a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcBytesColumnVector.java b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcBytesColumnVector.java index 92b4853aaae4..7f812bb5628b 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcBytesColumnVector.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcBytesColumnVector.java @@ -34,11 +34,10 @@ public OrcBytesColumnVector(BytesColumnVector vector, VectorizedRowBatch orcBatc @Override public Bytes getBytes(int i) { - int rowId = vector.isRepeating ? 0 : i; - int selectedRowId = rowMapper(rowId); + int rowId = rowMapper(i); byte[][] data = vector.vector; int[] start = vector.start; int[] length = vector.length; - return new Bytes(data[selectedRowId], start[selectedRowId], length[selectedRowId]); + return new Bytes(data[rowId], start[rowId], length[rowId]); } } diff --git a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcDecimalColumnVector.java b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcDecimalColumnVector.java index c8545723caf0..382c19f45be1 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcDecimalColumnVector.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcDecimalColumnVector.java @@ -41,8 +41,7 @@ public OrcDecimalColumnVector(DecimalColumnVector vector, VectorizedRowBatch orc @Override public Decimal getDecimal(int i, int precision, int scale) { i = rowMapper(i); - BigDecimal data = - vector.vector[vector.isRepeating ? 0 : i].getHiveDecimal().bigDecimalValue(); + BigDecimal data = vector.vector[i].getHiveDecimal().bigDecimalValue(); return Decimal.fromBigDecimal(data, precision, scale); } } diff --git a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcDoubleColumnVector.java b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcDoubleColumnVector.java index 3e19b137a222..f26dac6de9da 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcDoubleColumnVector.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcDoubleColumnVector.java @@ -39,12 +39,12 @@ public OrcDoubleColumnVector(DoubleColumnVector vector, VectorizedRowBatch orcBa @Override public double getDouble(int i) { i = rowMapper(i); - return vector.vector[vector.isRepeating ? 0 : i]; + return vector.vector[i]; } @Override public float getFloat(int i) { i = rowMapper(i); - return (float) vector.vector[vector.isRepeating ? 0 : i]; + return (float) vector.vector[i]; } } diff --git a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcLegacyTimestampColumnVector.java b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcLegacyTimestampColumnVector.java index eb3e014f2fcf..5107e722edb4 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcLegacyTimestampColumnVector.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcLegacyTimestampColumnVector.java @@ -43,8 +43,7 @@ public class OrcLegacyTimestampColumnVector extends AbstractOrcColumnVector @Override public Timestamp getTimestamp(int i, int precision) { i = rowMapper(i); - int index = hiveVector.isRepeating ? 0 : i; - java.sql.Timestamp timestamp = toTimestamp(hiveVector.vector[index]); + java.sql.Timestamp timestamp = toTimestamp(hiveVector.vector[i]); return Timestamp.fromSQLTimestamp(timestamp); } diff --git a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcLongColumnVector.java b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcLongColumnVector.java index 76c1c198d21d..c289b74c58b2 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcLongColumnVector.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcLongColumnVector.java @@ -42,30 +42,30 @@ public OrcLongColumnVector(LongColumnVector vector, VectorizedRowBatch orcBatch) @Override public long getLong(int i) { i = rowMapper(i); - return vector.vector[vector.isRepeating ? 0 : i]; + return vector.vector[i]; } @Override public boolean getBoolean(int i) { i = rowMapper(i); - return vector.vector[vector.isRepeating ? 0 : i] == 1; + return vector.vector[i] == 1; } @Override public byte getByte(int i) { i = rowMapper(i); - return (byte) vector.vector[vector.isRepeating ? 0 : i]; + return (byte) vector.vector[i]; } @Override public int getInt(int i) { i = rowMapper(i); - return (int) vector.vector[vector.isRepeating ? 0 : i]; + return (int) vector.vector[i]; } @Override public short getShort(int i) { i = rowMapper(i); - return (short) vector.vector[vector.isRepeating ? 0 : i]; + return (short) vector.vector[i]; } } diff --git a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcTimestampColumnVector.java b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcTimestampColumnVector.java index 8840a02a8c83..a6e71d6016f2 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcTimestampColumnVector.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/orc/reader/OrcTimestampColumnVector.java @@ -42,7 +42,6 @@ public OrcTimestampColumnVector(ColumnVector vector, VectorizedRowBatch orcBatch @Override public Timestamp getTimestamp(int i, int precision) { i = rowMapper(i); - int index = vector.isRepeating ? 0 : i; - return DateTimeUtils.toInternal(vector.time[index], vector.nanos[index] % 1_000_000); + return DateTimeUtils.toInternal(vector.time[i], vector.nanos[i] % 1_000_000); } }