jzhuge commented on a change in pull request #24741: [SPARK-27322][SQL]
DataSourceV2: Select from multiple catalogs
URL: https://github.com/apache/spark/pull/24741#discussion_r290583573
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveStrategies.scala
##########
@@ -153,7 +153,8 @@ object HiveAnalysis extends Rule[LogicalPlan] {
case CreateTable(tableDesc, mode, None) if DDLUtils.isHiveTable(tableDesc)
=>
CreateTableCommand(tableDesc, ignoreIfExists = mode == SaveMode.Ignore)
- case CreateTable(tableDesc, mode, Some(query)) if
DDLUtils.isHiveTable(tableDesc) =>
+ case CreateTable(tableDesc, mode, Some(query))
+ if DDLUtils.isHiveTable(tableDesc) && query.resolved =>
Review comment:
This PR prevents lookupTableFromCatalog from throwing NoSuchTableException
right away. Instead, it relies on checkAnalysis to throw an exception for
UnresolvedRelation.
The test hive.SQLQuerySuite."double nested data" would fail in the following
sql without this change:
```
CREATE TABLE test_ctas_1234 AS SELECT * from notexists
```
HiveAnalysis gets to run before checkAnalysis, thus exposing this bug where
query.output is used before query is resolved.
So wouldn't say it is a totally separate issue.
In addition, outside of this PR, it'd be hard to write a unit test.
----------------------------------------------------------------
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]