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 926ffb1df1 [api] Fix VectorType#isPrunedFrom to compare vector length
(#8812)
926ffb1df1 is described below
commit 926ffb1df1d9f9c171fcbc6b05ed07b6cfb47e4f
Author: Eunbin Son <[email protected]>
AuthorDate: Thu Jul 23 19:33:25 2026 +0900
[api] Fix VectorType#isPrunedFrom to compare vector length (#8812)
---
.../src/main/java/org/apache/paimon/types/VectorType.java | 2 +-
.../test/java/org/apache/paimon/types/VectorTypeTest.java | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/paimon-api/src/main/java/org/apache/paimon/types/VectorType.java
b/paimon-api/src/main/java/org/apache/paimon/types/VectorType.java
index 008b6f8abf..a3ea840c61 100644
--- a/paimon-api/src/main/java/org/apache/paimon/types/VectorType.java
+++ b/paimon-api/src/main/java/org/apache/paimon/types/VectorType.java
@@ -163,7 +163,7 @@ public class VectorType extends DataType {
return false;
}
VectorType vectorType = (VectorType) o;
- return elementType.isPrunedFrom(vectorType.elementType);
+ return elementType.isPrunedFrom(vectorType.elementType) && length ==
vectorType.length;
}
@Override
diff --git
a/paimon-api/src/test/java/org/apache/paimon/types/VectorTypeTest.java
b/paimon-api/src/test/java/org/apache/paimon/types/VectorTypeTest.java
index 9153d254b8..4e1f1e4414 100644
--- a/paimon-api/src/test/java/org/apache/paimon/types/VectorTypeTest.java
+++ b/paimon-api/src/test/java/org/apache/paimon/types/VectorTypeTest.java
@@ -38,4 +38,19 @@ class VectorTypeTest {
assertThat(DataTypes.VECTOR(Integer.MAX_VALUE,
DataTypes.DOUBLE()).defaultSize())
.isEqualTo(Integer.MAX_VALUE);
}
+
+ @Test
+ void testIsPrunedFromRejectsDifferentLength() {
+ DataType left = DataTypes.VECTOR(3, DataTypes.FLOAT());
+ DataType right = DataTypes.VECTOR(5, DataTypes.FLOAT());
+ assertThat(left.isPrunedFrom(right)).isFalse();
+ assertThat(right.isPrunedFrom(left)).isFalse();
+ }
+
+ @Test
+ void testIsPrunedFromAcceptsSameElementTypeAndLength() {
+ DataType left = DataTypes.VECTOR(3, DataTypes.FLOAT());
+ DataType right = DataTypes.VECTOR(3, DataTypes.FLOAT());
+ assertThat(left.isPrunedFrom(right)).isTrue();
+ }
}