@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)
| 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; |
nothing calls this directly
no test coverage detected