Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beam Schema RowCoder can't roundtrip DateTime #20906

Open
damccorm opened this issue Jun 4, 2022 · 0 comments
Open

Beam Schema RowCoder can't roundtrip DateTime #20906

damccorm opened this issue Jun 4, 2022 · 0 comments

Comments

@damccorm
Copy link
Contributor

damccorm commented Jun 4, 2022

Beam 2.21.0**** won't roundtrip DateTime. The test was changed in the PR that introduced the breakage: fc6cef9#diff-6dc06eab59c695aaa6c73cf608b392a6a6ab0809e72f1fc3b11805752b8eb69eL68

This is what doesn't work:


Row.withSchema(...).addValues(inputRow.getDateTime()).build();

Workaround:


Row.withSchema(...).addValues(inputRow.getDateTime().toInstant()).build();

Stack trace:


Caused by: java.lang.ClassCastException: org.joda.time.DateTime cannot be cast to org.joda.time.Instant
                                   
        at org.apache.beam.sdk.coders.InstantCoder.encode(InstantCoder.java:34)
                                                           
        at org.apache.beam.sdk.coders.RowCoderGenerator$EncodeInstruction.encodeDelegate(RowCoderGenerator.java:274)
                      
        at org.apache.beam.sdk.coders.Coder$ByteBuddy$qZItcXc5.encode(Unknown
Source)                                                      
        at org.apache.beam.sdk.coders.Coder$ByteBuddy$qZItcXc5.encode(Unknown
Source)                                                      
        at org.apache.beam.sdk.schemas.SchemaCoder.encode(SchemaCoder.java:118)
                                                           
        at org.apache.beam.sdk.coders.Coder.encode(Coder.java:136)
                                                                        
        at org.apache.beam.sdk.util.CoderUtils.encodeToSafeStream(CoderUtils.java:85)
                                                     
        at org.apache.beam.sdk.util.CoderUtils.encodeToByteArray(CoderUtils.java:69)
                                                      
        at org.apache.beam.sdk.util.CoderUtils.encodeToByteArray(CoderUtils.java:54)
                                                      
        at org.apache.beam.sdk.util.CoderUtils.clone(CoderUtils.java:144)
                                                                 
        at org.apache.beam.sdk.util.MutationDetectors$CodedValueMutationDetector.<init>(MutationDetectors.java:118)
                       
        at org.apache.beam.sdk.util.MutationDetectors.forValueWithCoder(MutationDetectors.java:49)
                                        
        at org.apache.beam.runners.direct.ImmutabilityCheckingBundleFactory$ImmutabilityEnforcingBundle.add(ImmutabilityCheckingBundleFacto
ry.java:115)
                                                                                                   
                          
        at org.apache.beam.runners.direct.ParDoEvaluator$BundleOutputManager.output(ParDoEvaluator.java:305)
                              
        at org.apache.beam.repackaged.direct_java.runners.core.SimpleDoFnRunner.outputWindowedValue(SimpleDoFnRunner.java:272)
            
        at org.apache.beam.repackaged.direct_java.runners.core.SimpleDoFnRunner.access$900(SimpleDoFnRunner.java:84)
                      
        at org.apache.beam.repackaged.direct_java.runners.core.SimpleDoFnRunner$DoFnProcessContext.output(SimpleDoFnRunner.java:418)
      
        at org.apache.beam.repackaged.direct_java.runners.core.SimpleDoFnRunner$DoFnProcessContext.output(SimpleDoFnRunner.java:406)
 

Imported from Jira BEAM-12105. Original Jira may contain additional context.
Reported by: apilloud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant