dictGet test improvements

This commit is contained in:
chertus 2019-05-29 17:16:20 +03:00
parent 0f5fffe25b
commit 414209d076
9 changed files with 830 additions and 110 deletions

View File

@ -57,7 +57,9 @@ if [ "$DATA_DIR_PATTERN" != "$DATA_DIR" ]; then
export CLICKHOUSE_CONFIG=$DATA_DIR/etc/server-config.xml
cp $CLICKHOUSE_CONFIG_USERS $DATA_DIR/etc
cp -R -L $CLICKHOUSE_CONFIG_USERS_D $DATA_DIR/etc
cat ${CONFIG_SERVER_DIR}/dictionary_decimals.xml | sed -e s!SERVER_PORT!$CLICKHOUSE_PORT_TCP! > $DATA_DIR/etc/dictionary_decimals.xml
cat ${CONFIG_SERVER_DIR}/ints_dictionary.xml | sed -e s!9000!$CLICKHOUSE_PORT_TCP! > $DATA_DIR/etc/ints_dictionary.xml
cat ${CONFIG_SERVER_DIR}/strings_dictionary.xml | sed -e s!9000!$CLICKHOUSE_PORT_TCP! > $DATA_DIR/etc/strings_dictionary.xml
cat ${CONFIG_SERVER_DIR}/decimals_dictionary.xml | sed -e s!9000!$CLICKHOUSE_PORT_TCP! > $DATA_DIR/etc/decimals_dictionary.xml
fi
CLICKHOUSE_EXTRACT_CONFIG=${CLICKHOUSE_EXTRACT_CONFIG:="${CLICKHOUSE_EXTRACT} --config=$CLICKHOUSE_CONFIG"}

View File

@ -4,7 +4,7 @@
<source>
<clickhouse>
<host>localhost</host>
<port>SERVER_PORT</port>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
@ -42,7 +42,7 @@
<source>
<clickhouse>
<host>localhost</host>
<port>SERVER_PORT</port>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
@ -80,7 +80,7 @@
<source>
<clickhouse>
<host>localhost</host>
<port>SERVER_PORT</port>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
@ -118,7 +118,7 @@
<source>
<clickhouse>
<host>localhost</host>
<port>SERVER_PORT</port>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
@ -159,7 +159,7 @@
<source>
<clickhouse>
<host>localhost</host>
<port>SERVER_PORT</port>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>

View File

@ -0,0 +1,322 @@
<dictionaries>
<dictionary>
<name>flat_ints</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>ints</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<flat/>
</layout>
<structure>
<id>
<name>key</name>
</id>
<attribute>
<name>i8</name>
<type>Int8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i16</name>
<type>Int16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i32</name>
<type>Int32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i64</name>
<type>Int64</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u8</name>
<type>UInt8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u16</name>
<type>UInt16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u32</name>
<type>UInt32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u64</name>
<type>UInt64</type>
<null_value>0</null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>hashed_ints</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>ints</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<hashed/>
</layout>
<structure>
<id>
<name>key</name>
</id>
<attribute>
<name>i8</name>
<type>Int8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i16</name>
<type>Int16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i32</name>
<type>Int32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i64</name>
<type>Int64</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u8</name>
<type>UInt8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u16</name>
<type>UInt16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u32</name>
<type>UInt32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u64</name>
<type>UInt64</type>
<null_value>0</null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>cache_ints</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>ints</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<cache><size_in_cells>1000</size_in_cells></cache>
</layout>
<structure>
<id>
<name>key</name>
</id>
<attribute>
<name>i8</name>
<type>Int8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i16</name>
<type>Int16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i32</name>
<type>Int32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i64</name>
<type>Int64</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u8</name>
<type>UInt8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u16</name>
<type>UInt16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u32</name>
<type>UInt32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u64</name>
<type>UInt64</type>
<null_value>0</null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>complex_hashed_ints</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>ints</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<complex_key_hashed/>
</layout>
<structure>
<key>
<attribute>
<name>key</name>
<type>UInt64</type>
</attribute>
</key>
<attribute>
<name>i8</name>
<type>Int8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i16</name>
<type>Int16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i32</name>
<type>Int32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i64</name>
<type>Int64</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u8</name>
<type>UInt8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u16</name>
<type>UInt16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u32</name>
<type>UInt32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u64</name>
<type>UInt64</type>
<null_value>0</null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>complex_cache_ints</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>ints</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<complex_key_cache><size_in_cells>1000</size_in_cells></complex_key_cache>
</layout>
<structure>
<key>
<attribute>
<name>key</name>
<type>UInt64</type>
</attribute>
</key>
<attribute>
<name>i8</name>
<type>Int8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i16</name>
<type>Int16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i32</name>
<type>Int32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>i64</name>
<type>Int64</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u8</name>
<type>UInt8</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u16</name>
<type>UInt16</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u32</name>
<type>UInt32</type>
<null_value>0</null_value>
</attribute>
<attribute>
<name>u64</name>
<type>UInt64</type>
<null_value>0</null_value>
</attribute>
</structure>
</dictionary>
</dictionaries>

View File

@ -1,15 +0,0 @@
dictGet(flat) 1 1.0000 1.000000 1.0
dictGetOrDefault(flat) 1 1.0000 1.000000 1.0
dictGetOrDefault(flat) 0 42.0000 42.000000 42.0
dictGet(hashed) 1 1.0000 1.000000 1.0
dictGetOrDefault(hashed) 1 1.0000 1.000000 1.0
dictGetOrDefault(hashed) 0 42.0000 42.000000 42.0
dictGet(cache) 1 1.0000 1.000000 1.0
dictGetOrDefault(cache) 1 1.0000 1.000000 1.0
dictGetOrDefault(cache) 0 42.0000 42.000000 42.0
dictGet(hashed) (1) 1.0000 1.000000 1.0
dictGetOrDefault(hashed) (1) 1.0000 1.000000 1.0
dictGetOrDefault(hashed) (0) 42.0000 42.000000 42.0
dictGet(cache) (1) 1.0000 1.000000 1.0
dictGetOrDefault(cache) (1) 1.0000 1.000000 1.0
dictGetOrDefault(cache) (0) 42.0000 42.000000 42.0

View File

@ -1,88 +0,0 @@
drop table if exists default.decimals;
create table default.decimals (key UInt64, d32 Decimal32(4), d64 Decimal64(6), d128 Decimal128(1)) Engine = Memory;
insert into default.decimals (key, d32, d64, d128) values (1, 1, 1, 1);
select 'dictGet(flat)', toUInt64(1) as k,
dictGet('flat_decimals', 'd32', k),
dictGet('flat_decimals', 'd64', k),
dictGet('flat_decimals', 'd128', k)
from default.decimals;
select 'dictGetOrDefault(flat)', toUInt64(1) as k,
dictGetOrDefault('flat_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('flat_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('flat_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
select 'dictGetOrDefault(flat)', toUInt64(0) as k,
dictGetOrDefault('flat_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('flat_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('flat_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
select 'dictGet(hashed)', toUInt64(1) as k,
dictGet('hashed_decimals', 'd32', k),
dictGet('hashed_decimals', 'd64', k),
dictGet('hashed_decimals', 'd128', k)
from default.decimals;
select 'dictGetOrDefault(hashed)', toUInt64(1) as k,
dictGetOrDefault('hashed_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('hashed_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('hashed_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
select 'dictGetOrDefault(hashed)', toUInt64(0) as k,
dictGetOrDefault('hashed_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('hashed_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('hashed_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
select 'dictGet(cache)', toUInt64(1) as k,
dictGet('cache_decimals', 'd32', k),
dictGet('cache_decimals', 'd64', k),
dictGet('cache_decimals', 'd128', k)
from default.decimals;
select 'dictGetOrDefault(cache)', toUInt64(1) as k,
dictGetOrDefault('cache_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('cache_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('cache_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
select 'dictGetOrDefault(cache)', toUInt64(0) as k,
dictGetOrDefault('cache_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('cache_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('cache_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
--
select 'dictGet(hashed)', tuple(toUInt64(1)) as k,
dictGet('complex_hashed_decimals', 'd32', k),
dictGet('complex_hashed_decimals', 'd64', k),
dictGet('complex_hashed_decimals', 'd128', k)
from default.decimals;
select 'dictGetOrDefault(hashed)', tuple(toUInt64(1)) as k,
dictGetOrDefault('complex_hashed_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('complex_hashed_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('complex_hashed_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
select 'dictGetOrDefault(hashed)', tuple(toUInt64(0)) as k,
dictGetOrDefault('complex_hashed_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('complex_hashed_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('complex_hashed_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
select 'dictGet(cache)', tuple(toUInt64(1)) as k,
dictGet('complex_cache_decimals', 'd32', k),
dictGet('complex_cache_decimals', 'd64', k),
dictGet('complex_cache_decimals', 'd128', k)
from default.decimals;
select 'dictGetOrDefault(cache)', tuple(toUInt64(1)) as k,
dictGetOrDefault('complex_cache_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('complex_cache_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('complex_cache_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
select 'dictGetOrDefault(cache)', tuple(toUInt64(0)) as k,
dictGetOrDefault('complex_cache_decimals', 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault('complex_cache_decimals', 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault('complex_cache_decimals', 'd128', k, toDecimal128(42, 1))
from default.decimals;
drop table default.decimals;

View File

@ -0,0 +1,45 @@
dictGet flat_ints 1 1 1 1 1 1 1 1 1
dictGetOrDefault flat_ints 1 1 1 1 1 1 1 1 1
dictGetOrDefault flat_ints 0 42 42 42 42 42 42 42 42
dictGet hashed_ints 1 1 1 1 1 1 1 1 1
dictGetOrDefault hashed_ints 1 1 1 1 1 1 1 1 1
dictGetOrDefault hashed_ints 0 42 42 42 42 42 42 42 42
dictGet cache_ints 1 1 1 1 1 1 1 1 1
dictGetOrDefault cache_ints 1 1 1 1 1 1 1 1 1
dictGetOrDefault cache_ints 0 42 42 42 42 42 42 42 42
dictGet complex_hashed_ints (1) 1 1 1 1 1 1 1 1
dictGetOrDefault complex_hashed_ints (1) 1 1 1 1 1 1 1 1
dictGetOrDefault complex_hashed_ints (0) 42 42 42 42 42 42 42 42
dictGet complex_cache_ints (1) 1 1 1 1 1 1 1 1
dictGetOrDefault complex_cache_ints (1) 1 1 1 1 1 1 1 1
dictGetOrDefault complex_cache_ints (0) 42 42 42 42 42 42 42 42
dictGet flat_strings 1 1
dictGetOrDefault flat_strings 1 1
dictGetOrDefault flat_strings 0 *
dictGet hashed_strings 1 1
dictGetOrDefault hashed_strings 1 1
dictGetOrDefault hashed_strings 0 *
dictGet cache_strings 1 1
dictGetOrDefault cache_strings 1 1
dictGetOrDefault cache_strings 0 *
dictGet complex_hashed_strings 1 1
dictGetOrDefault complex_hashed_strings 1 1
dictGetOrDefault complex_hashed_strings 0 *
dictGet complex_cache_strings 1 1
dictGetOrDefault complex_cache_strings 1 1
dictGetOrDefault complex_cache_strings 0 *
dictGet flat_decimals 1 1.0000 1.000000 1.0
dictGetOrDefault flat_decimals 1 1.0000 1.000000 1.0
dictGetOrDefault flat_decimals 0 42.0000 42.000000 42.0
dictGet hashed_decimals 1 1.0000 1.000000 1.0
dictGetOrDefault hashed_decimals 1 1.0000 1.000000 1.0
dictGetOrDefault hashed_decimals 0 42.0000 42.000000 42.0
dictGet cache_decimals 1 1.0000 1.000000 1.0
dictGetOrDefault cache_decimals 1 1.0000 1.000000 1.0
dictGetOrDefault cache_decimals 0 42.0000 42.000000 42.0
dictGet complex_hashed_decimals (1) 1.0000 1.000000 1.0
dictGetOrDefault complex_hashed_decimals (1) 1.0000 1.000000 1.0
dictGetOrDefault complex_hashed_decimals (0) 42.0000 42.000000 42.0
dictGet complex_cache_decimals (1) 1.0000 1.000000 1.0
dictGetOrDefault complex_cache_decimals (1) 1.0000 1.000000 1.0
dictGetOrDefault complex_cache_decimals (0) 42.0000 42.000000 42.0

View File

@ -0,0 +1,245 @@
use default;
drop table if exists ints;
drop table if exists strings;
drop table if exists decimals;
create table ints (key UInt64, i8 Int8, i16 Int16, i32 Int32, i64 Int64, u8 UInt8, u16 UInt16, u32 UInt32, u64 UInt64) Engine = Memory;
create table strings (key UInt64, str String) Engine = Memory;
create table decimals (key UInt64, d32 Decimal32(4), d64 Decimal64(6), d128 Decimal128(1)) Engine = Memory;
insert into ints values (1, 1, 1, 1, 1, 1, 1, 1, 1);
insert into strings values (1, '1');
insert into decimals values (1, 1, 1, 1);
select 'dictGet', 'flat_ints' as dict_name, toUInt64(1) as k,
dictGet(dict_name, 'i8', k),
dictGet(dict_name, 'i16', k),
dictGet(dict_name, 'i32', k),
dictGet(dict_name, 'i64', k),
dictGet(dict_name, 'u8', k),
dictGet(dict_name, 'u16', k),
dictGet(dict_name, 'u32', k),
dictGet(dict_name, 'u64', k);
select 'dictGetOrDefault', 'flat_ints' as dict_name, toUInt64(1) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGetOrDefault', 'flat_ints' as dict_name, toUInt64(0) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGet', 'hashed_ints' as dict_name, toUInt64(1) as k,
dictGet(dict_name, 'i8', k),
dictGet(dict_name, 'i16', k),
dictGet(dict_name, 'i32', k),
dictGet(dict_name, 'i64', k),
dictGet(dict_name, 'u8', k),
dictGet(dict_name, 'u16', k),
dictGet(dict_name, 'u32', k),
dictGet(dict_name, 'u64', k);
select 'dictGetOrDefault', 'hashed_ints' as dict_name, toUInt64(1) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGetOrDefault', 'hashed_ints' as dict_name, toUInt64(0) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGet', 'cache_ints' as dict_name, toUInt64(1) as k,
dictGet(dict_name, 'i8', k),
dictGet(dict_name, 'i16', k),
dictGet(dict_name, 'i32', k),
dictGet(dict_name, 'i64', k),
dictGet(dict_name, 'u8', k),
dictGet(dict_name, 'u16', k),
dictGet(dict_name, 'u32', k),
dictGet(dict_name, 'u64', k);
select 'dictGetOrDefault', 'cache_ints' as dict_name, toUInt64(1) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGetOrDefault', 'cache_ints' as dict_name, toUInt64(0) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGet', 'complex_hashed_ints' as dict_name, tuple(toUInt64(1)) as k,
dictGet(dict_name, 'i8', k),
dictGet(dict_name, 'i16', k),
dictGet(dict_name, 'i32', k),
dictGet(dict_name, 'i64', k),
dictGet(dict_name, 'u8', k),
dictGet(dict_name, 'u16', k),
dictGet(dict_name, 'u32', k),
dictGet(dict_name, 'u64', k);
select 'dictGetOrDefault', 'complex_hashed_ints' as dict_name, tuple(toUInt64(1)) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGetOrDefault', 'complex_hashed_ints' as dict_name, tuple(toUInt64(0)) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGet', 'complex_cache_ints' as dict_name, tuple(toUInt64(1)) as k,
dictGet(dict_name, 'i8', k),
dictGet(dict_name, 'i16', k),
dictGet(dict_name, 'i32', k),
dictGet(dict_name, 'i64', k),
dictGet(dict_name, 'u8', k),
dictGet(dict_name, 'u16', k),
dictGet(dict_name, 'u32', k),
dictGet(dict_name, 'u64', k);
select 'dictGetOrDefault', 'complex_cache_ints' as dict_name, tuple(toUInt64(1)) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
select 'dictGetOrDefault', 'complex_cache_ints' as dict_name, tuple(toUInt64(0)) as k,
dictGetOrDefault(dict_name, 'i8', k, toInt8(42)),
dictGetOrDefault(dict_name, 'i16', k, toInt16(42)),
dictGetOrDefault(dict_name, 'i32', k, toInt32(42)),
dictGetOrDefault(dict_name, 'i64', k, toInt64(42)),
dictGetOrDefault(dict_name, 'u8', k, toUInt8(42)),
dictGetOrDefault(dict_name, 'u16', k, toUInt16(42)),
dictGetOrDefault(dict_name, 'u32', k, toUInt32(42)),
dictGetOrDefault(dict_name, 'u64', k, toUInt64(42));
--
select 'dictGet', 'flat_strings' as dict_name, toUInt64(1) as k, dictGet(dict_name, 'str', k);
select 'dictGetOrDefault', 'flat_strings' as dict_name, toUInt64(1) as k, dictGetOrDefault(dict_name, 'str', k, '*');
select 'dictGetOrDefault', 'flat_strings' as dict_name, toUInt64(0) as k, dictGetOrDefault(dict_name, 'str', k, '*');
select 'dictGet', 'hashed_strings' as dict_name, toUInt64(1) as k, dictGet(dict_name, 'str', k);
select 'dictGetOrDefault', 'hashed_strings' as dict_name, toUInt64(1) as k, dictGetOrDefault(dict_name, 'str', k, '*');
select 'dictGetOrDefault', 'hashed_strings' as dict_name, toUInt64(0) as k, dictGetOrDefault(dict_name, 'str', k, '*');
select 'dictGet', 'cache_strings' as dict_name, toUInt64(1) as k, dictGet(dict_name, 'str', k);
select 'dictGetOrDefault', 'cache_strings' as dict_name, toUInt64(1) as k, dictGetOrDefault(dict_name, 'str', k, '*');
select 'dictGetOrDefault', 'cache_strings' as dict_name, toUInt64(0) as k, dictGetOrDefault(dict_name, 'str', k, '*');
select 'dictGet', 'complex_hashed_strings' as dict_name, toUInt64(1) as k, dictGet(dict_name, 'str', tuple(k));
select 'dictGetOrDefault', 'complex_hashed_strings' as dict_name, toUInt64(1) as k, dictGetOrDefault(dict_name, 'str', tuple(k), '*');
select 'dictGetOrDefault', 'complex_hashed_strings' as dict_name, toUInt64(0) as k, dictGetOrDefault(dict_name, 'str', tuple(k), '*');
select 'dictGet', 'complex_cache_strings' as dict_name, toUInt64(1) as k, dictGet(dict_name, 'str', tuple(k));
select 'dictGetOrDefault', 'complex_cache_strings' as dict_name, toUInt64(1) as k, dictGetOrDefault(dict_name, 'str', tuple(k), '*');
select 'dictGetOrDefault', 'complex_cache_strings' as dict_name, toUInt64(0) as k, dictGetOrDefault(dict_name, 'str', tuple(k), '*');
--
select 'dictGet', 'flat_decimals' as dict_name, toUInt64(1) as k,
dictGet(dict_name, 'd32', k),
dictGet(dict_name, 'd64', k),
dictGet(dict_name, 'd128', k);
select 'dictGetOrDefault', 'flat_decimals' as dict_name, toUInt64(1) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGetOrDefault', 'flat_decimals' as dict_name, toUInt64(0) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGet', 'hashed_decimals' as dict_name, toUInt64(1) as k,
dictGet(dict_name, 'd32', k),
dictGet(dict_name, 'd64', k),
dictGet(dict_name, 'd128', k);
select 'dictGetOrDefault', 'hashed_decimals' as dict_name, toUInt64(1) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGetOrDefault', 'hashed_decimals' as dict_name, toUInt64(0) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGet', 'cache_decimals' as dict_name, toUInt64(1) as k,
dictGet(dict_name, 'd32', k),
dictGet(dict_name, 'd64', k),
dictGet(dict_name, 'd128', k);
select 'dictGetOrDefault', 'cache_decimals' as dict_name, toUInt64(1) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGetOrDefault', 'cache_decimals' as dict_name, toUInt64(0) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGet', 'complex_hashed_decimals' as dict_name, tuple(toUInt64(1)) as k,
dictGet(dict_name, 'd32', k),
dictGet(dict_name, 'd64', k),
dictGet(dict_name, 'd128', k);
select 'dictGetOrDefault', 'complex_hashed_decimals' as dict_name, tuple(toUInt64(1)) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGetOrDefault', 'complex_hashed_decimals' as dict_name, tuple(toUInt64(0)) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGet', 'complex_cache_decimals' as dict_name, tuple(toUInt64(1)) as k,
dictGet(dict_name, 'd32', k),
dictGet(dict_name, 'd64', k),
dictGet(dict_name, 'd128', k);
select 'dictGetOrDefault', 'complex_cache_decimals' as dict_name, tuple(toUInt64(1)) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
select 'dictGetOrDefault', 'complex_cache_decimals' as dict_name, tuple(toUInt64(0)) as k,
dictGetOrDefault(dict_name, 'd32', k, toDecimal32(42, 4)),
dictGetOrDefault(dict_name, 'd64', k, toDecimal64(42, 6)),
dictGetOrDefault(dict_name, 'd128', k, toDecimal128(42, 1));
drop table ints;
drop table strings;
drop table decimals;

View File

@ -110,7 +110,7 @@
<table>query_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_log>
<dictionaries_config>dictionary_*.xml</dictionaries_config>
<dictionaries_config>*_dictionary.xml</dictionaries_config>
<compression incl="clickhouse_compression">
</compression>
<distributed_ddl>

View File

@ -0,0 +1,209 @@
<dictionaries>
<dictionary>
<name>flat_strings</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>strings</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<flat/>
</layout>
<structure>
<id>
<name>key</name>
</id>
<attribute>
<name>str</name>
<type>String</type>
<null_value></null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>hashed_strings</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>strings</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<hashed/>
</layout>
<structure>
<id>
<name>key</name>
</id>
<attribute>
<name>str</name>
<type>String</type>
<null_value></null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>cache_strings</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>strings</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<cache><size_in_cells>1000</size_in_cells></cache>
</layout>
<structure>
<id>
<name>key</name>
</id>
<attribute>
<name>str</name>
<type>String</type>
<null_value></null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>complex_hashed_strings</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>strings</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<complex_key_hashed/>
</layout>
<structure>
<key>
<attribute>
<name>key</name>
<type>UInt64</type>
</attribute>
</key>
<attribute>
<name>str</name>
<type>String</type>
<null_value></null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>complex_cache_strings</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>strings</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<complex_key_cache><size_in_cells>1000</size_in_cells></complex_key_cache>
</layout>
<structure>
<key>
<attribute>
<name>key</name>
<type>UInt64</type>
</attribute>
</key>
<attribute>
<name>str</name>
<type>String</type>
<null_value></null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>complex_hashed_strings_key</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>strings</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<complex_key_hashed/>
</layout>
<structure>
<key>
<attribute>
<name>str</name>
<type>String</type>
</attribute>
</key>
<attribute>
<name>key</name>
<type>UInt64</type>
<null_value>0</null_value>
</attribute>
</structure>
</dictionary>
<dictionary>
<name>complex_cache_strings_key</name>
<source>
<clickhouse>
<host>localhost</host>
<port>9000</port>
<user>default</user>
<password></password>
<db></db>
<table>strings</table>
</clickhouse>
</source>
<lifetime>0</lifetime>
<layout>
<complex_key_cache><size_in_cells>1000</size_in_cells></complex_key_cache>
</layout>
<structure>
<key>
<attribute>
<name>str</name>
<type>String</type>
</attribute>
</key>
<attribute>
<name>key</name>
<type>UInt64</type>
<null_value>0</null_value>
</attribute>
</structure>
</dictionary>
</dictionaries>