@@ -252,6 +252,42 @@ public void testAppendShortLongVariableWidthViewVector() {
252252 }
253253 }
254254
255+ @ Test
256+ public void testAppendLongVariableWidthViewVector () {
257+ try (ViewVarCharVector target = new ViewVarCharVector ("" , allocator );
258+ ViewVarCharVector delta = new ViewVarCharVector ("" , allocator )) {
259+
260+ String [] targetValues = randomLongViewVarCharVector (target );
261+ String [] deltaValues = randomLongViewVarCharVector (delta );
262+
263+ VectorAppender appender = new VectorAppender (target );
264+ delta .accept (appender , null );
265+
266+ assertEquals (4 , target .getDataBuffers ().size ());
267+ try (ViewVarCharVector expected = new ViewVarCharVector ("expected" , allocator )) {
268+ ValueVectorDataPopulator .setVector (
269+ expected ,
270+ Stream .concat (Arrays .stream (targetValues ), Arrays .stream (deltaValues ))
271+ .toArray (String []::new ));
272+ assertVectorsEqual (expected , target );
273+ }
274+ }
275+ }
276+
277+ private static String [] randomLongViewVarCharVector (ViewVarCharVector target ) {
278+ assertEquals (0 , target .getDataBuffers ().size ());
279+ int initial = 64 ;
280+ int stringCount = 128 ;
281+ target .setInitialCapacity (initial );
282+ String [] targetValues =
283+ IntStream .range (0 , stringCount )
284+ .mapToObj (i -> TestUtils .generateRandomString (BaseVariableWidthViewVector .ELEMENT_SIZE ))
285+ .toArray (String []::new );
286+ ValueVectorDataPopulator .setVector (target , targetValues );
287+ assertEquals (2 , target .getDataBuffers ().size ());
288+ return targetValues ;
289+ }
290+
255291 @ Test
256292 public void testAppendEmptyVariableWidthVector () {
257293 try (VarCharVector target = new VarCharVector ("" , allocator );
0 commit comments