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

Remove the option to completely disable decimal128 columns in the ORC reader #10127

Merged
merged 3 commits into from
Jan 26, 2022
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
24 changes: 0 additions & 24 deletions cpp/include/cudf/io/orc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class orc_reader_options {

// Columns that should be read as Decimal128
std::vector<std::string> _decimal128_columns;
bool _enable_decimal128 = true;

friend orc_reader_options_builder;

Expand Down Expand Up @@ -152,11 +151,6 @@ class orc_reader_options {
*/
std::vector<std::string> const& get_decimal128_columns() const { return _decimal128_columns; }

/**
* @brief Whether to use row index to speed-up reading.
*/
bool is_enabled_decimal128() const { return _enable_decimal128; }

// Setters

/**
Expand Down Expand Up @@ -231,13 +225,6 @@ class orc_reader_options {
_decimal_cols_as_float = std::move(val);
}

/**
* @brief Enable/Disable the use of decimal128 type
*
* @param use Boolean value to enable/disable.
*/
void enable_decimal128(bool use) { _enable_decimal128 = use; }

/**
* @brief Set columns that should be read as 128-bit Decimal
*
Expand Down Expand Up @@ -375,17 +362,6 @@ class orc_reader_options_builder {
return *this;
}

/**
* @brief Enable/Disable use of decimal128 type
*
* @param use Boolean value to enable/disable.
*/
orc_reader_options_builder& decimal128(bool use)
{
options.enable_decimal128(use);
return *this;
}

/**
* @brief move orc_reader_options member once it's built.
*/
Expand Down
13 changes: 3 additions & 10 deletions cpp/src/io/orc/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ size_t gather_stream_info(const size_t stripe_index,
*/
auto decimal_column_type(std::vector<std::string> const& float64_columns,
std::vector<std::string> const& decimal128_columns,
bool is_decimal128_enabled,
cudf::io::orc::detail::aggregate_orc_metadata const& metadata,
int column_index)
{
Expand All @@ -244,7 +243,7 @@ auto decimal_column_type(std::vector<std::string> const& float64_columns,
};

auto const user_selected_float64 = is_column_in(float64_columns);
auto const user_selected_decimal128 = is_decimal128_enabled and is_column_in(decimal128_columns);
auto const user_selected_decimal128 = is_column_in(decimal128_columns);
CUDF_EXPECTS(not user_selected_float64 or not user_selected_decimal128,
"Both decimal128 and float64 types selected for column " + column_path);

Expand All @@ -255,9 +254,6 @@ auto decimal_column_type(std::vector<std::string> const& float64_columns,
.precision.value_or(cuda::std::numeric_limits<int64_t>::digits10);
if (precision <= cuda::std::numeric_limits<int32_t>::digits10) return type_id::DECIMAL32;
if (precision <= cuda::std::numeric_limits<int64_t>::digits10) return type_id::DECIMAL64;
CUDF_EXPECTS(is_decimal128_enabled,
"Decimal precision too high for decimal64, use `decimal_cols_as_float` or enable "
"decimal128 use");
return type_id::DECIMAL128;
}

Expand Down Expand Up @@ -754,8 +750,7 @@ std::unique_ptr<column> reader::impl::create_empty_column(const size_type orc_co
_metadata.get_schema(orc_col_id),
_use_np_dtypes,
_timestamp_type.id(),
decimal_column_type(
_decimal_cols_as_float, decimal128_columns, is_decimal128_enabled, _metadata, orc_col_id));
decimal_column_type(_decimal_cols_as_float, decimal128_columns, _metadata, orc_col_id));
int32_t scale = 0;
std::vector<std::unique_ptr<column>> child_columns;
std::unique_ptr<column> out_col = nullptr;
Expand Down Expand Up @@ -900,7 +895,6 @@ reader::impl::impl(std::vector<std::unique_ptr<datasource>>&& sources,
// Control decimals conversion
_decimal_cols_as_float = options.get_decimal_cols_as_float();
decimal128_columns = options.get_decimal128_columns();
is_decimal128_enabled = options.is_enabled_decimal128();
}

timezone_table reader::impl::compute_timezone_table(
Expand Down Expand Up @@ -964,8 +958,7 @@ table_with_metadata reader::impl::read(size_type skip_rows,
_metadata.get_col_type(col.id),
_use_np_dtypes,
_timestamp_type.id(),
decimal_column_type(
_decimal_cols_as_float, decimal128_columns, is_decimal128_enabled, _metadata, col.id));
decimal_column_type(_decimal_cols_as_float, decimal128_columns, _metadata, col.id));
CUDF_EXPECTS(col_type != type_id::EMPTY, "Unknown type");
if (col_type == type_id::DECIMAL32 or col_type == type_id::DECIMAL64 or
col_type == type_id::DECIMAL128) {
Expand Down
1 change: 0 additions & 1 deletion cpp/src/io/orc/reader_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ class reader::impl {
bool _use_np_dtypes{true};
std::vector<std::string> _decimal_cols_as_float;
std::vector<std::string> decimal128_columns;
bool is_decimal128_enabled{true};
data_type _timestamp_type{type_id::EMPTY};
reader_column_meta _col_meta{};
};
Expand Down
2 changes: 0 additions & 2 deletions python/cudf/cudf/_lib/cpp/io/orc.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ cdef extern from "cudf/io/orc.hpp" \
void enable_use_np_dtypes(bool val) except+
void set_timestamp_type(data_type type) except+
void set_decimal_cols_as_float(vector[string] val) except+
void enable_decimal128(bool val) except+
vuule marked this conversation as resolved.
Show resolved Hide resolved

@staticmethod
orc_reader_options_builder builder(
Expand All @@ -59,7 +58,6 @@ cdef extern from "cudf/io/orc.hpp" \
orc_reader_options_builder& decimal_cols_as_float(
vector[string] val
) except+
orc_reader_options_builder& decimal128(bool val) except+

orc_reader_options build() except+

Expand Down