diff --git a/common/src/main/java/org/opensearch/sql/common/utils/StringUtils.java b/common/src/main/java/org/opensearch/sql/common/utils/StringUtils.java index 07c09c73c4..c81f56ef63 100644 --- a/common/src/main/java/org/opensearch/sql/common/utils/StringUtils.java +++ b/common/src/main/java/org/opensearch/sql/common/utils/StringUtils.java @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ - package org.opensearch.sql.common.utils; import com.google.common.base.Strings; @@ -13,6 +12,7 @@ public class StringUtils { /** * Unquote any string with mark specified. + * * @param text string * @param mark quotation mark * @return An unquoted string whose outer pair of (single/double/back-tick) quotes have been @@ -26,11 +26,10 @@ public static String unquote(String text, String mark) { } /** - * Unquote Identifier which has " or ' or ` as mark. - * Strings quoted by ' or " with two of these quotes appearing next to each other in the quote - * acts as an escape - * Example: 'Test''s' will result in 'Test's', similar with those single quotes being replaced - * with double. + * Unquote Identifier which has " or ' or ` as mark. Strings quoted by ' or " with two of these + * quotes appearing next to each other in the quote acts as an escape Example: 'Test''s' will + * result in 'Test's', similar with those single quotes being replaced with double. + * * @param text string * @return An unquoted string whose outer pair of (single/double/back-tick) quotes have been * removed @@ -45,10 +44,7 @@ public static String unquoteText(String text) { char firstChar = text.charAt(0); char lastChar = text.charAt(text.length() - 1); - if (firstChar == lastChar - && (firstChar == '\'' - || firstChar == '"' - || firstChar == '`')) { + if (firstChar == lastChar && (firstChar == '\'' || firstChar == '"' || firstChar == '`')) { enclosingQuote = firstChar; } else { return text; @@ -67,8 +63,7 @@ public static String unquoteText(String text) { for (int chIndex = 1; chIndex < text.length() - 1; chIndex++) { currentChar = text.charAt(chIndex); nextChar = text.charAt(chIndex + 1); - if (currentChar == enclosingQuote - && nextChar == currentChar) { + if (currentChar == enclosingQuote && nextChar == currentChar) { chIndex++; } textSB.append(currentChar); @@ -79,9 +74,9 @@ public static String unquoteText(String text) { /** * Unquote Identifier which has ` as mark. + * * @param identifier identifier that possibly enclosed by double quotes or back ticks - * @return An unquoted string whose outer pair of (double/back-tick) quotes have been - * removed + * @return An unquoted string whose outer pair of (double/back-tick) quotes have been removed */ public static String unquoteIdentifier(String identifier) { if (isQuoted(identifier, "`")) { @@ -92,16 +87,15 @@ public static String unquoteIdentifier(String identifier) { } /** - * Returns a formatted string using the specified format string and - * arguments, as well as the {@link Locale#ROOT} locale. + * Returns a formatted string using the specified format string and arguments, as well as the + * {@link Locale#ROOT} locale. * * @param format format string - * @param args arguments referenced by the format specifiers in the format string + * @param args arguments referenced by the format specifiers in the format string * @return A formatted string * @throws IllegalFormatException If a format string contains an illegal syntax, a format - * specifier that is incompatible with the given arguments, - * insufficient arguments given the format string, or other - * illegal conditions. + * specifier that is incompatible with the given arguments, insufficient arguments given the + * format string, or other illegal conditions. * @see java.lang.String#format(Locale, String, Object...) */ public static String format(final String format, Object... args) { @@ -111,4 +105,4 @@ public static String format(final String format, Object... args) { private static boolean isQuoted(String text, String mark) { return !Strings.isNullOrEmpty(text) && text.startsWith(mark) && text.endsWith(mark); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/MathematicalFunction.java b/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/MathematicalFunction.java index 0ba434c26d..22f4b76573 100644 --- a/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/MathematicalFunction.java +++ b/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/MathematicalFunction.java @@ -416,7 +416,6 @@ private static DefaultFunctionResolver pi() { } /** - * Definition of pow(x, y)/power(x, y) function.
* Calculate the value of x raised to the power of y
* The supported signature of pow/power function is