GitHub user cloud-fan opened a pull request:
https://github.com/apache/spark/pull/17398
[SPARK-19716][SQL] support by-name resolution for struct type elements in
array
## What changes were proposed in this pull request?
Previously when we construct deserializer expression for array type, we
will first cast the corresponding field to expected array type and then apply
`MapObjects`.
However, by doing that, we lose the opportunity to do by-name resolution
for struct type inside array type. In this PR, I introduce a
`UnresolvedMapObjects` to hold the lambda function and the input array
expression. Then during analysis, after the input array expression is resolved,
we get the actual array element type and apply by-name resolution. Then we
don't need to add `Cast` for array type when constructing the deserializer
expression, as the element type is determined later at analyzer.
## How was this patch tested?
new regression test
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cloud-fan/spark dataset
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/17398.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #17398
----
commit 2497b177caf33091778149dc6e3e5827f73fd1f9
Author: Wenchen Fan <[email protected]>
Date: 2017-03-23T14:17:52Z
support by-name resolution for struct type elements in array
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]