Skip to main content

Parser

Struct Parser 

Source
pub struct Parser { /* private fields */ }
Expand description

Recursive-descent SQL parser that converts a token stream into an AST.

The parser consumes a Vec<Token> produced by the Tokenizer and builds a tree of Expression nodes. It supports the full SQL grammar including SELECT, DML (INSERT/UPDATE/DELETE/MERGE), DDL (CREATE/ALTER/DROP), window functions, CTEs, set operations, and 30+ dialect-specific extensions.

§Quick start

For most use cases the static helper Parser::parse_sql is the simplest entry point:

use polyglot_sql::parser::Parser;

let statements = Parser::parse_sql("SELECT 1; SELECT 2")?;
assert_eq!(statements.len(), 2);

For dialect-aware parsing, use Parser::with_config or Parser::parse_sql_with_config.

Implementations§

Source§

impl Parser

Source

pub fn new(tokens: Vec<Token>) -> Self

Create a new parser from a pre-tokenized token stream with default configuration.

Prefer Parser::parse_sql if you are starting from a raw SQL string.

Source

pub fn with_config(tokens: Vec<Token>, config: ParserConfig) -> Self

Create a parser from a pre-tokenized token stream with a custom ParserConfig.

Source

pub fn with_source( tokens: Vec<Token>, config: ParserConfig, source: String, ) -> Self

Create a parser with source SQL attached.

The original SQL text is stored so that Command expressions (unparsed dialect-specific statements) can preserve the exact source verbatim.

Source

pub fn parse_sql(sql: &str) -> Result<Vec<Expression>>

Parse one or more SQL statements from a raw string.

This is the main entry point for most callers. It tokenizes the input with the default TokenizerConfig, then parses all semicolon-separated statements and returns them as a Vec<Expression>.

§Errors

Returns an error if the input contains invalid tokens or syntax that the parser cannot recognize.

§Example
let stmts = Parser::parse_sql("SELECT a FROM t WHERE x = 1")?;
Source

pub fn parse_sql_with_config( sql: &str, tokenizer_config: TokenizerConfig, ) -> Result<Vec<Expression>>

Parse SQL from a string using a custom TokenizerConfig.

Use this variant when the source dialect requires non-default tokenizer settings (e.g. different string quoting or comment syntax).

Source

pub fn parse(&mut self) -> Result<Vec<Expression>>

Parse all remaining statements from the token stream.

Consumes tokens until the end of input, splitting on semicolons. Returns one Expression per statement.

Source

pub fn parse_standalone_data_type(&mut self) -> Result<DataType>

Parse exactly one standalone data type from the token stream.

This entry point is intended for callers that need to parse native type strings such as DECIMAL(10, 2) without wrapping them in a SQL statement or CAST(...) expression.

Source

pub fn parse_statement(&mut self) -> Result<Expression>

Parse a single SQL statement from the current position in the token stream.

Dispatches to the appropriate sub-parser based on the leading keyword (SELECT, INSERT, CREATE, etc.). Unknown or dialect-specific statements fall through to a Command expression that preserves the raw SQL text.

Source

pub fn parse_add_column(&mut self) -> Result<Option<Expression>>

parse_add_column - Implemented from Python _parse_add_column Calls: parse_column, parse_column_def_with_exists

Source

pub fn parse_alias(&mut self) -> Result<Option<Expression>>

parse_alias - Parses alias for an expression This method parses just the alias part (AS name or just name) Python: _parse_alias

Source

pub fn parse_alias_with_expr( &mut self, this: Option<Expression>, ) -> Result<Option<Expression>>

parse_alias_with_expr - Wraps an expression with an alias if present

Source

pub fn parse_alter_diststyle(&mut self) -> Result<Option<Expression>>

parse_alter_diststyle - Implemented from Python _parse_alter_diststyle parse_alter_diststyle - Parses ALTER TABLE DISTSTYLE clause (Redshift) Python: parser.py:7797-7802

Source

pub fn parse_alter_session(&mut self) -> Result<Option<Expression>>

parse_alter_session - Parses ALTER SESSION SET/UNSET statements Python: parser.py:7879-7889

Source

pub fn parse_alter_sortkey(&mut self) -> Result<Option<Expression>>

parse_alter_sortkey - Parses ALTER TABLE SORTKEY clause (Redshift) Python: parser.py:7804-7816

Source

pub fn parse_alter_sortkey_impl( &mut self, compound: Option<bool>, ) -> Result<Option<Expression>>

Implementation of parse_alter_sortkey with compound option

Source

pub fn parse_alter_table_add(&mut self) -> Result<Option<Expression>>

parse_alter_table_add - Parses ALTER TABLE ADD clause Python: parser.py:7715-7751

Source

pub fn parse_alter_table_alter(&mut self) -> Result<Option<Expression>>

parse_alter_table_alter - Parses ALTER TABLE ALTER COLUMN clause Python: parser.py:7753-7795

Source

pub fn parse_alter_table_drop(&mut self) -> Result<Option<Expression>>

Parse ALTER TABLE DROP action Note: Main ALTER TABLE DROP logic is implemented inline in parse_alter_table This method provides a separate entry point for the same functionality

Source

pub fn parse_alter_table_rename(&mut self) -> Result<Option<Expression>>

parse_alter_table_rename - Parses ALTER TABLE RENAME clause Python: parser.py:7828-7841

Source

pub fn parse_alter_table_set(&mut self) -> Result<Option<Expression>>

parse_alter_table_set - Parses ALTER TABLE SET clause Python: parser.py:7843-7877

Source

pub fn parse_analyze(&mut self) -> Result<Option<Expression>>

parse_analyze - Implemented from Python _parse_analyze Calls: parse_table_parts, parse_number, parse_table parse_analyze - Parses ANALYZE statement Python: parser.py:7937-7999

Source

pub fn parse_analyze_columns(&mut self) -> Result<Option<Expression>>

parse_analyze_columns - Parses ANALYZE … COLUMNS Python: parser.py:8055-8059 Note: AnalyzeColumns not in expressions.rs, using Identifier instead

Source

pub fn parse_analyze_delete(&mut self) -> Result<Option<Expression>>

parse_analyze_delete - Parses ANALYZE DELETE STATISTICS Python: parser.py:8061-8065

Source

pub fn parse_analyze_histogram(&mut self) -> Result<Option<Expression>>

parse_analyze_histogram - Parses ANALYZE … HISTOGRAM ON Python: parser.py:8073-8108

Source

pub fn parse_analyze_list(&mut self) -> Result<Option<Expression>>

parse_analyze_list - Parses ANALYZE LIST CHAINED ROWS Python: parser.py:8067-8070

Source

pub fn parse_analyze_statistics(&mut self) -> Result<Option<Expression>>

parse_analyze_statistics - Parses ANALYZE … STATISTICS Python: parser.py:8002-8031

Source

pub fn parse_analyze_validate(&mut self) -> Result<Option<Expression>>

parse_analyze_validate - Parses ANALYZE VALIDATE Python: parser.py:8034-8053

Source

pub fn parse_attach_detach(&mut self, is_attach: bool) -> Result<Expression>

parse_attach_detach - Parses ATTACH/DETACH statements (DuckDB) Python: DuckDB._parse_attach_detach

Source

pub fn parse_install(&mut self, force: bool) -> Result<Expression>

parse_install - Parses INSTALL statement (DuckDB) Python: DuckDB._parse_install

Source

pub fn parse_force_statement(&mut self) -> Result<Expression>

parse_force_statement - Parses FORCE INSTALL/CHECKPOINT (DuckDB) Python: DuckDB._parse_force

Source

pub fn parse_summarize_statement(&mut self) -> Result<Expression>

parse_summarize_statement - Parses SUMMARIZE statement (DuckDB) Python: DuckDB parser for SUMMARIZE

Source

pub fn parse_deallocate_prepare(&mut self) -> Result<Expression>

parse_deallocate_prepare - Parses DEALLOCATE PREPARE Presto/Trino syntax for deallocating prepared statements

Source

pub fn parse_as_command(&mut self) -> Result<Option<Expression>>

parse_as_command - Creates Command expression parse_as_command - Parses remaining tokens as a raw command Python: _parse_as_command Used as fallback when specific parsing fails

Source

pub fn parse_assignment(&mut self) -> Result<Option<Expression>>

parse_assignment - Parses assignment expressions (variable := value) Python: _parse_assignment

Source

pub fn parse_auto_increment(&mut self) -> Result<Option<Expression>>

parse_auto_increment - Implemented from Python _parse_auto_increment Calls: parse_bitwise

Source

pub fn parse_auto_property(&mut self) -> Result<Option<Expression>>

parse_auto_property - Implemented from Python _parse_auto_property

Source

pub fn parse_between(&mut self) -> Result<Option<Expression>>

parse_between - Implemented from Python _parse_between

Source

pub fn parse_bitwise(&mut self) -> Result<Option<Expression>>

parse_bitwise - Parses bitwise OR/XOR/AND expressions Python: _parse_bitwise Delegates to the existing parse_bitwise_or in the operator precedence chain

Source

pub fn parse_blockcompression(&mut self) -> Result<Option<Expression>>

parse_blockcompression - Implemented from Python _parse_blockcompression

Source

pub fn parse_boolean(&mut self) -> Result<Option<Expression>>

parse_boolean - Parse boolean literal (TRUE/FALSE) Python: if self._match(TokenType.TRUE): return exp.Boolean(this=True)

Source

pub fn parse_bracket(&mut self) -> Result<Option<Expression>>

parse_bracket - Ported from Python _parse_bracket Parses bracket expressions: array[index], array literal [1,2,3], or struct {key: value}

Source

pub fn parse_bracket_key_value(&mut self) -> Result<Option<Expression>>

parse_bracket_key_value - Ported from Python _parse_bracket_key_value Parses key-value pairs in brackets: key: value or key => value

Source

pub fn parse_ceil_floor(&mut self) -> Result<Option<Expression>>

parse_ceil_floor - Implemented from Python _parse_ceil_floor Calls: parse_lambda, parse_var

Source

pub fn parse_changes(&mut self) -> Result<Option<Expression>>

parse_changes - Implemented from Python _parse_changes Parses: CHANGES(INFORMATION => var) AT|BEFORE(…) END(…)

Source

pub fn parse_char(&mut self) -> Result<Option<Expression>>

parse_char - Parses CHAR/CHR function with optional USING charset Python: CHAR(args…) [USING charset] MySQL: CHAR(n1, n2, … USING charset)

Source

pub fn parse_character_set(&mut self) -> Result<Option<Expression>>

parse_character_set - Ported from Python _parse_character_set parse_character_set - Parses CHARACTER SET property Example: CHARACTER SET = utf8 or CHARACTER SET utf8mb4

Source

pub fn parse_checksum(&mut self) -> Result<Option<Expression>>

parse_checksum - Implemented from Python _parse_checksum

Source

pub fn parse_cluster(&mut self) -> Result<Option<Expression>>

parse_cluster - CLUSTER BY clause for Hive/Spark-style queries Parses a list of ordered expressions (columns with optional ASC/DESC)

Source

pub fn parse_clustered_by(&mut self) -> Result<Option<Expression>>

parse_clustered_by - Implemented from Python _parse_clustered_by

Source

pub fn parse_colon_as_variant_extract( &mut self, this: Expression, ) -> Result<Option<Expression>>

Parse Snowflake colon JSON path extraction: data:field or data:field.subfield Python: def _parse_colon_as_variant_extract(self, this)

Source

pub fn parse_column(&mut self) -> Result<Option<Expression>>

parse_column - Parse column expression Python: this = self._parse_column_reference(); return self._parse_column_ops(this)

Source

pub fn parse_column_constraint(&mut self) -> Result<Option<Expression>>

parse_column_constraint - Ported from Python _parse_column_constraint Parses column-level constraints like NOT NULL, PRIMARY KEY, UNIQUE, DEFAULT, CHECK, etc.

Source

pub fn parse_column_def_with_exists(&mut self) -> Result<Option<Expression>>

parse_column_def_with_exists - Ported from Python _parse_column_def_with_exists Parses a column definition with optional IF [NOT] EXISTS clause

Source

pub fn parse_column_ops(&mut self) -> Result<Option<Expression>>

parse_column_ops - Parses column operations (stub for compatibility)

Source

pub fn parse_column_ops_with_expr( &mut self, this: Option<Expression>, ) -> Result<Option<Expression>>

parse_column_ops_with_expr - Parses column operations (dot access, brackets, casts) Python: _parse_column_ops(this)

Source

pub fn parse_column_reference(&mut self) -> Result<Option<Expression>>

parse_column_reference - Parse column reference (field -> Column) Python: this = self._parse_field(); if isinstance(this, exp.Identifier): return exp.Column(this=this)

Source

pub fn parse_command(&mut self) -> Result<Option<Expression>>

parse_command - Parses a generic SQL command Python: _parse_command Used for commands that we don’t have specific parsing for

Source

pub fn parse_commit_or_rollback(&mut self) -> Result<Option<Expression>>

parse_commit_or_rollback - Implemented from Python _parse_commit_or_rollback

Source

pub fn parse_composite_key_property(&mut self) -> Result<Option<Expression>>

parse_composite_key_property - Implemented from Python _parse_composite_key_property

Source

pub fn parse_comprehension( &mut self, this: Option<Expression>, ) -> Result<Option<Expression>>

parse_comprehension - Implemented from Python _parse_comprehension Parses list comprehension: expr FOR var [, position] IN iterator [IF condition]

Source

pub fn parse_compress(&mut self) -> Result<Option<Expression>>

parse_compress - Parses COMPRESS column constraint (Teradata) Python: _parse_compress Format: COMPRESS or COMPRESS (value1, value2, …)

Source

pub fn parse_conjunction(&mut self) -> Result<Option<Expression>>

parse_conjunction - Parses AND expressions Python: _parse_conjunction Delegates to the existing parse_and in the operator precedence chain

Source

pub fn parse_connect_with_prior(&mut self) -> Result<Option<Expression>>

parse_connect_with_prior - Parses expression in CONNECT BY context with PRIOR support Python: _parse_connect_with_prior This method temporarily treats PRIOR as a prefix operator while parsing the expression

Source

pub fn parse_constraint(&mut self) -> Result<Option<Expression>>

parse_constraint - Parses named or unnamed constraint Python: _parse_constraint

Source

pub fn parse_unnamed_constraints(&mut self) -> Result<Vec<Expression>>

parse_unnamed_constraints - Parses multiple unnamed constraints Python: _parse_unnamed_constraints

Source

pub fn parse_unnamed_constraint(&mut self) -> Result<Option<Expression>>

parse_unnamed_constraint - Parses a single unnamed constraint Python: _parse_unnamed_constraint

Source

pub fn parse_contains_property(&mut self) -> Result<Option<Expression>>

parse_contains_property - Implemented from Python _parse_contains_property

Source

pub fn parse_convert(&mut self) -> Result<Option<Expression>>

parse_convert - Ported from Python _parse_convert Parses CONVERT function: CONVERT(expr USING charset) or CONVERT(expr, type)

Source

pub fn parse_copy_parameters(&mut self) -> Result<Option<Expression>>

parse_copy_parameters - Implemented from Python _parse_copy_parameters parse_copy_parameters - Parses COPY statement parameters Returns a tuple of CopyParameter expressions

Source

pub fn parse_copy_property(&mut self) -> Result<Option<Expression>>

parse_copy_property - Implemented from Python _parse_copy_property

Source

pub fn parse_create_like(&mut self) -> Result<Option<Expression>>

parse_create_like - Implemented from Python _parse_create_like Calls: parse_id_var

Source

pub fn parse_credentials(&mut self) -> Result<Option<Expression>>

parse_credentials - Implemented from Python _parse_credentials

Source

pub fn parse_csv(&mut self) -> Result<Option<Expression>>

parse_csv - Parses comma-separated expressions Python: _parse_csv In Python this takes a parse_method callback, but in Rust we use parse_expression_list

Source

pub fn parse_cte(&mut self) -> Result<Option<Expression>>

parse_cte - Implemented from Python _parse_cte Calls: parse_wrapped_id_vars

Source

pub fn parse_cube_or_rollup(&mut self) -> Result<Option<Expression>>

parse_cube_or_rollup - Ported from Python _parse_cube_or_rollup Parses CUBE(…) or ROLLUP(…) expressions in GROUP BY

Source

pub fn parse_data_deletion_property(&mut self) -> Result<Option<Expression>>

parse_data_deletion_property - Implemented from Python _parse_data_deletion_property Calls: parse_column, parse_retention_period

Source

pub fn parse_datablocksize(&mut self) -> Result<Option<Expression>>

parse_datablocksize - Implemented from Python _parse_datablocksize Calls: parse_number

Source

pub fn parse_dcolon(&mut self) -> Result<Option<Expression>>

parse_dcolon - Delegates to parse_types

Source

pub fn parse_ddl_select(&mut self) -> Result<Option<Expression>>

parse_ddl_select - Ported from Python _parse_ddl_select Parses a SELECT statement in DDL context (CREATE TABLE AS SELECT, INSERT INTO … SELECT)

Source

pub fn parse_for_in(&mut self) -> Result<Expression>

parse_for_in - BigQuery procedural FOR…IN…DO loop Python: BigQuery._parse_for_in Format: FOR variable IN (query) DO statement(s) END FOR Example: FOR record IN (SELECT * FROM t) DO SELECT record.col

Source

pub fn parse_declare(&mut self) -> Result<Option<Expression>>

parse_declare - Parses DECLARE statement Python: _parse_declare Format: DECLARE var1 type [DEFAULT expr], var2 type [DEFAULT expr], …

Source

pub fn parse_declareitem(&mut self) -> Result<Option<Expression>>

parse_declareitem - Parse a DECLARE item (variable declaration) TSQL format: @var AS type [= expr] or @var type [= expr] Also handles: DECLARE name CURSOR FOR SELECT … Also handles: DECLARE @var TABLE (col_defs)

Source

pub fn parse_decode(&mut self) -> Result<Option<Expression>>

parse_decode - Ported from Python _parse_decode Parses Oracle-style DECODE or simple DECODE function If 3+ args: Oracle DECODE(expr, search1, result1, …, default) If 2 args: character set decode (expr, charset)

Source

pub fn parse_definer(&mut self) -> Result<Option<Expression>>

parse_definer - MySQL DEFINER property Parses: DEFINER = user@host

Source

pub fn parse_derived_table_values(&mut self) -> Result<Option<Expression>>

parse_derived_table_values - Implemented from Python _parse_derived_table_values

Source

pub fn parse_dict_property( &mut self, property_name: &str, ) -> Result<Option<Expression>>

parse_dict_property - ClickHouse dictionary property Parses: property_name(kind(key1 value1, key2 value2, …)) property_name should be the already matched property keyword (LAYOUT, SOURCE, etc.)

Source

pub fn parse_dict_range( &mut self, property_name: &str, ) -> Result<Option<Expression>>

parse_dict_range - Implemented from Python _parse_dict_range Parses dictionary range specification: (MIN min_val MAX max_val) or (max_val)

Source

pub fn parse_disjunction(&mut self) -> Result<Option<Expression>>

parse_disjunction - Parses OR expressions Python: _parse_disjunction Delegates to the existing parse_or in the operator precedence chain

Source

pub fn parse_distkey(&mut self) -> Result<Option<Expression>>

parse_distkey - Redshift DISTKEY property for distribution key Parses: DISTKEY(column_name)

Source

pub fn parse_distributed_property(&mut self) -> Result<Option<Expression>>

parse_distributed_property - Implemented from Python _parse_distributed_property parse_distributed_property - Parses DISTRIBUTED BY property Python: parser.py:2462-2481

Source

pub fn parse_drop_column(&mut self) -> Result<Option<Expression>>

Parse DROP COLUMN in ALTER TABLE Note: Main ALTER TABLE DROP COLUMN logic is in parse_alter_table -> AlterTableAction::DropColumn

Source

pub fn parse_drop_partition(&mut self) -> Result<Option<Expression>>

Parse DROP PARTITION in ALTER TABLE Note: Main ALTER TABLE DROP PARTITION logic is in parse_alter_table -> AlterTableAction::DropPartition

Source

pub fn parse_drop_partition_with_exists( &mut self, exists: bool, ) -> Result<Option<Expression>>

Parse DROP PARTITION with exists flag

Source

pub fn parse_equality(&mut self) -> Result<Option<Expression>>

parse_equality - Parses comparison/equality expressions (= <> < > <= >=) Python: _parse_equality Delegates to the existing parse_comparison in the operator precedence chain

Source

pub fn parse_escape(&mut self) -> Result<Option<Expression>>

parse_escape - Parses ESCAPE clause for LIKE patterns Python: _parse_escape Returns the escape character/expression if ESCAPE keyword is found

Source

pub fn parse_exists(&mut self) -> Result<Option<Expression>>

parse_exists - Implemented from Python _parse_exists

Source

pub fn parse_exponent(&mut self) -> Result<Option<Expression>>

parse_exponent - Parses exponent/power expressions Python: _parse_exponent In most dialects, EXPONENT is empty, so this delegates to parse_unary

Source

pub fn parse_expressions(&mut self) -> Result<Option<Expression>>

parse_expressions - Parse comma-separated expressions Returns a Tuple containing all expressions, or None if empty

Source

pub fn parse_extract(&mut self) -> Result<Option<Expression>>

parse_extract - Ported from Python _parse_extract Parses EXTRACT(field FROM expression) function

Source

pub fn parse_factor(&mut self) -> Result<Option<Expression>>

parse_factor - Parses multiplication/division expressions (* / % operators) Python: _parse_factor Delegates to the existing parse_multiplication in the operator precedence chain

Source

pub fn parse_fallback(&mut self) -> Result<Option<Expression>>

parse_fallback - Implemented from Python _parse_fallback

Source

pub fn parse_field(&mut self) -> Result<Option<Expression>>

parse_field - Parse a field (column name, literal, or expression) Python: field = self._parse_primary() or self._parse_function() or self._parse_id_var()

Source

pub fn parse_field_def(&mut self) -> Result<Option<Expression>>

parse_field_def - Ported from Python _parse_field_def Parses a field definition (column name + type + optional constraints)

Source

pub fn parse_foreign_key(&mut self) -> Result<Option<Expression>>

parse_foreign_key - Implemented from Python _parse_foreign_key Calls: parse_key_constraint_options, parse_wrapped_id_vars, parse_references

Source

pub fn parse_format_json(&mut self) -> Result<Option<Expression>>

parse_format_json - Implemented from Python _parse_format_json

Source

pub fn parse_format_name(&mut self) -> Result<Option<Expression>>

parse_format_name - Snowflake FILE_FORMAT = format_name property Parses: format_name (string or identifier)

Source

pub fn parse_freespace(&mut self) -> Result<Option<Expression>>

parse_freespace - Teradata FREESPACE property Parses: FREESPACE = number [PERCENT]

Source

pub fn parse_function(&mut self) -> Result<Option<Expression>>

parse_function - Ported from Python _parse_function Parses function calls like func_name(args) or {fn func_name(args)} (ODBC syntax)

Source

pub fn parse_function_args_list(&mut self) -> Result<Vec<Expression>>

parse_function_args - Ported from Python _parse_function_args Parses the arguments inside a function call, handling aliases and key-value pairs

Source

pub fn parse_function_call(&mut self) -> Result<Option<Expression>>

parse_function_call - Ported from Python _parse_function_call Parses a function call expression like func_name(arg1, arg2, …)

Source

pub fn parse_function_parameter(&mut self) -> Result<Option<Expression>>

parse_function_parameter - Ported from Python _parse_function_parameter Parses a function parameter in CREATE FUNCTION (name type [DEFAULT expr])

Source

pub fn parse_gap_fill(&mut self) -> Result<Option<Expression>>

parse_gap_fill - Ported from Python _parse_gap_fill parse_gap_fill - Parses GAP_FILL function for time series Example: GAP_FILL(TABLE t, ts_column, bucket_width, partitioning_columns, value_columns)

Source

pub fn parse_semantic_view(&mut self) -> Result<Expression>

parse_semantic_view - Parse Snowflake SEMANTIC_VIEW function Example: SEMANTIC_VIEW(foo METRICS a.b, a.c DIMENSIONS a.b, a.c WHERE a.b > ‘1995-01-01’)

Source

pub fn parse_grant_principal(&mut self) -> Result<Option<Expression>>

parse_grant_principal - Implemented from Python _parse_grant_principal Calls: parse_id_var

Source

pub fn parse_grant_privilege(&mut self) -> Result<Option<Expression>>

parse_grant_privilege - Parse a single privilege in GRANT/REVOKE Parses: SELECT, INSERT, UPDATE(col1, col2), DELETE, etc.

Source

pub fn parse_grant_revoke_common(&mut self) -> Result<Option<Expression>>

parse_grant_revoke_common - Parses common parts of GRANT/REVOKE statements Python: _parse_grant_revoke_common Returns a Tuple containing (privileges, kind, securable)

Source

pub fn parse_group(&mut self) -> Result<Option<Expression>>

parse_group - Parse GROUP BY clause Python: if not self._match(TokenType.GROUP_BY): return None; expressions = self._parse_csv(self._parse_disjunction)

Source

pub fn parse_group_concat(&mut self) -> Result<Option<Expression>>

parse_group_concat - Ported from Python _parse_group_concat parse_group_concat - Parses MySQL GROUP_CONCAT function Example: GROUP_CONCAT(DISTINCT col ORDER BY col SEPARATOR ‘,’)

Source

pub fn parse_grouping_set(&mut self) -> Result<Option<Expression>>

parse_grouping_set - Delegates to parse_grouping_sets

Source

pub fn parse_grouping_sets(&mut self) -> Result<Option<Expression>>

parse_grouping_sets - Ported from Python _parse_grouping_sets Parses GROUPING SETS ((…), (…)) in GROUP BY

Source

pub fn parse_having(&mut self) -> Result<Option<Expression>>

parse_having - Parse HAVING clause Python: if not self._match(TokenType.HAVING): return None; return exp.Having(this=self._parse_disjunction())

Source

pub fn parse_having_max(&mut self) -> Result<Option<Expression>>

parse_having_max - Implemented from Python _parse_having_max Calls: parse_column

Source

pub fn parse_heredoc(&mut self) -> Result<Option<Expression>>

parse_heredoc - Implemented from Python _parse_heredoc Parses dollar-quoted strings: $$content$$, $tag$content$tag$

Source

pub fn parse_hint_body(&mut self) -> Result<Option<Expression>>

parse_hint_body - Delegates to parse_hint_fallback_to_string

Source

pub fn parse_hint_fallback_to_string(&mut self) -> Result<Option<Expression>>

parse_hint_fallback_to_string - Parses remaining hint tokens as a raw string Python: _parse_hint_fallback_to_string Used when structured hint parsing fails - collects all remaining tokens

Source

pub fn parse_hint_function_call(&mut self) -> Result<Option<Expression>>

parse_hint_function_call - Delegates to parse_function_call

Source

pub fn parse_historical_data(&mut self) -> Result<Option<Expression>>

parse_historical_data - Snowflake AT/BEFORE time travel clauses Parses: AT(TIMESTAMP => expr) or BEFORE(STATEMENT => ‘id’) etc. Reference: https://docs.snowflake.com/en/sql-reference/constructs/at-before

Source

pub fn parse_id_var(&mut self) -> Result<Option<Expression>>

parse_id_var - Ported from Python _parse_id_var Parses an identifier or variable (more permissive than parse_identifier)

Source

pub fn parse_identifier(&mut self) -> Result<Option<Expression>>

parse_identifier - Parse quoted identifier Python: if self._match(TokenType.IDENTIFIER): return self._identifier_expression(quoted=True)

Source

pub fn parse_if(&mut self) -> Result<Option<Expression>>

Parse IF expression IF(condition, true_value, false_value) - function style IF condition THEN true_value ELSE false_value END - statement style

Source

pub fn parse_in(&mut self) -> Result<Option<Expression>>

parse_in - Ported from Python _parse_in Parses IN expression: expr IN (values…) or expr IN (subquery) Can also parse standalone IN list after IN keyword has been matched

Source

pub fn parse_index(&mut self) -> Result<Option<Expression>>

parse_index - Implemented from Python _parse_index Calls: parse_index_params, parse_id_var

Source

pub fn parse_index_params(&mut self) -> Result<Option<Expression>>

parse_index_params - Implemented from Python _parse_index_params Calls: parse_where, parse_wrapped_properties, parse_wrapped_id_vars

Source

pub fn parse_initcap(&mut self) -> Result<Option<Expression>>

parse_initcap - Ported from Python _parse_initcap parse_initcap - Parses INITCAP function Example: INITCAP(str) or INITCAP(str, delimiter)

Source

pub fn parse_inline(&mut self) -> Result<Option<Expression>>

parse_inline - Implemented from Python _parse_inline

Source

pub fn parse_insert_table(&mut self) -> Result<Option<Expression>>

parse_insert_table - Parse table reference for INSERT statement Parses: table_name [schema] [partition] [alias] This method is a simple wrapper around parse_table for INSERT context

Source

pub fn parse_interpolate(&mut self) -> Result<Option<Expression>>

parse_interpolate - Implemented from Python _parse_interpolate Parses INTERPOLATE clause for ClickHouse ORDER BY WITH FILL

Source

pub fn parse_interval(&mut self) -> Result<Option<Expression>>

parse_interval - Creates Interval expression Parses INTERVAL expressions: INTERVAL ‘1 day’, INTERVAL 1 MONTH, etc.

Source

pub fn parse_interval_span(&mut self) -> Result<Option<Expression>>

parse_interval_span - Implemented from Python _parse_interval_span Calls: parse_function

Source

pub fn parse_into(&mut self) -> Result<Option<Expression>>

parse_into - Implemented from Python _parse_into Parses: INTO [TEMPORARY] [UNLOGGED] [TABLE] table_name Returns the table expression for the INTO clause

Source

pub fn parse_introducer(&mut self) -> Result<Option<Expression>>

parse_introducer - Parses MySQL introducer expression (_charset’string’) Python: _parse_introducer Format: _charset ‘literal’

Source

pub fn parse_is(&mut self) -> Result<Option<Expression>>

parse_is - Implemented from Python _parse_is Calls: parse_null, parse_bitwise

Source

pub fn parse_join(&mut self) -> Result<Option<Expression>>

parse_join - Ported from Python _parse_join Parses a single JOIN clause: [method] [side] [kind] JOIN table [ON condition | USING (columns)] Returns the Join wrapped in an Expression, or None if no join is found

Source

pub fn parse_join_hint(&mut self, hint_name: &str) -> Result<Option<Expression>>

parse_join_hint - Spark/Hive join hints (BROADCAST, MERGE, SHUFFLE_HASH, etc.) Parses: HINT_NAME(table1, table2, …) hint_name should be the already matched hint keyword (BROADCAST, MAPJOIN, etc.)

Source

pub fn parse_join_parts( &mut self, ) -> (Option<String>, Option<String>, Option<String>)

parse_join_parts - Ported from Python _parse_join_parts Returns (method, side, kind) where each is an optional string method: ASOF, NATURAL, POSITIONAL side: LEFT, RIGHT, FULL kind: ANTI, CROSS, INNER, OUTER, SEMI

Source

pub fn parse_journal(&mut self) -> Result<Option<Expression>>

parse_journal - Parses JOURNAL property (Teradata) Python: _parse_journal Creates a JournalProperty expression

Source

pub fn parse_journal_impl( &mut self, no: bool, dual: bool, before: bool, local: bool, after: bool, ) -> Result<Option<Expression>>

Implementation of parse_journal with options

Source

pub fn parse_json_column_def(&mut self) -> Result<Option<Expression>>

parse_json_column_def - Implemented from Python _parse_json_column_def Calls: parse_string, parse_json_schema, parse_id_var

Source

pub fn parse_json_key_value(&mut self) -> Result<Option<Expression>>

parse_json_key_value - Implemented from Python _parse_json_key_value parse_json_key_value - Parses a JSON key-value pair Python: _parse_json_key_value Format: [KEY] key [: | VALUE] value

Source

pub fn parse_json_object(&mut self) -> Result<Option<Expression>>

parse_json_object - Parses JSON_OBJECT function Python: _parse_json_object Handles both JSON_OBJECT and JSON_OBJECTAGG

Source

pub fn parse_json_object_impl( &mut self, agg: bool, ) -> Result<Option<Expression>>

Implementation of JSON object parsing with aggregate flag

Source

pub fn parse_json_schema(&mut self) -> Result<Option<Expression>>

parse_json_schema - Implemented from Python _parse_json_schema

Source

pub fn parse_json_table_columns(&mut self) -> Result<Option<Expression>>

Parse JSON_TABLE COLUMNS clause: COLUMNS (column_def, column_def, …) or COLUMNS column_def Column definitions can be:

  • name type PATH ‘json_path’
  • name FOR ORDINALITY
  • NESTED [PATH] ‘json_path’ COLUMNS (…)
Source

pub fn parse_json_table_column_def(&mut self) -> Result<Option<Expression>>

Parse a single JSON_TABLE column definition Formats:

  • name [FOR ORDINALITY] [type] [PATH ‘path’]
  • NESTED [PATH] ‘path’ COLUMNS (…)
Source

pub fn parse_json_table(&mut self) -> Result<Option<Expression>>

Parse JSON_TABLE function JSON_TABLE(expr, path COLUMNS (…)) [ON ERROR …] [ON EMPTY …]

Source

pub fn parse_json_value(&mut self) -> Result<Option<Expression>>

parse_json_value - Ported from Python _parse_json_value parse_json_value - Parses JSON_VALUE function Example: JSON_VALUE(json, ‘$.path’ RETURNING type)

Source

pub fn parse_key_constraint_options(&mut self) -> Result<Option<Expression>>

parse_key_constraint_options - Implemented from Python _parse_key_constraint_options

Source

pub fn parse_lambda(&mut self) -> Result<Option<Expression>>

parse_lambda - Ported from Python _parse_lambda Parses lambda expressions: x -> x + 1 or (x, y) -> x + y Also supports DuckDB syntax: LAMBDA x : x + 1

Source

pub fn parse_lambda_arg(&mut self) -> Result<Option<Expression>>

parse_lambda_arg - Delegates to parse_id_var

Source

pub fn parse_lateral(&mut self) -> Result<Option<Expression>>

parse_lateral - Parse LATERAL subquery or table function Python: if self._match(TokenType.LATERAL): return exp.Lateral(this=…, view=…, outer=…)

Source

pub fn parse_limit(&mut self) -> Result<Option<Expression>>

parse_limit - Parse LIMIT clause Python: if self._match(TokenType.LIMIT): return exp.Limit(this=self._parse_term())

Source

pub fn parse_limit_by(&mut self) -> Result<Option<Expression>>

parse_limit_by - Implemented from Python _parse_limit_by

Source

pub fn parse_limit_options(&mut self) -> Result<Option<Expression>>

parse_limit_options - Implemented from Python _parse_limit_options

Source

pub fn parse_load(&mut self) -> Result<Option<Expression>>

parse_load - Implemented from Python _parse_load

Source

pub fn parse_locking(&mut self) -> Result<Option<Expression>>

parse_locking - Implemented from Python _parse_locking Calls: parse_table_parts

Source

pub fn parse_log(&mut self) -> Result<Option<Expression>>

parse_log - Parses LOG property (Teradata) Python: _parse_log Creates a LogProperty expression

Source

pub fn parse_log_impl(&mut self, no: bool) -> Result<Option<Expression>>

Implementation of parse_log with no flag

Source

pub fn parse_match_against(&mut self) -> Result<Option<Expression>>

parse_match_against - Parses MATCH(columns) AGAINST(pattern) Python: parser.py:7125-7153

Source

pub fn parse_match_recognize_measure(&mut self) -> Result<Option<Expression>>

parse_match_recognize_measure - Implemented from Python _parse_match_recognize_measure Parses a MEASURES expression in MATCH_RECOGNIZE: [FINAL|RUNNING] expression

Source

pub fn parse_max_min_by(&mut self, is_max: bool) -> Result<Option<Expression>>

parse_max_min_by - MAX_BY / MIN_BY / ARG_MAX / ARG_MIN aggregate functions Parses: MAX_BY(value, key [, n]) or MIN_BY(value, key [, n]) is_max: true for MAX_BY/ARG_MAX, false for MIN_BY/ARG_MIN

Source

pub fn parse_merge(&mut self) -> Result<Option<Expression>>

Parse MERGE statement Python: def _parse_merge(self) -> exp.Merge

Source

pub fn parse_mergeblockratio(&mut self) -> Result<Option<Expression>>

parse_mergeblockratio - Parses MERGEBLOCKRATIO property (Teradata) Python: _parse_mergeblockratio Format: MERGEBLOCKRATIO = number [PERCENT] or NO MERGEBLOCKRATIO or DEFAULT MERGEBLOCKRATIO

Source

pub fn parse_mergeblockratio_impl( &mut self, no: bool, default: bool, ) -> Result<Option<Expression>>

Implementation of parse_mergeblockratio with options

Source

pub fn parse_modifies_property(&mut self) -> Result<Option<Expression>>

parse_modifies_property - Implemented from Python _parse_modifies_property

Source

pub fn parse_multitable_inserts( &mut self, leading_comments: Vec<String>, overwrite: bool, ) -> Result<Option<Expression>>

parse_multitable_inserts - Parses Oracle’s multi-table INSERT (INSERT ALL/FIRST) Python: _parse_multitable_inserts Syntax: INSERT ALL|FIRST [WHEN cond THEN] INTO table [(cols)] [VALUES(…)] … SELECT …

Source

pub fn parse_name_as_expression(&mut self) -> Result<Option<Expression>>

parse_name_as_expression - Parse identifier that can be aliased Parses: identifier [AS expression]

Source

pub fn parse_named_window(&mut self) -> Result<Option<Expression>>

parse_named_window - Ported from Python _parse_named_window Parses a named window definition: name AS (spec)

Source

pub fn parse_next_value_for(&mut self) -> Result<Option<Expression>>

parse_next_value_for - Parses NEXT VALUE FOR sequence_name Python: parser.py:6752-6761

Source

pub fn parse_no_property(&mut self) -> Result<Option<Expression>>

parse_no_property - Implemented from Python _parse_no_property

Source

pub fn parse_normalize(&mut self) -> Result<Option<Expression>>

parse_normalize - Ported from Python _parse_normalize parse_normalize - Parses NORMALIZE(expr [, form]) Python: NORMALIZE(expr, form) where form is NFC/NFD/NFKC/NFKD

Source

pub fn parse_not_constraint(&mut self) -> Result<Option<Expression>>

parse_not_constraint - Implemented from Python _parse_not_constraint Parses constraints that start with NOT: NOT NULL, NOT CASESPECIFIC

Source

pub fn parse_null(&mut self) -> Result<Option<Expression>>

parse_null - Parse NULL literal Python: if self._match_set((TokenType.NULL, TokenType.UNKNOWN)): return exp.Null

Source

pub fn parse_number(&mut self) -> Result<Option<Expression>>

parse_number - Parse numeric literal Python: TokenType.NUMBER -> exp.Literal(this=token.text, is_string=False) Handles Hive/Spark numeric suffixes encoded as “number::TYPE” by the tokenizer

Source

pub fn parse_odbc_datetime_literal(&mut self) -> Result<Option<Expression>>

parse_odbc_datetime_literal - Ported from Python _parse_odbc_datetime_literal parse_odbc_datetime_literal - Parses ODBC datetime literals Examples: {d’2023-01-01’}, {t’12:00:00’}, {ts’2023-01-01 12:00:00’}

Source

pub fn parse_offset(&mut self) -> Result<Option<Expression>>

parse_offset - Parse OFFSET clause Python: if self._match(TokenType.OFFSET): return exp.Offset(this=self._parse_term())

Source

pub fn parse_on_condition(&mut self) -> Result<Option<Expression>>

parse_on_condition - Ported from Python _parse_on_condition parse_on_condition - Parses ON EMPTY/ERROR/NULL conditions Example: NULL ON EMPTY, ERROR ON ERROR

Source

pub fn parse_on_handling(&mut self) -> Result<Option<Expression>>

parse_on_handling - Implemented from Python _parse_on_handling Calls: parse_bitwise

Source

pub fn parse_on_property(&mut self) -> Result<Option<Expression>>

parse_on_property - Implemented from Python _parse_on_property

Source

pub fn parse_opclass(&mut self) -> Result<Option<Expression>>

parse_opclass - Ported from Python _parse_opclass parse_opclass - Parses PostgreSQL operator class in index expressions Example: column_name text_pattern_ops

Source

pub fn parse_open_json(&mut self) -> Result<Option<Expression>>

parse_open_json - Parses SQL Server OPENJSON function Example: OPENJSON(json, ‘$.path’) WITH (col1 type ‘$.path’ AS JSON, …)

Source

pub fn parse_operator( &mut self, this: Option<Expression>, ) -> Result<Option<Expression>>

parse_operator - Ported from Python _parse_operator parse_operator - Parses PostgreSQL OPERATOR(op) syntax Example: col1 OPERATOR(~>) col2

Source

pub fn parse_order(&mut self) -> Result<Option<Expression>>

parse_order - Parse ORDER BY clause Python: if not self._match(TokenType.ORDER_BY): return this; return exp.Order(expressions=self._parse_csv(self._parse_ordered))

Source

pub fn parse_ordered(&mut self) -> Result<Option<Expression>>

parse_ordered - Implemented from Python _parse_ordered (wrapper for parse_ordered_item)

Source

pub fn parse_overlay(&mut self) -> Result<Option<Expression>>

parse_overlay - Ported from Python _parse_overlay Parses OVERLAY function: OVERLAY(string PLACING replacement FROM position [FOR length])

Source

pub fn parse_parameter(&mut self) -> Result<Option<Expression>>

parse_parameter - Parse named parameter (@name or :name) Python: this = self._parse_identifier() or self._parse_primary_or_var(); return exp.Parameter(this=this)

Source

pub fn parse_paren(&mut self) -> Result<Option<Expression>>

parse_paren - Ported from Python _parse_paren Parses parenthesized expressions: (expr), (select …), or (a, b, c)

Source

pub fn parse_partition(&mut self) -> Result<Option<Expression>>

parse_partition - Parses PARTITION/SUBPARTITION clause Python: _parse_partition

Source

pub fn parse_partition_and_order(&mut self) -> Result<Option<Expression>>

parse_partition_and_order - Delegates to parse_partition_by

Source

pub fn parse_partition_bound_spec_legacy( &mut self, ) -> Result<Option<Expression>>

parse_partition_bound_spec - Implemented from Python _parse_partition_bound_spec Calls: parse_bitwise, parse_number

Source

pub fn parse_partition_by(&mut self) -> Result<Option<Expression>>

parse_partition_by - Ported from Python _parse_partition_by Parses PARTITION BY expression list

Source

pub fn parse_partitioned_by(&mut self) -> Result<Option<Expression>>

parse_partitioned_by - Parses PARTITIONED BY clause Python: _parse_partitioned_by

Source

pub fn parse_partitioned_by_bucket_or_truncate( &mut self, ) -> Result<Option<Expression>>

parse_partitioned_by_bucket_or_truncate - Parses BUCKET or TRUNCATE partition transforms Python: _parse_partitioned_by_bucket_or_truncate Syntax: BUCKET(col, num_buckets) or TRUNCATE(col, width) Handles both Hive (num, col) and Trino (col, num) ordering, normalizes to (col, num)

Source

pub fn parse_partitioned_of(&mut self) -> Result<Option<Expression>>

parse_partitioned_of - Implemented from Python _parse_partitioned_of

Source

pub fn parse_period_for_system_time(&mut self) -> Result<Option<Expression>>

parse_period_for_system_time - Parses PERIOD FOR SYSTEM_TIME constraint Python: _parse_period_for_system_time Syntax: PERIOD FOR SYSTEM_TIME (start_col, end_col)

Source

pub fn parse_pipe_syntax_aggregate(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_aggregate - Implemented from Python _parse_pipe_syntax_aggregate

Source

pub fn parse_pipe_syntax_aggregate_fields( &mut self, ) -> Result<Option<Expression>>

parse_pipe_syntax_aggregate_fields - Implemented from Python _parse_pipe_syntax_aggregate_fields Calls: parse_disjunction

Source

pub fn parse_pipe_syntax_aggregate_group_order_by( &mut self, ) -> Result<Option<Expression>>

parse_pipe_syntax_aggregate_group_order_by - Parses pipe syntax aggregate fields with grouping and ordering Python: _parse_pipe_syntax_aggregate_group_order_by Parses comma-separated aggregate fields and separates them into aggregates/groups and ORDER BY specs Returns a Tuple with two elements: (aggregates_and_groups, order_by_specs)

Source

pub fn parse_pipe_syntax_extend(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_extend - Implemented from Python _parse_pipe_syntax_extend

Source

pub fn parse_pipe_syntax_join(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_join - Parses JOIN in BigQuery pipe syntax Python: _parse_pipe_syntax_join Format: |> JOIN table ON condition

Source

pub fn parse_pipe_syntax_limit(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_limit - Parses LIMIT/OFFSET in BigQuery pipe syntax Python: _parse_pipe_syntax_limit Format: |> LIMIT n [OFFSET m]

Source

pub fn parse_pipe_syntax_pivot(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_pivot - Parses PIVOT in BigQuery pipe syntax Python: _parse_pipe_syntax_pivot Format: |> PIVOT (agg_function FOR column IN (values))

Source

pub fn parse_pipe_syntax_query(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_query - Parses a query with pipe syntax transformations Python: _parse_pipe_syntax_query Handles queries like: FROM table |> WHERE … |> SELECT … |> AGGREGATE …

Source

pub fn parse_pipe_syntax_select(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_select - Parses SELECT in BigQuery pipe syntax Python: _parse_pipe_syntax_select Format: |> SELECT expressions

Source

pub fn parse_pipe_syntax_set_operator(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_set_operator - Parses set operation in BigQuery pipe syntax Python: _parse_pipe_syntax_set_operator Format: |> UNION ALL/INTERSECT/EXCEPT (subquery1, subquery2, …)

Source

pub fn parse_pipe_syntax_tablesample(&mut self) -> Result<Option<Expression>>

parse_pipe_syntax_tablesample - Parses TABLESAMPLE in BigQuery pipe syntax Python: _parse_pipe_syntax_tablesample Format: |> TABLESAMPLE SYSTEM (percent PERCENT)

Source

pub fn parse_pivot_aggregation(&mut self) -> Result<Option<Expression>>

parse_pivot_aggregation - Ported from Python _parse_pivot_aggregation Parses an aggregation function in PIVOT clause, optionally with alias

Source

pub fn parse_pivot_in(&mut self) -> Result<Option<Expression>>

parse_pivot_in - Parses the IN clause of a PIVOT Python: _parse_pivot_in Format: column IN (value1 [AS alias1], value2 [AS alias2], …)

Source

pub fn parse_pivots_for_source( &mut self, source: Expression, ) -> Result<Option<Expression>>

parse_pivots - Ported from Python _parse_pivots Parses one or more PIVOT/UNPIVOT clauses attached to a source expression Uses the existing parse_pivot/parse_unpivot methods

Source

pub fn parse_placeholder(&mut self) -> Result<Option<Expression>>

parse_placeholder - Parse placeholder token (? or :name) Python: if self._match_set(self.PLACEHOLDER_PARSERS): return placeholder

Source

pub fn parse_position(&mut self) -> Result<Option<Expression>>

parse_position - Ported from Python _parse_position Parses POSITION function: POSITION(substr IN str) or POSITION(needle, haystack, start)

Source

pub fn parse_prewhere(&mut self) -> Result<Option<Expression>>

parse_prewhere - Ported from Python _parse_prewhere Parses PREWHERE clause (ClickHouse specific)

Source

pub fn parse_primary_key(&mut self) -> Result<Option<Expression>>

parse_primary_key - Parses PRIMARY KEY constraint Python: _parse_primary_key Can return either PrimaryKeyColumnConstraint (column-level) or PrimaryKey (table-level)

Source

pub fn parse_primary_key_impl( &mut self, wrapped_optional: bool, in_props: bool, ) -> Result<Option<Expression>>

Implementation of parse_primary_key with options

Source

pub fn parse_primary_key_part(&mut self) -> Result<Option<Expression>>

parse_primary_key_part - Delegates to parse_field

Source

pub fn parse_primary_or_var(&mut self) -> Result<Option<Expression>>

parse_primary_or_var - Parses a primary expression or variable Python: _parse_primary_or_var Returns: parse_primary() or parse_var(any_token=True)

Source

pub fn parse_procedure_option(&mut self) -> Result<Option<Expression>>

parse_procedure_option - Implemented from Python _parse_procedure_option

Source

pub fn parse_projections(&mut self) -> Result<Option<Expression>>

parse_projections - Delegates to parse_expressions

Source

pub fn parse_properties(&mut self) -> Result<Option<Expression>>

parse_properties - Parses table/column properties Python: _parse_properties Collects a list of properties using parse_property

Source

pub fn parse_properties_impl( &mut self, before: Option<bool>, ) -> Result<Option<Expression>>

Implementation of parse_properties with before option

Source

pub fn parse_property(&mut self) -> Result<Option<Expression>>

parse_property - Implemented from Python _parse_property Calls: parse_bitwise, parse_column, parse_sequence_properties

Source

pub fn parse_property_assignment(&mut self) -> Result<Option<Expression>>

parse_property_assignment - Ported from Python _parse_property_assignment Parses a property assignment: optionally = or AS, then a value

Source

pub fn parse_property_before(&mut self) -> Result<Option<Expression>>

parse_property_before - Implemented from Python _parse_property_before

Source

pub fn parse_qualify(&mut self) -> Result<Option<Expression>>

parse_qualify - Parse QUALIFY clause (Snowflake, BigQuery) Python: if not self._match(TokenType.QUALIFY): return None; return exp.Qualify(this=self._parse_disjunction())

Source

pub fn parse_range(&mut self) -> Result<Option<Expression>>

parse_range - Parses range expressions (BETWEEN, LIKE, IN, IS, etc.) Python: _parse_range

Source

pub fn parse_reads_property(&mut self) -> Result<Option<Expression>>

parse_reads_property - Implemented from Python _parse_reads_property

parse_recursive_with_search - Parse SEARCH/CYCLE clause for recursive CTEs (PostgreSQL) Syntax: SEARCH BREADTH|DEPTH FIRST BY column SET column [USING column] or: CYCLE column SET column USING column

Source

pub fn parse_references(&mut self) -> Result<Option<Expression>>

parse_references - Ported from Python _parse_references Parses REFERENCES clause for foreign key constraints

Source

pub fn parse_refresh(&mut self) -> Result<Option<Expression>>

parse_refresh - Implemented from Python _parse_refresh parse_refresh - Parses REFRESH TABLE or REFRESH MATERIALIZED VIEW Python: parser.py:7656-7668

Source

pub fn parse_refresh_trigger_property( &mut self, ) -> Result<RefreshTriggerProperty>

parse_refresh_trigger_property - Doris REFRESH clause for materialized views Syntax: REFRESH method ON kind [EVERY n UNIT] [STARTS ‘datetime’] Examples: REFRESH COMPLETE ON MANUAL REFRESH AUTO ON COMMIT REFRESH AUTO ON SCHEDULE EVERY 5 MINUTE STARTS ‘2025-01-01 00:00:00’

Source

pub fn parse_remote_with_connection(&mut self) -> Result<Option<Expression>>

parse_remote_with_connection - Implemented from Python _parse_remote_with_connection

Source

pub fn parse_respect_or_ignore_nulls(&mut self) -> Result<Option<Expression>>

parse_respect_or_ignore_nulls - Implemented from Python _parse_respect_or_ignore_nulls

Source

pub fn parse_retention_period(&mut self) -> Result<Option<Expression>>

parse_retention_period - Parses HISTORY_RETENTION_PERIOD (TSQL) Python: _parse_retention_period Format: INFINITE | DAY | DAYS | MONTH | MONTHS | YEAR | YEARS

Source

pub fn parse_returning(&mut self) -> Result<Option<Expression>>

parse_returning - Creates Returning expression Parses RETURNING clause (PostgreSQL) for INSERT/UPDATE/DELETE

Source

pub fn parse_output_clause(&mut self) -> Result<OutputClause>

parse_output_clause - Parses OUTPUT clause (TSQL) Used in INSERT/UPDATE/DELETE and MERGE statements Supports expressions with optional AS aliases: OUTPUT col1, col2 AS alias, col3

Source

pub fn parse_returns(&mut self) -> Result<Option<Expression>>

parse_returns - Implemented from Python _parse_returns Calls: parse_types

Source

pub fn parse_row(&mut self) -> Result<Option<Expression>>

parse_row - Parses ROW FORMAT clause Returns RowFormatSerdeProperty or RowFormatDelimitedProperty

Source

pub fn parse_row_format(&mut self) -> Result<Option<Expression>>

parse_row_format - Implemented from Python _parse_row_format Parses SERDE or DELIMITED row format specifications

Source

pub fn parse_schema(&mut self) -> Result<Option<Expression>>

parse_schema - Ported from Python _parse_schema Parses schema definition: (col1 type1, col2 type2, …) Used for CREATE TABLE column definitions

Source

pub fn parse_security(&mut self) -> Result<Option<Expression>>

parse_security - Implemented from Python _parse_security

Source

pub fn parse_select_or_expression(&mut self) -> Result<Option<Expression>>

parse_select_or_expression - Parses either a SELECT statement or an expression Python: _parse_select_or_expression

Source

pub fn parse_select_query(&mut self) -> Result<Option<Expression>>

parse_select_query - Implemented from Python _parse_select_query Calls: parse_string, parse_table, parse_describe

Source

pub fn parse_sequence_properties(&mut self) -> Result<Option<Expression>>

parse_sequence_properties - Implemented from Python _parse_sequence_properties Calls: parse_number, parse_term, parse_column

Source

pub fn parse_serde_properties( &mut self, with_: bool, ) -> Result<Option<Expression>>

parse_serde_properties - Implemented from Python _parse_serde_properties Parses SERDEPROPERTIES clause: [WITH] SERDEPROPERTIES (key=value, …)

Source

pub fn parse_session_parameter(&mut self) -> Result<Option<Expression>>

parse_session_parameter - Ported from Python _parse_session_parameter parse_session_parameter - Parses session parameters (@@var or @@session.var) Example: @@session.sql_mode, @@global.autocommit

Source

pub fn parse_set_item(&mut self) -> Result<Option<Expression>>

parse_set_item - Ported from Python _parse_set_item Parses an item in a SET statement (GLOBAL, LOCAL, SESSION prefixes, or assignment)

Source

pub fn parse_set_item_assignment(&mut self) -> Result<Option<Expression>>

parse_set_item_assignment - Implemented from Python _parse_set_item_assignment Parses SET variable = value assignments

Source

pub fn parse_set_operations(&mut self) -> Result<Option<Expression>>

parse_set_operations - Parses UNION/INTERSECT/EXCEPT operations This version parses from current position (expects to be at set operator) Python: _parse_set_operations

Source

pub fn parse_set_operations_with_expr( &mut self, this: Option<Expression>, ) -> Result<Option<Expression>>

parse_set_operations_with_expr - Parses set operations with a left expression

Source

pub fn parse_set_transaction(&mut self) -> Result<Option<Expression>>

parse_set_transaction - Implemented from Python _parse_set_transaction

Source

pub fn parse_settings_property(&mut self) -> Result<Option<Expression>>

parse_settings_property - Parses SETTINGS property (ClickHouse) Python: _parse_settings_property Format: SETTINGS key=value, key=value, …

Source

pub fn parse_simplified_pivot( &mut self, is_unpivot: bool, ) -> Result<Option<Expression>>

parse_simplified_pivot - Ported from Python _parse_simplified_pivot Handles DuckDB simplified PIVOT/UNPIVOT syntax: PIVOT table ON columns [IN (…)] USING agg_func [AS alias], … [GROUP BY …] UNPIVOT table ON columns [INTO NAME col VALUE col, …]

Source

pub fn parse_slice(&mut self) -> Result<Option<Expression>>

parse_slice - Parses array slice syntax [start:end:step] Python: _parse_slice Takes an optional ‘this’ expression (the start of the slice)

Source

pub fn parse_slice_with_this( &mut self, this: Option<Expression>, ) -> Result<Option<Expression>>

Implementation of parse_slice with ‘this’ parameter

Source

pub fn parse_sort(&mut self) -> Result<Option<Expression>>

parse_sort - Ported from Python _parse_sort Parses SORT BY clause (Hive/Spark)

Source

pub fn parse_cluster_by_clause(&mut self) -> Result<Option<Expression>>

parse_cluster_by_clause - Parses CLUSTER BY clause (Hive/Spark)

Source

pub fn parse_distribute_by_clause(&mut self) -> Result<Option<Expression>>

parse_distribute_by_clause - Parses DISTRIBUTE BY clause (Hive/Spark)

Source

pub fn parse_sortkey(&mut self) -> Result<Option<Expression>>

parse_sortkey - Redshift/PostgreSQL SORTKEY property Parses SORTKEY(column1, column2, …) with optional COMPOUND modifier

Source

pub fn parse_star(&mut self) -> Result<Option<Expression>>

parse_star - Parse STAR (*) token with optional EXCEPT/REPLACE/RENAME Python: if self._match(TokenType.STAR): return self._parse_star_ops()

Source

pub fn parse_star_op( &mut self, keywords: &[&str], ) -> Result<Option<Vec<Expression>>>

parse_star_op - Helper to parse EXCEPT/REPLACE/RENAME with keywords Returns list of expressions if keywords match

Source

pub fn parse_star_ops(&mut self) -> Result<Option<Expression>>

parse_star_ops - Implemented from Python _parse_star_ops Creates a Star expression with EXCEPT/REPLACE/RENAME clauses Also handles * COLUMNS(pattern) syntax for DuckDB column selection

Source

pub fn parse_stored(&mut self) -> Result<Option<Expression>>

parse_stored - Implemented from Python _parse_stored

Source

pub fn parse_stream(&mut self) -> Result<Option<Expression>>

parse_stream - Implemented from Python _parse_stream

Source

pub fn parse_string(&mut self) -> Result<Option<Expression>>

parse_string - Parse string literal Python: if self._match_set(self.STRING_PARSERS): return STRING_PARSERStoken_type

Source

pub fn parse_string_agg(&mut self) -> Result<Option<Expression>>

parse_string_agg - Parses STRING_AGG function arguments Python: parser.py:6849-6899 Handles DISTINCT, separator, ORDER BY, ON OVERFLOW, WITHIN GROUP

Source

pub fn parse_string_as_identifier(&mut self) -> Result<Option<Expression>>

parse_string_as_identifier - Parses a string literal as a quoted identifier Python: _parse_string_as_identifier Used for cases where a string can be used as an identifier (e.g., MySQL)

Source

pub fn parse_struct_types(&mut self) -> Result<Option<Expression>>

parse_struct_types - Delegates to parse_types

Source

pub fn parse_subquery(&mut self) -> Result<Option<Expression>>

parse_subquery - Ported from Python _parse_subquery Parses a parenthesized SELECT as subquery: (SELECT …)

Source

pub fn parse_substring(&mut self) -> Result<Option<Expression>>

parse_substring - Ported from Python _parse_substring Parses SUBSTRING function with two syntax variants:

  1. Standard SQL: SUBSTRING(str FROM start [FOR length])
  2. Function style: SUBSTRING(str, start, length)
Source

pub fn parse_system_versioning_property(&mut self) -> Result<Option<Expression>>

parse_system_versioning_property - Implemented from Python _parse_system_versioning_property Calls: parse_table_parts, parse_retention_period

Source

pub fn parse_table(&mut self) -> Result<Option<Expression>>

parse_table - Implemented from Python _parse_table Calls: parse_table_hints, parse_unnest, parse_partition

Source

pub fn parse_table_alias(&mut self) -> Result<Option<Expression>>

parse_table_alias - Ported from Python _parse_table_alias Parses table alias: AS alias [(col1, col2, …)]

Source

pub fn parse_table_hints(&mut self) -> Result<Option<Expression>>

parse_table_hints - Ported from Python _parse_table_hints Parses table hints (SQL Server WITH (…) or MySQL USE/IGNORE/FORCE INDEX)

Source

pub fn parse_truncate_table_hints(&mut self) -> Result<Option<Expression>>

Parse TSQL TRUNCATE table hints: WITH (PARTITIONS(1, 2 TO 5, 10 TO 20, 84)) Unlike regular table hints, PARTITIONS arguments can contain TO ranges.

Source

pub fn parse_table_part(&mut self) -> Result<Option<Expression>>

parse_table_part - Parse a single part of a table reference Tries: identifier, string as identifier, placeholder

Source

pub fn parse_table_parts(&mut self) -> Result<Option<Expression>>

parse_table_parts - Parse catalog.schema.table or schema.table or table Returns a Table expression with all parts

Source

pub fn parse_table_sample(&mut self) -> Result<Option<Expression>>

parse_table_sample - Implemented from Python _parse_table_sample Calls: parse_number, parse_factor, parse_placeholder

Source

pub fn parse_term(&mut self) -> Result<Option<Expression>>

parse_term - Parses addition/subtraction expressions (+ - operators) Python: _parse_term Delegates to the existing parse_addition in the operator precedence chain

Source

pub fn parse_to_table(&mut self) -> Result<Option<Expression>>

parse_to_table - ClickHouse TO table property Parses: TO table_name

Source

pub fn parse_tokens(&mut self) -> Result<Option<Expression>>

parse_tokens - Operator precedence parser

Source

pub fn parse_trim(&mut self) -> Result<Option<Expression>>

parse_trim - Ported from Python _parse_trim Parses TRIM function: TRIM([BOTH|LEADING|TRAILING] chars FROM str) or TRIM(str, chars)

Source

pub fn parse_truncate_table(&mut self) -> Result<Option<Expression>>

parse_truncate_table - Implemented from Python _parse_truncate_table Calls: parse_on_property, parse_partition, parse_function

Source

pub fn parse_ttl(&mut self) -> Result<Option<Expression>>

parse_ttl - Implemented from Python _parse_ttl Parses ClickHouse TTL expression with optional DELETE, RECOMPRESS, TO DISK/VOLUME

Source

pub fn parse_type(&mut self) -> Result<Option<Expression>>

parse_type - Parses a data type expression Python: _parse_type

Source

pub fn parse_type_size(&mut self) -> Result<Option<Expression>>

parse_type_size - Ported from Python _parse_type_size Parses type size parameters like 10 in VARCHAR(10) or 10, 2 in DECIMAL(10, 2)

Source

pub fn parse_types(&mut self) -> Result<Option<Expression>>

parse_types - Implemented from Python _parse_types Calls: parse_string

Source

pub fn parse_unique(&mut self) -> Result<Option<Expression>>

parse_unique - Implemented from Python _parse_unique Parses UNIQUE [KEY|INDEX] [NULLS NOT DISTINCT] [(columns)] [USING index_type]

Source

pub fn parse_unique_key(&mut self) -> Result<Option<Expression>>

parse_unique_key - Parse the key/index name for UNIQUE constraint Simply parses an identifier

Source

pub fn parse_unnest(&mut self) -> Result<Option<Expression>>

parse_unnest - Ported from Python _parse_unnest Parses UNNEST(array_expr) [WITH ORDINALITY] [AS alias]

Source

pub fn parse_unpivot_columns(&mut self) -> Result<Option<Expression>>

parse_unpivot_columns - Implemented from Python _parse_unpivot_columns Python: parser.py:4454-4462 Parses INTO NAME column VALUE col1, col2, …

Source

pub fn parse_unquoted_field(&mut self) -> Result<Option<Expression>>

parse_unquoted_field - Parses a field and converts unquoted identifiers to Var Python: _parse_unquoted_field

Source

pub fn parse_user_defined_function(&mut self) -> Result<Option<Expression>>

parse_user_defined_function - Parses user-defined function call Python: _parse_user_defined_function Parses: schema.function_name(param1, param2, …)

Source

pub fn parse_user_defined_function_expression( &mut self, ) -> Result<Option<Expression>>

parse_user_defined_function_expression - Parse user-defined function expression

Source

pub fn parse_user_defined_type( &mut self, identifier: Identifier, ) -> Result<Option<Expression>>

parse_user_defined_type - Parses a user-defined type reference Python: _parse_user_defined_type Format: schema.type_name or just type_name

Source

pub fn parse_using_identifiers(&mut self) -> Result<Option<Expression>>

parse_using_identifiers - Ported from Python _parse_using_identifiers Parses (col1, col2, …) for JOIN USING clause

Source

pub fn parse_value(&mut self) -> Result<Option<Expression>>

parse_value - Parses a value tuple for INSERT VALUES clause Python: _parse_value Syntax: (expr1, expr2, …) or just expr (single value)

Source

pub fn parse_var(&mut self) -> Result<Option<Expression>>

parse_var - Parse variable reference (unquoted identifier) Python: if self._match(TokenType.VAR): return exp.Var(this=self._prev.text)

Source

pub fn parse_var_from_options(&mut self) -> Result<Option<Expression>>

parse_var_from_options - Ported from Python _parse_var_from_options Parses a variable/identifier from a predefined set of options

Source

pub fn parse_var_or_string(&mut self) -> Result<Option<Expression>>

parse_var_or_string - Delegates to parse_string parse_var_or_string - Parses a string literal or a variable Python: parser.py:7506-7507

Source

pub fn parse_vector_expressions(&mut self) -> Result<Option<Expression>>

parse_vector_expressions - Transforms vector type parameters Python: _parse_vector_expressions In Python, this transforms a list of expressions where the first element (identifier) is converted to a DataType. In Rust, since VECTOR type parsing is handled inline in parse_data_type, this method parses vector expressions (element_type, dimension) from the current position and returns them as a Tuple.

Source

pub fn parse_version(&mut self) -> Result<Option<Expression>>

parse_version - Implemented from Python _parse_version Python: parser.py:4266-4295 Parses FOR SYSTEM_TIME AS OF, VERSIONS BETWEEN, etc.

Source

pub fn parse_volatile_property(&mut self) -> Result<Option<Expression>>

parse_volatile_property - Parses VOLATILE property Python: _parse_volatile_property Returns VolatileProperty for table volatility or StabilityProperty for function stability

Source

pub fn parse_when_matched(&mut self) -> Result<Option<Expression>>

parse_when_matched - Implemented from Python _parse_when_matched Calls: parse_disjunction, parse_star, parse_value Parse WHEN [NOT] MATCHED clauses for MERGE statements This is the public entry point that calls parse_when_matched_clauses

Source

pub fn parse_where(&mut self) -> Result<Option<Expression>>

parse_where - Parse WHERE clause Python: if not self._match(TokenType.WHERE): return None; return exp.Where(this=self._parse_disjunction())

Source

pub fn parse_window(&mut self) -> Result<Option<Expression>>

parse_window - Implemented from Python _parse_window Calls: parse_window_spec, parse_partition_and_order

Source

pub fn parse_window_clause(&mut self) -> Result<Option<Expression>>

parse_window_clause - Ported from Python _parse_window_clause Parses WINDOW named_window_definition [, named_window_definition, …]

Source

pub fn parse_window_spec(&mut self) -> Result<Option<Expression>>

parse_window_spec - Implemented from Python _parse_window_spec

Source

pub fn parse_with_operator(&mut self) -> Result<Option<Expression>>

parse_with_operator - Parse column with operator class (PostgreSQL) Parses: ordered_expression [WITH operator]

Source

pub fn parse_with_property(&mut self) -> Result<Option<Expression>>

parse_with_property - Implemented from Python _parse_with_property Calls: parse_withjournaltable, parse_withisolatedloading, parse_wrapped_properties

Source

pub fn parse_withdata(&mut self) -> Result<Option<Expression>>

parse_withdata - Implemented from Python _parse_withdata

Source

pub fn parse_withisolatedloading(&mut self) -> Result<Option<Expression>>

parse_withisolatedloading - Implemented from Python _parse_withisolatedloading

Source

pub fn parse_withjournaltable(&mut self) -> Result<Option<Expression>>

parse_withjournaltable - Teradata WITH JOURNAL TABLE property Parses: WITH JOURNAL TABLE = table_name

Source

pub fn parse_wrapped(&mut self) -> Result<Option<Expression>>

parse_wrapped - Parses an expression wrapped in parentheses Python: _parse_wrapped(parse_method) This version parses a disjunction (expression) inside parentheses

Source

pub fn parse_wrapped_csv(&mut self) -> Result<Option<Expression>>

parse_wrapped_csv - Parses comma-separated expressions wrapped in parentheses Python: _parse_wrapped_csv(parse_method)

Source

pub fn parse_wrapped_id_vars(&mut self) -> Result<Option<Expression>>

parse_wrapped_id_vars - Parses comma-separated identifiers wrapped in parentheses Python: _parse_wrapped_id_vars

Source

pub fn parse_wrapped_options(&mut self) -> Result<Option<Expression>>

parse_wrapped_options - Implemented from Python _parse_wrapped_options Parses space-separated properties wrapped in parentheses (for Snowflake STAGE_FILE_FORMAT, etc.) Format: = (KEY=VALUE KEY2=VALUE2 …)

Source

pub fn parse_options_list(&mut self) -> Result<Vec<Expression>>

parse_options_list - Parses BigQuery-style OPTIONS list: (key=value, key=value, …) Parses key=value assignments where values can be complex expressions

Source

pub fn parse_environment_list(&mut self) -> Result<Vec<Expression>>

parse_environment_list - Parses Databricks ENVIRONMENT list: (dependencies = ‘…’, environment_version = ‘…’) Parses key=value assignments where values can be string literals

Source

pub fn parse_wrapped_properties(&mut self) -> Result<Option<Expression>>

parse_wrapped_properties - Ported from Python _parse_wrapped_properties Parses properties wrapped in parentheses

Source

pub fn parse_wrapped_select( &mut self, table: bool, ) -> Result<Option<Expression>>

parse_wrapped_select - Ported from Python _parse_wrapped_select Parses wrapped select statements including PIVOT/UNPIVOT and FROM-first syntax

Source

pub fn parse_wrapped_select_default(&mut self) -> Result<Option<Expression>>

Helper for parse_wrapped_select with default table=false

Source

pub fn parse_xml_element(&mut self) -> Result<Option<Expression>>

parse_xml_element - Implemented from Python _parse_xml_element Python: parser.py:6917-6931 Parses XMLELEMENT(NAME name [, expr, …]) or XMLELEMENT(EVALNAME expr [, expr, …])

Source

pub fn parse_xml_namespace(&mut self) -> Result<Option<Expression>>

parse_xml_namespace - Ported from Python _parse_xml_namespace Parses XML namespace declarations

Source

pub fn parse_xml_table(&mut self) -> Result<Option<Expression>>

parse_xml_table - Implemented from Python _parse_xml_table Python: parser.py:6933-6961 Parses XMLTABLE(xpath_expr PASSING xml_doc COLUMNS …)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.