Skip to content

Commit 56c070b

Browse files
committed
Merge remote-tracking branch 'apache/main' into reduce-token-cloning
2 parents e6dcc38 + 885aa93 commit 56c070b

20 files changed

+293
-16
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions/checkout@v4
2828
- name: Setup Rust Toolchain
2929
uses: ./.github/actions/setup-builder
30-
- run: cargo fmt -- --check
30+
- run: cargo fmt --all -- --check
3131

3232
lint:
3333
runs-on: ubuntu-latest

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.52.0"
21+
version = "0.53.0"
2222
authors = ["Apache DataFusion <[email protected]>"]
2323
homepage = "https://github.com/apache/datafusion-sqlparser-rs"
2424
documentation = "https://docs.rs/sqlparser/"

changelog/0.53.0.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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.53.0 Changelog
21+
22+
This release consists of 47 commits from 16 contributors. See credits at the end of this changelog for more information.
23+
24+
**Other:**
25+
26+
- hive: support for special not expression `!a` and raise error for `a!` factorial operator [#1472](https://github.com/apache/datafusion-sqlparser-rs/pull/1472) (wugeer)
27+
- Add support for MSSQL's `OPENJSON WITH` clause [#1498](https://github.com/apache/datafusion-sqlparser-rs/pull/1498) (gaoqiangz)
28+
- Parse true and false as identifiers in mssql [#1510](https://github.com/apache/datafusion-sqlparser-rs/pull/1510) (lovasoa)
29+
- Fix the parsing error in MSSQL for multiple statements that include `DECLARE` statements [#1497](https://github.com/apache/datafusion-sqlparser-rs/pull/1497) (wugeer)
30+
- Add support for Snowflake SHOW DATABASES/SCHEMAS/TABLES/VIEWS/COLUMNS statements [#1501](https://github.com/apache/datafusion-sqlparser-rs/pull/1501) (yoavcloud)
31+
- Add support of COMMENT ON syntax for Snowflake [#1516](https://github.com/apache/datafusion-sqlparser-rs/pull/1516) (git-hulk)
32+
- Add support for MYSQL's `CREATE TABLE SELECT` expr [#1515](https://github.com/apache/datafusion-sqlparser-rs/pull/1515) (wugeer)
33+
- Add support for MSSQL's `XQuery` methods [#1500](https://github.com/apache/datafusion-sqlparser-rs/pull/1500) (gaoqiangz)
34+
- Add support for Hive's `LOAD DATA` expr [#1520](https://github.com/apache/datafusion-sqlparser-rs/pull/1520) (wugeer)
35+
- Fix ClickHouse document link from `Russian` to `English` [#1527](https://github.com/apache/datafusion-sqlparser-rs/pull/1527) (git-hulk)
36+
- Support ANTI and SEMI joins without LEFT/RIGHT [#1528](https://github.com/apache/datafusion-sqlparser-rs/pull/1528) (delamarch3)
37+
- support sqlite's OR clauses in update statements [#1530](https://github.com/apache/datafusion-sqlparser-rs/pull/1530) (lovasoa)
38+
- support column type definitions in table aliases [#1526](https://github.com/apache/datafusion-sqlparser-rs/pull/1526) (lovasoa)
39+
- Add support for MSSQL's `JSON_ARRAY`/`JSON_OBJECT` expr [#1507](https://github.com/apache/datafusion-sqlparser-rs/pull/1507) (gaoqiangz)
40+
- Add support for PostgreSQL `UNLISTEN` syntax and Add support for Postgres `LOAD extension` expr [#1531](https://github.com/apache/datafusion-sqlparser-rs/pull/1531) (wugeer)
41+
- Parse byte/bit string literals in MySQL and Postgres [#1532](https://github.com/apache/datafusion-sqlparser-rs/pull/1532) (mvzink)
42+
- Allow example CLI to read from stdin [#1536](https://github.com/apache/datafusion-sqlparser-rs/pull/1536) (mvzink)
43+
- recursive select calls are parsed with bad trailing_commas parameter [#1521](https://github.com/apache/datafusion-sqlparser-rs/pull/1521) (tomershaniii)
44+
- PartiQL queries in Redshift [#1534](https://github.com/apache/datafusion-sqlparser-rs/pull/1534) (yoavcloud)
45+
- Include license file in sqlparser_derive crate [#1543](https://github.com/apache/datafusion-sqlparser-rs/pull/1543) (ankane)
46+
- Fallback to identifier parsing if expression parsing fails [#1513](https://github.com/apache/datafusion-sqlparser-rs/pull/1513) (yoavcloud)
47+
- support `json_object('k':'v')` in postgres [#1546](https://github.com/apache/datafusion-sqlparser-rs/pull/1546) (lovasoa)
48+
- Document micro benchmarks [#1555](https://github.com/apache/datafusion-sqlparser-rs/pull/1555) (alamb)
49+
- Implement `Spanned` to retrieve source locations on AST nodes [#1435](https://github.com/apache/datafusion-sqlparser-rs/pull/1435) (Nyrox)
50+
- Fix error in benchmark queries [#1560](https://github.com/apache/datafusion-sqlparser-rs/pull/1560) (alamb)
51+
- Fix clippy warnings on rust 1.83 [#1570](https://github.com/apache/datafusion-sqlparser-rs/pull/1570) (iffyio)
52+
- Support relation visitor to visit the `Option` field [#1556](https://github.com/apache/datafusion-sqlparser-rs/pull/1556) (goldmedal)
53+
- Rename `TokenWithLocation` to `TokenWithSpan`, in backwards compatible way [#1562](https://github.com/apache/datafusion-sqlparser-rs/pull/1562) (alamb)
54+
- Support MySQL size variants for BLOB and TEXT columns [#1564](https://github.com/apache/datafusion-sqlparser-rs/pull/1564) (mvzink)
55+
- Increase version of sqlparser_derive from 0.2.2 to 0.3.0 [#1571](https://github.com/apache/datafusion-sqlparser-rs/pull/1571) (alamb)
56+
- `json_object('k' VALUE 'v')` in postgres [#1547](https://github.com/apache/datafusion-sqlparser-rs/pull/1547) (lovasoa)
57+
- Support snowflake double dot notation for object name [#1540](https://github.com/apache/datafusion-sqlparser-rs/pull/1540) (ayman-sigma)
58+
- Update comments / docs for `Spanned` [#1549](https://github.com/apache/datafusion-sqlparser-rs/pull/1549) (alamb)
59+
- Support Databricks struct literal [#1542](https://github.com/apache/datafusion-sqlparser-rs/pull/1542) (ayman-sigma)
60+
- Encapsulate CreateFunction [#1573](https://github.com/apache/datafusion-sqlparser-rs/pull/1573) (philipcristiano)
61+
- Support BIT column types [#1577](https://github.com/apache/datafusion-sqlparser-rs/pull/1577) (mvzink)
62+
- Support parsing optional nulls handling for unique constraint [#1567](https://github.com/apache/datafusion-sqlparser-rs/pull/1567) (mvzink)
63+
- Fix displaying WORK or TRANSACTION after BEGIN [#1565](https://github.com/apache/datafusion-sqlparser-rs/pull/1565) (mvzink)
64+
- Add support of the ENUM8|ENUM16 for ClickHouse dialect [#1574](https://github.com/apache/datafusion-sqlparser-rs/pull/1574) (git-hulk)
65+
- Parse Snowflake USE ROLE and USE SECONDARY ROLES [#1578](https://github.com/apache/datafusion-sqlparser-rs/pull/1578) (yoavcloud)
66+
- Snowflake ALTER TABLE clustering options [#1579](https://github.com/apache/datafusion-sqlparser-rs/pull/1579) (yoavcloud)
67+
- Support INSERT OVERWRITE INTO syntax [#1584](https://github.com/apache/datafusion-sqlparser-rs/pull/1584) (yuval-illumex)
68+
- Parse `INSERT` with subquery when lacking column names [#1586](https://github.com/apache/datafusion-sqlparser-rs/pull/1586) (iffyio)
69+
- Add support for ODBC functions [#1585](https://github.com/apache/datafusion-sqlparser-rs/pull/1585) (iffyio)
70+
71+
## Credits
72+
73+
Thank you to everyone who contributed to this release. Here is a breakdown of commits (PRs merged) per contributor.
74+
75+
```
76+
8 Andrew Lamb
77+
6 Michael Victor Zink
78+
5 Ophir LOJKINE
79+
5 Yoav Cohen
80+
5 wugeer
81+
3 Ifeanyi Ubah
82+
3 gaoqiangz
83+
3 hulk
84+
2 Ayman Elkfrawy
85+
1 Andrew Kane
86+
1 Jax Liu
87+
1 Mark-Oliver Junge
88+
1 Philip Cristiano
89+
1 Yuval Shkolar
90+
1 delamarch3
91+
1 tomershaniii
92+
```
93+
94+
Thank you also to everyone who contributed in other ways such as filing issues, reviewing PRs, and providing feedback on this release.
95+

derive/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
use proc_macro2::TokenStream;
1919
use quote::{format_ident, quote, quote_spanned, ToTokens};
2020
use syn::spanned::Spanned;
21-
use syn::{parse::{Parse, ParseStream}, parse_macro_input, parse_quote, Attribute, Data, DeriveInput, Fields, GenericParam, Generics, Ident, Index, LitStr, Meta, Token, Type, TypePath};
21+
use syn::{
22+
parse::{Parse, ParseStream},
23+
parse_macro_input, parse_quote, Attribute, Data, DeriveInput, Fields, GenericParam, Generics,
24+
Ident, Index, LitStr, Meta, Token, Type, TypePath,
25+
};
2226
use syn::{Path, PathArguments};
2327

2428
/// Implementation of `[#derive(Visit)]`
@@ -267,7 +271,11 @@ fn visit_children(
267271
}
268272

269273
fn is_option(ty: &Type) -> bool {
270-
if let Type::Path(TypePath { path: Path { segments, .. }, .. }) = ty {
274+
if let Type::Path(TypePath {
275+
path: Path { segments, .. },
276+
..
277+
}) = ty
278+
{
271279
if let Some(segment) = segments.last() {
272280
if segment.ident == "Option" {
273281
if let PathArguments::AngleBracketed(args) = &segment.arguments {

dev/release/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ Move artifacts to the release location in SVN, using the `release-tarball.sh` sc
146146
```shell
147147
./dev/release/release-tarball.sh 0.52.0 1
148148
```
149+
150+
Promote the rc tag to the release tag
151+
```shell
152+
git tag v0.52.0 v0.52.0-rc3
153+
git push apache v0.52.0
154+
```
149155

150156
Congratulations! The release is now official!
151157

src/ast/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5523,6 +5523,15 @@ impl fmt::Display for CloseCursor {
55235523
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
55245524
pub struct Function {
55255525
pub name: ObjectName,
5526+
/// Flags whether this function call uses the [ODBC syntax].
5527+
///
5528+
/// Example:
5529+
/// ```sql
5530+
/// SELECT {fn CONCAT('foo', 'bar')}
5531+
/// ```
5532+
///
5533+
/// [ODBC syntax]: https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/scalar-function-calls?view=sql-server-2017
5534+
pub uses_odbc_syntax: bool,
55265535
/// The parameters to the function, including any options specified within the
55275536
/// delimiting parentheses.
55285537
///
@@ -5561,6 +5570,10 @@ pub struct Function {
55615570

55625571
impl fmt::Display for Function {
55635572
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5573+
if self.uses_odbc_syntax {
5574+
write!(f, "{{fn ")?;
5575+
}
5576+
55645577
write!(f, "{}{}{}", self.name, self.parameters, self.args)?;
55655578

55665579
if !self.within_group.is_empty() {
@@ -5583,6 +5596,10 @@ impl fmt::Display for Function {
55835596
write!(f, " OVER {o}")?;
55845597
}
55855598

5599+
if self.uses_odbc_syntax {
5600+
write!(f, "}}")?;
5601+
}
5602+
55865603
Ok(())
55875604
}
55885605
}

src/ast/spans.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
use core::iter;
219

320
use crate::tokenizer::Span;
@@ -1478,6 +1495,7 @@ impl Spanned for Function {
14781495
fn span(&self) -> Span {
14791496
let Function {
14801497
name,
1498+
uses_odbc_syntax: _,
14811499
parameters,
14821500
args,
14831501
filter,

src/ast/visitor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ where
530530
/// let old_expr = std::mem::replace(expr, Expr::Value(Value::Null));
531531
/// *expr = Expr::Function(Function {
532532
/// name: ObjectName(vec![Ident::new("f")]),
533+
/// uses_odbc_syntax: false,
533534
/// args: FunctionArguments::List(FunctionArgumentList {
534535
/// duplicate_treatment: None,
535536
/// args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(old_expr))],

src/keywords.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ define_keywords!(
333333
FLOAT8,
334334
FLOOR,
335335
FLUSH,
336+
FN,
336337
FOLLOWING,
337338
FOR,
338339
FORCE,

0 commit comments

Comments
 (0)