xiangfu0 commented on code in PR #19996:
URL: https://github.com/apache/pinot/pull/19996#discussion_r4352109736


##########
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 transformer to the value at the given 
document id. By default, returns
+  /// `transformer.transform(getValue(docId))`, passing null values to the 
transformer 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 transformer deterministic transformation to apply to the value
+  /// @throws IOException if an I/O error occurs while reading
+  @Nullable
+  default Object getTransformedValue(int docId, ColumnTransformer transformer)

Review Comment:
   Clarified in `cc3dd4a04d`: the default invokes `transform(getValue(docId))` 
even when `isNoOp()` is true; overrides may skip no-op transformations while 
preserving the conversion contract. All 9 `ColumnReaderTest` cases and scoped 
precommit checks passed.



##########
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 transformer to the value at the given 
document id. By default, returns
+  /// `transformer.transform(getValue(docId))`, passing null values to the 
transformer 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 transformer deterministic transformation to apply to the value

Review Comment:
   Clarified in `cc3dd4a04d`: callers must supply a deterministic transformer 
and must not depend on invocation counts or side effects. This states the 
caller contract explicitly. All 9 `ColumnReaderTest` cases and scoped precommit 
checks passed.



##########
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 transformer to the value at the given 
document id. By default, returns
+  /// `transformer.transform(getValue(docId))`, passing null values to the 
transformer 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 transformer deterministic transformation to apply to the value
+  /// @throws IOException if an I/O error occurs while reading
+  @Nullable
+  default Object getTransformedValue(int docId, ColumnTransformer transformer)

Review Comment:
   Clarified in `cc3dd4a04d`: the default invokes `transform(getValue(docId))` 
even when `isNoOp()` is true; overrides may skip no-op transformations while 
preserving the conversion contract. All 9 `ColumnReaderTest` cases and scoped 
precommit checks passed.



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