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

Fix cast_string_to_float with trailing whitespaces for inf and nan string #2063

Merged
merged 14 commits into from
Jun 5, 2024

Conversation

Feng-Jiang28
Copy link
Collaborator

@Feng-Jiang28 Feng-Jiang28 commented May 22, 2024

Fix the issue listed in #10794.

In RapidsCastSuit of Spark UT, "Process Infinity, -Infinity, NaN in case insensitive manner" case would fail, the reason is that in jni's cast_to_float.cu, the functions for checking inf and nan were considering "inf"("infinity") and "nan" strings with additional characters as illegal. I added the logic for checking if the additional characters are whitespaces.

src/main/cpp/src/cast_string_to_float.cu Outdated Show resolved Hide resolved
src/main/cpp/src/cast_string_to_float.cu Show resolved Hide resolved
tb2.column("INFINITY ", "inf", "+inf ", " -INF ");

Table.TestBuilder tb = new Table.TestBuilder();
tb.column(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's test double type too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Some negative tests would be nice. Some strings like INFINITY AND BEYOND.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

INFINITY AND BEYOND added.
with aother one test string INF.
More test cases suggestions are appreciated.

Signed-off-by: fejiang <fejiang@nvidia.com>
@sameerz sameerz added the bug Something isn't working label May 23, 2024
Copy link
Collaborator

@hyperbolic2346 hyperbolic2346 left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you for doing this work!

src/main/cpp/src/cast_string_to_float.cu Show resolved Hide resolved
src/main/cpp/src/cast_string_to_float.cu Outdated Show resolved Hide resolved
tb2.column("INFINITY ", "inf", "+inf ", " -INF ");

Table.TestBuilder tb = new Table.TestBuilder();
tb.column(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some negative tests would be nice. Some strings like INFINITY AND BEYOND.

@jlowe jlowe changed the title Fix cast_string_to_float with trailing whitesapces for inf and nan string Fix cast_string_to_float with trailing whitespaces for inf and nan string May 29, 2024
hyperbolic2346
hyperbolic2346 previously approved these changes May 29, 2024
Copy link
Collaborator

@hyperbolic2346 hyperbolic2346 left a comment

Choose a reason for hiding this comment

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

Small typo fix, but I'm happy with this. Thanks for your work here!

src/main/cpp/src/cast_string_to_float.cu Outdated Show resolved Hide resolved
@Feng-Jiang28
Copy link
Collaborator Author

Small typo fix, but I'm happy with this. Thanks for your work here!

Thank you for reviewing, appreciate it.

thirtiseven
thirtiseven previously approved these changes May 30, 2024
Copy link
Collaborator

@thirtiseven thirtiseven left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@thirtiseven
Copy link
Collaborator

build

hyperbolic2346
hyperbolic2346 previously approved these changes May 30, 2024
@Feng-Jiang28
Copy link
Collaborator Author

build

1 similar comment
@thirtiseven
Copy link
Collaborator

build

thirtiseven
thirtiseven previously approved these changes May 31, 2024
@Feng-Jiang28 Feng-Jiang28 changed the base branch from branch-24.06 to branch-24.08 May 31, 2024 08:10
@Feng-Jiang28 Feng-Jiang28 dismissed thirtiseven’s stale review May 31, 2024 08:10

The base branch was changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants