Skip to content

Commit ae6c202

Browse files
shanhuuangpitrou
authored andcommitted
ARROW-15184: [C++] Unit tests of reading delta-encoded Parquet files with and without nulls
Closes apache#12015 from shanhuuang/ARROW-15184 Lead-authored-by: shanhuuang <shanhuuang@gmail.com> Co-authored-by: Shan Huang <85105837+shanhuuang@users.noreply.github.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 314d8bf commit ae6c202

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

‎cpp/src/parquet/arrow/arrow_reader_writer_test.cc‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,6 +4263,62 @@ TEST_F(TestArrowReadDeltaEncoding, IncrementalDecodeDeltaByteArray) {
42634263
ASSERT_EQ(nullptr, actual_batch);
42644264
}
42654265

4266+
TEST_F(TestArrowReadDeltaEncoding, RequiredColumn) {
4267+
std::shared_ptr<::arrow::Table> actual_table, expect_table;
4268+
ReadTableFromParquetFile("delta_encoding_required_column.parquet", &actual_table);
4269+
4270+
auto convert_options = ::arrow::csv::ConvertOptions::Defaults();
4271+
convert_options.column_types = {{"c_customer_sk", ::arrow::int32()},
4272+
{"c_current_cdemo_sk", ::arrow::int32()},
4273+
{"c_current_hdemo_sk", ::arrow::int32()},
4274+
{"c_current_addr_sk", ::arrow::int32()},
4275+
{"c_first_shipto_date_sk", ::arrow::int32()},
4276+
{"c_first_sales_date_sk", ::arrow::int32()},
4277+
{"c_birth_day", ::arrow::int32()},
4278+
{"c_birth_month", ::arrow::int32()},
4279+
{"c_birth_year", ::arrow::int32()},
4280+
{"c_customer_id", ::arrow::utf8()},
4281+
{"c_salutation", ::arrow::utf8()},
4282+
{"c_first_name", ::arrow::utf8()},
4283+
{"c_last_name", ::arrow::utf8()},
4284+
{"c_preferred_cust_flag", ::arrow::utf8()},
4285+
{"c_birth_country", ::arrow::utf8()},
4286+
{"c_login", ::arrow::utf8()},
4287+
{"c_email_address", ::arrow::utf8()},
4288+
{"c_last_review_date", ::arrow::utf8()}};
4289+
ReadTableFromCSVFile("delta_encoding_required_column_expect.csv", convert_options,
4290+
&expect_table);
4291+
::arrow::AssertTablesEqual(*actual_table, *expect_table, false);
4292+
}
4293+
4294+
TEST_F(TestArrowReadDeltaEncoding, OptionalColumn) {
4295+
std::shared_ptr<::arrow::Table> actual_table, expect_table;
4296+
ReadTableFromParquetFile("delta_encoding_optional_column.parquet", &actual_table);
4297+
4298+
auto convert_options = ::arrow::csv::ConvertOptions::Defaults();
4299+
convert_options.column_types = {{"c_customer_sk", ::arrow::int64()},
4300+
{"c_current_cdemo_sk", ::arrow::int64()},
4301+
{"c_current_hdemo_sk", ::arrow::int64()},
4302+
{"c_current_addr_sk", ::arrow::int64()},
4303+
{"c_first_shipto_date_sk", ::arrow::int64()},
4304+
{"c_first_sales_date_sk", ::arrow::int64()},
4305+
{"c_birth_day", ::arrow::int64()},
4306+
{"c_birth_month", ::arrow::int64()},
4307+
{"c_birth_year", ::arrow::int64()},
4308+
{"c_customer_id", ::arrow::utf8()},
4309+
{"c_salutation", ::arrow::utf8()},
4310+
{"c_first_name", ::arrow::utf8()},
4311+
{"c_last_name", ::arrow::utf8()},
4312+
{"c_preferred_cust_flag", ::arrow::utf8()},
4313+
{"c_birth_country", ::arrow::utf8()},
4314+
{"c_login", ::arrow::utf8()},
4315+
{"c_email_address", ::arrow::utf8()},
4316+
{"c_last_review_date", ::arrow::utf8()}};
4317+
convert_options.strings_can_be_null = true;
4318+
ReadTableFromCSVFile("delta_encoding_optional_column_expect.csv", convert_options,
4319+
&expect_table);
4320+
::arrow::AssertTablesEqual(*actual_table, *expect_table, false);
4321+
}
42664322
#else
42674323
TEST(TestArrowReadDeltaEncoding, DeltaBinaryPacked) {
42684324
GTEST_SKIP() << "Test needs CSV reader";
@@ -4276,6 +4332,14 @@ TEST(TestArrowReadDeltaEncoding, IncrementalDecodeDeltaByteArray) {
42764332
GTEST_SKIP() << "Test needs CSV reader";
42774333
}
42784334

4335+
TEST(TestArrowReadDeltaEncoding, RequiredColumn) {
4336+
GTEST_SKIP() << "Test needs CSV reader";
4337+
}
4338+
4339+
TEST(TestArrowReadDeltaEncoding, OptionalColumn) {
4340+
GTEST_SKIP() << "Test needs CSV reader";
4341+
}
4342+
42794343
#endif
42804344

42814345
struct NestedFilterTestCase {

0 commit comments

Comments
 (0)