ClickHouse/tests/queries/0_stateless/01015_insert_values_parametrized.sh

25 lines
1.8 KiB
Bash
Raw Normal View History

2019-10-02 19:54:40 +00:00
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2020-12-28 11:46:53 +00:00
# shellcheck source=../shell_config.sh
2020-08-01 00:51:12 +00:00
. "$CURDIR"/../shell_config.sh
2019-10-02 19:54:40 +00:00
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS insert_values_parametrized";
$CLICKHOUSE_CLIENT --query="CREATE TABLE insert_values_parametrized (n UInt8, s String, a Array(Float32)) ENGINE = Memory";
2019-10-07 16:08:07 +00:00
$CLICKHOUSE_CLIENT --input_format_values_deduce_templates_of_expressions=1 --input_format_values_interpret_expressions=0 --param_p_n="-1" --param_p_s="param" --param_p_a="[0.2,0.3]" --query="INSERT INTO insert_values_parametrized VALUES
2019-10-02 19:54:40 +00:00
(1 + {p_n:Int8}, lower(concat('Hello', {p_s:String})), arraySort(arrayIntersect([], {p_a:Array(Nullable(Float32))}))),\
(2 + {p_n:Int8}, lower(concat('world', {p_s:String})), arraySort(arrayIntersect([0.1,0.2,0.3], {p_a:Array(Nullable(Float32))}))),\
(3 + {p_n:Int8}, lower(concat('TEST', {p_s:String})), arraySort(arrayIntersect([0.1,0.3,0.4], {p_a:Array(Nullable(Float32))}))),\
(4 + {p_n:Int8}, lower(concat('PaRaM', {p_s:String})), arraySort(arrayIntersect([0.5], {p_a:Array(Nullable(Float32))})))";
2019-10-07 16:08:07 +00:00
$CLICKHOUSE_CLIENT --input_format_values_deduce_templates_of_expressions=0 --input_format_values_interpret_expressions=1 --param_p_n="-1" --param_p_s="param" --param_p_a="[0.2,0.3]" --query="INSERT INTO insert_values_parametrized VALUES \
(5 + {p_n:Int8}, lower(concat('Evaluate', {p_s:String})), arrayIntersect([0, 0.2, 0.6], {p_a:Array(Nullable(Float32))}))"
2020-06-24 21:36:18 +00:00
$CLICKHOUSE_CLIENT --param_p_n="5" --param_p_s="param" --param_p_a="[0.2,0.3]" --query="INSERT INTO insert_values_parametrized VALUES \
({p_n:Int8}, {p_s:String}, {p_a:Array(Nullable(Float32))})"
2019-10-02 19:54:40 +00:00
$CLICKHOUSE_CLIENT --query="SELECT * FROM insert_values_parametrized ORDER BY n";
$CLICKHOUSE_CLIENT --query="DROP TABLE insert_values_parametrized";