Skip to main content

Module statement_completion

Module statement_completion 

Source
Expand description

Spark-reference session/navigation statements that DataFusion’s planner does not handle natively (Phase 60 statement completion).

DataFusion 54 already plans SET/RESET, SHOW TABLES|COLUMNS|FUNCTIONS, SHOW CREATE, TRUNCATE TABLE, DESCRIBE <table>, and EXPLAIN. This module fills the two navigation gaps a SQL/BI client expects:

  • USE [CATALOG|SCHEMA|DATABASE|NAMESPACE] <name> — set the session’s current catalog/schema so subsequent unqualified table references resolve there (Spark USE). USE a.b sets catalog a, schema b.
  • SHOW DATABASES / SHOW SCHEMAS — list schemas; rewritten to an information_schema.schemata query returning a Spark-style namespace column.

CACHE/UNCACHE TABLE (session materialization), SHOW PARTITIONS (Iceberg metadata), and DESCRIBE FUNCTION|DATABASE|QUERY remain the itemized statement shortfall in the matrix.

Structs§

UseTarget
The parsed target of a USE statement.

Functions§

apply_use
Apply a USE target to the session by mutating the default catalog/schema. Returns Some(Ok(())) when the query was a USE statement (handled), or None when it was not.
parse_use
Parse a USE … statement into its catalog/schema target, or None if the query is not a USE statement.
rewrite_show_databases
If query is SHOW DATABASES/SHOW SCHEMAS (optionally LIKE 'pat'), return an equivalent information_schema.schemata SELECT; otherwise None. The result column is namespace, matching Spark’s SHOW DATABASES.