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

    https://github.com/apache/carbondata/pull/1671#discussion_r157337178
  
    --- Diff: 
integration/spark-common/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala
 ---
    @@ -514,17 +514,40 @@ class TableNewProcessor(cm: TableModel) {
         }
     
         cm.msrCols.foreach { field =>
    -      val encoders = new java.util.ArrayList[Encoding]()
    +      // if aggregate function is defined in case of preaggregate and agg 
function is sum or avg
    +      // then it can be stored as measure
    +      var isAggFunPresent = false
    +      // getting the encoder from maintable so whatever encoding is 
applied in maintable
    +      // same encoder can be applied on aggregate table
    +      val encoders = if (cm.parentTable.isDefined && 
cm.dataMapRelation.get.get(field).isDefined) {
    +        isAggFunPresent =
    +          
cm.dataMapRelation.get.get(field).get.aggregateFunction.equalsIgnoreCase("sum") 
||
    +          
cm.dataMapRelation.get.get(field).get.aggregateFunction.equals("avg")
    --- End diff --
    
    How about count aggregate?


---

Reply via email to