Skip to content

Conversation

@Shekharrajak
Copy link
Contributor

Closes #3181

Rationale for this change

Enable native execution for Spark's LEFT(str, len) function to improve query performance by avoiding JVM fallback.

What changes are included in this PR?

  • Added CometLeft serializer that transforms LEFT(str, len) to Substring(str, 1, len) protobuf
  • Registered Left expression in QueryPlanSerde string expressions map
  • No protobuf or Rust changes required (reuses existing Substring implementation)

How are these changes tested?

Added 4 test suites in CometExpressionSuite:

  • Basic functionality (various lengths: 0, -1, positive, exceeds length)
  • Unicode character handling (emoji, multi-byte chars)
  • Equivalence verification with SUBSTRING(str, 1, len)
  • Dictionary encoding preservation

@andygrove
Copy link
Member

@Shekharrajak can you run make to update the generated configs.md

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.

LGTM pending CI. Thanks @Shekharrajak

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.

[Feature] Support Spark expression: left

2 participants