Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1694#discussion_r159032604
  
    --- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/preaaggregate/PreAggregateUtil.scala
 ---
    @@ -116,29 +115,49 @@ object PreAggregateUtil {
           throw new MalformedCarbonCommandException(
             "Pre Aggregation is not supported on Pre-Aggregated Table")
         }
    +    var counter = 0
         aggExp.map {
    -      case Alias(attr: AggregateExpression, _) =>
    +      case Alias(attr: AggregateExpression, name) =>
             if (attr.isDistinct) {
               throw new MalformedCarbonCommandException(
                 "Distinct is not supported On Pre Aggregation")
             }
    -        fieldToDataMapFieldMap ++= 
validateAggregateFunctionAndGetFields(carbonTable,
    +        fieldToDataMapFieldMap ++= validateAggregateFunctionAndGetFields(
    +          carbonTable,
               attr.aggregateFunction,
               parentTableName,
               parentDatabaseName,
    -          parentTableId)
    +          parentTableId,
    +          "column_" + counter)
    +        counter = counter + 1
           case attr: AttributeReference =>
    -        fieldToDataMapFieldMap += getField(attr.name,
    +        val columnRelation = getColumnRelation(
    +          attr.name,
    +          parentTableId,
    +          parentTableName,
    +          parentDatabaseName,
    +          carbonTable)
    +        val arrayBuffer = new ArrayBuffer[ColumnTableRelation]()
    +        arrayBuffer += columnRelation
    +        fieldToDataMapFieldMap += createField(
    +          attr.name,
               attr.dataType,
    -          parentColumnId = carbonTable.getColumnByName(parentTableName, 
attr.name).getColumnId,
               parentTableName = parentTableName,
    -          parentDatabaseName = parentDatabaseName, parentTableId = 
parentTableId)
    +          columnTableRelationList = arrayBuffer.toList)
           case Alias(attr: AttributeReference, _) =>
    --- End diff --
    
    this case is the same as previous one, can be merged


---

Reply via email to