@Override @SuppressWarnings("unchecked") public Datum eval(Tuple tuple) { super.eval(tuple); Datum operandDatum = child.eval(tuple); if (operandDatum.isNull()) { return operandDatum; } return DatumFactory.cast(operandDatum, target, timezone); }
@Override @SuppressWarnings("unchecked") public Datum eval(Tuple tuple) { super.eval(tuple); boolean isNull = child.eval(tuple).isNull(); return DatumFactory.createBool(isNot ^ isNull); }
@Override @SuppressWarnings("unchecked") public Datum eval(Tuple tuple) { super.eval(tuple); Datum result = child.eval(tuple); if (result.isNotNull() && negative) { return ((NumericDatum)result).inverseSign(); } return result; }
@Override @SuppressWarnings("unchecked") public Datum eval(Tuple tuple) { super.eval(tuple); Datum result = child.eval(tuple); if (result.isNotNull() && negative) { return ((NumericDatum)result).inverseSign(); } return result; }
@Override @SuppressWarnings("unchecked") public Datum eval(Tuple tuple) { super.eval(tuple); Datum operandDatum = child.eval(tuple); if (operandDatum.isNull()) { return operandDatum; } return DatumFactory.cast(operandDatum, target, timezone); }
@Override @SuppressWarnings("unchecked") public Datum eval(Tuple tuple) { super.eval(tuple); boolean isNull = child.eval(tuple).isNull(); return DatumFactory.createBool(isNot ^ isNull); }
@Override @SuppressWarnings("unchecked") public Datum eval(Tuple tuple) { super.eval(tuple); Datum datum = child.eval(tuple); return !datum.isNull() ? DatumFactory.createBool(!datum.asBool()) : datum; }
@Override @SuppressWarnings("unchecked") public Datum eval(Tuple tuple) { super.eval(tuple); Datum datum = child.eval(tuple); return !datum.isNull() ? DatumFactory.createBool(!datum.asBool()) : datum; }
@Override public EvalNode visitUnaryEval(LogicalPlanner.PlanContext context, UnaryEval unaryEval, Stack<EvalNode> stack) { stack.push(unaryEval); EvalNode child = visit(context, unaryEval.getChild(), stack); stack.pop(); unaryEval.setChild(child); if (child.getType() == EvalType.CONST) { // session's time zone String timezoneId = context.getQueryContext().get(SessionVars.TIMEZONE); EvalContext evalContext = new EvalContext(); evalContext.setTimeZone(TimeZone.getTimeZone(timezoneId)); unaryEval.bind(evalContext, null); return new ConstEval(unaryEval.eval(null)); } return unaryEval; }
@Override public EvalNode visitUnaryEval(LogicalPlanner.PlanContext context, UnaryEval unaryEval, Stack<EvalNode> stack) { stack.push(unaryEval); EvalNode child = visit(context, unaryEval.getChild(), stack); stack.pop(); unaryEval.setChild(child); if (child.getType() == EvalType.CONST) { // session's time zone String timezoneId = context.getQueryContext().get(SessionVars.TIMEZONE); EvalContext evalContext = new EvalContext(); evalContext.setTimeZone(TimeZone.getTimeZone(timezoneId)); unaryEval.bind(evalContext, null); return new ConstEval(unaryEval.eval(null)); } return unaryEval; }