super(children);
}
@Override
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
Expression arrayExpr = children.get(0);
if (!arrayExpr.evaluate(tuple, ptr)) {
return false;
} else if (ptr.getLength() == 0) {
return true;
}
PDataType baseType = PDataType.fromTypeId(children.get(0).getDataType()
.getSqlType()
- PDataType.ARRAY_TYPE_BASE);
int length = PArrayDataType.getArrayLength(ptr, baseType, arrayExpr.getMaxLength());
byte[] lengthBuf = new byte[PDataType.INTEGER.getByteSize()];
PDataType.INTEGER.getCodec().encodeInt(length, lengthBuf, 0);
ptr.set(lengthBuf);
return true;
}