mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
test for decimal ( p , s) in dictionaries
This commit is contained in:
parent
2299930c31
commit
66e775ef88
@ -0,0 +1,10 @@
|
||||
-------- 42 --------
|
||||
42 14.0000 14.00000000 14.00000000 14.0000000000000000618637523926765281280
|
||||
42 14.0000 14.00000000 14.00000000
|
||||
14.0000 14.00000000 14.00000000
|
||||
-------- 4999 --------
|
||||
4999 1666.3333 1666.33333333 1666.33333333 1633.3553612205046244471093725648757194800
|
||||
4999 1666.3333 1666.33333333 1666.33333333
|
||||
1666.3333 1666.33333333 1666.33333333
|
||||
-------- 5000 --------
|
||||
0.1100 0.11000000 0.11000000
|
78
tests/queries/0_stateless/01721_dictionary_decimal_p_s.sql
Normal file
78
tests/queries/0_stateless/01721_dictionary_decimal_p_s.sql
Normal file
@ -0,0 +1,78 @@
|
||||
set allow_experimental_bigint_types=1;
|
||||
drop database if exists db_01721;
|
||||
drop table if exists db_01721.table_decimal_dict;
|
||||
drop dictionary if exists db_01721.decimal_dict;
|
||||
|
||||
|
||||
create database db_01721;
|
||||
|
||||
CREATE TABLE db_01721.table_decimal_dict(
|
||||
KeyField UInt64,
|
||||
Decimal32_ Decimal(5,4),
|
||||
Decimal64_ Decimal(18,8),
|
||||
Decimal128_ Decimal(25,8),
|
||||
Decimal256_ Decimal(76,37)
|
||||
)
|
||||
ENGINE = Memory;
|
||||
|
||||
insert into db_01721.table_decimal_dict
|
||||
select number,
|
||||
number / 3,
|
||||
number / 3,
|
||||
number / 3,
|
||||
number / 3
|
||||
from numbers(5000);
|
||||
|
||||
|
||||
CREATE DICTIONARY IF NOT EXISTS db_01721.decimal_dict (
|
||||
KeyField UInt64 DEFAULT 9999999,
|
||||
Decimal32_ Decimal(5,4) DEFAULT 0.11,
|
||||
Decimal64_ Decimal(18,8) DEFAULT 0.11,
|
||||
Decimal128_ Decimal(25,8) DEFAULT 0.11
|
||||
-- ,Decimal256_ Decimal256(37) DEFAULT 0.11
|
||||
)
|
||||
PRIMARY KEY KeyField
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_decimal_dict' DB 'db_01721'))
|
||||
LIFETIME(0) LAYOUT(SPARSE_HASHED);
|
||||
|
||||
select '-------- 42 --------';
|
||||
|
||||
SELECT * from db_01721.table_decimal_dict where KeyField = 42;
|
||||
|
||||
SELECT * from db_01721.decimal_dict where KeyField = 42;
|
||||
|
||||
SELECT dictGet('db_01721.decimal_dict', 'Decimal32_', toUInt64(42)),
|
||||
dictGet('db_01721.decimal_dict', 'Decimal64_', toUInt64(42)),
|
||||
dictGet('db_01721.decimal_dict', 'Decimal128_', toUInt64(42))
|
||||
-- ,dictGet('db_01721.decimal_dict', 'Decimal256_', toUInt64(42))
|
||||
;
|
||||
|
||||
|
||||
select '-------- 4999 --------';
|
||||
|
||||
SELECT * from db_01721.table_decimal_dict where KeyField = 4999;
|
||||
|
||||
SELECT * from db_01721.decimal_dict where KeyField = 4999;
|
||||
|
||||
SELECT dictGet('db_01721.decimal_dict', 'Decimal32_', toUInt64(4999)),
|
||||
dictGet('db_01721.decimal_dict', 'Decimal64_', toUInt64(4999)),
|
||||
dictGet('db_01721.decimal_dict', 'Decimal128_', toUInt64(4999))
|
||||
--,dictGet('db_01721.decimal_dict', 'Decimal256_', toUInt64(4999))
|
||||
;
|
||||
|
||||
select '-------- 5000 --------';
|
||||
|
||||
SELECT * from db_01721.table_decimal_dict where KeyField = 5000;
|
||||
|
||||
SELECT * from db_01721.decimal_dict where KeyField = 5000;
|
||||
|
||||
SELECT dictGet('db_01721.decimal_dict', 'Decimal32_', toUInt64(5000)),
|
||||
dictGet('db_01721.decimal_dict', 'Decimal64_', toUInt64(5000)),
|
||||
dictGet('db_01721.decimal_dict', 'Decimal128_', toUInt64(5000))
|
||||
--,dictGet('db_01721.decimal_dict', 'Decimal256_', toUInt64(5000))
|
||||
;
|
||||
|
||||
drop table if exists table_decimal_dict;
|
||||
drop dictionary if exists cache_dict;
|
||||
drop database if exists db_01721;
|
||||
|
Loading…
Reference in New Issue
Block a user