Expand description
The Materialize-specific runner for sqllogictest.
slt tests expect a serialized execution of sql statements and queries. To get the same results in materialize we track current_timestamp and increment it whenever we execute a statement.
The high-level workflow is: for each record in the test file: if record is a sql statement: run sql in postgres, observe changes and copy them to materialize using LocalInput::Updates(..) advance current_timestamp promise to never send updates for times < current_timestamp using LocalInput::Watermark(..) compare to expected results if wrong, bail out and stop processing this file if record is a sql query: peek query at current_timestamp compare to expected results if wrong, record the error
Structs§
- Outcomes
- Outcomes
Display - Query
Info 🔒 - Rewrite
Buffer 🔒 - Provides a means to rewrite the
.slt
file while iterating over it. - RunConfig
- Runner
- Runner
Inner - Slt
Enums§
Constants§
- INCONSISTENT_
VIEW_ 🔒OUTCOME_ WARNING_ REGEXPS - Regular expressions for matching error messages that should force a plan failure in an inconsistent view outcome into a warning if the corresponding query succeeds.
- NUM_
OUTCOMES 🔒 - SUCCESS_
OUTCOME 🔒 - WARNING_
OUTCOME 🔒
Traits§
Functions§
- connect 🔒
- derive_
num_ 🔒attributes - Analyzes the provided query
body
to derive the number of attributes in the query. We only consider syntactic cues, so we may end up derivingNone
for the number of attributes as a conservative approximation. - derive_
num_ 🔒attributes_ from_ projection - Computes the number of attributes that are obtained by the
projection of a
SELECT
query. The projection may include wildcards, in which case the analysis just returnsNone
. - derive_
order_ 🔒by - Analyzes a query’s
ORDER BY
clause to derive anORDER BY
clause that makes numeric references to any expressions in the projection and generated-attribute references to expressions that need to be added as extra columns to the projection list. The rewrittenORDER BY
clause is then usable when querying a view that contains the sameSELECT
as the given query. This function returns both the rewrittenORDER BY
clause as well as a list of extra columns that need to be added to the query’s projection for theORDER BY
clause to succeed. - derive_
order_ 🔒by_ from_ projection - Computes an
ORDER BY
clause with only numeric references from given projection andORDER BY
of aSELECT
query. If the derivation fails to match a given expression, the matched prefix is returned. Note that this could be empty. - find_
projection 🔒 - Finds the projection list in a
SELECT
query body. - format_
datum 🔒 - format_
row 🔒 - generate_
view_ 🔒sql - Generates view creation, view indexing, view querying, and view
dropping SQL commands for a given
SELECT
query. If the number of attributes produced by the query is known, the view commands are specialized to avoid issues with column ambiguity. This function is a helper for--auto_index_selects
and assumes that the provided input SQL has already been run through the parser, resulting in a validSELECT
statement. - mutate 🔒
- Returns extra statements to execute after
stmt
is executed. - print_
record 🔒 - print_
sql 🔒 - print_
sql_ 🔒if - read_
be_ 🔒i32 - read_
value 🔒 - rewrite_
file - run_
file - run_
string - should_
warn 🔒 - Evaluates if the given outcome should be returned directly or if it should be wrapped as a warning. Note that this function should be used for outcomes that can be judged in a context-independent manner, i.e., the outcome itself provides enough information as to whether a warning should be emitted or not.