Source:
private WindowDefinition getWindowDefinition(Optional<Window> maybeWindow, ExpressionAnalysisContext context) { if (!maybeWindow.isPresent()) { return null; } var unresolvedWindow = maybeWindow.get(); final Window window; if (unresolvedWindow.windowRef() != null) { var refWindow = resolveWindowRef(unresolvedWindow.windowRef(), context.windows()); window = unresolvedWindow.merge(refWindow); } else { window = unresolvedWindow; } List<Symbol> partitionSymbols = new ArrayList<>(window.getPartitions().size()); for (Expression partition : window.getPartitions()) { Symbol symbol = convert(partition, context); SemanticSortValidator.validate(symbol, "PARTITION BY"); partitionSymbols.add(symbol); } OrderBy orderBy = OrderyByAnalyzer.analyzeSortItems(window.getOrderBy(), sortKey -> { Symbol symbol = convert(sortKey, context); SemanticSortValidator.validate(symbol); return symbol; }); WindowFrameDefinition windowFrameDefinition = WindowDefinition.RANGE_UNBOUNDED_PRECEDING_CURRENT_ROW; if (window.getWindowFrame().isPresent()) { WindowFrame windowFrame = window.getWindowFrame().get(); WindowFrameBoundsValidator.validateFrame(window, windowFrame); FrameBound start = windowFrame.getStart(); FrameBoundDefinition startBound = convertToAnalyzedFrameBound(context, start); FrameBoundDefinition endBound = windowFrame.getEnd() .map(end -> convertToAnalyzedFrameBound(context, end)) .orElse(new FrameBoundDefinition(FrameBound.Type.CURRENT_ROW, Literal.NULL)); WindowFrameBoundsValidator.validateFrameBounds(windowFrame, startBound, endBound); windowFrameDefinition = new WindowFrameDefinition(windowFrame.mode(), startBound, endBound); } return new WindowDefinition(partitionSymbols, orderBy, windowFrameDefinition); }

Target:
private WindowDefinition getWindowDefinition(Optional<Window> maybeWindow, ExpressionAnalysisContext context) { if (!maybeWindow.isPresent()) { return null; } var unresolvedWindow = maybeWindow.get(); final Window window; if (unresolvedWindow.windowRef() != null) { var refWindow = resolveWindowRef(unresolvedWindow.windowRef(), context.windows()); window = unresolvedWindow.merge(refWindow); } else { window = unresolvedWindow; } List<Symbol> partitionSymbols = new ArrayList<>(window.getPartitions().size()); for (Expression partition : window.getPartitions()) { Symbol symbol = convert(partition, context); SemanticSortValidator.validate(symbol, "PARTITION BY"); partitionSymbols.add(symbol); } OrderBy orderBy = OrderyByAnalyzer.analyzeSortItems(window.getOrderBy(), sortKey -> { Symbol symbol = convert(sortKey, context); SemanticSortValidator.validate(symbol); return symbol; }); WindowFrameDefinition windowFrameDefinition = WindowDefinition.RANGE_UNBOUNDED_PRECEDING_CURRENT_ROW; if (window.getWindowFrame().isPresent()) { WindowFrame windowFrame = window.getWindowFrame().get(); validateFrame(window, windowFrame); FrameBound start = windowFrame.getStart(); FrameBoundDefinition startBound = convertToAnalyzedFrameBound(context, start); FrameBoundDefinition endBound = windowFrame.getEnd() .map(end -> convertToAnalyzedFrameBound(context, end)) .orElse(new FrameBoundDefinition(FrameBound.Type.CURRENT_ROW, Literal.NULL)); windowFrameDefinition = new WindowFrameDefinition(windowFrame.mode(), startBound, endBound); } return new WindowDefinition(partitionSymbols, orderBy, windowFrameDefinition); }