private long getWindowRequiredMemory(WindowOperator op) { WindowPOperator physOp = (WindowPOperator) op.getPhysicalOperator(); int frameCount = 2; if (physOp.isPartitionMaterialization()) { frameCount++; } if (op.hasNestedPlans()) { frameCount += 2; } return getOperatorRequiredMemory(op, frameSize * frameCount); } }
stringBuilder.append(") order by ("); printOrderExprList(op.getOrderExpressions()); if (op.hasNestedPlans()) { stringBuilder.append(") frame on ("); printOrderExprList(op.getFrameValueExpressions());
return false; if (winOp1.hasNestedPlans() && winOp2.hasNestedPlans() && !IsomorphismOperatorVisitor.compareWindowFrameSpec(winOp1, winOp2)) { return false; if (winOp2.hasNestedPlans() && !consolidateNestedPlans(winOp1, winOp2, context)) { return false;
@Override public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (context.checkIfInDontApplySet(this, op)) { return false; } // Disable aggregate combiners for nested plans inside window operators if (op.getOperatorTag() == LogicalOperatorTag.WINDOW) { WindowOperator winOp = (WindowOperator) op; if (winOp.hasNestedPlans()) { for (ILogicalPlan plan : winOp.getNestedPlans()) { for (Mutable<ILogicalOperator> root : plan.getRoots()) { ILogicalOperator rootOp = root.getValue(); if (rootOp.getOperatorTag() == LogicalOperatorTag.AGGREGATE) { context.addToDontApplySet(this, rootOp); } } } } } return false; }
orderColumns.add(new OrderColumn(var, p.first.getKind())); boolean partitionMaterialization = winOp.hasNestedPlans(); if (!partitionMaterialization) { for (Mutable<ILogicalExpression> exprRef : winOp.getExpressions()) {
pprintOrderList(op.getOrderExpressions(), indent); if (op.hasNestedPlans()) { buffer.append(" frame on "); pprintOrderList(op.getFrameValueExpressions(), indent);
private boolean consolidateNestedPlans(WindowOperator winOpTo, WindowOperator winOpFrom, IOptimizationContext context) throws AlgebricksException { if (winOpTo.hasNestedPlans()) { AggregateOperator aggTo = getAggregateRoot(winOpTo.getNestedPlans()); if (aggTo == null) { return false; } AggregateOperator aggFrom = getAggregateRoot(winOpFrom.getNestedPlans()); if (aggFrom == null) { return false; } if (!IsomorphismUtilities.isOperatorIsomorphicPlanSegment(aggTo.getInputs().get(0).getValue(), aggFrom.getInputs().get(0).getValue())) { return false; } aggTo.getVariables().addAll(aggFrom.getVariables()); aggTo.getExpressions().addAll(aggFrom.getExpressions()); context.computeAndSetTypeEnvironmentForOperator(aggTo); } else { setAll(winOpTo.getNestedPlans(), winOpFrom.getNestedPlans()); setAll(winOpTo.getFrameValueExpressions(), winOpFrom.getFrameValueExpressions()); setAll(winOpTo.getFrameStartExpressions(), winOpFrom.getFrameStartExpressions()); setAll(winOpTo.getFrameEndExpressions(), winOpFrom.getFrameEndExpressions()); setAll(winOpTo.getFrameExcludeExpressions(), winOpFrom.getFrameExcludeExpressions()); winOpTo.setFrameExcludeNegationStartIdx(winOpFrom.getFrameExcludeNegationStartIdx()); winOpTo.getFrameOffset().setValue(winOpFrom.getFrameOffset().getValue()); winOpTo.setFrameMaxObjects(winOpFrom.getFrameMaxObjects()); } return true; }
pprintOrderExprList(op.getOrderExpressions(), -1, indent); if (op.hasNestedPlans()) { buffer.append(",\n"); addIndent(indent).append("\"frame on\": ");
if (winOp.hasNestedPlans()) { int opSchemaSizePreSubplans = opSchema.getSize(); AlgebricksPipeline[] subplans = compileSubplans(inputSchemas[0], winOp, opSchema, context);