Skip to content

Commit

Permalink
Correct instantiation of rollup count_where operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
lbooker42 committed Dec 20, 2024
1 parent 83e0c97 commit d348e3f
Showing 1 changed file with 43 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -651,45 +651,8 @@ final void addWeightedAvgOrSumOperator(
addOperator(resultOperator, r.source, r.pair.input().name(), weightName);
});
}
}

// -----------------------------------------------------------------------------------------------------------------
// Standard Aggregations
// -----------------------------------------------------------------------------------------------------------------

/**
* Implementation class for conversion from a collection of {@link Aggregation aggregations} to an
* {@link AggregationContext} for standard aggregations. Accumulates state by visiting each aggregation.
*/
private final class NormalConverter extends Converter {
private final QueryCompilerRequestProcessor.BatchProcessor compilationProcessor;

private NormalConverter(
@NotNull final Table table,
final boolean requireStateChangeRecorder,
@NotNull final String... groupByColumnNames) {
super(table, requireStateChangeRecorder, groupByColumnNames);
this.compilationProcessor = QueryCompilerRequestProcessor.batch();
}

@Override
AggregationContext build() {
final AggregationContext resultContext = super.build();
compilationProcessor.compile();
return resultContext;
}

// -------------------------------------------------------------------------------------------------------------
// Aggregation.Visitor
// -------------------------------------------------------------------------------------------------------------

@Override
public void visit(@NotNull final Count count) {
addNoInputOperator(new CountAggregationOperator(count.column().name()));
}

@Override
public void visit(@NotNull final CountWhere countWhere) {
final void addCountWhereOperator(@NotNull CountWhere countWhere) {
final WhereFilter[] whereFilters = WhereFilter.fromInternal(countWhere.filter());

final Map<String, RecordingInternalOperator> inputColumnRecorderMap = new HashMap<>();
Expand Down Expand Up @@ -737,6 +700,47 @@ public void visit(@NotNull final CountWhere countWhere) {
addOperator(new CountWhereOperator(countWhere.column().name(), whereFilters, recorders, filterRecorders),
null, inputColumnNames);
}
}

// -----------------------------------------------------------------------------------------------------------------
// Standard Aggregations
// -----------------------------------------------------------------------------------------------------------------

/**
* Implementation class for conversion from a collection of {@link Aggregation aggregations} to an
* {@link AggregationContext} for standard aggregations. Accumulates state by visiting each aggregation.
*/
private final class NormalConverter extends Converter {
private final QueryCompilerRequestProcessor.BatchProcessor compilationProcessor;

private NormalConverter(
@NotNull final Table table,
final boolean requireStateChangeRecorder,
@NotNull final String... groupByColumnNames) {
super(table, requireStateChangeRecorder, groupByColumnNames);
this.compilationProcessor = QueryCompilerRequestProcessor.batch();
}

@Override
AggregationContext build() {
final AggregationContext resultContext = super.build();
compilationProcessor.compile();
return resultContext;
}

// -------------------------------------------------------------------------------------------------------------
// Aggregation.Visitor
// -------------------------------------------------------------------------------------------------------------

@Override
public void visit(@NotNull final Count count) {
addNoInputOperator(new CountAggregationOperator(count.column().name()));
}

@Override
public void visit(@NotNull final CountWhere countWhere) {
addCountWhereOperator(countWhere);
}

@Override
public void visit(@NotNull final FirstRowKey firstRowKey) {
Expand Down Expand Up @@ -1051,7 +1055,7 @@ public void visit(@NotNull final Count count) {

@Override
public void visit(@NotNull final CountWhere countWhere) {
addNoInputOperator(new CountAggregationOperator(countWhere.column().name()));
addCountWhereOperator(countWhere);
}

@Override
Expand Down

0 comments on commit d348e3f

Please sign in to comment.