carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzcclp <...@git.apache.org>
Subject [GitHub] carbondata pull request #1469: [WIP] Spark-2.2 Carbon Integration - Phase 1
Date Thu, 23 Nov 2017 06:50:28 GMT
Github user zzcclp commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1469#discussion_r152730468
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSparkSqlParser.scala
---
    @@ -38,7 +40,26 @@ import org.apache.carbondata.spark.util.CommonUtil
      */
     class CarbonSparkSqlParser(conf: SQLConf, sparkSession: SparkSession) extends AbstractSqlParser
{
     
    -  val astBuilder = new CarbonSqlAstBuilder(conf)
    +  val parser = new CarbonSpark2SqlParser
    +  val astBuilder = getAstBuilder()
    +
    +  def getAstBuilder(): AstBuilder = {
    +    if (sparkSession.version.contains("2.1")) {
    +      val clazz = Utils.classForName("org.apache.spark.sql.hive.CarbonSqlAstBuilder")
    +      val ctor = clazz.getConstructors.head
    +      ctor.setAccessible(true)
    +      val astBuilder = ctor.newInstance(conf, parser).asInstanceOf[AstBuilder]
    +      astBuilder
    +    } else if (sparkSession.version.contains("2.2")) {
    +      val clazz = Utils.classForName("org.apache.spark.sql.hive.CarbonSqlAstBuilder")
    +      val ctor = clazz.getConstructors.head
    +      ctor.setAccessible(true)
    +      val astBuilder = ctor.newInstance(conf, parser).asInstanceOf[AstBuilder]
    +      astBuilder
    --- End diff --
    
    what's the difference between the code for 2.1 and 2.2


---

Mime
View raw message