pub type Ast = Statement;
Aliased Type§
pub enum Ast {
Show 72 variants
Analyze {
table_name: ObjectName,
},
Truncate {
table_name: ObjectName,
},
Refresh {
table_name: ObjectName,
},
Query(Box<Query>),
Insert {
table_name: ObjectName,
columns: Vec<Ident>,
source: Box<Query>,
returning: Vec<SelectItem>,
},
Copy {
table_name: ObjectName,
columns: Vec<Ident>,
values: Vec<Option<String>>,
},
Update {
table_name: ObjectName,
assignments: Vec<Assignment>,
selection: Option<Expr>,
returning: Vec<SelectItem>,
},
Delete {
table_name: ObjectName,
selection: Option<Expr>,
returning: Vec<SelectItem>,
},
Discard(DiscardType),
CreateView {
or_replace: bool,
materialized: bool,
if_not_exists: bool,
name: ObjectName,
columns: Vec<Ident>,
query: Box<Query>,
emit_mode: Option<EmitMode>,
with_options: Vec<SqlOption>,
},
CreateTable {Show 18 fields
or_replace: bool,
temporary: bool,
if_not_exists: bool,
name: ObjectName,
columns: Vec<ColumnDef>,
wildcard_idx: Option<usize>,
constraints: Vec<TableConstraint>,
with_options: Vec<SqlOption>,
format_encode: Option<CompatibleFormatEncode>,
source_watermarks: Vec<SourceWatermark>,
append_only: bool,
on_conflict: Option<OnConflict>,
with_version_columns: Vec<Ident>,
query: Option<Box<Query>>,
cdc_table_info: Option<CdcTableInfo>,
include_column_options: Vec<IncludeOptionItem>,
webhook_info: Option<WebhookSourceInfo>,
engine: Engine,
},
CreateIndex {
name: ObjectName,
table_name: ObjectName,
columns: Vec<OrderByExpr>,
method: Option<Ident>,
include: Vec<Ident>,
distributed_by: Vec<Expr>,
unique: bool,
if_not_exists: bool,
with_properties: WithProperties,
},
CreateSource {
stmt: CreateSourceStatement,
},
CreateSink {
stmt: CreateSinkStatement,
},
CreateSubscription {
stmt: CreateSubscriptionStatement,
},
CreateConnection {
stmt: CreateConnectionStatement,
},
CreateSecret {
stmt: CreateSecretStatement,
},
CreateFunction {
or_replace: bool,
temporary: bool,
if_not_exists: bool,
name: ObjectName,
args: Option<Vec<OperateFunctionArg>>,
returns: Option<CreateFunctionReturns>,
params: CreateFunctionBody,
with_options: CreateFunctionWithOptions,
},
CreateAggregate {
or_replace: bool,
if_not_exists: bool,
name: ObjectName,
args: Vec<OperateFunctionArg>,
returns: DataType,
append_only: bool,
params: CreateFunctionBody,
},
DeclareCursor {
stmt: DeclareCursorStatement,
},
FetchCursor {
stmt: FetchCursorStatement,
},
CloseCursor {
stmt: CloseCursorStatement,
},
AlterDatabase {
name: ObjectName,
operation: AlterDatabaseOperation,
},
AlterSchema {
name: ObjectName,
operation: AlterSchemaOperation,
},
AlterTable {
name: ObjectName,
operation: AlterTableOperation,
},
AlterIndex {
name: ObjectName,
operation: AlterIndexOperation,
},
AlterView {
name: ObjectName,
materialized: bool,
operation: AlterViewOperation,
},
AlterSink {
name: ObjectName,
operation: AlterSinkOperation,
},
AlterSubscription {
name: ObjectName,
operation: AlterSubscriptionOperation,
},
AlterSource {
name: ObjectName,
operation: AlterSourceOperation,
},
AlterFunction {
name: ObjectName,
args: Option<Vec<OperateFunctionArg>>,
operation: AlterFunctionOperation,
},
AlterConnection {
name: ObjectName,
operation: AlterConnectionOperation,
},
AlterSecret {
name: ObjectName,
with_options: Vec<SqlOption>,
operation: AlterSecretOperation,
},
AlterFragment {
fragment_id: u32,
operation: AlterFragmentOperation,
},
AlterDefaultPrivileges {
target_users: Option<Vec<Ident>>,
schema_names: Option<Vec<ObjectName>>,
operation: DefaultPrivilegeOperation,
},
Describe {
name: ObjectName,
kind: DescribeKind,
},
DescribeFragment {
fragment_id: u32,
},
ShowObjects {
object: ShowObject,
filter: Option<ShowStatementFilter>,
},
ShowCreateObject {
create_type: ShowCreateType,
name: ObjectName,
},
ShowTransactionIsolationLevel,
CancelJobs(JobIdents),
Kill(String),
Drop(DropStatement),
DropFunction {
if_exists: bool,
func_desc: Vec<FunctionDesc>,
option: Option<ReferentialAction>,
},
DropAggregate {
if_exists: bool,
func_desc: Vec<FunctionDesc>,
option: Option<ReferentialAction>,
},
SetVariable {
local: bool,
variable: Ident,
value: SetVariableValue,
},
ShowVariable {
variable: Vec<Ident>,
},
StartTransaction {
modes: Vec<TransactionMode>,
},
Begin {
modes: Vec<TransactionMode>,
},
Abort,
SetTransaction {
modes: Vec<TransactionMode>,
snapshot: Option<Value>,
session: bool,
},
SetTimeZone {
local: bool,
value: SetTimeZoneValue,
},
Comment {
object_type: CommentObject,
object_name: ObjectName,
comment: Option<String>,
},
Commit {
chain: bool,
},
Rollback {
chain: bool,
},
CreateSchema {
schema_name: ObjectName,
if_not_exists: bool,
owner: Option<ObjectName>,
},
CreateDatabase {
db_name: ObjectName,
if_not_exists: bool,
owner: Option<ObjectName>,
resource_group: Option<SetVariableValue>,
barrier_interval_ms: Option<u32>,
checkpoint_frequency: Option<u64>,
},
Grant {
privileges: Privileges,
objects: GrantObjects,
grantees: Vec<Ident>,
with_grant_option: bool,
granted_by: Option<Ident>,
},
Revoke {
privileges: Privileges,
objects: GrantObjects,
grantees: Vec<Ident>,
granted_by: Option<Ident>,
revoke_grant_option: bool,
cascade: bool,
},
Deallocate {
name: Option<Ident>,
prepare: bool,
},
Execute {
name: Ident,
parameters: Vec<Expr>,
},
Prepare {
name: Ident,
data_types: Vec<DataType>,
statement: Box<Statement>,
},
Explain {
analyze: bool,
statement: Box<Statement>,
options: ExplainOptions,
},
ExplainAnalyzeStreamJob {
target: AnalyzeTarget,
duration_secs: Option<u64>,
},
CreateUser(CreateUserStatement),
AlterUser(AlterUserStatement),
AlterSystem {
param: Ident,
value: SetVariableValue,
},
Flush,
Wait,
Recover,
Use {
db_name: ObjectName,
},
Vacuum {
object_name: ObjectName,
full: bool,
},
}
Variants§
Analyze
Analyze (Hive)
Fields
table_name: ObjectName
Truncate
Truncate (Hive)
Fields
table_name: ObjectName
Refresh
Refresh table
Fields
table_name: ObjectName
Query(Box<Query>)
SELECT
Insert
INSERT
Fields
table_name: ObjectName
TABLE
returning: Vec<SelectItem>
Define output of this insert statement
Copy
Fields
table_name: ObjectName
TABLE
Update
UPDATE
Fields
table_name: ObjectName
TABLE
assignments: Vec<Assignment>
Column assignments
returning: Vec<SelectItem>
RETURNING
Delete
DELETE
Discard(DiscardType)
DISCARD
CreateView
CREATE VIEW
Fields
name: ObjectName
View name
CreateTable
CREATE TABLE
Fields
name: ObjectName
Table name
constraints: Vec<TableConstraint>
format_encode: Option<CompatibleFormatEncode>
FORMAT ... ENCODE ...
for table with connector
source_watermarks: Vec<SourceWatermark>
The watermark defined on source.
on_conflict: Option<OnConflict>
On conflict behavior
with_version_columns: Vec<Ident>
with_version_columns behind on conflict - supports multiple version columns
cdc_table_info: Option<CdcTableInfo>
FROM cdc_source TABLE database_name.table_name
include_column_options: Vec<IncludeOptionItem>
INCLUDE a AS b INCLUDE c
webhook_info: Option<WebhookSourceInfo>
VALIDATE SECRET secure_secret_name AS secure_compare ()
CreateIndex
CREATE INDEX
Fields
name: ObjectName
index name
table_name: ObjectName
columns: Vec<OrderByExpr>
with_properties: WithProperties
CreateSource
CREATE SOURCE
Fields
stmt: CreateSourceStatement
CreateSink
CREATE SINK
Fields
stmt: CreateSinkStatement
CreateSubscription
CREATE SUBSCRIPTION
Fields
CreateConnection
CREATE CONNECTION
Fields
CreateSecret
Fields
stmt: CreateSecretStatement
CreateFunction
CREATE FUNCTION
Postgres: https://www.postgresql.org/docs/15/sql-createfunction.html
Fields
name: ObjectName
args: Option<Vec<OperateFunctionArg>>
returns: Option<CreateFunctionReturns>
params: CreateFunctionBody
Optional parameters.
with_options: CreateFunctionWithOptions
CreateAggregate
CREATE AGGREGATE
Postgres: https://www.postgresql.org/docs/15/sql-createaggregate.html
DeclareCursor
DECLARE CURSOR
Fields
stmt: DeclareCursorStatement
FetchCursor
Fields
stmt: FetchCursorStatement
CloseCursor
Fields
stmt: CloseCursorStatement
AlterDatabase
ALTER DATABASE
AlterSchema
ALTER SCHEMA
AlterTable
ALTER TABLE
AlterIndex
ALTER INDEX
AlterView
ALTER VIEW
AlterSink
ALTER SINK
AlterSubscription
AlterSource
ALTER SOURCE
AlterFunction
ALTER FUNCTION
Fields
name: ObjectName
Function name
args: Option<Vec<OperateFunctionArg>>
operation: AlterFunctionOperation
AlterConnection
ALTER CONNECTION
AlterSecret
ALTER SECRET
AlterFragment
ALTER FRAGMENT
AlterDefaultPrivileges
DESCRIBE relation ALTER DEFAULT PRIVILEGES
Describe
DESCRIBE relation
DescribeFragment
DESCRIBE FRAGMENT <fragment_id>
ShowObjects
SHOW OBJECT COMMAND
ShowCreateObject
SHOW CREATE COMMAND
ShowTransactionIsolationLevel
CancelJobs(JobIdents)
CANCEL JOBS COMMAND
Kill(String)
KILL COMMAND Kill process in the show processlist.
Drop(DropStatement)
DROP
DropFunction
DROP FUNCTION
Fields
func_desc: Vec<FunctionDesc>
One or more function to drop
option: Option<ReferentialAction>
CASCADE
or RESTRICT
DropAggregate
DROP AGGREGATE
Fields
func_desc: Vec<FunctionDesc>
One or more function to drop
option: Option<ReferentialAction>
CASCADE
or RESTRICT
SetVariable
SET <variable>
Note: this is not a standard SQL statement, but it is supported by at least MySQL and PostgreSQL. Not all MySQL-specific syntactic forms are supported yet.
ShowVariable
SHOW <variable>
Note: this is a PostgreSQL-specific statement.
StartTransaction
START TRANSACTION ...
Fields
modes: Vec<TransactionMode>
Begin
BEGIN [ TRANSACTION | WORK ]
Fields
modes: Vec<TransactionMode>
Abort
ABORT
SetTransaction
SET TRANSACTION ...
SetTimeZone
SET [ SESSION | LOCAL ] TIME ZONE { value | 'value' | LOCAL | DEFAULT }
Comment
COMMENT ON ...
Note: this is a PostgreSQL-specific statement.
Commit
COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
Rollback
ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
CreateSchema
CREATE SCHEMA
CreateDatabase
CREATE DATABASE
Grant
GRANT privileges ON objects TO grantees
Revoke
REVOKE privileges ON objects FROM grantees
Deallocate
DEALLOCATE [ PREPARE ] { name | ALL }
Note: this is a PostgreSQL-specific statement.
Execute
EXECUTE name [ ( parameter [, ...] ) ]
Note: this is a PostgreSQL-specific statement.
Prepare
PREPARE name [ ( data_type [, ...] ) ] AS statement
Note: this is a PostgreSQL-specific statement.
Explain
EXPLAIN / DESCRIBE for select_statement
Fields
options: ExplainOptions
options of the explain statement
ExplainAnalyzeStreamJob
EXPLAIN ANALYZE for stream job
We introduce a new statement rather than reuse EXPLAIN
because
the body of the statement is not an SQL query.
TODO(kwannoel): Make profiling duration configurable: EXPLAIN ANALYZE (DURATION 1s) …
CreateUser(CreateUserStatement)
CREATE USER
AlterUser(AlterUserStatement)
ALTER USER
AlterSystem
ALTER SYSTEM SET configuration_parameter { TO | = } { value | ‘value’ | DEFAULT }
Flush
FLUSH the current barrier.
Note: RisingWave specific statement.
Wait
WAIT for ALL running stream jobs to finish. It will block the current session the condition is met.
Recover
Trigger stream job recover
Use
USE <db_name>
Note: this is a RisingWave specific statement and used to switch the current database.
Fields
db_name: ObjectName
Vacuum
VACUUM [FULL] [database_name][schema_name][object_name]
Note: this is a RisingWave specific statement for iceberg table/sink compaction.