Example #1
0
  @Override
  public Expr compile(final QueryContext ctx) throws QueryException {
    super.compile(ctx);
    if (expr[0].isEmpty()) return optPre(null, ctx);

    for (int e = 1; e < expr.length; ++e) {
      if (expr[e].isEmpty()) {
        ctx.compInfo(OPTREMOVE, description(), expr[e]);
        expr = Array.delete(expr, e--);
      }
    }
    // results must always be sorted
    return expr.length == 1 && iterable ? expr[0] : this;
  }