Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/branch-22.04' into opt_col_builder
Browse files Browse the repository at this point in the history
  • Loading branch information
sperlingxx committed Jan 24, 2022
2 parents 41d8e98 + fd968f3 commit aa0d151
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions java/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ nvidia-docker run -it cudf-build:11.5.0-devel-centos7 bash
You can download the cuDF repo in the docker container or you can mount it into the container.
Here I choose to download again in the container.
```bash
git clone --recursive https://github.com/rapidsai/cudf.git -b branch-22.02
git clone --recursive https://github.com/rapidsai/cudf.git -b branch-22.04
```

### Build cuDF jar with devtoolset
Expand All @@ -47,5 +47,5 @@ scl enable devtoolset-9 "java/ci/build-in-docker.sh"

### The output

You can find the cuDF jar in java/target/ like cudf-22.02.0-SNAPSHOT-cuda11.jar.
You can find the cuDF jar in java/target/ like cudf-22.04.0-SNAPSHOT-cuda11.jar.

2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<groupId>ai.rapids</groupId>
<artifactId>cudf</artifactId>
<version>22.02.0-SNAPSHOT</version>
<version>22.04.0-SNAPSHOT</version>

<name>cudfjni</name>
<description>
Expand Down
15 changes: 10 additions & 5 deletions java/src/main/java/ai/rapids/cudf/HostColumnVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,8 @@ private void appendChildOrNull(ColumnBuilder childBuilder, Object listElement) {
childBuilder.append((Short) listElement);
} else if (listElement instanceof BigDecimal) {
childBuilder.append((BigDecimal) listElement);
} else if (listElement instanceof BigInteger) {
childBuilder.append((BigInteger) listElement);
} else if (listElement instanceof List) {
childBuilder.append((List<?>) listElement);
} else if (listElement instanceof StructData) {
Expand Down Expand Up @@ -1296,17 +1298,20 @@ public final ColumnBuilder append(boolean value) {
return this;
}

public final ColumnBuilder append(BigDecimal value) {
growFixedWidthBuffersAndRows();
public ColumnBuilder append(BigDecimal value) {
return append(value.setScale(-type.getScale(), RoundingMode.UNNECESSARY).unscaledValue());
}

public ColumnBuilder append(BigInteger unscaledVal) {
growBuffersAndRows(false, currentIndex * type.getSizeInBytes() + type.getSizeInBytes());
assert currentIndex < rows;
// Rescale input decimal with UNNECESSARY policy, which accepts no precision loss.
BigInteger unscaledVal = value.setScale(-type.getScale(), RoundingMode.UNNECESSARY).unscaledValue();
if (type.typeId == DType.DTypeEnum.DECIMAL32) {
data.setInt(currentIndex++ << bitShiftBySize, unscaledVal.intValueExact());
} else if (type.typeId == DType.DTypeEnum.DECIMAL64) {
data.setLong(currentIndex++ << bitShiftBySize, unscaledVal.longValueExact());
} else if (type.typeId == DType.DTypeEnum.DECIMAL128) {
byte[] unscaledValueBytes = value.unscaledValue().toByteArray();
assert currentIndex < rows;
byte[] unscaledValueBytes = unscaledVal.toByteArray();
byte[] result = convertDecimal128FromJavaToCudf(unscaledValueBytes);
data.setBytes(currentIndex++ << bitShiftBySize, result, 0, result.length);
} else {
Expand Down

0 comments on commit aa0d151

Please sign in to comment.