* perf(query): let a TopK over a filtered scan publish its dynamic filter early Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(query): share the global TopK conditions and flush filters per batch Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(query): pin unsplit filter output at batch size 1 Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(query): balance rows when assigning ranges in time order Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(query): leave TopK on other sort keys unchanged Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(query): spread ranges of unknown size and test the scan wiring Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(query): share TopK test helpers and merge assignment cases Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(query): leave fetch-limited filters alone under a TopK A FilterExec with a fetch keeps the first rows that pass, so changing when the TopK threshold arrives or the order ranges are read changes which rows it keeps. Both rules now stop at such a filter. Also use replace_children instead of the deprecated with_new_children, and document the coalescer behavior that batch size 1 relies on. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(query): rewrite only TopKs bounded by a SortPreservingMergeExec A partitioned TopK keeps up to fetch rows per partition, which equals the global result only because the merge above it takes the first rows of all partitions. Match from that merge, through projections, and require the TopK's fetch to cover the merge's, so a TopK whose per-partition rows are part of the result is never rewritten. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * docs(query): state what the global TopK fetch cap does and does not bound Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(query): keep per-partition TopK heaps when no range can be skipped With no more ranges than partitions each partition reads at most one range, so the TopK threshold leaves no later range to skip and one heap only adds a single consumer. filtered_scan_below_topk now requires more ranges than partitions; both callers pass the partition count they plan for. The small sqlness tables in order_by and windowed_sort fall under the guard, so a new windowed_sort case with six files covers the rewrite end to end. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(perf): add a query regression case for time-index TopK over a selective filter Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(sqlness): say what the one-heap windowed_sort case pins Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Sqlness Test
Sqlness manual
Case file
Sqlness has two types of file:
.sql: test input, SQL only.result: expected test output, SQL and its results
.result is the output (execution result) file. If you see .result files is changed,
it means this test gets a different result and indicates it fails. You should
check change logs to solve the problem.
You only need to write test SQL in .sql file, and run the test.
Case organization
The root dir of input cases is tests/cases. It contains several subdirectories stand for different test
modes. E.g., standalone/ contains all the tests to run under greptimedb standalone start mode.
Under the first level of subdirectory (e.g. the cases/standalone), you can organize your cases as you like.
Sqlness walks through every file recursively and runs them.
Kafka WAL
Sqlness supports Kafka WAL. You can either provide a Kafka cluster or let sqlness to start one for you.
To run test with kafka, you need to pass the option -w kafka. If no other options are provided, sqlness will use conf/kafka-cluster.yml to start a Kafka cluster. This requires docker and docker-compose commands in your environment.
Otherwise, you can additionally pass the your existing kafka environment to sqlness with -k option. E.g.:
cargo sqlness bare -w kafka -k localhost:9092
In this case, sqlness will not start its own kafka cluster and the one you provided instead.
Run the test
Unlike other tests, this harness is in a binary target form. You can run it with:
cargo sqlness bare
It automatically finishes the following procedures: compile GreptimeDB, start it, grab tests and feed it to
the server, then collect and compare the results. You only need to check if the .result files are changed.
If not, congratulations, the test is passed 🥳!