File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -2424,14 +2424,16 @@ cdef void_int _dataframe(
2424
2424
_ensure_has_gil(& gs)
2425
2425
raise c_err_to_py(err)
2426
2426
2427
+ was_auto_flush = True
2427
2428
_dataframe_handle_auto_flush(& af, ls_buf, & gs)
2429
+ was_auto_flush = False
2428
2430
except Exception as e:
2429
2431
# It would be an internal bug for this to raise.
2430
2432
if not line_sender_buffer_rewind_to_marker(ls_buf, & err):
2431
2433
raise c_err_to_py(err)
2432
2434
2433
2435
if (isinstance (e, IngressError) and
2434
- (e.code == IngressErrorCode.InvalidApiCall)):
2436
+ (e.code == IngressErrorCode.InvalidApiCall) and not was_auto_flush ):
2435
2437
# TODO: This should be allowed by the database.
2436
2438
# It currently isn't so we have to raise an error.
2437
2439
raise IngressError(
Original file line number Diff line number Diff line change @@ -1523,6 +1523,18 @@ def test_serializing_in_chunks(self):
1523
1523
for i in range (index * 10 , (index + 1 ) * 10 ))
1524
1524
self .assertEqual (buf , exp .encode ("utf-8" ))
1525
1525
1526
+ def test_auto_flush_error_msg (self ):
1527
+ header = ["x" , "y" ]
1528
+ x = list (range (10000 ))
1529
+ y = list (range (10000 ))
1530
+
1531
+ df = pd .DataFrame (zip (x , y ), columns = header )
1532
+
1533
+ with self .assertRaisesRegex (qi .IngressError , 'Could not flush buffer: Buffer size of 21780 exceeds maximum configured allowed size of 1024 bytes' ):
1534
+ with qi .Sender .from_conf ("http::addr=localhost:9000;auto_flush_rows=1000;max_buf_size=1024;protocol_version=2;" ) as sender :
1535
+ sender .dataframe (df , table_name = 'test_df' , at = qi .ServerTimestamp )
1536
+ sender .flush ()
1537
+
1526
1538
def test_arrow_chunked_array (self ):
1527
1539
# We build a table with chunked arrow arrays as columns.
1528
1540
chunks_a = [
You can’t perform that action at this time.
0 commit comments