[ 
https://issues.apache.org/jira/browse/BEAM-7210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16831829#comment-16831829
 ] 

Reuven Lax commented on BEAM-7210:
----------------------------------

I see the problem. I changed things from POJO to AutoValue. Since Java 
reflection makes no guarantees about the order it returns things, this means 
that schema inference is always non deterministic in the order of fields.  
However reflection tends to return variables in order, so it happened to work 
before. When it comes to listing member methods, reflection is far less 
deterministic (I suspect it returns things in hashmap order or something).

 

The fix is to access by name instead of index. So replace row.getString(0) with 
row.getString("stringField"). I'll send a PR to fix this.

> 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
>
>
> 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)

Reply via email to