Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test](parquet)append parquet reader byte_array_decimal and rle_bool case. #26751

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion be/src/vec/exec/format/parquet/parquet_column_convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,23 @@ inline Status get_converter(tparquet::Type::type parquet_physical_type, Primitiv
DecimalScaleParams::NO_SCALE>>(); \
} \
} \
} else if (tparquet::Type::INT32 == parquet_physical_type) { \
} else if (tparquet::Type::BYTE_ARRAY == parquet_physical_type) { \
convert_params->init_decimal_converter<PRIMARY_TYPE>(dst_data_type); \
using ValueCopyType = DECIMAL_TYPE::NativeType; \
if (scale_params.scale_type == DecimalScaleParams::SCALE_UP) { \
*converter = std::make_unique<StringToDecimal<DECIMAL_TYPE, ValueCopyType, \
DecimalScaleParams::SCALE_UP>>(); \
} else if (scale_params.scale_type == DecimalScaleParams::SCALE_DOWN) { \
*converter = std::make_unique<StringToDecimal<DECIMAL_TYPE, ValueCopyType, \
DecimalScaleParams::SCALE_DOWN>>(); \
} else { \
*converter = std::make_unique<StringToDecimal<DECIMAL_TYPE, ValueCopyType, \
DecimalScaleParams::NO_SCALE>>(); \
} \
\
} \
\
else if (tparquet::Type::INT32 == parquet_physical_type) { \
if (scale_params.scale_type == DecimalScaleParams::SCALE_UP) { \
*converter = std::make_unique<NumberToDecimal<Int32, PRIMARY_TYPE, int64_t, \
DecimalScaleParams::SCALE_UP>>(); \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,20 @@ LOCATION

msck repair table orc_decimal_table;

CREATE TABLE `parquet_decimal_bool`(
decimals decimal(20,3),
bool_rle boolean
)
ROW FORMAT SERDE
'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'
LOCATION
'/user/doris/preinstalled_data/parquet_table/parquet_decimal_bool';

msck repair table partition_table;

show tables;

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,29 @@ suite("test_hive_basic_type", "external_docker,hive,external_docker_hive,p0,exte
// orc_all_types_t predicate test
order_qt_41 """select * from ${catalog_name}.${ex_db_name}.orc_all_types_t where t_int = 3;"""

//test parquet byte_array_decimal and rle_bool
order_qt_parquet """ select count(*) from ${catalog_name}.${ex_db_name}.parquet_decimal_bool """
order_qt_parquet1 """ select * from ${catalog_name}.${ex_db_name}.parquet_decimal_bool
where decimals is not null and bool_rle is not null order by decimals,bool_rle limit 7 """
order_qt_parquet2 """ select decimals from ${catalog_name}.${ex_db_name}.parquet_decimal_bool
where decimals is not null and decimals > 1 order by decimals limit 7 """
order_qt_parquet3 """ select decimals from ${catalog_name}.${ex_db_name}.parquet_decimal_bool
where decimals = 123.456 order by decimals limit 7 """
order_qt_parquet4 """ select decimals from ${catalog_name}.${ex_db_name}.parquet_decimal_bool
where decimals != -7871.416 and decimals is not null order by decimals limit 7 """

order_qt_parquet5 """ select decimals from ${catalog_name}.${ex_db_name}.parquet_decimal_bool
where decimals is not null and decimals < 0 order by decimals limit 7 """

order_qt_parquet7 """ select bool_rle from ${catalog_name}.${ex_db_name}.parquet_decimal_bool
where bool_rle is not null and bool_rle = 1 limit 7 """
order_qt_parquet8 """ select bool_rle from ${catalog_name}.${ex_db_name}.parquet_decimal_bool
where bool_rle is not null and bool_rle = 1 limit 7 """
order_qt_parquet9 """ select count(bool_rle) from ${catalog_name}.${ex_db_name}.parquet_decimal_bool; """
order_qt_parquet10 """ select count(decimals) from ${catalog_name}.${ex_db_name}.parquet_decimal_bool; """
order_qt_parquet11 """ select decimals from ${catalog_name}.${ex_db_name}.parquet_decimal_bool
where decimals is not null and decimals > 1 order by decimals limit 7 """

//sql """drop catalog if exists ${catalog_name} """
}
}
Expand Down
Loading