1. [SPARK-21402][SQL][BACKPORT-2.3] Fix java array of structs (commit: 61b301cc7bf3fce4c034be3171291d5212c386e1) (details)
Commit 61b301cc7bf3fce4c034be3171291d5212c386e1 by dongjoon
[SPARK-21402][SQL][BACKPORT-2.3] Fix java array of structs
This PR is to backport #22708 to branch 2.3.
## What changes were proposed in this pull request?
MapObjects expression is used to map array elements to java beans.
Struct type of elements is inferred from java bean structure and ends up
with mixed up field order. I used UnresolvedMapObjects instead of
MapObjects, which allows to provide element type for MapObjects during
analysis based on the resolved input data, not on the java bean.
## How was this patch tested?
Added a test case. Built complete project on travis.
dongjoon-hyun cloud-fan
Closes #22767 from vofque/SPARK-21402-2.3.
Authored-by: Vladimir Kuriatkov <>
Signed-off-by: Dongjoon Hyun <>
(commit: 61b301cc7bf3fce4c034be3171291d5212c386e1)
The file was addedsql/core/src/test/java/test/org/apache/spark/sql/
The file was addedsql/core/src/test/resources/test-data/with-array-fields.json
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/JavaTypeInference.scala (diff)