File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -682,6 +682,17 @@ def ibis_type_from_python_type(t: type) -> ibis_dtypes.DataType:
682
682
683
683
684
684
def ibis_type_from_type_kind (tk : bigquery .StandardSqlTypeNames ) -> ibis_dtypes .DataType :
685
+ """Convert bq type to ibis. Only to be used for remote functions, does not handle all types."""
685
686
if tk not in SUPPORTED_IO_BIGQUERY_TYPEKINDS :
686
687
raise UnsupportedTypeError (tk , SUPPORTED_IO_BIGQUERY_TYPEKINDS )
687
688
return third_party_ibis_bqtypes .BigQueryType .to_ibis (tk )
689
+
690
+
691
+ def bf_type_from_type_kind (bf_schema ) -> Dict [str , Dtype ]:
692
+ """Converts bigquery sql type to the default bigframes dtype."""
693
+ ibis_schema : ibis .Schema = third_party_ibis_bqtypes .BigQuerySchema .to_ibis (
694
+ bf_schema
695
+ )
696
+ return {
697
+ name : ibis_dtype_to_bigframes_dtype (type ) for name , type in ibis_schema .items ()
698
+ }
Original file line number Diff line number Diff line change @@ -1889,8 +1889,10 @@ def _get_table_size(self, destination_table):
1889
1889
def _rows_to_dataframe (
1890
1890
self , row_iterator : bigquery .table .RowIterator , dtypes : Dict
1891
1891
) -> pandas .DataFrame :
1892
+ # Can ignore inferred datatype until dtype emulation breaks 1:1 mapping between BQ types and bigframes types
1893
+ dtypes_from_bq = bigframes .dtypes .bf_type_from_type_kind (row_iterator .schema )
1892
1894
arrow_table = row_iterator .to_arrow ()
1893
- return bigframes .session ._io .pandas .arrow_to_pandas (arrow_table , dtypes )
1895
+ return bigframes .session ._io .pandas .arrow_to_pandas (arrow_table , dtypes_from_bq )
1894
1896
1895
1897
def _start_generic_job (self , job : formatting_helpers .GenericJob ):
1896
1898
if bigframes .options .display .progress_bar is not None :
You can’t perform that action at this time.
0 commit comments