Skip to content

Commit 66c87eb

Browse files
Merge branch 'main' into postgres-regression-2
2 parents 1ad989f + a281171 commit 66c87eb

36 files changed

Lines changed: 3451 additions & 334 deletions

AGENTS.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Extensible SQL Lexer and Parser for Rust Agents Guidelines
2+
3+
## General Agent Workflow
4+
1. You will write unit tests to ensure your code change is working as expected.
5+
2. You will run the commands in the Pre Commit Checks section below to ensure your change is ready for a pull request.
6+
3. When instructed to open a PR, you will follow the instructions in the Pull Request Guidelines section below.
7+
8+
## General Coding Guidelines
9+
1. Refrain from adding conditions on specific dialects, such as `dialect_is!(...)` or `dialect_of!(... | ...)`. Instead, define a new function in the `Dialect` trait that describes the condition, so that dialects can turn this condition on more easily.
10+
2. Make targeted code changes and refrain from refactoring, unless it's absolutely required.
11+
12+
## Unit Tests Guidelines
13+
- New unit tests should be added to the `tests` module in the corresponding dialect file (e.g., `tests/sqlparser_redshift.rs` for Redshift), and should be placed at the end of the file.
14+
- If the new functionality is gated using a dialect function, and the SQL is likely relevant in most dialects, tests should be placed under `tests/sqlparser_common.rs`.
15+
- When testing a multi-line SQL statement, use a raw string literal, i.e. `r#"..."#` to preserve formatting.
16+
- The parser builds an abstract syntax tree (AST) from the SQL statement and has functionality to display the tree as SQL. Use the following template for simple unit tests where you expect the SQL created from the AST to be the same as the input SQL:
17+
```rust
18+
<dialect>().verified_stmt(r#"..."#);
19+
```
20+
For example: `snowflake().verified_stmt(r#"SELECT * FROM my_table"#)`. Use `one_statement_parses_to` instead of `verified_stmt` when you expect the SQL created by the AST to differ than the input SQL. For example:
21+
```rust
22+
snowflake().one_statement_parses_to(
23+
"SELECT * FROM my_table t",
24+
"SELECT * FROM my_table AS t",
25+
)
26+
```
27+
28+
## Analyzing Parsing Issues
29+
You can try to simplify the SQL statement to identify the root cause of the parsing issue. This may involve removing certain clauses or components of the SQL statement to see if it can be parsed successfully. Additionally, you can compare the problematic SQL statement with similar statements that are parsed correctly to identify any differences that may be causing the issue.
30+
31+
## Pre Commit Checks
32+
Run the following commands before you commit to ensure the change will pass the CI process:
33+
```bash
34+
cargo test --all-features
35+
cargo fmt --all
36+
cargo clippy --all-targets --all-features -- -D warnings
37+
```
38+
39+
## Pull Request Guidelines
40+
1. PR title should follow this format: `<DIALECT>: <SHORT DESCRIPTION>`, For example, `Showflake: Add support for casting to VARIANT`.
41+
2. Make the PR comment short, provide an example of what was not working and a short description of the fix. Be succint.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
[package]
1919
name = "sqlparser"
2020
description = "Extensible SQL Lexer and Parser with support for ANSI SQL:2011"
21-
version = "0.61.0"
21+
version = "0.62.0"
2222
authors = ["Apache DataFusion <dev@datafusion.apache.org>"]
2323
homepage = "https://github.com/apache/datafusion-sqlparser-rs"
2424
documentation = "https://docs.rs/sqlparser/"

changelog/0.62.0.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
20+
# sqlparser-rs 0.62.0 Changelog
21+
22+
This release consists of 79 commits from 27 contributors. See credits at the end of this changelog for more information.
23+
24+
**Implemented enhancements:**
25+
26+
- feat(clickhouse): support PARTITION BY after ORDER BY and ARRAY JOIN [#2283](https://github.com/apache/datafusion-sqlparser-rs/pull/2283) (cristhiank)
27+
28+
**Other:**
29+
30+
- Fix panic on incomplete REGEXP/MATCH expressions in SQLite dialect [#2197](https://github.com/apache/datafusion-sqlparser-rs/pull/2197) (LucaCappelletti94)
31+
- chore: add confirmation before tarball is released [#2208](https://github.com/apache/datafusion-sqlparser-rs/pull/2208) (milenkovicm)
32+
- Databricks: Add support for `OPTIMIZE`, `PARTITIONED BY`, and `STRUCT` [#2170](https://github.com/apache/datafusion-sqlparser-rs/pull/2170) (funcpp)
33+
- Fix panic in `SET AUTHORIZATION` parsing when scope modifier is missing [#2201](https://github.com/apache/datafusion-sqlparser-rs/pull/2201) (LucaCappelletti94)
34+
- Snowflake: Add multi table insert support [#2148](https://github.com/apache/datafusion-sqlparser-rs/pull/2148) (finchxxia)
35+
- MSSQL: Support `THROW` statement [#2202](https://github.com/apache/datafusion-sqlparser-rs/pull/2202) (guan404ming)
36+
- Updated Fuzzer harness to address all dialects [#2203](https://github.com/apache/datafusion-sqlparser-rs/pull/2203) (RPG-Alex)
37+
- Snowflake: Lambda functions [#2192](https://github.com/apache/datafusion-sqlparser-rs/pull/2192) (yoavcloud)
38+
- Updated `parse_infix(..)` in `mysql.rs` and `sqlite.rs` to handle error rather than `unwrap()` [#2207](https://github.com/apache/datafusion-sqlparser-rs/pull/2207) (RPG-Alex)
39+
- MSSQL: Add support for TRAN shorthand [#2212](https://github.com/apache/datafusion-sqlparser-rs/pull/2212) (guan404ming)
40+
- Fixed select dollar column from stage for snowflake [#2165](https://github.com/apache/datafusion-sqlparser-rs/pull/2165) (romanoff)
41+
- [PIVOT] Optional AS keyword for aliases [#2209](https://github.com/apache/datafusion-sqlparser-rs/pull/2209) (xitep)
42+
- Fix `derive_dialect!` proc macro for use from external crates [#2219](https://github.com/apache/datafusion-sqlparser-rs/pull/2219) (alexander-beedie)
43+
- Resolve breaking change that set "supports_lambda_functions" on `GenericDialect` [#2224](https://github.com/apache/datafusion-sqlparser-rs/pull/2224) (alexander-beedie)
44+
- MSSQL: Add support for WAITFOR statement [#2210](https://github.com/apache/datafusion-sqlparser-rs/pull/2210) (guan404ming)
45+
- PostgreSQL: Support PRIMARY KEY/UNIQUE USING INDEX [#2213](https://github.com/apache/datafusion-sqlparser-rs/pull/2213) (guan404ming)
46+
- Prefer use of `peek_token_ref` over `peek_token` where valid [#2225](https://github.com/apache/datafusion-sqlparser-rs/pull/2225) (alexander-beedie)
47+
- PostgreSQL: Support more COMMENT ON object types [#2220](https://github.com/apache/datafusion-sqlparser-rs/pull/2220) (guan404ming)
48+
- Allow custom OptimizerHints [#2216](https://github.com/apache/datafusion-sqlparser-rs/pull/2216) (altmannmarcelo)
49+
- Optimise out string allocations and copies in keyword lookup [#2226](https://github.com/apache/datafusion-sqlparser-rs/pull/2226) (alexander-beedie)
50+
- [Oracle] Table alias for INSERTed table [#2214](https://github.com/apache/datafusion-sqlparser-rs/pull/2214) (xitep)
51+
- Introduce `Visit::visit_select` [#2235](https://github.com/apache/datafusion-sqlparser-rs/pull/2235) (xitep)
52+
- Add support for INTERVAL keyword as unquoted identifier in PostgreSQL [#2238](https://github.com/apache/datafusion-sqlparser-rs/pull/2238) (LucaCappelletti94)
53+
- Redshift: support wildcard select items with alias [#2230](https://github.com/apache/datafusion-sqlparser-rs/pull/2230) (yoabot-droid)
54+
- Snowflake: support wildcard with EXCLUDE in function arguments [#2231](https://github.com/apache/datafusion-sqlparser-rs/pull/2231) (yoabot-droid)
55+
- MSSQL: prevent statement-starting keywords from being consumed as implicit aliases [#2233](https://github.com/apache/datafusion-sqlparser-rs/pull/2233) (yoabot-droid)
56+
- Support parenthesized `CREATE TABLE ... (LIKE ... INCLUDING/EXCLUDING DEFAULTS)` in `PostgreSQL` [#2242](https://github.com/apache/datafusion-sqlparser-rs/pull/2242) (LucaCappelletti94)
57+
- MSSQL: support EXEC (@sql) dynamic SQL execution [#2234](https://github.com/apache/datafusion-sqlparser-rs/pull/2234) (yoabot-droid)
58+
- Support MySQL KEY keyword in column definitions [#2243](https://github.com/apache/datafusion-sqlparser-rs/pull/2243) (mvzink)
59+
- Support two-argument `TRIM(string, characters)` in PostgreSQL [#2240](https://github.com/apache/datafusion-sqlparser-rs/pull/2240) (LucaCappelletti94)
60+
- Add Readyset to users in README.md [#2247](https://github.com/apache/datafusion-sqlparser-rs/pull/2247) (mvzink)
61+
- Snowflake: parse EXCLUDE column list as ObjectName to support qualified names [#2244](https://github.com/apache/datafusion-sqlparser-rs/pull/2244) (yoabot-droid)
62+
- MSSQL: Add support for OUTPUT clause on INSERT/UPDATE/DELETE [#2228](https://github.com/apache/datafusion-sqlparser-rs/pull/2228) (guan404ming)
63+
- Redshift: Added DISTSTYLE and DISTKEY keywords parsing [#2222](https://github.com/apache/datafusion-sqlparser-rs/pull/2222) (romanoff)
64+
- Allow INSERT columns to be qualified [#2260](https://github.com/apache/datafusion-sqlparser-rs/pull/2260) (xitep)
65+
- Add support for parsing COPY statements from STDIN without a semicolon [#2245](https://github.com/apache/datafusion-sqlparser-rs/pull/2245) (LucaCappelletti94)
66+
- Fix credentials parsing for redshift [#2262](https://github.com/apache/datafusion-sqlparser-rs/pull/2262) (romanoff)
67+
- Added SORTKEY keyword parsing for redshift queries [#2261](https://github.com/apache/datafusion-sqlparser-rs/pull/2261) (romanoff)
68+
- Fixed transaction handling for snowflake [#2263](https://github.com/apache/datafusion-sqlparser-rs/pull/2263) (romanoff)
69+
- Fixed COPY GRANTS clause parsing for snowflake [#2267](https://github.com/apache/datafusion-sqlparser-rs/pull/2267) (romanoff)
70+
- Fixed parsing `OPTIONS(format = 'CSV')` when creating external bigquery table [#2268](https://github.com/apache/datafusion-sqlparser-rs/pull/2268) (romanoff)
71+
- Add support for PostgreSQL LOCK TABLE [#2273](https://github.com/apache/datafusion-sqlparser-rs/pull/2273) (mjbshaw)
72+
- add support for databricks JSON accessors [#2272](https://github.com/apache/datafusion-sqlparser-rs/pull/2272) (whirlun)
73+
- Fixed create snapshot table for bigquery [#2269](https://github.com/apache/datafusion-sqlparser-rs/pull/2269) (romanoff)
74+
- Fixed stage name parsing for snowflake [#2265](https://github.com/apache/datafusion-sqlparser-rs/pull/2265) (romanoff)
75+
- Fix STORAGE LIFECYCLE POLICY for snowflake queries [#2264](https://github.com/apache/datafusion-sqlparser-rs/pull/2264) (romanoff)
76+
- Fixed CHANGES keyword parsing for snowflake [#2266](https://github.com/apache/datafusion-sqlparser-rs/pull/2266) (romanoff)
77+
- Add SETOF support for PostgreSQL function return types [#2217](https://github.com/apache/datafusion-sqlparser-rs/pull/2217) (fmguerreiro)
78+
- [Oracle] Support for `INSERT INTO (<sub-query>) ...` [#2276](https://github.com/apache/datafusion-sqlparser-rs/pull/2276) (xitep)
79+
- Fixed BACKUP parsing for redshift [#2270](https://github.com/apache/datafusion-sqlparser-rs/pull/2270) (romanoff)
80+
- recursive protection for `parse_subexpr` [#2282](https://github.com/apache/datafusion-sqlparser-rs/pull/2282) (blaginin)
81+
- Fix the tokenization of `<` edge cases [#2280](https://github.com/apache/datafusion-sqlparser-rs/pull/2280) (ayman-sigma)
82+
- Expose values through ValueWithSpan [#2281](https://github.com/apache/datafusion-sqlparser-rs/pull/2281) (xitep)
83+
- Enable `!` as NOT operator for Databricks dialect [#2287](https://github.com/apache/datafusion-sqlparser-rs/pull/2287) (funcpp)
84+
- Add dollar prefix support for money constants in MSSQL [#2285](https://github.com/apache/datafusion-sqlparser-rs/pull/2285) (solontsev)
85+
- Allow bare columns in GROUPING SETS expressions [#2288](https://github.com/apache/datafusion-sqlparser-rs/pull/2288) (funcpp)
86+
- Enable numeric-prefix identifiers for Databricks dialect [#2290](https://github.com/apache/datafusion-sqlparser-rs/pull/2290) (funcpp)
87+
- Enable Redshift support for specifying null treatment inside window function [#2293](https://github.com/apache/datafusion-sqlparser-rs/pull/2293) (romanb)
88+
- Fix parsing EXECUTE (...) with a more general string expression [#2295](https://github.com/apache/datafusion-sqlparser-rs/pull/2295) (romanb)
89+
- Support optional AS keyword in CTE definitions for Databricks [#2286](https://github.com/apache/datafusion-sqlparser-rs/pull/2286) (funcpp)
90+
- MySQL: Add support for `ORDER BY` on single-table `UPDATE` [#2296](https://github.com/apache/datafusion-sqlparser-rs/pull/2296) (tpyo)
91+
- Support multi-column aliases in SELECT items [#2289](https://github.com/apache/datafusion-sqlparser-rs/pull/2289) (funcpp)
92+
- MySQL: Support `SHOW FULL PROCESSLIST` syntax [#2292](https://github.com/apache/datafusion-sqlparser-rs/pull/2292) (jstnd)
93+
- PostgreSQL `ALTER FUNCTION` / `ALTER AGGREGATE` [#2248](https://github.com/apache/datafusion-sqlparser-rs/pull/2248) (LucaCappelletti94)
94+
- Add xml '...' TypedString support for PostgreSQL [#2299](https://github.com/apache/datafusion-sqlparser-rs/pull/2299) (LucaCappelletti94)
95+
- Add PostgreSQL Collation DDL Support [#2249](https://github.com/apache/datafusion-sqlparser-rs/pull/2249) (LucaCappelletti94)
96+
- Fix COLLATE parsing after compound identifiers [#2294](https://github.com/apache/datafusion-sqlparser-rs/pull/2294) (romanb)
97+
- Redshift/PostgreSQL: Parse optional implicit aliases for wildcard select items [#2300](https://github.com/apache/datafusion-sqlparser-rs/pull/2300) (yoavcloud)
98+
- Only parse FROM identifier in CTE if using Hive [#2241](https://github.com/apache/datafusion-sqlparser-rs/pull/2241) (Viicos)
99+
- Add SHOW CATALOGS syntax and tests [#2284](https://github.com/apache/datafusion-sqlparser-rs/pull/2284) (Smith-Cruise)
100+
- Coding agents guidelines [#2298](https://github.com/apache/datafusion-sqlparser-rs/pull/2298) (yoavcloud)
101+
- Spark SQL: Add SparkSqlDialect [#2305](https://github.com/apache/datafusion-sqlparser-rs/pull/2305) (andygrove)
102+
- PostgreSQL: Add support for LATERAL ... WITH ORDINALITY [#2304](https://github.com/apache/datafusion-sqlparser-rs/pull/2304) (yoavcloud)
103+
- Track `Parens<T>`'s span [#2291](https://github.com/apache/datafusion-sqlparser-rs/pull/2291) (xitep)
104+
- Redshift: PartiQL AT <index> [#2303](https://github.com/apache/datafusion-sqlparser-rs/pull/2303) (yoavcloud)
105+
- Snowflake: Add support for text data type modifiers [#2297](https://github.com/apache/datafusion-sqlparser-rs/pull/2297) (yoavcloud)
106+
- PostgreSQL: Parse optimizer hints in leading comments [#2320](https://github.com/apache/datafusion-sqlparser-rs/pull/2320) (altmannmarcelo)
107+
- Add Teradata dialect [#2309](https://github.com/apache/datafusion-sqlparser-rs/pull/2309) (iffyio)
108+
109+
## Credits
110+
111+
Thank you to everyone who contributed to this release. Here is a breakdown of commits (PRs merged) per contributor.
112+
113+
```
114+
12 Andriy Romanov
115+
9 Luca Cappelletti
116+
7 xitep
117+
6 Guan-Ming (Wesley) Chiu
118+
6 Minjun Kim
119+
6 Yoav Cohen
120+
5 Yoabot
121+
4 Alexander Beedie
122+
3 Roman Borschel
123+
2 Alex
124+
2 Marcelo Altmann
125+
2 Michael Victor Zink
126+
1 Andy Grove
127+
1 Ayman Elkfrawy
128+
1 Cristhian Lopez
129+
1 Dmitrii Blaginin
130+
1 Donovan Schönknecht
131+
1 Filipe Guerreiro
132+
1 Ifeanyi Ubah
133+
1 Marko Milenković
134+
1 Michael Bradshaw
135+
1 Sergey Olontsev
136+
1 Smith Cruise
137+
1 Victorien
138+
1 finchxxia
139+
1 jstnd
140+
1 whirlun
141+
```
142+
143+
Thank you also to everyone who contributed in other ways such as filing issues, reviewing PRs, and providing feedback on this release.

dev/release/rat_exclude_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ dev/release/rat_exclude_files.txt
66
sqlparser_bench/img/flamegraph.svg
77
**Cargo.lock
88
filtered_rat.txt
9+
AGENTS.md

0 commit comments

Comments
 (0)