Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2100#discussion_r177652486
  
    --- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
 ---
    @@ -150,34 +150,39 @@ class CarbonSpark2SqlParser extends 
CarbonDDLSqlParser {
        */
       protected lazy val createDataMap: Parser[LogicalPlan] =
         CREATE ~> DATAMAP ~> opt(IF ~> NOT ~> EXISTS) ~ ident ~
    -    (ON ~ TABLE) ~  (ident <~ ".").? ~ ident ~
    +    opt(ontable) ~
         (USING ~> stringLit) ~ (DMPROPERTIES ~> "(" ~> repsep(loadOptions, 
",") <~ ")").? ~
         (AS ~> restInput).? <~ opt(";") ^^ {
    -      case ifnotexists ~ dmname ~ ontable ~ dbName ~ tableName ~ className 
~ dmprops ~ query =>
    +      case ifnotexists ~ dmname ~ tableIdent ~ className ~ dmprops ~ query 
=>
    +
             val map = dmprops.getOrElse(List[(String, 
String)]()).toMap[String, String]
    -        CarbonCreateDataMapCommand(
    -          dmname, TableIdentifier(tableName, dbName), className, map, 
query, ifnotexists.isDefined)
    +        CarbonCreateDataMapCommand(dmname, tableIdent, className, map, 
query, ifnotexists.isDefined)
    +    }
    +
    +  protected lazy val ontable: Parser[TableIdentifier] =
    +    ON ~> TABLE ~>  (ident <~ ".").? ~ ident ^^ {
    +      case dbName ~ tableName =>
    +        TableIdentifier(tableName, dbName)
         }
     
       /**
        * The below syntax is used to drop the datamap.
        * DROP DATAMAP IF EXISTS datamapName ON TABLE tablename
        */
       protected lazy val dropDataMap: Parser[LogicalPlan] =
    -    DROP ~> DATAMAP ~> opt(IF ~> EXISTS) ~ ident ~ (ON ~ TABLE) ~
    -    (ident <~ ".").? ~ ident <~ opt(";")  ^^ {
    -      case ifexists ~ dmname ~ ontable ~ dbName ~ tableName =>
    -        CarbonDropDataMapCommand(dmname, ifexists.isDefined, dbName, 
tableName)
    +    DROP ~> DATAMAP ~> opt(IF ~> EXISTS) ~ ident ~ opt(ontable) <~ 
opt(";")  ^^ {
    +      case ifexists ~ dmname ~ tableIdent =>
    +        CarbonDropDataMapCommand(dmname, ifexists.isDefined, tableIdent)
         }
     
       /**
        * The syntax of show datamap is used to show datamaps on the table
        * SHOW DATAMAP ON TABLE tableName
        */
       protected lazy val showDataMap: Parser[LogicalPlan] =
    -    SHOW ~> DATAMAP ~> ON ~> TABLE ~> (ident <~ ".").? ~ ident <~ opt(";") 
^^ {
    -      case databaseName ~ tableName =>
    -        CarbonDataMapShowCommand(convertDbNameToLowerCase(databaseName), 
tableName.toLowerCase())
    +    SHOW ~> DATAMAP ~> opt(ontable) <~ opt(";") ^^ {
    --- End diff --
    
    it should be but I am scared about backward compatability


---

Reply via email to