Repository: carbondata
Updated Branches:
  refs/heads/master 0b83a8183 -> 79fc97a8d


[CARBONDATA-3117] Rearrange the projection list in the Scan

Rearrange the projection list in the Scan with respect to the requested 
projection columns from the query

This closes #2933


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/79fc97a8
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/79fc97a8
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/79fc97a8

Branch: refs/heads/master
Commit: 79fc97a8df0ec8d3a1bf0d21fb04948681cacf62
Parents: 0b83a81
Author: dhatchayani <[email protected]>
Authored: Tue Nov 20 15:00:02 2018 +0530
Committer: ravipesala <[email protected]>
Committed: Thu Nov 22 18:06:36 2018 +0530

----------------------------------------------------------------------
 .../sql/execution/strategy/CarbonLateDecodeStrategy.scala    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/79fc97a8/integration/spark2/src/main/scala/org/apache/spark/sql/execution/strategy/CarbonLateDecodeStrategy.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/strategy/CarbonLateDecodeStrategy.scala
 
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/strategy/CarbonLateDecodeStrategy.scala
index 16763d3..6993ecc 100644
--- 
a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/strategy/CarbonLateDecodeStrategy.scala
+++ 
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/strategy/CarbonLateDecodeStrategy.scala
@@ -18,6 +18,7 @@
 package org.apache.spark.sql.execution.strategy
 
 import scala.collection.JavaConverters._
+import scala.collection.mutable
 import scala.collection.mutable.ArrayBuffer
 
 import org.apache.spark.rdd.RDD
@@ -235,7 +236,9 @@ private[sql] class CarbonLateDecodeStrategy extends 
SparkStrategy {
       }
     }.asInstanceOf[Seq[NamedExpression]]
 
-    val projectSet = AttributeSet(projects.flatMap(_.references))
+    // contains the original order of the projection requested
+    val projectsAttr = projects.flatMap(_.references)
+    val projectSet = AttributeSet(projectsAttr)
     val filterSet = AttributeSet(filterPredicates.flatMap(_.references))
 
     val candidatePredicates = filterPredicates.map {
@@ -387,7 +390,8 @@ private[sql] class CarbonLateDecodeStrategy extends 
SparkStrategy {
       }
       // Don't request columns that are only referenced by pushed filters.
       val requestedColumns =
-        (projectSet ++ filterSet -- 
handledSet).map(relation.attributeMap).toSeq ++ newProjectList
+        (projectsAttr.to[mutable.LinkedHashSet] ++ filterSet -- handledSet)
+          .map(relation.attributeMap).toSeq ++ newProjectList
 
       var updateRequestedColumns =
         if (!vectorPushRowFilters && !implictsExisted && 
!hasDictionaryFilterCols

Reply via email to