[
https://issues.apache.org/jira/browse/BEAM-7530?focusedWorklogId=257891&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-257891
]
ASF GitHub Bot logged work on BEAM-7530:
----------------------------------------
Author: ASF GitHub Bot
Created on: 11/Jun/19 16:25
Start Date: 11/Jun/19 16:25
Worklog Time Spent: 10m
Work Description: tvalentyn commented on pull request #8817: [BEAM-7530]
allow read None bytes
URL: https://github.com/apache/beam/pull/8817#discussion_r292547144
##########
File path: sdks/python/apache_beam/io/gcp/bigquery_tools.py
##########
@@ -928,7 +928,7 @@ def __iter__(self):
# return base64 encoded bytes as byte type on python 3
# which matches the behavior of Beam Java SDK
for i in range(len(row.f)):
- if self.schema.fields[i].type == 'BYTES':
+ if self.schema.fields[i].type == 'BYTES' and row.f[i].v:
Review comment:
Thanks a lot! Could you please add to one of BQ IT tests a test scenario
that reads and writes a row of None values for BQ datatypes that allow value to
be None ?
Thank you!
----------------------------------------------------------------
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: 257891)
Time Spent: 10m
Remaining Estimate: 0h
> Reading None value type BYTES from bigquery: AttributeError
> -----------------------------------------------------------
>
> Key: BEAM-7530
> URL: https://issues.apache.org/jira/browse/BEAM-7530
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Reporter: Juta Staes
> Assignee: Juta Staes
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When reading bigquery data where a field of type BYTES contains a None value
> I get the following error:
> {code:java}
> Traceback (most recent call last): File
> "/mnt/c/Users/Juta/Documents/02-projects/apache/beam/sdks/venv/lib/python3.5/site-packages/apache_beam/runners/direct/executor.py",
> line 343, in call finish_state) File
> "/mnt/c/Users/Juta/Documents/02-projects/apache/beam/sdks/venv/lib/python3.5/site-packages/apache_beam/runners/direct/executor.py",
> line 383, in attempt_call result = evaluator.finish_bundle() File
> "/mnt/c/Users/Juta/Documents/02-projects/apache/beam/sdks/venv/lib/python3.5/site-packages/apache_beam/runners/direct/transform_evaluator.py",
> line 319, in finish_bundle bundles = _read_values_to_bundles(reader) File
> "/mnt/c/Users/Juta/Documents/02-projects/apache/beam/sdks/venv/lib/python3.5/site-packages/apache_beam/runners/direct/transform_evaluator.py",
> line 306, in _read_values_to_bundles read_result =
> [GlobalWindows.windowed_value(e) for e in reader] File
> "/mnt/c/Users/Juta/Documents/02-projects/apache/beam/sdks/venv/lib/python3.5/site-packages/apache_beam/runners/direct/transform_evaluator.py",
> line 306, in <listcomp> read_result = [GlobalWindows.windowed_value(e) for e
> in reader] File
> "/mnt/c/Users/Juta/Documents/02-projects/apache/beam/sdks/venv/lib/python3.5/site-packages/apache_beam/io/gcp/bigquery_tools.py",
> line 932, in __iter__ row.f[i].v.string_value =
> row.f[i].v.string_value.encode('utf-8') AttributeError: 'NoneType' object has
> no attribute 'string_value'{code}
> This bug was introduced in https://github.com/apache/beam/pull/8621 and is
> present in the 2.13 release.
> I submitted a pr to fix the issue: https://github.com/apache/beam/pull/8817
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)