[ 
https://issues.apache.org/jira/browse/AIRFLOW-2573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16505038#comment-16505038
 ] 

ASF subversion and git services commented on AIRFLOW-2573:
----------------------------------------------------------

Commit f51db193c37a7caadae56885bd0bca5045e33711 in incubator-airflow's branch 
refs/heads/master from [~whynick1]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-airflow.git;h=f51db19 ]

[AIRFLOW-2573] Cast BigQuery TIMESTAMP field to float


> Cast TIMESTAMP field to float rather than int
> ---------------------------------------------
>
>                 Key: AIRFLOW-2573
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2573
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Hongyi Wang
>            Assignee: Hongyi Wang
>            Priority: Blocker
>             Fix For: 2.0.0
>
>
> In current bigquery_hook.py, we have a `_bq_cast(string_field, bq_type)` 
> function that help casts a BigQuery row to the appropriate data types. 
> {quote}elif bq_type == 'INTEGER' or bq_type == 'TIMESTAMP':
>     return int(string_field)
> {quote}
> However, when a bq_type equals to 'TIMESTAMP', it causes ValueError.
> {quote}>>> int('1.458668898E9')
> ValueError: invalid literal for int() with base 10: '1.458668898E9'
> {quote}
> Because 'TIMESTAMP' in bigquery is stored as double in python, thus should be 
> cast to float instead.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to