Skip to content

Commit caada19

Browse files
committed
bugfix: patch doctests for streamstats.md and endpoint.md for JDK11/17
Signed-off-by: Kyle Hounslow <kylhouns@amazon.com>
1 parent fa5d08b commit caada19

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

docs/user/ppl/cmd/streamstats.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ This example calculates the running maximum age over a 2-row window, excluding t
119119
```ppl
120120
source=state_country
121121
| streamstats current=false window=2 max(age) as prev_max_age
122+
| fields name, country, state, month, year, age, prev_max_age
122123
```
123124

124125
Expected output:
@@ -167,6 +168,7 @@ original data
167168
```ppl
168169
source=state_country
169170
| streamstats window=2 global=true avg(age) as running_avg by country
171+
| fields name, country, state, month, year, age, running_avg
170172
```
171173

172174
Expected output:
@@ -189,7 +191,8 @@ fetched rows / total rows = 8/8
189191

190192
```ppl
191193
source=state_country
192-
| streamstats window=2 global=false avg(age) as running_avg by country ;
194+
| streamstats window=2 global=false avg(age) as running_avg by country
195+
| fields name, country, state, month, year, age, running_avg
193196
```
194197

195198
Expected output:
@@ -217,6 +220,7 @@ This example calculates the running average of age across accounts by country, w
217220
```ppl
218221
source=state_country
219222
| streamstats current=false reset_before=age>34 reset_after=age<25 avg(age) as avg_age by country
223+
| fields name, country, state, month, year, age, avg_age
220224
```
221225

222226
Expected output:

docs/user/ppl/interfaces/endpoint.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ Explain query
6969
```bash ppl
7070
curl -sS -H 'Content-Type: application/json' \
7171
-X POST localhost:9200/_plugins/_ppl/_explain \
72-
-d '{"query" : "source=state_country | where age>30"}'
72+
-d '{"query" : "source=state_country | where age>30 | fields name, country, state, month, year, age"}'
7373
```
7474

7575
Expected output:
7676

7777
```json
7878
{
7979
"calcite": {
80-
"logical": "LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])\n LogicalProject(name=[$0], country=[$1], state=[$2], month=[$3], year=[$4], age=[$5])\n LogicalFilter(condition=[>($5, 30)])\n CalciteLogicalIndexScan(table=[[OpenSearch, state_country]])\n",
81-
"physical": "CalciteEnumerableIndexScan(table=[[OpenSearch, state_country]], PushDownContext=[[PROJECT->[name, country, state, month, year, age], FILTER->>($5, 30), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"query\":{\"range\":{\"age\":{\"from\":30,\"to\":null,\"include_lower\":false,\"include_upper\":true,\"boost\":1.0}}},\"_source\":{\"includes\":[\"name\",\"country\",\"state\",\"month\",\"year\",\"age\"],\"excludes\":[]}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])\n"
80+
"logical": "LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])\n LogicalProject(name=[$3], country=[$0], state=[$4], month=[$1], year=[$2], age=[$5])\n LogicalFilter(condition=[>($5, 30)])\n CalciteLogicalIndexScan(table=[[OpenSearch, state_country]])\n",
81+
"physical": "CalciteEnumerableIndexScan(table=[[OpenSearch, state_country]], PushDownContext=[[PROJECT->[country, month, year, name, state, age], FILTER->>($5, 30), PROJECT->[name, country, state, month, year, age], LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"query\":{\"range\":{\"age\":{\"from\":30,\"to\":null,\"include_lower\":false,\"include_upper\":true,\"boost\":1.0}}},\"_source\":{\"includes\":[\"name\",\"country\",\"state\",\"month\",\"year\",\"age\"],\"excludes\":[]}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])\n"
8282
}
8383
}
8484

@@ -91,7 +91,7 @@ Explain query
9191
```bash ppl
9292
curl -sS -H 'Content-Type: application/json' \
9393
-X POST localhost:9200/_plugins/_ppl/_explain?format=simple \
94-
-d '{"query" : "source=state_country | where age>30"}'
94+
-d '{"query" : "source=state_country | where age>30 | fields name, country, state, month, year, age"}'
9595
```
9696

9797
Expected output:
@@ -111,16 +111,16 @@ Explain query
111111
```bash ppl
112112
curl -sS -H 'Content-Type: application/json' \
113113
-X POST localhost:9200/_plugins/_ppl/_explain?format=extended \
114-
-d '{"query" : "source=state_country | where age>30"}'
114+
-d '{"query" : "source=state_country | where age>30 | fields name, country, state, month, year, age"}'
115115
```
116116

117117
Expected output:
118118

119119
```json
120120
{
121121
"calcite": {
122-
"logical": "LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])\n LogicalProject(name=[$0], country=[$1], state=[$2], month=[$3], year=[$4], age=[$5])\n LogicalFilter(condition=[>($5, 30)])\n CalciteLogicalIndexScan(table=[[OpenSearch, state_country]])\n",
123-
"physical": "CalciteEnumerableIndexScan(table=[[OpenSearch, state_country]], PushDownContext=[[PROJECT->[name, country, state, month, year, age], FILTER->>($5, 30), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"query\":{\"range\":{\"age\":{\"from\":30,\"to\":null,\"include_lower\":false,\"include_upper\":true,\"boost\":1.0}}},\"_source\":{\"includes\":[\"name\",\"country\",\"state\",\"month\",\"year\",\"age\"],\"excludes\":[]}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])\n",
122+
"logical": "LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])\n LogicalProject(name=[$3], country=[$0], state=[$4], month=[$1], year=[$2], age=[$5])\n LogicalFilter(condition=[>($5, 30)])\n CalciteLogicalIndexScan(table=[[OpenSearch, state_country]])\n",
123+
"physical": "CalciteEnumerableIndexScan(table=[[OpenSearch, state_country]], PushDownContext=[[PROJECT->[country, month, year, name, state, age], FILTER->>($5, 30), PROJECT->[name, country, state, month, year, age], LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"query\":{\"range\":{\"age\":{\"from\":30,\"to\":null,\"include_lower\":false,\"include_upper\":true,\"boost\":1.0}}},\"_source\":{\"includes\":[\"name\",\"country\",\"state\",\"month\",\"year\",\"age\"],\"excludes\":[]}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])\n",
124124
"extended": "public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root) {\n final org.opensearch.sql.opensearch.storage.scan.CalciteEnumerableIndexScan v1stashed = (org.opensearch.sql.opensearch.storage.scan.CalciteEnumerableIndexScan) root.get(\"v1stashed\");\n return v1stashed.scan();\n}\n\n\npublic Class getElementType() {\n return java.lang.Object[].class;\n}\n\n\n"
125125
}
126126
}
@@ -136,7 +136,7 @@ Explain query
136136
```bash ppl
137137
curl -sS -H 'Content-Type: application/json' \
138138
-X POST localhost:9200/_plugins/_ppl/_explain?format=yaml \
139-
-d '{"query" : "source=state_country | where age>30"}'
139+
-d '{"query" : "source=state_country | where age>30 | fields name, country, state, month, year, age"}'
140140
```
141141

142142
Expected output:
@@ -145,10 +145,10 @@ Expected output:
145145
calcite:
146146
logical: |
147147
LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])
148-
LogicalProject(name=[$0], country=[$1], state=[$2], month=[$3], year=[$4], age=[$5])
148+
LogicalProject(name=[$3], country=[$0], state=[$4], month=[$1], year=[$2], age=[$5])
149149
LogicalFilter(condition=[>($5, 30)])
150150
CalciteLogicalIndexScan(table=[[OpenSearch, state_country]])
151151
physical: |
152-
CalciteEnumerableIndexScan(table=[[OpenSearch, state_country]], PushDownContext=[[PROJECT->[name, country, state, month, year, age], FILTER->>($5, 30), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":10000,"timeout":"1m","query":{"range":{"age":{"from":30,"to":null,"include_lower":false,"include_upper":true,"boost":1.0}}},"_source":{"includes":["name","country","state","month","year","age"],"excludes":[]}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])
152+
CalciteEnumerableIndexScan(table=[[OpenSearch, state_country]], PushDownContext=[[PROJECT->[country, month, year, name, state, age], FILTER->>($5, 30), PROJECT->[name, country, state, month, year, age], LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":10000,"timeout":"1m","query":{"range":{"age":{"from":30,"to":null,"include_lower":false,"include_upper":true,"boost":1.0}}},"_source":{"includes":["name","country","state","month","year","age"],"excludes":[]}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])
153153
```
154154

0 commit comments

Comments
 (0)