[
https://issues.apache.org/jira/browse/CARBONDATA-50?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15381332#comment-15381332
]
ASF GitHub Bot commented on CARBONDATA-50:
------------------------------------------
Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/incubator-carbondata/pull/35#discussion_r71081842
--- Diff:
integration/spark/src/main/scala/org/apache/spark/sql/optimizer/CarbonOptimizer.scala
---
@@ -37,427 +36,461 @@ import org.carbondata.spark.CarbonFilters
/**
* Carbon Optimizer to add dictionary decoder.
*/
-class CarbonOptimizer(optimizer: Optimizer, conf: CatalystConf)
- extends Optimizer with PredicateHelper {
+object CarbonOptimizer {
- val batches = Nil
+ def optimizer(optimizer: Optimizer, conf: CarbonSQLConf, version:
String): Optimizer = {
+
CodeGenerateFactory.getInstance().optimizerFactory.createOptimizer(optimizer,
conf)
+ }
- override def execute(plan: LogicalPlan): LogicalPlan = {
+ def execute(plan: LogicalPlan, optimizer: Optimizer): LogicalPlan = {
val executedPlan: LogicalPlan = optimizer.execute(plan)
- val relations = collectCarbonRelation(plan)
+ val relations = CarbonOptimizer.collectCarbonRelation(plan)
if (relations.nonEmpty) {
- new ResolveCarbonFunctions(relations)(executedPlan)
+ new ResolveCarbonFunctions(relations).apply(executedPlan)
} else {
executedPlan
}
}
- /**
- * It does two jobs. 1. Change the datatype for dictionary encoded
column 2. Add the dictionary
- * decoder plan.
- */
- class ResolveCarbonFunctions(relations: Seq[CarbonDecoderRelation])
extends
- Rule[LogicalPlan] {
- def apply(plan: LogicalPlan): LogicalPlan = {
- transformCarbonPlan(plan, relations)
+ // get the carbon relation from plan.
+ def collectCarbonRelation(plan: LogicalPlan): Seq[CarbonDecoderRelation]
= {
+ plan collect {
+ case l: LogicalRelation if
l.relation.isInstanceOf[CarbonDatasourceRelation] =>
+ CarbonDecoderRelation(l.attributeMap,
l.relation.asInstanceOf[CarbonDatasourceRelation])
}
+ }
+}
+
+/**
+ * It does two jobs. 1. Change the datatype for dictionary encoded column
2. Add the dictionary
+ * decoder plan.
+ */
+class ResolveCarbonFunctions(
--- End diff --
Its parent class is `CarbonOptimizer`, and this class extends `Rule` not
`Optimizer` so it is just one rule to change the plan. That is why it is named
as `ResolveCarbonFunctions`
> Support Spark 1.6.2 in CarbonData
> ---------------------------------
>
> Key: CARBONDATA-50
> URL: https://issues.apache.org/jira/browse/CARBONDATA-50
> Project: CarbonData
> Issue Type: New Feature
> Reporter: Ravindra Pesala
> Assignee: Ravindra Pesala
>
> Current carbon cannot support latest Spark version 1.6.2. It should be
> supported with new maven profile like below
> {code}
> mvn clean -Pspark-1.6.2 package
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)