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(
24242424 _ensure_has_gil(& gs)
24252425 raise c_err_to_py(err)
24262426
2427+ was_auto_flush = True
24272428 _dataframe_handle_auto_flush(& af, ls_buf, & gs)
2429+ was_auto_flush = False
24282430 except Exception as e:
24292431 # It would be an internal bug for this to raise.
24302432 if not line_sender_buffer_rewind_to_marker(ls_buf, & err):
24312433 raise c_err_to_py(err)
24322434
24332435 if (isinstance (e, IngressError) and
2434- (e.code == IngressErrorCode.InvalidApiCall)):
2436+ (e.code == IngressErrorCode.InvalidApiCall) and not was_auto_flush ):
24352437 # TODO: This should be allowed by the database.
24362438 # It currently isn't so we have to raise an error.
24372439 raise IngressError(
Original file line number Diff line number Diff line change @@ -1523,6 +1523,18 @@ def test_serializing_in_chunks(self):
15231523 for i in range (index * 10 , (index + 1 ) * 10 ))
15241524 self .assertEqual (buf , exp .encode ("utf-8" ))
15251525
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+
15261538 def test_arrow_chunked_array (self ):
15271539 # We build a table with chunked arrow arrays as columns.
15281540 chunks_a = [
You can’t perform that action at this time.
0 commit comments