[ 
https://issues.apache.org/jira/browse/BEAM-10524?focusedWorklogId=473835&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-473835
 ]

ASF GitHub Bot logged work on BEAM-10524:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Aug/20 11:03
            Start Date: 24/Aug/20 11:03
    Worklog Time Spent: 10m 
      Work Description: codecov[bot] edited a comment on pull request #12671:
URL: https://github.com/apache/beam/pull/12671#issuecomment-679014547


   # [Codecov](https://codecov.io/gh/apache/beam/pull/12671?src=pr&el=h1) Report
   > :exclamation: No coverage uploaded for pull request base 
(`master@f7b49b6`). [Click here to learn what that 
means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
   > The diff coverage is `n/a`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/beam/pull/12671/graphs/tree.svg?width=650&height=150&src=pr&token=qcbbAh8Fj1)](https://codecov.io/gh/apache/beam/pull/12671?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff            @@
   ##             master   #12671   +/-   ##
   =========================================
     Coverage          ?   34.34%           
   =========================================
     Files             ?      692           
     Lines             ?    81961           
     Branches          ?     9265           
   =========================================
     Hits              ?    28147           
     Misses            ?    53391           
     Partials          ?      423           
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/beam/pull/12671?src=pr&el=tree) | Coverage 
Δ | |
   |---|---|---|
   | 
[runners/job/utils.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-cnVubmVycy9qb2IvdXRpbHMucHk=)
 | `57.14% <0.00%> (ø)` | |
   | 
[io/external/kafka.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-aW8vZXh0ZXJuYWwva2Fma2EucHk=)
 | `0.00% <0.00%> (ø)` | |
   | 
[transforms/window\_test.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-dHJhbnNmb3Jtcy93aW5kb3dfdGVzdC5weQ==)
 | `35.95% <0.00%> (ø)` | |
   | 
[io/gcp/dicomio\_integration\_test.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-aW8vZ2NwL2RpY29taW9faW50ZWdyYXRpb25fdGVzdC5weQ==)
 | `36.13% <0.00%> (ø)` | |
   | 
[transforms/sql.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-dHJhbnNmb3Jtcy9zcWwucHk=)
 | `85.71% <0.00%> (ø)` | |
   | 
[dataframe/expressions\_test.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-ZGF0YWZyYW1lL2V4cHJlc3Npb25zX3Rlc3QucHk=)
 | `30.00% <0.00%> (ø)` | |
   | 
[runners/interactive/pipeline\_fragment.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-cnVubmVycy9pbnRlcmFjdGl2ZS9waXBlbGluZV9mcmFnbWVudC5weQ==)
 | `13.39% <0.00%> (ø)` | |
   | 
[examples/complete/top\_wikipedia\_sessions\_test.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-ZXhhbXBsZXMvY29tcGxldGUvdG9wX3dpa2lwZWRpYV9zZXNzaW9uc190ZXN0LnB5)
 | `76.47% <0.00%> (ø)` | |
   | 
[...flow/internal/clients/dataflow/message\_matchers.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-cnVubmVycy9kYXRhZmxvdy9pbnRlcm5hbC9jbGllbnRzL2RhdGFmbG93L21lc3NhZ2VfbWF0Y2hlcnMucHk=)
 | `18.75% <0.00%> (ø)` | |
   | 
[io/gcp/gcsio\_integration\_test.py](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree#diff-aW8vZ2NwL2djc2lvX2ludGVncmF0aW9uX3Rlc3QucHk=)
 | `34.44% <0.00%> (ø)` | |
   | ... and [682 
more](https://codecov.io/gh/apache/beam/pull/12671/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/beam/pull/12671?src=pr&el=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/beam/pull/12671?src=pr&el=footer). Last 
update 
[f7b49b6...c815e8e](https://codecov.io/gh/apache/beam/pull/12671?src=pr&el=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 473835)
    Time Spent: 1h  (was: 50m)

> Default decoder for ReadFromBigQuery does not support repeatable fields
> -----------------------------------------------------------------------
>
>                 Key: BEAM-10524
>                 URL: https://issues.apache.org/jira/browse/BEAM-10524
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>    Affects Versions: 2.23.0
>            Reporter: Roman Frigg
>            Assignee: Kamil Wasilewski
>            Priority: P2
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> The code in 
> [https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/gcp/bigquery.py#L570]
> handles decoding fields with mode "REPEATABLE" incorrectly. This bug leads to 
> the following stack trace when running a query that returns results with 
> repeatable fields represented as JSON arrays. The corresponding stack trace 
> looks as follows:
> {noformat}
> ...
>  File "apache_beam/runners/common.py", line 1095, in 
> apache_beam.runners.common._OutputProcessor.process_outputs
>   File 
> "/Users/roman/src/ml/data-pipelines/etl/venv/lib/python3.6/site-packages/apache_beam/io/concat_source.py",
>  line 89, in read
>     range_tracker.sub_range_tracker(source_ix)):
>   File 
> "/Users/roman/src/ml/data-pipelines/etl/venv/lib/python3.6/site-packages/apache_beam/io/textio.py",
>  line 210, in read_records
>     yield self._coder.decode(record)
>   File 
> "/Users/roman/src/ml/data-pipelines/etl/venv/lib/python3.6/site-packages/apache_beam/io/gcp/bigquery.py",
>  line 566, in decode
>     return self._decode_with_schema(value, self.fields)
>   File 
> "/Users/roman/src/ml/data-pipelines/etl/venv/lib/python3.6/site-packages/apache_beam/io/gcp/bigquery.py",
>  line 580, in _decode_with_schema
>     value[field.name], field.fields)
>   File 
> "/Users/roman/src/ml/data-pipelines/etl/venv/lib/python3.6/site-packages/apache_beam/io/gcp/bigquery.py",
>  line 575, in _decode_with_schema
>     value[field.name] = None
> TypeError: list indices must be integers or slices, not str{noformat}
>  
> The fix could look something like this (untested):
> {code:python}
> def _decode_with_schema(self, value, schema_fields):
>     for field in schema_fields:
>         if field.name not in value:
>             # The field exists in the schema, but it doesn't exist in this 
> row.
>             # It probably means its value was null, as the extract to JSON job
>             # doesn't preserve null fields
>             value[field.name] = None
>             continue
>         if field.type == 'RECORD':
>             if field.mode == 'REPEATED':
>                 value[field.name] = [self._decode_with_schema(val, 
> field.fields)
>                                      for val in value[field.name]]
>             else:
>                 value[field.name] = 
> self._decode_with_schema(value[field.name],
>                                                              field.fields)
>         else:
>             try:
>                 converter = self._converters[field.type]
>             except KeyError:
>                 # No need to do any conversion
>                 continue
>             if field.mode == 'REPEATED':
>                 value[field.name] = map(converter, value[field.name])
>             else:
>                 value[field.name] = converter(value[field.name])
>     return value
> {code}



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

Reply via email to