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

Bikas Saha commented on TEZ-373:
--------------------------------

It is perfectly fine for payload to be null.
{code}+  public TezUserPayload(byte[] payload) {
+    Preconditions.checkNotNull(payload, "payload is null");
+    this.payload = payload;
+  }{code}
After the above, this is not needed anymore
{code}+    if (payload == null) {
+      payload = EMPTY_BYTE_ARRAY;
+    }{code}

Shouldn't this simply be "return userPayload.getPayload()"? DAGTypeConverters 
should be invoked only at the RPC boundary (like you observed earlier).
{code}@@ -40,11 +41,11 @@ public abstract class TezEntityDescriptor implements 
Writable {
   }
 
   public byte[] getUserPayload() {
-    return this.userPayload;
+    return DagTypeConverters.convertFromTezUserPayload(userPayload);
   }
....
@@ -67,7 +69,7 @@ public class CompositeDataMovementEvent extends Event {
   }
 
   public byte[] getUserPayload() {
-    return userPayload;
+    return DagTypeConverters.convertFromTezUserPayload(userPayload);
...
@@ -74,7 +76,7 @@ public final class RootInputDataInformationEvent extends 
Event {
   }
   
   public byte[] getUserPayload() {
-    return this.userPayload;
+    return DagTypeConverters.convertFromTezUserPayload(userPayload);
   }
....
and other places like 
RootInputUpdatePayloadEvent/VertexManagerEvent/Edge/TezInputContext/TezOutputContext/TezProcessorContext.
 etc.
{code}

> Create UserPayload class
> ------------------------
>
>                 Key: TEZ-373
>                 URL: https://issues.apache.org/jira/browse/TEZ-373
>             Project: Apache Tez
>          Issue Type: Task
>            Reporter: Bikas Saha
>            Assignee: Tsuyoshi OZAWA
>              Labels: newbie
>         Attachments: TEZ-373.1.patch, TEZ-373.10.patch, TEZ-373.2.patch, 
> TEZ-373.3.patch, TEZ-373.4.patch, TEZ-373.5.patch, TEZ-373.6.patch, 
> TEZ-373.7.patch, TEZ-373.8.patch, TEZ-373.9.patch
>
>
> Currently Tez allows user payload to be passed as byte[]. Within Tez code is 
> hard to understand where byte[] is userPayload and where is not user payload. 
> If we create a TezUserPayload class that contains byte[] as a member then its 
> much easier to search and identify in code.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to