cloud-fan commented on code in PR #44190:
URL: https://github.com/apache/spark/pull/44190#discussion_r1425084776
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalog.scala:
##########
@@ -232,7 +233,19 @@ class V2SessionCatalog(catalog: SessionCatalog)
throw QueryCompilationErrors.tableAlreadyExistsError(ident)
}
- loadTable(ident)
+ val table = loadTable(ident)
+
+ // Check if the schema of the created table matches the given schema.
+ if (schema.nonEmpty) {
+ val tableSchema = CharVarcharUtils.replaceCharVarcharWithStringInSchema(
+ table.columns().asSchema)
+ if (!DataType.equalsIgnoreNullability(tableSchema, schema)) {
Review Comment:
can we check it in `loadTable`? In case the data source is a bit random and
only return wrong schema at second time.
--
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]