You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Brian Hulette (Jira)" <ji...@apache.org> on 2020/08/05 21:35:00 UTC
[jira] [Comment Edited] (BEAM-10632) checkerframework @Nullable
annotation causes NPE when used with Schema Inference
[ https://issues.apache.org/jira/browse/BEAM-10632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17171779#comment-17171779 ]
Brian Hulette edited comment on BEAM-10632 at 8/5/20, 9:34 PM:
---------------------------------------------------------------
So far I've only been able to replicate this when using schema inference and checker framework @Nullable in :sdks:java:expansion-service. It seems to work without issue if I use checker framework @Nullable in AutoValueSchemaTest in core.
In expansion-service: If I add enableChecker: false it gets rid of the NPE, but we incorrectly infer the schema, inferring a field type with nullable=false for fields marked @Nullable. This seems to happen because method.getAnnotatedReturnType().getAnnotations() in FieldValueTypeInformation just doesn't return the @Nullable. Note I can fix the error completely if I just add checker framework as a compile dependency in expansion-service, but of course we shouldn't have to do that long term.
was (Author: bhulette):
So far I've only been able to replicate this when using schema inference and checker framework @Nullable in :sdks:java:expansion-service. It seems to work without issue if I use checker framework @Nullable in AutoValueSchemaTest in core.
In expansion-service: If I add enableChecker: false it gets rid of the NPE, but we incorrectly infer the schema, saying inferring a field type with nullable=false for fields marked @Nullable. This seems to happen because method.getAnnotatedReturnType().getAnnotations() in FieldValueTypeInformation just doesn't return the @Nullable. Note I can fix the error completely if I just add checker framework as a compile dependency in expansion-service, but of course we shouldn't have to do that long term.
> checkerframework @Nullable annotation causes NPE when used with Schema Inference
> --------------------------------------------------------------------------------
>
> Key: BEAM-10632
> URL: https://issues.apache.org/jira/browse/BEAM-10632
> Project: Beam
> Issue Type: Improvement
> Components: sdk-java-core
> Reporter: Brian Hulette
> Priority: P2
>
> {code:java}
> Caused by: java.lang.NullPointerException
> at sun.reflect.annotation.TypeAnnotationParser.mapTypeAnnotations(TypeAnnotationParser.java:356)
> at sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.<init>(AnnotatedTypeFactory.java:139)
> at sun.reflect.annotation.AnnotatedTypeFactory.buildAnnotatedType(AnnotatedTypeFactory.java:65)
> at sun.reflect.annotation.TypeAnnotationParser.buildAnnotatedType(TypeAnnotationParser.java:79)
> at java.lang.reflect.Executable.getAnnotatedReturnType0(Executable.java:633)
> at java.lang.reflect.Method.getAnnotatedReturnType(Method.java:648)
> at org.apache.beam.sdk.schemas.FieldValueTypeInformation.hasNullableReturnType(FieldValueTypeInformation.java:173)
> at org.apache.beam.sdk.schemas.FieldValueTypeInformation.forGetter(FieldValueTypeInformation.java:132)
> at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1383)
> at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
> at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
> at org.apache.beam.sdk.schemas.AutoValueSchema$AbstractGetterTypeSupplier.get(AutoValueSchema.java:62)
> at org.apache.beam.sdk.schemas.utils.StaticSchemaInference.schemaFromClass(StaticSchemaInference.java:88)
> at org.apache.beam.sdk.schemas.utils.JavaBeanUtils.schemaFromJavaBeanClass(JavaBeanUtils.java:65)
> at org.apache.beam.sdk.schemas.AutoValueSchema.schemaFor(AutoValueSchema.java:117)
> at org.apache.beam.sdk.schemas.annotations.DefaultSchema$DefaultSchemaProvider.schemaFor(DefaultSchema.java:130)
> {code}
> CC: [~kenn] [~reuvenlax]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)