[fix](nereids) fix bug when grouping has same grouping set (#32235)
This commit is contained in:
@ -228,11 +228,18 @@ public interface Repeat<CHILD_PLAN extends Plan> extends Aggregate<CHILD_PLAN> {
|
||||
this.shapes = ImmutableList.copyOf(shapes);
|
||||
}
|
||||
|
||||
// compute a long value that backend need to fill to the GROUPING_ID slot
|
||||
/**compute a long value that backend need to fill to the GROUPING_ID slot*/
|
||||
public List<Long> computeVirtualGroupingIdValue() {
|
||||
return shapes.stream()
|
||||
.map(GroupingSetShape::computeLongValue)
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
Set<Long> res = Sets.newLinkedHashSet();
|
||||
long k = (long) Math.pow(2, flattenGroupingSetExpression.size());
|
||||
for (GroupingSetShape shape : shapes) {
|
||||
Long val = shape.computeLongValue();
|
||||
while (res.contains(val)) {
|
||||
val += k;
|
||||
}
|
||||
res.add(val);
|
||||
}
|
||||
return ImmutableList.copyOf(res);
|
||||
}
|
||||
|
||||
public int indexOf(Expression expression) {
|
||||
|
||||
Reference in New Issue
Block a user