diff --git a/dbms/tests/queries/0_stateless/00948_format_in_with_single_element.reference b/dbms/tests/queries/0_stateless/00948_format_in_with_single_element.reference new file mode 100644 index 00000000000..53dce4a69ba --- /dev/null +++ b/dbms/tests/queries/0_stateless/00948_format_in_with_single_element.reference @@ -0,0 +1,12 @@ +SELECT 1 IN (1) +SELECT 1 IN (1) +SELECT 1 IN (1, 2) +SELECT 1 IN (f(1)) +SELECT 1 IN (f(1)) +SELECT 1 IN (f(1), f(2)) +SELECT 1 IN (f(1, 2)) +SELECT 1 IN ((1 + 1)) +SELECT 1 IN ('hello') +SELECT 1 IN (f('hello')) +SELECT 1 IN ('hello', 'world') +SELECT 1 IN (f('hello', 'world')) diff --git a/dbms/tests/queries/0_stateless/00948_format_in_with_single_element.sh b/dbms/tests/queries/0_stateless/00948_format_in_with_single_element.sh new file mode 100755 index 00000000000..81ce6c59656 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00948_format_in_with_single_element.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + +set -e + +echo "SELECT 1 IN 1" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN (1)" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN (1, 2)" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN f(1)" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN (f(1))" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN (f(1), f(2))" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN f(1, 2)" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN 1 + 1" | $CLICKHOUSE_FORMAT # This is quite strange +echo "SELECT 1 IN 'hello'" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN f('hello')" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN ('hello', 'world')" | $CLICKHOUSE_FORMAT +echo "SELECT 1 IN f('hello', 'world')" | $CLICKHOUSE_FORMAT diff --git a/dbms/tests/queries/shell_config.sh b/dbms/tests/queries/shell_config.sh index ec65f148b01..af222fc9531 100644 --- a/dbms/tests/queries/shell_config.sh +++ b/dbms/tests/queries/shell_config.sh @@ -22,6 +22,10 @@ export CLICKHOUSE_CONFIG_CLIENT=${CLICKHOUSE_CONFIG_CLIENT:="/etc/clickhouse-cli [ -x "${CLICKHOUSE_BINARY}" ] && CLICKHOUSE_EXTRACT_CONFIG=${CLICKHOUSE_EXTRACT_CONFIG:="$CLICKHOUSE_BINARY extract-from-config --config=$CLICKHOUSE_CONFIG"} export CLICKHOUSE_EXTRACT_CONFIG=${CLICKHOUSE_EXTRACT_CONFIG:="$CLICKHOUSE_BINARY-extract-from-config --config=$CLICKHOUSE_CONFIG"} +[ -x "${CLICKHOUSE_BINARY}-format" ] && CLICKHOUSE_FORMAT=${CLICKHOUSE_FORMAT=:="$CLICKHOUSE_BINARY-format"} +[ -x "${CLICKHOUSE_BINARY}" ] && CLICKHOUSE_FORMAT=${CLICKHOUSE_FORMAT:="$CLICKHOUSE_BINARY format"} +export CLICKHOUSE_FORMAT=${CLICKHOUSE_FORMAT:="$CLICKHOUSE_BINARY-format"} + export CLICKHOUSE_CONFIG_GREP=${CLICKHOUSE_CONFIG_GREP:="/etc/clickhouse-server/preprocessed/config.xml"} export CLICKHOUSE_HOST=${CLICKHOUSE_HOST:="localhost"}