dongjoon-hyun commented on a change in pull request #24158: [SPARK-26847][SQL] Pruning nested serializers from object serializers: MapType support URL: https://github.com/apache/spark/pull/24158#discussion_r268037271
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/objects.scala ########## @@ -132,49 +130,74 @@ object ObjectSerializerPruning extends Rule[LogicalPlan] { fields.map(f => collectStructType(f.dataType, structs)) case ArrayType(elementType, _) => collectStructType(elementType, structs) + case MapType(_, valueType, _) => + // Because we can't select a field from struct in key, so we skip key type. Review comment: Technically, `map_keys` returns key arrays and we can select fields from the keys. ```scala scala> sql("select keys, keys.a from (select map_keys(map(named_struct('a', 'key1'), 1, named_struct('a', 'key2'), 2)) keys)").show +----------------+------------+ | keys| a| +----------------+------------+ |[[key1], [key2]]|[key1, key2]| +----------------+------------+ ``` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org