[GitHub] [carbondata] ravipesala commented on a change in pull request #3184: [CARBONDATA-3357] Support TableProperties from single parent table and restrict alter/delete/partition on mv

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] ravipesala commented on a change in pull request #3184: [CARBONDATA-3357] Support TableProperties from single parent table and restrict alter/delete/partition on mv

GitBox
ravipesala commented on a change in pull request #3184: [CARBONDATA-3357] Support TableProperties from single parent table and restrict alter/delete/partition on mv
URL: https://github.com/apache/carbondata/pull/3184#discussion_r279300690
 
 

 ##########
 File path: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVUtil.scala
 ##########
 @@ -0,0 +1,615 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.mv.datamap
+
+import scala.collection.mutable
+import scala.collection.mutable.ArrayBuffer
+
+import org.apache.spark.sql.{CarbonDatasourceHadoopRelation, SparkSession}
+import org.apache.spark.sql.catalyst.expressions._
+import org.apache.spark.sql.catalyst.expressions.aggregate._
+import org.apache.spark.sql.catalyst.plans.logical._
+import org.apache.spark.sql.execution.command.{ColumnTableRelation, DataMapField, Field}
+import org.apache.spark.sql.execution.datasources.LogicalRelation
+import org.apache.spark.sql.types.DataType
+
+import org.apache.carbondata.core.metadata.schema.table.CarbonTable
+import org.apache.carbondata.mv.plans.util.ExtractSelectModule
+import org.apache.carbondata.spark.util.CommonUtil
+
+/**
+ * Utility class for keeping all the utility method for mv datamap
+ */
+object MVUtil {
+
+  /**
+   * Below method will be used to validate and get the required fields from select plan
+   */
+  def getFieldsAndDataMapFieldsFromPlan(plan: LogicalPlan,
+      selectStmt: String,
+      sparkSession: SparkSession): scala.collection.mutable.LinkedHashMap[Field, DataMapField] = {
+    plan match {
+      case Project(projectList, logicalPlan: LogicalPlan) =>
+        getFieldsFromProject(projectList, logicalPlan, selectStmt, sparkSession)
+      case Aggregate(groupByExp, aggExp, SubqueryAlias(_, logicalRelation: LogicalRelation)) =>
+        getFieldsFromAggregate(groupByExp, aggExp, logicalRelation, selectStmt)
+      case Aggregate(groupByExp, aggExp, logicalRelation: LogicalRelation) =>
+        getFieldsFromAggregate(groupByExp, aggExp, logicalRelation, selectStmt)
+      case Aggregate(groupByExp, aggExp, join: Join) =>
+        getFieldsFromPlanAggregateWithJoin(groupByExp, aggExp, join, Seq.empty)
+      case Aggregate(groupByExp, aggExp, filter: Filter) =>
+        getFieldsFromPlanAggreagteWithFilter(groupByExp, aggExp, filter)
+    }
+  }
+
+  /**
+   * Collect Project, Filter and sort List attributes from plan and return fieldToDataMapField map
+   */
+  def getFieldsFromProject(projectList: Seq[NamedExpression],
+      child: LogicalPlan,
+      selectStmt: String,
+      sparkSession: SparkSession): mutable.LinkedHashMap[Field, DataMapField] = {
+    var fieldToDataMapFieldMap = scala.collection.mutable.LinkedHashMap.empty[Field, DataMapField]
+    var logicalRelation: LogicalRelation = null
+    var filterList: Seq[AttributeReference] = Seq.empty
+    var sortList: Seq[AttributeReference] = Seq.empty
+    if (!child.isInstanceOf[Join]) {
+      child.transform {
+        case lr: LogicalRelation =>
+          logicalRelation = lr
+          lr
+      }
+    } else {
+      val condition = child.asInstanceOf[Join].condition
+      return getFieldsFromPlanJoin(child, projectList, filterList, sortList, condition)
+    }
+    child match {
+      case sort: Sort =>
+        // collect sort attributes list
+        sort.order.map { s =>
+          s.collect {
+            case attr: AttributeReference =>
+              sortList = sortList.+:(attr)
+          }
+        }
+        sort.transformDown {
+          case agg@Aggregate(groupByExp,
+          aggExp, SubqueryAlias(_, logicalRelation: LogicalRelation)) =>
+            fieldToDataMapFieldMap = fieldToDataMapFieldMap ++ getFieldsFromAggregate(groupByExp,
+              aggExp,
+              logicalRelation,
+              selectStmt)
+            agg
+          case agg1@Aggregate(groupByExp, aggExp, logicalRelation: LogicalRelation) =>
+            fieldToDataMapFieldMap = fieldToDataMapFieldMap ++ getFieldsFromAggregate(groupByExp,
+              aggExp,
+              logicalRelation,
+              selectStmt)
+            agg1
+        }
+      case filter: Filter =>
+        filter.condition.collect {
+          case attr: AttributeReference =>
+            filterList = filterList.+:(attr)
+        }
+      case _ =>
+    }
+    child.transformDown {
+      case join@Join(left, right, joinType, condition) =>
+        return getFieldsFromPlanJoin(join, projectList, filterList, sortList, condition)
+    }
+    addFieldsToDataMapFieldMap(fieldToDataMapFieldMap,
+      logicalRelation,
+      projectList,
+      filterList,
+      sortList)
+    fieldToDataMapFieldMap
+  }
+
+  def addFieldsToDataMapFieldMap(fieldToDataMapFieldMap: scala.collection.mutable
+  .LinkedHashMap[Field, DataMapField],
+      logicalRelation: LogicalRelation,
+      projectList: Seq[NamedExpression],
+      filterList: Seq[AttributeReference],
+      sortList: Seq[AttributeReference]): Unit = {
+    val carbonTable = logicalRelation.relation.
+      asInstanceOf[CarbonDatasourceHadoopRelation].carbonRelation
+      .metaData.carbonTable
+    projectList.map {
+      case attr: AttributeReference =>
+        addFieldToDataMapField(fieldToDataMapFieldMap, carbonTable, attr, "", false)
+      case Alias(attr: AttributeReference, name) =>
+        addFieldToDataMapField(fieldToDataMapFieldMap, carbonTable, attr, name, true)
+    }
+    if (filterList.nonEmpty) {
+      filterList.map { attr =>
+        addFieldToDataMapField(fieldToDataMapFieldMap, carbonTable, attr, "", false)
+      }
+    }
+    if (sortList.nonEmpty) {
+      sortList.map { attr =>
+        addFieldToDataMapField(fieldToDataMapFieldMap, carbonTable, attr, "", false)
+      }
+    }
+  }
+
+  /**
+   * Below method will be used to get the fields from expressions(aggregate, Groupby)
+   */
+  def getFieldsFromAggregate(groupByExp: Seq[Expression],
+      aggExp: Seq[NamedExpression], logicalRelation: LogicalRelation, selectStmt: String):
+  scala.collection.mutable.LinkedHashMap[Field, DataMapField] = {
+    val fieldToDataMapFieldMap = scala.collection.mutable.LinkedHashMap.empty[Field, DataMapField]
+    val carbonTable = logicalRelation.relation.
+      asInstanceOf[CarbonDatasourceHadoopRelation].carbonRelation
+      .metaData.carbonTable
+    getFieldsFromAggregate(carbonTable, groupByExp, aggExp, fieldToDataMapFieldMap)
+    fieldToDataMapFieldMap
+  }
+
+  /**
+   * Below method will be used to get the fields from expressions(aggregate, Groupby) with Join
+   */
+  def getFieldsFromPlanAggregateWithJoin(groupByExp: Seq[Expression],
+      aggExp: Seq[NamedExpression],
+      join: Join,
+      filterList: Seq[AttributeReference]): mutable.LinkedHashMap[Field, DataMapField] = {
+    var fieldToDataMapFieldMap = scala.collection.mutable.LinkedHashMap.empty[Field, DataMapField]
+    if (join.left.isInstanceOf[Join]) {
+      fieldToDataMapFieldMap = fieldToDataMapFieldMap ++
+                               getFieldsFromPlanJoinWithAggregate(groupByExp,
+                                 aggExp,
+                                 join.left,
+                                 filterList)
+    }
+    if (join.right.isInstanceOf[Join]) {
+      fieldToDataMapFieldMap = fieldToDataMapFieldMap ++
+                               getFieldsFromPlanJoinWithAggregate(groupByExp,
+                                 aggExp,
+                                 join.right,
+                                 filterList)
+    }
+    fieldToDataMapFieldMap ++
+    getFieldsAggWithJoin(join.left, join.right, join.condition, groupByExp, aggExp, filterList)
+  }
+
+  def getFieldsAggWithJoin(left: LogicalPlan,
+      right: LogicalPlan,
+      condition: Option[Expression],
+      groupByExp: Seq[Expression],
+      aggExp: Seq[NamedExpression],
+      filterList: Seq[AttributeReference]): mutable.LinkedHashMap[Field, DataMapField] = {
+    var fieldToDataMapFieldMap = scala.collection.mutable.LinkedHashMap.empty[Field, DataMapField]
+    val leftTuple = ExtractSelectModule.collectProjectsFiltersJoinsAndSort(left)
+    val rightTuple = ExtractSelectModule.collectProjectsFiltersJoinsAndSort(right)
+    val (leftCarbonTable, rightCarbonTable) = getLeftAndRightCarbonTables(left, right)
+
+    aggExp.map { agg =>
+      var aggregateType: String = ""
+      val arrayBuffer: ArrayBuffer[ColumnTableRelation] = new ArrayBuffer[ColumnTableRelation]()
+      agg.collect {
+        case Alias(attr: AggregateExpression, name) =>
+          aggregateType = attr.aggregateFunction.nodeName
+      }
+      agg.collect {
+        case attr: AttributeReference =>
+          var carbonTable: CarbonTable = null
+          if (leftTuple._1.contains(attr)) {
+            carbonTable = leftCarbonTable
+          } else if (rightTuple._1.contains(attr)) {
+            carbonTable = rightCarbonTable
+          }
+          if (null != carbonTable) {
+            val relation = getColumnRelation(attr.name,
+              carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableId,
+              carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableName,
+              carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getDatabaseName,
+              carbonTable)
+            if (null != relation) {
+              arrayBuffer += relation
+            }
+            if (aggregateType.isEmpty && arrayBuffer.nonEmpty) {
+              val tableName = carbonTable.getTableName
+              fieldToDataMapFieldMap +=
+              getFieldToDataMapFields(agg.name, agg.dataType, aggregateType, arrayBuffer, tableName)
+            }
+          }
+      }
+      if (!aggregateType.isEmpty && arrayBuffer.nonEmpty) {
+        fieldToDataMapFieldMap +=
+        getFieldToDataMapFields(agg.name, agg.dataType, aggregateType, arrayBuffer, "")
+      }
+    }
+    groupByExp map { grb =>
+      val arrayBuffer: ArrayBuffer[ColumnTableRelation] = new ArrayBuffer[ColumnTableRelation]()
+      grb.collect {
+        case attr: AttributeReference =>
+          var carbonTable: CarbonTable = null
+          if (leftTuple._1.contains(attr)) {
+            carbonTable = leftCarbonTable
+          } else if (rightTuple._1.contains(attr)) {
+            carbonTable = rightCarbonTable
+          }
+          if (null != carbonTable) {
+            val relation = getColumnRelation(attr.name,
+              carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableId,
+              carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableName,
+              carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getDatabaseName,
+              carbonTable)
+            if (null != relation) {
+              arrayBuffer += relation
+            }
+            if (arrayBuffer.nonEmpty) {
+              fieldToDataMapFieldMap +=
+              getFieldToDataMapFields(attr.name,
+                attr.dataType,
+                "",
+                arrayBuffer,
+                carbonTable.getTableName)
+            }
+          }
+      }
+    }
+    if (condition.isDefined) {
+      condition match {
+        case Some(expr) =>
+          val arrayBuffer: ArrayBuffer[ColumnTableRelation] = new ArrayBuffer[ColumnTableRelation]()
+          expr.collect {
+            case attr: AttributeReference =>
+              var carbonTable: CarbonTable = null
+              if (leftTuple._1.contains(attr)) {
+                carbonTable = leftCarbonTable
+              } else if (rightTuple._1.contains(attr)) {
+                carbonTable = rightCarbonTable
+              }
+              if (null != carbonTable) {
+                val relation = getColumnRelation(attr.name,
+                  carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableId,
+                  carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableName,
+                  carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getDatabaseName,
+                  carbonTable)
+                if (null != relation) {
+                  arrayBuffer += relation
+                }
+                if (arrayBuffer.nonEmpty) {
+                  fieldToDataMapFieldMap +=
+                  getFieldToDataMapFields(attr.name,
+                    attr.dataType,
+                    "",
+                    arrayBuffer,
+                    carbonTable.getTableName)
+                }
+              }
+          }
+        case _ =>
+      }
+    }
+    if (filterList.nonEmpty) {
+      filterList.map { attr =>
+        val arrayBuffer: ArrayBuffer[ColumnTableRelation] = new ArrayBuffer[ColumnTableRelation]()
+        var carbonTable: CarbonTable = null
+        if (leftTuple._1.contains(attr)) {
+          carbonTable = leftCarbonTable
+        } else if (rightTuple._1.contains(attr)) {
+          carbonTable = rightCarbonTable
+        }
+        if (null != carbonTable) {
+          val relation = getColumnRelation(attr.name,
+            carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableId,
+            carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableName,
+            carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getDatabaseName,
+            carbonTable)
+          if (null != relation) {
+            arrayBuffer += relation
+          }
+          if (arrayBuffer.nonEmpty) {
+            fieldToDataMapFieldMap +=
+            getFieldToDataMapFields(attr.name,
+              attr.dataType,
+              "",
+              arrayBuffer,
+              carbonTable.getTableName)
+          }
+        }
+      }
+    }
+    fieldToDataMapFieldMap
+  }
+
+  def getLeftAndRightCarbonTables(left: LogicalPlan,
+      right: LogicalPlan): (CarbonTable, CarbonTable) = {
+    var leftCarbonTable: CarbonTable = null
+    var rightCarbonTable: CarbonTable = null
+    left.collect {
+      case lr: LogicalRelation =>
+        leftCarbonTable = lr.relation.asInstanceOf[CarbonDatasourceHadoopRelation].carbonRelation
+          .metaData.carbonTable
+    }
+    right.collect {
+      case lr: LogicalRelation =>
+        rightCarbonTable = lr.relation.asInstanceOf[CarbonDatasourceHadoopRelation].carbonRelation
+          .metaData.carbonTable
+    }
+    (leftCarbonTable, rightCarbonTable)
+  }
+
+  def getFieldsFromPlanAggreagteWithFilter(groupByExp: Seq[Expression],
+      aggExp: Seq[NamedExpression],
+      filter: Filter): mutable.LinkedHashMap[Field, DataMapField] = {
+    val fieldToDataMapFieldMap = scala.collection.mutable.LinkedHashMap.empty[Field, DataMapField]
+    var carbonTable: CarbonTable = null
+    var filterList: Seq[AttributeReference] = Seq.empty
+    filter.condition.collect {
+      case attr: AttributeReference =>
+        filterList = filterList.+:(attr)
+    }
+    filter.transform {
+      case join@Join(left, right, joinType, condition) =>
+        return getFieldsFromPlanAggregateWithJoin(groupByExp, aggExp, join, filterList)
+    }
+    filter.collect {
+      case lr: LogicalRelation =>
+        carbonTable = lr.relation.
+          asInstanceOf[CarbonDatasourceHadoopRelation].carbonRelation
+          .metaData.carbonTable
+    }
+    getFieldsFromAggregate(carbonTable, groupByExp, aggExp, fieldToDataMapFieldMap)
+    if (filterList.nonEmpty) {
+      filterList.map { attr =>
+        addFieldToDataMapField(fieldToDataMapFieldMap,
+          carbonTable,
+          attr, "", false)
+      }
+    }
+    fieldToDataMapFieldMap
+  }
+
+  def getFieldsFromPlanJoin(child: LogicalPlan,
+      projectList: Seq[NamedExpression],
+      filterList: Seq[NamedExpression],
+      sortList: Seq[NamedExpression],
+      condition: Option[Expression]): mutable.LinkedHashMap[Field, DataMapField] = {
+    var fieldToDataMapFieldMap = scala.collection.mutable.LinkedHashMap
+      .empty[Field, DataMapField]
+    child match {
+      case Join(left, right, joinType, filcondition) =>
+        if (left.isInstanceOf[Join]) {
+          fieldToDataMapFieldMap = fieldToDataMapFieldMap ++
+                                   getFieldsFromPlanJoin(left,
+                                     projectList,
+                                     filterList,
+                                     sortList,
+                                     condition)
+        }
+        if (right.isInstanceOf[Join]) {
+          fieldToDataMapFieldMap = fieldToDataMapFieldMap ++
+                                   getFieldsFromPlanJoin(right,
+                                     projectList,
+                                     filterList,
+                                     sortList,
+                                     condition)
+        }
+        val leftTuple = ExtractSelectModule.collectProjectsFiltersJoinsAndSort(left)
+        val rightTuple = ExtractSelectModule.collectProjectsFiltersJoinsAndSort(right)
+        val (leftCarbonTable, rightCarbonTable) = getLeftAndRightCarbonTables(left, right)
+
+        def getFields(attr: AttributeReference, name: String, isAlias: Boolean) = {
+          if (leftTuple._1.contains(attr)) {
+            addFieldToDataMapField(fieldToDataMapFieldMap, leftCarbonTable, attr, name, isAlias)
+          } else if (rightTuple._1.contains(attr)) {
+            addFieldToDataMapField(fieldToDataMapFieldMap, rightCarbonTable, attr, name, isAlias)
+          }
+        }
+
+        projectList.foreach {
+          case attr: AttributeReference =>
+            getFields(attr, "", isAlias = false)
+          case Alias(attr: AttributeReference, name) =>
+            getFields(attr, name, isAlias = true)
+        }
+        filterList.foreach {
+          case attr: AttributeReference =>
+            getFields(attr, "", isAlias = false)
+
+        }
+        sortList.foreach {
+          case attr: AttributeReference =>
+            getFields(attr, "", isAlias = false)
+        }
+        if (condition.isDefined) {
+          condition match {
+            case Some(expr) =>
+              expr.collect {
+                case attr: AttributeReference =>
+                  getFields(attr, "", isAlias = false)
+              }
+            case _ =>
+          }
+        }
+    }
+    fieldToDataMapFieldMap
+  }
+
+  def getFieldsFromPlanJoinWithAggregate(groupByExp: Seq[Expression],
+      aggExp: Seq[NamedExpression],
+      plan: LogicalPlan,
+      filterList: Seq[AttributeReference]): mutable.LinkedHashMap[Field, DataMapField] = {
+    plan match {
+      case join@Join(left, right, joinType, condition) =>
+        getFieldsFromPlanAggregateWithJoin(groupByExp, aggExp, join, filterList)
+    }
+  }
+
+  /**
+   * Below method will be used to get the fields object for mv table
+   */
+  def createField(columnName: String,
+      isAlias: Boolean,
+      qualifier: Option[String],
+      dataType: DataType,
+      aggregateType: String = "",
+      parentTableName: String,
+      columnTableRelationList: Seq[ColumnTableRelation]): (Field, DataMapField) = {
+    val actualColumnName = if (aggregateType.equals("")) {
+      if (!parentTableName.equals("")) {
+        if (!isAlias) {
+          if (qualifier.isDefined) {
+            qualifier.map(qualifier => qualifier + "_" + columnName).getOrElse(columnName)
+          } else {
+            parentTableName + '_' + columnName
+          }
+        } else {
+          columnName
+        }
+      } else {
+        columnName
+      }
+    } else {
+      if (!parentTableName.equals("")) { aggregateType + '_' + columnName } else { columnName }
+    }
+    getFields(dataType, aggregateType, columnTableRelationList, actualColumnName)
+  }
+
+  /**
+   * Below method will be used to get the column relation
+   * with the parent column which will be used during query and data loading
+   */
+  def getColumnRelation(parentColumnName: String,
+      parentTableId: String,
+      parentTableName: String,
+      parentDatabaseName: String,
+      carbonTable: CarbonTable): ColumnTableRelation = {
+    val parentColumn = carbonTable.getColumnByName(parentTableName, parentColumnName)
+    var columnTableRelation: ColumnTableRelation = null
+    if (null != parentColumn) {
+      val parentColumnId = parentColumn.getColumnId
+      columnTableRelation = ColumnTableRelation(parentColumnName = parentColumnName,
+        parentColumnId = parentColumnId,
+        parentTableName = parentTableName,
+        parentDatabaseName = parentDatabaseName, parentTableId = parentTableId)
+      columnTableRelation
+    } else {
+      columnTableRelation
+    }
+  }
+
+  private def getFields(dataType: DataType,
+      aggregateType: String,
+      columnTableRelationList: Seq[ColumnTableRelation],
+      actualColumnName: String) = {
+    val rawSchema = '`' + actualColumnName + '`' + ' ' + dataType.typeName
+    val dataMapField = DataMapField(aggregateType, Some(columnTableRelationList))
+    if (dataType.typeName.startsWith("decimal")) {
+      val (precision, scale) = CommonUtil.getScaleAndPrecision(dataType.catalogString)
+      (Field(column = actualColumnName,
+        dataType = Some(dataType.typeName),
+        name = Some(actualColumnName),
+        children = None,
+        precision = precision,
+        scale = scale,
+        rawSchema = rawSchema), dataMapField)
+    } else {
+      (Field(column = actualColumnName,
+        dataType = Some(dataType.typeName),
+        name = Some(actualColumnName),
+        children = None,
+        rawSchema = rawSchema), dataMapField)
+    }
+  }
+
+  private def getFieldToDataMapFields(name: String, dataType: DataType,
+      aggregateType: String,
+      arrayBuffer: ArrayBuffer[ColumnTableRelation], parenTableName: String) = {
+    var actualColumnName = name.replace("(", "_")
+      .replace(")", "")
+      .replace(" ", "_")
+      .replace("=", "")
+      .replace(",", "")
+    if (aggregateType.isEmpty && !parenTableName.isEmpty) {
+      actualColumnName = parenTableName + "_" + actualColumnName
+    }
+    getFields(dataType, aggregateType, arrayBuffer, actualColumnName)
+  }
+
+  private def getFieldsFromAggregate(carbonTable: CarbonTable,
+      groupByExp: Seq[Expression],
+      aggExp: Seq[NamedExpression],
+      fieldToDataMapFieldMap: mutable.LinkedHashMap[Field, DataMapField]): scala.collection
+  .mutable.LinkedHashMap[Field, DataMapField] = {
+    aggExp.map { agg =>
+      var aggregateType: String = ""
+      val arrayBuffer: ArrayBuffer[ColumnTableRelation] = new ArrayBuffer[ColumnTableRelation]()
+      var tableName = carbonTable.getTableName
+      var columnName = agg.name
+      agg.collect {
+        case attr: AttributeReference =>
+          arrayBuffer += getColumnRelation(attr.name,
+            carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableId,
+            carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableName,
+            carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getDatabaseName,
+            carbonTable)
+        case Alias(attr: AggregateExpression, name) =>
+          aggregateType = attr.aggregateFunction.nodeName
+        case Alias(_, name) =>
 
 Review comment:
   I am not sure of the use of the above 2 cases.  why not a single case is enough?

----------------------------------------------------------------
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]


With regards,
Apache Git Services