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

Decimal32 Build Fix [skip ci] #7544

Merged
merged 22 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions java/src/main/java/ai/rapids/cudf/ColumnView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1394,9 +1394,13 @@ public ColumnView replaceChildrenWithViews(int[] indices,
List<ColumnView> newChildren = new ArrayList<>(getNumChildren());
IntStream.range(0, getNumChildren()).forEach(i -> {
ColumnView view = map.remove(i);
ColumnView child = getChildColumnView(i);
if (view == null) {
newChildren.add(getChildColumnView(i));
newChildren.add(child);
} else {
if (child.getRowCount() != view.getRowCount()) {
throw new IllegalArgumentException("Child row count doesn't match the old child");
}
newChildren.add(view);
}
});
Expand Down Expand Up @@ -1431,7 +1435,7 @@ public ColumnView replaceChildrenWithViews(int[] indices,
*/
public ColumnView replaceListChild(ColumnView child) {
assert(type == DType.LIST);
return replaceChildrenWithViews(new int[]{1}, new ColumnView[]{child});
return replaceChildrenWithViews(new int[]{0}, new ColumnView[]{child});
}

/**
Expand Down
9 changes: 6 additions & 3 deletions java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4005,7 +4005,7 @@ void testReplaceLeafNodeInList() {

@Test
void testReplaceLeafNodeInListWithIllegal() {
assertThrows(IllegalArgumentException.class, () -> {
Exception e = assertThrows(IllegalArgumentException.class, () -> {
try (ColumnVector child1 =
ColumnVector.decimalFromDoubles(DType.create(DType.DTypeEnum.DECIMAL64, 3),
RoundingMode.HALF_UP, 770.892, 961.110);
Expand All @@ -4023,6 +4023,7 @@ void testReplaceLeafNodeInListWithIllegal() {
ColumnView replacedView = created.replaceListChild(newChild)) {
}
});
assertTrue(e.getMessage().contains("Child row count doesn't match the old child"));
}

@Test
Expand All @@ -4049,7 +4050,7 @@ void testReplaceColumnInStruct() {

@Test
void testReplaceIllegalIndexColumnInStruct() {
assertThrows(IllegalArgumentException.class, () -> {
Exception e = assertThrows(IllegalArgumentException.class, () -> {
try (ColumnVector child1 = ColumnVector.fromInts(1, 4);
ColumnVector child2 = ColumnVector.fromInts(2, 5);
ColumnVector child3 = ColumnVector.fromInts(3, 6);
Expand All @@ -4059,11 +4060,12 @@ void testReplaceIllegalIndexColumnInStruct() {
new ColumnVector[]{replaceWith})) {
}
});
assertTrue(e.getMessage().contains("One or more invalid child indices passed to be replaced"));
}

@Test
void testReplaceSameIndexColumnInStruct() {
assertThrows(IllegalArgumentException.class, () -> {
Exception e = assertThrows(IllegalArgumentException.class, () -> {
try (ColumnVector child1 = ColumnVector.fromInts(1, 4);
ColumnVector child2 = ColumnVector.fromInts(2, 5);
ColumnVector child3 = ColumnVector.fromInts(3, 6);
Expand All @@ -4073,5 +4075,6 @@ void testReplaceSameIndexColumnInStruct() {
new ColumnVector[]{replaceWith, replaceWith})) {
}
});
assertTrue(e.getMessage().contains("Duplicate mapping found for replacing child index"));
}
}