This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 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 4e457ba30 [core] disable streaming read of ReadOptimizedTable which
has primary-key. (#4192)
4e457ba30 is described below
commit 4e457ba30646148e5b150d646243baff8adbc9d8
Author: liming.1018 <[email protected]>
AuthorDate: Tue Sep 17 17:51:47 2024 +0800
[core] disable streaming read of ReadOptimizedTable which has primary-key.
(#4192)
---
.../paimon/table/system/ReadOptimizedTable.java | 4 ++++
.../paimon/table/PrimaryKeyFileStoreTableTest.java | 28 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/table/system/ReadOptimizedTable.java
b/paimon-core/src/main/java/org/apache/paimon/table/system/ReadOptimizedTable.java
index 4b1ad4b7f..e28ae3760 100644
---
a/paimon-core/src/main/java/org/apache/paimon/table/system/ReadOptimizedTable.java
+++
b/paimon-core/src/main/java/org/apache/paimon/table/system/ReadOptimizedTable.java
@@ -137,6 +137,10 @@ public class ReadOptimizedTable implements DataTable,
ReadonlyTable {
@Override
public StreamDataTableScan newStreamScan() {
+ if (wrapped.schema().primaryKeys().size() > 0) {
+ throw new UnsupportedOperationException(
+ "Unsupported streaming scan for read optimized table");
+ }
return new DataTableStreamScan(
coreOptions(),
newSnapshotReader(),
diff --git
a/paimon-core/src/test/java/org/apache/paimon/table/PrimaryKeyFileStoreTableTest.java
b/paimon-core/src/test/java/org/apache/paimon/table/PrimaryKeyFileStoreTableTest.java
index 47e46fba1..ab79019d1 100644
---
a/paimon-core/src/test/java/org/apache/paimon/table/PrimaryKeyFileStoreTableTest.java
+++
b/paimon-core/src/test/java/org/apache/paimon/table/PrimaryKeyFileStoreTableTest.java
@@ -1380,6 +1380,34 @@ public class PrimaryKeyFileStoreTableTest extends
FileStoreTableTestBase {
commit.close();
}
+ @Test
+ public void testStreamingReadOptimizedTable() throws Exception {
+ FileStoreTable table =
+ createFileStoreTable(options -> options.set(TARGET_FILE_SIZE,
new MemorySize(1)));
+ StreamTableWrite write = table.newWrite(commitUser);
+ StreamTableCommit commit = table.newCommit(commitUser);
+
+ write.write(rowDataWithKind(RowKind.INSERT, 1, 10, 100L));
+ write.compact(binaryRow(1), 0, true);
+ commit.commit(0, write.prepareCommit(true, 0));
+
+ ReadOptimizedTable roTable = new ReadOptimizedTable(table);
+ Function<InternalRow, String> rowDataToString =
+ row ->
+ internalRowToString(
+ row,
+ DataTypes.ROW(
+ DataTypes.INT(), DataTypes.INT(),
DataTypes.BIGINT()));
+
+ TableRead read = roTable.newRead();
+ List<String> result = getResult(read,
roTable.newScan().plan().splits(), rowDataToString);
+ assertThat(result).containsExactlyInAnyOrder("+I[1, 10, 100]");
+
+ assertThatThrownBy(roTable::newStreamScan)
+ .isInstanceOf(UnsupportedOperationException.class)
+ .hasMessage("Unsupported streaming scan for read optimized
table");
+ }
+
@Test
public void testReadDeletionVectorTable() throws Exception {
FileStoreTable table =