[
https://issues.apache.org/jira/browse/BEAM-7210?focusedWorklogId=237038&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-237038
]
ASF GitHub Bot logged work on BEAM-7210:
----------------------------------------
Author: ASF GitHub Bot
Created on: 03/May/19 20:09
Start Date: 03/May/19 20:09
Worklog Time Spent: 10m
Work Description: reuvenlax commented on pull request #8474: [BEAM-7210]
Fix non-deterministic row access
URL: https://github.com/apache/beam/pull/8474#discussion_r280913088
##########
File path:
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoSchemaTest.java
##########
@@ -388,7 +388,7 @@ public void testInferredSchemaPipeline() {
new DoFn<Inferred, String>() {
@ProcessElement
public void process(@Element Row row,
OutputReceiver<String> r) {
- r.output(row.getString(0) + ":" + row.getInt32(1));
+ r.output(row.getString("stringField") + ":" +
row.getInt32("integerField"));
Review comment:
It is perfectly safe. What's not safe is assuming that the order of the
schema fields will match the order of the methods in your class. In fact it's
technically not safe for POJOs either, as AFAICT Java makes no guarantees there
either.
----------------------------------------------------------------
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: 237038)
Time Spent: 0.5h (was: 20m)
> Test ParDoSchemaTest#testInferredSchemaPipeline is flaky
> --------------------------------------------------------
>
> Key: BEAM-7210
> URL: https://issues.apache.org/jira/browse/BEAM-7210
> Project: Beam
> Issue Type: Bug
> Components: runner-flink, sdk-java-core
> Reporter: Maximilian Michels
> Priority: Major
> Fix For: 2.13.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Test ParDoSchemaTest#testInferredSchemaPipeline is flaky. Please see
> [https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/3918/testReport/junit/org.apache.beam.sdk.transforms/ParDoSchemaTest/testInferredSchemaPipeline/]
> It seems like the backing row data is not populated in a deterministic way:
> {noformat}
> Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to
> java.lang.String
> at org.apache.beam.sdk.values.Row.getString(Row.java:279)
> at
> org.apache.beam.sdk.transforms.ParDoSchemaTest$12.process(ParDoSchemaTest.java:391){noformat}
> CC [~reuvenlax]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)