ClickHouse/tests/queries/0_stateless/01401_FORMAT_SETTINGS.sh
Azat Khuzhin 781f1597f2 Fix SETTINGS parsing after FORMAT for SELECT queries
There are two possible ways to pass the SETTINGS clause:

  - SELECT 1 FORMAT Null SETTINGS max_block_size = 1
  - SELECT 1 SETTINGS max_block_size = 1[ FORMAT Null]

And when the SETTINGS goes after FORMAT it is parsed in
ParserQueryWithOutput, and these settings are not applied for the query
from the ASTSelectQuery::initSettings()

So propagate settings from the ParserQueryWithOutput to the
ASTSelectQuery settings.
2020-07-17 00:28:52 +03:00

22 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
set -o pipefail
# test via http, since client parses settings by itself additionally
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT DISTINCT blockSize() FROM numbers(2) SETTINGS max_block_size = 1 FORMAT CSV'
# push down
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT DISTINCT blockSize() FROM numbers(2) FORMAT CSV SETTINGS max_block_size = 1'
# push down append
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT DISTINCT blockSize() FROM numbers(2) SETTINGS max_compress_block_size = 1 FORMAT CSV SETTINGS max_block_size = 1'
# overwrite on push down (since these settings goes latest)
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT DISTINCT blockSize() FROM numbers(2) SETTINGS max_block_size = 2 FORMAT CSV SETTINGS max_block_size = 1'
# on push-down
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT DISTINCT blockSize() FROM numbers(2) SETTINGS max_block_size = 1 FORMAT CSV'
# no settings
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT DISTINCT blockSize() FROM numbers(2) FORMAT CSV'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT DISTINCT blockSize() FROM numbers(2)'