Github user kumarvishal09 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1671#discussion_r157337872
--- 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 --
In case of sum and average data type will be always bigint or double so we
can store as measure in case of count it will be of actual data type
---