Handle Object-returning scalar transform functions#18628
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18628 +/- ##
============================================
- Coverage 64.40% 64.38% -0.02%
Complexity 1137 1137
============================================
Files 3337 3337
Lines 206069 206106 +37
Branches 32128 32135 +7
============================================
- Hits 132710 132707 -3
- Misses 62726 62766 +40
Partials 10633 10633
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
xiangfu0
left a comment
There was a problem hiding this comment.
Found a high-signal issue; see inline comment.
| @@ -66,7 +66,8 @@ public ScalarTransformFunctionWrapper(FunctionInfo functionInfo) { | |||
| ColumnDataType resultType = FunctionUtils.getColumnDataType(resultClass); | |||
| if (resultType != null) { | |||
| _resultType = resultType; | |||
There was a problem hiding this comment.
This changes every OBJECT-returning scalar UDF to advertise STRING output and stringify the value. That silently changes query semantics for functions like nullIf/caseWhen: NULLIF(int_col, 0) now becomes a VARCHAR result instead of preserving the input type, so downstream arithmetic/comparisons will see the wrong type. We need a type-preserving resolution here rather than coercing OBJECT to STRING.
Summary
Objectwithout exposingColumnDataType.OBJECTthrough transform result metadataObjectfrom child transform functionsnullIfwith anObjectresult and anObjectparameterFixes #11743
Tests
JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./mvnw -pl pinot-core -am -Dtest=ScalarTransformFunctionWrapperTest#testObjectResultScalarTransformFunction+testObjectParameterScalarTransformFunction -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false testJAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./mvnw -pl pinot-core -am -Dtest=ScalarTransformFunctionWrapperTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false testgit diff --check