Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spotless] Applying Google Code Format for core/src/main files #2 #313

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ repositories {
// Spotless checks will be added as PRs are applied to resolve each style issue is approved.
spotless {
java {
// target fileTree('.') {
// include '**/*.java', 'src/*/java/**/*.java'
// exclude '**/build/**', '**/build-*/**'
// }
target fileTree('.') {
include 'core/src/main/java/org/opensearch/sql/monitor/*.java',
'core/src/main/java/org/opensearch/sql/expression/*.java',
'core/src/main/java/org/opensearch/sql/executor/*.java'
'core/src/main/java/org/opensearch/sql/exception/*.java'
exclude '**/build/**', '**/build-*/**'
}
// importOrder()
// licenseHeader("/*\n" +
// " * Copyright OpenSearch Contributors\n" +
Expand All @@ -95,7 +98,7 @@ spotless {
// removeUnusedImports()
// trimTrailingWhitespace()
// endWithNewline()
// googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
}
}

Expand Down
3 changes: 3 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ repositories {
mavenCentral()
}

checkstyleTest.ignoreFailures = true
checkstyleMain.ignoreFailures = true

pitest {
targetClasses = ['org.opensearch.sql.*']
pitestVersion = '1.9.0'
Expand Down
16 changes: 8 additions & 8 deletions core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already included this file in part 1 in #312

Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ public static Function function(String funcName, UnresolvedExpression... funcArg
}

/**
* CASE
* WHEN search_condition THEN result_expr
* [WHEN search_condition THEN result_expr] ...
* [ELSE result_expr]
* CASE<br>
* WHEN search_condition THEN result_expr<br>
* [WHEN search_condition THEN result_expr] ...<br>
* [ELSE result_expr]<br>
* END
*/
public UnresolvedExpression caseWhen(UnresolvedExpression elseClause,
Expand All @@ -261,10 +261,10 @@ public UnresolvedExpression caseWhen(UnresolvedExpression elseClause,
}

/**
* CASE case_value_expr
* WHEN compare_expr THEN result_expr
* [WHEN compare_expr THEN result_expr] ...
* [ELSE result_expr]
* CASE case_value_expr<br>
* WHEN compare_expr THEN result_expr<br>
* [WHEN compare_expr THEN result_expr] ...<br>
* [ELSE result_expr]<br>
* END
*/
public UnresolvedExpression caseWhen(UnresolvedExpression caseValueExpr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.opensearch.sql.common.utils.StringUtils;

/**
* Expression node of aggregate functions.
* Expression node of aggregate functions.<br>
* Params include aggregate function name (AVG, SUM, MAX etc.) and the field to aggregate.
*/
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


/**
* Expression node of scalar function.
* Expression node of scalar function.<br>
* Params include function name (@funcName) and function arguments (@funcArgs)
*/
@Getter
Expand Down

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also present in #312 with other changes

Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ public Optional<String> first() {

/**
* Get rest parts of the qualified name. Assume that there must be remaining parts
* so caller is responsible for the check (first() or size() must be called first).
* For example:
* {@code
* QualifiedName name = ...
* Optional<String> first = name.first();
* if (first.isPresent()) {
* name.rest() ...
* }
* so caller is responsible for the check (first() or size() must be called first).<br>
* For example:<br>
* {@code<br>
* &ensp; QualifiedName name = ...<br>
* &ensp; Optional<String> first = name.first();<br>
* &ensp; if (first.isPresent()) {<br>
* &emsp; name.rest() ...<br>
* &ensp; }<br>
* }
* @return rest part(s)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.exception;

/**
* Exception for Expression Evaluation.
*/
/** Exception for Expression Evaluation. */
public class ExpressionEvaluationException extends QueryEngineException {
public ExpressionEvaluationException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
package org.opensearch.sql.exception;

/**
* This should be thrown on serialization of a PhysicalPlan tree if paging is finished.
* Processing of such exception should outcome of responding no cursor to the user.
* This should be thrown on serialization of a PhysicalPlan tree if paging is finished. Processing
* of such exception should outcome of responding no cursor to the user.
*/
public class NoCursorException extends RuntimeException {
}
public class NoCursorException extends RuntimeException {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{} will conflict with checkstyle

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.exception;

/**
* Query analysis abstract exception.
*/
/** Query analysis abstract exception. */
public class QueryEngineException extends RuntimeException {

public QueryEngineException(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.exception;

/**
* Semantic Check Exception.
*/
/** Semantic Check Exception. */
public class SemanticCheckException extends QueryEngineException {
public SemanticCheckException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@

package org.opensearch.sql.exception;

/**
* This should be thrown by V2 engine to support fallback scenario.
*/
public class UnsupportedCursorRequestException extends RuntimeException {
}
/** This should be thrown by V2 engine to support fallback scenario. */
public class UnsupportedCursorRequestException extends RuntimeException {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
import lombok.Getter;
import org.opensearch.sql.storage.split.Split;

/**
* Execution context hold planning related information.
*/
/** Execution context hold planning related information. */
public class ExecutionContext {
@Getter
private final Optional<Split> split;
@Getter private final Optional<Split> split;

public ExecutionContext(Split split) {
this.split = Optional.of(split);
Expand Down
36 changes: 14 additions & 22 deletions core/src/main/java/org/opensearch/sql/executor/ExecutionEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.executor;

import java.util.List;
Expand All @@ -17,39 +16,33 @@
import org.opensearch.sql.executor.pagination.Cursor;
import org.opensearch.sql.planner.physical.PhysicalPlan;

/**
* Execution engine that encapsulates execution details.
*/
/** Execution engine that encapsulates execution details. */
public interface ExecutionEngine {

/**
* Execute physical plan and call back response listener.
* Todo. deprecated this interface after finalize {@link ExecutionContext}.
* Execute physical plan and call back response listener. Todo. deprecated this interface after
* finalize {@link ExecutionContext}.
Comment on lines +23 to +24

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Execute physical plan and call back response listener. Todo. deprecated this interface after
* finalize {@link ExecutionContext}.
* Execute physical plan and call back response listener.<br />
* TODO: deprecate this interface after finalize {@link ExecutionContext}.

*
* @param plan executable physical plan
* @param plan executable physical plan
* @param listener response listener
*/
void execute(PhysicalPlan plan, ResponseListener<QueryResponse> listener);

/**
* Execute physical plan with {@link ExecutionContext} and call back response listener.
*/
void execute(PhysicalPlan plan, ExecutionContext context,
ResponseListener<QueryResponse> listener);
/** Execute physical plan with {@link ExecutionContext} and call back response listener. */
void execute(
PhysicalPlan plan, ExecutionContext context, ResponseListener<QueryResponse> listener);

/**
* Explain physical plan and call back response listener. The reason why this has to
* be part of execution engine interface is that the physical plan probably needs to
* be executed to get more info for profiling, such as actual execution time, rows fetched etc.
* Explain physical plan and call back response listener. The reason why this has to be part of
* execution engine interface is that the physical plan probably needs to be executed to get more
* info for profiling, such as actual execution time, rows fetched etc.
*
* @param plan physical plan to explain
* @param plan physical plan to explain
* @param listener response listener
*/
void explain(PhysicalPlan plan, ResponseListener<ExplainResponse> listener);

/**
* Data class that encapsulates ExprValue.
*/
/** Data class that encapsulates ExprValue. */
@Data
class QueryResponse {
private final Schema schema;
Expand All @@ -70,8 +63,8 @@ public static class Column {
}

/**
* Data class that encapsulates explain result. This can help decouple core engine
* from concrete explain response format.
* Data class that encapsulates explain result. This can help decouple core engine from concrete
* explain response format.
*/
@Data
class ExplainResponse {
Expand All @@ -86,5 +79,4 @@ class ExplainResponseNode {
private Map<String, Object> description;
private List<ExplainResponseNode> children;
}

}
Loading
Loading