Skip to content

spark: the Scala function-mapping registry diverges from isthmus' with nothing enforcing parity #1277

Description

@nielspardon

:spark carries its own SCALAR_SIGS in spark/src/main/scala/io/substrait/spark/expression/FunctionMappings.scala, entirely separate from the isthmus list, and nothing checks the two against each other. So a function isthmus can produce may be unconvertible on the Spark side, and the only way to find out is to hit it.

Current examples: spark has upper and lower but not reverse, initcap, char_length, replace, left, right or strpos. #1251 widens the gap by two.

#1012's scope note already records "unifying the parallel :spark Scala mapping implementation" as out of scope / a separate follow-up, naming an AbstractFunctionInvocation<T, I> seam in core as the intended direction. This issue is that follow-up, plus the smaller thing that can be done independently of it: a test that reports which Substrait function names one binding maps and the other does not, so the divergence is visible rather than discovered.

One caveat for anyone adding entries rather than building the seam: Spark's Catalyst Reverse covers reverse(array) as well as strings, so a plain s[Reverse]("reverse") would mis-map array reverse onto the string function. It needs the same special-casing the ss[...] entries get.

Found while reviewing #1251.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions