dongjoon-hyun commented on a change in pull request #34199:
URL: https://github.com/apache/spark/pull/34199#discussion_r740751572
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaConverter.scala
##########
@@ -243,20 +338,30 @@ class ParquetToSparkSchemaConverter(
ParquetSchemaConverter.checkConversionRequirement(
field.getFieldCount == 1 && !field.getType(0).isPrimitive,
s"Invalid map type: $field")
+ ParquetSchemaConverter.checkConversionRequirement(
+ sparkReadType.forall(_.isInstanceOf[MapType]),
+ s"Invalid Spark read type: expected $field to be map type but found
$sparkReadType")
- val keyValueType = field.getType(0).asGroupType()
+ val keyValue = groupColumn.getChild(0).asInstanceOf[GroupColumnIO]
+ val keyValueType = keyValue.getType.asGroupType()
ParquetSchemaConverter.checkConversionRequirement(
keyValueType.isRepetition(REPEATED) && keyValueType.getFieldCount ==
2,
s"Invalid map type: $field")
- val keyType = keyValueType.getType(0)
- val valueType = keyValueType.getType(1)
+ val key = keyValue.getChild(0)
+ val value = keyValue.getChild(1)
+ val sparkReadKeyType =
sparkReadType.map(_.asInstanceOf[MapType].keyType)
+ val sparkReadValueType =
sparkReadType.map(_.asInstanceOf[MapType].valueType)
+ val valueType = value.getType
val valueOptional = valueType.isRepetition(OPTIONAL)
Review comment:
nit. Maybe.
```scala
- val valueType = value.getType
- val valueOptional = valueType.isRepetition(OPTIONAL)
+ val valueOptional = value.getType.isRepetition(OPTIONAL)
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]