@Override public EvalNode visitUnaryEval(EvalTreeProtoBuilderContext context, UnaryEval unary, Stack<EvalNode> stack) { // visiting and registering childs super.visitUnaryEval(context, unary, stack); int [] childIds = registerGetChildIds(context, unary); // building itself PlanProto.UnaryEval.Builder unaryBuilder = PlanProto.UnaryEval.newBuilder(); unaryBuilder.setChildId(childIds[0]); if (unary.getType() == EvalType.IS_NULL) { IsNullEval isNullEval = (IsNullEval) unary; unaryBuilder.setNegative(isNullEval.isNot()); } else if (unary.getType() == EvalType.SIGNED) { SignedEval signedEval = (SignedEval) unary; unaryBuilder.setNegative(signedEval.isNegative()); } else if (unary.getType() == EvalType.CAST) { CastEval castEval = (CastEval) unary; unaryBuilder.setCastingType(castEval.getValueType()); } // registering itself and building EvalNode PlanProto.EvalNode.Builder builder = createEvalBuilder(context, unary); builder.setUnary(unaryBuilder); context.treeBuilder.addNodes(builder); return unary; }
@Override public EvalNode visitUnaryEval(EvalTreeProtoBuilderContext context, UnaryEval unary, Stack<EvalNode> stack) { // visiting and registering childs super.visitUnaryEval(context, unary, stack); int [] childIds = registerGetChildIds(context, unary); // building itself PlanProto.UnaryEval.Builder unaryBuilder = PlanProto.UnaryEval.newBuilder(); unaryBuilder.setChildId(childIds[0]); if (unary.getType() == EvalType.IS_NULL) { IsNullEval isNullEval = (IsNullEval) unary; unaryBuilder.setNegative(isNullEval.isNot()); } else if (unary.getType() == EvalType.SIGNED) { SignedEval signedEval = (SignedEval) unary; unaryBuilder.setNegative(signedEval.isNegative()); } else if (unary.getType() == EvalType.CAST) { CastEval castEval = (CastEval) unary; unaryBuilder.setCastingType(castEval.getValueType().getProto()); } // registering itself and building EvalNode PlanProto.EvalNode.Builder builder = createEvalBuilder(context, unary); builder.setUnary(unaryBuilder); context.treeBuilder.addNodes(builder); return unary; }
public EvalNode visitCast(EvalCodeGenContext context, Stack<EvalNode> stack, CastEval cast) { DataType srcType = cast.getOperand().getValueType(); DataType targetType = cast.getValueType(); if (srcType.equals(targetType)) { visit(context, cast.getChild(), stack); return cast; } visit(context, cast.getChild(), stack); Label ifNull = new Label(); Label afterEnd = new Label(); context.emitNullityCheck(ifNull); context.castInsn(srcType, targetType); context.pushNullFlag(true); emitGotoLabel(context, afterEnd); emitLabel(context, ifNull); context.pop(srcType); context.pushDummyValue(targetType); context.pushNullFlag(false); emitLabel(context, afterEnd); return cast; }
public EvalNode visitCast(EvalCodeGenContext context, Stack<EvalNode> stack, CastEval cast) { org.apache.tajo.type.Type srcType = cast.getOperand().getValueType(); org.apache.tajo.type.Type targetType = cast.getValueType(); if (srcType.equals(targetType)) { visit(context, cast.getChild(), stack); return cast; } visit(context, cast.getChild(), stack); Label ifNull = new Label(); Label afterEnd = new Label(); context.emitNullityCheck(ifNull); context.castInsn(srcType, targetType); context.pushNullFlag(true); emitGotoLabel(context, afterEnd); emitLabel(context, ifNull); context.pop(srcType); context.pushDummyValue(targetType); context.pushNullFlag(false); emitLabel(context, afterEnd); return cast; }