[ 
https://issues.apache.org/jira/browse/BEAM-6963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Balázs Németh updated BEAM-6963:
--------------------------------
    Description: 
Classes affected:
 org.apache.beam.sdk.options.ValueProvider.Serializer
 org.apache.beam.sdk.options.ValueProvider.Deserializer

The problem is that according to the JsonDeserializer documentation, the 
deserialize method isn't executed for null nodes:
 ( 
[https://static.javadoc.io/com.fasterxml.jackson.core/jackson-databind/2.9.6/com/fasterxml/jackson/databind/JsonDeserializer.html#deserialize(com.fasterxml.jackson.core.JsonParser,%20com.fasterxml.jackson.databind.DeserializationContext)|https://static.javadoc.io/com.fasterxml.jackson.core/jackson-databind/2.9.6/com/fasterxml/jackson/databind/JsonDeserializer.html#deserialize(com.fasterxml.jackson.core.JsonParser,%20com.fasterxml.jackson.databind.DeserializationContext]
 )
 )
 "Note that this method is never called for JSON null literal, and thus 
deserializers need (and should) not check for it."

If we serialize a RuntimeValueProvider, the isAccessible() will return false, 
so we call a writeNull(). During deserialization this isn't handled properly as 
mentioned and our deserialization will return null.

The end result is that getters with ValueProvider return values will return 
"null". AFAIK ValueProvider getters should be never null.

My guess is that either we should completely omit serializing 
RuntimeValueProviders, or during deserialization the proper runtime value 
provider should be created again - which requires more than a "null" being 
present in the json.

  was:
Classes affected:
 org.apache.beam.sdk.options.ValueProvider.Serializer
 org.apache.beam.sdk.options.ValueProvider.Deserializer

The problem is that according to the JsonDeserializer documentation, the 
deserialize method isn't executed for null nodes:
 ( 
[https://static.javadoc.io/com.fasterxml.jackson.core/jackson-databind/2.9.6/com/fasterxml/jackson/databind/JsonDeserializer.html#deserialize(com.fasterxml.jackson.core.JsonParser,%20com.fasterxml.jackson.databind.DeserializationContext)|https://static.javadoc.io/com.fasterxml.jackson.core/jackson-databind/2.9.6/com/fasterxml/jackson/databind/JsonDeserializer.html#deserialize(com.fasterxml.jackson.core.JsonParser,%20com.fasterxml.jackson.databind.DeserializationContext]
 )
 )
 "Note that this method is never called for JSON null literal, and thus 
deserializers need (and should) not check for it."

If we serialize a RuntimeValueProvider, the isAccessible() will return false, 
so we call a writeNull(). During deserialization this isn't handled properly as 
mentioned and our deserialization will return null.

The end result is that getters with ValueProvider return values will return 
"null". AFAIK ValueProvider getters should be never null.


> Bug in RuntimeValueProvider JSON serialization
> ----------------------------------------------
>
>                 Key: BEAM-6963
>                 URL: https://issues.apache.org/jira/browse/BEAM-6963
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>    Affects Versions: 2.11.0
>            Reporter: Balázs Németh
>            Priority: Critical
>
> Classes affected:
>  org.apache.beam.sdk.options.ValueProvider.Serializer
>  org.apache.beam.sdk.options.ValueProvider.Deserializer
> The problem is that according to the JsonDeserializer documentation, the 
> deserialize method isn't executed for null nodes:
>  ( 
> [https://static.javadoc.io/com.fasterxml.jackson.core/jackson-databind/2.9.6/com/fasterxml/jackson/databind/JsonDeserializer.html#deserialize(com.fasterxml.jackson.core.JsonParser,%20com.fasterxml.jackson.databind.DeserializationContext)|https://static.javadoc.io/com.fasterxml.jackson.core/jackson-databind/2.9.6/com/fasterxml/jackson/databind/JsonDeserializer.html#deserialize(com.fasterxml.jackson.core.JsonParser,%20com.fasterxml.jackson.databind.DeserializationContext]
>  )
>  )
>  "Note that this method is never called for JSON null literal, and thus 
> deserializers need (and should) not check for it."
> If we serialize a RuntimeValueProvider, the isAccessible() will return false, 
> so we call a writeNull(). During deserialization this isn't handled properly 
> as mentioned and our deserialization will return null.
> The end result is that getters with ValueProvider return values will return 
> "null". AFAIK ValueProvider getters should be never null.
> My guess is that either we should completely omit serializing 
> RuntimeValueProviders, or during deserialization the proper runtime value 
> provider should be created again - which requires more than a "null" being 
> present in the json.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to