mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 01:12:12 +00:00
Added tests
This commit is contained in:
parent
c773afb659
commit
d3615aca67
@ -361,6 +361,13 @@ public:
|
|||||||
/// Functions in external dictionaries_loader only support full-value (not constant) columns with keys.
|
/// Functions in external dictionaries_loader only support full-value (not constant) columns with keys.
|
||||||
ColumnPtr key_column_full = key_col_with_type.column->convertToFullColumnIfConst();
|
ColumnPtr key_column_full = key_col_with_type.column->convertToFullColumnIfConst();
|
||||||
|
|
||||||
|
if (!isTuple(key_col_with_type.type))
|
||||||
|
throw Exception(
|
||||||
|
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||||
|
"Third argument of function ({}) must be tuple when dictionary is complex. Actual type ({}).",
|
||||||
|
getName(),
|
||||||
|
key_col_with_type.type->getName());
|
||||||
|
|
||||||
const auto & key_columns = typeid_cast<const ColumnTuple &>(*key_column_full).getColumnsCopy();
|
const auto & key_columns = typeid_cast<const ColumnTuple &>(*key_column_full).getColumnsCopy();
|
||||||
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
|
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
|
||||||
|
|
||||||
|
154
tests/config/executable_pool_dictionary.xml
Normal file
154
tests/config/executable_pool_dictionary.xml
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
<dictionaries>
|
||||||
|
|
||||||
|
<dictionary>
|
||||||
|
<name>executable_pool_simple</name>
|
||||||
|
|
||||||
|
<structure>
|
||||||
|
<id>
|
||||||
|
<name>x</name>
|
||||||
|
</id>
|
||||||
|
<attribute>
|
||||||
|
<name>a</name>
|
||||||
|
<type>String</type>
|
||||||
|
<null_value></null_value>
|
||||||
|
</attribute>
|
||||||
|
<attribute>
|
||||||
|
<name>b</name>
|
||||||
|
<type>String</type>
|
||||||
|
<null_value></null_value>
|
||||||
|
</attribute>
|
||||||
|
</structure>
|
||||||
|
|
||||||
|
<source>
|
||||||
|
<executable_pool>
|
||||||
|
<format>TabSeparated</format>
|
||||||
|
<command>while read read_data; do printf "$read_data\t$read_data a\t$read_data b\n"; done</command>
|
||||||
|
<size>5</size>
|
||||||
|
</executable_pool>
|
||||||
|
</source>
|
||||||
|
|
||||||
|
<layout>
|
||||||
|
<direct />
|
||||||
|
</layout>
|
||||||
|
|
||||||
|
<lifetime>300</lifetime>
|
||||||
|
</dictionary>
|
||||||
|
|
||||||
|
<dictionary>
|
||||||
|
<name>executable_pool_complex</name>
|
||||||
|
|
||||||
|
<structure>
|
||||||
|
<key>
|
||||||
|
<attribute>
|
||||||
|
<name>x</name>
|
||||||
|
<type>String</type>
|
||||||
|
</attribute>
|
||||||
|
<attribute>
|
||||||
|
<name>y</name>
|
||||||
|
<type>String</type>
|
||||||
|
</attribute>
|
||||||
|
</key>
|
||||||
|
<attribute>
|
||||||
|
<name>a</name>
|
||||||
|
<type>String</type>
|
||||||
|
<null_value></null_value>
|
||||||
|
</attribute>
|
||||||
|
<attribute>
|
||||||
|
<name>b</name>
|
||||||
|
<type>String</type>
|
||||||
|
<null_value></null_value>
|
||||||
|
</attribute>
|
||||||
|
</structure>
|
||||||
|
|
||||||
|
<source>
|
||||||
|
<executable>
|
||||||
|
<format>TabSeparated</format>
|
||||||
|
<command>while read read_data; do printf "$read_data\tvalue a\tvalue b\n"; done</command>
|
||||||
|
</executable>
|
||||||
|
</source>
|
||||||
|
|
||||||
|
<layout>
|
||||||
|
<complex_key_direct />
|
||||||
|
</layout>
|
||||||
|
|
||||||
|
<lifetime>300</lifetime>
|
||||||
|
</dictionary>
|
||||||
|
|
||||||
|
<dictionary>
|
||||||
|
<name>executable_pool_simple_implicit_key</name>
|
||||||
|
|
||||||
|
<structure>
|
||||||
|
<id>
|
||||||
|
<name>x</name>
|
||||||
|
</id>
|
||||||
|
<attribute>
|
||||||
|
<name>a</name>
|
||||||
|
<type>String</type>
|
||||||
|
<null_value></null_value>
|
||||||
|
</attribute>
|
||||||
|
<attribute>
|
||||||
|
<name>b</name>
|
||||||
|
<type>String</type>
|
||||||
|
<null_value></null_value>
|
||||||
|
</attribute>
|
||||||
|
</structure>
|
||||||
|
|
||||||
|
<source>
|
||||||
|
<executable_pool>
|
||||||
|
<format>TabSeparated</format>
|
||||||
|
<command>while read read_data; do printf "$read_data a\t$read_data b\n"; done</command>
|
||||||
|
<size>5</size>
|
||||||
|
<implicit_key>true</implicit_key>
|
||||||
|
</executable_pool>
|
||||||
|
</source>
|
||||||
|
|
||||||
|
<layout>
|
||||||
|
<direct />
|
||||||
|
</layout>
|
||||||
|
|
||||||
|
<lifetime>300</lifetime>
|
||||||
|
</dictionary>
|
||||||
|
|
||||||
|
<dictionary>
|
||||||
|
<name>executable_pool_complex_implicit_key</name>
|
||||||
|
|
||||||
|
<structure>
|
||||||
|
<key>
|
||||||
|
<attribute>
|
||||||
|
<name>x</name>
|
||||||
|
<type>String</type>
|
||||||
|
</attribute>
|
||||||
|
<attribute>
|
||||||
|
<name>y</name>
|
||||||
|
<type>String</type>
|
||||||
|
</attribute>
|
||||||
|
</key>
|
||||||
|
<attribute>
|
||||||
|
<name>a</name>
|
||||||
|
<type>String</type>
|
||||||
|
<null_value></null_value>
|
||||||
|
</attribute>
|
||||||
|
<attribute>
|
||||||
|
<name>b</name>
|
||||||
|
<type>String</type>
|
||||||
|
<null_value></null_value>
|
||||||
|
</attribute>
|
||||||
|
</structure>
|
||||||
|
|
||||||
|
<source>
|
||||||
|
<executable_pool>
|
||||||
|
<format>TabSeparated</format>
|
||||||
|
<command>while read read_data; do printf "data a\tdata b\n"; done</command>
|
||||||
|
<size>5</size>
|
||||||
|
<implicit_key>true</implicit_key>
|
||||||
|
</executable_pool>
|
||||||
|
</source>
|
||||||
|
|
||||||
|
<layout>
|
||||||
|
<complex_key_direct />
|
||||||
|
</layout>
|
||||||
|
|
||||||
|
<lifetime>300</lifetime>
|
||||||
|
</dictionary>
|
||||||
|
|
||||||
|
</dictionaries>
|
@ -0,0 +1,10 @@
|
|||||||
|
executable_pool_simple
|
||||||
|
1 a
|
||||||
|
1 b
|
||||||
|
2 a
|
||||||
|
2 b
|
||||||
|
executable_pool_complex
|
||||||
|
value a
|
||||||
|
value b
|
||||||
|
value a
|
||||||
|
value b
|
@ -0,0 +1,15 @@
|
|||||||
|
SELECT 'executable_pool_simple';
|
||||||
|
|
||||||
|
SELECT dictGet('executable_pool_simple', 'a', toUInt64(1));
|
||||||
|
SELECT dictGet('executable_pool_simple', 'b', toUInt64(1));
|
||||||
|
|
||||||
|
SELECT dictGet('executable_pool_simple', 'a', toUInt64(2));
|
||||||
|
SELECT dictGet('executable_pool_simple', 'b', toUInt64(2));
|
||||||
|
|
||||||
|
SELECT 'executable_pool_complex';
|
||||||
|
|
||||||
|
SELECT dictGet('executable_pool_complex', 'a', ('First_1', 'Second_1'));
|
||||||
|
SELECT dictGet('executable_pool_complex', 'b', ('First_1', 'Second_1'));
|
||||||
|
|
||||||
|
SELECT dictGet('executable_pool_complex', 'a', ('First_2', 'Second_2'));
|
||||||
|
SELECT dictGet('executable_pool_complex', 'b', ('First_2', 'Second_2'));
|
@ -0,0 +1,10 @@
|
|||||||
|
executable_pool_simple_implicit_key
|
||||||
|
1 a
|
||||||
|
1 b
|
||||||
|
2 a
|
||||||
|
2 b
|
||||||
|
executable_pool_complex_implicit_key
|
||||||
|
data a
|
||||||
|
data b
|
||||||
|
data a
|
||||||
|
data b
|
@ -0,0 +1,15 @@
|
|||||||
|
SELECT 'executable_pool_simple_implicit_key';
|
||||||
|
|
||||||
|
SELECT dictGet('executable_pool_simple_implicit_key', 'a', toUInt64(1));
|
||||||
|
SELECT dictGet('executable_pool_simple_implicit_key', 'b', toUInt64(1));
|
||||||
|
|
||||||
|
SELECT dictGet('executable_pool_simple_implicit_key', 'a', toUInt64(2));
|
||||||
|
SELECT dictGet('executable_pool_simple_implicit_key', 'b', toUInt64(2));
|
||||||
|
|
||||||
|
SELECT 'executable_pool_complex_implicit_key';
|
||||||
|
|
||||||
|
SELECT dictGet('executable_pool_complex_implicit_key', 'a', ('First_1', 'Second_1'));
|
||||||
|
SELECT dictGet('executable_pool_complex_implicit_key', 'b', ('First_1', 'Second_1'));
|
||||||
|
|
||||||
|
SELECT dictGet('executable_pool_complex_implicit_key', 'a', ('First_2', 'Second_2'));
|
||||||
|
SELECT dictGet('executable_pool_complex_implicit_key', 'b', ('First_2', 'Second_2'));
|
Loading…
Reference in New Issue
Block a user