Skip to content

Conversation

@viirya
Copy link
Member

@viirya viirya commented Apr 9, 2021

What changes were proposed in this pull request?

This patch proposes a fix of nested column pruning for extracting case-insensitive struct field from array of struct.

This is the backport of #32059 to branch-2.4.

Why are the changes needed?

Under case-insensitive mode, nested column pruning rule cannot correctly push down extractor of a struct field of an array of struct, e.g.,

val query = spark.table("contacts").select("friends.First", "friends.MiDDle")

Error stack:

[info]   java.lang.IllegalArgumentException: Field "First" does not exist.                                                                                        
[info] Available fields:                                                                                                                                          
[info]   at org.apache.spark.sql.types.StructType$$anonfun$apply$1.apply(StructType.scala:274)                                                                    
[info]   at org.apache.spark.sql.types.StructType$$anonfun$apply$1.apply(StructType.scala:274)                            
[info]   at scala.collection.MapLike$class.getOrElse(MapLike.scala:128)                                                                                           
[info]   at scala.collection.AbstractMap.getOrElse(Map.scala:59)                                                                                                  
[info]   at org.apache.spark.sql.types.StructType.apply(StructType.scala:273)                                                                                     
[info]   at org.apache.spark.sql.execution.ProjectionOverSchema$$anonfun$getProjection$3.apply(ProjectionOverSchema.scala:44)                                   
[info]   at org.apache.spark.sql.execution.ProjectionOverSchema$$anonfun$getProjection$3.apply(ProjectionOverSchema.scala:41) 

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit test

@viirya
Copy link
Member Author

viirya commented Apr 9, 2021

cc @dongjoon-hyun @maropu

@SparkQA
Copy link

SparkQA commented Apr 9, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/41732/

@SparkQA
Copy link

SparkQA commented Apr 9, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/41732/

@SparkQA
Copy link

SparkQA commented Apr 9, 2021

Test build #137153 has finished for PR 32112 at commit 42d6eda.

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

viirya added a commit that referenced this pull request Apr 10, 2021
…-insensitive struct field from array of struct

### What changes were proposed in this pull request?

This patch proposes a fix of nested column pruning for extracting case-insensitive struct field from array of struct.

This is the backport of #32059 to branch-2.4.

### Why are the changes needed?

Under case-insensitive mode, nested column pruning rule cannot correctly push down extractor of a struct field of an array of struct, e.g.,

```scala
val query = spark.table("contacts").select("friends.First", "friends.MiDDle")
```

Error stack:
```
[info]   java.lang.IllegalArgumentException: Field "First" does not exist.
[info] Available fields:
[info]   at org.apache.spark.sql.types.StructType$$anonfun$apply$1.apply(StructType.scala:274)
[info]   at org.apache.spark.sql.types.StructType$$anonfun$apply$1.apply(StructType.scala:274)
[info]   at scala.collection.MapLike$class.getOrElse(MapLike.scala:128)
[info]   at scala.collection.AbstractMap.getOrElse(Map.scala:59)
[info]   at org.apache.spark.sql.types.StructType.apply(StructType.scala:273)
[info]   at org.apache.spark.sql.execution.ProjectionOverSchema$$anonfun$getProjection$3.apply(ProjectionOverSchema.scala:44)
[info]   at org.apache.spark.sql.execution.ProjectionOverSchema$$anonfun$getProjection$3.apply(ProjectionOverSchema.scala:41)
```

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Unit test

Closes #32112 from viirya/fix-array-nested-pruning-2.4.

Authored-by: Liang-Chi Hsieh <viirya@gmail.com>
Signed-off-by: Liang-Chi Hsieh <viirya@gmail.com>
@viirya
Copy link
Member Author

viirya commented Apr 10, 2021

Thanks @maropu. Merged to branch-2.4.

@viirya viirya closed this Apr 10, 2021
@viirya viirya deleted the fix-array-nested-pruning-2.4 branch December 27, 2023 18:27
Sign up for free to 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