Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change group key delimiter from '\t' to '\0' #5858

Merged
merged 1 commit into from
Aug 18, 2020

Conversation

Jackie-Jiang
Copy link
Contributor

Description

Using '\t' as the group key delimiter will cause unexpected behavior when grouping on string value with '\t' inside. To solve it, we can use '\0' as the delimiter which is not allowed in the string values.

  • Add code to handle both '\0' and '\t' as limiter on broker side for backward-compatibility
  • Specialize case of grouping on single expression to save the redundant group key splits.

Upgrade Notes

In order to achieve zero down-time upgrade, Brokers must be upgraded before Servers.

Copy link
Contributor

@xiangfu0 xiangfu0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

for (int i = 0; i < numGroupByExpressions; i++) {
converterFunctions[i] = getConverterFunction(_dataSchema.getColumnDataType(i));
}
if (numGroupByExpressions == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we separate single groupby ? for performance ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. For single group-by, we don't need to split the string for each group key

public AggregationGroupByTrimmingService(QueryContext queryContext) {
_aggregationFunctions = queryContext.getAggregationFunctions();
List<ExpressionContext> groupByExpressions = queryContext.getGroupByExpressions();
assert groupByExpressions != null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we stick to Preconditions.checkArgument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually use assert to indicate that it is not possible to be null for readability, which will be ignored in production environment.
Preconditions are used for catching the illegal user input and throw exceptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants