From 20f9e53e7eb11fe7ce850f30630d77d9b377b63a Mon Sep 17 00:00:00 2001 From: Indhumathi27 Date: Wed, 28 Nov 2018 16:18:13 +0530 Subject: [PATCH] [CARBONDATA-3137] Update the Project List --- .../strategy/CarbonLateDecodeStrategy.scala | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) 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 a2c4bd0fe32..e0c2be99534 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 @@ -367,7 +367,7 @@ private[sql] class CarbonLateDecodeStrategy extends SparkStrategy { // In case of implicit exist we should disable vectorPushRowFilters as it goes in IUD flow // to get the positionId or tupleID var implictsExisted = false - val updatedProjects = projects.map { + var updatedProjects = projects.map { case a@Alias(s: ScalaUDF, name) if name.equalsIgnoreCase(CarbonCommonConstants.POSITION_ID) || name.equalsIgnoreCase(CarbonCommonConstants.CARBON_IMPLICIT_COLUMN_TUPLEID) => @@ -388,9 +388,15 @@ private[sql] class CarbonLateDecodeStrategy extends SparkStrategy { } case other => other } + val updatedColumns = getRequestedColumns(relation, + projectsAttr, + filterSet, + handledSet, + newProjectList, + updatedProjects) // Don't request columns that are only referenced by pushed filters. - val requestedColumns = - getRequestedColumns(relation, projectsAttr, filterSet, handledSet, newProjectList) + val requestedColumns = updatedColumns._1 + updatedProjects = updatedColumns._2 var updateRequestedColumns = if (!vectorPushRowFilters && !implictsExisted && !hasDictionaryFilterCols @@ -449,9 +455,10 @@ private[sql] class CarbonLateDecodeStrategy extends SparkStrategy { projectsAttr: Seq[Attribute], filterSet: AttributeSet, handledSet: AttributeSet, - newProjectList: Seq[Attribute]) = { - (projectsAttr.to[mutable.LinkedHashSet] ++ filterSet -- handledSet) - .map(relation.attributeMap).toSeq ++ newProjectList + newProjectList: Seq[Attribute], + updatedProjects: Seq[Expression]): (Seq[Attribute], Seq[Expression]) = { + ((projectsAttr.to[mutable.LinkedHashSet] ++ filterSet -- handledSet) + .map(relation.attributeMap).toSeq ++ newProjectList, updatedProjects) } private def getDataSourceScan(relation: LogicalRelation,