[ 
https://issues.apache.org/jira/browse/BEAM-10314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jeff Webb updated BEAM-10314:
-----------------------------
    Status: Open  (was: Triage Needed)

> Writing containers containing nested Decimal to BigQuery fails
> --------------------------------------------------------------
>
>                 Key: BEAM-10314
>                 URL: https://issues.apache.org/jira/browse/BEAM-10314
>             Project: Beam
>          Issue Type: Bug
>          Components: io-py-gcp
>            Reporter: Alexander Faxå
>            Priority: P3
>
> This piece of code: 
> [https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/gcp/bigquery_tools.py#L946]
>  is attempting to handle the case when inserting objects of type 
> decimal.Decimal into BigQuery by converting them to string.
> This works but doesn't handle the case when the `v` is really a container of 
> nested objects (e.g. a dict), and one of them is a decimal.Decimal. This can 
> easily happen when using ReadFromBigQuery on a table with nested schema.
> Note how `to_json_value`, which is being called here, is recursive for this 
> reason. I verified that a fix for my crash is to insert
> ```
> if isinstance(obj, decimal.Decimal):
>   obj = str(obj)
> ```
> in the beginning of to_json_value.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to