Posted by
GitBox on
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-ajantha-bhat-opened-a-new-pull-request-3932-WIP-order-by-limit-pushdown-for-array-r-tp100485p102286.html
ajantha-bhat commented on a change in pull request #3932:
URL:
https://github.com/apache/carbondata/pull/3932#discussion_r508460403##########
File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/strategy/CarbonLateDecodeStrategy.scala
##########
@@ -984,6 +988,80 @@ private[sql] class CarbonLateDecodeStrategy extends SparkStrategy {
null)(sparkSession)
}
}
+
+ object ExtractTakeOrderedAndProjectExec {
+
+ def unapply(plan: LogicalPlan): Option[CarbonTakeOrderedAndProjectExec] = {
+ val allRelations = plan.collect { case logicalRelation: LogicalRelation => logicalRelation }
+ // push down order by limit to carbon map task,
+ // only when there are only one CarbonDatasourceHadoopRelation
+ if (allRelations.size != 1 ||
+ allRelations.exists(x => !x.relation.isInstanceOf[CarbonDatasourceHadoopRelation])) {
+ return None
+ }
+ // check and Replace TakeOrderedAndProject with CarbonTakeOrderedAndProjectExec.
+ val relation = allRelations.head.relation.asInstanceOf[CarbonDatasourceHadoopRelation]
+ val sparkPlan = plan match {
+ case ReturnAnswer(rootPlan) => rootPlan match {
+ case Limit(IntegerLiteral(limit), Sort(order, true, child)) =>
+ TakeOrderedAndProjectExec(limit,
+ order,
+ child.output,
+ planLater(pushLimit(limit, child)))
+ case Limit(IntegerLiteral(limit), Project(projectList, Sort(order, true, child))) =>
+ TakeOrderedAndProjectExec(limit, order, projectList, planLater(pushLimit(limit, child)))
Review comment:
ok. Handled.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[hidden email]