1. [SPARK-21402][SQL] Fix java array of structs deserialization (details)
Commit e5b8136f47a947356e74c8d4bf9d03139f455a2f by wenchen
[SPARK-21402][SQL] Fix java array of structs deserialization
When deserializing values of ArrayType with struct elements in java
beans, fields of structs get mixed up. I suggest using struct data types
retrieved from resolved input data instead of inferring them from java
## 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.
michalsenkyr cloud-fan marmbrus liancheng
Closes #22708 from vofque/SPARK-21402.
Lead-authored-by: Vladimir Kuriatkov <> Co-authored-by:
Vladimir Kuriatkov <> Signed-off-by: Wenchen
Fan <>
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)
The file was addedsql/core/src/test/java/test/org/apache/spark/sql/