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

Improve print formatting of strings containing newline characters. #11108

Merged
merged 3 commits into from
Jun 21, 2022

Conversation

nvdbaranec
Copy link
Contributor

String data that contained \r and \n characters would print badly mangled.

Example column containing:

.,e,Infinity,+Infinity,-Infinity,+nAn,-naN,Nan,5f,1.2f,\riNf,NULL

Doing a cudf::test::print() on this would yield mostly garbage, but importantly, plausible-seeming but puzzling garbage:

iNf,NULLnity,+Infinity,-Infinity,+nAn,-naN,Nan,5f,1.2f,

The fix is to do a little postprocessing and replace the individual chars '\r' and '\n' with the escaped strings "\r" and "\n". Note that this only applies to the output ultimately sent to the print - not to the raw data retrieved from the device itself using ::to_host

@nvdbaranec nvdbaranec added libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jun 14, 2022
@nvdbaranec nvdbaranec requested a review from a team as a code owner June 14, 2022 21:21
cpp/tests/utilities/column_utilities.cu Outdated Show resolved Hide resolved
cpp/tests/utilities/column_utilities.cu Outdated Show resolved Hide resolved
Copy link
Contributor

@karthikeyann karthikeyann left a comment

Choose a reason for hiding this comment

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

Replace string const& with string_view.
Rest all looks good.

@codecov
Copy link

codecov bot commented Jun 15, 2022

Codecov Report

❗ No coverage uploaded for pull request base (branch-22.08@b7c7adc). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 5c2a3ad differs from pull request most recent head fecabb8. Consider uploading reports for the commit fecabb8 to get more accurate results

@@               Coverage Diff               @@
##             branch-22.08   #11108   +/-   ##
===============================================
  Coverage                ?   86.31%           
===============================================
  Files                   ?      144           
  Lines                   ?    22729           
  Branches                ?        0           
===============================================
  Hits                    ?    19618           
  Misses                  ?     3111           
  Partials                ?        0           

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 b7c7adc...fecabb8. Read the comment docs.

@ttnghia
Copy link
Contributor

ttnghia commented Jun 20, 2022

Rerun tests.

@vyasr
Copy link
Contributor

vyasr commented Jun 21, 2022

@nvdbaranec good to merge this?

@nvdbaranec
Copy link
Contributor Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 36aa957 into rapidsai:branch-22.08 Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants