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
.sltfile 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
bodyto derive the number of attributes in the query. We only consider syntactic cues, so we may end up derivingNonefor 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
SELECTquery. The projection may include wildcards, in which case the analysis just returnsNone. - derive_
order_ πby - Analyzes a queryβs
ORDER BYclause to derive anORDER BYclause 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 BYclause is then usable when querying a view that contains the sameSELECTas the given query. This function returns both the rewrittenORDER BYclause as well as a list of extra columns that need to be added to the queryβs projection for theORDER BYclause to succeed. - derive_
order_ πby_ from_ projection - Computes an
ORDER BYclause with only numeric references from given projection andORDER BYof aSELECTquery. 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
SELECTquery body. - format_
datum π - format_
row π - generate_
view_ πsql - Generates view creation, view indexing, view querying, and view
dropping SQL commands for a given
SELECTquery. 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_selectsand assumes that the provided input SQL has already been run through the parser, resulting in a validSELECTstatement. - mutate π
- Returns extra statements to execute after
stmtis 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.