Skip to content

Commit

Permalink
Added javadocs to CastStrings.fromIntegersWithBase method [skip ci] (N…
Browse files Browse the repository at this point in the history
…VIDIA#1452)

* added javadocs

* Signing off

Signed-off-by: Raza Jafri <rjafri@nvidia.com>

* addressed review comments

* addressed review concern

* fixed the docs with the correct hex value

---------

Signed-off-by: Raza Jafri <rjafri@nvidia.com>
  • Loading branch information
razajafri authored Sep 28, 2023
1 parent f32fe74 commit d0d058e
Showing 1 changed file with 18 additions and 0 deletions.
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 [ '7B', 'FFFFFFFF', '0', '1B', '146D7719']
* 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 (currently only 10/16)
* @return a new String ColumnVector
*/
public static ColumnVector fromIntegersWithBase(ColumnView cv, int base) {
return new ColumnVector(fromIntegersWithBase(cv.getNativeView(), base));
}
Expand Down

0 comments on commit d0d058e

Please sign in to comment.