This is an automated email from the ASF dual-hosted git repository.
JingsongLi 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 d5d49952ec [core] Propagate unsupported result when unioning global
index readers (#8740)
d5d49952ec is described below
commit d5d49952ec838852d08346d5c82a97cfe8c62aab
Author: Arnav Balyan <[email protected]>
AuthorDate: Mon Jul 20 09:06:26 2026 +0530
[core] Propagate unsupported result when unioning global index readers
(#8740)
---
.../paimon/globalindex/UnionGlobalIndexReader.java | 2 +-
.../paimon/table/BtreeGlobalIndexTableTest.java | 64 ++++++++++++++++++++++
2 files changed, 65 insertions(+), 1 deletion(-)
diff --git
a/paimon-common/src/main/java/org/apache/paimon/globalindex/UnionGlobalIndexReader.java
b/paimon-common/src/main/java/org/apache/paimon/globalindex/UnionGlobalIndexReader.java
index 81c83076c2..57eb372591 100644
---
a/paimon-common/src/main/java/org/apache/paimon/globalindex/UnionGlobalIndexReader.java
+++
b/paimon-common/src/main/java/org/apache/paimon/globalindex/UnionGlobalIndexReader.java
@@ -187,7 +187,7 @@ public class UnionGlobalIndexReader implements
GlobalIndexReader {
futures) {
Optional<GlobalIndexResult> current =
f.join();
if (!current.isPresent()) {
- continue;
+ return Optional.empty();
}
if (!union.isPresent()) {
union = current;
diff --git
a/paimon-core/src/test/java/org/apache/paimon/table/BtreeGlobalIndexTableTest.java
b/paimon-core/src/test/java/org/apache/paimon/table/BtreeGlobalIndexTableTest.java
index cf4ac40ac8..4e306768c1 100644
---
a/paimon-core/src/test/java/org/apache/paimon/table/BtreeGlobalIndexTableTest.java
+++
b/paimon-core/src/test/java/org/apache/paimon/table/BtreeGlobalIndexTableTest.java
@@ -27,6 +27,7 @@ import org.apache.paimon.globalindex.GlobalIndexCoverage;
import org.apache.paimon.globalindex.GlobalIndexResult;
import org.apache.paimon.globalindex.GlobalIndexScanner;
import org.apache.paimon.globalindex.IndexedSplit;
+import org.apache.paimon.globalindex.btree.BTreeIndexOptions;
import org.apache.paimon.globalindex.sorted.SortedGlobalIndexBuilder;
import org.apache.paimon.index.GlobalIndexMeta;
import org.apache.paimon.index.IndexFileMeta;
@@ -438,6 +439,69 @@ public class BtreeGlobalIndexTableTest extends
DataEvolutionTestBase {
assertThat(rowIds.toRangeList()).containsExactly(new Range(0L,
oldRowCount - 1));
}
+ @Test
+ public void testUnionAcrossRangesWithMixedFallbackAnswers() throws
Exception {
+ write(100L);
+ createIndex("f0");
+
+ appendRows(100, 20100);
+ createIndexIncremental("f0");
+
+ FileStoreTable table = (FileStoreTable) catalog.getTable(identifier());
+
+ long firstRangeSize = 0;
+ long secondRangeSize = 0;
+ for (IndexManifestEntry entry :
table.store().newIndexFileHandler().scanEntries()) {
+ IndexFileMeta file = entry.indexFile();
+ if (!"btree".equals(file.indexType())) {
+ continue;
+ }
+ if (file.globalIndexMeta().rowRangeStart() == 0) {
+ firstRangeSize += file.fileSize();
+ } else {
+ secondRangeSize += file.fileSize();
+ }
+ }
+ assertThat(firstRangeSize).isGreaterThan(0);
+ assertThat(secondRangeSize).isGreaterThan(firstRangeSize);
+
+ long fallbackScanMaxSize = (firstRangeSize + secondRangeSize) / 2;
+ FileStoreTable capped =
+ table.copy(
+ Collections.singletonMap(
+
BTreeIndexOptions.BTREE_INDEX_FALLBACK_SCAN_MAX_SIZE.key(),
+ String.valueOf(fallbackScanMaxSize)));
+
+ Predicate predicate = new
PredicateBuilder(capped.rowType()).lessThan(0, 150);
+ List<String> result = readF1(capped, predicate);
+
+ List<String> expected = new ArrayList<>();
+ for (int i = 0; i < 150; i++) {
+ expected.add("a" + i);
+ }
+ assertThat(result).containsExactlyInAnyOrderElementsOf(expected);
+ }
+
+ private void createIndexIncremental(String fieldName) throws Exception {
+ FileStoreTable table = (FileStoreTable) catalog.getTable(identifier());
+ SortedGlobalIndexBuilder builder =
+ new SortedGlobalIndexBuilder(table,
"btree").withIndexField(fieldName);
+ List<DataSplit> dataSplits =
+ builder.incrementalScan()
+ .map(org.apache.paimon.utils.Pair::getRight)
+ .orElseThrow(
+ () ->
+ new IllegalStateException(
+ "Expected incremental scan
result when building index."));
+ List<CommitMessage> commitMessages = new ArrayList<>();
+ for (DataSplit dataSplit : dataSplits) {
+ commitMessages.addAll(builder.build(dataSplit, ioManager));
+ }
+ try (BatchTableCommit commit =
table.newBatchWriteBuilder().newCommit()) {
+ commit.commit(commitMessages);
+ }
+ }
+
private void createIndex(String fieldName) throws Exception {
createIndex(fieldName, null);
}