VALUES listsDataFusion is designed to be extensible at all points. To that end, you can provide your own custom:
TableProvider) for tablesOptimizer passes (plan rewrites)LogicalPlan nodesExecutionPlan nodesThis crate is tested with the latest stable version of Rust. We do not currently test against other, older versions of the Rust compiler.
This library currently supports many SQL constructs, including
CREATE EXTERNAL TABLE X STORED AS PARQUET LOCATION '...'; to register a table's locationsSELECT ... FROM ... together with any expressionALIAS to name an expressionCAST to change types, including e.g. Timestamp(Nanosecond, None)+, /, sqrt, tan, >=.WHERE to filterGROUP BY together with one of the following aggregations: MIN, MAX, COUNT, SUM, AVG, CORR, VAR, COVAR, STDDEV (sample and population)ORDER BY together with an expression and optional ASC or DESC and also optional NULLS FIRST or NULLS LASTDataFusion strives to implement a subset of the PostgreSQL SQL dialect where possible. We explicitly choose a single dialect to maximize interoperability with other tools and allow reuse of the PostgreSQL documents and tutorials as much as possible.
Currently, only a subset of the PostgreSQL dialect is implemented, and we will document any deviations.
DataFusion supports the showing metadata about the tables available. This information can be accessed using the views of the ISO SQL information_schema schema or the DataFusion specific SHOW TABLES and SHOW COLUMNS commands.
More information can be found in the Postgres docs).
To show tables available for use in DataFusion, use the SHOW TABLES command or the information_schema.tables view:
> show tables; +---------------+--------------------+------------+------------+ | table_catalog | table_schema | table_name | table_type | +---------------+--------------------+------------+------------+ | datafusion | public | t | BASE TABLE | | datafusion | information_schema | tables | VIEW | +---------------+--------------------+------------+------------+ > select * from information_schema.tables; +---------------+--------------------+------------+--------------+ | table_catalog | table_schema | table_name | table_type | +---------------+--------------------+------------+--------------+ | datafusion | public | t | BASE TABLE | | datafusion | information_schema | TABLES | SYSTEM TABLE | +---------------+--------------------+------------+--------------+
To show the schema of a table in DataFusion, use the SHOW COLUMNS command or the or information_schema.columns view:
> show columns from t; +---------------+--------------+------------+-------------+-----------+-------------+ | table_catalog | table_schema | table_name | column_name | data_type | is_nullable | +---------------+--------------+------------+-------------+-----------+-------------+ | datafusion | public | t | a | Int32 | NO | | datafusion | public | t | b | Utf8 | NO | | datafusion | public | t | c | Float32 | NO | +---------------+--------------+------------+-------------+-----------+-------------+ > select table_name, column_name, ordinal_position, is_nullable, data_type from information_schema.columns; +------------+-------------+------------------+-------------+-----------+ | table_name | column_name | ordinal_position | is_nullable | data_type | +------------+-------------+------------------+-------------+-----------+ | t | a | 0 | NO | Int32 | | t | b | 1 | NO | Utf8 | | t | c | 2 | NO | Float32 | +------------+-------------+------------------+-------------+-----------+
DataFusion uses Arrow, and thus the Arrow type system, for query execution. The SQL types from sqlparser-rs are mapped to Arrow types according to the following table
| SQL Data Type | Arrow DataType |
|---|---|
CHAR | Utf8 |
VARCHAR | Utf8 |
UUID | Not yet supported |
CLOB | Not yet supported |
BINARY | Not yet supported |
VARBINARY | Not yet supported |
DECIMAL | Float64 |
FLOAT | Float32 |
SMALLINT | Int16 |
INT | Int32 |
BIGINT | Int64 |
REAL | Float32 |
DOUBLE | Float64 |
BOOLEAN | Boolean |
DATE | Date32 |
TIME | Time64(TimeUnit::Millisecond) |
TIMESTAMP | Timestamp(TimeUnit::Nanosecond) |
INTERVAL | Not yet supported |
REGCLASS | Not yet supported |
TEXT | Not yet supported |
BYTEA | Not yet supported |
CUSTOM | Not yet supported |
ARRAY | Not yet supported |