1 | /* | |
2 | * Copyright OpenSearch Contributors | |
3 | * SPDX-License-Identifier: Apache-2.0 | |
4 | */ | |
5 | ||
6 | ||
7 | package org.opensearch.sql.planner.logical; | |
8 | ||
9 | import java.util.Collections; | |
10 | import lombok.EqualsAndHashCode; | |
11 | import lombok.Getter; | |
12 | import lombok.ToString; | |
13 | import org.opensearch.sql.expression.NamedExpression; | |
14 | import org.opensearch.sql.expression.window.WindowDefinition; | |
15 | ||
16 | /** | |
17 | * Logical operator for window function generated from project list. Logically, each window operator | |
18 | * has to work with a Sort operator to ensure input data is sorted as required by window definition. | |
19 | * However, the Sort operator may be removed after logical optimization. | |
20 | */ | |
21 | @EqualsAndHashCode(callSuper = true) | |
22 | @Getter | |
23 | @ToString | |
24 | public class LogicalWindow extends LogicalPlan { | |
25 | private final NamedExpression windowFunction; | |
26 | private final WindowDefinition windowDefinition; | |
27 | ||
28 | /** | |
29 | * Constructor of logical window. | |
30 | */ | |
31 | public LogicalWindow( | |
32 | LogicalPlan child, | |
33 | NamedExpression windowFunction, | |
34 | WindowDefinition windowDefinition) { | |
35 | super(Collections.singletonList(child)); | |
36 | this.windowFunction = windowFunction; | |
37 | this.windowDefinition = windowDefinition; | |
38 | } | |
39 | ||
40 | @Override | |
41 | public <R, C> R accept(LogicalPlanNodeVisitor<R, C> visitor, C context) { | |
42 |
1
1. accept : replaced return value with null for org/opensearch/sql/planner/logical/LogicalWindow::accept → KILLED |
return visitor.visitWindow(this, context); |
43 | } | |
44 | ||
45 | } | |
Mutations | ||
42 |
1.1 |