|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2024, NVIDIA CORPORATION. |
| 2 | + * Copyright (c) 2024-2025, NVIDIA CORPORATION. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 |
|
| 17 | +#include "compression_common.hpp" |
| 18 | + |
17 | 19 | #include <cudf_test/base_fixture.hpp>
|
18 | 20 | #include <cudf_test/column_utilities.hpp>
|
19 | 21 | #include <cudf_test/column_wrapper.hpp>
|
@@ -161,6 +163,8 @@ auto chunked_read(std::string const& filepath,
|
161 | 163 |
|
162 | 164 | struct OrcChunkedReaderTest : public cudf::test::BaseFixture {};
|
163 | 165 |
|
| 166 | +using OrcChunkedDecompressionTest = DecompressionTest<OrcChunkedReaderTest>; |
| 167 | + |
164 | 168 | TEST_F(OrcChunkedReaderTest, TestChunkedReadNoData)
|
165 | 169 | {
|
166 | 170 | std::vector<std::unique_ptr<cudf::column>> input_columns;
|
@@ -1477,3 +1481,62 @@ TEST_F(OrcChunkedReaderInputLimitTest, SizeTypeRowsOverflow)
|
1477 | 1481 |
|
1478 | 1482 | #endif // LOCAL_TEST
|
1479 | 1483 | }
|
| 1484 | + |
| 1485 | +TEST_P(OrcChunkedDecompressionTest, RoundTripBasic) |
| 1486 | +{ |
| 1487 | + auto const compression_type = std::get<1>(GetParam()); |
| 1488 | + |
| 1489 | + auto const num_rows = 12'345; |
| 1490 | + |
| 1491 | + std::vector<std::unique_ptr<cudf::column>> input_columns; |
| 1492 | + auto value_iter = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i / 4; }); |
| 1493 | + input_columns.emplace_back(int32s_col(value_iter, value_iter + num_rows).release()); |
| 1494 | + input_columns.emplace_back(int64s_col(value_iter, value_iter + num_rows).release()); |
| 1495 | + auto expected = std::make_unique<cudf::table>(std::move(input_columns)); |
| 1496 | + |
| 1497 | + auto const filepath = temp_env->get_temp_filepath("chunked_read_compressions.orc"); |
| 1498 | + auto const write_opts = |
| 1499 | + cudf::io::orc_writer_options::builder(cudf::io::sink_info{filepath}, *expected) |
| 1500 | + .compression(compression_type) |
| 1501 | + .stripe_size_rows(2'000) |
| 1502 | + .row_index_stride(1'000) |
| 1503 | + .build(); |
| 1504 | + cudf::io::write_orc(write_opts); |
| 1505 | + |
| 1506 | + { |
| 1507 | + auto const [result, num_chunks] = |
| 1508 | + chunked_read(filepath, output_limit{0}, input_limit{2'400'000}); |
| 1509 | + CUDF_TEST_EXPECT_TABLES_EQUAL(*expected, *result); |
| 1510 | + } |
| 1511 | + |
| 1512 | + { |
| 1513 | + auto const [result, num_chunks] = chunked_read(filepath, output_limit{0}, input_limit{240'000}); |
| 1514 | + CUDF_TEST_EXPECT_TABLES_EQUAL(*expected, *result); |
| 1515 | + } |
| 1516 | + |
| 1517 | + { |
| 1518 | + auto const [result, num_chunks] = chunked_read(filepath, output_limit{0}, input_limit{24'000}); |
| 1519 | + CUDF_TEST_EXPECT_TABLES_EQUAL(*expected, *result); |
| 1520 | + } |
| 1521 | +} |
| 1522 | + |
| 1523 | +INSTANTIATE_TEST_CASE_P(Nvcomp, |
| 1524 | + OrcChunkedDecompressionTest, |
| 1525 | + ::testing::Combine(::testing::Values("NVCOMP"), |
| 1526 | + ::testing::Values(cudf::io::compression_type::AUTO, |
| 1527 | + cudf::io::compression_type::SNAPPY, |
| 1528 | + cudf::io::compression_type::LZ4, |
| 1529 | + cudf::io::compression_type::ZSTD))); |
| 1530 | + |
| 1531 | +INSTANTIATE_TEST_CASE_P(DeviceInternal, |
| 1532 | + OrcChunkedDecompressionTest, |
| 1533 | + ::testing::Combine(::testing::Values("DEVICE_INTERNAL"), |
| 1534 | + ::testing::Values(cudf::io::compression_type::AUTO, |
| 1535 | + cudf::io::compression_type::SNAPPY))); |
| 1536 | + |
| 1537 | +INSTANTIATE_TEST_CASE_P(Host, |
| 1538 | + OrcChunkedDecompressionTest, |
| 1539 | + ::testing::Combine(::testing::Values("HOST"), |
| 1540 | + ::testing::Values(cudf::io::compression_type::AUTO, |
| 1541 | + cudf::io::compression_type::SNAPPY, |
| 1542 | + cudf::io::compression_type::ZSTD))); |
0 commit comments