Skip to content

Commit 45ebc39

Browse files
Update big5 ppl queries and check plans (#4668)
* Update big5 ppl queries Signed-off-by: Lantao Jin <[email protected]> * Add explain check for big5 queries Signed-off-by: Lantao Jin <[email protected]> * update to latest code base Signed-off-by: Lantao Jin <[email protected]> --------- Signed-off-by: Lantao Jin <[email protected]> (cherry picked from commit 0f45382) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 757904d commit 45ebc39

File tree

152 files changed

+3175
-108
lines changed

Some content is hidden

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

152 files changed

+3175
-108
lines changed

integ-test/src/test/java/org/opensearch/sql/calcite/big5/CalcitePPLBig5IT.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,25 @@ public void init() throws Exception {
2121

2222
@Test
2323
public void bin_bins() throws IOException {
24-
String ppl = sanitize(loadFromFile("big5/queries/bin_bins.ppl"));
24+
String ppl = sanitize(loadExpectedQuery("bin_bins.ppl"));
2525
timing(summary, "bin_bins", ppl);
2626
}
2727

2828
@Test
2929
public void bin_span_log() throws IOException {
30-
String ppl = sanitize(loadFromFile("big5/queries/bin_span_log.ppl"));
30+
String ppl = sanitize(loadExpectedQuery("bin_span_log.ppl"));
3131
timing(summary, "bin_span_log", ppl);
3232
}
3333

3434
@Test
3535
public void bin_span_time() throws IOException {
36-
String ppl = sanitize(loadFromFile("big5/queries/bin_span_time.ppl"));
36+
String ppl = sanitize(loadExpectedQuery("bin_span_time.ppl"));
3737
timing(summary, "bin_span_time", ppl);
3838
}
3939

40+
@Test
4041
public void coalesce_nonexistent_field_fallback() throws IOException {
41-
String ppl = sanitize(loadFromFile("big5/queries/coalesce_nonexistent_field_fallback.ppl"));
42+
String ppl = sanitize(loadExpectedQuery("coalesce_nonexistent_field_fallback.ppl"));
4243
timing(summary, "coalesce_nonexistent_field_fallback", ppl);
4344
}
4445
}

integ-test/src/test/java/org/opensearch/sql/calcite/big5/PPLBig5IT.java

Lines changed: 175 additions & 47 deletions
Large diffs are not rendered by default.

integ-test/src/test/java/org/opensearch/sql/ppl/ExplainIT.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -743,18 +743,4 @@ public void testExplainSearchWildcardStar() throws IOException {
743743
explainQueryToString(
744744
String.format("search source=%s severityText=ERR* | fields severityText ", TEST_INDEX_OTEL_LOGS)));
745745
}
746-
747-
protected String loadExpectedPlan(String fileName) throws IOException {
748-
String prefix;
749-
if (isCalciteEnabled()) {
750-
if (isPushdownDisabled()) {
751-
prefix = "expectedOutput/calcite_no_pushdown/";
752-
} else {
753-
prefix = "expectedOutput/calcite/";
754-
}
755-
} else {
756-
prefix = "expectedOutput/ppl/";
757-
}
758-
return loadFromFile(prefix + fileName);
759-
}
760746
}

integ-test/src/test/java/org/opensearch/sql/ppl/PPLIntegTestCase.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,4 +402,18 @@ protected static String loadFromFile(String filename) {
402402
throw new RuntimeException(e);
403403
}
404404
}
405+
406+
protected String loadExpectedPlan(String fileName) throws IOException {
407+
String prefix;
408+
if (isCalciteEnabled()) {
409+
if (isPushdownDisabled()) {
410+
prefix = "expectedOutput/calcite_no_pushdown/";
411+
} else {
412+
prefix = "expectedOutput/calcite/";
413+
}
414+
} else {
415+
prefix = "expectedOutput/ppl/";
416+
}
417+
return loadFromFile(prefix + fileName);
418+
}
405419
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
{
3+
"name": "asc_sort_timestamp",
4+
"operation-type": "search",
5+
"index": "{{index_name | default('big5')}}",
6+
"body": {
7+
"query": {
8+
"match_all": {}
9+
},
10+
"sort" : [
11+
{"@timestamp" : "asc"}
12+
]
13+
}
14+
}
15+
*/
116
source = big5
217
| sort + `@timestamp`
318
| head 10
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
{
3+
"name": "asc_sort_timestamp_can_match_shortcut",
4+
"operation-type": "search",
5+
"index": "{{index_name | default('big5')}}",
6+
"body": {
7+
"track_total_hits": false,
8+
"query": {
9+
"match": {
10+
"process.name": "kernel"
11+
}
12+
},
13+
"sort" : [
14+
{"@timestamp" : "asc"}
15+
]
16+
}
17+
}
18+
*/
119
source = big5 process.name=kernel
220
| sort + `@timestamp`
321
| head 10
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
/*
2+
{
3+
"name": "asc_sort_timestamp_no_can_match_shortcut",
4+
"operation-type": "search",
5+
"index": "{{index_name | default('big5')}}",
6+
"request-params" : {
7+
"pre_filter_shard_size" : 100000
8+
},
9+
"body": {
10+
"track_total_hits": false,
11+
"query": {
12+
"match": {
13+
"process.name": "kernel"
14+
}
15+
},
16+
"sort" : [
17+
{"@timestamp" : "asc"}
18+
]
19+
}
20+
}
21+
*/
122
source = big5 process.name=kernel
223
| sort + `@timestamp`
324
| head 10
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
/*
2+
{
3+
"name": "asc_sort_with_after_timestamp",
4+
"operation-type": "search",
5+
"index": "{{index_name | default('big5')}}",
6+
"body": {
7+
"track_total_hits": false,
8+
"query": {
9+
"match_all": {}
10+
},
11+
"sort" : [
12+
{"@timestamp" : "asc"}
13+
],
14+
{% if distribution_version.split('.') | map('int') | list < "6.0.0".split('.') | map('int') | list or distribution_version.split('.') | map('int') | list >= "7.0.0".split('.') | map('int') | list %}
15+
"search_after": ["2023-01-01T23:59:58.000Z"]
16+
{% else %}
17+
"search_after": [1673049598]
18+
{% endif %}
19+
}
20+
}
21+
*/
122
source = big5
223
| sort + `@timestamp`
324
| head 10
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
{
3+
"name": "cardinality-agg-high",
4+
"operation-type": "search",
5+
"index": "{{index_name | default('big5')}}",
6+
"body": {
7+
"size": 0,
8+
"aggs": {
9+
"agent": {
10+
"cardinality": {
11+
"field": "agent.name"
12+
{% if distribution_version.split('.') | map('int') | list >= "2.19.1".split('.') | map('int') | list and distribution_version.split('.') | map('int') | list < "6.0.0".split('.') | map('int') | list %}
13+
, "execution_hint": "ordinals"
14+
{% endif %}
15+
}
16+
}
17+
}
18+
}
19+
}
20+
*/
21+
source = big5
22+
| stats dc(`agent.name`)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
{
3+
"name": "cardinality-agg-high-2",
4+
"operation-type": "search",
5+
"index": "{{index_name | default('big5')}}",
6+
"request-timeout": 1800,
7+
"body": {
8+
"size": 0,
9+
"aggs": {
10+
"agent": {
11+
"cardinality": {
12+
"field": "event.id",
13+
"execution_hint":"ordinals"
14+
}
15+
}
16+
}
17+
}
18+
}
19+
*/
20+
source = big5
21+
| stats dc(`event.id`)

0 commit comments

Comments
 (0)