From 92ac8647e1d9f3eac8c8f2311f8972fcb4dad075 Mon Sep 17 00:00:00 2001 From: jackylee-ch Date: Fri, 6 Jan 2023 10:52:31 +0800 Subject: [PATCH] check aggregate mode for first func in build check --- .../execution/ColumnarHashAggregateExec.scala | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/native-sql-engine/core/src/main/scala/com/intel/oap/execution/ColumnarHashAggregateExec.scala b/native-sql-engine/core/src/main/scala/com/intel/oap/execution/ColumnarHashAggregateExec.scala index 5dd6e3987..4ee9e19fb 100644 --- a/native-sql-engine/core/src/main/scala/com/intel/oap/execution/ColumnarHashAggregateExec.scala +++ b/native-sql-engine/core/src/main/scala/com/intel/oap/execution/ColumnarHashAggregateExec.scala @@ -642,16 +642,22 @@ case class ColumnarHashAggregateExec( s"${other} is not supported in Columnar StddevSamp") } case first @ First(_, _) => - // Spark will use sort agg for string type input, see AggUtils.scala. - // So it will fallback to row-based operator for such case. - val supportedTypes = List(ByteType, ShortType, IntegerType, LongType, - FloatType, DoubleType, DateType, BooleanType, StringType) - val aggBufferAttr = first.inputAggBufferAttributes - val attr = ConverterUtils.getAttrFromExpr(aggBufferAttr.head) - // Currently, decimal is not supported. - if (supportedTypes.indexOf(attr.dataType) == -1) { - throw new UnsupportedOperationException(s"${attr.dataType} is NOT" + - s" supported in Columnar First!") + mode match { + case Partial | Final => + // Spark will use sort agg for string type input, see AggUtils.scala. + // So it will fallback to row-based operator for such case. + val supportedTypes = List(ByteType, ShortType, IntegerType, LongType, + FloatType, DoubleType, DateType, BooleanType, StringType) + val aggBufferAttr = first.inputAggBufferAttributes + val attr = ConverterUtils.getAttrFromExpr(aggBufferAttr.head) + // Currently, decimal is not supported. + if (supportedTypes.indexOf(attr.dataType) == -1) { + throw new UnsupportedOperationException(s"${attr.dataType} is NOT" + + s" supported in Columnar First!") + } + case other => + throw new UnsupportedOperationException(s"${other} is NOT supported" + + " for First agg func.") } case other => throw new UnsupportedOperationException(