public OrderByProcessorOrderedLimitForge( OrderByProcessorForgeImpl orderByProcessorForge, RowLimitProcessorFactoryForge rowLimitProcessorFactoryForge) { this.orderByProcessorForge = orderByProcessorForge; this.rowLimitProcessorFactoryForge = rowLimitProcessorFactoryForge; }
public OrderByProcessorRowLimitOnlyForge(RowLimitProcessorFactoryForge rowLimitProcessorFactoryForge) { this.rowLimitProcessorFactoryForge = rowLimitProcessorFactoryForge; }
public static OrderByProcessorFactoryForge GetProcessor( IList<SelectClauseExprCompiledSpec> selectionList, IList<OrderByItem> orderByList, RowLimitSpec rowLimitSpec, VariableCompileTimeResolver variableCompileTimeResolver, bool isSortUsingCollator, string optionalContextName, OrderByElementForge[][] orderByRollup) { // Get the order by expression nodes IList<ExprNode> orderByNodes = new List<ExprNode>(); foreach (var element in orderByList) { orderByNodes.Add(element.ExprNode); } // No order-by clause if (orderByList.IsEmpty()) { Log.Debug(".getProcessor Using no OrderByProcessor"); if (rowLimitSpec != null) { var rowLimitProcessorFactory = new RowLimitProcessorFactoryForge( rowLimitSpec, variableCompileTimeResolver, optionalContextName); return new OrderByProcessorRowLimitOnlyForge(rowLimitProcessorFactory); } return null; } // Determine aggregate functions used in select, if any IList<ExprAggregateNode> selectAggNodes = new List<ExprAggregateNode>(); foreach (var element in selectionList) { ExprAggregateNodeUtil.GetAggregatesBottomUp(element.SelectExpression, selectAggNodes); } // Get all the aggregate functions occuring in the order-by clause IList<ExprAggregateNode> orderAggNodes = new List<ExprAggregateNode>(); foreach (var orderByNode in orderByNodes) { ExprAggregateNodeUtil.GetAggregatesBottomUp(orderByNode, orderAggNodes); } ValidateOrderByAggregates(selectAggNodes, orderAggNodes); // Tell the order-by processor whether to compute group-by // keys if they are not present var needsGroupByKeys = !selectionList.IsEmpty() && !orderAggNodes.IsEmpty(); Log.Debug(".getProcessor Using OrderByProcessorImpl"); var elements = ToElementArray(orderByList); var comparator = GetComparator(elements, isSortUsingCollator); var orderByProcessorForge = new OrderByProcessorForgeImpl( elements, needsGroupByKeys, orderByRollup, comparator); if (rowLimitSpec == null) { return orderByProcessorForge; } { var rowLimitProcessorFactory = new RowLimitProcessorFactoryForge( rowLimitSpec, variableCompileTimeResolver, optionalContextName); return new OrderByProcessorOrderedLimitForge(orderByProcessorForge, rowLimitProcessorFactory); } }