dongjoon-hyun commented on a change in pull request #24179: [SPARK-27241][SQL]
Support map_keys and map_values in SelectedField
URL: https://github.com/apache/spark/pull/24179#discussion_r268415243
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SelectedFieldSuite.scala
##########
@@ -394,6 +405,91 @@ class SelectedFieldSuite extends SparkFunSuite with
BeforeAndAfterAll {
:: Nil)))
}
+ // |-- col1: string (nullable = false)
+ // |-- col2: map (nullable = true)
+ // | |-- key: struct (containsNull = false)
+ // | | |-- field1: string (nullable = true)
+ // | | |-- field2: integer (nullable = true)
+ // | |-- value: array (valueContainsNull = true)
+ // | | |-- element: struct (containsNull = false)
+ // | | | |-- field3: struct (nullable = true)
+ // | | | | |-- subfield1: integer (nullable = true)
+ // | | | | |-- subfield2: integer (nullable = true)
+ private val mapWithStructKey = StructType(Array(ignoredField,
+ StructField("col2", MapType(StructType(
+ StructField("field1", StringType) ::
+ StructField("field2", IntegerType) :: Nil),
+ ArrayType(StructType(
+ StructField("field3", StructType(
+ StructField("subfield1", IntegerType) ::
+ StructField("subfield2", IntegerType) :: Nil)) :: Nil), containsNull
= false)))))
+
+ testSelect(mapWithStructKey, "map_keys(col2).field1 as foo") {
+ StructField("col2", MapType(StructType(
+ StructField("field1", StringType) :: Nil),
Review comment:
```scala
- StructField("col2", MapType(StructType(
- StructField("field1", StringType) :: Nil),
+ StructField("col2", MapType(
+ StructType(StructField("field1", StringType) :: Nil),
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]