limbo/testing
Glauber Costa 097510216e implement the projector operator for DBSP
My goal with this patch is to be able to implement the ProjectOperator
for DBSP circuits using VDBE for expression evaluation.

*not* doing so is dangerous for the following reason: we will end up
with different, subtle, and incompatible behavior between SQLite
expressions if they are used in views versus outside of views.

In fact, even in our prototype had them: our projection tests, which
used to pass, were actually wrong =) (sqlite would return something
different if those functions were executed outside the view context)

For optimization reasons, we single out trivial expressions: they don't
have go through VDBE. Trivial expressions are expressions that only
involve Columns, Literals, and simple operators on elements of the same
type. Even type coercion takes this out of the realm of trivial.

Everything that is not trivial, is then translated with translate_expr -
in the same way SQLite will, and then compiled with VDBE.

We can, over time, make this process much better. There are essentially
infinite opportunities for optimization here. But for now, the main
warts are:
* VDBE execution needs a connection
* There is no good way in VDBE to pass parameters to a program.
* It is almost trivial to pollute the original connection. For example,
  we need to issue HALT for the program to stop, but seeing that halt
  will usually cause the program to try and halt the original program.

Subprograms, like the ones we use in triggers are a possible solution,
but they are much more expensive to execute, especially given that our
execution would essentially have to have a program with no other role
than to wrap the subprogram.

Therefore, what I am doing is:
* There is an in-memory database inside the projection operator (an
  obvious optimization is to share it with *all* projection operators).
* We obtain a connection to that database when the operator is created
* We use that connection to execute our VDBE, which offers a clean, safe
  and isolated way to execute the expression.
* We feed the values to the program manually by editing the registers
  directly.
2025-08-25 17:48:17 +03:00
..
cli_tests dont time the first iteration of sqlite benchmark 2025-08-18 17:39:50 -04:00
javascript testing/javascript: Add test case for blobs 2025-08-22 14:17:45 +03:00
sqlite3 testing/sqlite3: Update all.test 2025-08-02 13:00:18 +03:00
sqlite_test_ext Implement xBestIndex for kvstore.c 2025-08-04 19:25:11 +02:00
test_files CSV import fixes 2025-07-15 16:44:11 +03:00
unreliable-libc unreliable-libc: Make fault injection seed configurable 2025-08-20 13:50:04 +03:00
wal testing: Add test database + WAL file 2024-08-03 12:16:34 +03:00
agg-functions.test chore: enable indexes by default 2025-08-01 15:44:56 +03:00
all.test Add framework for testing extensions in TCL 2025-08-15 21:06:27 +02:00
alter_table.test fix: check if index exists with the same name 2025-08-13 08:55:17 +03:00
analyze.test ANALYZE creates sqlite_stat1 if it doesn't exist 2025-08-24 13:35:39 -07:00
attach.test Support ATTACH (read only) 2025-07-24 19:19:48 -05:00
boolean.test Fix incompatibility AND Expression 2025-04-13 22:38:43 -03:00
changes.test Created basic tcl tests for changes and total_changes 2025-01-19 20:51:16 -05:00
cmdlineshell.test refactor(testing): move .table tests to shelltests.py 2024-12-18 09:10:37 +02:00
coalesce.test extend TCL tests for COALESCE 2025-02-09 22:01:33 +04:00
collate.test implement the collseq bytecode instruction 2025-08-05 13:49:04 -05:00
compare.test Add Null comparision tests 2025-01-19 00:39:10 +05:30
concat.test Added Concat Opcode 2025-01-21 00:29:23 +05:30
create_table.test Add regression test for #2686 2025-08-21 16:40:10 +03:00
default_value.test chore: make every CREATE TABLE stmt in entire repo have 1 space after tbl name 2025-07-22 11:35:21 +03:00
delete.test chore: enable indexes by default 2025-08-01 15:44:56 +03:00
drop_index.test Including tests 2025-08-05 21:18:52 -07:00
drop_table.test chore: enable indexes by default 2025-08-01 15:44:56 +03:00
gen-database.py ruff lint fix 2025-06-20 15:59:03 -03:00
glob.test testing/glob.test: Run in-memory mode 2025-07-07 11:09:54 +03:00
groupby.test chore: enable indexes by default 2025-08-01 15:44:56 +03:00
insert.test update test 2025-08-19 23:11:10 -04:00
integrity_check.test integrity test with tcl 2025-06-11 18:39:06 +02:00
join.test Evaluate WHERE conditions after LEFT JOIN 2025-08-08 06:26:30 +02:00
json.test make tests pass 2025-03-30 18:58:38 +03:00
like.test Escape character is ignored in LIKE function #1051 2025-03-01 18:32:09 +01:00
literal.test handle int64 overflow by f64 2025-05-08 22:22:55 +08:00
materialized_views.test implement the projector operator for DBSP 2025-08-25 17:48:17 +03:00
math.test Merge 'Parse hex integers 2' from Anton Harniakou 2025-04-16 11:13:01 +03:00
null.test Support isnull and notnull expr 2025-05-11 23:47:30 +08:00
offset.test Created TCL tests for select queries with offset 2025-01-26 16:40:30 -05:00
orderby.test Fix DISTINCT with ORDER BY 2025-08-15 15:49:55 +03:00
pragma.test Fix pragma module list tests 2025-08-11 12:13:47 -04:00
pyproject.toml Add bench-sqlite script and makefile command for benchmarking an I/O backend against sqlite3 2025-08-18 15:11:29 -04:00
README.md Add framework for testing extensions in TCL 2025-08-15 21:06:27 +02:00
rollback.test chore: enable indexes by default 2025-08-01 15:44:56 +03:00
scalar-functions-datetime.test Bump julian_day_converter to 0.4.5 2025-04-14 20:57:54 +08:00
scalar-functions-printf.test test fix 2025-02-04 21:02:51 +05:30
scalar-functions.test Including test for parsing large numeric strings as number when an operand is numerican when doing logical comparision 2025-08-01 16:30:32 -07:00
select.test chore: enable indexes by default 2025-08-01 15:44:56 +03:00
subquery.test chore: enable indexes by default 2025-08-01 15:44:56 +03:00
tester.tcl Add framework for testing extensions in TCL 2025-08-15 21:06:27 +02:00
testing.db fix: revert changes on testing dbs 2025-08-11 08:42:08 -03:00
testing_norowidalias.db fix: revert changes on testing dbs 2025-08-11 08:42:08 -03:00
testing_small.db implement is and is not where constraints 2025-01-31 23:01:49 -05:00
testing_user_version_10.db Add read implementation of user_version pragma with ReadCookie opcode 2025-02-07 09:23:48 -05:00
time.test extensions/time: normalize offset_sec 2025-02-19 21:25:14 +08:00
total-changes.test Add total_changes test 2025-06-07 17:37:36 +09:00
transactions.test Implement deferred transactions 2025-03-17 10:01:00 -03:00
update.test Add regression test 2025-08-21 16:31:12 +03:00
values.test improve handling of double quotes 2025-07-18 10:39:02 -05:00
vector.test testing: Add few TCL tests for vector extensions 2025-01-28 14:24:09 +02:00
views.test Implement views 2025-08-13 14:14:03 -05:00
vtab.test Extract TVF-related tests to TCL 2025-08-15 21:06:30 +02:00
where.test chore: enable indexes by default 2025-08-01 15:44:56 +03:00

Turso Testing

Testing Extensions

When adding tests for extensions, please follow these guidelines:

  • Tests that verify the internal logic or behavior of a particular extension should go into cli_tests/extensions.py.
  • Tests that verify how extensions interact with the database engine, such as virtual table handling, should be written in TCL (see vtab.test as an example).

To check which extensions are available in TCL, or to add a new one, refer to the tester.tcl file and look at the extension_map.