mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fixed convert function monotonic failure when string data type
This commit is contained in:
parent
6869771ae4
commit
dc61a73a6e
@ -1138,6 +1138,10 @@ struct ToIntMonotonicity
|
||||
|
||||
static IFunction::Monotonicity get(const IDataType & type, const Field & left, const Field & right)
|
||||
{
|
||||
/// If type is string, the function is no monotonic
|
||||
if (WhichDataType(type).isString())
|
||||
return {};
|
||||
|
||||
size_t size_of_type = type.getSizeOfValueInMemory();
|
||||
|
||||
/// If type is expanding
|
||||
|
@ -1 +1,2 @@
|
||||
1
|
||||
1
|
||||
|
@ -1,5 +1,10 @@
|
||||
drop table if exists test.table;
|
||||
create table test.table (val Int32) engine = MergeTree order by val;
|
||||
insert into test.table values (-2), (0), (2);
|
||||
select count() from test.table where toUInt64(val) == 0;
|
||||
|
||||
DROP TABLE IF EXISTS test.number_test_table;
|
||||
DROP TABLE IF EXISTS test.string_test_table;
|
||||
CREATE TABLE test.number_test_table (val Int32) ENGINE = MergeTree ORDER BY val;
|
||||
CREATE TABLE test.string_test_table (val String) ENGINE = MergeTree ORDER BY val;
|
||||
INSERT INTO test.number_test_table VALUES (-2), (0), (2);
|
||||
INSERT INTO test.string_test_table VALUES ('0'), ('2');
|
||||
SELECT count() FROM test.number_test_table WHERE toUInt64(val) == 0;
|
||||
SELECT count() FROM test.string_test_table WHERE toUInt64(val) == 0;
|
||||
DROP TABLE IF EXISTS test.number_test_table;
|
||||
DROP TABLE IF EXISTS test.string_test_table;
|
||||
|
Loading…
Reference in New Issue
Block a user