1 | /* |
---|---|
2 | * This Source Code Form is subject to the terms of the Mozilla Public |
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
5 | * |
6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
7 | */ |
8 | |
9 | /* |
10 | * opt_prelude |
11 | * M. Kersten |
12 | * These definitions are handy to have around in the optimizer |
13 | */ |
14 | #include "monetdb_config.h" |
15 | #include "opt_prelude.h" |
16 | #include "optimizer_private.h" |
17 | |
18 | /* ! please keep this list sorted for easier maintenance ! */ |
19 | str abortRef; |
20 | str actionRef; |
21 | str affectedRowsRef; |
22 | str aggrRef; |
23 | str alarmRef; |
24 | str algebraRef; |
25 | str alter_add_range_partitionRef; |
26 | str alter_add_tableRef; |
27 | str alter_add_value_partitionRef; |
28 | str alter_constraintRef; |
29 | str alter_del_tableRef; |
30 | str alter_functionRef; |
31 | str alter_indexRef; |
32 | str alter_roleRef; |
33 | str alter_schemaRef; |
34 | str alter_seqRef; |
35 | str alter_set_tableRef; |
36 | str alter_tableRef; |
37 | str alter_triggerRef; |
38 | str alter_typeRef; |
39 | str alter_userRef; |
40 | str alter_viewRef; |
41 | str andRef; |
42 | str antijoinRef; |
43 | str appendidxRef; |
44 | str appendRef; |
45 | str arrayRef; |
46 | str assertRef; |
47 | str attachRef; |
48 | str avgRef; |
49 | str bandjoinRef; |
50 | str basketRef; |
51 | str batalgebraRef; |
52 | str batcalcRef; |
53 | str batcapiRef; |
54 | str batmalRef; |
55 | str batmmathRef; |
56 | str batmtimeRef; |
57 | str batpyapi3Ref; |
58 | str batpyapiRef; |
59 | str batrapiRef; |
60 | str batRef; |
61 | str batsqlRef; |
62 | str batstrRef; |
63 | str batxmlRef; |
64 | str bbpRef; |
65 | str betweenRef; |
66 | str binddbatRef; |
67 | str bindidxRef; |
68 | str bindRef; |
69 | str blockRef; |
70 | str bpmRef; |
71 | str bstreamRef; |
72 | str calcRef; |
73 | str capiRef; |
74 | str catalogRef; |
75 | str clear_tableRef; |
76 | str closeRef; |
77 | str columnBindRef; |
78 | str columnRef; |
79 | str comment_onRef; |
80 | str commitRef; |
81 | str connectRef; |
82 | str contextRef; |
83 | str copy_fromRef; |
84 | str copyRef; |
85 | str count_no_nilRef; |
86 | str countRef; |
87 | str create_constraintRef; |
88 | str create_functionRef; |
89 | str create_indexRef; |
90 | str createRef; |
91 | str create_roleRef; |
92 | str create_schemaRef; |
93 | str create_seqRef; |
94 | str create_tableRef; |
95 | str create_triggerRef; |
96 | str create_typeRef; |
97 | str create_userRef; |
98 | str create_viewRef; |
99 | str crossRef; |
100 | str cume_distRef; |
101 | str dataflowRef; |
102 | str dateRef; |
103 | str dblRef; |
104 | str defineRef; |
105 | str deleteRef; |
106 | str deltaRef; |
107 | str dense_rankRef; |
108 | str diffcandRef; |
109 | str differenceRef; |
110 | str disconnectRef; |
111 | str divRef; |
112 | str drop_constraintRef; |
113 | str drop_functionRef; |
114 | str drop_indexRef; |
115 | str drop_roleRef; |
116 | str drop_schemaRef; |
117 | str drop_seqRef; |
118 | str drop_tableRef; |
119 | str drop_triggerRef; |
120 | str drop_typeRef; |
121 | str drop_userRef; |
122 | str drop_viewRef; |
123 | str emptybindidxRef; |
124 | str emptybindRef; |
125 | str eqRef; |
126 | str evalRef; |
127 | str execRef; |
128 | str expandRef; |
129 | str exportOperationRef; |
130 | str export_tableRef; |
131 | str fetchRef; |
132 | str findRef; |
133 | str finishRef; |
134 | str firstnRef; |
135 | str first_valueRef; |
136 | str generatorRef; |
137 | str getRef; |
138 | str getTraceRef; |
139 | str grant_functionRef; |
140 | str grantRef; |
141 | str grant_rolesRef; |
142 | str groupbyRef; |
143 | str group_concatRef; |
144 | str groupdoneRef; |
145 | str groupRef; |
146 | str hashRef; |
147 | str hgeRef; |
148 | str identityRef; |
149 | str ifthenelseRef; |
150 | str ilikeRef; |
151 | str ilikeselectRef; |
152 | str ilikethetaselectRef; |
153 | str inplaceRef; |
154 | str intersectcandRef; |
155 | str intersectRef; |
156 | str intRef; |
157 | str ioRef; |
158 | str iteratorRef; |
159 | str jitRef; |
160 | str joinRef; |
161 | str jsonRef; |
162 | str lagRef; |
163 | str languageRef; |
164 | str last_valueRef; |
165 | str leadRef; |
166 | str leftjoinRef; |
167 | str likeRef; |
168 | str likeselectRef; |
169 | str likethetaselectRef; |
170 | str listRef; |
171 | str lockRef; |
172 | str lookupRef; |
173 | str malRef; |
174 | str manifoldRef; |
175 | str mapiRef; |
176 | str markRef; |
177 | str matRef; |
178 | str max_no_nilRef; |
179 | str maxRef; |
180 | str mdbRef; |
181 | str mergecandRef; |
182 | str mergepackRef; |
183 | str min_no_nilRef; |
184 | str minRef; |
185 | str minusRef; |
186 | str mirrorRef; |
187 | str mitosisRef; |
188 | str mkeyRef; |
189 | str mmathRef; |
190 | str mtimeRef; |
191 | str mulRef; |
192 | str multicolumnRef; |
193 | str multiplexRef; |
194 | str mvcRef; |
195 | str newRef; |
196 | str nextRef; |
197 | str not_ilikeRef; |
198 | str not_likeRef; |
199 | str notRef; |
200 | str not_uniqueRef; |
201 | str nth_valueRef; |
202 | str ntileRef; |
203 | str oidRef; |
204 | str oltpRef; |
205 | str openRef; |
206 | str optimizerRef; |
207 | str pack2Ref; |
208 | str packIncrementRef; |
209 | str packRef; |
210 | str parametersRef; |
211 | str partitionRef; |
212 | str passRef; |
213 | str pcreRef; |
214 | str percent_rankRef; |
215 | str pinRef; |
216 | str plusRef; |
217 | str postludeRef; |
218 | str preludeRef; |
219 | str printRef; |
220 | str prodRef; |
221 | str profilerRef; |
222 | str projectdeltaRef; |
223 | str projectionpathRef; |
224 | str projectionRef; |
225 | str projectRef; |
226 | str putRef; |
227 | str pyapi3mapRef; |
228 | str pyapi3Ref; |
229 | str pyapimapRef; |
230 | str pyapiRef; |
231 | str querylogRef; |
232 | str queryRef; |
233 | str raiseRef; |
234 | str rangejoinRef; |
235 | str rankRef; |
236 | str rapiRef; |
237 | str reconnectRef; |
238 | str refineRef; |
239 | str registerRef; |
240 | str register_supervisorRef; |
241 | str releaseRef; |
242 | str remapRef; |
243 | str remoteRef; |
244 | str rename_columnRef; |
245 | str rename_schemaRef; |
246 | str rename_tableRef; |
247 | str rename_userRef; |
248 | str replaceRef; |
249 | str replicatorRef; |
250 | str resultSetRef; |
251 | str reuseRef; |
252 | str revoke_functionRef; |
253 | str revokeRef; |
254 | str revoke_rolesRef; |
255 | str rollbackRef; |
256 | str row_numberRef; |
257 | str rpcRef; |
258 | str rsColumnRef; |
259 | str sampleRef; |
260 | str schedulerRef; |
261 | str selectNotNilRef; |
262 | str selectRef; |
263 | str semaRef; |
264 | str semijoinRef; |
265 | str seriesRef; |
266 | str setAccessRef; |
267 | str setVariableRef; |
268 | str setWriteModeRef; |
269 | str singleRef; |
270 | str sinkRef; |
271 | str sliceRef; |
272 | str sortRef; |
273 | str sqlcatalogRef; |
274 | str sqlRef; |
275 | str startRef; |
276 | str starttraceRef; |
277 | str stoptraceRef; |
278 | str streamsRef; |
279 | str strRef; |
280 | str subavgRef; |
281 | str subcountRef; |
282 | str subdeltaRef; |
283 | str subeval_aggrRef; |
284 | str subgroupdoneRef; |
285 | str subgroupRef; |
286 | str subinterRef; |
287 | str submaxRef; |
288 | str submedianRef; |
289 | str subminRef; |
290 | str subprodRef; |
291 | str subsliceRef; |
292 | str subsumRef; |
293 | str subuniformRef; |
294 | str sumRef; |
295 | str takeRef; |
296 | str thetajoinRef; |
297 | str thetaselectRef; |
298 | str tidRef; |
299 | str timestampRef; |
300 | str transaction_abortRef; |
301 | str transaction_beginRef; |
302 | str transaction_commitRef; |
303 | str transactionRef; |
304 | str transaction_releaseRef; |
305 | str transaction_rollbackRef; |
306 | str uniqueRef; |
307 | str unlockRef; |
308 | str unpackRef; |
309 | str unpinRef; |
310 | str updateRef; |
311 | str userRef; |
312 | str vectorRef; |
313 | str window_boundRef; |
314 | str wlcRef; |
315 | str wlrRef; |
316 | str zero_or_oneRef; |
317 | /* ! please keep this list sorted for easier maintenance ! */ |
318 | |
319 | void optimizerInit(void) |
320 | { |
321 | /* ! please keep this list sorted for easier maintenance ! */ |
322 | abortRef = putName("abort"); |
323 | actionRef = putName("action"); |
324 | affectedRowsRef = putName("affectedRows"); |
325 | aggrRef = putName("aggr"); |
326 | alarmRef = putName("alarm"); |
327 | algebraRef = putName("algebra"); |
328 | alter_add_range_partitionRef = putName("alter_add_range_partition"); |
329 | alter_add_tableRef = putName("alter_add_table"); |
330 | alter_add_value_partitionRef = putName("alter_add_value_partition"); |
331 | alter_constraintRef = putName("alter_constraint"); |
332 | alter_del_tableRef = putName("alter_del_table"); |
333 | alter_functionRef = putName("alter_function"); |
334 | alter_indexRef = putName("alter_index"); |
335 | alter_roleRef = putName("alter_role"); |
336 | alter_schemaRef = putName("alter_schema"); |
337 | alter_seqRef = putName("alter_seq"); |
338 | alter_set_tableRef = putName("alter_set_table"); |
339 | alter_tableRef = putName("alter_table"); |
340 | alter_triggerRef = putName("alter_trigger"); |
341 | alter_typeRef = putName("alter_type"); |
342 | alter_userRef = putName("alter_user"); |
343 | alter_viewRef = putName("alter_view"); |
344 | andRef = putName("and"); |
345 | antijoinRef = putName("antijoin"); |
346 | appendidxRef = putName("append_idxbat"); |
347 | appendRef = putName("append"); |
348 | arrayRef = putName("array"); |
349 | assertRef = putName("assert"); |
350 | attachRef = putName("attach"); |
351 | avgRef = putName("avg"); |
352 | bandjoinRef = putName("bandjoin"); |
353 | basketRef = putName("basket"); |
354 | batalgebraRef = putName("batalgebra"); |
355 | batcalcRef = putName("batcalc"); |
356 | batcapiRef = putName("batcapi"); |
357 | batmalRef = putName("batmal"); |
358 | batmmathRef = putName("batmmath"); |
359 | batmtimeRef = putName("batmtime"); |
360 | batpyapi3Ref = putName("batpyapi3"); |
361 | batpyapiRef = putName("batpyapi"); |
362 | batrapiRef = putName("batrapi"); |
363 | batRef = putName("bat"); |
364 | batsqlRef = putName("batsql"); |
365 | batstrRef = putName("batstr"); |
366 | batxmlRef = putName("batxml"); |
367 | bbpRef = putName("bbp"); |
368 | betweenRef = putName("between"); |
369 | binddbatRef = putName("bind_dbat"); |
370 | bindidxRef = putName("bind_idxbat"); |
371 | bindRef = putName("bind"); |
372 | blockRef = putName("block"); |
373 | bpmRef = putName("bpm"); |
374 | bstreamRef = putName("bstream"); |
375 | calcRef = putName("calc"); |
376 | capiRef = putName("capi"); |
377 | catalogRef = putName("catalog"); |
378 | clear_tableRef = putName("clear_table"); |
379 | closeRef = putName("close"); |
380 | columnBindRef = putName("columnBind"); |
381 | columnRef = putName("column"); |
382 | comment_onRef = putName("comment_on"); |
383 | commitRef = putName("commit"); |
384 | connectRef = putName("connect"); |
385 | contextRef = putName("context"); |
386 | copy_fromRef = putName("copy_from"); |
387 | copyRef = putName("copy"); |
388 | count_no_nilRef = putName("count_no_nil"); |
389 | countRef = putName("count"); |
390 | create_constraintRef = putName("create_constraint"); |
391 | create_functionRef = putName("create_function"); |
392 | create_indexRef = putName("create_index"); |
393 | createRef = putName("create"); |
394 | create_roleRef = putName("create_role"); |
395 | create_schemaRef = putName("create_schema"); |
396 | create_seqRef = putName("create_seq"); |
397 | create_tableRef = putName("create_table"); |
398 | create_triggerRef = putName("create_trigger"); |
399 | create_typeRef = putName("create_type"); |
400 | create_userRef = putName("create_user"); |
401 | create_viewRef = putName("create_view"); |
402 | crossRef = putName("crossproduct"); |
403 | cume_distRef = putName("cume_dist"); |
404 | dataflowRef = putName("dataflow"); |
405 | dateRef = putName("date"); |
406 | dblRef = putName("dbl"); |
407 | defineRef = putName("define"); |
408 | deleteRef = putName("delete"); |
409 | deltaRef = putName("delta"); |
410 | dense_rankRef = putName("dense_rank"); |
411 | diffcandRef= putName("diffcand"); |
412 | differenceRef = putName("difference"); |
413 | disconnectRef= putName("disconnect"); |
414 | divRef = putName("/"); |
415 | drop_constraintRef = putName("drop_constraint"); |
416 | drop_functionRef = putName("drop_function"); |
417 | drop_indexRef = putName("drop_index"); |
418 | drop_roleRef = putName("drop_role"); |
419 | drop_schemaRef = putName("drop_schema"); |
420 | drop_seqRef = putName("drop_seq"); |
421 | drop_tableRef = putName("drop_table"); |
422 | drop_triggerRef = putName("drop_trigger"); |
423 | drop_typeRef = putName("drop_type"); |
424 | drop_userRef = putName("drop_user"); |
425 | drop_viewRef = putName("drop_view"); |
426 | emptybindidxRef = putName("emptybindidx"); |
427 | emptybindRef = putName("emptybind"); |
428 | eqRef = putName("=="); |
429 | evalRef = putName("eval"); |
430 | execRef = putName("exec"); |
431 | expandRef = putName("expand"); |
432 | exportOperationRef = putName("exportOperation"); |
433 | export_tableRef = putName("export_table"); |
434 | fetchRef = putName("fetch"); |
435 | findRef = putName("find"); |
436 | finishRef = putName("finish"); |
437 | firstnRef = putName("firstn"); |
438 | first_valueRef = putName("first_value"); |
439 | generatorRef = putName("generator"); |
440 | getRef = putName("get"); |
441 | getTraceRef = putName("getTrace"); |
442 | grant_functionRef = putName("grant_function"); |
443 | grantRef = putName("grant"); |
444 | grant_rolesRef = putName("grant_roles"); |
445 | groupbyRef = putName("groupby"); |
446 | group_concatRef = putName("group_concat"); |
447 | groupdoneRef = putName("groupdone"); |
448 | groupRef = putName("group"); |
449 | hashRef = putName("hash"); |
450 | hgeRef = putName("hge"); |
451 | identityRef = putName("identity"); |
452 | ifthenelseRef = putName("ifthenelse"); |
453 | ilikeRef = putName("ilike"); |
454 | ilikeselectRef = putName("ilikeselect"); |
455 | ilikethetaselectRef = putName("ilikethetaselect"); |
456 | inplaceRef = putName("inplace"); |
457 | intersectcandRef= putName("intersectcand"); |
458 | intersectRef = putName("intersect"); |
459 | intRef = putName("int"); |
460 | ioRef = putName("io"); |
461 | iteratorRef = putName("iterator"); |
462 | jitRef = putName("jit"); |
463 | joinRef = putName("join"); |
464 | jsonRef = putName("json"); |
465 | lagRef = putName("lag"); |
466 | languageRef= putName("language"); |
467 | last_valueRef = putName("last_value"); |
468 | leadRef = putName("lead"); |
469 | leftjoinRef = putName("leftjoin"); |
470 | likeRef = putName("like"); |
471 | likeselectRef = putName("likeselect"); |
472 | likethetaselectRef = putName("likethetaselect"); |
473 | listRef = putName("list"); |
474 | lockRef = putName("lock"); |
475 | lookupRef = putName("lookup"); |
476 | malRef = putName("mal"); |
477 | manifoldRef = putName("manifold"); |
478 | mapiRef = putName("mapi"); |
479 | markRef = putName("mark"); |
480 | matRef = putName("mat"); |
481 | max_no_nilRef = putName("max_no_nil"); |
482 | maxRef = putName("max"); |
483 | mdbRef = putName("mdb"); |
484 | mergecandRef= putName("mergecand"); |
485 | mergepackRef= putName("mergepack"); |
486 | min_no_nilRef = putName("min_no_nil"); |
487 | minRef = putName("min"); |
488 | minusRef = putName("-"); |
489 | mirrorRef = putName("mirror"); |
490 | mitosisRef = putName("mitosis"); |
491 | mkeyRef = putName("mkey"); |
492 | mmathRef = putName("mmath"); |
493 | mtimeRef = putName("mtime"); |
494 | mulRef = putName("*"); |
495 | multicolumnRef = putName("multicolumn"); |
496 | multiplexRef = putName("multiplex"); |
497 | mvcRef = putName("mvc"); |
498 | newRef = putName("new"); |
499 | nextRef = putName("next"); |
500 | not_ilikeRef = putName("not_ilike"); |
501 | not_likeRef = putName("not_like"); |
502 | notRef = putName("not"); |
503 | not_uniqueRef= putName("not_unique"); |
504 | nth_valueRef = putName("nth_value"); |
505 | ntileRef = putName("ntile"); |
506 | oidRef = putName("oid"); |
507 | oltpRef = putName("oltp"); |
508 | openRef = putName("open"); |
509 | optimizerRef = putName("optimizer"); |
510 | pack2Ref = putName("pack2"); |
511 | packIncrementRef = putName("packIncrement"); |
512 | packRef = putName("pack"); |
513 | parametersRef = putName("parameters"); |
514 | partitionRef = putName("partition"); |
515 | passRef = putName("pass"); |
516 | pcreRef = putName("pcre"); |
517 | percent_rankRef = putName("percent_rank"); |
518 | pinRef = putName("pin"); |
519 | plusRef = putName("+"); |
520 | postludeRef = putName("postlude"); |
521 | preludeRef = putName("prelude"); |
522 | printRef = putName("print"); |
523 | prodRef = putName("prod"); |
524 | profilerRef = putName("profiler"); |
525 | projectdeltaRef = putName("projectdelta"); |
526 | projectionpathRef = putName("projectionpath"); |
527 | projectionRef = putName("projection"); |
528 | projectRef = putName("project"); |
529 | putRef = putName("put"); |
530 | pyapi3mapRef = putName("batpyapi3map"); |
531 | pyapi3Ref = putName("pyapi3"); |
532 | pyapimapRef = putName("batpyapimap"); |
533 | pyapiRef = putName("pyapi"); |
534 | querylogRef = putName("querylog"); |
535 | queryRef = putName("query"); |
536 | raiseRef = putName("raise"); |
537 | rangejoinRef = putName("rangejoin"); |
538 | rankRef = putName("rank"); |
539 | rapiRef = putName("rapi"); |
540 | reconnectRef = putName("reconnect"); |
541 | refineRef = putName("refine"); |
542 | registerRef = putName("register"); |
543 | register_supervisorRef = putName("register_supervisor"); |
544 | releaseRef = putName("release"); |
545 | remapRef = putName("remap"); |
546 | remoteRef = putName("remote"); |
547 | rename_columnRef = putName("rename_column"); |
548 | rename_schemaRef = putName("rename_schema"); |
549 | rename_tableRef = putName("rename_table"); |
550 | rename_userRef = putName("rename_user"); |
551 | replaceRef = putName("replace"); |
552 | replicatorRef = putName("replicator"); |
553 | resultSetRef = putName("resultSet"); |
554 | reuseRef = putName("reuse"); |
555 | revoke_functionRef = putName("revoke_function"); |
556 | revokeRef = putName("revoke"); |
557 | revoke_rolesRef = putName("revoke_roles"); |
558 | rollbackRef = putName("rollback"); |
559 | row_numberRef = putName("row_number"); |
560 | rpcRef = putName("rpc"); |
561 | rsColumnRef = putName("rsColumn"); |
562 | sampleRef= putName("sample"); |
563 | schedulerRef = putName("scheduler"); |
564 | selectNotNilRef = putName("selectNotNil"); |
565 | selectRef = putName("select"); |
566 | semaRef = putName("sema"); |
567 | semijoinRef = putName("semijoin"); |
568 | seriesRef = putName("series"); |
569 | setAccessRef = putName("setAccess"); |
570 | setVariableRef = putName("setVariable"); |
571 | setWriteModeRef= putName("setWriteMode"); |
572 | singleRef = putName("single"); |
573 | sinkRef = putName("sink"); |
574 | sliceRef = putName("slice"); |
575 | sortRef = putName("sort"); |
576 | sqlcatalogRef = putName("sqlcatalog"); |
577 | sqlRef = putName("sql"); |
578 | startRef = putName("start"); |
579 | starttraceRef = putName("starttrace"); |
580 | stoptraceRef = putName("stoptrace"); |
581 | streamsRef = putName("streams"); |
582 | strRef = putName("str"); |
583 | subavgRef = putName("subavg"); |
584 | subcountRef = putName("subcount"); |
585 | subdeltaRef = putName("subdelta"); |
586 | subeval_aggrRef = putName("subeval_aggr"); |
587 | subgroupdoneRef= putName("subgroupdone"); |
588 | subgroupRef = putName("subgroup"); |
589 | subinterRef = putName("subinterRef"); |
590 | submaxRef = putName("submax"); |
591 | submedianRef = putName("submedian"); |
592 | subminRef = putName("submin"); |
593 | subprodRef = putName("subprod"); |
594 | subsliceRef = putName("subslice"); |
595 | subsumRef = putName("subsum"); |
596 | subuniformRef= putName("subuniform"); |
597 | sumRef = putName("sum"); |
598 | takeRef= putName("take"); |
599 | thetajoinRef = putName("thetajoin"); |
600 | thetaselectRef = putName("thetaselect"); |
601 | tidRef = putName("tid"); |
602 | timestampRef = putName("timestamp"); |
603 | transaction_abortRef= putName("transaction_abort"); |
604 | transaction_beginRef= putName("transaction_begin"); |
605 | transaction_commitRef= putName("transaction_commit"); |
606 | transactionRef= putName("transaction"); |
607 | transaction_releaseRef= putName("transaction_release"); |
608 | transaction_rollbackRef= putName("transaction_rollback"); |
609 | uniqueRef= putName("unique"); |
610 | unlockRef= putName("unlock"); |
611 | unpackRef = putName("unpack"); |
612 | unpinRef = putName("unpin"); |
613 | updateRef = putName("update"); |
614 | userRef = putName("user"); |
615 | vectorRef = putName("vector"); |
616 | window_boundRef = putName("window_bound"); |
617 | wlcRef = putName("wlc"); |
618 | wlrRef = putName("wlr"); |
619 | zero_or_oneRef = putName("zero_or_one"); |
620 | /* ! please keep this list sorted for easier maintenance ! */ |
621 | } |
622 |