@@ -1380,45 +1380,22 @@ public void testCopyValueSafeForExtensionType() throws Exception {
13801380 }
13811381
13821382 @ Test
1383- public void testNestedEmptyListOffsetBuffer () {
1384- // Test that 3-level nested ListVector properly allocates offset buffers
1385- // even when nested writers are never invoked. According to Arrow spec,
1386- // offset buffer must have N+1 entries. Even when N=0, it should contain [0].
1387- try (ListVector level0 = ListVector .empty ("level0" , allocator )) {
1388- // Setup List<List<List<Int>>> - 3 levels
1389- level0 .addOrGetVector (FieldType .nullable (MinorType .LIST .getType ()));
1390- ListVector level1 = (ListVector ) level0 .getDataVector ();
1391- level1 .addOrGetVector (FieldType .nullable (MinorType .LIST .getType ()));
1392- ListVector level2 = (ListVector ) level1 .getDataVector ();
1393- level2 .addOrGetVector (FieldType .nullable (MinorType .INT .getType ()));
1394-
1395- // Allocate all levels - simulates case where nested levels are never written to
1396- level0 .allocateNew ();
1397- level1 .allocateNew ();
1398- level2 .allocateNew ();
1399- level0 .setValueCount (0 );
1400- level1 .setValueCount (0 );
1401- level2 .setValueCount (0 );
1402-
1403- // Verify all levels have properly allocated offset buffers
1404- List <ArrowBuf > level1Buffers = level1 .getFieldBuffers ();
1405- List <ArrowBuf > level2Buffers = level2 .getFieldBuffers ();
1406-
1407- assertTrue (
1408- level1Buffers .get (1 ).readableBytes () >= BaseRepeatedValueVector .OFFSET_WIDTH ,
1409- "Level1 offset buffer should have at least "
1410- + BaseRepeatedValueVector .OFFSET_WIDTH
1411- + " bytes for offset[0]" );
1412-
1383+ public void testEmptyListOffsetBuffer () {
1384+ // Test that ListVector has correct readableBytes after allocation.
1385+ // According to Arrow spec, offset buffer must have N+1 entries.
1386+ // Even when N=0, it should contain [0].
1387+ try (ListVector list = ListVector .empty ("list" , allocator )) {
1388+ list .addOrGetVector (FieldType .nullable (MinorType .INT .getType ()));
1389+ list .allocateNew ();
1390+ list .setValueCount (0 );
1391+
1392+ List <ArrowBuf > buffers = list .getFieldBuffers ();
14131393 assertTrue (
1414- level2Buffers .get (1 ).readableBytes () >= BaseRepeatedValueVector .OFFSET_WIDTH ,
1415- "Level2 offset buffer should have at least "
1394+ buffers .get (1 ).readableBytes () >= BaseRepeatedValueVector .OFFSET_WIDTH ,
1395+ "Offset buffer should have at least "
14161396 + BaseRepeatedValueVector .OFFSET_WIDTH
14171397 + " bytes for offset[0]" );
1418-
1419- // Verify offset[0] = 0 for all levels
1420- assertEquals (0 , level1 .getOffsetBuffer ().getInt (0 ));
1421- assertEquals (0 , level2 .getOffsetBuffer ().getInt (0 ));
1398+ assertEquals (0 , list .getOffsetBuffer ().getInt (0 ));
14221399 }
14231400 }
14241401
0 commit comments