to.bytes(dba.get(), dba.size()); return;
@Override public Long exec(Tuple input) throws IOException { try { DataByteArray dba = (DataByteArray)(input.get(0)); return dba == null ? null : Long.valueOf(dba.size()); } catch (ExecException exp) { throw exp; } catch (Exception e) { int errCode = 2106; String msg = "Error while computing size in " + this.getClass().getSimpleName(); throw new ExecException(msg, errCode, PigException.BUG, e); } }
/** * @param context the context the method is being executed in * @return the size of the encapsulated DataByteArray */ @JRubyMethod(name = {"size", "length"}) public RubyFixnum size(ThreadContext context) { return RubyFixnum.newFixnum(context.getRuntime(), internalDBA.size()); }
public Long exec(Tuple input) throws IOException { if (input == null || input.size() == 0 ) { return 0L; } long bytesSize = 0L; switch(input.getType(0)) { case DataType.BYTEARRAY: DataByteArray dba = (DataByteArray)input.get(0); bytesSize = dba.size(); break; case DataType.CHARARRAY: String str = (String)input.get(0); bytesSize = str.getBytes().length; break; default: break; } return bytesSize; }
out.writeByte(DataType.BYTEARRAY); DataByteArray bytes = (DataByteArray)val; out.writeInt(bytes.size()); out.write(bytes.mData); break;
byte[] b = new byte[((DataByteArray) pigObject).size()];
to.bytes(dba.get(), dba.size()); return;