mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Fixed tests
This commit is contained in:
parent
3d34247998
commit
25088187d4
@ -4608,25 +4608,47 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
||||
auto if_function_condition = if_function_arguments[0];
|
||||
resolveExpressionNode(if_function_condition, scope, false /*allow_lambda_expression*/, false /*allow_table_expression*/);
|
||||
|
||||
QueryTreeNodePtr constant_if_result_node;
|
||||
auto constant_condition = tryExtractConstantFromConditionNode(if_function_condition);
|
||||
|
||||
if (constant_condition.has_value() && if_function_arguments.size() == 3)
|
||||
{
|
||||
if (*constant_condition)
|
||||
constant_if_result_node = if_function_arguments[1];
|
||||
else
|
||||
constant_if_result_node = if_function_arguments[2];
|
||||
}
|
||||
QueryTreeNodePtr constant_if_result_node;
|
||||
QueryTreeNodePtr possibly_invalid_argument_node;
|
||||
|
||||
if (constant_if_result_node)
|
||||
{
|
||||
auto result_projection_names = resolveExpressionNode(constant_if_result_node,
|
||||
scope,
|
||||
false /*allow_lambda_expression*/,
|
||||
false /*allow_table_expression*/);
|
||||
node = std::move(constant_if_result_node);
|
||||
return result_projection_names;
|
||||
if (*constant_condition)
|
||||
{
|
||||
possibly_invalid_argument_node = if_function_arguments[2];
|
||||
constant_if_result_node = if_function_arguments[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
possibly_invalid_argument_node = if_function_arguments[1];
|
||||
constant_if_result_node = if_function_arguments[2];
|
||||
}
|
||||
|
||||
bool apply_constant_if_optimization = false;
|
||||
|
||||
try
|
||||
{
|
||||
resolveExpressionNode(possibly_invalid_argument_node,
|
||||
scope,
|
||||
false /*allow_lambda_expression*/,
|
||||
false /*allow_table_expression*/);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
apply_constant_if_optimization = true;
|
||||
}
|
||||
|
||||
if (apply_constant_if_optimization)
|
||||
{
|
||||
auto result_projection_names = resolveExpressionNode(constant_if_result_node,
|
||||
scope,
|
||||
false /*allow_lambda_expression*/,
|
||||
false /*allow_table_expression*/);
|
||||
node = std::move(constant_if_result_node);
|
||||
return result_projection_names;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1193,6 +1193,7 @@ JoinTreeQueryPlan buildJoinTreeQueryPlan(const QueryTreeNodePtr & query_node,
|
||||
if (table_expression == left_table_expression)
|
||||
{
|
||||
query_plans_stack.push_back(std::move(left_table_expression_query_plan));
|
||||
left_table_expression = {};
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,6 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_LOCAL -q "SELECT assumeNotNull(NULL)" 2>&1 | grep -q "ILLEGAL_COLUMN" && echo "OK" || echo "FAIL"
|
||||
$CLICKHOUSE_LOCAL -q "SELECT assumeNotNull(materialize(NULL)) SETTINGS allow_experimental_analyzer = 1" 2>&1 | grep -q "ILLEGAL_COLUMN" && echo "OK" || echo "FAIL"
|
||||
$CLICKHOUSE_LOCAL -q "SELECT assumeNotNull(materialize(NULL)) from numbers(10) SETTINGS allow_experimental_analyzer = 1" 2>&1 | grep -q "ILLEGAL_COLUMN" && echo "OK" || echo "FAIL"
|
||||
$CLICKHOUSE_LOCAL -q "SELECT assumeNotNull(materialize(NULL))" 2>&1 | grep -q "ILLEGAL_TYPE_OF_ARGUMENT" && echo "OK" || echo "FAIL"
|
||||
$CLICKHOUSE_LOCAL -q "SELECT assumeNotNull(materialize(NULL)) from numbers(10)" 2>&1 | grep -q "ILLEGAL_TYPE_OF_ARGUMENT" && echo "OK" || echo "FAIL"
|
||||
|
||||
|
@ -4,19 +4,19 @@
|
||||
2022-09-09 12:00:00 0x
|
||||
2022-09-09 12:00:00 1
|
||||
2022-09-09 12:00:00 1x
|
||||
Prefix sort description: toStartOfMinute(test.t_order_by_monotonic.t_0) ASC
|
||||
Result sort description: toStartOfMinute(test.t_order_by_monotonic.t_0) ASC, test.t_order_by_monotonic.c1_1 ASC
|
||||
Prefix sort description: toStartOfMinute(test.t_order_by_monotonic.t_0) ASC
|
||||
Result sort description: toStartOfMinute(test.t_order_by_monotonic.t_0) ASC
|
||||
Prefix sort description: negate(test.t_order_by_monotonic.a_0) ASC
|
||||
Result sort description: negate(test.t_order_by_monotonic.a_0) ASC
|
||||
Prefix sort description: negate(test.t_order_by_monotonic.a_0) ASC, negate(test.t_order_by_monotonic.b_1) ASC
|
||||
Result sort description: negate(test.t_order_by_monotonic.a_0) ASC, negate(test.t_order_by_monotonic.b_1) ASC
|
||||
Prefix sort description: test.t_order_by_monotonic.a_0 DESC, negate(test.t_order_by_monotonic.b_1) ASC
|
||||
Result sort description: test.t_order_by_monotonic.a_0 DESC, negate(test.t_order_by_monotonic.b_1) ASC
|
||||
Prefix sort description: negate(test.t_order_by_monotonic.a_0) ASC, test.t_order_by_monotonic.b_1 DESC
|
||||
Result sort description: negate(test.t_order_by_monotonic.a_0) ASC, test.t_order_by_monotonic.b_1 DESC
|
||||
Prefix sort description: negate(test.t_order_by_monotonic.a_0) ASC
|
||||
Result sort description: negate(test.t_order_by_monotonic.a_0) ASC, test.t_order_by_monotonic.b_1 ASC
|
||||
Prefix sort description: test.t_order_by_monotonic.a_0 ASC
|
||||
Result sort description: test.t_order_by_monotonic.a_0 ASC, negate(test.t_order_by_monotonic.b_1) ASC
|
||||
Prefix sort description: toStartOfMinute(test.t_0) ASC
|
||||
Result sort description: toStartOfMinute(test.t_0) ASC, test.c1_1 ASC
|
||||
Prefix sort description: toStartOfMinute(test.t_0) ASC
|
||||
Result sort description: toStartOfMinute(test.t_0) ASC
|
||||
Prefix sort description: negate(test.a_0) ASC
|
||||
Result sort description: negate(test.a_0) ASC
|
||||
Prefix sort description: negate(test.a_0) ASC, negate(test.b_1) ASC
|
||||
Result sort description: negate(test.a_0) ASC, negate(test.b_1) ASC
|
||||
Prefix sort description: test.a_0 DESC, negate(test.b_1) ASC
|
||||
Result sort description: test.a_0 DESC, negate(test.b_1) ASC
|
||||
Prefix sort description: negate(test.a_0) ASC, test.b_1 DESC
|
||||
Result sort description: negate(test.a_0) ASC, test.b_1 DESC
|
||||
Prefix sort description: negate(test.a_0) ASC
|
||||
Result sort description: negate(test.a_0) ASC, test.b_1 ASC
|
||||
Prefix sort description: test.a_0 ASC
|
||||
Result sort description: test.a_0 ASC, negate(test.b_1) ASC
|
||||
|
@ -17,12 +17,12 @@ $CLICKHOUSE_CLIENT -q "CREATE TABLE t_order_by_monotonic (t DateTime, c1 String)
|
||||
SELECT '2022-09-09 12:00:30', toString(number % 2)|| 'x' FROM numbers(3)"
|
||||
|
||||
$CLICKHOUSE_CLIENT --optimize_aggregation_in_order=1 -q "SELECT count() FROM
|
||||
(SELECT toStartOfMinute(t) AS s, c1 FROM t_order_by_monotonic GROUP BY s, c1)"
|
||||
(SELECT toStartOfMinute(t) AS s, c1 FROM t_order_by_monotonic AS test GROUP BY s, c1)"
|
||||
|
||||
$CLICKHOUSE_CLIENT --optimize_read_in_order=1 -q "SELECT toStartOfMinute(t) AS s, c1 FROM t_order_by_monotonic ORDER BY s, c1"
|
||||
$CLICKHOUSE_CLIENT --optimize_read_in_order=1 -q "SELECT toStartOfMinute(t) AS s, c1 FROM t_order_by_monotonic AS test ORDER BY s, c1"
|
||||
|
||||
explain_sort_description "SELECT toStartOfMinute(t) AS s, c1 FROM t_order_by_monotonic ORDER BY s, c1"
|
||||
explain_sort_description "SELECT toStartOfMinute(t) AS s, c1 FROM t_order_by_monotonic ORDER BY s"
|
||||
explain_sort_description "SELECT toStartOfMinute(t) AS s, c1 FROM t_order_by_monotonic AS test ORDER BY s, c1"
|
||||
explain_sort_description "SELECT toStartOfMinute(t) AS s, c1 FROM t_order_by_monotonic AS test ORDER BY s"
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS t_order_by_monotonic"
|
||||
|
||||
@ -30,11 +30,11 @@ $CLICKHOUSE_CLIENT -q "CREATE TABLE t_order_by_monotonic (a Int64, b Int64) ENGI
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "INSERT INTO t_order_by_monotonic VALUES (1, 1) (1, 2), (2, 1) (2, 2)"
|
||||
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic ORDER BY -a"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic ORDER BY -a, -b"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic ORDER BY a DESC, -b"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic ORDER BY -a, b DESC"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic ORDER BY -a, b"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic ORDER BY a, -b"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic AS test ORDER BY -a"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic AS test ORDER BY -a, -b"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic AS test ORDER BY a DESC, -b"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic AS test ORDER BY -a, b DESC"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic AS test ORDER BY -a, b"
|
||||
explain_sort_description "SELECT * FROM t_order_by_monotonic AS test ORDER BY a, -b"
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS t_order_by_monotonic"
|
||||
|
@ -1,4 +1,5 @@
|
||||
-- { echoOn }
|
||||
|
||||
SELECT
|
||||
cutURLParameter('http://bigmir.net/?a=b&c=d', []),
|
||||
cutURLParameter('http://bigmir.net/?a=b&c=d', ['a']),
|
||||
|
Loading…
Reference in New Issue
Block a user