This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch release-1.0
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/release-1.0 by this push:
new 3df6b2a004 [core] Fix Add min_partition_stats and max_partition_stats
columns to manifests system table
3df6b2a004 is described below
commit 3df6b2a004f7165b744dc142298a003b42b409f5
Author: JingsongLi <[email protected]>
AuthorDate: Wed Jan 22 15:38:52 2025 +0800
[core] Fix Add min_partition_stats and max_partition_stats columns to
manifests system table
---
docs/content/concepts/system-tables.md | 10 ++++-----
.../apache/paimon/table/system/ManifestsTable.java | 25 +++++++++++-----------
.../paimon/table/system/ManifestsTableTest.java | 4 ++--
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/docs/content/concepts/system-tables.md
b/docs/content/concepts/system-tables.md
index 7ef54b140e..88f1ea58a0 100644
--- a/docs/content/concepts/system-tables.md
+++ b/docs/content/concepts/system-tables.md
@@ -282,8 +282,8 @@ SELECT * FROM my_table$manifests;
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
| file_name | file_size | num_added_files |
num_deleted_files | schema_id | min_partition_stats | max_partition_stats |
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
-| manifest-f4dcab43-ef6b-4713... | 12365| 40 |
0 | 0 | {20230315, 00} | {20230315, 20} |
-| manifest-f4dcab43-ef6b-4713... | 1648 | 1 |
0 | 0 | {20230115, 00} | {20230316, 23} |
+| manifest-f4dcab43-ef6b-4713... | 12365| 40 |
0 | 0 | [20230315, 00] | [20230315, 20] |
+| manifest-f4dcab43-ef6b-4713... | 1648 | 1 |
0 | 0 | [20230115, 00] | [20230316, 23] |
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
2 rows in set
*/
@@ -294,7 +294,7 @@ SELECT * FROM my_table$manifests /*+
OPTIONS('scan.snapshot-id'='1') */;
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
| file_name | file_size | num_added_files |
num_deleted_files | schema_id | min_partition_stats | max_partition_stats |
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
-| manifest-f4dcab43-ef6b-4713... | 12365| 40 |
0 | 0 | {20230315, 00} | {20230315, 20} |
+| manifest-f4dcab43-ef6b-4713... | 12365| 40 |
0 | 0 | [20230315, 00] | [20230315, 20] |
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
1 rows in set
*/
@@ -305,7 +305,7 @@ SELECT * FROM my_table$manifests /*+
OPTIONS('scan.tag-name'='tag1') */;
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
| file_name | file_size | num_added_files |
num_deleted_files | schema_id | min_partition_stats | max_partition_stats |
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
-| manifest-f4dcab43-ef6b-4713... | 12365| 40 |
0 | 0 | {20230315, 00} | {20230315, 20} |
+| manifest-f4dcab43-ef6b-4713... | 12365| 40 |
0 | 0 | [20230315, 00] | [20230315, 20] |
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
1 rows in set
*/
@@ -316,7 +316,7 @@ SELECT * FROM my_table$manifests /*+
OPTIONS('scan.timestamp-millis'='1678883047
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
| file_name | file_size | num_added_files |
num_deleted_files | schema_id | min_partition_stats | max_partition_stats |
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
-| manifest-f4dcab43-ef6b-4713... | 12365| 40 |
0 | 0 | {20230315, 00} | {20230315, 20} |
+| manifest-f4dcab43-ef6b-4713... | 12365| 40 |
0 | 0 | [20230315, 00] | [20230315, 20] |
+--------------------------------+-------------+------------------+-------------------+---------------+---------------------+---------------------+
1 rows in set
*/
diff --git
a/paimon-core/src/main/java/org/apache/paimon/table/system/ManifestsTable.java
b/paimon-core/src/main/java/org/apache/paimon/table/system/ManifestsTable.java
index 4b3ddf30ce..a205db7dac 100644
---
a/paimon-core/src/main/java/org/apache/paimon/table/system/ManifestsTable.java
+++
b/paimon-core/src/main/java/org/apache/paimon/table/system/ManifestsTable.java
@@ -20,8 +20,6 @@ package org.apache.paimon.table.system;
import org.apache.paimon.CoreOptions;
import org.apache.paimon.Snapshot;
-import org.apache.paimon.casting.CastExecutor;
-import org.apache.paimon.casting.CastExecutors;
import org.apache.paimon.data.BinaryString;
import org.apache.paimon.data.GenericRow;
import org.apache.paimon.data.InternalRow;
@@ -46,6 +44,7 @@ import org.apache.paimon.types.RowType;
import org.apache.paimon.utils.FileStorePathFactory;
import org.apache.paimon.utils.IteratorRecordReader;
import org.apache.paimon.utils.ProjectedRow;
+import org.apache.paimon.utils.RowDataToObjectArrayConverter;
import org.apache.paimon.utils.SerializationUtils;
import org.apache.paimon.shade.guava30.com.google.common.collect.Iterators;
@@ -58,6 +57,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.function.Function;
import static org.apache.paimon.catalog.Catalog.SYSTEM_TABLE_SPLITTER;
@@ -186,16 +186,17 @@ public class ManifestsTable implements ReadonlyTable {
}
List<ManifestFileMeta> manifestFileMetas = allManifests(dataTable);
- @SuppressWarnings("unchecked")
- CastExecutor<InternalRow, BinaryString> partitionCastExecutor =
- (CastExecutor<InternalRow, BinaryString>)
- CastExecutors.resolveToString(
- dataTable.schema().logicalPartitionType());
+ RowDataToObjectArrayConverter partRowConverter =
+ new
RowDataToObjectArrayConverter(dataTable.schema().logicalPartitionType());
+
+ Function<InternalRow, BinaryString> partConverter =
+ part ->
+ BinaryString.fromString(
+
Arrays.toString(partRowConverter.convert(part)));
Iterator<InternalRow> rows =
Iterators.transform(
- manifestFileMetas.iterator(),
- meta -> toRow(meta, partitionCastExecutor));
+ manifestFileMetas.iterator(), meta -> toRow(meta,
partConverter));
if (readType != null) {
rows =
Iterators.transform(
@@ -209,15 +210,15 @@ public class ManifestsTable implements ReadonlyTable {
private InternalRow toRow(
ManifestFileMeta manifestFileMeta,
- CastExecutor<InternalRow, BinaryString> partitionCastExecutor)
{
+ Function<InternalRow, BinaryString> partitionCastExecutor) {
return GenericRow.of(
BinaryString.fromString(manifestFileMeta.fileName()),
manifestFileMeta.fileSize(),
manifestFileMeta.numAddedFiles(),
manifestFileMeta.numDeletedFiles(),
manifestFileMeta.schemaId(),
-
partitionCastExecutor.cast(manifestFileMeta.partitionStats().minValues()),
-
partitionCastExecutor.cast(manifestFileMeta.partitionStats().maxValues()));
+
partitionCastExecutor.apply(manifestFileMeta.partitionStats().minValues()),
+
partitionCastExecutor.apply(manifestFileMeta.partitionStats().maxValues()));
}
}
diff --git
a/paimon-core/src/test/java/org/apache/paimon/table/system/ManifestsTableTest.java
b/paimon-core/src/test/java/org/apache/paimon/table/system/ManifestsTableTest.java
index f375dfd2c8..5c92704735 100644
---
a/paimon-core/src/test/java/org/apache/paimon/table/system/ManifestsTableTest.java
+++
b/paimon-core/src/test/java/org/apache/paimon/table/system/ManifestsTableTest.java
@@ -180,14 +180,14 @@ public class ManifestsTableTest extends TableTestBase {
manifestFileMeta.schemaId(),
BinaryString.fromString(
String.format(
- "{%d}",
+ "[%d]",
manifestFileMeta
.partitionStats()
.minValues()
.getInt(0))),
BinaryString.fromString(
String.format(
- "{%d}",
+ "[%d]",
manifestFileMeta
.partitionStats()
.maxValues()