Skip to content

[AURON #2152] Implement native function of map_from_arrays#2165

Merged
slfan1989 merged 2 commits intoapache:masterfrom
weimingdiit:feat/map_from_arrays-function
Apr 8, 2026
Merged

[AURON #2152] Implement native function of map_from_arrays#2165
slfan1989 merged 2 commits intoapache:masterfrom
weimingdiit:feat/map_from_arrays-function

Conversation

@weimingdiit
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2152

Rationale for this change

This PR adds native support for Spark map_from_arrays(keys, values) through Auron’s extension-function path.

Spark defines this function as creating a map from the given key/value arrays, with the requirement that all elements in keys must be non-null. This change implements that behavior in Auron and adds regression coverage.

map_from_arrays(...) was not supported in Auron’s native execution path.

This PR extends native map-function coverage while keeping behavior aligned with Spark semantics, following the existing extension-function pattern already used for Spark-specific functions such as map_concat(...).

What changes are included in this PR?

This PR:

  • adds MapFromArrays conversion in NativeConverters
  • registers Spark_MapFromArrays in datafusion-ext-functions
  • implements map_from_arrays(...) in spark_map.rs
  • enforces Spark-compatible null-key rejection
  • handles row-level null propagation
  • adds Scala and Rust regression tests

Are there any user-facing changes?

Yes.
Queries using map_from_arrays(keys, values) can now run through Auron’s native extension-function path.

How was this patch tested?

UT.

Signed-off-by: weimingdiit <weimingdiit@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds native execution support for Spark’s map_from_arrays(keys, values) via Auron’s extension-function path, aligning behavior with Spark semantics (null propagation + null-key rejection) and adding regression coverage.

Changes:

  • Adds Spark plan conversion for MapFromArrays to the native extension-function call (Spark_MapFromArrays).
  • Registers and implements the Spark_MapFromArrays extension function in the native engine (Arrow/DataFusion).
  • Adds Scala + Rust tests covering baseline behavior and null-key rejection.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
spark-extension/src/main/scala/org/apache/spark/sql/auron/NativeConverters.scala Converts Spark MapFromArrays expression into the Spark_MapFromArrays native extension function call.
spark-extension-shims-spark/src/test/scala/org/apache/auron/AuronFunctionSuite.scala Adds Spark-side regression tests for map_from_arrays, including a null-key rejection case.
native-engine/datafusion-ext-functions/src/spark_map.rs Implements map_from_arrays in Rust, including Spark-like null propagation and null-key/duplicate-key errors, plus Rust unit tests.
native-engine/datafusion-ext-functions/src/lib.rs Registers Spark_MapFromArrays for extension-function dispatch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ull handling

Signed-off-by: weimingdiit <weimingdiit@gmail.com>
@slfan1989 slfan1989 merged commit 7484470 into apache:master Apr 8, 2026
123 checks passed
@weimingdiit
Copy link
Copy Markdown
Contributor Author

@slfan1989 Thanks for your review and merge!

@weimingdiit weimingdiit deleted the feat/map_from_arrays-function branch April 8, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement native function of map_from_arrays

3 participants