@@ -257,8 +257,10 @@ impl<O: IntegerPType> ColumnExporter for ListVectorExporter<O> {
257257#[ cfg( test) ]
258258mod tests {
259259 use vortex:: array:: IntoArray as _;
260+ use vortex:: array:: arrays:: VarBinArray ;
260261 use vortex:: array:: validity:: Validity ;
261262 use vortex:: buffer:: Buffer ;
263+ use vortex:: buffer:: buffer;
262264 use vortex:: error:: VortexUnwrap ;
263265
264266 use super :: * ;
@@ -291,6 +293,40 @@ mod tests {
291293 format!( "{}" , String :: try_from( & chunk) . unwrap( ) ) ,
292294 r#"Chunk - [1 Columns]
293295- FLAT INTEGER[]: 0 = [ ]
296+ "#
297+ ) ;
298+ }
299+
300+ #[ test]
301+ fn test_export_non_empty_list_of_strings ( ) {
302+ let list = unsafe {
303+ ListArray :: new_unchecked (
304+ <VarBinArray as FromIterator < _ > >:: from_iter ( [
305+ Some ( "abc" ) ,
306+ Some ( "def" ) ,
307+ None ,
308+ Some ( "ghi" ) ,
309+ ] )
310+ . into_array ( ) ,
311+ buffer ! [ 0u8 , 1 , 2 , 3 , 4 ] . into_array ( ) ,
312+ Validity :: from_iter ( [ true , true , false , true ] ) ,
313+ )
314+ }
315+ . into_array ( ) ;
316+
317+ let list_type = LogicalType :: list_type ( LogicalType :: varchar ( ) ) . vortex_unwrap ( ) ;
318+ let mut chunk = DataChunk :: new ( [ list_type] ) ;
319+
320+ new_array_exporter ( & list, & ConversionCache :: default ( ) )
321+ . unwrap ( )
322+ . export ( 0 , 4 , & mut chunk. get_vector ( 0 ) )
323+ . unwrap ( ) ;
324+ chunk. set_len ( 4 ) ;
325+
326+ assert_eq ! (
327+ format!( "{}" , String :: try_from( & chunk) . unwrap( ) ) ,
328+ r#"Chunk - [1 Columns]
329+ - FLAT VARCHAR[]: 4 = [ [abc], [def], NULL, [ghi]]
294330"#
295331 ) ;
296332 }
0 commit comments