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

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

bq. If ProcessorDescriptor.setUserPayload were accepting a ByteBuffer only, 
then it would be alright for UserPayload to be a valid object with a null 
ByteBuffer payload.
That sounds right. But that would make the API asymmetric.

Lets consider the cases
ProcDesc.setUserPayload() is called to provide a payload. Null UserPayload 
object cannot be provided (it checks for that). The ByteBuffer inside it can be 
null. In that case ProcContext.getPayload() will give that UserPayload object 
back and payload.getPayload() will give whatever ByteBuffer was provided.
If ProcDesc.setUserPayload() not called by the user, the ideally 
procContext.getPayload() should also not be called because this proc does not 
care about the payload. If it does call getUserPayload for some reason then the 
actual ByteBuffer returned via that would still be null. Can this just be fixed 
by clarifying the javadoc?

> 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