|
220 | 220 | public class LogicalPlanOptimizerTests extends AbstractLogicalPlanOptimizerTests { |
221 | 221 | private static final LiteralsOnTheRight LITERALS_ON_THE_RIGHT = new LiteralsOnTheRight(); |
222 | 222 |
|
223 | | - public void testPruneColumnsWhenFork() { |
224 | | - var query = """ |
225 | | - FROM employees |
226 | | - | KEEP first_name |
227 | | - | EVAL x = 1.0 |
228 | | - | DROP x |
229 | | - | FORK |
230 | | - (WHERE true) |
231 | | - (WHERE true) |
232 | | - | WHERE _fork == "fork1" |
233 | | - | DROP _fork |
234 | | - """; |
235 | | - var plan = plan(query); |
236 | | - assertNotNull(plan); |
237 | | - } |
238 | | - |
239 | | - public void testPruneColumnsWhenFork2() { |
240 | | - var query = """ |
241 | | - FROM employees |
242 | | - | WHERE emp_no == 10048 OR emp_no == 10081 |
243 | | - | FORK (EVAL a = CONCAT(first_name, " ", emp_no::keyword, " ", last_name) |
244 | | - | GROK a "%{WORD:x} %{WORD:y} %{WORD:z}" ) |
245 | | - (EVAL b = CONCAT(last_name, " ", emp_no::keyword, " ", first_name) |
246 | | - | GROK b "%{WORD:x} %{WORD:y} %{WORD:z}" ) |
247 | | - | KEEP _fork, emp_no, x, y, z |
248 | | - | SORT _fork, emp_no |
249 | | - """; |
250 | | - var plan = plan(query); |
251 | | - assertNotNull(plan); |
252 | | - } |
253 | | - |
254 | | - public void testPruneColumnsWhenFork3() { |
255 | | - var query = """ |
256 | | - FROM employees |
257 | | - | WHERE emp_no == 10048 OR emp_no == 10081 |
258 | | - | EVAL s = 10 |
259 | | - | FORK ( EVAL a = CONCAT(first_name, " ", emp_no::keyword, " ", last_name) |
260 | | - | DISSECT a "%{x} %{y} %{z}" |
261 | | - | EVAL y = y::keyword ) |
262 | | - ( STATS x = COUNT(*)::keyword, y = MAX(emp_no)::keyword, z = MIN(emp_no)::keyword ) |
263 | | - ( SORT emp_no ASC | LIMIT 2 | EVAL x = last_name ) |
264 | | - ( EVAL x = "abc" | EVAL y = "aaa" ) |
265 | | - | STATS count(*), d = count(emp_no), m = max(_fork), ls = count(s) |
266 | | - """; |
267 | | - var plan = plan(query); |
268 | | - assertNotNull(plan); |
269 | | - } |
270 | | - |
271 | | - public void testPruneColumnsWhenFork4() { |
272 | | - var query = """ |
273 | | - from employees metadata _index |
274 | | - | drop languages |
275 | | - | eval languages = 123 |
276 | | - | keep languages |
277 | | - | limit 4 |
278 | | - | fork |
279 | | - (where true) |
280 | | - (where true) |
281 | | - | where _fork == "fork1" |
282 | | - | drop _fork |
283 | | - """; |
284 | | - var plan = plan(query); |
285 | | - assertNotNull(plan); |
286 | | - } |
287 | | - |
288 | 223 | public void testEvalWithScoreImplicitLimit() { |
289 | 224 | var plan = plan(""" |
290 | 225 | FROM test |
|
0 commit comments