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 std::overflow_error when output would exceed column size limit #13323

Merged
merged 24 commits into from
May 24, 2023

Conversation

davidwendt
Copy link
Contributor

@davidwendt davidwendt commented May 9, 2023

Description

Replaces generic cudf::logic_error exception with std::overflow_error where appropriate in libcudf.
Since this changes what is thrown in certain APIs, I think this technically is a breaking change.

Closes #12925

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt added 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 9, 2023
@davidwendt davidwendt added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels May 10, 2023
@davidwendt davidwendt marked this pull request as ready for review May 10, 2023 21:25
@davidwendt davidwendt requested a review from a team as a code owner May 10, 2023 21:25
@davidwendt davidwendt added breaking Breaking change and removed non-breaking Non-breaking change labels May 11, 2023
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do overflow comparisons with operands as std::size_t always? Should we use a common detail function to do these comparisons, like:

#include <limits>

template<typename T>
bool check_column_size_overflow(T size) {
    return static_cast<std::size_t>(size) <= static_cast<std::size_t>(std::numeric_limits<cudf::size_type>::max());
}

cpp/src/join/hash_join.cu Outdated Show resolved Hide resolved
cpp/src/text/subword/subword_tokenize.cu Outdated Show resolved Hide resolved
cpp/tests/filling/repeat_tests.cpp Outdated Show resolved Hide resolved
@davidwendt davidwendt requested a review from bdice May 18, 2023 15:48
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to unblock this because I think it's a net improvement. But I'm still in favor of doing this work with a helper function that makes this logic less repetitive across libcudf.

@davidwendt davidwendt changed the base branch from branch-23.06 to branch-23.08 May 24, 2023 12:37
@davidwendt davidwendt changed the base branch from branch-23.08 to branch-23.06 May 24, 2023 12:38
@bdice
Copy link
Contributor

bdice commented May 24, 2023

Note: While looking at the MAX_JOIN_SIZE issue, I think there's some cleanup of constants on the Python side that needs to be written in terms of size_type_dtype.

MAX_COLUMN_SIZE = np.iinfo(np.int32).max
MAX_COLUMN_SIZE_STR = "INT32_MAX"
MAX_STRING_COLUMN_BYTES = np.iinfo(np.int32).max
MAX_STRING_COLUMN_BYTES_STR = "INT32_MAX"

I'll file a follow-up there.

@davidwendt
Copy link
Contributor Author

/merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team breaking Breaking change improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Throw std::overflow exception when an output column size exceeds cudf limit
5 participants