ClickHouse/tests/queries/0_stateless/03203_hive_style_partitioning.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
3.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# Tags: no-fasttest
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
2024-07-11 19:16:47 +00:00
$CLICKHOUSE_LOCAL -q "SELECT 'TESTING THE FILE HIVE PARTITIONING'"
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_LOCAL -q """
2024-07-05 17:36:59 +00:00
set use_hive_partitioning = 1;
2024-08-21 22:27:02 +00:00
SELECT *, column0 FROM file('$CURDIR/data_hive/partitioning/column0=Elizabeth/sample.parquet') LIMIT 10;
2024-08-20 12:02:09 +00:00
SELECT *, non_existing_column FROM file('$CURDIR/data_hive/partitioning/non_existing_column=Elizabeth/sample.parquet') LIMIT 10;
2024-08-22 11:20:04 +00:00
SELECT *, column0 FROM file('$CURDIR/data_hive/partitioning/column0=*/sample.parquet') WHERE column0 = 'Elizabeth' LIMIT 10;
2024-07-10 17:44:06 +00:00
2024-08-20 12:02:09 +00:00
SELECT number, date FROM file('$CURDIR/data_hive/partitioning/number=42/date=2020-01-01/sample.parquet') LIMIT 1;
SELECT array, float FROM file('$CURDIR/data_hive/partitioning/array=[1,2,3]/float=42.42/sample.parquet') LIMIT 1;
SELECT toTypeName(array), toTypeName(float) FROM file('$CURDIR/data_hive/partitioning/array=[1,2,3]/float=42.42/sample.parquet') LIMIT 1;
SELECT count(*) FROM file('$CURDIR/data_hive/partitioning/number=42/date=2020-01-01/sample.parquet') WHERE number = 42;
2024-07-10 17:44:06 +00:00
"""
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_LOCAL -q """
2024-07-15 16:27:38 +00:00
set use_hive_partitioning = 1;
2024-08-20 12:02:09 +00:00
SELECT identifier FROM file('$CURDIR/data_hive/partitioning/identifier=*/email.csv') LIMIT 2;
SELECT a FROM file('$CURDIR/data_hive/partitioning/a=b/a=b/sample.parquet') LIMIT 1;
2024-07-15 16:27:38 +00:00
"""
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_LOCAL -q """
2024-08-22 16:56:50 +00:00
set use_hive_partitioning = 1;
2024-08-22 21:40:18 +00:00
SELECT *, column0 FROM file('$CURDIR/data_hive/partitioning/column0=Elizabeth/column0=Elizabeth1/sample.parquet') LIMIT 10;
2024-08-22 16:56:50 +00:00
""" 2>&1 | grep -c "INCORRECT_DATA"
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_LOCAL -q """
2024-07-05 17:36:59 +00:00
set use_hive_partitioning = 0;
2024-08-22 15:56:16 +00:00
SELECT *, non_existing_column FROM file('$CURDIR/data_hive/partitioning/non_existing_column=Elizabeth/sample.parquet') LIMIT 10;
2024-07-02 14:43:45 +00:00
""" 2>&1 | grep -c "UNKNOWN_IDENTIFIER"
2024-07-11 19:16:47 +00:00
$CLICKHOUSE_LOCAL -q "SELECT 'TESTING THE URL PARTITIONING'"
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_LOCAL -q """
2024-07-05 17:36:59 +00:00
set use_hive_partitioning = 1;
2024-08-21 22:27:02 +00:00
SELECT *, column0 FROM url('http://localhost:11111/test/hive_partitioning/column0=Elizabeth/sample.parquet') LIMIT 10;
2024-08-20 12:02:09 +00:00
SELECT *, non_existing_column FROM url('http://localhost:11111/test/hive_partitioning/non_existing_column=Elizabeth/sample.parquet') LIMIT 10;"""
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_LOCAL -q """
2024-07-05 17:36:59 +00:00
set use_hive_partitioning = 0;
2024-07-08 13:57:54 +00:00
SELECT *, _column0 FROM url('http://localhost:11111/test/hive_partitioning/column0=Elizabeth/sample.parquet') LIMIT 10;
2024-07-02 14:43:45 +00:00
""" 2>&1 | grep -c "UNKNOWN_IDENTIFIER"
2024-07-11 19:16:47 +00:00
$CLICKHOUSE_LOCAL -q "SELECT 'TESTING THE S3 PARTITIONING'"
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_CLIENT -q """
2024-07-05 17:36:59 +00:00
set use_hive_partitioning = 1;
2024-08-21 22:27:02 +00:00
SELECT *, column0 FROM s3('http://localhost:11111/test/hive_partitioning/column0=Elizabeth/sample.parquet') LIMIT 10;
2024-08-20 12:02:09 +00:00
SELECT *, non_existing_column FROM s3('http://localhost:11111/test/hive_partitioning/non_existing_column=Elizabeth/sample.parquet') LIMIT 10;
2024-08-22 11:20:04 +00:00
SELECT *, column0 FROM s3('http://localhost:11111/test/hive_partitioning/column0=*/sample.parquet') WHERE column0 = 'Elizabeth' LIMIT 10;
2024-07-02 14:43:45 +00:00
"""
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_CLIENT -q """
2024-07-05 17:36:59 +00:00
set use_hive_partitioning = 0;
2024-07-08 13:57:54 +00:00
SELECT *, _column0 FROM s3('http://localhost:11111/test/hive_partitioning/column0=Elizabeth/sample.parquet') LIMIT 10;
2024-07-12 12:59:43 +00:00
""" 2>&1 | grep -F -q "UNKNOWN_IDENTIFIER" && echo "OK" || echo "FAIL";
2024-07-15 22:09:30 +00:00
$CLICKHOUSE_LOCAL -q "SELECT 'TESTING THE S3CLUSTER PARTITIONING'"
2024-09-07 16:20:20 +00:00
$CLICKHOUSE_CLIENT -q """
2024-07-15 22:09:30 +00:00
set use_hive_partitioning = 1;
2024-08-21 22:27:02 +00:00
SELECT *, column0 FROM s3Cluster(test_cluster_one_shard_three_replicas_localhost, 'http://localhost:11111/test/hive_partitioning/column0=Elizabeth/sample.parquet') LIMIT 10;
2024-07-15 22:09:30 +00:00
2024-08-22 11:20:04 +00:00
SELECT *, column0 FROM s3Cluster(test_cluster_one_shard_three_replicas_localhost, 'http://localhost:11111/test/hive_partitioning/column0=Elizabeth/sample.parquet') WHERE column0 = 'Elizabeth' LIMIT 10;
2024-07-15 22:09:30 +00:00
"""