From 86f061976e0b818cca3b13d93c94c2f6ab5e5380 Mon Sep 17 00:00:00 2001 From: Pavel Kruglov Date: Wed, 12 May 2021 22:02:56 +0300 Subject: [PATCH] Some fixes --- .../Formats/Impl/ArrowColumnToCHColumn.cpp | 17 +++++++++------ .../Formats/Impl/CHColumnToArrowColumn.cpp | 20 +++++++++--------- .../0_stateless/00900_orc_arrays_load.sh | 10 ++++----- .../00900_orc_nested_arrays_load.sh | 12 +++++------ .../00900_orc_nullable_arrays_load.sh | 12 +++++------ tests/queries/0_stateless/data_orc/tmp | Bin 714 -> 0 bytes .../data_parquet/00900_parquet_load.reference | 0 7 files changed, 37 insertions(+), 34 deletions(-) delete mode 100644 tests/queries/0_stateless/data_orc/tmp delete mode 100644 tests/queries/0_stateless/data_parquet/00900_parquet_load.reference diff --git a/src/Processors/Formats/Impl/ArrowColumnToCHColumn.cpp b/src/Processors/Formats/Impl/ArrowColumnToCHColumn.cpp index cef9bd79b2a..3134fe7d919 100644 --- a/src/Processors/Formats/Impl/ArrowColumnToCHColumn.cpp +++ b/src/Processors/Formats/Impl/ArrowColumnToCHColumn.cpp @@ -274,9 +274,11 @@ namespace DB // TODO: check if a column is const? if (!is_nullable && !isColumnArray(internal_column) && arrow_column->null_count()) { - throw Exception{ - "Can not insert NULL data into non-nullable column \"" + column_name + "\"", - ErrorCodes::CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN}; + throw Exception + { + "Can not insert NULL data into non-nullable column \"" + column_name + "\"", + ErrorCodes::CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN + }; } switch (arrow_column->type()->id()) @@ -373,10 +375,11 @@ namespace DB { return DataTypeFactory::instance().get(internal_type_it->second); } - throw Exception{ - "The type \"" + arrow_type->name() + "\" of an input column \"" + column_name + "\" is not supported for conversion from a " - + format_name + " data format", - ErrorCodes::CANNOT_CONVERT_TYPE}; + throw Exception + { + "The type \"" + arrow_type->name() + "\" of an input column \"" + column_name + "\" is not supported for conversion from a " + format_name + " data format", + ErrorCodes::CANNOT_CONVERT_TYPE + }; } void ArrowColumnToCHColumn::arrowTableToCHChunk(Chunk & res, std::shared_ptr & table, diff --git a/src/Processors/Formats/Impl/CHColumnToArrowColumn.cpp b/src/Processors/Formats/Impl/CHColumnToArrowColumn.cpp index 522a3927bef..3d0b16e3b0a 100644 --- a/src/Processors/Formats/Impl/CHColumnToArrowColumn.cpp +++ b/src/Processors/Formats/Impl/CHColumnToArrowColumn.cpp @@ -218,7 +218,7 @@ namespace DB const ColumnNullable * column_nullable = checkAndGetColumn(column.get()); ColumnPtr nested_column = column_nullable->getNestedColumnPtr(); DataTypePtr nested_type = typeid_cast(column_type.get())->getNestedType(); - ColumnPtr null_column = column_nullable->getNullMapColumnPtr(); + const ColumnPtr & null_column = column_nullable->getNullMapColumnPtr(); const PaddedPODArray & bytemap = assert_cast &>(*null_column).getData(); fillArrowArray(column_name, nested_column, nested_type, &bytemap, array_builder, format_name, start, end); } @@ -269,9 +269,11 @@ namespace DB #undef DISPATCH else { - throw Exception{"Internal type \"" + column_type_name + "\" of a column \"" + column_name + "\"" - " is not supported for conversion into a " + format_name + " data format", - ErrorCodes::UNKNOWN_TYPE}; + throw Exception + { + "Internal type \"" + column_type_name + "\" of a column \"" + column_name + "\" is not supported for conversion into a " + format_name + " data format", + ErrorCodes::UNKNOWN_TYPE + }; } } @@ -349,12 +351,10 @@ namespace DB { return arrow_type_it->second; } - throw Exception{ - "The type \"" + type_name + "\" of a column \"" + column_name - + "\"" - " is not supported for conversion into a " - + format_name + " data format", - ErrorCodes::UNKNOWN_TYPE}; + + throw Exception{"The type \"" + column_name + "\" of a column \"" + column_name + "\"" + " is not supported for conversion into a " + format_name + " data format", + ErrorCodes::UNKNOWN_TYPE}; } void CHColumnToArrowColumn::chChunkToArrowTable( diff --git a/tests/queries/0_stateless/00900_orc_arrays_load.sh b/tests/queries/0_stateless/00900_orc_arrays_load.sh index ff3d4596b61..0b3dfd62526 100755 --- a/tests/queries/0_stateless/00900_orc_arrays_load.sh +++ b/tests/queries/0_stateless/00900_orc_arrays_load.sh @@ -7,9 +7,9 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) DATA_FILE=$CUR_DIR/data_orc/array_test.orc ${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS orc_load" -${CLICKHOUSE_CLIENT} --query="CREATE TABLE orc_load (a1 Array(Int8), a2 Array(UInt8), a3 Array(Int16), a4 Array(UInt16), a5 Array(Int32), a6 Array(UInt32), a7 Array(Int64), a8 Array(UInt64), a9 Array(String), a10 Array(FixedString(4)), a11 Array(Float32), a12 Array(Float64), a13 Array(Date), a14 Array(Datetime), a15 Array(Decimal(4, 2)), a16 Array(Decimal(10, 2)), a17 Array(Decimal(25, 2))) ENGINE=Memory()" -cat "$DATA_FILE" | ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" -timeout 3 ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" < $DATA_FILE -${CLICKHOUSE_CLIENT} --query="select * from orc_load" +${CLICKHOUSE_CLIENT} --query="CREATE TABLE orc_arrays (a1 Array(Int8), a2 Array(UInt8), a3 Array(Int16), a4 Array(UInt16), a5 Array(Int32), a6 Array(UInt32), a7 Array(Int64), a8 Array(UInt64), a9 Array(String), a10 Array(FixedString(4)), a11 Array(Float32), a12 Array(Float64), a13 Array(Date), a14 Array(Datetime), a15 Array(Decimal(4, 2)), a16 Array(Decimal(10, 2)), a17 Array(Decimal(25, 2))) ENGINE=Memory()" +cat "$DATA_FILE" | ${CLICKHOUSE_CLIENT} -q "insert into orc_arrays format ORC" +timeout 3 ${CLICKHOUSE_CLIENT} -q "insert into orc_arrays format ORC" < $DATA_FILE +${CLICKHOUSE_CLIENT} --query="select * from orc_arrays" -${CLICKHOUSE_CLIENT} --query="drop table orc_load" +${CLICKHOUSE_CLIENT} --query="drop table orc_arrays" diff --git a/tests/queries/0_stateless/00900_orc_nested_arrays_load.sh b/tests/queries/0_stateless/00900_orc_nested_arrays_load.sh index d9d5e5f1c57..9c40efd6676 100755 --- a/tests/queries/0_stateless/00900_orc_nested_arrays_load.sh +++ b/tests/queries/0_stateless/00900_orc_nested_arrays_load.sh @@ -6,10 +6,10 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) DATA_FILE=$CUR_DIR/data_orc/nested_array_test.orc -${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS orc_load" -${CLICKHOUSE_CLIENT} --query="CREATE TABLE orc_load (a1 Array(Array(Array(UInt32))), a2 Array(Array(Array(String))), a3 Array(Array(Nullable(UInt32))), a4 Array(Array(Nullable(String)))) engine=Memory()" -cat "$DATA_FILE" | ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" -timeout 3 ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" < $DATA_FILE -${CLICKHOUSE_CLIENT} --query="select * from orc_load" +${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS orc_nested_arrays" +${CLICKHOUSE_CLIENT} --query="CREATE TABLE orc_nested_arrays (a1 Array(Array(Array(UInt32))), a2 Array(Array(Array(String))), a3 Array(Array(Nullable(UInt32))), a4 Array(Array(Nullable(String)))) engine=Memory()" +cat "$DATA_FILE" | ${CLICKHOUSE_CLIENT} -q "insert into orc_nested_arrays format ORC" +timeout 3 ${CLICKHOUSE_CLIENT} -q "insert into orc_nested_arrays format ORC" < $DATA_FILE +${CLICKHOUSE_CLIENT} --query="select * from orc_nested_arrays" -${CLICKHOUSE_CLIENT} --query="drop table orc_load" +${CLICKHOUSE_CLIENT} --query="drop table orc_nested_arrays" diff --git a/tests/queries/0_stateless/00900_orc_nullable_arrays_load.sh b/tests/queries/0_stateless/00900_orc_nullable_arrays_load.sh index ec2a8be2d07..b3de283033a 100755 --- a/tests/queries/0_stateless/00900_orc_nullable_arrays_load.sh +++ b/tests/queries/0_stateless/00900_orc_nullable_arrays_load.sh @@ -6,10 +6,10 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) DATA_FILE=$CUR_DIR/data_orc/nullable_array_test.orc -${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS orc_load" -${CLICKHOUSE_CLIENT} --query="CREATE TABLE orc_load (a1 Array(Nullable(UInt32)), a2 Array(Nullable(String)), a3 Array(Nullable(Decimal(4, 2)))) ENGINE=Memory()" -cat "$DATA_FILE" | ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" -timeout 3 ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" < $DATA_FILE -${CLICKHOUSE_CLIENT} --query="select * from orc_load" +${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS orc_nullable_arrays" +${CLICKHOUSE_CLIENT} --query="CREATE TABLE orc_nullable_arrays (a1 Array(Nullable(UInt32)), a2 Array(Nullable(String)), a3 Array(Nullable(Decimal(4, 2)))) ENGINE=Memory()" +cat "$DATA_FILE" | ${CLICKHOUSE_CLIENT} -q "insert into orc_nullable_arrays format ORC" +timeout 3 ${CLICKHOUSE_CLIENT} -q "insert into orc_nullable_arrays format ORC" < $DATA_FILE +${CLICKHOUSE_CLIENT} --query="select * from orc_nullable_arrays" -${CLICKHOUSE_CLIENT} --query="drop table orc_load" +${CLICKHOUSE_CLIENT} --query="drop table orc_nullable_arrays" diff --git a/tests/queries/0_stateless/data_orc/tmp b/tests/queries/0_stateless/data_orc/tmp deleted file mode 100644 index 8a1ad838b502edc42110bf2bbb547c1425a74db6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 714 zcma)(u};G<5Qfh_+d4TdL{R~gsj3j_RGH9;scHuppsfloz<>|~AOR0hv9d5Tb>Kmm zcnx?6RvL`shE|m-2H)@R_xTdv4Msg3X#{{o5Dr0CwRBM8#tbXO6Gc20MlEM0TKP+m z5V0<&&E=GxG9@LR)wHlJYZKYdTJ0FxDJ{r=(Z>gIBG z4zJy*5L%In!Bo96v+k9fEw30@n3`u9SeaeN;O=p+%qx$X`K<>r_spE4XAI{U&PCut znd?a8^JMU4$Wx(?@^xhF)b-eX_dhYk!;>?8tc#%(ad8BN_t)=&S2UL}e!;Zjndv0ZJ?bo3R78()hgz*4GIB$#6rg>YH_L|!X%Pk)G-wJWz0l_OD f5O~D{I?w$hM(@l`ZafwZ4pFmj)#Df9VAL}|T