You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/08/17 21:43:16 UTC
[GitHub] tswast commented on a change in pull request #2306: [AIRFLOW-1214]
Fix conversion of int type in BigQueryHook
tswast commented on a change in pull request #2306: [AIRFLOW-1214] Fix conversion of int type in BigQueryHook
URL: https://github.com/apache/incubator-airflow/pull/2306#discussion_r211039642
##########
File path: airflow/contrib/hooks/bigquery_hook.py
##########
@@ -915,7 +915,7 @@ def _bq_cast(string_field, bq_type):
if string_field is None:
return None
elif bq_type == 'INTEGER' or bq_type == 'TIMESTAMP':
- return int(string_field)
+ return int(float(string_field))
Review comment:
It does not. We do not do this conversion in the google-cloud-bigquery library.
https://github.com/GoogleCloudPlatform/google-cloud-python/blob/75de6a53c9feee1bc37ee4bfd1369b3010403194/bigquery/google/cloud/bigquery/_helpers.py#L38-L41
TIMESTAMP can contain fractional values, so perhaps that's why this was added? Probably best to separate these types.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services