public final static byte[] ZERO = PDataType.LONG.toBytes(0);
    public final static byte[] ONE = PDataType.LONG.toBytes(1);
    @Override
    public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
        if (!super.evaluate(tuple, ptr)) {
            ptr.set(ZERO); // If evaluate returns false, then no rows were found, so result is 0
        }else if (isConstantExpression()) {
            ptr.set(ONE); // Otherwise, we found one or more rows, so a distinct on a constant is 1
        }
        return true; // Always evaluates to a  LONG value
    }