Skip to content

Commit

Permalink
Merge 8b83773 into 9d02092
Browse files Browse the repository at this point in the history
  • Loading branch information
akashrn5 committed Jun 6, 2019
2 parents 9d02092 + 8b83773 commit b8b4e1d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 26 deletions.
Expand Up @@ -254,22 +254,35 @@ class CarbonInMemorySessionStateBuilder (sparkSession: SparkSession,

override lazy val optimizer: Optimizer = new CarbonOptimizer(catalog, conf, experimentalMethods)

override protected def analyzer: Analyzer = new CarbonAnalyzer(catalog, conf, sparkSession,
override protected def analyzer: Analyzer = {
new CarbonAnalyzer(catalog,
conf,
sparkSession,
getAnalyzer(super.analyzer))
}

/**
* This method adds carbon rules to Hive Analyzer and returns new analyzer
*
* @param analyzer SessionStateBuilder analyzer
* @return
*/
def getAnalyzer(analyzer: Analyzer): Analyzer = {
new Analyzer(catalog, conf) {

override val extendedResolutionRules: Seq[Rule[LogicalPlan]] =
new FindDataSourceTable(session) +:
new ResolveSQLOnFile(session) +:
new CarbonIUDAnalysisRule(sparkSession) +:
new CarbonPreInsertionCasts(sparkSession) +: customResolutionRules
analyzer.extendedResolutionRules ++
Seq(CarbonIUDAnalysisRule(sparkSession)) ++
Seq(CarbonPreInsertionCasts(sparkSession)) ++ customResolutionRules

override val extendedCheckRules: Seq[LogicalPlan => Unit] =
PreWriteCheck :: HiveOnlyCheck :: Nil
analyzer.extendedCheckRules

override val postHocResolutionRules: Seq[Rule[LogicalPlan]] =
PreprocessTableCreation(session) +:
PreprocessTableInsertion(conf) +:
DataSourceAnalysis(conf) +:
customPostHocResolutionRules
analyzer.postHocResolutionRules
}
)
}

override protected def newBuilder: NewBuilder = new CarbonInMemorySessionStateBuilder(_, _)
}

Expand Up @@ -236,29 +236,33 @@ class CarbonSessionStateBuilder(sparkSession: SparkSession,

override lazy val optimizer: Optimizer = new CarbonOptimizer(catalog, conf, experimentalMethods)

override protected def analyzer: Analyzer = new CarbonAnalyzer(catalog, conf, sparkSession,
override protected def analyzer: Analyzer = {
new CarbonAnalyzer(catalog,
conf,
sparkSession,
getAnalyzer(super.analyzer))
}

/**
* This method adds carbon rules to Hive Analyzer and returns new analyzer
* @param analyzer hiveSessionStateBuilder analyzer
* @return
*/
def getAnalyzer(analyzer: Analyzer): Analyzer = {
new Analyzer(catalog, conf) {

override val extendedResolutionRules: Seq[Rule[LogicalPlan]] =
new ResolveHiveSerdeTable(session) +:
new FindDataSourceTable(session) +:
new ResolveSQLOnFile(session) +:
new CarbonIUDAnalysisRule(sparkSession) +:
new CarbonPreInsertionCasts(sparkSession) +: customResolutionRules
analyzer.extendedResolutionRules ++
Seq(CarbonIUDAnalysisRule(sparkSession)) ++
Seq(CarbonPreInsertionCasts(sparkSession)) ++ customResolutionRules

override val extendedCheckRules: Seq[LogicalPlan => Unit] =
PreWriteCheck :: HiveOnlyCheck :: Nil
analyzer.extendedCheckRules

override val postHocResolutionRules: Seq[Rule[LogicalPlan]] =
new DetermineTableStats(session) +:
RelationConversions(conf, catalog) +:
PreprocessTableCreation(session) +:
PreprocessTableInsertion(conf) +:
DataSourceAnalysis(conf) +:
HiveAnalysis +:
customPostHocResolutionRules
analyzer.postHocResolutionRules
}
)
}

override protected def newBuilder: NewBuilder = new CarbonSessionStateBuilder(_, _)
}

0 comments on commit b8b4e1d

Please sign in to comment.