Huawei-Spark / Spark-SQL-on-HBase

Native, optimized access to HBase Data through Spark SQL/Dataframe Interfaces
Apache License 2.0
321 stars 164 forks source link

Some of the codes that I can't understand #26

Closed ccsshh closed 9 years ago

ccsshh commented 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(";") ^^ {

xinyunh commented 9 years ago

Hi @ccsshh ,

Please refer http://www.scala-lang.org/api/2.11.7/scala-parser-combinators/#scala.util.parsing.combinator.Parsers