This is an automated email from the ASF dual-hosted git repository.

Jackie-Jiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 6bd36c13bd6 Keep the upsert out-of-order flag non-null under null 
handling (#20266)
6bd36c13bd6 is described below

commit 6bd36c13bd6aeff8df250307bfad373b2e427871
Author: Chaitanya Deepthi <[email protected]>
AuthorDate: Mon Nov 16 20:52:21 2026 -0800

    Keep the upsert out-of-order flag non-null under null handling (#20266)
---
 .../segment/local/indexsegment/mutable/MutableSegmentImpl.java    | 2 ++
 .../mutable/MutableSegmentImplUpsertComparisonColTest.java        | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git 
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java
 
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java
index 3920c0e2faf..7c79de66aaa 100644
--- 
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java
+++ 
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java
@@ -697,6 +697,8 @@ public class MutableSegmentImpl implements MutableSegment {
         // TODO fix this metadata mismatch scenario
         boolean isOutOfOrderRecord = 
!_partitionUpsertMetadataManager.addRecord(this, recordInfo);
         if (_upsertOutOfOrderRecordColumn != null) {
+          // The input never carries this column, so the null value 
transformer marked it null; the flag is a real value
+          updatedRow.removeNullValueField(_upsertOutOfOrderRecordColumn);
           updatedRow.putValue(_upsertOutOfOrderRecordColumn, 
BooleanUtils.toInt(isOutOfOrderRecord));
         }
         if (!isOutOfOrderRecord || !_upsertDropOutOfOrderRecord) {
diff --git 
a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImplUpsertComparisonColTest.java
 
b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImplUpsertComparisonColTest.java
index 9441bf67689..7b7799e0c57 100644
--- 
a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImplUpsertComparisonColTest.java
+++ 
b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImplUpsertComparisonColTest.java
@@ -28,6 +28,7 @@ import 
org.apache.pinot.segment.local.segment.creator.TransformPipeline;
 import org.apache.pinot.segment.local.upsert.PartitionUpsertMetadataManager;
 import org.apache.pinot.segment.local.upsert.TableUpsertMetadataManager;
 import org.apache.pinot.segment.local.upsert.TableUpsertMetadataManagerFactory;
+import org.apache.pinot.segment.spi.index.reader.NullValueVectorReader;
 import org.apache.pinot.spi.config.table.HashFunction;
 import org.apache.pinot.spi.config.table.TableConfig;
 import org.apache.pinot.spi.config.table.TableType;
@@ -195,6 +196,13 @@ public class MutableSegmentImplUpsertComparisonColTest 
implements PinotBuffersAf
       assertFalse(BooleanUtils.toBoolean(_mutableSegmentImpl.getValue(1, 
outOfOrderRecordColumn)));
       assertFalse(BooleanUtils.toBoolean(_mutableSegmentImpl.getValue(2, 
outOfOrderRecordColumn)));
       assertTrue(BooleanUtils.toBoolean(_mutableSegmentImpl.getValue(3, 
outOfOrderRecordColumn)));
+      // The flag is a real value, not null: with null handling, a query must 
read it as true/false
+      NullValueVectorReader nullValueVector =
+          
_mutableSegmentImpl.getDataSource(outOfOrderRecordColumn).getNullValueVector();
+      assertNotNull(nullValueVector);
+      for (int docId = 0; docId < 4; docId++) {
+        assertFalse(nullValueVector.isNull(docId), "Out-of-order flag of doc " 
+ docId + " reads as null");
+      }
     } finally {
       tearDown();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to