diff --git a/src/main/java/com/nvidia/spark/rapids/jni/CastStrings.java b/src/main/java/com/nvidia/spark/rapids/jni/CastStrings.java index 5df44c77c1..d3a239066b 100644 --- a/src/main/java/com/nvidia/spark/rapids/jni/CastStrings.java +++ b/src/main/java/com/nvidia/spark/rapids/jni/CastStrings.java @@ -109,6 +109,21 @@ public static ColumnVector toIntegersWithBase(ColumnView cv, int base, type.getTypeId().getNativeId())); } + /** + * Converts an integer column to a strings column with either decimal or hexadecimal values + * based on the base provided. The hexadecimal value will be returned with the leading + * zeros dropped + * Example: + * input = [123, -1, 0, 27, 342718233] + * s = fromIntegersWithBase(input, 16) + * s is [ '4D2', '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 either 10 or 16 + * @return a new String ColumnVector + */ public static ColumnVector fromIntegersWithBase(ColumnView cv, int base) { return new ColumnVector(fromIntegersWithBase(cv.getNativeView(), base)); }