yyanyy opened a new pull request, #60356: URL: https://github.com/apache/spark/pull/60356
### What changes were proposed in this pull request? Use a map lookup key as an `arrays_zip` field name only when it is a non-null string literal. Use the existing ordinal field names for dynamic keys, other expressions, NULL, and non-string keys. Preserve literal string names and explicit aliases. ### Why are the changes needed? The map-lookup naming branch passes the key expression to `Literal.apply`. Dynamic and foldable expression keys fail during analysis; NULL and non-string literal keys fail when Spark constructs the output schema. These are valid array-valued expressions. ### Does this PR introduce _any_ user-facing change? Yes. For example, `arrays_zip(readings[metric], readings['hum'])` can now return the selected arrays as `ARRAY<STRUCT<0:INT,hum:INT>>`, with a stable schema even when different rows select different keys. Existing successful literal string-key calls keep their field names. Typed and NULL key lookups also use stable ordinal names. ### How was this patch tested? Added Catalyst regressions that assert complete types and values through interpreted and generated evaluation. Added range-based DataFrame regressions covering dynamic, foldable, NULL, integer, date, timestamp, and binary keys, preserved string names, and explicit aliases with code generation enabled and disabled. Validation: - `build/sbt 'catalyst/testOnly *CollectionExpressionsSuite'`: 77 passed. Before the production change, the focused `ArraysZip` tests had 8 behavioral failures; the same tests now pass. - `build/sbt 'sql/testOnly *DataFrameFunctionsSuite -- -z arrays_zip'`: 8 passed. - Catalyst production/test and SQL test Scala style checks. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Codex (GPT-6) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
