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 cc4548c6e4 [core] change Float to float to simplify the topk index 
module (#6791)
cc4548c6e4 is described below

commit cc4548c6e493cfcbb2e5fc178ac6d4cf8ea2e435
Author: YeJunHao <[email protected]>
AuthorDate: Wed Dec 10 17:45:59 2025 +0800

    [core] change Float to float to simplify the topk index module (#6791)
---
 .../apache/paimon/globalindex/IndexedSplit.java    | 19 ++++-------
 .../paimon/globalindex/IndexedSplitTest.java       | 37 ++--------------------
 2 files changed, 10 insertions(+), 46 deletions(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/globalindex/IndexedSplit.java 
b/paimon-core/src/main/java/org/apache/paimon/globalindex/IndexedSplit.java
index e14a18fcb9..c0d4b7a363 100644
--- a/paimon-core/src/main/java/org/apache/paimon/globalindex/IndexedSplit.java
+++ b/paimon-core/src/main/java/org/apache/paimon/globalindex/IndexedSplit.java
@@ -44,9 +44,9 @@ public class IndexedSplit implements Split {
 
     private DataSplit split;
     private List<Range> rowRanges;
-    @Nullable private Float[] scores;
+    @Nullable private float[] scores;
 
-    public IndexedSplit(DataSplit split, List<Range> rowRanges, @Nullable 
Float[] scores) {
+    public IndexedSplit(DataSplit split, List<Range> rowRanges, @Nullable 
float[] scores) {
         this.split = split;
         this.rowRanges = rowRanges;
         this.scores = scores;
@@ -61,7 +61,7 @@ public class IndexedSplit implements Split {
     }
 
     @Nullable
-    public Float[] scores() {
+    public float[] scores() {
         return scores;
     }
 
@@ -116,10 +116,7 @@ public class IndexedSplit implements Split {
             out.writeBoolean(true);
             out.writeInt(scores.length);
             for (Float score : scores) {
-                out.writeByte(score == null ? 0 : 1);
-                if (score != null) {
-                    out.writeFloat(score);
-                }
+                out.writeFloat(score);
             }
         } else {
             out.writeBoolean(false);
@@ -143,15 +140,13 @@ public class IndexedSplit implements Split {
             long to = in.readLong();
             rowRanges.add(new Range(from, to));
         }
-        Float[] scores = null;
+        float[] scores = null;
         boolean hasScores = in.readBoolean();
         if (hasScores) {
             int scoresLength = in.readInt();
-            scores = new Float[scoresLength];
+            scores = new float[scoresLength];
             for (int i = 0; i < scoresLength; i++) {
-                if (in.readByte() == 1) {
-                    scores[i] = in.readFloat();
-                }
+                scores[i] = in.readFloat();
             }
         }
         return new IndexedSplit(split, rowRanges, scores);
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/globalindex/IndexedSplitTest.java 
b/paimon-core/src/test/java/org/apache/paimon/globalindex/IndexedSplitTest.java
index f24f7cd12a..6b50efc61e 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/globalindex/IndexedSplitTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/globalindex/IndexedSplitTest.java
@@ -91,7 +91,7 @@ public class IndexedSplitTest {
 
         // Create test ranges and scores
         List<Range> rowRanges = Arrays.asList(new Range(0, 50), new Range(100, 
150));
-        Float[] scores = new Float[] {0.8f, 0.9f};
+        float[] scores = new float[] {0.8f, 0.9f};
 
         // Create IndexedSplit with scores
         IndexedSplit split = new IndexedSplit(dataSplit, rowRanges, scores);
@@ -152,38 +152,7 @@ public class IndexedSplitTest {
 
         List<Range> rowRanges =
                 Arrays.asList(new Range(5, 10), new Range(20, 30), new 
Range(100, 200));
-        Float[] scores = new Float[] {0.5f, 0.7f, 0.9f};
-
-        IndexedSplit split = new IndexedSplit(dataSplit, rowRanges, scores);
-
-        // Test Java serialization
-        byte[] serialized = InstantiationUtil.serializeObject(split);
-        IndexedSplit deserialized =
-                InstantiationUtil.deserializeObject(serialized, 
getClass().getClassLoader());
-
-        // Verify
-        assertThat(deserialized).isEqualTo(split);
-    }
-
-    @Test
-    public void testJavaSerializationWithScoresPartialNull()
-            throws IOException, ClassNotFoundException {
-        // Create test DataSplit
-        DataFileMeta file1 = DataFileTestUtils.newFile("file1", 0, 1, 100, 
1000L);
-        DataFileMeta file2 = DataFileTestUtils.newFile("file2", 0, 101, 200, 
2000L);
-
-        DataSplit dataSplit =
-                DataSplit.builder()
-                        .withSnapshot(4L)
-                        .withPartition(BinaryRow.EMPTY_ROW)
-                        .withBucket(3)
-                        .withBucketPath("bucket-3")
-                        .withDataFiles(Arrays.asList(file1, file2))
-                        .build();
-
-        List<Range> rowRanges =
-                Arrays.asList(new Range(5, 10), new Range(20, 30), new 
Range(100, 200));
-        Float[] scores = new Float[] {0.5f, null, 0.9f};
+        float[] scores = new float[] {0.5f, 0.7f, 0.9f};
 
         IndexedSplit split = new IndexedSplit(dataSplit, rowRanges, scores);
 
@@ -308,7 +277,7 @@ public class IndexedSplitTest {
                         new Range(0, 1000000),
                         new Range(2000000, 3000000),
                         new Range(5000000, 10000000));
-        Float[] scores = new Float[] {0.1f, 0.5f, 0.9f};
+        float[] scores = new float[] {0.1f, 0.5f, 0.9f};
 
         IndexedSplit split = new IndexedSplit(dataSplit, rowRanges, scores);
 

Reply via email to