Skip to content

[SPARK-21402][SQL][BACKPORT-2.2] Fix java array of structs deserialization - #22768

Closed
vofque wants to merge 2 commits into
apache:branch-2.2from
vofque:SPARK-21402-2.2
Closed

[SPARK-21402][SQL][BACKPORT-2.2] Fix java array of structs deserialization#22768
vofque wants to merge 2 commits into
apache:branch-2.2from
vofque:SPARK-21402-2.2

Conversation

@vofque

Copy link
Copy Markdown
Contributor

This PR is to backport #22708 to branch 2.2.

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

@dongjoon-hyun

Copy link
Copy Markdown
Member

ok to test

@SparkQA

Copy link
Copy Markdown

Test build #97545 has finished for PR 22768 at commit 90d3a74.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Assert.assertEquals(records, RECORDS);
}

private StructType createSchema() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So, this is back inevitably. :)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah, it managed to survive

@dongjoon-hyundongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, LGTM.

@dongjoon-hyun

Copy link
Copy Markdown
Member

Merged to branch-2.2.

asfgit pushed a commit that referenced this pull request Oct 18, 2018
…ation
This PR is to backport #22708 to branch 2.2.
## 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#22768 from vofque/SPARK-21402-2.2.
Lead-authored-by: Vladimir Kuriatkov <Vladimir_Kuriatkov@epam.com>
Co-authored-by: Vladimir Kuriatkov <vofque@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@dongjoon-hyun

Copy link
Copy Markdown
Member

Thank you, @vofque .

@dongjoon-hyun

Copy link
Copy Markdown
Member

Could you close this PR? Auto-close is only working for master branch PR.

@vofquevofque closed this Oct 18, 2018
Willymontaz pushed a commit to criteo-forks/spark that referenced this pull request Sep 26, 2019
…ation
This PR is to backport apache#22708 to branch 2.2.
## 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
Closesapache#22768 from vofque/SPARK-21402-2.2.
Lead-authored-by: Vladimir Kuriatkov <Vladimir_Kuriatkov@epam.com>
Co-authored-by: Vladimir Kuriatkov <vofque@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Willymontaz pushed a commit to criteo-forks/spark that referenced this pull request Sep 27, 2019
…ation
This PR is to backport apache#22708 to branch 2.2.
## 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
Closesapache#22768 from vofque/SPARK-21402-2.2.
Lead-authored-by: Vladimir Kuriatkov <Vladimir_Kuriatkov@epam.com>
Co-authored-by: Vladimir Kuriatkov <vofque@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for freeto 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.

3 participants

@vofque@dongjoon-hyun@SparkQA