Github user hvanhovell commented on a diff in the pull request: https://github.com/apache/spark/pull/10723#discussion_r49975804 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/SparkQl.scala --- @@ -42,6 +45,81 @@ private[sql] class SparkQl(conf: ParserConf = SimpleParserConf()) extends Cataly getClauses(Seq("TOK_QUERY", "FORMATTED", "EXTENDED"), explainArgs) ExplainCommand(nodeToPlan(query), extended = extended.isDefined) + case Token("TOK_REFRESHTABLE", nameParts :: Nil) => + val tableIdent = extractTableIdent(nameParts) + RefreshTable(tableIdent) + + case Token("TOK_CREATETABLEUSING", createTableArgs) => + val clauses = getClauses( + Seq("TEMPORARY", "TOK_IFNOTEXISTS", "TOK_TABNAME", "TOK_TABCOLLIST", "TOK_TABLEPROVIDER", + "TOK_TABLEOPTIONS", "TOK_QUERY"), createTableArgs) + + val temp = clauses(0) + val allowExisting = clauses(1) + val Some(tabName) = clauses(2) + val tableCols = clauses(3) + val Some(tableProvider) = clauses(4) + val tableOpts = clauses(5) + val tableAs = clauses(6) + + val tableIdent: TableIdentifier = tabName match { + case Token("TOK_TABNAME", Token(tableName, _) :: Nil) => TableIdentifier(tableName) + } + + val columns = tableCols.map { + case Token("TOK_TABCOLLIST", fields) => StructType(fields.map(nodeToStructField)) + } + + val provider = tableProvider match { + case Token("TOK_TABLEPROVIDER", Token(provider, _) :: Nil) => provider + } --- End diff -- You could make more use of pattern matching here. For example: val temp :: allowExisting :: Some(Token("TOK_TABNAME", Token(tableName, Nil)) :: tableCols :: Some(Token("TOK_TABLEPROVIDER", Token(provider, Nil) :: Nil)) :: tableOpts :: tableAs :: Nil = getClauses(Seq( "TEMPORARY", "TOK_IFNOTEXISTS", "TOK_TABNAME", "TOK_TABCOLLIST", "TOK_TABLEPROVIDER", "TOK_TABLEOPTIONS", "TOK_QUERY"), createTableArgs)
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org