You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2019/06/14 10:46:00 UTC
[jira] [Work logged] (BEAM-7542) java.lang.ClassCastException when
writing BYTES to BigQuery
[ https://issues.apache.org/jira/browse/BEAM-7542?focusedWorklogId=260293&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-260293 ]
ASF GitHub Bot logged work on BEAM-7542:
----------------------------------------
Author: ASF GitHub Bot
Created on: 14/Jun/19 10:45
Start Date: 14/Jun/19 10:45
Worklog Time Spent: 10m
Work Description: vglocus commented on pull request #8858: [BEAM-7542] Fix faulty cast in BigQueryUtils
URL: https://github.com/apache/beam/pull/8858
I wish to be able to write BYTES type fields to BigQuery.
In BigQueryUtils (sdks/io/google-cloud-platform) when serialising a BYTES type BEAM field for BQ there is a faulty cast to java.nio.ByteBuffer while the value will always be a primitive byte array (see org.apache.beam.sdk.values.Row.Builder#verifyPrimitiveType).
Trying to use BigQueryUtils when writing a BYTES field to BiqQuery will cause
`
java.lang.ClassCastException: [B cannot be cast to java.nio.ByteBuffer at org.apache.beam.sdk.io.gcp.bigquery.BigQueryUtils.fromBeamField(BigQueryUtils.java:280)
`
and the added tests in BigQueryUtilsTest will trigger this, and the changes to BigQueryUtils intends to solve it.
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
- [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
Post-Commit Tests Status (on master branch)
------------------------------------------------------------------------------------------------
Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
--- | --- | --- | --- | --- | --- | --- | ---
Go | [](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/) | --- | --- | [](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/) | --- | --- | [](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/)
Java | [](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/)
Python | [](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Python3_Verify/lastCompletedBuild/) | --- | [](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/) <br> [](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/) | --- | --- | [](https://builds.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/)
Pre-Commit Tests Status (on master branch)
------------------------------------------------------------------------------------------------
--- |Java | Python | Go | Website
--- | --- | --- | --- | ---
Non-portable | [](https://builds.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/) | [](https://builds.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/)
Portable | --- | [](https://builds.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/) | --- | ---
See [.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md) for trigger phrase, status and link of all Jenkins jobs.
----------------------------------------------------------------
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:
users@infra.apache.org
Issue Time Tracking
-------------------
Worklog Id: (was: 260293)
Time Spent: 10m
Remaining Estimate: 23h 50m (was: 24h)
> java.lang.ClassCastException when writing BYTES to BigQuery
> -----------------------------------------------------------
>
> Key: BEAM-7542
> URL: https://issues.apache.org/jira/browse/BEAM-7542
> Project: Beam
> Issue Type: Bug
> Components: io-java-gcp
> Affects Versions: 2.13.0
> Environment: Running on OS X 10.14.5 (18F132), JRE 1.8.0_152, also in GCP DataFlow
> Reporter: Viktor Gerdin
> Assignee: Viktor Gerdin
> Priority: Major
> Fix For: 2.14.0
>
> Original Estimate: 24h
> Time Spent: 10m
> Remaining Estimate: 23h 50m
>
> When trying to use BigQueryIO.write() with BigQueryUtils.toTableRow() with a BYTES field it breaks with
> {noformat}
> java.lang.ClassCastException: [B cannot be cast to java.nio.ByteBuffer at org.apache.beam.sdk.io.gcp.bigquery.BigQueryUtils.fromBeamField(BigQueryUtils.java:280){noformat}
> BigQueryUtils.fromBeamField() attempts to cast fieldValue to java.nio.ByteBuffer but it is a byte[].
> Unit tests are not covering BYTES field type.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)