Skip to content
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
31 changes: 5 additions & 26 deletions cpp/examples/hybrid_scan_io/common_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "common_utils.hpp"

#include <cudf/ast/expressions.hpp>
#include <cudf/io/parquet.hpp>
#include <cudf/join/filtered_join.hpp>
#include <cudf/table/equality.hpp>
#include <cudf/table/table_view.hpp>

#include <rmm/cuda_stream_view.hpp>
Expand Down Expand Up @@ -69,30 +68,10 @@ void check_tables_equal(cudf::table_view const& lhs_table,
cudf::table_view const& rhs_table,
rmm::cuda_stream_view stream)
{
try {
// Left anti-join the original and transcoded tables identical tables should not throw an
// exception and return an empty indices vector
cudf::filtered_join join_obj(lhs_table, cudf::null_equality::EQUAL, stream);
auto const indices = join_obj.anti_join(rhs_table, stream);
// No exception thrown, check indices
auto const tables_equal = indices->size() == 0;
if (tables_equal) {
std::cout << "Tables identical: " << std::boolalpha << tables_equal << "\n\n";
} else {
// Helper to write parquet data for inspection
auto const write_parquet =
[](cudf::table_view table, std::string filepath, rmm::cuda_stream_view stream) {
auto sink_info = cudf::io::sink_info(filepath);
auto opts = cudf::io::parquet_writer_options::builder(sink_info, table).build();
cudf::io::write_parquet(opts, stream);
};
write_parquet(lhs_table, "lhs_table.parquet", stream);
write_parquet(rhs_table, "rhs_table.parquet", stream);
throw std::logic_error("Tables identical: false\n\n");
}
} catch (std::exception& e) {
std::cout << e.what() << std::endl;
}
auto const tables_equal =
cudf::tables_equal(lhs_table, rhs_table, cudf::null_equality::EQUAL, stream);
std::cout << "Tables identical: " << std::boolalpha << tables_equal << "\n\n";
if (not tables_equal) { throw std::logic_error("Table equality check failed"); }
}

std::vector<io_source> extract_input_sources(std::string const& paths,
Expand Down
19 changes: 5 additions & 14 deletions cpp/examples/parquet_io/common_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <cudf/concatenate.hpp>
#include <cudf/io/types.hpp>
#include <cudf/join/filtered_join.hpp>
#include <cudf/table/equality.hpp>
#include <cudf/table/table_view.hpp>

#include <rmm/cuda_stream_view.hpp>
Expand Down Expand Up @@ -87,19 +87,10 @@ void check_tables_equal(cudf::table_view const& lhs_table,
cudf::table_view const& rhs_table,
rmm::cuda_stream_view stream)
{
try {
// Left anti-join the original and transcoded tables identical tables should not throw an
// exception and return an empty indices vector
cudf::filtered_join join_obj(lhs_table, cudf::null_equality::EQUAL, stream);
auto const indices = join_obj.anti_join(rhs_table, stream);

// No exception thrown, check indices
auto const valid = indices->size() == 0;
std::cout << "Tables identical: " << valid << "\n\n";
} catch (std::exception& e) {
std::cerr << e.what() << std::endl << std::endl;
throw std::runtime_error("Tables identical: false\n\n");
}
auto const tables_equal =
cudf::tables_equal(lhs_table, rhs_table, cudf::null_equality::EQUAL, stream);
std::cout << "Tables identical: " << std::boolalpha << tables_equal << "\n\n";
if (not tables_equal) { throw std::logic_error("Table equality check failed"); }
}

std::unique_ptr<cudf::table> concatenate_tables(std::vector<std::unique_ptr<cudf::table>> tables,
Expand Down
1 change: 0 additions & 1 deletion cpp/examples/parquet_io/parquet_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

#include "common_utils.hpp"
#include "io_source.hpp"
#include "timer.hpp"

#include <cudf/io/parquet.hpp>
Expand Down
Loading