Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigQuery: cast to dt.binary results in invalid datatype in compiled SQL #2354

Closed
tswast opened this issue Sep 3, 2020 · 0 comments · Fixed by #2597
Closed

BigQuery: cast to dt.binary results in invalid datatype in compiled SQL #2354

tswast opened this issue Sep 3, 2020 · 0 comments · Fixed by #2597
Labels
bug Incorrect behavior inside of ibis
Milestone

Comments

@tswast
Copy link
Collaborator

tswast commented Sep 3, 2020

It appears that casting to ibis.expr.datatypes.binary results in BINARY as the data type. The correct name for this data type in BigQuery is BYTES

Code example

import ibis.bigquery
import ibis.expr.datatypes as dt

bigquery_client = ibis.bigquery.connect()
tbl = bigquery_client.table(
    "citibike_trips",
    database="bigquery-public-data.new_york_citibike"
)
expr = tbl[
    tbl["start_station_name"]
    .cast(dt.binary)
    .name("station_hash")
]
sql = expr.compile()
print(sql)

Output

SELECT CAST(`start_station_name` AS BINARY) AS `station_hash`
FROM `bigquery-public-data.new_york_citibike.citibike_trips`

This results in a Type not found: BINARY at [1:48] error when you paste this query in the BigQuery UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants