if (ws.getOrderBy() != null) { for (OrderByItem item : ws.getOrderBy().getOrderByItems()) { if (EvaluatableVisitor.willBecomeConstant(SymbolMap.getExpression(item.getSymbol()))) { wsi.emptyOrdering = true;
@Override public void visit(WindowSpecification obj) { preVisitVisitor(obj); visitNodes(obj.getPartition()); visitNode(obj.getOrderBy()); postVisitVisitor(obj); }
if (ws.getOrderBy() != null) { for (OrderByItem item : ws.getOrderBy().getOrderByItems()) { if (EvaluatableVisitor.willBecomeConstant(SymbolMap.getExpression(item.getSymbol()))) { wsi.emptyOrdering = true;
@Override public void visit(WindowSpecification obj) { preVisitVisitor(obj); visitNodes(obj.getPartition()); visitNode(obj.getOrderBy()); visitNode(obj.getWindowFrame()); postVisitVisitor(obj); }
@Override public void visit(WindowSpecification obj) { preVisitVisitor(obj); visitNodes(obj.getPartition()); visitNode(obj.getOrderBy()); visitNode(obj.getWindowFrame()); postVisitVisitor(obj); }
@Override public void visit(WindowSpecification windowSpecification) { append(Tokens.LPAREN); boolean needsSpace = false; if (windowSpecification.getPartition() != null) { append(PARTITION); append(SPACE); append(BY); append(SPACE); registerNodes(windowSpecification.getPartition(), 0); needsSpace = true; } if (windowSpecification.getOrderBy() != null) { if (needsSpace) { append(SPACE); } append(windowSpecification.getOrderBy()); } append(Tokens.RPAREN); }
if (ws.getOrderBy() != null) { for (OrderByItem item : ws.getOrderBy().getOrderByItems()) { Expression ex1 = SymbolMap.getExpression(item.getSymbol()); Integer index = GroupingNode.getIndex(ex1, expressionIndexes);
@Override public void visit(WindowSpecification windowSpecification) { append(Tokens.LPAREN); boolean needsSpace = false; if (windowSpecification.getPartition() != null) { append(PARTITION); append(SPACE); append(BY); append(SPACE); registerNodes(windowSpecification.getPartition(), 0); needsSpace = true; } if (windowSpecification.getOrderBy() != null) { if (needsSpace) { append(SPACE); } append(windowSpecification.getOrderBy()); needsSpace = true; } if (windowSpecification.getWindowFrame() != null) { if (needsSpace) { append(SPACE); } append(windowSpecification.getWindowFrame()); } append(Tokens.RPAREN); }
@Override public void visit(WindowSpecification windowSpecification) { append(Tokens.LPAREN); boolean needsSpace = false; if (windowSpecification.getPartition() != null) { append(PARTITION); append(SPACE); append(BY); append(SPACE); registerNodes(windowSpecification.getPartition(), 0); needsSpace = true; } if (windowSpecification.getOrderBy() != null) { if (needsSpace) { append(SPACE); } append(windowSpecification.getOrderBy()); needsSpace = true; } if (windowSpecification.getWindowFrame() != null) { if (needsSpace) { append(SPACE); } append(windowSpecification.getWindowFrame()); } append(Tokens.RPAREN); }
org.teiid.language.WindowFunction translate(WindowFunction windowFunction) { org.teiid.language.WindowFunction result = new org.teiid.language.WindowFunction(); result.setFunction(translate(windowFunction.getFunction())); WindowSpecification ws = new WindowSpecification(); ws.setOrderBy(translate(windowFunction.getWindowSpecification().getOrderBy(), false)); List<Expression> partition = windowFunction.getWindowSpecification().getPartition(); if (partition != null) { ArrayList<org.teiid.language.Expression> partitionList = translateExpressionList(partition); ws.setPartition(partitionList); } result.setWindowSpecification(ws); return result; }
case DENSE_RANK: case ROW_NUMBER: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.ranking_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ case XMLAGG: case STRING_AGG: if (windowFunction.getWindowSpecification().getOrderBy() != null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.window_order_by", windowFunction), windowFunction); //$NON-NLS-1$ case LAST_VALUE: case FIRST_VALUE: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ case LEAD: case LAG: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getFunction().getOrderBy() != null || (windowFunction.getFunction().isDistinct() && windowFunction.getWindowSpecification().getOrderBy() != null)) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0042", new Object[] {windowFunction.getFunction(), windowFunction}), windowFunction); //$NON-NLS-1$
&& windowFunction.getWindowSpecification().getOrderBy() != null && !windowFunction.getFunction().isAnalytical()) { markInvalid(windowFunction, "Window function order by with aggregate not supported by source"); //$NON-NLS-1$ OrderBy orderBy = windowFunction.getWindowSpecification().getOrderBy(); if (orderBy != null) { for (OrderByItem item : orderBy.getOrderByItems()) {
&& windowFunction.getWindowSpecification().getOrderBy() != null && !(windowFunction.getFunction().isAnalytical())) { markInvalid(windowFunction, "Window function order by with aggregate not supported by source"); //$NON-NLS-1$ OrderBy orderBy = windowFunction.getWindowSpecification().getOrderBy(); if (orderBy != null) { for (OrderByItem item : orderBy.getOrderByItems()) {
&& windowFunction.getWindowSpecification().getOrderBy() != null && !(windowFunction.getFunction().isAnalytical())) { markInvalid(windowFunction, "Window function order by with aggregate not supported by source"); //$NON-NLS-1$ OrderBy orderBy = windowFunction.getWindowSpecification().getOrderBy(); if (orderBy != null) { for (OrderByItem item : orderBy.getOrderByItems()) {
org.teiid.language.WindowFunction translate(WindowFunction windowFunction) { org.teiid.language.WindowFunction result = new org.teiid.language.WindowFunction(); result.setFunction(translate(windowFunction.getFunction())); WindowSpecification ws = new WindowSpecification(); ws.setOrderBy(translate(windowFunction.getWindowSpecification().getOrderBy(), false)); List<Expression> partition = windowFunction.getWindowSpecification().getPartition(); if (partition != null) { ArrayList<org.teiid.language.Expression> partitionList = translateExpressionList(partition); ws.setPartition(partitionList); } WindowFrame frame = windowFunction.getWindowSpecification().getWindowFrame(); if (frame != null) { org.teiid.language.WindowFrame resultFrame = new org.teiid.language.WindowFrame(frame.getMode()); resultFrame.setStart(translate(frame.getStart())); resultFrame.setEnd(translate(frame.getEnd())); ws.setWindowFrame(resultFrame); } result.setWindowSpecification(ws); return result; }
case CUME_DIST: case PERCENT_RANK: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.ranking_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ case LAST_VALUE: case FIRST_VALUE: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ case LEAD: case LAG: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31286, new Object[] {windowFunction}), windowFunction); if (windowFunction.getFunction().getOrderBy() != null || (windowFunction.getFunction().isDistinct() && windowFunction.getWindowSpecification().getOrderBy() != null)) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0042", new Object[] {windowFunction.getFunction(), windowFunction}), windowFunction); //$NON-NLS-1$
org.teiid.language.WindowFunction translate(WindowFunction windowFunction) { org.teiid.language.WindowFunction result = new org.teiid.language.WindowFunction(); result.setFunction(translate(windowFunction.getFunction())); WindowSpecification ws = new WindowSpecification(); ws.setOrderBy(translate(windowFunction.getWindowSpecification().getOrderBy(), false)); List<Expression> partition = windowFunction.getWindowSpecification().getPartition(); if (partition != null) { ArrayList<org.teiid.language.Expression> partitionList = translateExpressionList(partition); ws.setPartition(partitionList); } WindowFrame frame = windowFunction.getWindowSpecification().getWindowFrame(); if (frame != null) { org.teiid.language.WindowFrame resultFrame = new org.teiid.language.WindowFrame(frame.getMode()); resultFrame.setStart(translate(frame.getStart())); resultFrame.setEnd(translate(frame.getEnd())); ws.setWindowFrame(resultFrame); } result.setWindowSpecification(ws); return result; }
case CUME_DIST: case PERCENT_RANK: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.ranking_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ case LAST_VALUE: case FIRST_VALUE: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ case LEAD: case LAG: if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_requires_order_by", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getWindowSpecification().getOrderBy() == null) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31286, new Object[] {windowFunction}), windowFunction); if (windowFunction.getFunction().getOrderBy() != null || (windowFunction.getFunction().isDistinct() && windowFunction.getWindowSpecification().getOrderBy() != null)) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0042", new Object[] {windowFunction.getFunction(), windowFunction}), windowFunction); //$NON-NLS-1$