MCPcopy Create free account
hub / github.com/apache/pig / exec

Method exec

src/org/apache/pig/impl/builtin/GetMemNumRows.java:48–69  ·  view source on GitHub ↗

@param in - input tuple @return - tuple having size in memory of this tuple and numRows if this is specially marked tuple having number of rows field

(Tuple in)

Source from the content-addressed store, hash-verified

46 * is specially marked tuple having number of rows field
47 */
48 public Tuple exec(Tuple in) throws IOException {
49 if (in == null) {
50 return null;
51 }
52 long memSize = in.getMemorySize();
53 long numRows = 0;
54
55
56 // if this is specially marked tuple, get the number of rows
57 int tSize = in.size();
58 if(tSize >=2 &&
59 PoissonSampleLoader.NUMROWS_TUPLE_MARKER.equals(in.get(tSize-2)) ){
60 memSize -= SizeUtil.getPigObjMemSize(PoissonSampleLoader.NUMROWS_TUPLE_MARKER);
61 numRows = (Long)in.get(tSize-1);
62 }
63
64 //create tuple to be returned
65 Tuple t = factory.newTuple(2);
66 t.set(0, memSize);
67 t.set(1, numRows);
68 return t;
69 }
70
71 public Type getReturnType(){
72 return Tuple.class;

Callers

nothing calls this directly

Calls 7

getPigObjMemSizeMethod · 0.95
setMethod · 0.95
getMemorySizeMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
newTupleMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected