mirror of https://github.com/apache/druid.git
Fix druid sql group by queries returning complex aggregation type (#8099)
* Fix druid sql group by queries returning complex aggregation type * Remove unnecessary check
This commit is contained in:
parent
01f3da6fda
commit
ceb3a891bb
|
@ -28,6 +28,7 @@ import org.apache.druid.math.expr.ExprType;
|
||||||
import org.apache.druid.query.aggregation.PostAggregator;
|
import org.apache.druid.query.aggregation.PostAggregator;
|
||||||
import org.apache.druid.query.aggregation.post.ExpressionPostAggregator;
|
import org.apache.druid.query.aggregation.post.ExpressionPostAggregator;
|
||||||
import org.apache.druid.segment.VirtualColumn;
|
import org.apache.druid.segment.VirtualColumn;
|
||||||
|
import org.apache.druid.segment.column.ValueType;
|
||||||
import org.apache.druid.sql.calcite.expression.DruidExpression;
|
import org.apache.druid.sql.calcite.expression.DruidExpression;
|
||||||
import org.apache.druid.sql.calcite.expression.Expressions;
|
import org.apache.druid.sql.calcite.expression.Expressions;
|
||||||
import org.apache.druid.sql.calcite.planner.Calcites;
|
import org.apache.druid.sql.calcite.planner.Calcites;
|
||||||
|
@ -193,11 +194,14 @@ public class Projection
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a cast is necessary.
|
// We don't really have a way to cast complex type. So might as well not do anything and return.
|
||||||
final ExprType toExprType = Expressions.exprTypeForValueType(
|
final ValueType columnValueType = aggregateRowSignature.getColumnType(expression.getDirectColumn());
|
||||||
aggregateRowSignature.getColumnType(expression.getDirectColumn())
|
if (columnValueType == ValueType.COMPLEX) {
|
||||||
);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if a cast is necessary.
|
||||||
|
final ExprType toExprType = Expressions.exprTypeForValueType(columnValueType);
|
||||||
final ExprType fromExprType = Expressions.exprTypeForValueType(
|
final ExprType fromExprType = Expressions.exprTypeForValueType(
|
||||||
Calcites.getValueTypeForSqlTypeName(rexNode.getType().getSqlTypeName())
|
Calcites.getValueTypeForSqlTypeName(rexNode.getType().getSqlTypeName())
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue