Skip to content

Commit c7845c9

Browse files
committed
Simplify toAddHintsOnAggregate condition
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent 21667c7 commit c7845c9

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,13 +1137,12 @@ private void visitAggregation(
11371137
}
11381138
groupExprList.addAll(node.getGroupExprList());
11391139

1140-
// add stats hint to LogicalAggregation
1140+
// Add stats hint to LogicalAggregation.
11411141
boolean toAddHintsOnAggregate =
1142-
nonNullGroupMask.nextClearBit(0)
1143-
>= groupExprList.size() // This checks if all group-bys should be nonnull
1144-
&& !groupExprList.isEmpty()
1145-
&& !(groupExprList.size() == 1 && getTimeSpanField(span).isPresent());
1146-
// add isNotNull filter before aggregation for non-nullable buckets
1142+
!groupExprList.isEmpty()
1143+
// This checks if all group-bys should be nonnull
1144+
&& nonNullGroupMask.nextClearBit(0) >= groupExprList.size();
1145+
// Add isNotNull filter before aggregation for non-nullable buckets
11471146
List<RexNode> groupByList =
11481147
groupExprList.stream().map(expr -> rexVisitor.analyze(expr, context)).toList();
11491148
List<RexNode> nonNullGroupBys =

0 commit comments

Comments
 (0)