Github user xubo245 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2004#discussion_r170906653 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/preaaggregate/PreAggregateUtil.scala --- @@ -346,11 +346,13 @@ object PreAggregateUtil { carbonTable) } // if parent column relation is of size more than one that means aggregate table - // column is derived from multiple column of main table - // or if expression is not a instance of attribute reference + // column is derived from multiple column of main table or if size is zero then it means + // column is present in select statement is some constants for example count(*) + // and if expression is not a instance of attribute reference // then use column name which is passed val columnName = - if (parentColumnsName.size > 1 && !expression.isInstanceOf[AttributeReference]) { + if ((parentColumnsName.size > 1 || parentColumnsName.isEmpty) && + !expression.isInstanceOf[AttributeReference]) { newColumnName --- End diff -- Why don't we use 1_count instead of 0_count in default? It is count(1) after spark parser count(*)
---