@@ -746,4 +746,38 @@ private void testDecimalConvertToDecimalInNullStripe() throws Exception {
746746 readDecimalInNullStripe ("decimal(18,2)" , DecimalColumnVector .class ,
747747 new String []{"null" , "1024" , "1" });
748748 }
749+
750+ @ Test
751+ public void testIntArrayToStringArrayFirstBatchAllEmpty () throws Exception {
752+ TypeDescription fileSchema = TypeDescription .fromString ("struct<col1:array<int>>" );
753+ TypeDescription readerSchema = TypeDescription .fromString ("struct<col1:array<string>>" );
754+
755+ try (Writer w = OrcFile .createWriter (testFilePath ,
756+ OrcFile .writerOptions (conf ).setSchema (fileSchema ))) {
757+ VectorizedRowBatch b = fileSchema .createRowBatch (3 );
758+ ListColumnVector lc = (ListColumnVector ) b .cols [0 ];
759+ for (int i = 0 ; i < 3 ; i ++) {
760+ lc .offsets [i ] = 0 ;
761+ lc .lengths [i ] = 0 ;
762+ }
763+ lc .childCount = 0 ;
764+ b .size = 3 ;
765+ w .addRowBatch (b );
766+ }
767+
768+ try (Reader reader = OrcFile .createReader (testFilePath , OrcFile .readerOptions (conf ));
769+ RecordReader rows = reader .rows (reader .options ().schema (readerSchema ))) {
770+ VectorizedRowBatch rb = readerSchema .createRowBatch (3 );
771+ assertTrue (rows .nextBatch (rb ));
772+ ListColumnVector r = (ListColumnVector ) rb .cols [0 ];
773+ // Cast verifies schema evolution took effect (would be LongColumnVector without evolution)
774+ BytesColumnVector child = (BytesColumnVector ) r .child ;
775+ assertEquals (0 , r .childCount );
776+ for (int i = 0 ; i < 3 ; i ++) {
777+ assertEquals (0 , r .lengths [i ], "row " + i + " should be empty array" );
778+ }
779+ } finally {
780+ fs .delete (testFilePath , false );
781+ }
782+ }
749783}
0 commit comments