Skip to content

feat: support elt expression#3587

Open
n0r0shi wants to merge 1 commit intoapache:mainfrom
n0r0shi:elt-func
Open

feat: support elt expression#3587
n0r0shi wants to merge 1 commit intoapache:mainfrom
n0r0shi:elt-func

Conversation

@n0r0shi
Copy link

@n0r0shi n0r0shi commented Feb 25, 2026

Summary

  • Wire elt from the datafusion-spark crate (SparkElt) to Comet
  • Register in jni_api.rs and add serde mapping via CometScalarFunction in QueryPlanSerde.scala

Test plan

  • New test in CometStringExpressionSuite — passes
  • Spotless formatting check passes
  • Rust native build passes

Register datafusion-spark's SparkElt UDF and add serde mapping
in stringExpressions.
Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serde wiring and UDF registration look good. Same clean pattern as your other PRs.

A couple of test suggestions. The SQL file framework in spark/src/test/resources/sql-tests/expressions/string/ would be a nice fit here instead of CometStringExpressionSuite.

The Spark reference mentions that elt returns null for out-of-range indices in non-ANSI mode and throws an error in ANSI mode. It might be worth adding a test for out-of-range index values like elt(0, 'a', 'b') or elt(5, 'a', 'b', 'c') to make sure those match Spark's behavior.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants