File tree Expand file tree Collapse file tree
vector/src/test/java/org/apache/arrow/vector Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -560,6 +560,40 @@ public void testSetSafeEmptyValueAtViewBufferBoundary(
560560 }
561561 }
562562
563+ @ ParameterizedTest
564+ @ MethodSource ({"vectorCreatorProvider" })
565+ public void testSetValueCountFillsEmptiesAtViewBufferBoundary (
566+ Function <BufferAllocator , BaseVariableWidthViewVector > vectorCreator ) {
567+ try (final BaseVariableWidthViewVector vector = vectorCreator .apply (allocator )) {
568+ vector .allocateNew ();
569+ final int valueCapacity = vector .getValueCapacity ();
570+
571+ vector .setSafe (valueCapacity - 1 , "x" .getBytes (StandardCharsets .UTF_8 ));
572+ vector .setValueCount (valueCapacity + 1 );
573+
574+ assertTrue (vector .getValueCapacity () > valueCapacity );
575+ assertTrue (vector .isNull (valueCapacity ));
576+ }
577+ }
578+
579+ @ ParameterizedTest
580+ @ MethodSource ({"vectorCreatorProvider" })
581+ public void testSetNullAtViewBufferBoundary (
582+ Function <BufferAllocator , BaseVariableWidthViewVector > vectorCreator ) {
583+ try (final BaseVariableWidthViewVector vector = vectorCreator .apply (allocator )) {
584+ vector .allocateNew ();
585+ final int valueCapacity = vector .getValueCapacity ();
586+
587+ for (int i = 0 ; i <= valueCapacity ; i ++) {
588+ vector .setNull (i );
589+ }
590+ vector .setValueCount (valueCapacity + 1 );
591+
592+ assertTrue (vector .getValueCapacity () > valueCapacity );
593+ assertTrue (vector .isNull (valueCapacity ));
594+ }
595+ }
596+
563597 @ Test
564598 public void testNullableVarType1 () {
565599
You can’t perform that action at this time.
0 commit comments