Jackie-Jiang commented on code in PR #18447:
URL: https://github.com/apache/pinot/pull/18447#discussion_r3211723123


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/ColumnMetadataImpl.java:
##########
@@ -571,7 +571,11 @@ public ColumnMetadataImpl build() {
         _lengthOfShortestElement = size;
         _lengthOfLongestElement = size;
       } else {
-        if (_lengthOfLongestElement < 0 && _dictionaryElementSize > 0) {
+        // Pre-1.6.0 segments don't write LENGTH_OF_LONGEST_ELEMENT; fall back 
to DICTIONARY_ELEMENT_SIZE
+        // (which is non-negative for any dictionary-encoded column, including 
columns where every value
+        // is empty and the longest entry is zero bytes). Leaving the field at 
the UNAVAILABLE sentinel
+        // would propagate as `numBytesPerValue = -1` into 
BaseImmutableDictionary.getBuffer().
+        if (_lengthOfLongestElement < 0 && _dictionaryElementSize >= 0) {

Review Comment:
   Probably more robust if we check `_hasDictionary` instead
   ```suggestion
           if (_lengthOfLongestElement < 0 && _hasDictionary) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to