This directory is Gluten's function overlay: a place to host Velox-compatible function implementations that are managed on the Gluten side, so a new or fixed function does not have to be upstreamed to Velox before it can ship in Gluten.
Typical use cases:
sparksql function whose semantics diverge from Spark. Implement the corrected version here to override the Velox one while the fix is pending upstream.registerFunctionOverlay() (see RegisterFunctionOverlay.h) is called at the end of gluten::registerAllFunctions(), after all Velox presto/spark function registrations. Velox's function registries let a later registration with the same name and signature replace an earlier one, so any function registered in the overlay takes precedence over the Velox implementation.
Round.h for a simple-function example and Velox scalar functions guide.RegisterFunctionOverlay.cc inside registerFunctionOverlay(). Use the same name Gluten‘s Substrait plan conversion emits (Spark’s function name in most cases)..cc file, add it to the source list in cpp/velox/CMakeLists.txt.cpp/velox/tests/SparkFunctionTest.cc (function overlay is registered there through registerAllFunctions()), and Scala side tests where applicable.ExpressionMappings.scala / ExpressionNames) so the planner offloads it.The overlay is a staging area, not a permanent fork. When an overlay function is accepted into upstream Velox, remove it from the overlay in the same PR that bumps the Velox version, so the Velox implementation takes effect.