cherry-pick #38166 to branch-2.1
This commit is contained in:
@ -51,6 +51,8 @@ import com.google.common.collect.Sets.SetView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -133,9 +135,9 @@ public class NormalizeRepeat extends OneAnalysisRuleFactory {
|
||||
Set<Expression> needToSlotsGroupingExpr = collectNeedToSlotGroupingExpr(repeat);
|
||||
NormalizeToSlotContext groupingExprContext = buildContext(repeat, needToSlotsGroupingExpr);
|
||||
Map<Expression, NormalizeToSlotTriplet> groupingExprMap = groupingExprContext.getNormalizeToSlotMap();
|
||||
Set<Alias> existsAlias = getExistsAlias(repeat, groupingExprMap);
|
||||
Map<Expression, Alias> existsAlias = getExistsAlias(repeat, groupingExprMap);
|
||||
Set<Expression> needToSlotsArgs = collectNeedToSlotArgsOfGroupingScalarFuncAndAggFunc(repeat);
|
||||
NormalizeToSlotContext argsContext = NormalizeToSlotContext.buildContext(existsAlias, needToSlotsArgs);
|
||||
NormalizeToSlotContext argsContext = buildContextWithAlias(repeat, existsAlias, needToSlotsArgs);
|
||||
|
||||
// normalize grouping sets to List<List<Slot>>
|
||||
ImmutableList.Builder<List<Slot>> normalizedGroupingSetBuilder = ImmutableList.builder();
|
||||
@ -254,12 +256,27 @@ public class NormalizeRepeat extends OneAnalysisRuleFactory {
|
||||
/** buildContext */
|
||||
public static NormalizeToSlotContext buildContext(Repeat<? extends Plan> repeat,
|
||||
Set<? extends Expression> sourceExpressions) {
|
||||
Set<Alias> aliases = ExpressionUtils.collect(repeat.getOutputExpressions(), Alias.class::isInstance);
|
||||
List<Alias> aliases = ExpressionUtils.collectToList(repeat.getOutputExpressions(), Alias.class::isInstance);
|
||||
Map<Expression, Alias> existsAliasMap = Maps.newLinkedHashMap();
|
||||
for (Alias existsAlias : aliases) {
|
||||
if (existsAliasMap.containsKey(existsAlias.child())) {
|
||||
continue;
|
||||
}
|
||||
existsAliasMap.put(existsAlias.child(), existsAlias);
|
||||
}
|
||||
|
||||
Map<Expression, NormalizeToSlotTriplet> normalizeToSlotMap = Maps.newLinkedHashMap();
|
||||
for (Expression expression : sourceExpressions) {
|
||||
Optional<NormalizeToSlotTriplet> pushDownTriplet =
|
||||
toGroupingSetExpressionPushDownTriplet(expression, existsAliasMap.get(expression));
|
||||
pushDownTriplet.ifPresent(
|
||||
normalizeToSlotTriplet -> normalizeToSlotMap.put(expression, normalizeToSlotTriplet));
|
||||
}
|
||||
return new NormalizeToSlotContext(normalizeToSlotMap);
|
||||
}
|
||||
|
||||
private static NormalizeToSlotContext buildContextWithAlias(Repeat<? extends Plan> repeat,
|
||||
Map<Expression, Alias> existsAliasMap, Collection<? extends Expression> sourceExpressions) {
|
||||
List<Expression> groupingSetExpressions = ExpressionUtils.flatExpressions(repeat.getGroupingSets());
|
||||
Map<Expression, NormalizeToSlotTriplet> normalizeToSlotMap = Maps.newLinkedHashMap();
|
||||
for (Expression expression : sourceExpressions) {
|
||||
@ -270,10 +287,8 @@ public class NormalizeRepeat extends OneAnalysisRuleFactory {
|
||||
pushDownTriplet = Optional.of(
|
||||
NormalizeToSlotTriplet.toTriplet(expression, existsAliasMap.get(expression)));
|
||||
}
|
||||
|
||||
if (pushDownTriplet.isPresent()) {
|
||||
normalizeToSlotMap.put(expression, pushDownTriplet.get());
|
||||
}
|
||||
pushDownTriplet.ifPresent(
|
||||
normalizeToSlotTriplet -> normalizeToSlotMap.put(expression, normalizeToSlotTriplet));
|
||||
}
|
||||
return new NormalizeToSlotContext(normalizeToSlotMap);
|
||||
}
|
||||
@ -304,18 +319,23 @@ public class NormalizeRepeat extends OneAnalysisRuleFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private static Set<Alias> getExistsAlias(LogicalRepeat<Plan> repeat,
|
||||
private static Map<Expression, Alias> getExistsAlias(LogicalRepeat<Plan> repeat,
|
||||
Map<Expression, NormalizeToSlotTriplet> groupingExprMap) {
|
||||
Set<Alias> existsAlias = Sets.newHashSet();
|
||||
Set<Alias> aliases = ExpressionUtils.collect(repeat.getOutputExpressions(), Alias.class::isInstance);
|
||||
existsAlias.addAll(aliases);
|
||||
Map<Expression, Alias> existsAliasMap = new HashMap<>();
|
||||
for (NormalizeToSlotTriplet triplet : groupingExprMap.values()) {
|
||||
if (triplet.pushedExpr instanceof Alias) {
|
||||
Alias alias = (Alias) triplet.pushedExpr;
|
||||
existsAlias.add(alias);
|
||||
existsAliasMap.put(triplet.originExpr, alias);
|
||||
}
|
||||
}
|
||||
return existsAlias;
|
||||
List<Alias> aliases = ExpressionUtils.collectToList(repeat.getOutputExpressions(), Alias.class::isInstance);
|
||||
for (Alias alias : aliases) {
|
||||
if (existsAliasMap.containsKey(alias.child())) {
|
||||
continue;
|
||||
}
|
||||
existsAliasMap.put(alias.child(), alias);
|
||||
}
|
||||
return existsAliasMap;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -699,6 +699,15 @@ public class ExpressionUtils {
|
||||
return set.build();
|
||||
}
|
||||
|
||||
public static <E> List<E> collectToList(Collection<? extends Expression> expressions,
|
||||
Predicate<TreeNode<Expression>> predicate) {
|
||||
ImmutableList.Builder<E> list = ImmutableList.builder();
|
||||
for (Expression expr : expressions) {
|
||||
list.addAll(expr.collectToList(predicate));
|
||||
}
|
||||
return list.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* extract uniform slot for the given predicate, such as a = 1 and b = 2
|
||||
*/
|
||||
|
||||
@ -0,0 +1,531 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !alias --
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
3
|
||||
3
|
||||
4
|
||||
4
|
||||
|
||||
-- !alias_grouping_scalar --
|
||||
1 0
|
||||
1 0
|
||||
2 0
|
||||
2 0
|
||||
3 0
|
||||
3 0
|
||||
4 0
|
||||
4 0
|
||||
|
||||
-- !alias_agg_func --
|
||||
1 1
|
||||
1 1
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
|
||||
-- !same_column_different_alias --
|
||||
1 1
|
||||
1 1
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
|
||||
-- !same_column_different_alias_grouping_scalar --
|
||||
1 1 0
|
||||
1 1 0
|
||||
2 2 0
|
||||
2 2 0
|
||||
3 3 0
|
||||
3 3 0
|
||||
4 4 0
|
||||
4 4 0
|
||||
|
||||
-- !same_column_different_alias_agg_func --
|
||||
1 1 1
|
||||
1 1 1
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
|
||||
-- !same_column_different_alias_3_column --
|
||||
1 1 1
|
||||
1 1 1
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
|
||||
-- !same_column_different_alias_3_column_grouping_scalar --
|
||||
1 1 1 0
|
||||
1 1 1 0
|
||||
2 2 2 0
|
||||
2 2 2 0
|
||||
3 3 3 0
|
||||
3 3 3 0
|
||||
4 4 4 0
|
||||
4 4 4 0
|
||||
|
||||
-- !same_column_different_alias_3_column_agg_func --
|
||||
1 1 1 1
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
3 3 3 3
|
||||
4 4 4 4
|
||||
4 4 4 4
|
||||
|
||||
-- !same_column_one_has_alias_the_other_do_not --
|
||||
1 1
|
||||
1 1
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
|
||||
-- !same_column_one_has_alias_the_other_do_not_grouping_scalar --
|
||||
1 1 0
|
||||
1 1 0
|
||||
2 2 0
|
||||
2 2 0
|
||||
3 3 0
|
||||
3 3 0
|
||||
4 4 0
|
||||
4 4 0
|
||||
|
||||
-- !same_column_one_has_alias_the_other_do_not_agg_func --
|
||||
1 1 1
|
||||
1 1 1
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
|
||||
-- !alias_expr --
|
||||
2
|
||||
2
|
||||
3
|
||||
3
|
||||
4
|
||||
4
|
||||
5
|
||||
5
|
||||
|
||||
-- !alias_grouping_scalar_expr --
|
||||
2 0
|
||||
2 0
|
||||
3 0
|
||||
3 0
|
||||
4 0
|
||||
4 0
|
||||
5 0
|
||||
5 0
|
||||
|
||||
-- !alias_agg_func_expr --
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
5 5
|
||||
5 5
|
||||
|
||||
-- !same_expr_different_alias --
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
5 5
|
||||
5 5
|
||||
|
||||
-- !same_expr_different_alias_grouping_scalar --
|
||||
2 2 0
|
||||
2 2 0
|
||||
3 3 0
|
||||
3 3 0
|
||||
4 4 0
|
||||
4 4 0
|
||||
5 5 0
|
||||
5 5 0
|
||||
|
||||
-- !same_expr_different_alias_agg_func --
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
5 5 5
|
||||
5 5 5
|
||||
|
||||
-- !same_expr_different_alias_3_expr --
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
5 5 5
|
||||
5 5 5
|
||||
|
||||
-- !same_expr_different_alias_3_expr_grouping_scalar --
|
||||
2 2 2 0
|
||||
2 2 2 0
|
||||
3 3 3 0
|
||||
3 3 3 0
|
||||
4 4 4 0
|
||||
4 4 4 0
|
||||
5 5 5 0
|
||||
5 5 5 0
|
||||
|
||||
-- !same_expr_different_alias_3_expr_agg_func --
|
||||
2 2 2 2
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
3 3 3 3
|
||||
4 4 4 4
|
||||
4 4 4 4
|
||||
5 5 5 5
|
||||
5 5 5 5
|
||||
|
||||
-- !same_expr_one_has_alias_the_other_do_not --
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
5 5
|
||||
5 5
|
||||
|
||||
-- !same_expr_one_has_alias_the_other_do_not_grouping_scalar --
|
||||
2 2 0
|
||||
2 2 0
|
||||
3 3 0
|
||||
3 3 0
|
||||
4 4 0
|
||||
4 4 0
|
||||
5 5 0
|
||||
5 5 0
|
||||
|
||||
-- !same_expr_one_has_alias_the_other_do_not_agg_func --
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
5 5 5
|
||||
5 5 5
|
||||
|
||||
-- !expr_without_alias --
|
||||
2
|
||||
2
|
||||
3
|
||||
3
|
||||
4
|
||||
4
|
||||
5
|
||||
5
|
||||
|
||||
-- !expr_without_alias_grouping_scalar --
|
||||
2 0
|
||||
2 0
|
||||
3 0
|
||||
3 0
|
||||
4 0
|
||||
4 0
|
||||
5 0
|
||||
5 0
|
||||
|
||||
-- !expr_without_alias_agg_func --
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
5 5
|
||||
5 5
|
||||
|
||||
-- !same_expr_without_alias --
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
5 5
|
||||
5 5
|
||||
|
||||
-- !same_expr_without_alias_grouping_scalar --
|
||||
2 2 0
|
||||
2 2 0
|
||||
3 3 0
|
||||
3 3 0
|
||||
4 4 0
|
||||
4 4 0
|
||||
5 5 0
|
||||
5 5 0
|
||||
|
||||
-- !same_expr_without_alias_agg_func --
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
5 5 5
|
||||
5 5 5
|
||||
|
||||
-- !expr_with_or_without_alias_3_expr --
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
5 5 5
|
||||
5 5 5
|
||||
|
||||
-- !expr_with_or_without_alias_3_expr_grouping_scalar --
|
||||
2 2 2 0
|
||||
2 2 2 0
|
||||
3 3 3 0
|
||||
3 3 3 0
|
||||
4 4 4 0
|
||||
4 4 4 0
|
||||
5 5 5 0
|
||||
5 5 5 0
|
||||
|
||||
-- !expr_with_or_without_alias_3_expr_agg_func --
|
||||
2 2 2 2
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
3 3 3 3
|
||||
4 4 4 4
|
||||
4 4 4 4
|
||||
5 5 5 5
|
||||
5 5 5 5
|
||||
|
||||
-- !alias_in_grouping --
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
3
|
||||
3
|
||||
4
|
||||
4
|
||||
|
||||
-- !alias_grouping_scalar_in_grouping --
|
||||
1 0
|
||||
1 0
|
||||
2 0
|
||||
2 0
|
||||
3 0
|
||||
3 0
|
||||
4 0
|
||||
4 0
|
||||
|
||||
-- !alias_agg_func_in_grouping --
|
||||
1 1
|
||||
1 1
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
|
||||
-- !same_column_different_alias_in_grouping --
|
||||
1 1
|
||||
1 1
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
|
||||
-- !same_column_different_alias_grouping_scalar_in_grouping --
|
||||
1 1 0
|
||||
1 1 0
|
||||
2 2 0
|
||||
2 2 0
|
||||
3 3 0
|
||||
3 3 0
|
||||
4 4 0
|
||||
4 4 0
|
||||
|
||||
-- !same_column_different_alias_agg_func_in_grouping --
|
||||
1 1 1
|
||||
1 1 1
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
|
||||
-- !same_column_different_alias_in_grouping_3_column --
|
||||
1 1 1
|
||||
1 1 1
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
|
||||
-- !same_column_different_alias_in_grouping_3_column_grouping_scalar --
|
||||
1 1 1 0
|
||||
1 1 1 0
|
||||
2 2 2 0
|
||||
2 2 2 0
|
||||
3 3 3 0
|
||||
3 3 3 0
|
||||
4 4 4 0
|
||||
4 4 4 0
|
||||
|
||||
-- !same_column_different_alias_in_grouping_3_column_agg_func --
|
||||
1 1 1 1
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
3 3 3 3
|
||||
4 4 4 4
|
||||
4 4 4 4
|
||||
|
||||
-- !same_column_one_has_alias_in_grouping_the_other_do_not --
|
||||
1 1
|
||||
1 1
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
|
||||
-- !same_column_one_has_alias_in_grouping_the_other_do_not_grouping_scalar --
|
||||
1 1 0
|
||||
1 1 0
|
||||
2 2 0
|
||||
2 2 0
|
||||
3 3 0
|
||||
3 3 0
|
||||
4 4 0
|
||||
4 4 0
|
||||
|
||||
-- !same_column_one_has_alias_in_grouping_the_other_do_not_agg_func --
|
||||
1 1 1
|
||||
1 1 1
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
|
||||
-- !alias_in_grouping_expr --
|
||||
2
|
||||
2
|
||||
3
|
||||
3
|
||||
4
|
||||
4
|
||||
5
|
||||
5
|
||||
|
||||
-- !alias_in_grouping_grouping_scalar_expr --
|
||||
2 0
|
||||
2 0
|
||||
3 0
|
||||
3 0
|
||||
4 0
|
||||
4 0
|
||||
5 0
|
||||
5 0
|
||||
|
||||
-- !alias_in_grouping_agg_func_expr --
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
5 5
|
||||
5 5
|
||||
|
||||
-- !same_expr_different_alias_in_grouping --
|
||||
2 2
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
4 4
|
||||
4 4
|
||||
5 5
|
||||
5 5
|
||||
|
||||
-- !same_expr_different_alias_in_grouping_grouping_scalar --
|
||||
2 2 0
|
||||
2 2 0
|
||||
3 3 0
|
||||
3 3 0
|
||||
4 4 0
|
||||
4 4 0
|
||||
5 5 0
|
||||
5 5 0
|
||||
|
||||
-- !same_expr_different_alias_in_grouping_agg_func --
|
||||
2 2 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
3 3 3
|
||||
4 4 4
|
||||
4 4 4
|
||||
5 5 5
|
||||
5 5 5
|
||||
|
||||
-- !same_expr_different_alias_in_grouping_3_expr --
|
||||
2 2 2 0 2
|
||||
2 2 2 0 2
|
||||
3 3 3 0 3
|
||||
3 3 3 0 3
|
||||
4 4 4 0 4
|
||||
4 4 4 0 4
|
||||
5 5 5 0 5
|
||||
5 5 5 0 5
|
||||
|
||||
-- !same_expr_one_has_alias_in_grouping_the_other_do_not --
|
||||
2 2 0 2
|
||||
2 2 0 2
|
||||
3 3 0 3
|
||||
3 3 0 3
|
||||
4 4 0 4
|
||||
4 4 0 4
|
||||
5 5 0 5
|
||||
5 5 0 5
|
||||
|
||||
@ -0,0 +1,111 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("grouping_alias_test"){
|
||||
sql "SET enable_nereids_planner=true"
|
||||
sql "SET enable_fallback_to_original_planner=false"
|
||||
sql"drop table if exists grouping_alias_test_t"
|
||||
sql """
|
||||
CREATE TABLE grouping_alias_test_t (
|
||||
id INT,
|
||||
value1 INT,
|
||||
value2 VARCHAR(50)
|
||||
)distributed by hash(id) properties("replication_num"="1");
|
||||
"""
|
||||
sql """
|
||||
INSERT INTO grouping_alias_test_t (id, value1, value2) VALUES
|
||||
(1, 10, 'A'),
|
||||
(2, 20, 'B'),
|
||||
(3, 30, 'C'),
|
||||
(4, 40, 'D');
|
||||
"""
|
||||
|
||||
qt_alias "select id as c1 from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1;"
|
||||
qt_alias_grouping_scalar "select id as c1, grouping(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2;"
|
||||
qt_alias_agg_func "select id as c1, sum(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2;"
|
||||
|
||||
qt_same_column_different_alias "select id as c1, id as c2 from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2;"
|
||||
qt_same_column_different_alias_grouping_scalar "select id as c1, id as c2, grouping(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2,3;"
|
||||
qt_same_column_different_alias_agg_func "select id as c1, id as c2 , sum(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2,3;"
|
||||
|
||||
qt_same_column_different_alias_3_column "select id as c1, id as c2, id as c3 from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2,3;"
|
||||
qt_same_column_different_alias_3_column_grouping_scalar "select id as c1, id as c2, id as c3,grouping(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2,3,4;"
|
||||
qt_same_column_different_alias_3_column_agg_func "select id as c1, id as c2, id as c3 ,sum(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2,3,4;"
|
||||
|
||||
qt_same_column_one_has_alias_the_other_do_not "select id , id as c2 from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2;"
|
||||
qt_same_column_one_has_alias_the_other_do_not_grouping_scalar "select id , id as c2 ,grouping(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2,3;"
|
||||
qt_same_column_one_has_alias_the_other_do_not_agg_func "select id , id as c2 ,sum(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2,3;"
|
||||
|
||||
qt_alias_expr "select id+1 as c1 from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1;"
|
||||
qt_alias_grouping_scalar_expr "select id+1 as c1, grouping(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2;"
|
||||
qt_alias_agg_func_expr "select id+1 as c1, sum(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2;"
|
||||
|
||||
qt_same_expr_different_alias "select id+1 as c1, id+1 as c2 from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2;"
|
||||
qt_same_expr_different_alias_grouping_scalar "select id+1 as c1, id+1 as c2, grouping(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3;"
|
||||
qt_same_expr_different_alias_agg_func "select id+1 as c1, id+1 as c2 , sum(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3;"
|
||||
|
||||
qt_same_expr_different_alias_3_expr "select id+1 as c1, id+1 as c2, id+1 as c3 from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3;"
|
||||
qt_same_expr_different_alias_3_expr_grouping_scalar "select id+1 as c1, id+1 as c2, id+1 as c3,grouping(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3,4;"
|
||||
qt_same_expr_different_alias_3_expr_agg_func "select id+1 as c1, id+1 as c2, id+1 as c3 ,sum(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3,4;"
|
||||
|
||||
qt_same_expr_one_has_alias_the_other_do_not "select id+1 , id+1 as c2 from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2;"
|
||||
qt_same_expr_one_has_alias_the_other_do_not_grouping_scalar "select id+1 , id+1 as c2 ,grouping(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3;"
|
||||
qt_same_expr_one_has_alias_the_other_do_not_agg_func "select id+1 , id+1 as c2 ,sum(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3;"
|
||||
|
||||
qt_expr_without_alias "select id+1 from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1;"
|
||||
qt_expr_without_alias_grouping_scalar "select id+1, grouping(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2;"
|
||||
qt_expr_without_alias_agg_func "select id+1, sum(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2;"
|
||||
|
||||
qt_same_expr_without_alias "select id+1, id+1 from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2;"
|
||||
qt_same_expr_without_alias_grouping_scalar "select id+1, id+1, grouping(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3;"
|
||||
qt_same_expr_without_alias_agg_func "select id+1, id+1, sum(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3;"
|
||||
|
||||
qt_expr_with_or_without_alias_3_expr "select id+1, id+1, id+1 as c1 from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3;"
|
||||
qt_expr_with_or_without_alias_3_expr_grouping_scalar "select id+1, id+1, id+1 as c3,grouping(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3,4;"
|
||||
qt_expr_with_or_without_alias_3_expr_agg_func "select id+1 as c1, id+1, id+1,sum(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(id+1)) order by 1,2,3,4;"
|
||||
|
||||
qt_alias_in_grouping "select id as c1 from grouping_alias_test_t group by grouping sets((c1,value2),(id)) order by 1;"
|
||||
qt_alias_grouping_scalar_in_grouping "select id as c1, grouping(id) from grouping_alias_test_t group by grouping sets((c1,value2),(id)) order by 1,2;"
|
||||
qt_alias_agg_func_in_grouping "select id as c1, sum(id) from grouping_alias_test_t group by grouping sets((id,value2),(c1)) order by 1,2;"
|
||||
|
||||
// TODO: The query result of the following example is different from pg. It needs to be modified later.
|
||||
qt_same_column_different_alias_in_grouping "select id as c1, id as c2 from grouping_alias_test_t group by grouping sets((c1,value2),(c2)) order by 1,2;"
|
||||
qt_same_column_different_alias_grouping_scalar_in_grouping "select id as c1, id as c2, grouping(id) from grouping_alias_test_t group by grouping sets((c1,value2),(c2)) order by 1,2,3;"
|
||||
qt_same_column_different_alias_agg_func_in_grouping "select id as c1, id as c2 , sum(id) from grouping_alias_test_t group by grouping sets((c1,value2),(c2)) order by 1,2,3;"
|
||||
|
||||
qt_same_column_different_alias_in_grouping_3_column "select id as c1, id as c2, id as c3 from grouping_alias_test_t group by grouping sets((c1,value2),(c2,c3)) order by 1,2,3;"
|
||||
qt_same_column_different_alias_in_grouping_3_column_grouping_scalar "select id as c1, id as c2, id as c3,grouping(id) from grouping_alias_test_t group by grouping sets((c1,value2),(c2,c3)) order by 1,2,3,4;"
|
||||
qt_same_column_different_alias_in_grouping_3_column_agg_func "select id as c1, id as c2, id as c3 ,sum(id) from grouping_alias_test_t group by grouping sets((c1,value2),(c2,c3)) order by 1,2,3,4;"
|
||||
|
||||
qt_same_column_one_has_alias_in_grouping_the_other_do_not "select id , id as c2 from grouping_alias_test_t group by grouping sets((id,value2),(c2)) order by 1,2;"
|
||||
qt_same_column_one_has_alias_in_grouping_the_other_do_not_grouping_scalar "select id , id as c2 ,grouping(id) from grouping_alias_test_t group by grouping sets((id,value2),(c2)) order by 1,2,3;"
|
||||
qt_same_column_one_has_alias_in_grouping_the_other_do_not_agg_func "select id , id as c2 ,sum(id) from grouping_alias_test_t group by grouping sets((id,value2),(c2)) order by 1,2,3;"
|
||||
|
||||
qt_alias_in_grouping_expr "select id+1 as c1 from grouping_alias_test_t group by grouping sets((id+1,value2),(c1)) order by 1;"
|
||||
qt_alias_in_grouping_grouping_scalar_expr "select id+1 as c1, grouping(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(c1)) order by 1,2;"
|
||||
qt_alias_in_grouping_agg_func_expr "select id+1 as c1, sum(id+1) from grouping_alias_test_t group by grouping sets((id+1,value2),(c1)) order by 1,2;"
|
||||
|
||||
qt_same_expr_different_alias_in_grouping "select id+1 as c1, id+1 as c2 from grouping_alias_test_t group by grouping sets((c1,value2),(id+1,c2)) order by 1,2;"
|
||||
qt_same_expr_different_alias_in_grouping_grouping_scalar "select id+1 as c1, id+1 as c2, grouping(id+1) from grouping_alias_test_t group by grouping sets((c1,value2),(id+1,c2)) order by 1,2,3;"
|
||||
qt_same_expr_different_alias_in_grouping_agg_func "select id+1 as c1, id+1 as c2 , sum(id+1) from grouping_alias_test_t group by grouping sets((c1,value2),(c2)) order by 1,2,3;"
|
||||
|
||||
qt_same_expr_different_alias_in_grouping_3_expr "select id+1 as c1, id+1 as c2, id+1 as c3,grouping(id+1),sum(id+1) as c3 from grouping_alias_test_t group by grouping sets((c1,value2),(c2,c3,id+1)) order by 1,2,3;"
|
||||
|
||||
qt_same_expr_one_has_alias_in_grouping_the_other_do_not "select id+1 , id+1 as c2,grouping(id+1),sum(id+1) from grouping_alias_test_t group by grouping sets((c2,value2),(id+1)) order by 1,2;"
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user