简体   繁体   中英

BigQuery: "Cannot read field of type NUMERIC as INT64 Field" for part of table data

I was trying to update BQ table schema by performing:

CREATE TABLE {TABLE_WITH_NEW_SCHEMA} ... AS SELECT ... FROM {TABLE_WITH_OLD_SCHEMA}

While doing that I am receiving error:

Cannot read field of type NUMERIC as INT64 Field {field_name}

While inspecting schema current type of field is INTEGER . I tried to extract data with select for multiple timespans from table and it seems like only part of data is affected by this issue - queries with particular start_date / end_date are returning data, and some are raising mentioned exception.

I tried to export data to GC Bucket, but job fails with same error.

Question: Is there a ways to fix table schema/error or at least extract data from table into new table so reason of this error is fixed?

UPDATE

I already tried @ammar-tech suggestion to cast data:

SELECT CAST({field_name} AS INT64) ... FROM {TABLE_NAME}

and I am getting same error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM