Example #1
0
  @Override
  public GroupBy copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
    // copy the pre-grouping expressions
    final Expr[] pEx = Arr.copyAll(qc, scp, vs, preExpr);

    // create fresh copies of the post-grouping variables
    final Var[] ps = new Var[post.length];
    final int pl = ps.length;
    for (int p = 0; p < pl; p++) {
      final Var old = post[p];
      ps[p] = scp.addCopy(old, qc);
      vs.put(old.id, ps[p]);
    }

    // done
    return new GroupBy(Arr.copyAll(qc, scp, vs, specs), pEx, ps, nonOcc, info);
  }
Example #2
0
  @Override
  public Expr comp(final QueryContext ctx) throws QueryException {
    super.comp(ctx);

    final SeqType s0 = expr[0].type();
    final SeqType s1 = expr[1].type();
    type =
        s0.isNum() && s1.isNum()
            ? SeqType.ITR
            : s0.one() && s1.one() ? SeqType.ITEM : SeqType.ITEM_ZO;

    return optPre(oneIsEmpty() ? null : allAreValues() ? item(ctx, input) : this, ctx);
  }
Example #3
0
 @Override
 public FTExpr copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
   final FTWords ftw =
       new FTWords(
           info,
           query.copy(qc, scp, vs),
           mode,
           occ == null ? null : Arr.copyAll(qc, scp, vs, occ));
   if (ftt != null) ftw.ftt = ftt.copy(ftw);
   ftw.tokens = tokens;
   ftw.data = data;
   ftw.first = first;
   ftw.pos = pos;
   ftw.fast = fast;
   return ftw;
 }
Example #4
0
 @Override
 public Expr copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
   return new TypeSwitch(info, ts.copy(qc, scp, vs), Arr.copyAll(qc, scp, vs, cases));
 }
Example #5
0
 @Override
 public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException {
   for (final Let c : copies) c.expr = c.expr.compile(ctx, scp);
   super.compile(ctx, scp);
   return this;
 }
Example #6
0
 @Override
 public FTExpr copy(final CompileContext cc, final IntObjMap<Var> vm) {
   final FTAnd copy = new FTAnd(info, Arr.copyAll(cc, vm, exprs));
   if (negated != null) copy.negated = negated.clone();
   return copy;
 }
Example #7
0
 @Override
 public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException {
   super.compile(ctx, scp);
   return optimize(ctx, scp);
 }