boolean samePartition = GroupingNode.sameGroup(partitionIndexes, tuple, lastRow) == -1; if (!samePartition || (!info.isUnboundedFollowing() && ((info.windowFrame != null && info.windowFrame.getMode() == FrameMode.ROWS) || GroupingNode.sameGroup(orderIndexes, tuple, lastRow) != -1))) { saveValues(specIndex, aggs, groupId, samePartition);
boolean samePartition = GroupingNode.sameGroup(partitionIndexes, tuple, lastRow) == -1; if (!samePartition || (!info.isUnboundedFollowing() && ((info.windowFrame != null && info.windowFrame.getMode() == FrameMode.ROWS) || GroupingNode.sameGroup(orderIndexes, tuple, lastRow) != -1))) { saveValues(specIndex, aggs, groupId, samePartition);
lastRow = null; groupId++; } else if (info.windowFrame.getMode() == FrameMode.ROWS || GroupingNode.sameGroup(orderIndexes, tuple, lastRow) != -1) { groupId++; end = currentIndex + frameEndOffset; if (info.windowFrame.getMode() == FrameMode.RANGE) { Assertion.assertTrue(frameEndOffset.intValue() == 0); for (long i = end + 1; i <= endPartition; i++) {
lastRow = null; groupId++; } else if (info.windowFrame.getMode() == FrameMode.ROWS || GroupingNode.sameGroup(orderIndexes, tuple, lastRow) != -1) { groupId++; end = currentIndex + frameEndOffset; if (info.windowFrame.getMode() == FrameMode.RANGE) { Assertion.assertTrue(frameEndOffset.intValue() == 0); for (long i = end + 1; i <= endPartition; i++) {
@Override public void visit(WindowFrame windowFrame) { append(windowFrame.getMode().name()); append(SPACE); if (windowFrame.getEnd() != null) { append(Reserved.BETWEEN); append(SPACE); } appendFrameBound(windowFrame.getStart()); if (windowFrame.getEnd() != null) { append(SPACE); append(Reserved.AND); append(SPACE); appendFrameBound(windowFrame.getEnd()); } }
@Override public void visit(WindowFrame windowFrame) { append(windowFrame.getMode().name()); append(SPACE); if (windowFrame.getEnd() != null) { append(Reserved.BETWEEN); append(SPACE); } appendFrameBound(windowFrame.getStart()); if (windowFrame.getEnd() != null) { append(SPACE); append(Reserved.AND); append(SPACE); appendFrameBound(windowFrame.getEnd()); } }
windowFrame.setEnd(new FrameBound(BoundMode.CURRENT_ROW)); if (windowFrame.getMode() == FrameMode.RANGE && (windowFrame.getEnd() == null || windowFrame.getEnd().getBoundMode() == BoundMode.CURRENT_ROW) && windowFrame.getStart().getBound() == null && windowFrame.getStart().getBoundMode() == BoundMode.PRECEDING) {
windowFrame.setEnd(new FrameBound(BoundMode.CURRENT_ROW)); if (windowFrame.getMode() == FrameMode.RANGE && (windowFrame.getEnd() == null || windowFrame.getEnd().getBoundMode() == BoundMode.CURRENT_ROW) && windowFrame.getStart().getBound() == null && windowFrame.getStart().getBoundMode() == BoundMode.PRECEDING) {
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; }
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; }
if (frame.getMode() == FrameMode.RANGE && (start.getBound() != null || (end != null && end.getBound() != null))) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31288, new Object[] {windowFunction}), windowFunction);
if (frame.getMode() == FrameMode.RANGE && (start.getBound() != null || (end != null && end.getBound() != null))) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31288, new Object[] {windowFunction}), windowFunction);