[GLUTEN-12157][VL] Register sin, tan, tanh, radians in Velox sparksql function registry#12158
[GLUTEN-12157][VL] Register sin, tan, tanh, radians in Velox sparksql function registry#12158brijrajk wants to merge 1 commit into
Conversation
|
Hi @brijrajk, apologies for the parallel work, I didn't see your PR was already up when I started. I had an upstream Velox fix in flight at the same time: facebookincubator/velox#17648. Heads up on So a change on Velox is indeed inevitable, the Velox PR adds a Your test-framework fixes ( Happy to coordinate whichever direction maintainers prefer. |
Thanks for the detailed explanation and for flagging the parallel work — no worries at all. You're right on ln; I've dropped it from this PR so only the four semantically safe functions (sin, tan, tanh, radians) land here, along with the test-framework fixes. Once your Velox PR (facebookincubator/velox#17648) lands upstream and Gluten picks up the new sparksql::LnFunction, ln can follow in a separate PR. |
… function registry
6270b01 to
9aa5e1b
Compare
What changes are proposed in this pull request?
Five math scalar functions (
sin,tan,tanh,radians) are mapped inExpressionMappings.scalato their Substrait counterparts but were missing fromGluten's Velox C++ function registry (
RegistrationAllFunctions.cc). Queries usingthese functions silently fell back to vanilla Spark instead of running natively in Velox.
This PR registers them in
registerFunctionOverwrite()using the existing Velox prestosqlimplementations from
velox/functions/prestosql/Arithmetic.h, which match Spark's expectedsemantics for these functions.
Also fixes a leftover from PR #11756 (RAS removal):
MathFunctionsValidateSuiteandScalarFunctionsValidateSuitewere left asabstract classafter their only concretesubclasses were deleted, causing all tests in those suites to silently not run. Both are
promoted to
classhere, consistent with the fix already applied toDateFunctionsValidateSuitein that same PR.Fixes #12157
How was this patch tested?
Added tests in
MathFunctionsValidateSuitefor each of the five functions usingrunQueryAndComparewithcheckGlutenPlan[ProjectExecTransformer]to verify nativeexecution in Velox without fallback.
MathFunctionsValidateSuitenow explicitly disables ANSI mode (enabled by default inSpark 4), which wraps arithmetic expressions in ANSI check nodes and shifts the top-level
plan node away from
ProjectExecTransformer. ANSI-specific behavior is covered by theexisting
MathFunctionsValidateSuiteAnsiOn.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude (Anthropic)