Module mz_sqllogictest::runner

source ·
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

Enums

Constants

Traits

Functions

  • connect 🔒
  • Analyzes the provided query body to derive the number of attributes in the query. We only consider syntactic cues, so we may end up deriving None for the number of attributes as a conservative approximation.
  • 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 returns None.
  • Analyzes a query’s ORDER BY clause to derive an ORDER 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 rewritten ORDER BY clause is then usable when querying a view that contains the same SELECT as the given query. This function returns both the rewritten ORDER BY clause as well as a list of extra columns that need to be added to the query’s projection for the ORDER BY clause to succeed.
  • Computes an ORDER BY clause with only numeric references from given projection and ORDER BY of a SELECT query. If the derivation fails to match a given expression, the matched prefix is returned. Note that this could be empty.
  • Finds the projection list in a SELECT query body.
  • format_row 🔒
  • 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 valid SELECT statement.
  • mutate 🔒
    Returns extra statements to execute after stmt is executed.
  • print_sql 🔒
  • read_value 🔒
  • 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.