-
Notifications
You must be signed in to change notification settings - Fork 915
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 JNI for strings::code_points #14533
Merged
rapids-bot
merged 5 commits into
rapidsai:branch-24.02
from
thirtiseven:code_points_jni
Dec 12, 2023
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1413851
Add code_points jni
thirtiseven 981510b
Update java/src/main/native/src/ColumnViewJni.cpp
thirtiseven 00e965d
Merge branch 'rapidsai:branch-24.02' into code_points_jni
thirtiseven fa0bb0b
Merge branch 'branch-24.02' into code_points_jni
res-life 378b5d1
format
thirtiseven File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API seems very problematic in light of the effort to move to large strings. A strings column will soon support more than 2^31 characters. Calling this API on such a column will crash since it cannot manifest an INT32 column with more than 2^31 entries.
It also seems problematic from a usability point of view. Since it returns only a column of INT32 instead of LIST(INT32), it's not straightforward to figure out where the code points of one string stops and another starts. We can't use the offset column of the original string, since that's byte offsets instead of character offsets. I guess one would need to get the character lengths of the original string (converting nulls to zereoes) and then do a prefix scan to compute the code point offsets to know where one string's codepoints are in the result.
It also seems very wasteful for what NVIDIA/spark-rapids#9585 needs if called directly, since it will explode the memory of many string columns by 4X. We should first slice the original string column to only select the first character of each string. That would work around the large strings issue, the "where does a string start" issue, as well as the waste, since we only need the codepoint of the first character for that Spark feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review and analysis! I'm trying the 'only select the first character' way in the plugin.
Another problem with the spark issue is that the results of Latin-1 Supplement chars are mismatched between spark and
code_points
. For example é is 50089 forcode_points
and utf-8, and 233 for spark and Unicode (and Latin-1 and utf-16?), I'm trying to work around it but it is possible that we need a custom kernel forascii
.