yashmayya opened a new pull request, #19789:
URL: https://github.com/apache/pinot/pull/19789

   ## Summary
   
   `ScalarTransformFunctionWrapper` had no case for `Object` parameters. A 
scalar function with an `Object` parameter failed on a column argument with 
`Unsupported parameter type: OBJECT`. The failure occurs in the single-stage 
engine and in multi-stage leaf stages. For example, `SELECT 
toBase64(toThetaSketch(intCol)) FROM tbl` failed. The same call worked above a 
stage boundary, where `FunctionOperand` runs it.
   
   Affected functions:
   - The sketch scalars in `SketchFunctions` (`toThetaSketch`, `toHLL`, 
`toCpcSketch`, `toULL`, `toIntegerSumTupleSketch`, `getThetaSketchEstimate`, 
and more).
   - `jsonFormat`, `jsonPath*`, `jsonExtractObject`, `jsonKeyValueArrayToMap`, 
and `nullIf`.
   
   Some `Object`-parameter scalars (for example `isDistinctFrom`, `coalesce`, 
and `inIdSet`) have a transform function with the same name. The single-stage 
engine uses that transform function, so this change does not affect them.
   
   ## Change
   
   For an `Object` parameter, the wrapper now reads the argument by its result 
type. It passes the same external Java values that 
`ColumnDataType.toExternal()` gives in `FunctionOperand`:
   - Single-value: `Integer`, `Long`, `Float`, `Double`, `BigDecimal`, 
`Boolean`, `Timestamp`, `String` (also for JSON), `byte[]`, `UUID`.
   - Multi-value: `int[]`, `long[]`, `float[]`, `double[]`, `BigDecimal[]`, 
`boolean[]`, `Timestamp[]`, `String[]`, `byte[][]`, `UUID[]`.
   
   The wrapper selects the type once in `init()`. Other argument types (for 
example MAP) now fail in `init()` with a clear error.
   
   ## Tests
   
   - `ScalarTransformFunctionWrapperTest#testObjectParameter`: a test-only 
scalar function returns the class of its `Object` argument, for each type.
   - `ObjectParameterScalarFunctionsQueriesTest`: sketch functions and 
`jsonFormat` on single-value and multi-value columns of all types.
   - `ObjectParameterFunctions.json`: in the multi-stage engine, the same calls 
give the same result in the leaf stage and above a stage boundary.
   
   All new tests fail without the fix.
   
   ## Differences not changed here
   
   - The leaf stage and `FunctionOperand` give the same values for column 
arguments. For an expression such as `intCol + 1`, the leaf stage gives a 
`Double`, because the single-stage `plus` returns DOUBLE. `CAST(intCol + 1 AS 
VARCHAR)` has the same difference today.
   - With null handling enabled, the wrapper returns null for a null input and 
does not call the function. `FunctionOperand` calls the function with `null` 
when the function has `nullableParameters = true`.
   


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