Skip to content

Commit

Permalink
[Spotless] Applying Google Code Format for core/src/main files #2 (op…
Browse files Browse the repository at this point in the history
…ensearch-project#1931)

* Applied spotless changes to `core/stc/main/.../expression` and more.

Signed-off-by: Mitchell Gale <[email protected]>

* Applied all spotless for PR 2 for GJF

Signed-off-by: Mitchell Gale <[email protected]>

* Apply spotless to fix custom fixes.

Signed-off-by: Mitchell Gale <[email protected]>

* Remove unused <br>

Signed-off-by: Mitchell Gale <[email protected]>

* ignoring core checkstyle failures.

Signed-off-by: Mitchell Gale <[email protected]>

* addressed PR comments.

Signed-off-by: Mitchell Gale <[email protected]>

* Addressing PR 2 comments.

Signed-off-by: Mitchell Gale <[email protected]>

* Ran spotless apply

Signed-off-by: Mitchell Gale <[email protected]>

---------

Signed-off-by: Mitchell Gale <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>
  • Loading branch information
MitchellGale committed Aug 18, 2023
1 parent d9a78df commit dd86162
Show file tree
Hide file tree
Showing 96 changed files with 3,543 additions and 2,888 deletions.
25 changes: 17 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,21 @@ repositories {
spotless {
java {
target fileTree('.') {
include '**/*.java'
include 'core/src/main/java/org/opensearch/sql/analysis/**/*.java',
'core/src/test/java/org/opensearch/sql/data/**/*.java',
'core/src/test/java/org/opensearch/sql/datasource/**/*.java',
'core/src/test/java/org/opensearch/sql/ast/**/*.java'
exclude '**/build/**', '**/build-*/**'
}
// importOrder()
importOrder()
// licenseHeader("/*\n" +
// " * Copyright OpenSearch Contributors\n" +
// " * SPDX-License-Identifier: Apache-2.0\n" +
// " */\n\n")
// removeUnusedImports()
// trimTrailingWhitespace()
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 All @@ -113,9 +116,8 @@ allprojects {
sourceCompatibility = targetCompatibility = "11"
}
configurations.all {
resolutionStrategy.force "com.squareup.okio:okio:3.5.0"
resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib:1.9.0"
resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.0"
resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib:1.6.0"
resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib-common:1.6.0"
}
}

Expand Down Expand Up @@ -217,5 +219,12 @@ task updateVersion {
println "Setting version to ${newVersion}."
// String tokenization to support -SNAPSHOT
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true)
ant.replaceregexp(match:'"version": "\\d+.\\d+.\\d+.\\d+', replace:'"version": ' + '"' + newVersion.tokenize('-')[0] + '.0', flags:'g', byline:true) {
fileset(dir: projectDir) {
include(name: "workbench/package.json")
include(name: "workbench/opensearch_dashboards.json")
}
}
ant.replaceregexp(file:'workbench/opensearch_dashboards.json', match:'"opensearchDashboardsVersion": "\\d+.\\d+.\\d+', replace:'"opensearchDashboardsVersion": ' + '"' + newVersion.tokenize('-')[0], flags:'g', byline:true)
}
}
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 {}
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
34 changes: 13 additions & 21 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.
* Execute physical plan and call back response listener.<br>
* Todo. deprecated 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

0 comments on commit dd86162

Please sign in to comment.