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

Bikas Saha commented on TEZ-1666:
---------------------------------

Folks, this is just a question of documentation of semantics.
Context.getUserPayload() will return a UserPayload object. If the DAG creation 
code has provided a ByteBuffer then userPayload.getPayload() gives the buffer 
to you. If the DAG creation code has not provided any ByteBuffer then 
userPayload.getPayload() will return null. All scenarios are covered if these 
semantics are documented. UserPayload.getPayload() is what the I/P/O need to 
check for the ByteBuffer if they need a ByteBuffer.

The conf was a random thought. The bottomline is whether the UserPayload will 
ever be augmented with anything else in addition to the ByteBuffer that is 
currently being provided. If we dont know for sure then we are better off 
returning a non-null object. For the user, in either case they have to check 
for null. They either check context.getUserPayload() == null or 
context.getUserPayload().getPayload() == null. They will check whatever is 
documented. But if we return a null object now then we will never be able to 
return a non-null object later on. That kind of defeats the purpose of having 
the wrapper object in the first place other than being more typesafe than 
ByteBuffer.


> UserPayload should be null if the payload is not specified
> ----------------------------------------------------------
>
>                 Key: TEZ-1666
>                 URL: https://issues.apache.org/jira/browse/TEZ-1666
>             Project: Apache Tez
>          Issue Type: Bug
>            Reporter: Siddharth Seth
>            Priority: Critical
>
> As an example in the ProcessorDescriptor - if no payload is specified, 
> context.getUserPayload should return null.
> SleepProcessor has an explicit check for a null payload, to enable default 
> sleep value - which fails.
> Marking as critical since this is an API behaviour inconsistency.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to