You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/07/19 06:27:43 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #33409: [SPARK-36021][SQL] Schema check should check inner field too

HyukjinKwon commented on a change in pull request #33409:
URL: https://github.com/apache/spark/pull/33409#discussion_r672018403



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaConverter.scala
##########
@@ -593,8 +593,14 @@ private[sql] object ParquetSchemaConverter {
        """.stripMargin.split("\n").mkString(" ").trim)
   }
 
-  def checkFieldNames(names: Seq[String]): Unit = {
-    names.foreach(checkFieldName)
+  def checkFieldNames(schema: StructType): Unit = {
+    schema.map(field => field.name -> field.dataType)
+      .foreach {
+        case (name, struct: StructType) =>

Review comment:
       I think you can traverse with `StructField`? e.g.)
   
   ```scala
     case field if field.dataType.isInstanceOf[StructType]  =>
       checkFieldName(name)
       checkFieldNames(struct)
     case field => checkFieldName(field.name)
   ```




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org