Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/14397#discussion_r72912387
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -131,17 +131,17 @@ class Analyzer(
def substituteCTE(plan: LogicalPlan, cteRelations: Map[String,
LogicalPlan]): LogicalPlan = {
plan transform {
- // In hive, if there is same table name in database and CTE
definition,
- // hive will use the table in database, not the CTE one.
- // Taking into account the reasonableness and the implementation
complexity,
- // here use the CTE definition first, check table name only and
ignore database name
- // see
https://github.com/apache/spark/pull/4929#discussion_r27186638 for more info
case u : UnresolvedRelation =>
- val substituted = cteRelations.get(u.tableIdentifier.table).map
{ relation =>
- val withAlias = u.alias.map(SubqueryAlias(_, relation))
- withAlias.getOrElse(relation)
+ try {
+ catalog.lookupRelation(u.tableIdentifier, u.alias)
--- End diff --
This integrates some of the functionality of the `ResolveRelations` rule,
but not all (for instance file based datasources). Shouldn't we be consistent
and (perhaps) integrate these rules?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]