diff --git a/core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java b/core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java index 98808f929b..543b8f5277 100644 --- a/core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java +++ b/core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ - package org.opensearch.sql.ast.dsl; import java.util.Arrays; @@ -63,9 +62,7 @@ import org.opensearch.sql.ast.tree.UnresolvedPlan; import org.opensearch.sql.ast.tree.Values; -/** - * Class of static methods to create specific node instances. - */ +/** Class of static methods to create specific node instances. */ @UtilityClass public class AstDSL { @@ -132,8 +129,9 @@ public static UnresolvedPlan rename(UnresolvedPlan input, Map... maps) { /** * Initialize Values node by rows of literals. - * @param values rows in which each row is a list of literal values - * @return Values node + * + * @param values rows in which each row is a list of literal values + * @return Values node */ @SafeVarargs public UnresolvedPlan values(List... values) { @@ -255,8 +253,7 @@ public static Function function(String funcName, UnresolvedExpression... funcArg *   [ELSE result_expr]
* END */ - public UnresolvedExpression caseWhen(UnresolvedExpression elseClause, - When... whenClauses) { + public UnresolvedExpression caseWhen(UnresolvedExpression elseClause, When... whenClauses) { return caseWhen(null, elseClause, whenClauses); } @@ -267,9 +264,8 @@ public UnresolvedExpression caseWhen(UnresolvedExpression elseClause, *   [ELSE result_expr]
* END */ - public UnresolvedExpression caseWhen(UnresolvedExpression caseValueExpr, - UnresolvedExpression elseClause, - When... whenClauses) { + public UnresolvedExpression caseWhen( + UnresolvedExpression caseValueExpr, UnresolvedExpression elseClause, When... whenClauses) { return new Case(caseValueExpr, Arrays.asList(whenClauses), elseClause); } @@ -281,19 +277,20 @@ public When when(UnresolvedExpression condition, UnresolvedExpression result) { return new When(condition, result); } - public UnresolvedExpression highlight(UnresolvedExpression fieldName, - java.util.Map arguments) { + public UnresolvedExpression highlight( + UnresolvedExpression fieldName, java.util.Map arguments) { return new HighlightFunction(fieldName, arguments); } - public UnresolvedExpression score(UnresolvedExpression relevanceQuery, - Literal relevanceFieldWeight) { + public UnresolvedExpression score( + UnresolvedExpression relevanceQuery, Literal relevanceFieldWeight) { return new ScoreFunction(relevanceQuery, relevanceFieldWeight); } - public UnresolvedExpression window(UnresolvedExpression function, - List partitionByList, - List> sortList) { + public UnresolvedExpression window( + UnresolvedExpression function, + List partitionByList, + List> sortList) { return new WindowFunction(function, partitionByList, sortList); } @@ -328,9 +325,10 @@ public static UnresolvedExpression compare( return new Compare(operator, left, right); } - public static UnresolvedExpression between(UnresolvedExpression value, - UnresolvedExpression lowerBound, - UnresolvedExpression upperBound) { + public static UnresolvedExpression between( + UnresolvedExpression value, + UnresolvedExpression lowerBound, + UnresolvedExpression upperBound) { return new Between(value, lowerBound, upperBound); } @@ -398,9 +396,7 @@ public static List defaultFieldsArgs() { return exprList(argument("exclude", booleanLiteral(false))); } - /** - * Default Stats Command Args. - */ + /** Default Stats Command Args. */ public static List defaultStatsArgs() { return exprList( argument("partitions", intLiteral(1)), @@ -409,9 +405,7 @@ public static List defaultStatsArgs() { argument("dedupsplit", booleanLiteral(false))); } - /** - * Default Dedup Command Args. - */ + /** Default Dedup Command Args. */ public static List defaultDedupArgs() { return exprList( argument("number", intLiteral(1)), @@ -447,9 +441,12 @@ public static List defaultTopArgs() { return exprList(argument("noOfResults", intLiteral(10))); } - public static RareTopN rareTopN(UnresolvedPlan input, CommandType commandType, - List noOfResults, List groupList, - Field... fields) { + public static RareTopN rareTopN( + UnresolvedPlan input, + CommandType commandType, + List noOfResults, + List groupList, + Field... fields) { return new RareTopN(input, commandType, noOfResults, Arrays.asList(fields), groupList) .attach(input); } @@ -458,11 +455,12 @@ public static Limit limit(UnresolvedPlan input, Integer limit, Integer offset) { return new Limit(limit, offset).attach(input); } - public static Parse parse(UnresolvedPlan input, ParseMethod parseMethod, - UnresolvedExpression sourceField, - Literal pattern, - java.util.Map arguments) { + public static Parse parse( + UnresolvedPlan input, + ParseMethod parseMethod, + UnresolvedExpression sourceField, + Literal pattern, + java.util.Map arguments) { return new Parse(parseMethod, sourceField, pattern, arguments, input); } - } diff --git a/core/src/main/java/org/opensearch/sql/data/type/WideningTypeRule.java b/core/src/main/java/org/opensearch/sql/data/type/WideningTypeRule.java index 78d4f5b733..5587570ad9 100644 --- a/core/src/main/java/org/opensearch/sql/data/type/WideningTypeRule.java +++ b/core/src/main/java/org/opensearch/sql/data/type/WideningTypeRule.java @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ - package org.opensearch.sql.data.type; import static org.opensearch.sql.data.type.ExprCoreType.UNKNOWN; @@ -31,8 +30,8 @@ public class WideningTypeRule { public static final int TYPE_EQUAL = 0; /** - * The widening distance is calculated from the leaf to root. - * e.g. distance(INTEGER, FLOAT) = 2, but distance(FLOAT, INTEGER) = IMPOSSIBLE_WIDENING + * The widening distance is calculated from the leaf to root. e.g. distance(INTEGER, FLOAT) = 2, + * but distance(FLOAT, INTEGER) = IMPOSSIBLE_WIDENING * * @param type1 widen from type * @param type2 widen to type @@ -50,15 +49,15 @@ private static int distance(ExprType type1, ExprType type2, int distance) { } else { return type1.getParent().stream() .map(parentOfType1 -> distance(parentOfType1, type2, distance + 1)) - .reduce(Math::min).get(); + .reduce(Math::min) + .get(); } } /** - * The max type among two types. The max is defined as follow - * if type1 could widen to type2, then max is type2, vice versa - * if type1 could't widen to type2 and type2 could't widen to type1, - * then throw {@link ExpressionEvaluationException}. + * The max type among two types. The max is defined as follow if type1 could widen to type2, then + * max is type2, vice versa if type1 could't widen to type2 and type2 could't widen to type1, then + * throw {@link ExpressionEvaluationException}. * * @param type1 type1 * @param type2 type2