Fix some more tests

This commit is contained in:
kssenii 2021-08-07 11:31:53 +00:00
parent ec9e82fb0c
commit 01b4bd3f91
8 changed files with 16 additions and 11 deletions

View File

@ -3470,7 +3470,7 @@ protected:
if constexpr (internal) if constexpr (internal)
return type; return type;
if (keep_nullable && arguments.front().type->isNullable()) if (keep_nullable && arguments.front().type->isNullable() && type->canBeInsideNullable())
return makeNullable(type); return makeNullable(type);
return type; return type;

View File

@ -1,3 +1,5 @@
SET cast_keep_nullable = 0;
SELECT CAST('Hello' AS LowCardinality(Nullable(String))); SELECT CAST('Hello' AS LowCardinality(Nullable(String)));
SELECT CAST(Null AS LowCardinality(Nullable(String))); SELECT CAST(Null AS LowCardinality(Nullable(String)));
SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String); SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String);

View File

@ -1,3 +1,5 @@
SET cast_keep_nullable = 0;
-- https://github.com/ClickHouse/ClickHouse/issues/5818#issuecomment-619628445 -- https://github.com/ClickHouse/ClickHouse/issues/5818#issuecomment-619628445
SELECT CAST(CAST(NULL AS Nullable(String)) AS Nullable(Enum8('Hello' = 1))); SELECT CAST(CAST(NULL AS Nullable(String)) AS Nullable(Enum8('Hello' = 1)));
SELECT CAST(CAST(NULL AS Nullable(FixedString(1))) AS Nullable(Enum8('Hello' = 1))); SELECT CAST(CAST(NULL AS Nullable(FixedString(1))) AS Nullable(Enum8('Hello' = 1)));

View File

@ -1 +1,2 @@
SET cast_keep_nullable = 0;
SELECT CAST(arrayJoin([NULL, '', '', NULL, '', NULL, '01.02.2017 03:04\005GMT', '', NULL, '01/02/2017 03:04:05 MSK01/02/\0017 03:04:05 MSK', '', NULL, '03/04/201903/04/201903/04/\001903/04/2019']), 'Enum8(\'a\' = 1, \'b\' = 2)') AS x; -- { serverError 349 } SELECT CAST(arrayJoin([NULL, '', '', NULL, '', NULL, '01.02.2017 03:04\005GMT', '', NULL, '01/02/2017 03:04:05 MSK01/02/\0017 03:04:05 MSK', '', NULL, '03/04/201903/04/201903/04/\001903/04/2019']), 'Enum8(\'a\' = 1, \'b\' = 2)') AS x; -- { serverError 349 }

View File

@ -56,7 +56,7 @@ Filter column: notEquals(y, 0)
9 10 9 10
> one condition of filter should be pushed down after aggregating, other condition is casted > one condition of filter should be pushed down after aggregating, other condition is casted
Filter column Filter column
FUNCTION CAST(minus(s, 4) :: 1, UInt8 :: 3) -> and(notEquals(y, 0), minus(s, 4)) FUNCTION _CAST(minus(s, 4) :: 1, UInt8 :: 3) -> and(notEquals(y, 0), minus(s, 4))
Aggregating Aggregating
Filter column: notEquals(y, 0) Filter column: notEquals(y, 0)
0 1 0 1

View File

@ -56,7 +56,7 @@ $CLICKHOUSE_CLIENT -q "
select sum(x) as s, y from (select number as x, number + 1 as y from numbers(10)) group by y select sum(x) as s, y from (select number as x, number + 1 as y from numbers(10)) group by y
) where y != 0 and s - 4 ) where y != 0 and s - 4
settings enable_optimize_predicate_expression=0" | settings enable_optimize_predicate_expression=0" |
grep -o "Aggregating\|Filter column\|Filter column: notEquals(y, 0)\|FUNCTION CAST(minus(s, 4) :: 1, UInt8 :: 3) -> and(notEquals(y, 0), minus(s, 4))" grep -o "Aggregating\|Filter column\|Filter column: notEquals(y, 0)\|FUNCTION _CAST(minus(s, 4) :: 1, UInt8 :: 3) -> and(notEquals(y, 0), minus(s, 4))"
$CLICKHOUSE_CLIENT -q " $CLICKHOUSE_CLIENT -q "
select s, y from ( select s, y from (
select sum(x) as s, y from (select number as x, number + 1 as y from numbers(10)) group by y select sum(x) as s, y from (select number as x, number + 1 as y from numbers(10)) group by y

View File

@ -48,8 +48,8 @@ SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(b)) == 'Nullable(Int64)'
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(b)) == 'Nullable(Int64)' FROM t_ab1 RIGHT JOIN t_ab2 USING (a, b); SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(b)) == 'Nullable(Int64)' FROM t_ab1 RIGHT JOIN t_ab2 USING (a, b);
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(b)) == 'Nullable(Int64)' FROM t_ab1 INNER JOIN t_ab2 USING (a, b); SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(b)) == 'Nullable(Int64)' FROM t_ab1 INNER JOIN t_ab2 USING (a, b);
SELECT * FROM ( SELECT a, b as "CAST(a, Int32)" FROM t_ab1 ) t_ab1 FULL JOIN t_ab2 ON (t_ab1.a == t_ab2.a); -- { serverError 44 } SELECT * FROM ( SELECT a, b as "_CAST(a, Int32)" FROM t_ab1 ) t_ab1 FULL JOIN t_ab2 ON (t_ab1.a == t_ab2.a); -- { serverError 44 }
SELECT * FROM ( SELECT a, b as "CAST(a, Int32)" FROM t_ab1 ) t_ab1 FULL JOIN t_ab2 USING (a) FORMAT Null; SELECT * FROM ( SELECT a, b as "_CAST(a, Int32)" FROM t_ab1 ) t_ab1 FULL JOIN t_ab2 USING (a) FORMAT Null;
{% endfor %} {% endfor %}

View File

@ -1,17 +1,17 @@
(0, 2) (0, 2)
0 0 0 0
0 0 0 0
WITH CAST(\'default\', \'Nullable(String)\') AS id_no SELECT one.dummy, ignore(id_no) FROM system.one WHERE dummy IN (0, 2) WITH _CAST(\'default\', \'Nullable(String)\') AS id_no SELECT one.dummy, ignore(id_no) FROM system.one WHERE dummy IN (0, 2)
WITH CAST(\'default\', \'Nullable(String)\') AS id_no SELECT one.dummy, ignore(id_no) FROM system.one WHERE dummy IN (0, 2) WITH _CAST(\'default\', \'Nullable(String)\') AS id_no SELECT one.dummy, ignore(id_no) FROM system.one WHERE dummy IN (0, 2)
optimize_skip_unused_shards_rewrite_in(0, 2) optimize_skip_unused_shards_rewrite_in(0, 2)
0 0 0 0
WITH CAST(\'default\', \'Nullable(String)\') AS id_02 SELECT one.dummy, ignore(id_02) FROM system.one WHERE dummy IN tuple(0) WITH _CAST(\'default\', \'Nullable(String)\') AS id_02 SELECT one.dummy, ignore(id_02) FROM system.one WHERE dummy IN tuple(0)
WITH CAST(\'default\', \'Nullable(String)\') AS id_02 SELECT one.dummy, ignore(id_02) FROM system.one WHERE dummy IN tuple(2) WITH _CAST(\'default\', \'Nullable(String)\') AS id_02 SELECT one.dummy, ignore(id_02) FROM system.one WHERE dummy IN tuple(2)
optimize_skip_unused_shards_rewrite_in(2,) optimize_skip_unused_shards_rewrite_in(2,)
WITH CAST(\'default\', \'Nullable(String)\') AS id_2 SELECT one.dummy, ignore(id_2) FROM system.one WHERE dummy IN tuple(2) WITH _CAST(\'default\', \'Nullable(String)\') AS id_2 SELECT one.dummy, ignore(id_2) FROM system.one WHERE dummy IN tuple(2)
optimize_skip_unused_shards_rewrite_in(0,) optimize_skip_unused_shards_rewrite_in(0,)
0 0 0 0
WITH CAST(\'default\', \'Nullable(String)\') AS id_0 SELECT one.dummy, ignore(id_0) FROM system.one WHERE dummy IN tuple(0) WITH _CAST(\'default\', \'Nullable(String)\') AS id_0 SELECT one.dummy, ignore(id_0) FROM system.one WHERE dummy IN tuple(0)
0 0
0 0
errors errors