From 871ca7b2de90236d30600888057e92b437735435 Mon Sep 17 00:00:00 2001 From: zouxxyy Date: Tue, 27 Feb 2024 11:09:33 +0800 Subject: [PATCH] move SystemColumns from paimon core to common --- .../src/main/java/org/apache/paimon/schema/SystemColumns.java | 0 .../java/org/apache/paimon/format/orc/OrcReaderFactory.java | 3 ++- .../org/apache/paimon/format/parquet/ParquetReaderFactory.java | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) rename {paimon-core => paimon-common}/src/main/java/org/apache/paimon/schema/SystemColumns.java (100%) diff --git a/paimon-core/src/main/java/org/apache/paimon/schema/SystemColumns.java b/paimon-common/src/main/java/org/apache/paimon/schema/SystemColumns.java similarity index 100% rename from paimon-core/src/main/java/org/apache/paimon/schema/SystemColumns.java rename to paimon-common/src/main/java/org/apache/paimon/schema/SystemColumns.java diff --git a/paimon-format/src/main/java/org/apache/paimon/format/orc/OrcReaderFactory.java b/paimon-format/src/main/java/org/apache/paimon/format/orc/OrcReaderFactory.java index 8d45d6e1f1d50..6b64498b46449 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/orc/OrcReaderFactory.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/orc/OrcReaderFactory.java @@ -30,6 +30,7 @@ import org.apache.paimon.fs.FileIO; import org.apache.paimon.fs.Path; import org.apache.paimon.reader.RecordReader.RecordIterator; +import org.apache.paimon.schema.SystemColumns; import org.apache.paimon.types.DataType; import org.apache.paimon.types.RowType; import org.apache.paimon.utils.IOUtils; @@ -124,7 +125,7 @@ public OrcReaderBatch createReaderBatch( for (int i = 0; i < vectors.length; i++) { String name = tableFieldNames.get(i); DataType type = tableFieldTypes.get(i); - if ("_ROW_POSITION".equals(name)) { + if (name.equals(SystemColumns.ROW_POSITION)) { vectors[i] = new OrcRowPositionColumnVector( orcBatch.cols[tableFieldNames.indexOf(name)]); diff --git a/paimon-format/src/main/java/org/apache/paimon/format/parquet/ParquetReaderFactory.java b/paimon-format/src/main/java/org/apache/paimon/format/parquet/ParquetReaderFactory.java index 05750842407bb..e76f0082840a4 100644 --- a/paimon-format/src/main/java/org/apache/paimon/format/parquet/ParquetReaderFactory.java +++ b/paimon-format/src/main/java/org/apache/paimon/format/parquet/ParquetReaderFactory.java @@ -34,6 +34,7 @@ import org.apache.paimon.options.Options; import org.apache.paimon.reader.RecordReader; import org.apache.paimon.reader.RecordReader.RecordIterator; +import org.apache.paimon.schema.SystemColumns; import org.apache.paimon.types.DataType; import org.apache.paimon.types.RowType; import org.apache.paimon.utils.Pool; @@ -139,7 +140,7 @@ private MessageType clipParquetSchema(GroupType parquetSchema) { Type[] types = new Type[projectedFields.length]; for (int i = 0; i < projectedFields.length; ++i) { String fieldName = projectedFields[i]; - if (fieldName.equals("_ROW_POSITION")) { + if (fieldName.equals(SystemColumns.ROW_POSITION)) { types[i] = ParquetSchemaConverter.convertToParquetType(fieldName, projectedTypes[i]); } else if (!parquetSchema.containsField(fieldName)) {