Skip to content

Commit cadac00

Browse files
committed
Merge branch 'main' into sort-expression-pushdown
2 parents c85bb1a + f97adb0 commit cadac00

File tree

509 files changed

+13054
-1679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

509 files changed

+13054
-1679
lines changed

.github/workflows/sql-test-and-build-workflow.yml

Lines changed: 81 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ jobs:
179179
doctest/build/testclusters/docTestCluster-0/logs/*
180180
integ-test/build/testclusters/*/logs/*
181181
182-
bwc-tests:
182+
bwc-tests-rolling-upgrade:
183183
needs: Get-CI-Image-Tag
184184
runs-on: ubuntu-latest
185185
strategy:
@@ -190,37 +190,83 @@ jobs:
190190
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
191191

192192
steps:
193-
- name: Run start commands
194-
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
195-
196-
- uses: actions/checkout@v4
197-
198-
- name: Set up JDK ${{ matrix.java }}
199-
uses: actions/setup-java@v4
200-
with:
201-
distribution: 'temurin'
202-
java-version: ${{ matrix.java }}
203-
204-
- name: Run backward compatibility tests
205-
run: |
206-
chown -R 1000:1000 `pwd`
207-
su `id -un 1000` -c "./scripts/bwctest.sh"
208-
209-
- name: Upload test reports
210-
if: ${{ always() }}
211-
uses: actions/upload-artifact@v4
212-
continue-on-error: true
213-
with:
214-
name: test-reports-ubuntu-latest-${{ matrix.java }}-bwc
215-
path: |
216-
sql/build/reports/**
217-
ppl/build/reports/**
218-
core/build/reports/**
219-
common/build/reports/**
220-
opensearch/build/reports/**
221-
integ-test/build/reports/**
222-
protocol/build/reports/**
223-
legacy/build/reports/**
224-
plugin/build/reports/**
225-
doctest/build/testclusters/docTestCluster-0/logs/*
226-
integ-test/build/testclusters/*/logs/*
193+
- name: Run start commands
194+
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
195+
196+
- uses: actions/checkout@v4
197+
198+
- name: Set up JDK ${{ matrix.java }}
199+
uses: actions/setup-java@v4
200+
with:
201+
distribution: 'temurin'
202+
java-version: ${{ matrix.java }}
203+
204+
- name: Run backward compatibility tests in rolling upgrade
205+
run: |
206+
chown -R 1000:1000 `pwd`
207+
su `id -un 1000` -c "./scripts/bwctest-rolling-upgrade.sh"
208+
209+
- name: Upload test reports
210+
if: ${{ always() }}
211+
uses: actions/upload-artifact@v4
212+
continue-on-error: true
213+
with:
214+
name: test-reports-ubuntu-latest-${{ matrix.java }}-bwc
215+
path: |
216+
sql/build/reports/**
217+
ppl/build/reports/**
218+
core/build/reports/**
219+
common/build/reports/**
220+
opensearch/build/reports/**
221+
integ-test/build/reports/**
222+
protocol/build/reports/**
223+
legacy/build/reports/**
224+
plugin/build/reports/**
225+
doctest/build/testclusters/docTestCluster-0/logs/*
226+
integ-test/build/testclusters/*/logs/*
227+
228+
bwc-tests-full-restart:
229+
needs: Get-CI-Image-Tag
230+
runs-on: ubuntu-latest
231+
strategy:
232+
matrix:
233+
java: [21, 24]
234+
container:
235+
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
236+
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
237+
238+
steps:
239+
- name: Run start commands
240+
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
241+
242+
- uses: actions/checkout@v4
243+
244+
- name: Set up JDK ${{ matrix.java }}
245+
uses: actions/setup-java@v4
246+
with:
247+
distribution: 'temurin'
248+
java-version: ${{ matrix.java }}
249+
250+
- name: Run backward compatibility tests in full restart
251+
run: |
252+
chown -R 1000:1000 `pwd`
253+
su `id -un 1000` -c "./scripts/bwctest-full-restart.sh"
254+
255+
- name: Upload test reports
256+
if: ${{ always() }}
257+
uses: actions/upload-artifact@v4
258+
continue-on-error: true
259+
with:
260+
name: test-reports-ubuntu-latest-${{ matrix.java }}-bwc
261+
path: |
262+
sql/build/reports/**
263+
ppl/build/reports/**
264+
core/build/reports/**
265+
common/build/reports/**
266+
opensearch/build/reports/**
267+
integ-test/build/reports/**
268+
protocol/build/reports/**
269+
legacy/build/reports/**
270+
plugin/build/reports/**
271+
doctest/build/testclusters/docTestCluster-0/logs/*
272+
integ-test/build/testclusters/*/logs/*

api/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies {
1515
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
1616
testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: "${hamcrest_version}"
1717
testImplementation group: 'org.mockito', name: 'mockito-core', version: "${mockito_version}"
18-
testImplementation group: 'org.apache.calcite', name: 'calcite-testkit', version: '1.38.0'
18+
testImplementation group: 'org.apache.calcite', name: 'calcite-testkit', version: '1.41.0'
1919
}
2020

2121
spotless {

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ allprojects {
152152
resolutionStrategy.force 'org.apache.commons:commons-text:1.11.0'
153153
resolutionStrategy.force 'commons-io:commons-io:2.15.0'
154154
resolutionStrategy.force 'org.yaml:snakeyaml:2.2'
155+
resolutionStrategy.dependencySubstitution {
156+
substitute module('commons-lang:commons-lang') using module('org.apache.commons:commons-lang3:3.18.0') because 'CVE-2025-48924: commons-lang 2.x vulnerable to StackOverflowError'
157+
}
155158
}
156159
}
157160

core/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ dependencies {
5858
api group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
5959
api group: 'com.tdunning', name: 't-digest', version: '3.3'
6060
api "net.minidev:json-smart:${versions.json_smart}"
61-
api('org.apache.calcite:calcite-core:1.38.0') {
61+
api('org.apache.calcite:calcite-core:1.41.0') {
6262
exclude group: 'net.minidev', module: 'json-smart'
63-
exclude group: 'commons-lang', module: 'commons-lang'
6463
}
65-
api 'org.apache.calcite:calcite-linq4j:1.38.0'
64+
api 'org.apache.calcite:calcite-linq4j:1.41.0'
6665
api project(':common')
6766
implementation "com.github.seancfoley:ipaddress:5.4.2"
6867
implementation "com.jayway.jsonpath:json-path:2.9.0"
6968

7069
annotationProcessor('org.immutables:value:2.8.8')
71-
compileOnly('org.immutables:value-annotations:2.8.8')
70+
compileOnly 'org.immutables:value-annotations:2.8.8'
71+
compileOnlyApi 'com.google.code.findbugs:jsr305:3.0.2'
7272

73-
testImplementation('org.junit.jupiter:junit-jupiter:5.9.3')
73+
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
7474
testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: "${hamcrest_version}"
7575
testImplementation group: 'org.mockito', name: 'mockito-core', version: "${mockito_version}"
7676
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: "${mockito_version}"

core/src/main/java/org/opensearch/sql/analysis/Analyzer.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
import org.opensearch.sql.ast.tree.Search;
9393
import org.opensearch.sql.ast.tree.Sort;
9494
import org.opensearch.sql.ast.tree.Sort.SortOption;
95+
import org.opensearch.sql.ast.tree.StreamWindow;
9596
import org.opensearch.sql.ast.tree.SubqueryAlias;
9697
import org.opensearch.sql.ast.tree.TableFunction;
9798
import org.opensearch.sql.ast.tree.Timechart;
@@ -380,8 +381,7 @@ public LogicalPlan visitRareTopN(RareTopN node, AnalysisContext context) {
380381
fields.forEach(
381382
field -> newEnv.define(new Symbol(Namespace.FIELD_NAME, field.toString()), field.type()));
382383

383-
List<Argument> options = node.getArguments();
384-
Integer noOfResults = (Integer) options.get(0).getValue().getValue();
384+
Integer noOfResults = node.getNoOfResults();
385385

386386
return new LogicalRareTopN(child, node.getCommandType(), noOfResults, fields, groupBys);
387387
}
@@ -749,6 +749,11 @@ public LogicalPlan visitTrendline(Trendline node, AnalysisContext context) {
749749
computationsAndTypes.build());
750750
}
751751

752+
@Override
753+
public LogicalPlan visitStreamWindow(StreamWindow node, AnalysisContext context) {
754+
throw getOnlyForCalciteException("Streamstats");
755+
}
756+
752757
@Override
753758
public LogicalPlan visitFlatten(Flatten node, AnalysisContext context) {
754759
throw getOnlyForCalciteException("Flatten");

core/src/main/java/org/opensearch/sql/ast/AbstractNodeVisitor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import org.opensearch.sql.ast.tree.SPath;
8080
import org.opensearch.sql.ast.tree.Search;
8181
import org.opensearch.sql.ast.tree.Sort;
82+
import org.opensearch.sql.ast.tree.StreamWindow;
8283
import org.opensearch.sql.ast.tree.SubqueryAlias;
8384
import org.opensearch.sql.ast.tree.TableFunction;
8485
import org.opensearch.sql.ast.tree.Timechart;
@@ -410,6 +411,10 @@ public T visitWindow(Window window, C context) {
410411
return visitChildren(window, context);
411412
}
412413

414+
public T visitStreamWindow(StreamWindow node, C context) {
415+
return visitChildren(node, context);
416+
}
417+
413418
public T visitJoin(Join node, C context) {
414419
return visitChildren(node, context);
415420
}

core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,16 @@ public static RareTopN rareTopN(
540540
List<Argument> noOfResults,
541541
List<UnresolvedExpression> groupList,
542542
Field... fields) {
543-
return new RareTopN(input, commandType, noOfResults, Arrays.asList(fields), groupList)
544-
.attach(input);
543+
Integer N =
544+
(Integer)
545+
Argument.ArgumentMap.of(noOfResults)
546+
.getOrDefault("noOfResults", new Literal(10, DataType.INTEGER))
547+
.getValue();
548+
List<Argument> removed =
549+
noOfResults.stream()
550+
.filter(argument -> !argument.getArgName().equals("noOfResults"))
551+
.toList();
552+
return new RareTopN(commandType, N, removed, Arrays.asList(fields), groupList).attach(input);
545553
}
546554

547555
public static Limit limit(UnresolvedPlan input, Integer limit, Integer offset) {

core/src/main/java/org/opensearch/sql/ast/expression/AllFields.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
public class AllFields extends UnresolvedExpression {
1919
public static final AllFields INSTANCE = new AllFields();
2020

21-
public AllFields() {}
21+
protected AllFields() {}
2222

2323
public static AllFields of() {
2424
return INSTANCE;

core/src/main/java/org/opensearch/sql/ast/expression/Argument.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public <R, C> R accept(AbstractNodeVisitor<R, C> nodeVisitor, C context) {
3737
}
3838

3939
/** ArgumentMap is a helper class to get argument value by name. */
40+
@EqualsAndHashCode
41+
@ToString
4042
public static class ArgumentMap {
4143
private final Map<String, Literal> map;
4244

core/src/main/java/org/opensearch/sql/ast/expression/IntervalUnit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
@RequiredArgsConstructor
1515
public enum IntervalUnit {
1616
UNKNOWN,
17-
1817
MICROSECOND,
18+
MILLISECOND,
1919
SECOND,
2020
MINUTE,
2121
HOUR,

0 commit comments

Comments
 (0)