Closed ccsshh closed 9 years ago
When I read the part of HBaseSQlParser,the follow code that I can't understand. what the meaning of these?what the use of these?
protected lazy val insertValues: Parser[LogicalPlan] = INSERT ~> INTO ~> TABLE ~> ident ~ (VALUES ~> "(" ~> values <~ ")") ^^ { case tableName ~ valueSeq => val valueStringSeq = valueSeq.map { case v => if (v.value == null) null else v.value.toString } InsertValueIntoTableCommand(tableName, valueStringSeq) }
protected lazy val create: Parser[LogicalPlan] = CREATE ~> TABLE ~> ident ~ ("(" ~> tableCols <~ ",") ~ (PRIMARY ~> KEY ~> "(" ~> keys <~ ")" <~ ")") ~ (MAPPED ~> BY ~> "(" ~> opt(nameSpace)) ~ (ident <~ ",") ~ (COLS ~> "=" ~> "[" ~> expressions <~ "]" <~ ")") ~ (IN ~> ident).? <~ opt(";") ^^ {
Hi @ccsshh ,
Please refer http://www.scala-lang.org/api/2.11.7/scala-parser-combinators/#scala.util.parsing.combinator.Parsers
When I read the part of HBaseSQlParser,the follow code that I can't understand. what the meaning of these?what the use of these?
protected lazy val insertValues: Parser[LogicalPlan] = INSERT ~> INTO ~> TABLE ~> ident ~ (VALUES ~> "(" ~> values <~ ")") ^^ { case tableName ~ valueSeq => val valueStringSeq = valueSeq.map { case v => if (v.value == null) null else v.value.toString } InsertValueIntoTableCommand(tableName, valueStringSeq) }
protected lazy val create: Parser[LogicalPlan] = CREATE ~> TABLE ~> ident ~ ("(" ~> tableCols <~ ",") ~ (PRIMARY ~> KEY ~> "(" ~> keys <~ ")" <~ ")") ~ (MAPPED ~> BY ~> "(" ~> opt(nameSpace)) ~ (ident <~ ",") ~ (COLS ~> "=" ~> "[" ~> expressions <~ "]" <~ ")") ~ (IN ~> ident).? <~ opt(";") ^^ {