tanishqgandhi1908 commented on code in PR #5896:
URL: https://github.com/apache/texera/pull/5896#discussion_r3456581173
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/aggregate/AggregateOpDesc.scala:
##########
@@ -78,9 +78,14 @@ class AggregateOpDesc extends LogicalOp {
val inputSchema = inputSchemas(operatorInfo.inputPorts.head.id)
val outputSchema = Schema(
groupByKeys.map(key => inputSchema.getAttribute(key)) ++
- localAggregations.map(agg =>
-
agg.getAggregationAttribute(inputSchema.getAttribute(agg.attribute).getType)
- )
+ localAggregations.map { agg =>
+ // A blank attribute (COUNT(*)) has no input column to look up
+ // so a null attrType is safe here.
+ val attrType =
+ if (agg.attribute == null || agg.attribute.trim.isEmpty) null
+ else inputSchema.getAttribute(agg.attribute).getType
+ agg.getAggregationAttribute(attrType)
+ }
Review Comment:
The COUNT(*) guards in AggregateOpExec and AggregateOpDesc now key off
aggFunction == COUNT_STAR instead of whether the attribute is blank, so the
attribute is ignored regardless of its value and no input-column lookup happens
for COUNT(*). Also updated both guard tests to use a stale attribute that isn't
in the schema, so the previous behavior would have thrown. Existing functions
(count on a column, sum, etc.) are unaffected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]