viirya commented on a change in pull request #26499: [SPARK-29869][SQL] Fix 
assertion error in HiveMetastoreCatalog#convertToLogicalRelation 
URL: https://github.com/apache/spark/pull/26499#discussion_r347657588
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
 ##########
 @@ -257,8 +257,20 @@ private[hive] class HiveMetastoreCatalog(sparkSession: 
SparkSession) extends Log
     }
     // The inferred schema may have different field names as the table schema, 
we should respect
     // it, but also respect the exprId in table relation output.
-    assert(result.output.length == relation.output.length &&
-      result.output.zip(relation.output).forall { case (a1, a2) => a1.dataType 
== a2.dataType })
+    if (result.output.length != relation.output.length) {
+      throw new HiveTableConvertException(
+        s"Converted table has ${result.output.length} columns, " +
+        s"but source Hive table has ${relation.output.length} columns. " +
+        s"Set ${HiveUtils.CONVERT_METASTORE_PARQUET.key} to false, " +
+        s"or recreate table ${relation.tableMeta.identifier} to workaround.")
+    }
+    if (!result.output.zip(relation.output).forall {
+          case (a1, a2) => a1.dataType.sameType(a2.dataType) }) {
 
 Review comment:
   This is a breaking change. We allow inferred schema may have different field 
names. `sameType` requires same field names. 

----------------------------------------------------------------
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]

Reply via email to