HyukjinKwon commented on a change in pull request #28177:
[SPARK-31407][SQL][TEST] Fix hive/SQLQuerySuite.derived from Hive query file:
drop_database_removes_partition_dirs.q
URL: https://github.com/apache/spark/pull/28177#discussion_r407284481
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/test/TestHive.scala
##########
@@ -588,20 +588,29 @@ private[hive] class TestHiveQueryExecution(
override lazy val analyzed: LogicalPlan = {
val describedTables = logical match {
- case CacheTableCommand(tbl, _, _, _) => tbl.table :: Nil
+ case CacheTableCommand(tbl, _, _, _) => (tbl.table, tbl.database) :: Nil
case _ => Nil
}
// Make sure any test tables referenced are loaded.
val referencedTables =
describedTables ++
- logical.collect { case UnresolvedRelation(ident) => ident.last }
+ logical.collect { case UnresolvedRelation(ident) => (ident.last,
ident.init.lastOption) }
val resolver = sparkSession.sessionState.conf.resolver
- val referencedTestTables = sparkSession.testTables.keys.filter { testTable
=>
- referencedTables.exists(resolver(_, testTable))
+ val referencedTestTables = referencedTables.flatMap { case (table, dbOpt)
=>
+ val testTableOpt = sparkSession.testTables.keys.find(resolver(_, table))
+ testTableOpt.map(testTable => Seq((testTable,
dbOpt))).getOrElse(Seq.empty)
Review comment:
nit: I think we can just do `testTableOpt.map(testTable => (testTable,
tbl.database))`
----------------------------------------------------------------
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]