krishan1390 commented on code in PR #17183:
URL: https://github.com/apache/pinot/pull/17183#discussion_r2532854113


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/readers/DefaultValueColumnReader.java:
##########
@@ -76,19 +74,254 @@ public Object next()
   }
 
   @Override
-  public void rewind()
-      throws IOException {
+  public void rewind() {
     _currentIndex = 0;
   }
 
+  @Override
+  public boolean isNextNull() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    return false; // Default values are never null
+  }
+
+  @Override
+  public void skipNext() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+  }
+
+  @Override
+  public int nextInt() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return ((Number) _defaultValue).intValue();
+  }
+
+  @Override
+  public long nextLong() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return ((Number) _defaultValue).longValue();
+  }
+
+  @Override
+  public float nextFloat() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return ((Number) _defaultValue).floatValue();
+  }
+
+  @Override
+  public double nextDouble() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return ((Number) _defaultValue).doubleValue();
+  }
+
+  @Override
+  public int[] nextIntMV() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return getIntMV(0); // Use existing getIntMV logic

Review Comment:
   updated to use defaults 



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/readers/DefaultValueColumnReader.java:
##########
@@ -76,19 +74,254 @@ public Object next()
   }
 
   @Override
-  public void rewind()
-      throws IOException {
+  public void rewind() {
     _currentIndex = 0;
   }
 
+  @Override
+  public boolean isNextNull() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    return false; // Default values are never null
+  }
+
+  @Override
+  public void skipNext() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+  }
+
+  @Override
+  public int nextInt() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return ((Number) _defaultValue).intValue();
+  }
+
+  @Override
+  public long nextLong() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return ((Number) _defaultValue).longValue();
+  }
+
+  @Override
+  public float nextFloat() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return ((Number) _defaultValue).floatValue();
+  }
+
+  @Override
+  public double nextDouble() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return ((Number) _defaultValue).doubleValue();
+  }
+
+  @Override
+  public int[] nextIntMV() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return getIntMV(0); // Use existing getIntMV logic
+  }
+
+  @Override
+  public long[] nextLongMV() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return getLongMV(0);
+  }
+
+  @Override
+  public float[] nextFloatMV() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return getFloatMV(0);
+  }
+
+  @Override
+  public double[] nextDoubleMV() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return getDoubleMV(0);
+  }
+
+  @Override
+  public String[] nextStringMV() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return getStringMV(0);
+  }
+
+  @Override
+  public byte[][] nextBytesMV() {
+    if (!hasNext()) {
+      throw new IllegalStateException("No more values available");
+    }
+    _currentIndex++;
+    return getBytesMV(0);
+  }
+
   @Override
   public String getColumnName() {
     return _columnName;
   }
 
   @Override
-  public void close()
-      throws IOException {
+  public int getTotalDocs() {
+    return _numDocs;
+  }
+
+  @Override
+  public boolean isNull(int docId) {
+    validateDocId(docId);
+    // Default values are never null
+    return false;
+  }
+
+  // Single-value accessors
+
+  @Override
+  public int getInt(int docId) {
+    validateDocId(docId);
+    return ((Number) _defaultValue).intValue();
+  }
+
+  @Override
+  public long getLong(int docId) {
+    validateDocId(docId);
+    return ((Number) _defaultValue).longValue();
+  }
+
+  @Override
+  public float getFloat(int docId) {
+    validateDocId(docId);
+    return ((Number) _defaultValue).floatValue();
+  }
+
+  @Override
+  public double getDouble(int docId) {
+    validateDocId(docId);
+    return ((Number) _defaultValue).doubleValue();
+  }
+
+  @Override
+  public String getString(int docId) {
+    validateDocId(docId);
+    return (String) _defaultValue;
+  }
+
+  @Override
+  public byte[] getBytes(int docId) {
+    validateDocId(docId);
+    return (byte[]) _defaultValue;
+  }
+
+  // Multi-value accessors
+
+  @Override
+  public int[] getIntMV(int docId) {
+    validateDocId(docId);
+    Object[] defaultArray = (Object[]) _defaultValue;
+    int[] result = new int[defaultArray.length];
+    for (int i = 0; i < defaultArray.length; i++) {
+      result[i] = ((Number) defaultArray[i]).intValue();
+    }
+    return result;
+  }

Review Comment:
   updated to use defaults



-- 
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