Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/integ-tests-with-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [21, 24]
java: [21, 25]
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
fail-fast: false
matrix:
os: [ windows-latest, macos-14 ]
java: [21, 24]
java: [21, 25]

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sql-pitest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
needs: Get-CI-Image-Tag
strategy:
matrix:
java: [21, 24]
java: [21, 25]
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/sql-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [21, 24]
java: [21, 25]
test-type: ['unit', 'integration', 'doc']
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -106,16 +106,16 @@ jobs:
matrix:
entry:
- { os: windows-latest, java: 21, os_build_args: -PbuildPlatform=windows }
- { os: windows-latest, java: 24, os_build_args: -PbuildPlatform=windows }
- { os: windows-latest, java: 25, os_build_args: -PbuildPlatform=windows }
- { os: macos-14, java: 21, os_build_args: '' }
- { os: macos-14, java: 24, os_build_args: '' }
- { os: macos-14, java: 25, os_build_args: '' }
test-type: ['unit', 'integration', 'doc']
exclude:
# Exclude doctest for Windows
- test-type: doc
entry: { os: windows-latest, java: 21, os_build_args: -PbuildPlatform=windows }
- test-type: doc
entry: { os: windows-latest, java: 24, os_build_args: -PbuildPlatform=windows }
entry: { os: windows-latest, java: 25, os_build_args: -PbuildPlatform=windows }
runs-on: ${{ matrix.entry.os }}

steps:
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [21, 24]
java: [21, 25]
container:
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [21, 24]
java: [21, 25]
container:
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sql-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
needs: Get-CI-Image-Tag
strategy:
matrix:
java: [21, 24]
java: [21, 25]
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spotless {
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
}
}

Expand Down
2 changes: 1 addition & 1 deletion async-query-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ spotless {
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
}
}

Expand Down
10 changes: 10 additions & 0 deletions async-query/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,22 @@ jacocoTestCoverageVerification {
rule {
element = 'CLASS'
excludes = [
'org.opensearch.sql.spark.asyncquery.OpenSearchAsyncQueryJobMetadataStorageService',
'org.opensearch.sql.spark.cluster.ClusterManagerEventListener*',
'org.opensearch.sql.spark.cluster.FlintIndexRetention',
'org.opensearch.sql.spark.cluster.FlintStreamingJobHouseKeeperTask',
'org.opensearch.sql.spark.cluster.IndexCleanup',
'org.opensearch.sql.spark.config.OpenSearchSparkSubmitParameterModifier',
'org.opensearch.sql.spark.execution.session.*',
'org.opensearch.sql.spark.execution.statement.*',
// ignore because XContext IOException
'org.opensearch.sql.spark.execution.statestore.StateStore',
'org.opensearch.sql.spark.execution.statestore.OpenSearchStatementStorageService',
'org.opensearch.sql.spark.execution.statestore.OpenSearchSessionStorageService',
'org.opensearch.sql.spark.flint.*',
'org.opensearch.sql.spark.metrics.OpenSearchMetricsService',
'org.opensearch.sql.spark.rest.*',
'org.opensearch.sql.spark.response.OpenSearchJobExecutionResponseReader',
'org.opensearch.sql.spark.scheduler.parser.OpenSearchScheduleQueryJobRequestParser',
'org.opensearch.sql.spark.transport.model.*'
]
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

plugins {
id 'java-library'
id "me.champeau.jmh" version "0.6.8"
id "me.champeau.jmh" version "0.7.3"
}

repositories {
Expand Down
14 changes: 11 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ plugins {
id 'java-library'
id "io.freefair.lombok" version "8.14"
id 'jacoco'
id 'com.diffplug.spotless' version '7.2.1'
id 'com.diffplug.spotless' version '8.1.0'
}

// import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94
Expand Down Expand Up @@ -113,7 +113,7 @@ spotless {
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
}
}

Expand All @@ -128,8 +128,16 @@ allprojects {
}

plugins.withId('java') {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
}

tasks.withType(Test) {
jvmArgs '-Dnet.bytebuddy.experimental=true'
}

configurations.all {
resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib:1.9.10"
resolutionStrategy.force "net.minidev:json-smart:${versions.json_smart}"
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ spotless {
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
}
}
6 changes: 3 additions & 3 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ plugins {
id 'java-library'
id "io.freefair.lombok"
id 'jacoco'
id 'info.solidsoft.pitest' version '1.9.0'
id 'info.solidsoft.pitest' version '1.19.0-rc.2'
id 'java-test-fixtures'
id 'com.diffplug.spotless'

Expand All @@ -38,7 +38,7 @@ repositories {

pitest {
targetClasses = ['org.opensearch.sql.*']
pitestVersion = '1.9.0'
pitestVersion = '1.19.0-rc.2'
threads = 4
outputFormats = ['HTML', 'XML']
timestampedReports = false
Expand Down Expand Up @@ -91,7 +91,7 @@ spotless {
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,9 @@ private List<RexNode> expandProjectFields(
.filter(addedFields::add)
.forEach(field -> expandedFields.add(context.relBuilder.field(field)));
}
default -> throw new IllegalStateException(
"Unexpected expression type in project list: " + expr.getClass().getSimpleName());
default ->
throw new IllegalStateException(
"Unexpected expression type in project list: " + expr.getClass().getSimpleName());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ public RexNode makeCast(
"Cannot convert %s to IP, only STRING and IP types are supported",
argExprType));
}
default -> throw new SemanticCheckException(
String.format(Locale.ROOT, "Cannot cast from %s to %s", argExprType, udt.name()));
default ->
throw new SemanticCheckException(
String.format(Locale.ROOT, "Cannot cast from %s to %s", argExprType, udt.name()));
};
}
// Use a custom operator when casting floating point or decimal number to a character type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public Type getJavaType() {
INTEGER,
INTERVAL_YEAR,
INTERVAL_YEAR_MONTH,
INTERVAL_MONTH -> this.isNullable() ? Integer.class : int.class;
INTERVAL_MONTH ->
this.isNullable() ? Integer.class : int.class;
case TIMESTAMP,
TIMESTAMP_WITH_LOCAL_TIME_ZONE,
TIMESTAMP_TZ,
Expand All @@ -68,13 +69,14 @@ public Type getJavaType() {
INTERVAL_HOUR_SECOND,
INTERVAL_MINUTE,
INTERVAL_MINUTE_SECOND,
INTERVAL_SECOND -> this.isNullable() ? Long.class : long.class;
INTERVAL_SECOND ->
this.isNullable() ? Long.class : long.class;
case SMALLINT -> this.isNullable() ? Short.class : short.class;
case TINYINT -> this.isNullable() ? Byte.class : byte.class;
case DECIMAL -> BigDecimal.class;
case BOOLEAN -> this.isNullable() ? Boolean.class : boolean.class;
case DOUBLE, FLOAT -> // sic
this.isNullable() ? Double.class : double.class;
this.isNullable() ? Double.class : double.class;
case REAL -> this.isNullable() ? Float.class : float.class;
case BINARY, VARBINARY -> ByteString.class;
case GEOMETRY -> Geometry.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ public static ExprType convertSqlTypeNameToExprType(SqlTypeName sqlTypeName) {
INTERVAL_HOUR_SECOND,
INTERVAL_MINUTE,
INTERVAL_MINUTE_SECOND,
INTERVAL_SECOND -> INTERVAL;
INTERVAL_SECOND ->
INTERVAL;
case ARRAY -> ARRAY;
case MAP -> STRUCT;
case GEOMETRY -> GEO_POINT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ static RexNode makeOver(
RexWindowBound lowerBound = convert(context, windowFrame.getLower());
RexWindowBound upperBound = convert(context, windowFrame.getUpper());
switch (functionName) {
// There is no "avg" AggImplementor in Calcite, we have to change avg window
// function to `sum over(...).toRex / count over(...).toRex`
// There is no "avg" AggImplementor in Calcite, we have to change avg window
// function to `sum over(...).toRex / count over(...).toRex`
case AVG:
// avg(x) ==>
// sum(x) / count(x)
Expand All @@ -167,17 +167,17 @@ static RexNode makeOver(
context.relBuilder.cast(
countOver(context, field, partitions, rows, lowerBound, upperBound),
SqlTypeName.DOUBLE));
// stddev_pop(x) ==>
// power((sum(x * x) - sum(x) * sum(x) / count(x)) / count(x), 0.5)
//
// stddev_samp(x) ==>
// power((sum(x * x) - sum(x) * sum(x) / count(x)) / (count(x) - 1), 0.5)
//
// var_pop(x) ==>
// (sum(x * x) - sum(x) * sum(x) / count(x)) / count(x)
//
// var_samp(x) ==>
// (sum(x * x) - sum(x) * sum(x) / count(x)) / (count(x) - 1)
// stddev_pop(x) ==>
// power((sum(x * x) - sum(x) * sum(x) / count(x)) / count(x), 0.5)
//
// stddev_samp(x) ==>
// power((sum(x * x) - sum(x) * sum(x) / count(x)) / (count(x) - 1), 0.5)
//
// var_pop(x) ==>
// (sum(x * x) - sum(x) * sum(x) / count(x)) / count(x)
//
// var_samp(x) ==>
// (sum(x * x) - sum(x) * sum(x) / count(x)) / (count(x) - 1)
case STDDEV_POP:
return variance(context, field, partitions, rows, lowerBound, upperBound, true, true);
case STDDEV_SAMP:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public static SqlTypeName convertRelDataTypeToSqlTypeName(RelDataType type) {
case EXPR_DATE -> SqlTypeName.DATE;
case EXPR_TIME -> SqlTypeName.TIME;
case EXPR_TIMESTAMP -> SqlTypeName.TIMESTAMP;
// EXPR_IP is mapped to SqlTypeName.OTHER since there is no
// corresponding SqlTypeName in Calcite.
// EXPR_IP is mapped to SqlTypeName.OTHER since there is no
// corresponding SqlTypeName in Calcite.
case EXPR_IP -> SqlTypeName.OTHER;
case EXPR_BINARY -> SqlTypeName.VARBINARY;
default -> type.getSqlTypeName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,9 @@ public RexNode createTimeSpanExpression(
TimeUnitRegistry.validateSubSecondSpan(config, intervalValue);

return switch (config) {
case MICROSECONDS,
MILLISECONDS,
CENTISECONDS,
DECISECONDS,
SECONDS,
MINUTES,
HOURS -> standardHandler.createExpression(
fieldExpr, intervalValue, config, alignmentOffsetMillis, context);
case MICROSECONDS, MILLISECONDS, CENTISECONDS, DECISECONDS, SECONDS, MINUTES, HOURS ->
standardHandler.createExpression(
fieldExpr, intervalValue, config, alignmentOffsetMillis, context);
case DAYS -> dayHandler.createExpression(fieldExpr, intervalValue, context);
case MONTHS -> monthHandler.createExpression(fieldExpr, intervalValue, context);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public static ExprTimestampValue forceConvertToTimestampValue(
ExprValue value, FunctionProperties properties) {
return switch (value) {
case ExprTimestampValue timestampValue -> timestampValue;
case ExprDateValue dateValue -> (ExprTimestampValue)
ExprValueUtils.timestampValue(dateValue.timestampValue());
case ExprTimeValue timeValue -> (ExprTimestampValue)
ExprValueUtils.timestampValue(timeValue.timestampValue(properties));
case ExprStringValue stringValue -> new ExprTimestampValue(
DateTimeParser.parse(stringValue.stringValue()));
default -> throw new ExpressionEvaluationException(
String.format(
"Cannot convert %s to timestamp, only STRING, DATE, TIME and TIMESTAMP are supported",
value.type()));
case ExprDateValue dateValue ->
(ExprTimestampValue) ExprValueUtils.timestampValue(dateValue.timestampValue());
case ExprTimeValue timeValue ->
(ExprTimestampValue) ExprValueUtils.timestampValue(timeValue.timestampValue(properties));
case ExprStringValue stringValue ->
new ExprTimestampValue(DateTimeParser.parse(stringValue.stringValue()));
default ->
throw new ExpressionEvaluationException(
String.format(
"Cannot convert %s to timestamp, only STRING, DATE, TIME and TIMESTAMP are"
+ " supported",
value.type()));
};
}

Expand Down Expand Up @@ -129,8 +131,9 @@ public static TemporalAmount convertToTemporalAmount(long number, TimeUnit unit)
case MICROSECOND -> Duration.ofNanos(number * 1000);
case NANOSECOND -> Duration.ofNanos(number);

default -> throw new UnsupportedOperationException(
"No mapping defined for Calcite TimeUnit: " + unit);
default ->
throw new UnsupportedOperationException(
"No mapping defined for Calcite TimeUnit: " + unit);
};
}
}
Loading
Loading