Skip to content

[VL] Register missing math scalar functions in Velox sparksql registry (sin, tan, tanh, radians, ln) #12157

@brijrajk

Description

@brijrajk

Description

Summary

Five math scalar functions — sin, tan, tanh, radians, and ln — are mapped in
ExpressionMappings.scala (Spark expression → Substrait function name) but are not
registered in Gluten's Velox C++ function registry (RegistrationAllFunctions.cc).

As a result, queries using these functions silently fall back to vanilla Spark instead
of executing natively in Velox.

Root Cause

RegistrationAllFunctions.cc does not call velox::registerFunction<> for:

  • lnvelox::functions::LnFunction
  • radiansvelox::functions::RadiansFunction
  • sinvelox::functions::SinFunction
  • tanvelox::functions::TanFunction
  • tanhvelox::functions::TanhFunction

All five implementations exist in Velox's prestosql arithmetic library
(velox/functions/prestosql/Arithmetic.h).

Fix

Register the five functions in registerFunctionOverwrite() and add Scala integration
tests in MathFunctionsValidateSuite to verify native execution.

Gluten version

main branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions