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

    https://github.com/apache/carbondata/pull/1694#discussion_r158932436
  
    --- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/preaaggregate/PreAggregateUtil.scala
 ---
    @@ -166,127 +208,160 @@ object PreAggregateUtil {
           aggFunctions: AggregateFunction,
           parentTableName: String,
           parentDatabaseName: String,
    -      parentTableId: String) : scala.collection.mutable.ListBuffer[(Field, 
DataMapField)] = {
    +      parentTableId: String,
    +      newColumnName: String) : scala.collection.mutable.ListBuffer[(Field, 
DataMapField)] = {
         val list = scala.collection.mutable.ListBuffer.empty[(Field, 
DataMapField)]
         aggFunctions match {
    -      case sum@Sum(attr: AttributeReference) =>
    -        list += getField(attr.name,
    -          attr.dataType,
    -          sum.prettyName,
    -          carbonTable.getColumnByName(parentTableName, 
attr.name).getColumnId,
    -          parentTableName,
    -          parentDatabaseName, parentTableId = parentTableId)
    -      case sum@Sum(Cast(attr: AttributeReference, changeDataType: 
DataType)) =>
    -        list += getField(attr.name,
    +      case sum@Sum(MatchCastExpression(exp: Expression, changeDataType: 
DataType)) =>
    +        list += getFieldForAggregateExpression(exp,
               changeDataType,
    -          sum.prettyName,
    -          carbonTable.getColumnByName(parentTableName, 
attr.name).getColumnId,
    -          parentTableName,
    -          parentDatabaseName, parentTableId = parentTableId)
    -      case count@Count(Seq(attr: AttributeReference)) =>
    -        list += getField(attr.name,
    -          attr.dataType,
    -          count.prettyName,
    -          carbonTable.getColumnByName(parentTableName, 
attr.name).getColumnId,
    -          parentTableName,
    -          parentDatabaseName, parentTableId = parentTableId)
    -      case count@Count(Seq(Cast(attr: AttributeReference, _))) =>
    -        list += getField(attr.name,
    -          attr.dataType,
    -          count.prettyName,
    -          carbonTable.getColumnByName(parentTableName, 
attr.name).getColumnId,
    -          parentTableName,
    -          parentDatabaseName, parentTableId = parentTableId)
    -      case min@Min(attr: AttributeReference) =>
    -        list += getField(attr.name,
    -          attr.dataType,
    -          min.prettyName,
    -          carbonTable.getColumnByName(parentTableName, 
attr.name).getColumnId,
    -          parentTableName,
    -          parentDatabaseName, parentTableId = parentTableId)
    -      case min@Min(Cast(attr: AttributeReference, changeDataType: 
DataType)) =>
    -        list += getField(attr.name,
    +          carbonTable,
    +          newColumnName,
    +          sum.prettyName)
    +      case sum@Sum(exp: Expression) =>
    +        list += getFieldForAggregateExpression(exp,
    --- End diff --
    
    move first parameter to next line


---

Reply via email to