rjhallsted
9f18fdbfd2
Remove unecessary clone when executing LIKE function
2024-09-10 11:25:52 -07:00
sonhmai
9cc965186f
core: support modifiers in date function
2024-09-03 14:28:07 +07:00
Rajiv Harlalka
0b5b0a426d
remove redundant comment
...
Signed-off-by: Rajiv Harlalka <rajivharlalka009@gmail.com >
2024-08-30 20:28:37 +05:30
Rajiv Harlalka
1de974253b
add support for custom date time value as first parameter
...
Signed-off-by: Rajiv Harlalka <rajivharlalka009@gmail.com >
2024-08-30 20:27:59 +05:30
Rajiv Harlalka
6684fb46e4
FEAT: Implement the unixepoch function
...
Signed-off-by: Rajiv Harlalka <rajivharlalka009@gmail.com >
2024-08-30 20:27:58 +05:30
sonhmai
c32bb91dd5
core: support modifiers in time function
2024-08-24 18:31:34 +07:00
Kim Seon Woo
8f617dd394
Apply fmt
2024-08-20 18:44:06 +02:00
Kim Seon Woo
8bb2a48cb6
Add support for nullif scalar function
2024-08-20 18:36:06 +02:00
Pekka Enberg
edf0f754f6
Merge 'More structured query planner' from Jussi Saurio
...
Reader's guide to this PR:
The aim is to have a more structured and maintainable approach to generating bytecode from the query AST so that different parts of the query processing pipeline have clearer responsibilities, so that developing new functionality is easier. E.g.:
- If you want to implement join reordering -> you do it in `Optimizer`
- If you want to implement `GROUP BY` -> you change `QueryPlanNode::Aggregate` to include it, parse it in `Planner` and handle the code generation for it in `Emitter`
The pipeline is:
`SQL text -> Parser -> Planner -> Optimizer -> Emitter`
and this pipeline generates:
`SQL text -> AST -> Logical Plan -> Optimized Logical Plan -> SQLite Bytecode`
---
Module structure:
`plan.rs`: defines the `Operator` enum. An `Operator` is a tree of other `Operators`, e.g. an `Operator::Join` has `left` and `right` children, etc.
`planner.rs`: Parses an `ast::Select` into a `Plan` which is mainly a wrapper for a root `Operator`
`optimizer.rs`: Makes a new `Plan` from an input `Plan` - does predicate pushdown, constant elimination and turns `Scan` nodes into `SeekRowId` nodes where applicable
`emitter.rs`: Generates bytecode instructions from an input `Plan`.
---
Adds feature `EXPLAIN QUERY PLAN <stmt>` which shows the logical query plan instead of the bytecode plan
---
Other changes:
- Almost everything from `select.rs` removed; things like `translate_aggregation()` moved to `expr.rs`
- `where_clause.rs` removed, some things from it like `translate_condition_expr()` moved to `expr.rs`
- i.e.: there is nothing _new_ in `expr.rs`, stuff just moved there
---
Concerns:
- Perf impact: there's a lot more indirection than before (`Operator`s are very "traditional" trees where they refer to other operators via Boxes etc)
Closes #281
2024-08-18 16:36:51 +03:00
jussisaurio
e8c894e532
More flexible Emitter via stateful operators
2024-08-17 12:55:16 +03:00
JeanArhancet
b6c720c90a
feat: add quote function
2024-08-17 09:28:14 +02:00
jussisaurio
2e32ca0bdb
More structured query planner
2024-08-16 19:42:03 +03:00
Kim Seon Woo
48d3c05fb0
Rebase
2024-08-16 21:40:30 +09:00
Pekka Enberg
c9c0d2808c
Merge 'Add support for ifnull scalar function' from Kim Seon Woo
...
Add support for `ifnull` scalar function
### EXPLAIN SELECT ifnull(null, 20);

### Related issue
https://github.com/penberg/limbo/issues/144
Closes #290
2024-08-16 14:37:08 +03:00
Pekka Enberg
ba3acedbc8
Merge 'Add support for substr scalar function' from Kim Seon Woo
...
Add support for `substr` scalar function. We can reuse the `substring` logic which is already implemted.
## Related issue
https://github.com/penberg/limbo/issues/144
Closes #289
2024-08-16 14:36:55 +03:00
김선우
8fbcd10e0e
Add support for ifnull scalar function
2024-08-16 09:25:04 +09:00
김선우
27d9af2bf4
Add support for substr scalar function
2024-08-16 08:26:42 +09:00
김선우
fe526e118e
Nit
2024-08-16 06:43:55 +09:00
김선우
77c3d130f3
Add char function support
2024-08-16 06:26:06 +09:00
Pekka Enberg
39e77bac9f
Merge 'Implement scala function substring(...) ' from Kim Seon Woo
...
Implement scala function `substring(x, y, z)` and `substring(x, y)`
### EXPLAIN SELECT substring('limbo', 3);

### EXPLAIN SELECT substring('limbo', 1, 2);

### Related issue
https://github.com/penberg/limbo/issues/144
Closes #286
2024-08-15 19:45:22 +03:00
김선우
ac440495bd
Nit
2024-08-15 18:59:46 +09:00
김선우
28bd0275c0
Run cargo fmt, clippy
2024-08-15 18:56:02 +09:00
김선우
dc48c2e71d
Add substring scala function with 2 arg
2024-08-15 18:47:32 +09:00
김선우
3fa3c5c002
Add substr scala function
2024-08-15 18:27:18 +09:00
gandeevanr
23a7d389b1
added unit tests for NewRowid
2024-08-08 19:04:10 -07:00
gandeevanr
a9cb8157b5
initial pass at implementing NewRowId
2024-08-07 09:04:09 -07:00
sonhmai
c104e50a66
core: add datetime modifiers helpers.
...
Building the helpers for integrating with supporting datetime Functions modifiers later.
2024-08-07 13:43:51 +07:00
Pekka Enberg
5b7d112e74
Merge 'implementation of json function json(X)' from Jean Arhancet
...
Add the `json` function `json(X)` (related to the issue https://github.com/penberg/limbo/issues/127 )
Closes #230
2024-08-06 08:05:33 +03:00
JeanArhancet
4050a3ebe2
refactor: impl json5 direclty
2024-08-04 12:47:08 +02:00
JeanArhancet
8dbced6a39
refactor: delete Insn Json
2024-08-04 10:56:51 +02:00
JeanArhancet
552090cb29
feat: add json support
2024-08-04 10:54:27 +02:00
sonhmai
0e7bd95e4e
core: fix clippy
2024-08-03 20:14:26 +07:00
Pekka Enberg
0affdada2a
core: Move datetime.rs to vdbe/
...
The file contains SQL functions invoked by the VDBE so let's move the
file there.
2024-08-02 17:34:10 +03:00
Pekka Enberg
9c479734be
core: Rename to exec_time()
...
Follow the same naming convention as other SQL functions.
2024-08-02 17:34:10 +03:00
Pekka Enberg
465dfa3cb5
core: Rename to exec_date()
...
Follow the same naming convention as other SQL functions.
2024-08-02 17:34:10 +03:00
jussisaurio
20c085614f
Add ability to annotate instructions with comments
2024-08-01 20:34:45 +03:00
jussisaurio
f344e07868
extract method
2024-08-01 17:54:29 +03:00
jussisaurio
551b11303f
Broaden the type of expr that qualifies as seekrowid candidate
2024-08-01 17:23:59 +03:00
jussisaurio
97dfae437c
SeekRowid VM instruction
2024-08-01 17:23:59 +03:00
jussisaurio
d965998cdf
btree_seek_rowid() implementation
2024-08-01 17:23:59 +03:00
Pekka Enberg
f8a43361db
core: Move pager.rs to storage module
2024-08-01 11:52:50 +03:00
Pekka Enberg
7abc48303f
core: Move btree.rs to storage module
2024-08-01 11:52:50 +03:00
Pekka Enberg
73bdf1671f
Initial pass on WAL reader
...
These are mostly just stubs for now, but at least we have some code in
place as reminder what we need.
2024-08-01 11:31:17 +03:00
Pekka Enberg
e88e57f9ba
Merge 'Random clippy cleanups' from Pekka Enberg
...
Closes #253
2024-08-01 10:22:25 +03:00
Pekka Enberg
82ff5b9c9b
core: Remove useless use of format!()
2024-08-01 09:16:02 +03:00
sonhmai
789ae4becf
feat: add time() scalar function partial support without modifier #158
2024-08-01 13:06:07 +07:00
Pere Diaz Bou
20dc068a9d
core: don't traverse twice
2024-07-31 17:27:02 +02:00
Pere Diaz Bou
3b9f5aa511
core: implement exists
2024-07-31 17:27:02 +02:00
Pere Diaz Bou
84bf0ea96a
core: remove a bunch of warnings
...
Signed-off-by: Pere Diaz Bou <pere-altea@hotmail.com >
2024-07-31 17:27:02 +02:00
Pere Diaz Bou
463292c2fe
core: fix rebase errors
2024-07-31 17:27:02 +02:00