diff --git a/java/src/main/java/ai/rapids/cudf/ColumnView.java b/java/src/main/java/ai/rapids/cudf/ColumnView.java index e0cc96263b3..2df89177d5f 100644 --- a/java/src/main/java/ai/rapids/cudf/ColumnView.java +++ b/java/src/main/java/ai/rapids/cudf/ColumnView.java @@ -1394,9 +1394,11 @@ public ColumnView replaceChildrenWithViews(int[] indices, List 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 { + assert (child.getRowCount() == view.getRowCount()); newChildren.add(view); } }); @@ -1431,7 +1433,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}); } /** diff --git a/java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java b/java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java index 0675ece4863..554a1fd0629 100644 --- a/java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java +++ b/java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java @@ -4005,7 +4005,7 @@ void testReplaceLeafNodeInList() { @Test void testReplaceLeafNodeInListWithIllegal() { - assertThrows(IllegalArgumentException.class, () -> { + assertThrows(AssertionError.class, () -> { try (ColumnVector child1 = ColumnVector.decimalFromDoubles(DType.create(DType.DTypeEnum.DECIMAL64, 3), RoundingMode.HALF_UP, 770.892, 961.110);