Skip to content
Merged
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 @@ -71,7 +71,7 @@ public boolean useDeferredGroupBySelector(
return false;
}

if (!capabilities.isNumeric() && !capabilities.isDictionaryEncoded().isTrue()) {
if (!capabilities.isNumeric() && !isDictionaryEncodedScalarString(capabilities)) {
// Not fixed-width.
return false;
}
Expand Down Expand Up @@ -106,7 +106,7 @@ public boolean useDeferredGroupBySelector(

allNumericInputs = allNumericInputs && capabilities.isNumeric();

if (!capabilities.isNumeric() && !capabilities.isDictionaryEncoded().isTrue()) {
if (!capabilities.isNumeric() && !isDictionaryEncodedScalarString(capabilities)) {
// Not fixed-width.
return false;
}
Expand Down Expand Up @@ -162,6 +162,25 @@ public String toString()
return jsonName;
}


/**
* {@link VectorColumnSelectorFactory} currently can only make dictionary encoded selectors for string types, so
* we can only consider them as fixed width. Additionally, to err on the side of safety, multi-value string columns
* are also not considered fixed width because expressions process multi-value dimensions as single rows, so we would
* need all dictionary ids to be present in the combined key.
*
* At the time of this javadoc, vector group by does not support multi-value dimensions anyway, so this isn't really
* a problem, but if it did, we could consider allowing them if we ensure that all multi-value inputs are used as
* scalars and so the expression can be applied separately to each individual dictionary id (e.g. the equivalent of
* {@link ExpressionPlan.Trait#SINGLE_INPUT_MAPPABLE} but for all multi-value string inputs of the expression).
*/
private static boolean isDictionaryEncodedScalarString(ColumnCapabilities capabilities)
{
return capabilities.isDictionaryEncoded().isTrue() &&
capabilities.is(ValueType.STRING) &&
capabilities.hasMultipleValues().isFalse();
}

/**
* Whether the given expression can be deferred innately by the selector created by
* {@link ExpressionVirtualColumn#makeSingleValueVectorDimensionSelector(DimensionSpec, VectorColumnSelectorFactory)}.
Expand Down
Loading