@@ -1837,6 +1837,7 @@ def to_arrow_iterable(
18371837 self ,
18381838 bqstorage_client : Optional ["bigquery_storage.BigQueryReadClient" ] = None ,
18391839 max_queue_size : int = _pandas_helpers ._MAX_QUEUE_SIZE_DEFAULT , # type: ignore
1840+ max_stream_count : Optional [int ] = None ,
18401841 ) -> Iterator ["pyarrow.RecordBatch" ]:
18411842 """[Beta] Create an iterable of class:`pyarrow.RecordBatch`, to process the table as a stream.
18421843
@@ -1861,6 +1862,22 @@ def to_arrow_iterable(
18611862 created by the server. If ``max_queue_size`` is :data:`None`, the queue
18621863 size is infinite.
18631864
1865+ max_stream_count (Optional[int]):
1866+ The maximum number of parallel download streams when
1867+ using BigQuery Storage API. Ignored if
1868+ BigQuery Storage API is not used.
1869+
1870+ This setting also has no effect if the query result
1871+ is deterministically ordered with ORDER BY,
1872+ in which case, the number of download stream is always 1.
1873+
1874+ If set to 0 or None (the default), the number of download
1875+ streams is determined by BigQuery the server. However, this behaviour
1876+ can require a lot of memory to store temporary download result,
1877+ especially with very large queries. In that case,
1878+ setting this parameter value to a value > 0 can help
1879+ reduce system resource consumption.
1880+
18641881 Returns:
18651882 pyarrow.RecordBatch:
18661883 A generator of :class:`~pyarrow.RecordBatch`.
@@ -1877,6 +1894,7 @@ def to_arrow_iterable(
18771894 preserve_order = self ._preserve_order ,
18781895 selected_fields = self ._selected_fields ,
18791896 max_queue_size = max_queue_size ,
1897+ max_stream_count = max_stream_count ,
18801898 )
18811899 tabledata_list_download = functools .partial (
18821900 _pandas_helpers .download_arrow_row_iterator , iter (self .pages ), self .schema
@@ -2003,6 +2021,7 @@ def to_dataframe_iterable(
20032021 bqstorage_client : Optional ["bigquery_storage.BigQueryReadClient" ] = None ,
20042022 dtypes : Optional [Dict [str , Any ]] = None ,
20052023 max_queue_size : int = _pandas_helpers ._MAX_QUEUE_SIZE_DEFAULT , # type: ignore
2024+ max_stream_count : Optional [int ] = None ,
20062025 ) -> "pandas.DataFrame" :
20072026 """Create an iterable of pandas DataFrames, to process the table as a stream.
20082027
@@ -2033,6 +2052,22 @@ def to_dataframe_iterable(
20332052
20342053 .. versionadded:: 2.14.0
20352054
2055+ max_stream_count (Optional[int]):
2056+ The maximum number of parallel download streams when
2057+ using BigQuery Storage API. Ignored if
2058+ BigQuery Storage API is not used.
2059+
2060+ This setting also has no effect if the query result
2061+ is deterministically ordered with ORDER BY,
2062+ in which case, the number of download stream is always 1.
2063+
2064+ If set to 0 or None (the default), the number of download
2065+ streams is determined by BigQuery the server. However, this behaviour
2066+ can require a lot of memory to store temporary download result,
2067+ especially with very large queries. In that case,
2068+ setting this parameter value to a value > 0 can help
2069+ reduce system resource consumption.
2070+
20362071 Returns:
20372072 pandas.DataFrame:
20382073 A generator of :class:`~pandas.DataFrame`.
@@ -2059,6 +2094,7 @@ def to_dataframe_iterable(
20592094 preserve_order = self ._preserve_order ,
20602095 selected_fields = self ._selected_fields ,
20612096 max_queue_size = max_queue_size ,
2097+ max_stream_count = max_stream_count ,
20622098 )
20632099 tabledata_list_download = functools .partial (
20642100 _pandas_helpers .download_dataframe_row_iterator ,
@@ -2715,6 +2751,7 @@ def to_dataframe_iterable(
27152751 bqstorage_client : Optional ["bigquery_storage.BigQueryReadClient" ] = None ,
27162752 dtypes : Optional [Dict [str , Any ]] = None ,
27172753 max_queue_size : Optional [int ] = None ,
2754+ max_stream_count : Optional [int ] = None ,
27182755 ) -> Iterator ["pandas.DataFrame" ]:
27192756 """Create an iterable of pandas DataFrames, to process the table as a stream.
27202757
@@ -2730,6 +2767,9 @@ def to_dataframe_iterable(
27302767 max_queue_size:
27312768 Ignored. Added for compatibility with RowIterator.
27322769
2770+ max_stream_count:
2771+ Ignored. Added for compatibility with RowIterator.
2772+
27332773 Returns:
27342774 An iterator yielding a single empty :class:`~pandas.DataFrame`.
27352775
@@ -2744,6 +2784,7 @@ def to_arrow_iterable(
27442784 self ,
27452785 bqstorage_client : Optional ["bigquery_storage.BigQueryReadClient" ] = None ,
27462786 max_queue_size : Optional [int ] = None ,
2787+ max_stream_count : Optional [int ] = None ,
27472788 ) -> Iterator ["pyarrow.RecordBatch" ]:
27482789 """Create an iterable of pandas DataFrames, to process the table as a stream.
27492790
@@ -2756,6 +2797,9 @@ def to_arrow_iterable(
27562797 max_queue_size:
27572798 Ignored. Added for compatibility with RowIterator.
27582799
2800+ max_stream_count:
2801+ Ignored. Added for compatibility with RowIterator.
2802+
27592803 Returns:
27602804 An iterator yielding a single empty :class:`~pyarrow.RecordBatch`.
27612805 """
0 commit comments