} else if (element.rollup_list() != null) { groupSize++; groups.add(new GroupElement(GroupType.Rollup, getRowValuePredicandsFromOrdinaryGroupingSetList(element.rollup_list().c))); } else if (element.cube_list() != null) { groupSize++; groups.add(new GroupElement(GroupType.Cube, getRowValuePredicandsFromOrdinaryGroupingSetList(element.cube_list().c))); groups.set(0, new GroupElement(GroupType.OrdinaryGroup, ordinaryExprs.toArray(new Expr[ordinaryExprs.size()]))); clause.setGroups(groups.subList(0, groupSize).toArray(new GroupElement[groupSize])); } else if (groupSize > 1) {
int groupingKeyNum = aggregation.getGroupSet()[0].getGroupingSets().length; ExprNormalizedResult [] normalizedResults = new ExprNormalizedResult[groupingKeyNum]; for (int i = 0; i < groupingKeyNum; i++) { Expr groupingKey = aggregation.getGroupSet()[0].getGroupingSets()[i]; normalizedResults[i] = normalizer.normalize(context, groupingKey);
int groupingKeyNum = aggregation.getGroupSet()[0].getGroupingSets().length; ExprNormalizedResult [] normalizedResults = new ExprNormalizedResult[groupingKeyNum]; for (int i = 0; i < groupingKeyNum; i++) { Expr groupingKey = aggregation.getGroupSet()[0].getGroupingSets()[i]; normalizedResults[i] = normalizer.normalize(context, groupingKey);
} else if (element.rollup_list() != null) { groupSize++; groups.add(new GroupElement(GroupType.Rollup, getRowValuePredicandsFromOrdinaryGroupingSetList(element.rollup_list().c))); } else if (element.cube_list() != null) { groupSize++; groups.add(new GroupElement(GroupType.Cube, getRowValuePredicandsFromOrdinaryGroupingSetList(element.cube_list().c))); groups.set(0, new GroupElement(GroupType.OrdinaryGroup, ordinaryExprs.toArray(new Expr[ordinaryExprs.size()]))); clause.setGroups(groups.subList(0, groupSize).toArray(new GroupElement[groupSize])); } else if (groupSize > 1) {
@Override public Expr visitGroupBy(Context context, Stack<Expr> stack, Aggregation expr) throws TajoException { super.visitGroupBy(context, stack, expr); // Enforcer only ordinary grouping set. for (Aggregation.GroupElement groupingElement : expr.getGroupSet()) { if (groupingElement.getType() != Aggregation.GroupType.OrdinaryGroup) { context.state.addVerification(ExceptionUtil.makeNotSupported(groupingElement.getType().name())); } } Projection projection = null; for (Expr parent : stack) { if (parent.getType() == OpType.Projection) { projection = (Projection) parent; break; } } if (projection == null) { throw new TajoInternalError("No Projection"); } return expr; }
@Override public Expr visitGroupBy(Context context, Stack<Expr> stack, Aggregation expr) throws TajoException { super.visitGroupBy(context, stack, expr); // Enforcer only ordinary grouping set. for (Aggregation.GroupElement groupingElement : expr.getGroupSet()) { if (groupingElement.getType() != Aggregation.GroupType.OrdinaryGroup) { context.state.addVerification(ExceptionUtil.makeNotSupported(groupingElement.getType().name())); } } Projection projection = null; for (Expr parent : stack) { if (parent.getType() == OpType.Projection) { projection = (Projection) parent; break; } } if (projection == null) { throw new TajoInternalError("No Projection"); } return expr; }
@Override public Object clone() throws CloneNotSupportedException { Aggregation aggregation = (Aggregation) super.clone(); if (namedExprs != null) { aggregation.namedExprs = new NamedExpr[namedExprs.length]; for (int i = 0; i < namedExprs.length; i++) { aggregation.namedExprs[i] = (NamedExpr) namedExprs[i].clone(); } } if (groups != null) { aggregation.groups = new GroupElement[groups.length]; for (int i = 0; i < groups.length; i++) { aggregation.groups[i] = (GroupElement) groups[i].clone(); } } return aggregation; }
@Override public Object clone() throws CloneNotSupportedException { Aggregation aggregation = (Aggregation) super.clone(); if (namedExprs != null) { aggregation.namedExprs = new NamedExpr[namedExprs.length]; for (int i = 0; i < namedExprs.length; i++) { aggregation.namedExprs[i] = (NamedExpr) namedExprs[i].clone(); } } if (groups != null) { aggregation.groups = new GroupElement[groups.length]; for (int i = 0; i < groups.length; i++) { aggregation.groups[i] = (GroupElement) groups[i].clone(); } } return aggregation; }
public String toString() { return toJson(); }
public String toString() { return toJson(); }
@Override public RESULT visitGroupBy(CONTEXT ctx, Stack<Expr> stack, Aggregation expr) throws TajoException { stack.push(expr); for (org.apache.tajo.algebra.Aggregation.GroupElement groupElement : expr.getGroupSet()) { for (Expr groupingSet : groupElement.getGroupingSets()) { visit(ctx, stack, groupingSet); } } RESULT result = visit(ctx, stack, expr.getChild()); stack.pop(); return result; }
@Override public RESULT visitGroupBy(CONTEXT ctx, Stack<Expr> stack, Aggregation expr) throws TajoException { stack.push(expr); for (org.apache.tajo.algebra.Aggregation.GroupElement groupElement : expr.getGroupSet()) { for (Expr groupingSet : groupElement.getGroupingSets()) { visit(ctx, stack, groupingSet); } } RESULT result = visit(ctx, stack, expr.getChild()); stack.pop(); return result; }