Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/1118#discussion_r13954704
--- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala ---
@@ -362,13 +367,19 @@ private[hive] object HiveQl {
}
}
+ protected def extractDbNameTableName(tableNameParts: Node):
(Option[String], String) = {
+ val (db, tableName) =
+ tableNameParts.getChildren.map{ case Token(part, Nil) =>
cleanIdentifier(part)} match {
+ case Seq(tableOnly) => (None, tableOnly)
+ case Seq(databaseName, table) => (Some(databaseName), table)
+ }
+
+ (db, tableName)
+ }
+
protected def nodeToPlan(node: Node): LogicalPlan = node match {
// Just fake explain for any of the native commands.
- case Token("TOK_EXPLAIN", explainArgs) if nativeCommands contains
explainArgs.head.getText =>
- ExplainCommand(NoRelation)
- // Create tables aren't native commands due to CTAS queries, but we
still don't need to
- // explain them.
- case Token("TOK_EXPLAIN", explainArgs) if explainArgs.head.getText ==
"TOK_CREATETABLE" =>
+ case Token("TOK_EXPLAIN", explainArgs) if noExplainCommands contains
explainArgs.head.getText =>
--- End diff --
avoid infix contains here, i.e.
```scala
noExplainCommands.contains(explainArgs.head.getText)
```
---
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.
---