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 72f96f9a2e [hive] Do not filter a whole-table read of a foreign Hive 
location by its path (#10663)
72f96f9a2e is described below

commit 72f96f9a2ee6325f8fb65ed1b89f1dd390e9c63e
Author: YangJie <[email protected]>
AuthorDate: Thu Oct 22 07:01:57 2026 -0400

    [hive] Do not filter a whole-table read of a foreign Hive location by its 
path (#10663)
---
 .../java/org/apache/paimon/hive/utils/HiveSplitGenerator.java    | 9 ++++++++-
 .../test/java/org/apache/paimon/hive/HiveSplitGeneratorTest.java | 5 +++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git 
a/paimon-hive/paimon-hive-connector-common/src/main/java/org/apache/paimon/hive/utils/HiveSplitGenerator.java
 
b/paimon-hive/paimon-hive-connector-common/src/main/java/org/apache/paimon/hive/utils/HiveSplitGenerator.java
index ea3ea52b5f..04d5aec799 100644
--- 
a/paimon-hive/paimon-hive-connector-common/src/main/java/org/apache/paimon/hive/utils/HiveSplitGenerator.java
+++ 
b/paimon-hive/paimon-hive-connector-common/src/main/java/org/apache/paimon/hive/utils/HiveSplitGenerator.java
@@ -87,7 +87,14 @@ public class HiveSplitGenerator {
         // locations may contain multiple partitions
         for (String location : locationsToPlan(table, jobConf, locations)) {
             InnerTableScan scan;
-            if (tagToPartField != null) {
+            if (!location.startsWith(table.location().toString())) {
+                // The Hive location of the whole table, see locationsToPlan. 
It is not under the
+                // paimon location, so its path names no partition or tag.
+                scan = table.newScan();
+                if (predicates.size() > 0) {
+                    scan.withFilter(PredicateBuilder.and(predicates));
+                }
+            } else if (tagToPartField != null) {
                 // the location should be pruned by partition predicate
                 // we can extract tag name from location, and use time travel 
to scan
                 String tag = extractTagName(location, tagToPartField);
diff --git 
a/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveSplitGeneratorTest.java
 
b/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveSplitGeneratorTest.java
index 73ba93682c..7c6e56aaba 100644
--- 
a/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveSplitGeneratorTest.java
+++ 
b/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveSplitGeneratorTest.java
@@ -192,6 +192,11 @@ public class HiveSplitGeneratorTest {
         jobConf.setBoolean(HiveSplitGenerator.HIVE_PARTITIONED, false);
         assertThat(HiveSplitGenerator.generateSplits(table, jobConf, 
1)).hasSize(2);
 
+        // A warehouse path that happens to look like a partition does not 
filter the table.
+        jobConf.set(FileInputFormat.INPUT_DIR, "/hive/" + PLAIN_PARTITION_DIR 
+ "/warehouse/t");
+        assertThat(HiveSplitGenerator.generateSplits(table, jobConf, 
1)).hasSize(2);
+        jobConf.set(FileInputFormat.INPUT_DIR, 
"/hive/warehouse/somewhere-else");
+
         // All Hive partitions share that location, which names no partition. 
Planning it would
         // read every partition once for each Hive partition. Hive decides 
this, not the
         // metastore.partitioned-table option, which a session can override.

Reply via email to