From 1b01c718f4e7b15bac9e08309eb4ca7b89bfd9d1 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Tue, 11 Jul 2023 14:21:26 -0700 Subject: [PATCH 01/11] Adding spotless plugin to project build.gradle. Signed-off-by: Mitchell Gale Remove commented out spotless changes. Signed-off-by: Mitchell Gale Adding Spotless to DEVELOPER_GUIDE.rst Signed-off-by: Mitchell Gale Added Google Java format to spotless. Signed-off-by: Mitchell Gale Update DEVELOPER_GUIDE.rst Co-authored-by: Yury-Fridlyand --- DEVELOPER_GUIDE.rst | 8 ++++++-- build.gradle | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/DEVELOPER_GUIDE.rst b/DEVELOPER_GUIDE.rst index 923cb459f9..257e3bb8f9 100644 --- a/DEVELOPER_GUIDE.rst +++ b/DEVELOPER_GUIDE.rst @@ -113,8 +113,8 @@ Note that missing license header will be detected by Gradle license plugin and f Making Code Changes =================== -Project Strucure ----------------- +Project Structure +----------------- The plugin codebase is in standard layout of Gradle project:: @@ -226,6 +226,10 @@ Most of the time you just need to run ./gradlew build which will make sure you p - Build plugin by run all tasks above (this takes time). * - ./gradlew pitest - Run PiTest mutation testing (see more info in `#1204 `_) + * - ./gradlew spotlessCheck + - Runs Spotless to check for code style. + * - ./gradlew spotlessApply + - Automatically apply spotless code style changes. For integration test, you can use ``-Dtests.class`` “UT full path” to run a task individually. For example ``./gradlew :integ-test:integTest -Dtests.class="*QueryIT"``. diff --git a/build.gradle b/build.gradle index d7458f722f..6e7dc631e9 100644 --- a/build.gradle +++ b/build.gradle @@ -65,6 +65,7 @@ plugins { id 'checkstyle' id "io.freefair.lombok" version "6.4.0" id 'jacoco' + id 'com.diffplug.spotless' version '6.19.0' } // import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94 @@ -79,6 +80,20 @@ repositories { maven { url 'https://jitpack.io' } } +spotless { + java { + target fileTree('.') { + include '**/*.java' + exclude '**/build/**', '**/build-*/**' + } + importOrder() + removeUnusedImports() + trimTrailingWhitespace() + endWithNewline() + googleJavaFormat() + } +} + allprojects { version = opensearch_version.tokenize('-')[0] + '.0' if (buildVersionQualifier) { From 3d87ab57cf074a30e68a40097916282929fa5812 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Tue, 11 Jul 2023 20:57:21 -0700 Subject: [PATCH 02/11] Added apply false for spotless Signed-off-by: Mitchell Gale --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e7dc631e9..678df1324d 100644 --- a/build.gradle +++ b/build.gradle @@ -65,7 +65,7 @@ plugins { id 'checkstyle' id "io.freefair.lombok" version "6.4.0" id 'jacoco' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.19.0' apply false } // import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94 From 98479d0aa5873ae3d0c91f4f91570bb54c0abe72 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Wed, 12 Jul 2023 13:00:31 -0700 Subject: [PATCH 03/11] Adding ratchetFrom to build.gradle Signed-off-by: Mitchell Gale --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 678df1324d..852f97d9c9 100644 --- a/build.gradle +++ b/build.gradle @@ -81,6 +81,7 @@ repositories { } spotless { + ratchetFrom java { target fileTree('.') { include '**/*.java' From bf595d3a05dac892fa837db9f6e2bde95190dd0d Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Wed, 12 Jul 2023 15:12:18 -0700 Subject: [PATCH 04/11] Adding license header to build.gradle for spotless. Signed-off-by: Mitchell Gale --- build.gradle | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 852f97d9c9..d18d25dcf7 100644 --- a/build.gradle +++ b/build.gradle @@ -65,7 +65,7 @@ plugins { id 'checkstyle' id "io.freefair.lombok" version "6.4.0" id 'jacoco' - id 'com.diffplug.spotless' version '6.19.0' apply false + id 'com.diffplug.spotless' version '6.19.0' } // import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94 @@ -81,17 +81,20 @@ repositories { } spotless { - ratchetFrom java { target fileTree('.') { include '**/*.java' exclude '**/build/**', '**/build-*/**' } - importOrder() - removeUnusedImports() - trimTrailingWhitespace() - endWithNewline() - googleJavaFormat() +// importOrder() + licenseHeader("/*\n" + + " * Copyright OpenSearch Contributors\n" + + " * SPDX-License-Identifier: Apache-2.0\n" + + " */\n\n\n") +// removeUnusedImports() +// trimTrailingWhitespace() +// endWithNewline() +// googleJavaFormat() } } From b23f84cbcb88bc466a548cd859dc1207032a0ba9 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Wed, 12 Jul 2023 15:16:14 -0700 Subject: [PATCH 05/11] Uncommenting all changes to build.gradle for spotless. Signed-off-by: Mitchell Gale --- build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index d18d25dcf7..dbc9ac650b 100644 --- a/build.gradle +++ b/build.gradle @@ -86,15 +86,15 @@ spotless { include '**/*.java' exclude '**/build/**', '**/build-*/**' } -// importOrder() + importOrder() licenseHeader("/*\n" + " * Copyright OpenSearch Contributors\n" + " * SPDX-License-Identifier: Apache-2.0\n" + " */\n\n\n") -// removeUnusedImports() -// trimTrailingWhitespace() -// endWithNewline() -// googleJavaFormat() + removeUnusedImports() + trimTrailingWhitespace() + endWithNewline() + googleJavaFormat() } } From 5e15e79d5e1719d266426a7c3ace7afb9092df42 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Wed, 19 Jul 2023 14:29:26 -0700 Subject: [PATCH 06/11] Commented out spotless checks. Signed-off-by: Mitchell Gale --- build.gradle | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index dbc9ac650b..f142dedb48 100644 --- a/build.gradle +++ b/build.gradle @@ -80,21 +80,22 @@ repositories { maven { url 'https://jitpack.io' } } +// Spotless checks will be added as PRs are applied to resolve each style issue is approved. spotless { java { - target fileTree('.') { - include '**/*.java' - exclude '**/build/**', '**/build-*/**' - } - importOrder() - licenseHeader("/*\n" + - " * Copyright OpenSearch Contributors\n" + - " * SPDX-License-Identifier: Apache-2.0\n" + - " */\n\n\n") - removeUnusedImports() - trimTrailingWhitespace() - endWithNewline() - googleJavaFormat() +// target fileTree('.') { +// include '**/*.java' +// exclude '**/build/**', '**/build-*/**' +// } +// importOrder() +// licenseHeader("/*\n" + +// " * Copyright OpenSearch Contributors\n" + +// " * SPDX-License-Identifier: Apache-2.0\n" + +// " */\n\n\n") +// removeUnusedImports() +// trimTrailingWhitespace() +// endWithNewline() +// googleJavaFormat() } } From 18a75bd98fdca34405face2a80562bca1138e841 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Wed, 19 Jul 2023 21:51:58 -0700 Subject: [PATCH 07/11] Add specific version for java format spotless (1.17.0) Signed-off-by: Mitchell Gale --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index f142dedb48..ff29eb7687 100644 --- a/build.gradle +++ b/build.gradle @@ -84,7 +84,7 @@ repositories { spotless { java { // target fileTree('.') { -// include '**/*.java' +// include '**/*.java', 'src/*/java/**/*.java' // exclude '**/build/**', '**/build-*/**' // } // importOrder() @@ -95,7 +95,7 @@ spotless { // removeUnusedImports() // trimTrailingWhitespace() // endWithNewline() -// googleJavaFormat() +// googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format') } } From f26d188335ea88e2c1d0434dc3c5fcb3806fbf29 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Thu, 20 Jul 2023 10:10:00 -0700 Subject: [PATCH 08/11] Add spotless end with new line check. Signed-off-by: Mitchell Gale --- build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index ff29eb7687..e460b28c53 100644 --- a/build.gradle +++ b/build.gradle @@ -83,10 +83,10 @@ 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 '**/*.java', 'src/*/java/**/*.java' + exclude '**/build/**', '**/build-*/**' + } // importOrder() // licenseHeader("/*\n" + // " * Copyright OpenSearch Contributors\n" + @@ -94,7 +94,7 @@ spotless { // " */\n\n\n") // removeUnusedImports() // trimTrailingWhitespace() -// endWithNewline() + endWithNewline() // googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format') } } From aeda307aeb1d2d3c425933164db586b0f4ebe317 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Thu, 20 Jul 2023 10:10:25 -0700 Subject: [PATCH 09/11] Add new line at end of files missing lines. Signed-off-by: Mitchell Gale --- .../opensearch/sql/common/grok/Converter.java | 336 +++++++++--------- .../org/opensearch/sql/ast/tree/RareTopN.java | 1 - .../arthmetic/ArithmeticFunction.java | 2 +- .../sql/expression/text/TextFunction.java | 1 - .../planner/logical/LogicalRelationTest.java | 2 +- ...undedOutOfOrderWatermarkGeneratorTest.java | 2 +- .../streaming/windowing/WindowTest.java | 2 +- .../assigner/SlidingWindowAssignerTest.java | 2 +- .../assigner/TumblingWindowAssignerTest.java | 2 +- .../AfterWatermarkWindowTriggerTest.java | 2 +- .../storage/write/TableWriteOperatorTest.java | 2 +- .../sql/datasources/encryptor/Encryptor.java | 2 +- .../datasources/encryptor/EncryptorImpl.java | 2 +- .../CreateDataSourceActionRequest.java | 2 +- .../CreateDataSourceActionResponse.java | 2 +- .../DeleteDataSourceActionRequest.java | 2 +- .../DeleteDataSourceActionResponse.java | 2 +- .../transport/GetDataSourceActionRequest.java | 2 +- .../GetDataSourceActionResponse.java | 2 +- .../UpdateDataSourceActionRequest.java | 2 +- .../UpdateDataSourceActionResponse.java | 2 +- .../rest/RestDataSourceQueryAction.java | 2 +- .../service/DataSourceMetadataStorage.java | 2 +- .../TransportCreateDataSourceAction.java | 2 +- .../TransportDeleteDataSourceAction.java | 2 +- .../TransportGetDataSourceAction.java | 2 +- .../TransportUpdateDataSourceAction.java | 2 +- .../sql/datasources/utils/Scheduler.java | 2 +- .../encryptor/EncryptorImplTest.java | 2 +- .../TransportCreateDataSourceActionTest.java | 2 +- .../TransportDeleteDataSourceActionTest.java | 2 +- .../TransportGetDataSourceActionTest.java | 2 +- .../TransportUpdateDataSourceActionTest.java | 2 +- .../sql/datasources/utils/SchedulerTest.java | 2 +- .../opensearch/sql/legacy/domain/Select.java | 1 - .../format/BindingTupleResultSet.java | 1 - .../sql/legacy/parser/SQLOdbcExpr.java | 1 - .../nestedfield/NestedFieldRewriter.java | 1 - .../sql/legacy/spatial/CellFilterParams.java | 1 - .../semantic/SemanticAnalyzerBasicTest.java | 2 +- .../node/scroll/SearchHitRowTest.java | 2 +- .../sql/legacy/unittest/HavingTest.java | 1 - .../planner/physical/MLCommonsOperator.java | 1 - .../planner/physical/MLOperator.java | 1 - .../ppl/antlr/NowLikeFunctionParserTest.java | 148 ++++---- .../sql/ppl/antlr/PPLSyntaxParserTest.java | 1 - .../client/PrometheusClientImpl.java | 2 +- .../QueryRangeFunctionResponseHandle.java | 2 +- .../storage/PrometheusMetricTable.java | 2 +- .../PrometheusDefaultImplementor.java | 2 +- .../querybuilder/StepParameterResolver.java | 2 +- .../storage/PrometheusStorageFactoryTest.java | 1 - .../opensearch/sql/spark/utils/TestUtils.java | 1 - 53 files changed, 280 insertions(+), 293 deletions(-) diff --git a/common/src/main/java/org/opensearch/sql/common/grok/Converter.java b/common/src/main/java/org/opensearch/sql/common/grok/Converter.java index 72bfa3d7f1..ebbe13f761 100644 --- a/common/src/main/java/org/opensearch/sql/common/grok/Converter.java +++ b/common/src/main/java/org/opensearch/sql/common/grok/Converter.java @@ -1,168 +1,168 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.opensearch.sql.common.grok; - -import java.time.Instant; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.time.temporal.TemporalAccessor; -import java.util.AbstractMap; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -/** - * Convert String argument to the right type. - */ -public class Converter { - - public enum Type { - BYTE(Byte::valueOf), - BOOLEAN(Boolean::valueOf), - SHORT(Short::valueOf), - INT(Integer::valueOf, "integer"), - LONG(Long::valueOf), - FLOAT(Float::valueOf), - DOUBLE(Double::valueOf), - DATETIME(new DateConverter(), "date"), - STRING(v -> v, "text"); - - public final IConverter converter; - public final List aliases; - - Type(IConverter converter, String... aliases) { - this.converter = converter; - this.aliases = Arrays.asList(aliases); - } - } - - private static final Pattern SPLITTER = Pattern.compile("[:;]"); - - private static final Map TYPES = - Arrays.stream(Type.values()) - .collect(Collectors.toMap(t -> t.name().toLowerCase(), t -> t)); - - private static final Map TYPE_ALIASES = - Arrays.stream(Type.values()) - .flatMap(type -> type.aliases.stream() - .map(alias -> new AbstractMap.SimpleEntry<>(alias, type))) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - - private static Type getType(String key) { - key = key.toLowerCase(); - Type type = TYPES.getOrDefault(key, TYPE_ALIASES.get(key)); - if (type == null) { - throw new IllegalArgumentException("Invalid data type :" + key); - } - return type; - } - - /** - * getConverters. - */ - public static Map> - getConverters(Collection groupNames, Object... params) { - return groupNames.stream() - .filter(Converter::containsDelimiter) - .collect(Collectors.toMap(Function.identity(), key -> { - String[] list = splitGrokPattern(key); - IConverter converter = getType(list[1]).converter; - if (list.length == 3) { - converter = converter.newConverter(list[2], params); - } - return converter; - })); - } - - /** - * getGroupTypes. - */ - public static Map getGroupTypes(Collection groupNames) { - return groupNames.stream() - .filter(Converter::containsDelimiter) - .map(Converter::splitGrokPattern) - .collect(Collectors.toMap( - l -> l[0], - l -> getType(l[1]) - )); - } - - public static String extractKey(String key) { - return splitGrokPattern(key)[0]; - } - - private static boolean containsDelimiter(String string) { - return string.indexOf(':') >= 0 || string.indexOf(';') >= 0; - } - - private static String[] splitGrokPattern(String string) { - return SPLITTER.split(string, 3); - } - - interface IConverter { - - T convert(String value); - - default IConverter newConverter(String param, Object... params) { - return this; - } - } - - - static class DateConverter implements IConverter { - - private final DateTimeFormatter formatter; - private final ZoneId timeZone; - - public DateConverter() { - this.formatter = DateTimeFormatter.ISO_DATE_TIME; - this.timeZone = ZoneOffset.UTC; - } - - private DateConverter(DateTimeFormatter formatter, ZoneId timeZone) { - this.formatter = formatter; - this.timeZone = timeZone; - } - - @Override - public Instant convert(String value) { - TemporalAccessor dt = formatter - .parseBest(value.trim(), ZonedDateTime::from, LocalDateTime::from, OffsetDateTime::from, - Instant::from, - LocalDate::from); - if (dt instanceof ZonedDateTime) { - return ((ZonedDateTime) dt).toInstant(); - } else if (dt instanceof LocalDateTime) { - return ((LocalDateTime) dt).atZone(timeZone).toInstant(); - } else if (dt instanceof OffsetDateTime) { - return ((OffsetDateTime) dt).atZoneSameInstant(timeZone).toInstant(); - } else if (dt instanceof Instant) { - return ((Instant) dt); - } else if (dt instanceof LocalDate) { - return ((LocalDate) dt).atStartOfDay(timeZone).toInstant(); - } else { - return null; - } - } - - @Override - public DateConverter newConverter(String param, Object... params) { - if (!(params.length == 1 && params[0] instanceof ZoneId)) { - throw new IllegalArgumentException("Invalid parameters"); - } - return new DateConverter(DateTimeFormatter.ofPattern(param), (ZoneId) params[0]); - } - } -} +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.common.grok; + +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.util.AbstractMap; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + * Convert String argument to the right type. + */ +public class Converter { + + public enum Type { + BYTE(Byte::valueOf), + BOOLEAN(Boolean::valueOf), + SHORT(Short::valueOf), + INT(Integer::valueOf, "integer"), + LONG(Long::valueOf), + FLOAT(Float::valueOf), + DOUBLE(Double::valueOf), + DATETIME(new DateConverter(), "date"), + STRING(v -> v, "text"); + + public final IConverter converter; + public final List aliases; + + Type(IConverter converter, String... aliases) { + this.converter = converter; + this.aliases = Arrays.asList(aliases); + } + } + + private static final Pattern SPLITTER = Pattern.compile("[:;]"); + + private static final Map TYPES = + Arrays.stream(Type.values()) + .collect(Collectors.toMap(t -> t.name().toLowerCase(), t -> t)); + + private static final Map TYPE_ALIASES = + Arrays.stream(Type.values()) + .flatMap(type -> type.aliases.stream() + .map(alias -> new AbstractMap.SimpleEntry<>(alias, type))) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + private static Type getType(String key) { + key = key.toLowerCase(); + Type type = TYPES.getOrDefault(key, TYPE_ALIASES.get(key)); + if (type == null) { + throw new IllegalArgumentException("Invalid data type :" + key); + } + return type; + } + + /** + * getConverters. + */ + public static Map> + getConverters(Collection groupNames, Object... params) { + return groupNames.stream() + .filter(Converter::containsDelimiter) + .collect(Collectors.toMap(Function.identity(), key -> { + String[] list = splitGrokPattern(key); + IConverter converter = getType(list[1]).converter; + if (list.length == 3) { + converter = converter.newConverter(list[2], params); + } + return converter; + })); + } + + /** + * getGroupTypes. + */ + public static Map getGroupTypes(Collection groupNames) { + return groupNames.stream() + .filter(Converter::containsDelimiter) + .map(Converter::splitGrokPattern) + .collect(Collectors.toMap( + l -> l[0], + l -> getType(l[1]) + )); + } + + public static String extractKey(String key) { + return splitGrokPattern(key)[0]; + } + + private static boolean containsDelimiter(String string) { + return string.indexOf(':') >= 0 || string.indexOf(';') >= 0; + } + + private static String[] splitGrokPattern(String string) { + return SPLITTER.split(string, 3); + } + + interface IConverter { + + T convert(String value); + + default IConverter newConverter(String param, Object... params) { + return this; + } + } + + + static class DateConverter implements IConverter { + + private final DateTimeFormatter formatter; + private final ZoneId timeZone; + + public DateConverter() { + this.formatter = DateTimeFormatter.ISO_DATE_TIME; + this.timeZone = ZoneOffset.UTC; + } + + private DateConverter(DateTimeFormatter formatter, ZoneId timeZone) { + this.formatter = formatter; + this.timeZone = timeZone; + } + + @Override + public Instant convert(String value) { + TemporalAccessor dt = formatter + .parseBest(value.trim(), ZonedDateTime::from, LocalDateTime::from, OffsetDateTime::from, + Instant::from, + LocalDate::from); + if (dt instanceof ZonedDateTime) { + return ((ZonedDateTime) dt).toInstant(); + } else if (dt instanceof LocalDateTime) { + return ((LocalDateTime) dt).atZone(timeZone).toInstant(); + } else if (dt instanceof OffsetDateTime) { + return ((OffsetDateTime) dt).atZoneSameInstant(timeZone).toInstant(); + } else if (dt instanceof Instant) { + return ((Instant) dt); + } else if (dt instanceof LocalDate) { + return ((LocalDate) dt).atStartOfDay(timeZone).toInstant(); + } else { + return null; + } + } + + @Override + public DateConverter newConverter(String param, Object... params) { + if (!(params.length == 1 && params[0] instanceof ZoneId)) { + throw new IllegalArgumentException("Invalid parameters"); + } + return new DateConverter(DateTimeFormatter.ofPattern(param), (ZoneId) params[0]); + } + } +} diff --git a/core/src/main/java/org/opensearch/sql/ast/tree/RareTopN.java b/core/src/main/java/org/opensearch/sql/ast/tree/RareTopN.java index c884afd86a..407d37e8e4 100644 --- a/core/src/main/java/org/opensearch/sql/ast/tree/RareTopN.java +++ b/core/src/main/java/org/opensearch/sql/ast/tree/RareTopN.java @@ -57,4 +57,3 @@ public enum CommandType { RARE } } - diff --git a/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/ArithmeticFunction.java b/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/ArithmeticFunction.java index 1f4ac3943c..e25c5cda20 100644 --- a/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/ArithmeticFunction.java +++ b/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/ArithmeticFunction.java @@ -265,4 +265,4 @@ private static DefaultFunctionResolver subtract() { private static DefaultFunctionResolver subtractFunction() { return subtractBase(BuiltinFunctionName.SUBTRACTFUNCTION.getName()); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/opensearch/sql/expression/text/TextFunction.java b/core/src/main/java/org/opensearch/sql/expression/text/TextFunction.java index e56c85a0c8..0bbfb65154 100644 --- a/core/src/main/java/org/opensearch/sql/expression/text/TextFunction.java +++ b/core/src/main/java/org/opensearch/sql/expression/text/TextFunction.java @@ -379,4 +379,3 @@ private static ExprValue exprReverse(ExprValue str) { return new ExprStringValue(new StringBuilder(str.stringValue()).reverse().toString()); } } - diff --git a/core/src/test/java/org/opensearch/sql/planner/logical/LogicalRelationTest.java b/core/src/test/java/org/opensearch/sql/planner/logical/LogicalRelationTest.java index dacd84e12b..6426ebb63f 100644 --- a/core/src/test/java/org/opensearch/sql/planner/logical/LogicalRelationTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/logical/LogicalRelationTest.java @@ -33,4 +33,4 @@ public void logicalRelationWithDataSourceHasNoInput() { assertEquals(0, relation.getChild().size()); } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/opensearch/sql/planner/streaming/watermark/BoundedOutOfOrderWatermarkGeneratorTest.java b/core/src/test/java/org/opensearch/sql/planner/streaming/watermark/BoundedOutOfOrderWatermarkGeneratorTest.java index 1d18a16f2a..9522c600b8 100644 --- a/core/src/test/java/org/opensearch/sql/planner/streaming/watermark/BoundedOutOfOrderWatermarkGeneratorTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/streaming/watermark/BoundedOutOfOrderWatermarkGeneratorTest.java @@ -58,4 +58,4 @@ public AssertionHelper shouldGenerateWatermark(long expected) { return this; } } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/WindowTest.java b/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/WindowTest.java index 9b9aafa933..c8214f5771 100644 --- a/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/WindowTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/WindowTest.java @@ -18,4 +18,4 @@ void test() { assertEquals(2000, window.getEndTime()); assertEquals(1999, window.maxTimestamp()); } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/assigner/SlidingWindowAssignerTest.java b/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/assigner/SlidingWindowAssignerTest.java index fd69065742..886537e088 100644 --- a/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/assigner/SlidingWindowAssignerTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/assigner/SlidingWindowAssignerTest.java @@ -49,4 +49,4 @@ void testConstructWithIllegalArguments() { () -> new SlidingWindowAssigner(1000, 0)); assertEquals("Slide size [0] must be positive number", error2.getMessage()); } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/assigner/TumblingWindowAssignerTest.java b/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/assigner/TumblingWindowAssignerTest.java index 4c98c40f7a..55a8750c11 100644 --- a/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/assigner/TumblingWindowAssignerTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/assigner/TumblingWindowAssignerTest.java @@ -36,4 +36,4 @@ void testConstructWithIllegalWindowSize() { () -> new TumblingWindowAssigner(-1)); assertEquals("Window size [-1] must be positive number", error.getMessage()); } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/trigger/AfterWatermarkWindowTriggerTest.java b/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/trigger/AfterWatermarkWindowTriggerTest.java index 3ef6907c38..d2854549ae 100644 --- a/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/trigger/AfterWatermarkWindowTriggerTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/streaming/windowing/trigger/AfterWatermarkWindowTriggerTest.java @@ -31,4 +31,4 @@ void shouldFireWindowBelowWatermark() { assertEquals(TriggerResult.FIRE, trigger.trigger(new Window(500, 800))); assertEquals(TriggerResult.FIRE, trigger.trigger(new Window(500, 1000))); } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/opensearch/sql/storage/write/TableWriteOperatorTest.java b/core/src/test/java/org/opensearch/sql/storage/write/TableWriteOperatorTest.java index 8780b08276..112192bde0 100644 --- a/core/src/test/java/org/opensearch/sql/storage/write/TableWriteOperatorTest.java +++ b/core/src/test/java/org/opensearch/sql/storage/write/TableWriteOperatorTest.java @@ -67,4 +67,4 @@ public Boolean visitTableWrite(TableWriteOperator node, Object context) { void testGetChild() { assertEquals(Collections.singletonList(child), tableWrite.getChild()); } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/encryptor/Encryptor.java b/datasources/src/main/java/org/opensearch/sql/datasources/encryptor/Encryptor.java index 55dc1ef18f..578b66d0ba 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/encryptor/Encryptor.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/encryptor/Encryptor.java @@ -25,4 +25,4 @@ public interface Encryptor { */ String decrypt(String encryptedText); -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/encryptor/EncryptorImpl.java b/datasources/src/main/java/org/opensearch/sql/datasources/encryptor/EncryptorImpl.java index 18e3e2f257..98f693eca1 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/encryptor/EncryptorImpl.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/encryptor/EncryptorImpl.java @@ -67,4 +67,4 @@ private void validate(String masterKey) { } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/CreateDataSourceActionRequest.java b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/CreateDataSourceActionRequest.java index 2926f95220..0cbb2355ca 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/CreateDataSourceActionRequest.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/CreateDataSourceActionRequest.java @@ -46,4 +46,4 @@ public ActionRequestValidationException validate() { return null; } } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/CreateDataSourceActionResponse.java b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/CreateDataSourceActionResponse.java index 3b997a7d21..377a249a44 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/CreateDataSourceActionResponse.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/CreateDataSourceActionResponse.java @@ -30,4 +30,4 @@ public CreateDataSourceActionResponse(StreamInput in) throws IOException { public void writeTo(StreamOutput streamOutput) throws IOException { streamOutput.writeString(result); } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/DeleteDataSourceActionRequest.java b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/DeleteDataSourceActionRequest.java index bc9d4491d5..1eb2d17bff 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/DeleteDataSourceActionRequest.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/DeleteDataSourceActionRequest.java @@ -48,4 +48,4 @@ public ActionRequestValidationException validate() { } } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/DeleteDataSourceActionResponse.java b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/DeleteDataSourceActionResponse.java index 11d4a72274..4bb6e290c5 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/DeleteDataSourceActionResponse.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/DeleteDataSourceActionResponse.java @@ -30,4 +30,4 @@ public void writeTo(StreamOutput streamOutput) throws IOException { streamOutput.writeString(result); } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/GetDataSourceActionRequest.java b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/GetDataSourceActionRequest.java index 1e617f1866..23f4898543 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/GetDataSourceActionRequest.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/GetDataSourceActionRequest.java @@ -46,4 +46,4 @@ public ActionRequestValidationException validate() { } } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/GetDataSourceActionResponse.java b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/GetDataSourceActionResponse.java index 15437e6a3f..964e5989f8 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/GetDataSourceActionResponse.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/GetDataSourceActionResponse.java @@ -30,4 +30,4 @@ public void writeTo(StreamOutput streamOutput) throws IOException { streamOutput.writeString(result); } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/UpdateDataSourceActionRequest.java b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/UpdateDataSourceActionRequest.java index cd5c761d85..11bc2d1e20 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/UpdateDataSourceActionRequest.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/UpdateDataSourceActionRequest.java @@ -44,4 +44,4 @@ public ActionRequestValidationException validate() { return null; } } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/UpdateDataSourceActionResponse.java b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/UpdateDataSourceActionResponse.java index 8407b9675d..5f5f6f496a 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/UpdateDataSourceActionResponse.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/model/transport/UpdateDataSourceActionResponse.java @@ -30,4 +30,4 @@ public UpdateDataSourceActionResponse(StreamInput in) throws IOException { public void writeTo(StreamOutput streamOutput) throws IOException { streamOutput.writeString(result); } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/rest/RestDataSourceQueryAction.java b/datasources/src/main/java/org/opensearch/sql/datasources/rest/RestDataSourceQueryAction.java index aa34488675..a56512f838 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/rest/RestDataSourceQueryAction.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/rest/RestDataSourceQueryAction.java @@ -251,4 +251,4 @@ private static boolean isClientError(Exception e) { || e instanceof IllegalStateException; } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/service/DataSourceMetadataStorage.java b/datasources/src/main/java/org/opensearch/sql/datasources/service/DataSourceMetadataStorage.java index b54af3195e..e6483900c6 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/service/DataSourceMetadataStorage.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/service/DataSourceMetadataStorage.java @@ -60,4 +60,4 @@ public interface DataSourceMetadataStorage { */ void deleteDataSourceMetadata(String datasourceName); -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportCreateDataSourceAction.java b/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportCreateDataSourceAction.java index 4d8c51fac7..ce1c1bb157 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportCreateDataSourceAction.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportCreateDataSourceAction.java @@ -57,4 +57,4 @@ protected void doExecute(Task task, CreateDataSourceActionRequest request, } } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportDeleteDataSourceAction.java b/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportDeleteDataSourceAction.java index 1d109ca7fc..fe2df1ee51 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportDeleteDataSourceAction.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportDeleteDataSourceAction.java @@ -56,4 +56,4 @@ protected void doExecute(Task task, DeleteDataSourceActionRequest request, } } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportGetDataSourceAction.java b/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportGetDataSourceAction.java index 33d08f7cd2..7a36114755 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportGetDataSourceAction.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportGetDataSourceAction.java @@ -92,4 +92,4 @@ protected Object buildJsonObject(DataSourceMetadata response) { }.format(dataSourceMetadata); return responseContent; } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportUpdateDataSourceAction.java b/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportUpdateDataSourceAction.java index 4aece69e5b..13f80733e6 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportUpdateDataSourceAction.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/transport/TransportUpdateDataSourceAction.java @@ -56,4 +56,4 @@ protected void doExecute(Task task, UpdateDataSourceActionRequest request, } } -} \ No newline at end of file +} diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/utils/Scheduler.java b/datasources/src/main/java/org/opensearch/sql/datasources/utils/Scheduler.java index 0bc597ed4f..eaac8a7fa3 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/utils/Scheduler.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/utils/Scheduler.java @@ -30,4 +30,4 @@ private static Runnable withCurrentContext(final Runnable task) { task.run(); }; } -} \ No newline at end of file +} diff --git a/datasources/src/test/java/org/opensearch/sql/datasources/encryptor/EncryptorImplTest.java b/datasources/src/test/java/org/opensearch/sql/datasources/encryptor/EncryptorImplTest.java index 8c9b140f09..d62a5a957a 100644 --- a/datasources/src/test/java/org/opensearch/sql/datasources/encryptor/EncryptorImplTest.java +++ b/datasources/src/test/java/org/opensearch/sql/datasources/encryptor/EncryptorImplTest.java @@ -142,4 +142,4 @@ public void testEncryptionAndDecryptionWithEmptyMasterKey() { illegalStateException.getMessage()); } -} \ No newline at end of file +} diff --git a/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportCreateDataSourceActionTest.java b/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportCreateDataSourceActionTest.java index 3dd5c21214..2ece0eb5cd 100644 --- a/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportCreateDataSourceActionTest.java +++ b/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportCreateDataSourceActionTest.java @@ -83,4 +83,4 @@ public void testDoExecuteWithException() { Assertions.assertEquals("Error", exception.getMessage()); } -} \ No newline at end of file +} diff --git a/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportDeleteDataSourceActionTest.java b/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportDeleteDataSourceActionTest.java index 9beeb1a9a9..61b197a805 100644 --- a/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportDeleteDataSourceActionTest.java +++ b/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportDeleteDataSourceActionTest.java @@ -75,4 +75,4 @@ public void testDoExecuteWithException() { Assertions.assertEquals("Error", exception.getMessage()); } -} \ No newline at end of file +} diff --git a/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportGetDataSourceActionTest.java b/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportGetDataSourceActionTest.java index d5506c0a45..0546df643d 100644 --- a/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportGetDataSourceActionTest.java +++ b/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportGetDataSourceActionTest.java @@ -134,4 +134,4 @@ public void testDoExecuteWithException() { Assertions.assertEquals("Error", exception.getMessage()); } -} \ No newline at end of file +} diff --git a/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportUpdateDataSourceActionTest.java b/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportUpdateDataSourceActionTest.java index fecab012d2..2b9305c459 100644 --- a/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportUpdateDataSourceActionTest.java +++ b/datasources/src/test/java/org/opensearch/sql/datasources/transport/TransportUpdateDataSourceActionTest.java @@ -84,4 +84,4 @@ public void testDoExecuteWithException() { Assertions.assertEquals("Error", exception.getMessage()); } -} \ No newline at end of file +} diff --git a/datasources/src/test/java/org/opensearch/sql/datasources/utils/SchedulerTest.java b/datasources/src/test/java/org/opensearch/sql/datasources/utils/SchedulerTest.java index d091e77044..e3dac306cd 100644 --- a/datasources/src/test/java/org/opensearch/sql/datasources/utils/SchedulerTest.java +++ b/datasources/src/test/java/org/opensearch/sql/datasources/utils/SchedulerTest.java @@ -42,4 +42,4 @@ public void testSchedule() { Assert.assertTrue(isRun.get()); } -} \ No newline at end of file +} diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/domain/Select.java b/legacy/src/main/java/org/opensearch/sql/legacy/domain/Select.java index 8a6d3b265d..cd600d856e 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/domain/Select.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/domain/Select.java @@ -188,4 +188,3 @@ public boolean isSelectAll() { return selectAll; } } - diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/executor/format/BindingTupleResultSet.java b/legacy/src/main/java/org/opensearch/sql/legacy/executor/format/BindingTupleResultSet.java index c3b5d2e84d..d9eb463572 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/executor/format/BindingTupleResultSet.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/executor/format/BindingTupleResultSet.java @@ -58,4 +58,3 @@ public static DataRows buildDataRows(List columnNodes, List hasScript(String expectedCode) { return hasFieldWithValue("script", "has script", is(new Script(expectedCode))); } } - diff --git a/opensearch/src/main/java/org/opensearch/sql/opensearch/planner/physical/MLCommonsOperator.java b/opensearch/src/main/java/org/opensearch/sql/opensearch/planner/physical/MLCommonsOperator.java index 48e21246b2..de0c23c4e9 100644 --- a/opensearch/src/main/java/org/opensearch/sql/opensearch/planner/physical/MLCommonsOperator.java +++ b/opensearch/src/main/java/org/opensearch/sql/opensearch/planner/physical/MLCommonsOperator.java @@ -122,4 +122,3 @@ protected MLAlgoParams convertArgumentToMLParameter(Map argumen } } - diff --git a/opensearch/src/main/java/org/opensearch/sql/opensearch/planner/physical/MLOperator.java b/opensearch/src/main/java/org/opensearch/sql/opensearch/planner/physical/MLOperator.java index 938ff60157..36834bc23a 100644 --- a/opensearch/src/main/java/org/opensearch/sql/opensearch/planner/physical/MLOperator.java +++ b/opensearch/src/main/java/org/opensearch/sql/opensearch/planner/physical/MLOperator.java @@ -109,4 +109,3 @@ protected Map processArgs(Map arguments) { return res; } } - diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/antlr/NowLikeFunctionParserTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/antlr/NowLikeFunctionParserTest.java index fb849f6de7..9f635fdd81 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/antlr/NowLikeFunctionParserTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/antlr/NowLikeFunctionParserTest.java @@ -1,74 +1,74 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - - -package org.opensearch.sql.ppl.antlr; - -import static org.junit.Assert.assertNotEquals; - -import java.util.List; -import org.antlr.v4.runtime.tree.ParseTree; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Parameterized.class) -public class NowLikeFunctionParserTest { - - private final PPLSyntaxParser parser = new PPLSyntaxParser(); - - /** - * Set parameterized values used in test. - * @param name Function name - * @param hasFsp Whether function has fsp argument - * @param hasShortcut Whether function has shortcut (call without `()`) - */ - public NowLikeFunctionParserTest(String name, Boolean hasFsp, Boolean hasShortcut) { - this.name = name; - this.hasFsp = hasFsp; - this.hasShortcut = hasShortcut; - } - - /** - * Returns function data to test. - * @return An iterable. - */ - @Parameterized.Parameters(name = "{0}") - public static Iterable functionNames() { - return List.of(new Object[][]{ - {"now", true, false}, - {"current_timestamp", true, true}, - {"localtimestamp", true, true}, - {"localtime", true, true}, - {"sysdate", true, false}, - {"curtime", true, false}, - {"current_time", true, true}, - {"curdate", false, false}, - {"current_date", false, true}, - {"utc_date", false, false}, - {"utc_time", false, false}, - {"utc_timestamp", false, false} - }); - } - - private final String name; - private final Boolean hasFsp; - private final Boolean hasShortcut; - - @Test - public void test_now_like_functions() { - for (var call : hasShortcut ? List.of(name, name + "()") : List.of(name + "()")) { - ParseTree tree = parser.parse("source=t | eval r=" + call); - assertNotEquals(null, tree); - - tree = parser.parse("search source=t | where a=" + call); - assertNotEquals(null, tree); - } - if (hasFsp) { - ParseTree tree = parser.parse("search source=t | where a=" + name + "(0)"); - assertNotEquals(null, tree); - } - } -} +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + + +package org.opensearch.sql.ppl.antlr; + +import static org.junit.Assert.assertNotEquals; + +import java.util.List; +import org.antlr.v4.runtime.tree.ParseTree; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class NowLikeFunctionParserTest { + + private final PPLSyntaxParser parser = new PPLSyntaxParser(); + + /** + * Set parameterized values used in test. + * @param name Function name + * @param hasFsp Whether function has fsp argument + * @param hasShortcut Whether function has shortcut (call without `()`) + */ + public NowLikeFunctionParserTest(String name, Boolean hasFsp, Boolean hasShortcut) { + this.name = name; + this.hasFsp = hasFsp; + this.hasShortcut = hasShortcut; + } + + /** + * Returns function data to test. + * @return An iterable. + */ + @Parameterized.Parameters(name = "{0}") + public static Iterable functionNames() { + return List.of(new Object[][]{ + {"now", true, false}, + {"current_timestamp", true, true}, + {"localtimestamp", true, true}, + {"localtime", true, true}, + {"sysdate", true, false}, + {"curtime", true, false}, + {"current_time", true, true}, + {"curdate", false, false}, + {"current_date", false, true}, + {"utc_date", false, false}, + {"utc_time", false, false}, + {"utc_timestamp", false, false} + }); + } + + private final String name; + private final Boolean hasFsp; + private final Boolean hasShortcut; + + @Test + public void test_now_like_functions() { + for (var call : hasShortcut ? List.of(name, name + "()") : List.of(name + "()")) { + ParseTree tree = parser.parse("source=t | eval r=" + call); + assertNotEquals(null, tree); + + tree = parser.parse("search source=t | where a=" + call); + assertNotEquals(null, tree); + } + if (hasFsp) { + ParseTree tree = parser.parse("search source=t | where a=" + name + "(0)"); + assertNotEquals(null, tree); + } + } +} diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/antlr/PPLSyntaxParserTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/antlr/PPLSyntaxParserTest.java index 8ca6c5c84e..57cee7fa1d 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/antlr/PPLSyntaxParserTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/antlr/PPLSyntaxParserTest.java @@ -324,4 +324,3 @@ public void testCanParseTimestampdiffFunction() { "SOURCE=test | eval k = TIMESTAMPDIFF(WEEK,'2003-01-02','2003-01-02')")); } } - diff --git a/prometheus/src/main/java/org/opensearch/sql/prometheus/client/PrometheusClientImpl.java b/prometheus/src/main/java/org/opensearch/sql/prometheus/client/PrometheusClientImpl.java index 512c014564..cc625fc9ec 100644 --- a/prometheus/src/main/java/org/opensearch/sql/prometheus/client/PrometheusClientImpl.java +++ b/prometheus/src/main/java/org/opensearch/sql/prometheus/client/PrometheusClientImpl.java @@ -112,4 +112,4 @@ private JSONObject readResponse(Response response) throws IOException { } -} \ No newline at end of file +} diff --git a/prometheus/src/main/java/org/opensearch/sql/prometheus/functions/response/QueryRangeFunctionResponseHandle.java b/prometheus/src/main/java/org/opensearch/sql/prometheus/functions/response/QueryRangeFunctionResponseHandle.java index 80a75cfae7..3bc666b703 100644 --- a/prometheus/src/main/java/org/opensearch/sql/prometheus/functions/response/QueryRangeFunctionResponseHandle.java +++ b/prometheus/src/main/java/org/opensearch/sql/prometheus/functions/response/QueryRangeFunctionResponseHandle.java @@ -28,4 +28,4 @@ public interface QueryRangeFunctionResponseHandle { * Return ExecutionEngine.Schema of the Prometheus response. */ ExecutionEngine.Schema schema(); -} \ No newline at end of file +} diff --git a/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/PrometheusMetricTable.java b/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/PrometheusMetricTable.java index a03d69bc41..8f13080ce1 100644 --- a/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/PrometheusMetricTable.java +++ b/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/PrometheusMetricTable.java @@ -119,4 +119,4 @@ public TableScanBuilder createScanBuilder() { return null; } } -} \ No newline at end of file +} diff --git a/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/implementor/PrometheusDefaultImplementor.java b/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/implementor/PrometheusDefaultImplementor.java index 8cae250e5e..db09258e92 100644 --- a/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/implementor/PrometheusDefaultImplementor.java +++ b/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/implementor/PrometheusDefaultImplementor.java @@ -137,4 +137,4 @@ private Optional getSpanExpression(List namedE } -} \ No newline at end of file +} diff --git a/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/querybuilder/StepParameterResolver.java b/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/querybuilder/StepParameterResolver.java index 54315bb792..2078950a5d 100644 --- a/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/querybuilder/StepParameterResolver.java +++ b/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/querybuilder/StepParameterResolver.java @@ -60,4 +60,4 @@ private static Optional getSpanExpression( -} \ No newline at end of file +} diff --git a/prometheus/src/test/java/org/opensearch/sql/prometheus/storage/PrometheusStorageFactoryTest.java b/prometheus/src/test/java/org/opensearch/sql/prometheus/storage/PrometheusStorageFactoryTest.java index d6a934a015..41ac7ff144 100644 --- a/prometheus/src/test/java/org/opensearch/sql/prometheus/storage/PrometheusStorageFactoryTest.java +++ b/prometheus/src/test/java/org/opensearch/sql/prometheus/storage/PrometheusStorageFactoryTest.java @@ -282,4 +282,3 @@ void createDataSourceSuccessWithHostnameRestrictions() { } } - diff --git a/spark/src/test/java/org/opensearch/sql/spark/utils/TestUtils.java b/spark/src/test/java/org/opensearch/sql/spark/utils/TestUtils.java index 0630a85096..b480e6d9d9 100644 --- a/spark/src/test/java/org/opensearch/sql/spark/utils/TestUtils.java +++ b/spark/src/test/java/org/opensearch/sql/spark/utils/TestUtils.java @@ -23,4 +23,3 @@ public static String getJson(String filename) throws IOException { } } - From 760d64dde45b1c0f9291b30f8ba8712ea682586b Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Thu, 20 Jul 2023 10:53:37 -0700 Subject: [PATCH 10/11] Removed include path Signed-off-by: Mitchell Gale --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e460b28c53..3ca1c145b1 100644 --- a/build.gradle +++ b/build.gradle @@ -84,7 +84,7 @@ repositories { spotless { java { target fileTree('.') { - include '**/*.java', 'src/*/java/**/*.java' + include '**/*.java' exclude '**/build/**', '**/build-*/**' } // importOrder() From 1b811832436d002918e1a23867e4a6259240d387 Mon Sep 17 00:00:00 2001 From: Mitchell Gale Date: Mon, 31 Jul 2023 15:28:45 -0700 Subject: [PATCH 11/11] Correcting ending new line for QueryExemplars. Signed-off-by: Mitchell Gale --- .../QueryExemplarsFunctionImplementationTest.java | 1 - .../resolver/QueryExemplarsTableFunctionResolverTest.java | 1 - .../scan/QueryExemplarsFunctionTableScanOperatorTest.java | 2 +- .../sql/prometheus/storage/QueryExemplarsTableTest.java | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/implementation/QueryExemplarsFunctionImplementationTest.java b/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/implementation/QueryExemplarsFunctionImplementationTest.java index b5a52b0e8a..025e3bde06 100644 --- a/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/implementation/QueryExemplarsFunctionImplementationTest.java +++ b/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/implementation/QueryExemplarsFunctionImplementationTest.java @@ -89,4 +89,3 @@ void testApplyArgumentsException() { } - diff --git a/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/resolver/QueryExemplarsTableFunctionResolverTest.java b/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/resolver/QueryExemplarsTableFunctionResolverTest.java index 1e296a80c3..3e26b46c8f 100644 --- a/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/resolver/QueryExemplarsTableFunctionResolverTest.java +++ b/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/resolver/QueryExemplarsTableFunctionResolverTest.java @@ -72,4 +72,3 @@ void testResolve() { } } - diff --git a/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/scan/QueryExemplarsFunctionTableScanOperatorTest.java b/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/scan/QueryExemplarsFunctionTableScanOperatorTest.java index bd77eb8c2b..d4e31d4d1e 100644 --- a/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/scan/QueryExemplarsFunctionTableScanOperatorTest.java +++ b/prometheus/src/test/java/org/opensearch/sql/prometheus/functions/scan/QueryExemplarsFunctionTableScanOperatorTest.java @@ -189,4 +189,4 @@ void testClose() { prometheusQueryExemplarsRequest); queryExemplarsFunctionTableScanOperator.close(); } -} \ No newline at end of file +} diff --git a/prometheus/src/test/java/org/opensearch/sql/prometheus/storage/QueryExemplarsTableTest.java b/prometheus/src/test/java/org/opensearch/sql/prometheus/storage/QueryExemplarsTableTest.java index 81af30769e..19876d398d 100644 --- a/prometheus/src/test/java/org/opensearch/sql/prometheus/storage/QueryExemplarsTableTest.java +++ b/prometheus/src/test/java/org/opensearch/sql/prometheus/storage/QueryExemplarsTableTest.java @@ -79,4 +79,3 @@ void testCreateScanBuilderWithQueryRangeTableFunction() { } } -