Skip to content

Commit f136eb9

Browse files
authored
Merge branch 'main' into dsql-async-index
2 parents 3c3faf4 + a281171 commit f136eb9

8 files changed

Lines changed: 300 additions & 50 deletions

File tree

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.

src/ast/dml.rs

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,14 @@ pub enum MergeInsertKind {
649649
/// ```
650650
/// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement)
651651
Row,
652+
/// The insert expression uses the `*` wildcard to insert all columns.
653+
///
654+
/// Example:
655+
/// ```sql
656+
/// INSERT *
657+
/// ```
658+
/// [Databricks](https://docs.databricks.com/en/sql/language-manual/delta-merge-into.html)
659+
Wildcard,
652660
}
653661

654662
impl Display for MergeInsertKind {
@@ -660,6 +668,9 @@ impl Display for MergeInsertKind {
660668
MergeInsertKind::Row => {
661669
write!(f, "ROW")
662670
}
671+
MergeInsertKind::Wildcard => {
672+
write!(f, "*")
673+
}
663674
}
664675
}
665676
}
@@ -710,33 +721,70 @@ impl Display for MergeInsertExpr {
710721
}
711722
}
712723

724+
/// The kind of update used within a `MERGE` statement.
725+
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
726+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
727+
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
728+
pub enum MergeUpdateKind {
729+
/// Standard update with explicit assignments.
730+
///
731+
/// Example:
732+
/// ```sql
733+
/// UPDATE SET quantity = source.quantity, name = source.name
734+
/// ```
735+
Set(Vec<Assignment>),
736+
/// The `*` wildcard to update all columns from the source.
737+
///
738+
/// Example:
739+
/// ```sql
740+
/// UPDATE SET *
741+
/// ```
742+
/// [Databricks](https://docs.databricks.com/en/sql/language-manual/delta-merge-into.html)
743+
Wildcard,
744+
}
745+
746+
impl Display for MergeUpdateKind {
747+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
748+
match self {
749+
MergeUpdateKind::Set(assignments) => {
750+
write!(f, "SET {}", display_comma_separated(assignments))
751+
}
752+
MergeUpdateKind::Wildcard => {
753+
write!(f, "SET *")
754+
}
755+
}
756+
}
757+
}
758+
713759
/// The expression used to update rows within a `MERGE` statement.
714760
///
715761
/// Examples
716762
/// ```sql
717763
/// UPDATE SET quantity = T.quantity + S.quantity
764+
/// UPDATE SET *
718765
/// ```
719766
///
720767
/// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/merge)
721768
/// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement)
722769
/// [Oracle](https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/MERGE.html)
770+
/// [Databricks](https://docs.databricks.com/en/sql/language-manual/delta-merge-into.html)
723771
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
724772
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
725773
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
726774
pub struct MergeUpdateExpr {
727775
/// The `UPDATE` token that starts the sub-expression.
728776
pub update_token: AttachedToken,
729-
/// The update assiment expressions
730-
pub assignments: Vec<Assignment>,
731-
/// `where_clause` for the update (Oralce specific)
777+
/// The kind of update: explicit assignments or `*` shorthand.
778+
pub kind: MergeUpdateKind,
779+
/// `where_clause` for the update (Oracle specific)
732780
pub update_predicate: Option<Expr>,
733781
/// `delete_clause` for the update "delete where" (Oracle specific)
734782
pub delete_predicate: Option<Expr>,
735783
}
736784

737785
impl Display for MergeUpdateExpr {
738786
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
739-
write!(f, "SET {}", display_comma_separated(&self.assignments))?;
787+
write!(f, "{}", self.kind)?;
740788
if let Some(predicate) = self.update_predicate.as_ref() {
741789
write!(f, " WHERE {predicate}")?;
742790
}

src/ast/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ pub use self::ddl::{
8585
};
8686
pub use self::dml::{
8787
Delete, Insert, Merge, MergeAction, MergeClause, MergeClauseKind, MergeInsertExpr,
88-
MergeInsertKind, MergeUpdateExpr, MultiTableInsertIntoClause, MultiTableInsertType,
89-
MultiTableInsertValue, MultiTableInsertValues, MultiTableInsertWhenClause, OutputClause,
90-
Update,
88+
MergeInsertKind, MergeUpdateExpr, MergeUpdateKind, MultiTableInsertIntoClause,
89+
MultiTableInsertType, MultiTableInsertValue, MultiTableInsertValues,
90+
MultiTableInsertWhenClause, OutputClause, Update,
9191
};
9292
pub use self::operator::{BinaryOperator, UnaryOperator};
9393
pub use self::query::{

0 commit comments

Comments
 (0)