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

Use exceptions instead of return values to handle errors in CompactProtocolReader #14582

Merged
merged 20 commits into from
Dec 14, 2023
Merged
Changes from 3 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
14 changes: 13 additions & 1 deletion cpp/src/io/parquet/compact_protocol_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,24 @@ class parquet_field_int : public parquet_field {

T& val;

std::string type_string()
vuule marked this conversation as resolved.
Show resolved Hide resolved
{
if constexpr (EXPECTED_TYPE == ST_FLD_BYTE) {
return "byte";
} else if constexpr (EXPECTED_TYPE == ST_FLD_I32) {
return "int32";
} else if constexpr (EXPECTED_TYPE == ST_FLD_I64) {
return "int64";
}
return "unknown(EXPECTED_TYPE=" + std::to_string(EXPECTED_TYPE) + ")";
vuule marked this conversation as resolved.
Show resolved Hide resolved
}

public:
parquet_field_int(int f, T& v) : parquet_field(f), val(v) {}

inline void operator()(CompactProtocolReader* cpr, int field_type)
{
CUDF_EXPECTS(field_type == EXPECTED_TYPE, "unexpected int field type");
CUDF_EXPECTS(field_type != EXPECTED_TYPE, "expected " + type_string() + " field");
if constexpr (is_byte) {
val = cpr->getb();
} else {
Expand Down
Loading