@Override public RESULT visitValueListExpr(CONTEXT ctx, Stack<Expr> stack, ValueListExpr expr) throws TajoException { stack.push(expr); RESULT result = null; for (Expr value : expr.getValues()) { result = visit(ctx, stack, value); } stack.pop(); return result; }
@Override public Object clone() throws CloneNotSupportedException { ListPartitionSpecifier specifier = (ListPartitionSpecifier) super.clone(); specifier.valueList = (ValueListExpr) valueList.clone(); return specifier; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ListPartitionSpecifier that = (ListPartitionSpecifier) o; return valueList.equals(that.valueList); }
@Override public Expr visitArray(ArrayContext ctx) { int size = ctx.numeric_value_expression().size(); Expr[] exprs = new Expr[size]; for (int i = 0; i < size; i++) { exprs[i] = visit(ctx.numeric_value_expression(i)); } return new ValueListExpr(exprs); }
@Override public int hashCode() { return valueList.hashCode(); }
@Override protected EvalNode visitRowConstant(Object o, RowConstantEval evalNode, Stack<EvalNode> stack) { Expr[] values = new Expr[evalNode.getValues().length]; for (int i = 0; i < evalNode.getValues().length; i++) { Datum datum = evalNode.getValues()[i]; values[i] = convertDatumToExpr(datum.kind(), datum); } ValueListExpr expr = new ValueListExpr(values); exprs.push(expr); return super.visitRowConstant(o, evalNode, stack); }
@Override public int hashCode() { return valueList.hashCode(); }
@Override public RESULT visitValueListExpr(CONTEXT ctx, Stack<Expr> stack, ValueListExpr expr) throws TajoException { stack.push(expr); RESULT result = null; for (Expr value : expr.getValues()) { result = visit(ctx, stack, value); } stack.pop(); return result; }
@Override public Expr visitIn_predicate_value(In_predicate_valueContext ctx) { if (checkIfExist(ctx.in_value_list())) { int size = ctx.in_value_list().row_value_predicand().size(); Expr [] exprs = new Expr[size]; for (int i = 0; i < size; i++) { exprs[i] = visitRow_value_predicand(ctx.in_value_list().row_value_predicand(i)); } return new ValueListExpr(exprs); } else { return new SimpleTableSubquery(visitChildren(ctx.table_subquery())); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ListPartitionSpecifier that = (ListPartitionSpecifier) o; return valueList.equals(that.valueList); }
@Override public Object clone() throws CloneNotSupportedException { ListPartitionSpecifier specifier = (ListPartitionSpecifier) super.clone(); specifier.valueList = (ValueListExpr) valueList.clone(); return specifier; } }
@Override public EvalNode visitValueListExpr(Context ctx, Stack<Expr> stack, ValueListExpr expr) throws TajoException { Datum[] values = new Datum[expr.getValues().length]; EvalNode [] evalNodes = new EvalNode[expr.getValues().length]; for (int i = 0; i < expr.getValues().length; i++) { evalNodes[i] = visit(ctx, stack, expr.getValues()[i]); if (!EvalTreeUtil.checkIfCanBeConstant(evalNodes[i])) { throw makeSyntaxError("Non constant values cannot be included in IN PREDICATE."); } values[i] = EvalTreeUtil.evaluateImmediately(null, evalNodes[i]); } return new RowConstantEval(values); }
@Override public Expr visitIn_predicate_value(In_predicate_valueContext ctx) { if (checkIfExist(ctx.in_value_list())) { int size = ctx.in_value_list().row_value_predicand().size(); Expr [] exprs = new Expr[size]; for (int i = 0; i < size; i++) { exprs[i] = visitRow_value_predicand(ctx.in_value_list().row_value_predicand(i)); } return new ValueListExpr(exprs); } else { return new SimpleTableSubquery(visitChildren(ctx.table_subquery())); } }
@Override public EvalNode visitValueListExpr(Context ctx, Stack<Expr> stack, ValueListExpr expr) throws TajoException { Datum[] values = new Datum[expr.getValues().length]; EvalNode [] evalNodes = new EvalNode[expr.getValues().length]; for (int i = 0; i < expr.getValues().length; i++) { evalNodes[i] = visit(ctx, stack, expr.getValues()[i]); if (!EvalTreeUtil.checkIfCanBeConstant(evalNodes[i])) { throw makeSyntaxError("Non constant values cannot be included in IN PREDICATE."); } values[i] = EvalTreeUtil.evaluateImmediately(null, evalNodes[i]); } return new RowConstantEval(values); }
new ValueListExpr(exprs)));
@Override public Expr visitValueListExpr(Object ctx, Stack<Expr> stack, ValueListExpr expr) throws TajoException { StringBuilder sb = new StringBuilder(); if (!isHiveCatalog) { sb.append("("); for(int i = 0; i < expr.getValues().length; i++) { if (i > 0) { sb.append(", "); } sb.append("?"); stack.push(expr.getValues()[i]); visit(ctx, stack, expr.getValues()[i]); stack.pop(); } sb.append(")"); sb.append(" )"); queries.push(sb.toString()); } else { throw new UnsupportedException("IN Operator"); } return expr; }
new ValueListExpr(exprs)));