Skip to content

Commit 81bf657

Browse files
committed
Revert "Applying Google Java code format changes to core/src/main/java/org/opensearch/sql/planner core/src/main/java/org/opensearch/sql/storage core/src/main/java/org/opensearch/sql/utils"
This reverts commit 8bb4117.
1 parent c800a64 commit 81bf657

File tree

87 files changed

+1160
-747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1160
-747
lines changed

core/src/main/java/org/opensearch/sql/planner/DefaultImplementor.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@
4545

4646
/**
4747
* Default implementor for implementing logical to physical translation. "Default" here means all
48-
* logical operator will be translated to correspondent physical operator to pipeline operations in
49-
* post-processing style in memory. Different storage can override methods here to optimize default
50-
* pipelining operator, for example a storage has the flexibility to override visitFilter and
51-
* visitRelation to push down filtering operation and return a single physical index scan operator.
48+
* logical operator will be translated to correspondent physical operator to pipeline operations
49+
* in post-processing style in memory.
50+
* Different storage can override methods here to optimize default pipelining operator, for example
51+
* a storage has the flexibility to override visitFilter and visitRelation to push down filtering
52+
* operation and return a single physical index scan operator.
5253
*
53-
* @param <C> context type
54+
* @param <C> context type
5455
*/
5556
public class DefaultImplementor<C> extends LogicalPlanNodeVisitor<PhysicalPlan, C> {
5657

@@ -61,7 +62,8 @@ public PhysicalPlan visitRareTopN(LogicalRareTopN node, C context) {
6162
node.getCommandType(),
6263
node.getNoOfResults(),
6364
node.getFieldList(),
64-
node.getGroupByList());
65+
node.getGroupByList()
66+
);
6567
}
6668

6769
@Override
@@ -76,14 +78,16 @@ public PhysicalPlan visitDedupe(LogicalDedupe node, C context) {
7678

7779
@Override
7880
public PhysicalPlan visitProject(LogicalProject node, C context) {
79-
return new ProjectOperator(
80-
visitChild(node, context), node.getProjectList(), node.getNamedParseExpressions());
81+
return new ProjectOperator(visitChild(node, context), node.getProjectList(),
82+
node.getNamedParseExpressions());
8183
}
8284

8385
@Override
8486
public PhysicalPlan visitWindow(LogicalWindow node, C context) {
8587
return new WindowOperator(
86-
visitChild(node, context), node.getWindowFunction(), node.getWindowDefinition());
88+
visitChild(node, context),
89+
node.getWindowFunction(),
90+
node.getWindowDefinition());
8791
}
8892

8993
@Override
@@ -144,9 +148,8 @@ public PhysicalPlan visitTableWriteBuilder(TableWriteBuilder plan, C context) {
144148

145149
@Override
146150
public PhysicalPlan visitRelation(LogicalRelation node, C context) {
147-
throw new UnsupportedOperationException(
148-
"Storage engine is responsible for "
149-
+ "implementing and optimizing logical plan with relation involved");
151+
throw new UnsupportedOperationException("Storage engine is responsible for "
152+
+ "implementing and optimizing logical plan with relation involved");
150153
}
151154

152155
@Override

core/src/main/java/org/opensearch/sql/planner/PlanContext.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
import lombok.Getter;
1010
import org.opensearch.sql.storage.split.Split;
1111

12-
/** Plan context hold planning related information. */
12+
/**
13+
* Plan context hold planning related information.
14+
*/
1315
public class PlanContext {
1416

15-
@Getter private final Optional<Split> split;
17+
@Getter
18+
private final Optional<Split> split;
1619

1720
public PlanContext(Split split) {
1821
this.split = Optional.of(split);

core/src/main/java/org/opensearch/sql/planner/PlanNode.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
67
package org.opensearch.sql.planner;
78

89
import java.util.List;
910

10-
/** The definition of Plan Node. */
11+
/**
12+
* The definition of Plan Node.
13+
*/
1114
public interface PlanNode<T extends PlanNode> {
1215

1316
/**

core/src/main/java/org/opensearch/sql/planner/Planner.java

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
67
package org.opensearch.sql.planner;
78

9+
810
import java.util.List;
911
import lombok.RequiredArgsConstructor;
1012
import org.opensearch.sql.planner.logical.LogicalPlan;
@@ -14,16 +16,18 @@
1416
import org.opensearch.sql.planner.physical.PhysicalPlan;
1517
import org.opensearch.sql.storage.Table;
1618

17-
/** Planner that plans and chooses the optimal physical plan. */
19+
/**
20+
* Planner that plans and chooses the optimal physical plan.
21+
*/
1822
@RequiredArgsConstructor
1923
public class Planner {
2024

2125
private final LogicalPlanOptimizer logicalOptimizer;
2226

2327
/**
24-
* Generate optimal physical plan for logical plan. If no table involved, translate logical plan
25-
* to physical by default implementor. TODO: for now just delegate entire logical plan to storage
26-
* engine.
28+
* Generate optimal physical plan for logical plan. If no table involved,
29+
* translate logical plan to physical by default implementor.
30+
* TODO: for now just delegate entire logical plan to storage engine.
2731
*
2832
* @param plan logical plan
2933
* @return optimal physical plan
@@ -33,28 +37,28 @@ public PhysicalPlan plan(LogicalPlan plan) {
3337
if (table == null) {
3438
return plan.accept(new DefaultImplementor<>(), null);
3539
}
36-
return table.implement(table.optimize(optimize(plan)));
40+
return table.implement(
41+
table.optimize(optimize(plan)));
3742
}
3843

3944
private Table findTable(LogicalPlan plan) {
40-
return plan.accept(
41-
new LogicalPlanNodeVisitor<Table, Object>() {
42-
43-
@Override
44-
public Table visitNode(LogicalPlan node, Object context) {
45-
List<LogicalPlan> children = node.getChild();
46-
if (children.isEmpty()) {
47-
return null;
48-
}
49-
return children.get(0).accept(this, context);
50-
}
51-
52-
@Override
53-
public Table visitRelation(LogicalRelation node, Object context) {
54-
return node.getTable();
55-
}
56-
},
57-
null);
45+
return plan.accept(new LogicalPlanNodeVisitor<Table, Object>() {
46+
47+
@Override
48+
public Table visitNode(LogicalPlan node, Object context) {
49+
List<LogicalPlan> children = node.getChild();
50+
if (children.isEmpty()) {
51+
return null;
52+
}
53+
return children.get(0).accept(this, context);
54+
}
55+
56+
@Override
57+
public Table visitRelation(LogicalRelation node, Object context) {
58+
return node.getTable();
59+
}
60+
61+
}, null);
5862
}
5963

6064
private LogicalPlan optimize(LogicalPlan plan) {

core/src/main/java/org/opensearch/sql/planner/SerializablePlan.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,36 @@
1010
/**
1111
* All subtypes of PhysicalPlan which needs to be serialized (in cursor, for pagination feature)
1212
* should follow one of the following options.
13-
*
1413
* <ul>
1514
* <li>Both:
16-
* <ul>
17-
* <li>Override both methods from {@link Externalizable}.
18-
* <li>Define a public no-arg constructor.
19-
* </ul>
20-
* <li>Overwrite {@link #getPlanForSerialization} to return another instance of {@link
21-
* SerializablePlan}.
15+
* <ul>
16+
* <li>Override both methods from {@link Externalizable}.</li>
17+
* <li>Define a public no-arg constructor.</li>
18+
* </ul>
19+
* </li>
20+
* <li>
21+
* Overwrite {@link #getPlanForSerialization} to return
22+
* another instance of {@link SerializablePlan}.
23+
* </li>
2224
* </ul>
2325
*/
2426
public interface SerializablePlan extends Externalizable {
2527

2628
/**
27-
* Override to return child or delegated plan, so parent plan should skip this one for
28-
* serialization, but it should try to serialize grandchild plan. Imagine plan structure like this
29-
*
29+
* Override to return child or delegated plan, so parent plan should skip this one
30+
* for serialization, but it should try to serialize grandchild plan.
31+
* Imagine plan structure like this
3032
* <pre>
3133
* A -> this
3234
* `- B -> child
3335
* `- C -> this
3436
* </pre>
37+
* In that case only plans A and C should be attempted to serialize.
38+
* It is needed to skip a `ResourceMonitorPlan` instance only, actually.
3539
*
36-
* In that case only plans A and C should be attempted to serialize. It is needed to skip a
37-
* `ResourceMonitorPlan` instance only, actually.
38-
*
39-
* <pre>{@code
40-
* * A.writeObject(B.getPlanForSerialization());
41-
*
42-
* }</pre>
43-
*
40+
* <pre>{@code
41+
* * A.writeObject(B.getPlanForSerialization());
42+
* }</pre>
4443
* @return Next plan for serialization.
4544
*/
4645
default SerializablePlan getPlanForSerialization() {

core/src/main/java/org/opensearch/sql/planner/logical/LogicalAD.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class LogicalAD extends LogicalPlan {
1818

1919
/**
2020
* Constructor of LogicalAD.
21-
*
2221
* @param child child logical plan
2322
* @param arguments arguments of the algorithm
2423
*/

core/src/main/java/org/opensearch/sql/planner/logical/LogicalAggregation.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
67
package org.opensearch.sql.planner.logical;
78

89
import java.util.Collections;
@@ -13,18 +14,26 @@
1314
import org.opensearch.sql.expression.NamedExpression;
1415
import org.opensearch.sql.expression.aggregation.NamedAggregator;
1516

16-
/** Logical Aggregation. */
17+
/**
18+
* Logical Aggregation.
19+
*/
1720
@ToString
1821
@EqualsAndHashCode(callSuper = true)
1922
public class LogicalAggregation extends LogicalPlan {
2023

21-
@Getter private final List<NamedAggregator> aggregatorList;
24+
@Getter
25+
private final List<NamedAggregator> aggregatorList;
2226

23-
@Getter private final List<NamedExpression> groupByList;
27+
@Getter
28+
private final List<NamedExpression> groupByList;
2429

25-
/** Constructor of LogicalAggregation. */
30+
/**
31+
* Constructor of LogicalAggregation.
32+
*/
2633
public LogicalAggregation(
27-
LogicalPlan child, List<NamedAggregator> aggregatorList, List<NamedExpression> groupByList) {
34+
LogicalPlan child,
35+
List<NamedAggregator> aggregatorList,
36+
List<NamedExpression> groupByList) {
2837
super(Collections.singletonList(child));
2938
this.aggregatorList = aggregatorList;
3039
this.groupByList = groupByList;

core/src/main/java/org/opensearch/sql/planner/logical/LogicalCloseCursor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import lombok.ToString;
1111

1212
/**
13-
* A logical plan node which wraps {@link org.opensearch.sql.planner.LogicalCursor} and represent a
14-
* cursor close operation.
13+
* A logical plan node which wraps {@link org.opensearch.sql.planner.LogicalCursor}
14+
* and represent a cursor close operation.
1515
*/
1616
@ToString
1717
@EqualsAndHashCode(callSuper = false)

core/src/main/java/org/opensearch/sql/planner/logical/LogicalDedupe.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
67
package org.opensearch.sql.planner.logical;
78

89
import java.util.Arrays;
@@ -12,7 +13,9 @@
1213
import lombok.ToString;
1314
import org.opensearch.sql.expression.Expression;
1415

15-
/** Logical Dedupe Plan. */
16+
/**
17+
* Logical Dedupe Plan.
18+
*/
1619
@Getter
1720
@ToString
1821
@EqualsAndHashCode(callSuper = true)
@@ -23,12 +26,12 @@ public class LogicalDedupe extends LogicalPlan {
2326
private final Boolean keepEmpty;
2427
private final Boolean consecutive;
2528

26-
/** Constructor of LogicalDedupe. */
29+
/**
30+
* Constructor of LogicalDedupe.
31+
*/
2732
public LogicalDedupe(
2833
LogicalPlan child,
29-
List<Expression> dedupeList,
30-
Integer allowedDuplication,
31-
Boolean keepEmpty,
34+
List<Expression> dedupeList, Integer allowedDuplication, Boolean keepEmpty,
3235
Boolean consecutive) {
3336
super(Arrays.asList(child));
3437
this.dedupeList = dedupeList;

core/src/main/java/org/opensearch/sql/planner/logical/LogicalEval.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
67
package org.opensearch.sql.planner.logical;
78

89
import java.util.Collections;
@@ -23,10 +24,15 @@
2324
@EqualsAndHashCode(callSuper = true)
2425
public class LogicalEval extends LogicalPlan {
2526

26-
@Getter private final List<Pair<ReferenceExpression, Expression>> expressions;
27+
@Getter
28+
private final List<Pair<ReferenceExpression, Expression>> expressions;
2729

28-
/** Constructor of LogicalEval. */
29-
public LogicalEval(LogicalPlan child, List<Pair<ReferenceExpression, Expression>> expressions) {
30+
/**
31+
* Constructor of LogicalEval.
32+
*/
33+
public LogicalEval(
34+
LogicalPlan child,
35+
List<Pair<ReferenceExpression, Expression>> expressions) {
3036
super(Collections.singletonList(child));
3137
this.expressions = expressions;
3238
}

core/src/main/java/org/opensearch/sql/planner/logical/LogicalFetchCursor.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,25 @@
99
import lombok.EqualsAndHashCode;
1010
import lombok.Getter;
1111
import lombok.ToString;
12+
import org.opensearch.sql.planner.logical.LogicalPlan;
13+
import org.opensearch.sql.planner.logical.LogicalPlanNodeVisitor;
1214
import org.opensearch.sql.storage.StorageEngine;
1315

14-
/** A plan node which represents operation of fetching a next page from the cursor. */
16+
/**
17+
* A plan node which represents operation of fetching a next page from the cursor.
18+
*/
1519
@EqualsAndHashCode(callSuper = false)
1620
@ToString
1721
public class LogicalFetchCursor extends LogicalPlan {
18-
@Getter private final String cursor;
22+
@Getter
23+
private final String cursor;
1924

20-
@Getter private final StorageEngine engine;
25+
@Getter
26+
private final StorageEngine engine;
2127

22-
/** LogicalCursor constructor. Does not have child plans. */
28+
/**
29+
* LogicalCursor constructor. Does not have child plans.
30+
*/
2331
public LogicalFetchCursor(String cursor, StorageEngine engine) {
2432
super(List.of());
2533
this.cursor = cursor;

0 commit comments

Comments
 (0)