Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,12 @@ private static Operator operator(DriverContext driverContext, String grouping, S
new BlockHash.GroupSpec(2, ElementType.BYTES_REF)
);
case TOP_N_LONGS -> List.of(
new BlockHash.GroupSpec(0, ElementType.LONG, null, new BlockHash.TopNDef(0, true, true, TOP_N_LIMIT))
new BlockHash.GroupSpec(0, ElementType.LONG, null, new BlockHash.TopNDef(0, true, true, TOP_N_LIMIT), null)
);
default -> throw new IllegalArgumentException("unsupported grouping [" + grouping + "]");
};
return new HashAggregationOperator(
groups,
List.of(supplier(op, dataType, filter).groupingAggregatorFactory(AggregatorMode.SINGLE, List.of(groups.size()))),
() -> BlockHash.build(groups, driverContext.blockFactory(), 16 * 1024, false),
driverContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ private static Operator operator(DriverContext driverContext, int groups, String
}
List<BlockHash.GroupSpec> groupSpec = List.of(new BlockHash.GroupSpec(0, ElementType.LONG));
return new HashAggregationOperator(
groupSpec,
List.of(supplier(dataType).groupingAggregatorFactory(mode, List.of(1))),
() -> BlockHash.build(groupSpec, driverContext.blockFactory(), 16 * 1024, false),
driverContext
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public class GroupingAggregator implements Releasable {

private final AggregatorMode mode;

public AggregatorMode getMode() {
return mode;
}

public interface Factory extends Function<DriverContext, GroupingAggregator>, Describable {}

public GroupingAggregator(GroupingAggregatorFunction aggregatorFunction, AggregatorMode mode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ public abstract class BlockHash implements Releasable, SeenGroupIds {
*/
public record TopNDef(int order, boolean asc, boolean nullsFirst, int limit) {}

public interface EmptyBucketGenerator {
int getEmptyBucketCount();

void generate(Block.Builder blockBuilder);
}

/**
* Configuration for a BlockHash group spec that is doing text categorization.
*/
Expand All @@ -137,13 +143,19 @@ public enum OutputFormat {
}
}

public record GroupSpec(int channel, ElementType elementType, @Nullable CategorizeDef categorizeDef, @Nullable TopNDef topNDef) {
public record GroupSpec(
int channel,
ElementType elementType,
@Nullable CategorizeDef categorizeDef,
@Nullable TopNDef topNDef,
@Nullable EmptyBucketGenerator emptyBucketGenerator
) {
public GroupSpec(int channel, ElementType elementType) {
this(channel, elementType, null, null);
this(channel, elementType, null, null, null);
}

public GroupSpec(int channel, ElementType elementType, CategorizeDef categorizeDef) {
this(channel, elementType, categorizeDef, null);
this(channel, elementType, categorizeDef, null, null);
}

public boolean isCategorize() {
Expand Down
Loading
Loading