Skip to content

Commit 05aff73

Browse files
committed
Merge remote-tracking branch 'origin/main' into issues/399
Signed-off-by: Yuanchun Shen <[email protected]>
2 parents 9da3bd2 + e06ebc5 commit 05aff73

File tree

165 files changed

+4801
-826
lines changed

Some content is hidden

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

165 files changed

+4801
-826
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 {

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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
import org.opensearch.sql.ast.tree.Search;
9494
import org.opensearch.sql.ast.tree.Sort;
9595
import org.opensearch.sql.ast.tree.Sort.SortOption;
96+
import org.opensearch.sql.ast.tree.StreamWindow;
9697
import org.opensearch.sql.ast.tree.SubqueryAlias;
9798
import org.opensearch.sql.ast.tree.TableFunction;
9899
import org.opensearch.sql.ast.tree.Timechart;
@@ -749,6 +750,11 @@ public LogicalPlan visitTrendline(Trendline node, AnalysisContext context) {
749750
computationsAndTypes.build());
750751
}
751752

753+
@Override
754+
public LogicalPlan visitStreamWindow(StreamWindow node, AnalysisContext context) {
755+
throw getOnlyForCalciteException("Streamstats");
756+
}
757+
752758
@Override
753759
public LogicalPlan visitFlatten(Flatten node, AnalysisContext context) {
754760
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
@@ -80,6 +80,7 @@
8080
import org.opensearch.sql.ast.tree.SPath;
8181
import org.opensearch.sql.ast.tree.Search;
8282
import org.opensearch.sql.ast.tree.Sort;
83+
import org.opensearch.sql.ast.tree.StreamWindow;
8384
import org.opensearch.sql.ast.tree.SubqueryAlias;
8485
import org.opensearch.sql.ast.tree.TableFunction;
8586
import org.opensearch.sql.ast.tree.Timechart;
@@ -415,6 +416,10 @@ public T visitWindow(Window window, C context) {
415416
return visitChildren(window, context);
416417
}
417418

419+
public T visitStreamWindow(StreamWindow node, C context) {
420+
return visitChildren(node, context);
421+
}
422+
418423
public T visitJoin(Join node, C context) {
419424
return visitChildren(node, context);
420425
}

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/QualifiedName.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@Getter
2323
@EqualsAndHashCode(callSuper = false)
2424
public class QualifiedName extends UnresolvedExpression {
25+
public static final String DELIMITER = ".";
2526
private final List<String> parts;
2627

2728
public QualifiedName(String name) {
@@ -94,7 +95,7 @@ public QualifiedName rest() {
9495
}
9596

9697
public String toString() {
97-
return String.join(".", this.parts);
98+
return String.join(DELIMITER, this.parts);
9899
}
99100

100101
@Override
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package org.opensearch.sql.ast.tree;
7+
8+
import com.google.common.collect.ImmutableList;
9+
import java.util.List;
10+
import lombok.EqualsAndHashCode;
11+
import lombok.Getter;
12+
import lombok.ToString;
13+
import org.opensearch.sql.ast.AbstractNodeVisitor;
14+
import org.opensearch.sql.ast.expression.UnresolvedExpression;
15+
16+
@Getter
17+
@ToString
18+
@EqualsAndHashCode(callSuper = false)
19+
public class StreamWindow extends UnresolvedPlan {
20+
21+
private final List<UnresolvedExpression> windowFunctionList;
22+
private final List<UnresolvedExpression> groupList;
23+
private final boolean current;
24+
private final int window;
25+
private final boolean global;
26+
private final UnresolvedExpression resetBefore;
27+
private final UnresolvedExpression resetAfter;
28+
@ToString.Exclude private UnresolvedPlan child;
29+
30+
/** StreamWindow Constructor. */
31+
public StreamWindow(
32+
List<UnresolvedExpression> windowFunctionList,
33+
List<UnresolvedExpression> groupList,
34+
boolean current,
35+
int window,
36+
boolean global,
37+
UnresolvedExpression resetBefore,
38+
UnresolvedExpression resetAfter) {
39+
this.windowFunctionList = windowFunctionList;
40+
this.groupList = groupList;
41+
this.current = current;
42+
this.window = window;
43+
this.global = global;
44+
this.resetBefore = resetBefore;
45+
this.resetAfter = resetAfter;
46+
}
47+
48+
public boolean isCurrent() {
49+
return current;
50+
}
51+
52+
public boolean isGlobal() {
53+
return global;
54+
}
55+
56+
@Override
57+
public StreamWindow attach(UnresolvedPlan child) {
58+
this.child = child;
59+
return this;
60+
}
61+
62+
@Override
63+
public List<UnresolvedPlan> getChild() {
64+
return this.child == null ? ImmutableList.of() : ImmutableList.of(this.child);
65+
}
66+
67+
@Override
68+
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) {
69+
return nodeVisitor.visitStreamWindow(this, context);
70+
}
71+
}

0 commit comments

Comments
 (0)