Merge branch 'master' into ADQM-880

This commit is contained in:
Alexey Gerasimchuk 2023-05-29 09:12:19 +10:00 committed by GitHub
commit e21fa2b35c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 102 additions and 3 deletions

View File

@ -1230,8 +1230,11 @@ public:
/// The case when arguments are the same (tautological comparison). Return constant.
/// NOTE: Nullable types are special case.
/// (BTW, this function use default implementation for Nullable, so Nullable types cannot be here. Check just in case.)
/// NOTE: We consider NaN comparison to be implementation specific (and in our implementation NaNs are sometimes equal sometimes not).
if (left_type->equals(*right_type) && !left_type->isNullable() && !isTuple(left_type) && col_left_untyped == col_right_untyped)
if (left_type->equals(*right_type) &&
!left_type->isNullable() &&
!isTuple(left_type) &&
!WhichDataType(left_type).isFloat() &&
col_left_untyped == col_right_untyped)
{
ColumnPtr result_column;

View File

@ -2041,7 +2041,7 @@ Aggregator::convertToBlockImplFinal(Method & method, Table & data, Arena * arena
*/
if (data.hasNullKeyData())
{
has_null_key_data = Method::one_key_nullable_optimization;
has_null_key_data = true;
out_cols->key_columns[0]->insertDefault();
insertAggregatesIntoColumns(data.getNullKeyData(), out_cols->final_aggregate_columns, arena);
data.hasNullKeyData() = false;
@ -2076,6 +2076,7 @@ Aggregator::convertToBlockImplFinal(Method & method, Table & data, Arena * arena
res.emplace_back(insertResultsIntoColumns<use_compiled_functions>(places, std::move(out_cols.value()), arena, has_null_key_data));
places.clear();
out_cols.reset();
has_null_key_data = false;
}
}
});

View File

@ -0,0 +1,10 @@
nan 0 0 0 0
nan 0 0 0 0
nan nan 0 0 0 0
--
--
nan 1 1 1 1
nan 1 1 1 1
nan nan 1 1 1 1
--
nan

View File

@ -0,0 +1,42 @@
SET compile_expressions = 1;
SET min_count_to_compile_expression = 0;
SELECT nan AS value, value = value, value = materialize(value), materialize(value) = value, materialize(value) = materialize(value);
SELECT cast(nan, 'Float32') AS value, value = value, value = materialize(value), materialize(value) = value, materialize(value) = materialize(value);
SELECT nan AS lhs, cast(nan, 'Float32') AS rhs, lhs = rhs, lhs = materialize(rhs), materialize(lhs) = rhs, materialize(lhs) = materialize(rhs);
SELECT '--';
CREATE TABLE test_table
(
id UInt32,
value UInt32
) ENGINE = MergeTree ORDER BY id;
INSERT INTO test_table VALUES (76, 57);
SELECT value FROM (SELECT stddevSamp(id) AS value FROM test_table) as subquery
WHERE ((value = value) AND (NOT (value = value)));
DROP TABLE test_table;
SELECT '--';
SELECT nan AS value, value != value, value != materialize(value), materialize(value) != value, materialize(value) != materialize(value);
SELECT cast(nan, 'Float32') AS value, value != value, value != materialize(value), materialize(value) != value, materialize(value) != materialize(value);
SELECT nan AS lhs, cast(nan, 'Float32') AS rhs, lhs != rhs, lhs != materialize(rhs), materialize(lhs) != rhs, materialize(lhs) != materialize(rhs);
SELECT '--';
CREATE TABLE test_table
(
id UInt32,
value_1 UInt32,
value_2 Float32
) ENGINE = MergeTree ORDER BY id;
INSERT INTO test_table VALUES (12000, 36, 77.94);
SELECT value
FROM (SELECT (corr(value_1, value_1) OVER test_window) AS value FROM test_table WINDOW test_window AS (PARTITION BY value_2 ORDER BY id ASC)) as subquery
WHERE not (not (value <> value));
DROP TABLE test_table;

View File

@ -0,0 +1,4 @@
1048576
65411
1048576
65411

View File

@ -0,0 +1,39 @@
SET compile_aggregate_expressions = 1;
SET min_count_to_compile_aggregate_expression = 0;
SET group_by_use_nulls = 0;
SELECT count() FROM
(
SELECT
count([NULL, NULL]),
count([2147483646, -2147483647, 3, 3]),
uniqExact(if(number >= 1048577, number, NULL), NULL)
FROM numbers(1048577)
GROUP BY if(number >= 2., number, NULL)
);
SELECT count() FROM
(
SELECT count()
FROM numbers(65411)
GROUP BY if(number < 1, NULL, number)
);
SET group_by_use_nulls = 1;
SELECT count() FROM
(
SELECT
count([NULL, NULL]),
count([2147483646, -2147483647, 3, 3]),
uniqExact(if(number >= 1048577, number, NULL), NULL)
FROM numbers(1048577)
GROUP BY if(number >= 2., number, NULL)
);
SELECT count() FROM
(
SELECT count()
FROM numbers(65411)
GROUP BY if(number < 1, NULL, number)
);