&& (windowFrame.getEnd() == null || windowFrame.getEnd().getBoundMode() == BoundMode.CURRENT_ROW) && windowFrame.getStart().getBound() == null && windowFrame.getStart().getBoundMode() == BoundMode.PRECEDING) { if (windowFrame.getEnd() == null || windowFrame.getEnd().getBoundMode() == BoundMode.CURRENT_ROW) {
&& (windowFrame.getEnd() == null || windowFrame.getEnd().getBoundMode() == BoundMode.CURRENT_ROW) && windowFrame.getStart().getBound() == null && windowFrame.getStart().getBoundMode() == BoundMode.PRECEDING) { if (windowFrame.getEnd() == null || windowFrame.getEnd().getBoundMode() == BoundMode.CURRENT_ROW) {
if (start.getBoundMode() == BoundMode.FOLLOWING && (start.getBound() == null || end == null)) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31283, new Object[] {windowFunction}), windowFunction); if (end.getBoundMode() == BoundMode.PRECEDING && end.getBound() == null) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31284, new Object[] {windowFunction}), windowFunction); if ((start.getBoundMode() == BoundMode.CURRENT_ROW && end.getBoundMode() == BoundMode.PRECEDING) || (start.getBoundMode() == BoundMode.FOLLOWING && end.getBoundMode() != BoundMode.FOLLOWING)) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31285, new Object[] {windowFunction}), windowFunction);
if (start.getBoundMode() == BoundMode.FOLLOWING && (start.getBound() == null || end == null)) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31283, new Object[] {windowFunction}), windowFunction); if (end.getBoundMode() == BoundMode.PRECEDING && end.getBound() == null) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31284, new Object[] {windowFunction}), windowFunction); if ((start.getBoundMode() == BoundMode.CURRENT_ROW && end.getBoundMode() == BoundMode.PRECEDING) || (start.getBoundMode() == BoundMode.FOLLOWING && end.getBoundMode() != BoundMode.FOLLOWING)) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31285, new Object[] {windowFunction}), windowFunction);
boolean processEachFrame() { for (WindowFunctionInfo info : functions) { //because getting the output is destructive, we need //to process these for each frame //TODO: udfs switch (info.function.getFunction().getAggregateFunction()) { case XMLAGG: case STRING_AGG: case JSONARRAY_AGG: case TEXTAGG: case NTH_VALUE: //the logic needs to know the frame start/end if (windowFrame == null) { //use the default frame range unbounded preceding this.windowFrame = new WindowFrame(FrameMode.RANGE); this.windowFrame.setStart(new FrameBound(BoundMode.PRECEDING)); } return true; } } return windowFrame != null && (windowFrame.getStart().getBound() != null || windowFrame.getStart().getBoundMode() == BoundMode.CURRENT_ROW || (windowFrame.getEnd() != null && windowFrame.getEnd().getBound() != null)); } }
boolean processEachFrame() { for (WindowFunctionInfo info : functions) { //because getting the output is destructive, we need //to process these for each frame //TODO: udfs switch (info.function.getFunction().getAggregateFunction()) { case XMLAGG: case STRING_AGG: case JSONARRAY_AGG: case TEXTAGG: case NTH_VALUE: //the logic needs to know the frame start/end if (windowFrame == null) { //use the default frame range unbounded preceding this.windowFrame = new WindowFrame(FrameMode.RANGE); this.windowFrame.setStart(new FrameBound(BoundMode.PRECEDING)); } return true; } } return windowFrame != null && (windowFrame.getStart().getBound() != null || windowFrame.getStart().getBoundMode() == BoundMode.CURRENT_ROW || (windowFrame.getEnd() != null && windowFrame.getEnd().getBound() != null)); } }
private void appendFrameBound(FrameBound bound) { if (bound.getBoundMode() == org.teiid.language.WindowFrame.BoundMode.CURRENT_ROW) { append(NonReserved.CURRENT); append(SPACE); append(ROW); } else { if (bound.getBound() != null) { append(bound.getBound()); } else { append(NonReserved.UNBOUNDED); } append(SPACE); append(bound.getBoundMode().name()); } }
boolean isUnboundedFollowing() { return windowFrame != null && windowFrame.getEnd() != null && windowFrame.getEnd().getBound() == null && windowFrame.getEnd().getBoundMode() == BoundMode.FOLLOWING; }
private void appendFrameBound(FrameBound bound) { if (bound.getBoundMode() == org.teiid.language.WindowFrame.BoundMode.CURRENT_ROW) { append(NonReserved.CURRENT); append(SPACE); append(ROW); } else { if (bound.getBound() != null) { append(bound.getBound()); } else { append(NonReserved.UNBOUNDED); } append(SPACE); append(bound.getBoundMode().name()); } }
Integer getWindowStartOffset() { if (windowFrame.getStart().getBoundMode() == BoundMode.CURRENT_ROW) { return 0; } if (windowFrame.getStart().getBound() == null) { return null; } return (windowFrame.getStart().getBoundMode() == BoundMode.PRECEDING?-1:1)*windowFrame.getStart().getBound(); }
org.teiid.language.WindowFrame.FrameBound translate(FrameBound frameBound) { if (frameBound == null) { return null; } org.teiid.language.WindowFrame.FrameBound result = new org.teiid.language.WindowFrame.FrameBound(frameBound.getBoundMode()); result.setBound(frameBound.getBound()); return result; }
boolean isUnboundedFollowing() { return windowFrame != null && windowFrame.getEnd() != null && windowFrame.getEnd().getBound() == null && windowFrame.getEnd().getBoundMode() == BoundMode.FOLLOWING; }
Integer getWindowEndOffset() { if (windowFrame.getEnd() == null || windowFrame.getEnd().getBoundMode() == BoundMode.CURRENT_ROW) { return 0; } if (windowFrame.getEnd().getBound() == null) { return null; } return (windowFrame.getEnd().getBoundMode() == BoundMode.PRECEDING?-1:1)*windowFrame.getEnd().getBound(); }
Integer getWindowStartOffset() { if (windowFrame.getStart().getBoundMode() == BoundMode.CURRENT_ROW) { return 0; } if (windowFrame.getStart().getBound() == null) { return null; } return (windowFrame.getStart().getBoundMode() == BoundMode.PRECEDING?-1:1)*windowFrame.getStart().getBound(); }
org.teiid.language.WindowFrame.FrameBound translate(FrameBound frameBound) { if (frameBound == null) { return null; } org.teiid.language.WindowFrame.FrameBound result = new org.teiid.language.WindowFrame.FrameBound(frameBound.getBoundMode()); result.setBound(frameBound.getBound()); return result; }
Integer getWindowEndOffset() { if (windowFrame.getEnd() == null || windowFrame.getEnd().getBoundMode() == BoundMode.CURRENT_ROW) { return 0; } if (windowFrame.getEnd().getBound() == null) { return null; } return (windowFrame.getEnd().getBoundMode() == BoundMode.PRECEDING?-1:1)*windowFrame.getEnd().getBound(); }