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

Added javadocs to CastStrings.fromIntegersWithBase method [skip ci] #1452

Merged
merged 5 commits into from
Sep 28, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/main/java/com/nvidia/spark/rapids/jni/CastStrings.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ public static ColumnVector toIntegersWithBase(ColumnView cv, int base,
type.getTypeId().getNativeId()));
}

/**
* Converts an integer column to a string column by converting the underlying integers to the
* specified base.
*
* Note: Right now we only support base 10 and 16. The hexadecimal values will be
* returned without leading zeros or padding at the end
*
* Example:
* input = [123, -1, 0, 27, 342718233]
* s = fromIntegersWithBase(input, 16)
* s is [ '4D2', 'FFFFFFFF', '0', '1B', '146D7719']
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this accurate? 123 should map to "7B"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, you are right. I copied this from cudf doc here.

I have created a ticket in cudf rapidsai/cudf#14232

* s = fromIntegersWithBase(input, 10)
* s is ['123', '-1', '0', '27', '342718233']
*
* @param cv The input integer column to be converted.
* @param base base that we want to convert to either 10 or 16
* @return a new String ColumnVector
*/
public static ColumnVector fromIntegersWithBase(ColumnView cv, int base) {
return new ColumnVector(fromIntegersWithBase(cv.getNativeView(), base));
}
Expand Down