File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
crates/duckdb/src/appender Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -80,4 +80,24 @@ mod test {
8080 assert_eq ! ( rbs. iter( ) . map( |op| op. num_rows( ) ) . sum:: <usize >( ) , 5 ) ;
8181 Ok ( ( ) )
8282 }
83+
84+ #[ test]
85+ fn test_append_record_batch_large ( ) -> Result < ( ) > {
86+ let record_count = usize:: pow ( 2 , 16 ) + 1 ;
87+ let db = Connection :: open_in_memory ( ) ?;
88+ db. execute_batch ( "CREATE TABLE foo(id INT)" ) ?;
89+ {
90+ let id_array = Int32Array :: from ( vec ! [ 42 ; record_count] ) ;
91+ let schema = Schema :: new ( vec ! [ Field :: new( "id" , DataType :: Int32 , true ) ] ) ;
92+ let record_batch = RecordBatch :: try_new ( Arc :: new ( schema) , vec ! [ Arc :: new( id_array) ] ) . unwrap ( ) ;
93+ let mut app = db. appender ( "foo" ) ?;
94+ app. append_record_batch ( record_batch) ?;
95+ }
96+ let count = db. query_row ( "SELECT COUNT(*) FROM foo" , [ ] , |row| {
97+ let count: usize = row. get ( 0 ) ?;
98+ Ok ( count)
99+ } ) ?;
100+ assert_eq ! ( count, record_count) ;
101+ Ok ( ( ) )
102+ }
83103}
You can’t perform that action at this time.
0 commit comments