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


##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/readers/ColumnReader.java:
##########
@@ -188,6 +189,23 @@ boolean isNull(int docId)
   Object getValue(int docId)
       throws IOException;
 
+  /// Applies the supplied deterministic JSON converter to the value at the 
given document id. By default, returns
+  /// `jsonTransformer.transform(getValue(docId))`, passing null values to the 
converter as well.
+  ///
+  /// Readers may override this method to avoid materializing repeated raw 
values or to reuse immutable conversion
+  /// results. Overrides must preserve the conversion result, including nulls 
and conversion failures; callers must not
+  /// depend on the converter's invocation count. This method does not change 
[#getValue(int)] or the typed accessors.
+  /// Callers remain responsible for applying this conversion in the correct 
order relative to other transformations.
+  ///
+  /// @param docId 0-based document id, from 0 (inclusive) to 
[#getTotalDocs()] (exclusive)
+  /// @param jsonTransformer deterministic converter to the column's JSON 
representation
+  /// @throws IOException if an I/O error occurs while reading
+  @Nullable
+  default Object getJsonValue(int docId, ColumnTransformer jsonTransformer)

Review Comment:
   This hook accepts any `ColumnTransformer` and simply applies it to 
`getValue(docId)`; neither the signature nor the implementation is 
JSON-specific. Could we name it `getTransformedValue(int docId, 
ColumnTransformer transformer)` and document it as a generic deterministic 
conversion hook? If the extension point is intended specifically for JSON, 
could we clarify what JSON-specific contract or optimization requires that 
scope?



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