mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 20:12:02 +00:00
Fix tests
This commit is contained in:
parent
8a65c265e9
commit
9f30c17777
@ -324,15 +324,15 @@ def test_read_table_with_default(started_cluster):
|
|||||||
|
|
||||||
|
|
||||||
def test_schema_inference(started_cluster):
|
def test_schema_inference(started_cluster):
|
||||||
node1.query(f"insert into table function hdfs('hdfs://hdfs1:9000/parquet', 'Parquet', 'a Int32, b String') SELECT number, randomString(100) FROM numbers(5000000)")
|
node1.query(f"insert into table function hdfs('hdfs://hdfs1:9000/native', 'Native', 'a Int32, b String') SELECT number, randomString(100) FROM numbers(5000000)")
|
||||||
|
|
||||||
result = node1.query(f"desc hdfs('hdfs://hdfs1:9000/parquet', 'Parquet')")
|
result = node1.query(f"desc hdfs('hdfs://hdfs1:9000/native', 'Native')")
|
||||||
assert result == "a\tInt32\t\t\t\t\t\nb\tString\t\t\t\t\t\n"
|
assert result == "a\tInt32\t\t\t\t\t\nb\tString\t\t\t\t\t\n"
|
||||||
|
|
||||||
result = node1.query(f"select count(*) from hdfs('hdfs://hdfs1:9000/parquet', 'Parquet')")
|
result = node1.query(f"select count(*) from hdfs('hdfs://hdfs1:9000/native', 'Native')")
|
||||||
assert(int(result) == 5000000)
|
assert(int(result) == 5000000)
|
||||||
|
|
||||||
node1.query(f"create table schema_inference engine=HDFS('hdfs://hdfs1:9000/parquet', 'Parquet')")
|
node1.query(f"create table schema_inference engine=HDFS('hdfs://hdfs1:9000/native', 'Native')")
|
||||||
result = node1.query(f"desc schema_inference")
|
result = node1.query(f"desc schema_inference")
|
||||||
assert result == "a\tInt32\t\t\t\t\t\nb\tString\t\t\t\t\t\n"
|
assert result == "a\tInt32\t\t\t\t\t\nb\tString\t\t\t\t\t\n"
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|||||||
USER_FILES_PATH=$(clickhouse-client --query "select _path,_file from file('nonexist.txt', 'CSV', 'val1 char')" 2>&1 | grep Exception | awk '{gsub("/nonexist.txt","",$9); print $9}')
|
USER_FILES_PATH=$(clickhouse-client --query "select _path,_file from file('nonexist.txt', 'CSV', 'val1 char')" 2>&1 | grep Exception | awk '{gsub("/nonexist.txt","",$9); print $9}')
|
||||||
mkdir $USER_FILES_PATH/test_02149
|
mkdir $USER_FILES_PATH/test_02149
|
||||||
FILE_NAME=test_02149/data.Parquet
|
FILE_NAME=test_02149/data.Parquet
|
||||||
|
DATA_FILE=$USER_FILES_PATH/$FILE_NAME
|
||||||
|
|
||||||
$CLICKHOUSE_CLIENT -q "insert into table function file('$FILE_NAME', 'Parquet', 'num UInt64, str String, arr Array(UInt64)') select number as num, concat('Str: ', toString(number)) as str, [number, number + 1] as arr from numbers(10)"
|
$CLICKHOUSE_CLIENT -q "select number as num, concat('Str: ', toString(number)) as str, [number, number + 1] as arr from numbers(10) format Parquet" > $DATA_FILE
|
||||||
|
|
||||||
|
|
||||||
$CLICKHOUSE_CLIENT -q "drop table if exists test_02149"
|
$CLICKHOUSE_CLIENT -q "drop table if exists test_02149"
|
||||||
$CLICKHOUSE_CLIENT -q "create table test_02149 engine=File('Parquet', '$FILE_NAME')"
|
$CLICKHOUSE_CLIENT -q "create table test_02149 engine=File('Parquet', '$FILE_NAME')"
|
||||||
|
@ -49,7 +49,7 @@ $CLICKHOUSE_CLIENT -q "select toFloat32(number * 1.2) as float32, toFloat64(numb
|
|||||||
$CLICKHOUSE_CLIENT -q "desc file('$FILE_NAME', 'Avro')"
|
$CLICKHOUSE_CLIENT -q "desc file('$FILE_NAME', 'Avro')"
|
||||||
$CLICKHOUSE_CLIENT -q "select * from file('$FILE_NAME', 'Avro')"
|
$CLICKHOUSE_CLIENT -q "select * from file('$FILE_NAME', 'Avro')"
|
||||||
|
|
||||||
$CLICKHOUSE_CLIENT -q "select toDate(number) as date, toDateTime(number) as datetime from numbers(2) format Avro" > $DATA_FILE
|
$CLICKHOUSE_CLIENT -q "select toDate(number) as date, toDateTime(number, 'UTC') as datetime from numbers(2) format Avro" > $DATA_FILE
|
||||||
$CLICKHOUSE_CLIENT -q "desc file('$FILE_NAME', 'Avro')"
|
$CLICKHOUSE_CLIENT -q "desc file('$FILE_NAME', 'Avro')"
|
||||||
$CLICKHOUSE_CLIENT -q "select * from file('$FILE_NAME', 'Avro')"
|
$CLICKHOUSE_CLIENT -q "select * from file('$FILE_NAME', 'Avro')"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user