@Override public void write(DataOutput out) throws IOException { out.writeByte(DataType.TUPLE); int sz = size(); out.writeInt(sz); for (int i = 0; i < sz; i++) { DataReaderWriter.writeDatum(out, mFields.get(i)); } }
@SuppressWarnings("rawtypes") public Long exec(Tuple input) throws IOException { if (input == null) { return 0L; } long n = 0; if (input.size() != 0) { Object obj = input.get(0); if (obj instanceof DefaultTuple) { n = ((DefaultTuple)obj).size(); } else if (obj instanceof DataBag) { n = ((DataBag)obj).size(); } else if (obj instanceof String) { n = ((String)obj).length(); } else if (obj instanceof Map) { n = ((Map)obj).size(); } } return n; }