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

Add days check to cudf::is_timestamp using cuda::std::chrono classes #7028

Merged

Conversation

davidwendt
Copy link
Contributor

Closes #6774

This PR adds a check for a valid day value for a year/month (if these are specified in the format) in the cudf::is_timestamp() API. Also, a chunk of messy year/month/day logic in a related functor was replaced with libcu++ implementation of the year_month_day() function instead.
A gtest is also updated to include to test for an invalid day.

@davidwendt davidwendt requested a review from a team as a code owner December 17, 2020 16:44
@davidwendt davidwendt self-assigned this Dec 17, 2020
@davidwendt davidwendt added 3 - Ready for Review Ready for review by team bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change strings strings issues (C++ and Python) labels Dec 17, 2020
@codecov
Copy link

codecov bot commented Dec 17, 2020

Codecov Report

Merging #7028 (ef92b80) into branch-0.18 (28d18d6) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           branch-0.18    #7028      +/-   ##
===============================================
+ Coverage        82.09%   82.11%   +0.01%     
===============================================
  Files               97       97              
  Lines            16477    16477              
===============================================
+ Hits             13527    13530       +3     
+ Misses            2950     2947       -3     
Impacted Files Coverage Δ
python/cudf/cudf/io/csv.py 93.33% <0.00%> (-0.42%) ⬇️
python/cudf/cudf/_fuzz_testing/fuzzer.py 0.00% <0.00%> (ø)
python/cudf/cudf/utils/hash_vocab_utils.py 100.00% <0.00%> (ø)
python/cudf/cudf/core/abc.py 91.48% <0.00%> (+4.25%) ⬆️
python/cudf/cudf/utils/gpu_utils.py 58.53% <0.00%> (+4.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28d18d6...ef92b80. Read the comment docs.

Copy link
Contributor

@vuule vuule left a comment

Choose a reason for hiding this comment

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

That was a quick application of a talk!
Looks good, posted a tentative suggestion.

cpp/src/strings/convert/convert_datetime.cu Outdated Show resolved Hide resolved
cpp/src/strings/convert/convert_datetime.cu Outdated Show resolved Hide resolved
cpp/src/strings/convert/convert_datetime.cu Outdated Show resolved Hide resolved
@davidwendt davidwendt added breaking Breaking change and removed non-breaking Non-breaking change labels Jan 4, 2021
@@ -84,7 +84,7 @@ std::unique_ptr<column> to_timestamps(
* | :-------: | ----------- |
* | \%d | Day of the month: 01-31 |
* | \%m | Month of the year: 01-12 |
* | \%y | Year without century: 00-99 |
* | \%y | Year without century: 00-99. [0,68] maps to [2000,2068] and [69,99] maps to [1969,1999] |
Copy link
Contributor

Choose a reason for hiding this comment

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

We could add a %C format string to specify the century like std::chrono::parse: https://en.cppreference.com/w/cpp/chrono/parse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reference #5991

@rapids-bot rapids-bot bot merged commit 6ebd264 into rapidsai:branch-0.18 Jan 5, 2021
@davidwendt davidwendt deleted the is-timestamp-verify-date branch January 5, 2021 18:09
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 bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. strings strings issues (C++ and Python)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] is_timestamp should check that "days" is within range for specific month
5 participants