Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/11048#discussion_r52617996
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkQl.scala ---
@@ -62,6 +66,458 @@ private[sql] class SparkQl(conf: ParserConf =
SimpleParserConf()) extends Cataly
val tableIdent = extractTableIdent(nameParts)
RefreshTable(tableIdent)
+ case Token("TOK_CREATEDATABASE", Token(databaseName, Nil) ::
createDatabaseArgs) =>
+ val Seq(
+ allowExisting,
+ dbLocation,
+ databaseComment,
+ dbprops) = getClauses(Seq(
+ "TOK_IFNOTEXISTS",
+ "TOK_DATABASELOCATION",
+ "TOK_DATABASECOMMENT",
+ "TOK_DATABASEPROPERTIES"), createDatabaseArgs)
+
+ val location = dbLocation.map {
+ case Token("TOK_DATABASELOCATION", Token(loc, Nil) :: Nil) =>
unquoteString(loc)
+ }
+ val comment = databaseComment.map {
+ case Token("TOK_DATABASECOMMENT", Token(comment, Nil) :: Nil) =>
unquoteString(comment)
+ }
+ val props: Map[String, String] = dbprops.toSeq.flatMap {
+ case Token("TOK_DATABASEPROPERTIES", propList) =>
--- End diff --
This looks very similar to code in SparkQl
https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkQl.scala#L91-L99.
We could also try to integrate the concepts of
TOK_DBPROPLIST/TOK_TABLEOPTIONS and TOK_TABLEPROPERTY/TOK_TABLEOPTION.
---
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]