public List<Integer> normalize(PlanContext context, Projection projection, ExprNormalizedResult [] normalizedExprList, Matcher matcher) throws TajoException { List<Integer> targetIds = new ArrayList<>(); for (int i = 0; i < projection.size(); i++) { NamedExpr namedExpr = projection.getNamedExprs().get(i); if (PlannerUtil.existsAggregationFunction(namedExpr)) { context.queryBlock.setAggregationRequire(); } if (matcher.isMatch(namedExpr.getExpr())) { // If a value is constant value, it adds the constant value with a proper name to the constant map // of the current block if (!namedExpr.hasAlias() && OpType.isLiteralType(namedExpr.getExpr().getType())) { String generatedName = context.plan.generateUniqueColumnName(namedExpr.getExpr()); ConstEval constEval = (ConstEval) exprAnnotator.createEvalNode(context, namedExpr.getExpr(), NameResolvingMode.RELS_ONLY); context.getQueryBlock().addConstReference(generatedName, namedExpr.getExpr(), constEval); normalizedExprList[i] = new ExprNormalizedResult(context, false); normalizedExprList[i].baseExpr = new ColumnReferenceExpr(generatedName); } else { // dissect an expression into multiple parts (at most dissected into three parts) normalizedExprList[i] = normalizer.normalize(context, namedExpr.getExpr()); } targetIds.add(i); } } return targetIds; }
public List<Integer> normalize(PlanContext context, Projection projection, ExprNormalizedResult [] normalizedExprList, Matcher matcher) throws TajoException { List<Integer> targetIds = new ArrayList<Integer>(); for (int i = 0; i < projection.size(); i++) { NamedExpr namedExpr = projection.getNamedExprs()[i]; if (PlannerUtil.existsAggregationFunction(namedExpr)) { context.queryBlock.setAggregationRequire(); } if (matcher.isMatch(namedExpr.getExpr())) { // If a value is constant value, it adds the constant value with a proper name to the constant map // of the current block if (!namedExpr.hasAlias() && OpType.isLiteralType(namedExpr.getExpr().getType())) { String generatedName = context.plan.generateUniqueColumnName(namedExpr.getExpr()); ConstEval constEval = (ConstEval) exprAnnotator.createEvalNode(context, namedExpr.getExpr(), NameResolvingMode.RELS_ONLY); context.getQueryBlock().addConstReference(generatedName, namedExpr.getExpr(), constEval); normalizedExprList[i] = new ExprNormalizedResult(context, false); normalizedExprList[i].baseExpr = new ColumnReferenceExpr(generatedName); } else { // dissect an expression into multiple parts (at most dissected into three parts) normalizedExprList[i] = normalizer.normalize(context, namedExpr.getExpr()); } targetIds.add(i); } } return targetIds; }
Expr constExpr = namedExpr.getExpr(); ConstEval constEval = (ConstEval) annotator.createEvalNode(ctx, constExpr, NameResolvingMode.RELS_ONLY, true); ctx.getQueryBlock().addConstReference(namedExpr.getAlias(), constExpr, constEval);
Expr constExpr = namedExpr.getExpr(); ConstEval constEval = (ConstEval) annotator.createEvalNode(ctx, constExpr, NameResolvingMode.RELS_ONLY, true); ctx.getQueryBlock().addConstReference(namedExpr.getAlias(), constExpr, constEval);