Skip to content

Commit

Permalink
spotlesss apply
Browse files Browse the repository at this point in the history
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
  • Loading branch information
MitchellGale committed Aug 22, 2023
1 parent d205bd6 commit 57bc5ca
Show file tree
Hide file tree
Showing 132 changed files with 5,508 additions and 5,567 deletions.
24 changes: 14 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,32 @@ repositories {
spotless {
java {
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',
'core/src/main/java/org/opensearch/sql/DataSourceSchemaName.java',
include 'core/src/main/java/org/opensearch/sql/DataSourceSchemaName.java',
'core/src/test/java/org/opensearch/sql/data/**/*.java',
'core/src/test/java/org/opensearch/sql/config/**/*.java',
'core/src/test/java/org/opensearch/sql/analysis/**/*.java',
'core/src/main/java/org/opensearch/sql/planner/**/*.java',
'core/src/main/java/org/opensearch/sql/storage/**/*.java',
'core/src/main/java/org/opensearch/sql/utils/**/*.java'
'core/src/main/java/org/opensearch/sql/utils/**/*.java',
'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',
'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 Down
7 changes: 6 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ repositories {
mavenCentral()
}

checkstyleMain.ignoreFailures = true
// Being ignored as a temporary measure before being removed in favour of
// spotless https://github.com/opensearch-project/sql/issues/1101
checkstyleTest.ignoreFailures = true
checkstyleMain.ignoreFailures = true
checkstyleTestFixtures.ignoreFailures = true



dependencies {
api group: 'com.google.guava', name: 'guava', version: '32.0.1-jre'
Expand Down
10 changes: 7 additions & 3 deletions core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,13 @@ public static Function function(String funcName, UnresolvedExpression... funcArg
}

/**
*
*
* <pre>
* CASE
* WHEN search_condition THEN result_expr<br>
* [WHEN search_condition THEN result_expr] ...
* [ELSE result_expr]
* WHEN search_condition THEN result_expr
* [WHEN search_condition THEN result_expr] ...
* [ELSE result_expr]
* END
* </pre>
*/
Expand All @@ -263,6 +265,8 @@ public UnresolvedExpression caseWhen(UnresolvedExpression elseClause,
}

/**
*
*
* <pre>
* CASE case_value_expr
* WHEN compare_expr THEN result_expr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.ast.expression;

import static java.util.Objects.requireNonNull;
Expand All @@ -28,7 +29,9 @@ public QualifiedName(String name) {
this.parts = Collections.singletonList(name);
}

/** QualifiedName Constructor. */
/**
* QualifiedName Constructor.
*/
public QualifiedName(Iterable<String> parts) {
List<String> partsList = StreamSupport.stream(parts.spliterator(), false).collect(toList());
if (partsList.isEmpty()) {
Expand All @@ -37,7 +40,9 @@ public QualifiedName(Iterable<String> parts) {
this.parts = partsList;
}

/** Construct {@link QualifiedName} from list of string. */
/**
* Construct {@link QualifiedName} from list of string.
*/
public static QualifiedName of(String first, String... rest) {
requireNonNull(first);
ArrayList<String> parts = new ArrayList<>();
Expand All @@ -50,7 +55,9 @@ public static QualifiedName of(Iterable<String> parts) {
return new QualifiedName(parts);
}

/** Get Prefix of {@link QualifiedName}. */
/**
* Get Prefix of {@link QualifiedName}.
*/
public Optional<QualifiedName> getPrefix() {
if (parts.size() == 1) {
return Optional.empty();
Expand All @@ -64,8 +71,7 @@ public String getSuffix() {

/**
* Get first part of the qualified name.
*
* @return first part
* @return first part
*/
public Optional<String> first() {
if (parts.size() == 1) {
Expand All @@ -75,17 +81,19 @@ public Optional<String> first() {
}

/**
* <pre>
* 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).<br>
* For example:<br>
* {@code<br>
* &nbsp; QualifiedName name = ...<br>
* &nbsp; Optional<String> first = name.first();<br>
* &nbsp; if (first.isPresent()) {<br>
* &ensp; name.rest() ...<br>
* &nbsp; }<br>
* 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() ...
* }
* }
* @return rest part(s)
* @return rest part(s)
* </pre>
*/
public QualifiedName rest() {
return QualifiedName.of(parts.subList(1, parts.size()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.data.model;

import org.opensearch.sql.exception.ExpressionEvaluationException;

/** Abstract ExprValue. */
/**
* Abstract ExprValue.
*/
public abstract class AbstractExprValue implements ExprValue {
/** The customize compareTo logic. */
/**
* The customize compareTo logic.
*/
@Override
public int compareTo(ExprValue other) {
if (this.isNull() || this.isMissing() || other.isNull() || other.isMissing()) {
throw new IllegalStateException(
"[BUG] Unreachable, Comparing with NULL or MISSING is undefined");
"[BUG] Unreachable, Comparing with NULL or MISSING is undefined");
}
if ((this.isNumber() && other.isNumber())
|| (this.isDateTime() && other.isDateTime())
Expand All @@ -29,8 +34,9 @@ public int compareTo(ExprValue other) {
}

/**
* The customize equals logic.
* The customize equals logic.<br>
* The table below list the NULL and MISSING handling logic.
*
* <table>
* <tr>
* <th>A</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

/**
* The definition of widening type rule for expression value.
*
* <table border="3">
* <tr><th>ExprType</th><th>Widens to data types</th></tr>
* <tr><td>INTEGER</td><td>LONG, FLOAT, DOUBLE</td></tr>
Expand Down Expand Up @@ -55,7 +56,7 @@ private static int distance(ExprType type1, ExprType type2, int distance) {
}

/**
* The max type among two types. The max is defined as follow if type1 could widen to type2, then
* The max type among two types. The max is defined as follows if type1 could widen to type2, then
* max is type2, vice versa if type1 couldn't widen to type2 and type2 could't widen to type1, then
* throw {@link ExpressionEvaluationException}.
*
Expand Down
Loading

0 comments on commit 57bc5ca

Please sign in to comment.