@Override public String visitGroupByOperator(GroupByOperator op, Boolean showDetails) throws AlgebricksException { stringBuilder.setLength(0); stringBuilder.append("group by").append(op.isGroupAll() ? " (all)" : "").append(" ("); printVariableAndExprList(op.getGroupByList()); stringBuilder.append(") decor ("); printVariableAndExprList(op.getDecorList()); stringBuilder.append(")"); appendSchema(op, showDetails); appendAnnotations(op, showDetails); appendPhysicalOperatorInfo(op, showDetails); return stringBuilder.toString(); }
@Override public Long visitGroupByOperator(GroupByOperator op, Void arg) throws AlgebricksException { if (op.isGroupAll()) { return ONE; } ILogicalOperator inputOp = op.getInputs().get(0).getValue(); long inputCardinality = inputOp.accept(this, arg); List<LogicalVariable> gbyVar = op.getGbyVarList(); if (inputCardinality == ONE_GROUP && keyVariables.containsAll(gbyVar)) { keyVariables.clear(); return ONE; } if (inputCardinality == ZERO_OR_ONE_GROUP && keyVariables.containsAll(gbyVar)) { keyVariables.clear(); return ZERO_OR_ONE; } // ZERO_OR_ONE, ONE, ZERO_OR_ONE_GROUP, ONE_GROUP, OR UNKNOWN return inputCardinality; }
@Override public ILogicalOperator visitGroupByOperator(GroupByOperator op, Void arg) throws AlgebricksException { List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> groupByList = new ArrayList<>(); List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> decoList = new ArrayList<>(); ArrayList<ILogicalPlan> newSubplans = new ArrayList<>(); for (Pair<LogicalVariable, Mutable<ILogicalExpression>> pair : op.getGroupByList()) { groupByList.add(new Pair<>(pair.first, deepCopyExpressionRef(pair.second))); } for (Pair<LogicalVariable, Mutable<ILogicalExpression>> pair : op.getDecorList()) { decoList.add(new Pair<>(pair.first, deepCopyExpressionRef(pair.second))); } GroupByOperator gbyOp = new GroupByOperator(groupByList, decoList, newSubplans, op.isGroupAll()); for (ILogicalPlan plan : op.getNestedPlans()) { newSubplans.add(OperatorManipulationUtil.deepCopy(plan, gbyOp)); } return gbyOp; }
@Override public ILogicalOperator visitGroupByOperator(GroupByOperator op, ILogicalOperator arg) throws AlgebricksException { List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> groupByListCopy = deepCopyVariableExpressionReferencePairList(op.getGroupByList()); List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> decorListCopy = deepCopyVariableExpressionReferencePairList(op.getDecorList()); List<ILogicalPlan> nestedPlansCopy = new ArrayList<ILogicalPlan>(); GroupByOperator opCopy = new GroupByOperator(groupByListCopy, decorListCopy, nestedPlansCopy, op.isGroupAll()); deepCopyInputsAnnotationsAndExecutionMode(op, arg, opCopy); deepCopyPlanList(op.getNestedPlans(), nestedPlansCopy, opCopy); return opCopy; }
@Override public Void visitGroupByOperator(GroupByOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("group by" + (op.isGroupAll() ? " (all)" : "") + " ("); pprintVeList(op.getGroupByList(), indent); buffer.append(") decor ("); pprintVeList(op.getDecorList(), indent); buffer.append(") {"); printNestedPlans(op, indent); return null; }
newGbyOp.setGroupAll(gbyOp.isGroupAll()); return newGbyOp;
if (!groupOp.isGroupAll()) { return false;
ExecutionMode executionMode = gbyOp.getExecutionMode(); if (executionMode != ExecutionMode.PARTITIONED && !(executionMode == ExecutionMode.UNPARTITIONED && gbyOp.isGroupAll())) { return false;
GroupByOperator gby = (GroupByOperator) op; StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1]; if (gby.isGroupAll() && gby.isGlobal()) { if (op.getExecutionMode() == ExecutionMode.UNPARTITIONED) { pv[0] = new StructuralPropertiesVector(IPartitioningProperty.UNPARTITIONED, null);
@Override public Void visitGroupByOperator(GroupByOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("\"operator\": \"group-by\""); if (op.isGroupAll()) { buffer.append(",\n"); addIndent(indent).append("\"option\": \"all\""); } if (!op.getGroupByList().isEmpty()) { buffer.append(",\n"); addIndent(indent).append("\"group-by-list\": "); pprintVeList(op.getGroupByList(), indent); } if (!op.getDecorList().isEmpty()) { buffer.append(",\n"); addIndent(indent).append("\"decor-list\": "); pprintVeList(op.getDecorList(), indent); } if (!op.getNestedPlans().isEmpty()) { buffer.append(",\n"); addIndent(indent).append("\"subplan\": "); printNestedPlans(op, indent); } return null; }
if (!groupByOperator.isGroupAll()) { op.setPhysicalOperator(new SortGroupByPOperator(groupByOperator.getGroupByList(), context.getPhysicalOptimizationConfig().getMaxFramesForGroupBy(),
if (gbyOp.isGroupAll() && gbyOp.isGlobal()) { op.setExecutionMode(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED); forceUnpartitioned = true;
op.setPhysicalOperator(new PreclusteredGroupByPOperator(columnList, gby.isGroupAll(), context.getPhysicalOptimizationConfig().getMaxFramesForGroupBy())); op.setPhysicalOperator(new PreclusteredGroupByPOperator(columnList, gby.isGroupAll(), context.getPhysicalOptimizationConfig().getMaxFramesForGroupBy())); } else {
op.setPhysicalOperator(new PreclusteredGroupByPOperator(columnList, gby.isGroupAll(), context.getPhysicalOptimizationConfig().getMaxFramesForGroupBy())); } else {