Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Dec 12, 2024
1 parent d9b0a10 commit b5ccce2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
8 changes: 6 additions & 2 deletions pandas_gbq/schema/pyarrow_to_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ def arrow_type_to_bigquery_field(
return None


def arrow_list_type_to_bigquery(name, type_, default_type="STRING") -> Optional[schema.SchemaField]:
inner_field = arrow_type_to_bigquery_field(name, type_.value_type, default_type=default_type)
def arrow_list_type_to_bigquery(
name, type_, default_type="STRING"
) -> Optional[schema.SchemaField]:
inner_field = arrow_type_to_bigquery_field(
name, type_.value_type, default_type=default_type
)
if inner_field is None:
return None

Expand Down
18 changes: 8 additions & 10 deletions tests/unit/schema/test_pyarrow_to_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ def test_arrow_type_to_bigquery_field_scalar_types(pyarrow_type, bigquery_type):


def test_arrow_type_to_bigquery_field_unknown():
assert (
pyarrow_to_bigquery.arrow_type_to_bigquery_field("test_name", pyarrow.null(), default_type="DEFAULT_TYPE")
== bigquery.SchemaField("test_name", "DEFAULT_TYPE")
)
assert pyarrow_to_bigquery.arrow_type_to_bigquery_field(
"test_name", pyarrow.null(), default_type="DEFAULT_TYPE"
) == bigquery.SchemaField("test_name", "DEFAULT_TYPE")


def test_arrow_type_to_bigquery_field_list_of_unknown():
assert (
pyarrow_to_bigquery.arrow_type_to_bigquery_field(
"test_name", pyarrow.list_(pyarrow.null()), default_type="DEFAULT_TYPE",
)
== bigquery.SchemaField("test_name", "DEFAULT_TYPE", mode="REPEATED")
)
assert pyarrow_to_bigquery.arrow_type_to_bigquery_field(
"test_name",
pyarrow.list_(pyarrow.null()),
default_type="DEFAULT_TYPE",
) == bigquery.SchemaField("test_name", "DEFAULT_TYPE", mode="REPEATED")

0 comments on commit b5ccce2

Please sign in to comment.