[ https://issues.apache.org/jira/browse/BEAM-2170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15996945#comment-15996945 ]
Eugene Kirpichov commented on BEAM-2170: ---------------------------------------- Sorry for the trouble, I'll fix this today around 1pm PST. > PubsubIO.readStrings should handle messages without metadata > ------------------------------------------------------------ > > Key: BEAM-2170 > URL: https://issues.apache.org/jira/browse/BEAM-2170 > Project: Beam > Issue Type: Bug > Components: sdk-java-gcp > Reporter: Alexandre Crayssac > Assignee: Eugene Kirpichov > Fix For: First stable release > > > When I use PubsubIO.readStrings with messages that does not contain any > metadata I got the following error: > {noformat} > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) > at java.lang.Thread.run(Thread.java:745) > Caused by: java.lang.RuntimeException: > org.apache.beam.sdk.coders.CoderException: cannot encode a null Map > at > org.apache.beam.runners.direct.ImmutabilityCheckingBundleFactory$ImmutabilityEnforcingBundle.add(ImmutabilityCheckingBundleFactory.java:113) > at > org.apache.beam.runners.direct.UnboundedReadEvaluatorFactory$UnboundedReadEvaluator.processElement(UnboundedReadEvaluatorFactory.java:134) > at > org.apache.beam.runners.direct.TransformExecutor.processElements(TransformExecutor.java:138) > at > org.apache.beam.runners.direct.TransformExecutor.run(TransformExecutor.java:106) > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > ... 1 more > Caused by: org.apache.beam.sdk.coders.CoderException: cannot encode a null Map > at org.apache.beam.sdk.coders.MapCoder.encode(MapCoder.java:90) > at org.apache.beam.sdk.coders.MapCoder.encode(MapCoder.java:43) > at > org.apache.beam.sdk.io.gcp.pubsub.PubsubMessageWithAttributesCoder.encode(PubsubMessageWithAttributesCoder.java:53) > at > org.apache.beam.sdk.io.gcp.pubsub.PubsubMessageWithAttributesCoder.encode(PubsubMessageWithAttributesCoder.java:33) > at > org.apache.beam.sdk.util.CoderUtils.encodeToSafeStream(CoderUtils.java:91) > at > org.apache.beam.sdk.util.CoderUtils.encodeToByteArray(CoderUtils.java:75) > at > org.apache.beam.sdk.util.CoderUtils.encodeToByteArray(CoderUtils.java:60) > at > org.apache.beam.sdk.util.MutationDetectors$CodedValueMutationDetector.<init>(MutationDetectors.java:106) > at > org.apache.beam.sdk.util.MutationDetectors.forValueWithCoder(MutationDetectors.java:44) > at > org.apache.beam.runners.direct.ImmutabilityCheckingBundleFactory$ImmutabilityEnforcingBundle.add(ImmutabilityCheckingBundleFactory.java:111) > ... 8 more > {noformat} > When I add some metadata the problem disappears. You should be able to > reproduce the problem with a very simple pipeline consisting of only one > PubsubIO.readStrings. > Tell me if you need more information -- This message was sent by Atlassian JIRA (v6.3.15#6346)