Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply changes from v0.53.0 #2

Open
wants to merge 69 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
749b061
MySQL dialect: Add support for hash comments (#1466)
hansott Oct 11, 2024
7c20d4a
Fix #1469 (SET ROLE regression) (#1474)
lovasoa Oct 14, 2024
1dd7d26
Add support for parsing MsSql alias with equals (#1467)
yoavcloud Oct 20, 2024
3421e1e
Snowflake: support for extended column options in `CREATE TABLE` (#1454)
7phs Oct 20, 2024
45c5d69
MsSQL TRY_CONVERT (#1477)
yoavcloud Oct 20, 2024
a8432b5
Add PostgreSQL specfic "CREATE TYPE t AS ENUM (...)" support. (#1460)
caldwell Oct 21, 2024
38f1e57
feat: adding Display implementation to DELETE and INSERT (#1427)
seve-martinez Oct 21, 2024
8e0d26a
fix for maybe_parse preventing parser from erroring on recursion limi…
tomershaniii Oct 21, 2024
ee90373
Fix build (#1483)
yoavcloud Oct 29, 2024
8de3cb0
Fix complex blocks warning when running clippy (#1488)
git-hulk Nov 1, 2024
e2197ee
Add support for SHOW DATABASES/SCHEMAS/TABLES/VIEWS in Hive (#1487)
yoavcloud Nov 3, 2024
a9a9d58
Fix typo in `Dialect::supports_eq_alias_assigment` (#1478)
alamb Nov 6, 2024
05821cc
Add support for PostgreSQL `LISTEN/NOTIFY` syntax (#1485)
wugeer Nov 6, 2024
a5b0092
Add support for TOP before ALL/DISTINCT (#1495)
yoavcloud Nov 6, 2024
fc0e13b
add support for `FOR ORDINALITY` and `NESTED` in JSON_TABLE (#1493)
lovasoa Nov 6, 2024
9394ad4
Add Apache License to additional files (#1502)
alamb Nov 6, 2024
543ec6c
Move CHANGELOG content (#1503)
alamb Nov 6, 2024
d853c35
improve support for T-SQL EXECUTE statements (#1490)
lovasoa Nov 7, 2024
334a5bf
Update CHANGELOG.md for `0.52.0` release, add scripts/ instructions f…
alamb Nov 7, 2024
e857787
hive: support for special not expression `!a` and raise error for `a!…
wugeer Nov 13, 2024
9082448
Add support for MSSQL's `OPENJSON WITH` clause (#1498)
gaoqiangz Nov 13, 2024
3a8369a
Parse true and false as identifiers in mssql (#1510)
lovasoa Nov 13, 2024
632ba4c
Fix the parsing error in MSSQL for multiple statements that include `…
wugeer Nov 13, 2024
76322ba
Add support for Snowflake SHOW DATABASES/SCHEMAS/TABLES/VIEWS/COLUMNS…
yoavcloud Nov 13, 2024
6d907d3
Add support of COMMENT ON syntax for Snowflake (#1516)
git-hulk Nov 13, 2024
2bb8144
Add support for MYSQL's `CREATE TABLE SELECT` expr (#1515)
wugeer Nov 13, 2024
62eaee6
Add support for MSSQL's `XQuery` methods (#1500)
gaoqiangz Nov 14, 2024
724a1d1
Add support for Hive's `LOAD DATA` expr (#1520)
wugeer Nov 15, 2024
4a5f20e
Fix ClickHouse document link from `Russian` to `English` (#1527)
git-hulk Nov 18, 2024
a67a4f3
Support ANTI and SEMI joins without LEFT/RIGHT (#1528)
delamarch3 Nov 18, 2024
4c629e8
support sqlite's OR clauses in update statements (#1530)
lovasoa Nov 18, 2024
f961efc
support column type definitions in table aliases (#1526)
lovasoa Nov 18, 2024
92be237
Add support for MSSQL's `JSON_ARRAY`/`JSON_OBJECT` expr (#1507)
gaoqiangz Nov 18, 2024
73947a5
Add support for PostgreSQL `UNLISTEN` syntax and Add support for Post…
wugeer Nov 19, 2024
fad2ddd
Parse byte/bit string literals in MySQL and Postgres (#1532)
mvzink Nov 20, 2024
a115022
Allow example CLI to read from stdin (#1536)
mvzink Nov 22, 2024
1051900
recursive select calls are parsed with bad trailing_commas parameter …
tomershaniii Nov 23, 2024
62fa860
PartiQL queries in Redshift (#1534)
yoavcloud Nov 23, 2024
0fb2ef3
Include license file in sqlparser_derive crate (#1543)
ankane Nov 24, 2024
fd21fae
Fallback to identifier parsing if expression parsing fails (#1513)
yoavcloud Nov 25, 2024
525d178
support `json_object('k':'v')` in postgres (#1546)
lovasoa Nov 25, 2024
0adec33
Document micro benchmarks (#1555)
alamb Nov 26, 2024
3c8fd74
Implement `Spanned` to retrieve source locations on AST nodes (#1435)
Nyrox Nov 26, 2024
5a510ac
Fix error in benchmark queries (#1560)
alamb Nov 27, 2024
6291afb
Fix clippy warnings on rust 1.83 (#1570)
iffyio Nov 29, 2024
92c6e7f
Support relation visitor to visit the `Option` field (#1556)
goldmedal Nov 29, 2024
a134910
Rename `TokenWithLocation` to `TokenWithSpan`, in backwards compatibl…
alamb Nov 30, 2024
48b0e4d
Support MySQL size variants for BLOB and TEXT columns (#1564)
mvzink Nov 30, 2024
b000738
Increase version of sqlparser_derive from 0.2.2 to 0.3.0 (#1571)
alamb Nov 30, 2024
96f7c02
`json_object('k' VALUE 'v')` in postgres (#1547)
lovasoa Nov 30, 2024
f4f112d
Support snowflake double dot notation for object name (#1540)
ayman-sigma Nov 30, 2024
4ab3ab9
Update comments / docs for `Spanned` (#1549)
alamb Nov 30, 2024
bd750df
Support Databricks struct literal (#1542)
ayman-sigma Dec 2, 2024
e16b246
Encapsulate CreateFunction (#1573)
philipcristiano Dec 2, 2024
6d4188d
Support BIT column types (#1577)
mvzink Dec 4, 2024
6517da6
Support parsing optional nulls handling for unique constraint (#1567)
mvzink Dec 4, 2024
c761f0b
Fix displaying WORK or TRANSACTION after BEGIN (#1565)
mvzink Dec 4, 2024
dd7ba72
Add support of the ENUM8|ENUM16 for ClickHouse dialect (#1574)
git-hulk Dec 5, 2024
7b50ac3
Parse Snowflake USE ROLE and USE SECONDARY ROLES (#1578)
yoavcloud Dec 5, 2024
d0fcc06
Snowflake ALTER TABLE clustering options (#1579)
yoavcloud Dec 6, 2024
00abaf2
Support INSERT OVERWRITE INTO syntax (#1584)
yuval-illumex Dec 9, 2024
04271b0
Parse `INSERT` with subquery when lacking column names (#1586)
iffyio Dec 11, 2024
a13f8c6
Add support for ODBC functions (#1585)
iffyio Dec 11, 2024
5de5312
Update version to 0.53.0 and add release notes (#1592)
alamb Dec 12, 2024
93c9cb5
Add Apache license header to spans.rs
alamb Dec 12, 2024
e7d2c85
Run cargo fmt in derive crate
alamb Dec 12, 2024
6359358
Merge tag 'v0.53.0' of https://github.com/apache/datafusion-sqlparser…
hansott Dec 26, 2024
f7a2ef7
Apply patch for dollar placeholder
hansott Dec 28, 2024
d018ee3
Merge pull request #3 from AikidoSec/dollar-placeholder
willem-delbare Dec 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

version: 2
updates:
- package-ecosystem: cargo
Expand Down
54 changes: 18 additions & 36 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: Rust

on: [push, pull_request]
Expand All @@ -10,7 +27,7 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
- run: cargo fmt -- --check
- run: cargo fmt --all -- --check

lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -68,38 +85,3 @@ jobs:
use-tool-cache: true
- name: Test
run: cargo test --all-features

test-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: stable
- name: Install Tarpaulin
uses: actions-rs/[email protected]
with:
crate: cargo-tarpaulin
version: 0.14.2
use-tool-cache: true
- name: Coverage
run: cargo tarpaulin -o Lcov --output-dir ./coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

publish-crate:
if: startsWith(github.ref, 'refs/tags/v0')
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
- name: Publish
shell: bash
run: |
cargo publish --token ${{ secrets.CRATES_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/target/
/sqlparser_bench/target/
/derive/target/
dev/dist

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Expand Down
1,180 changes: 5 additions & 1,175 deletions CHANGELOG.md

Large diffs are not rendered by default.

16 changes: 5 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
[package]
name = "sqlparser"
description = "Extensible SQL Lexer and Parser with support for ANSI SQL:2011"
version = "0.51.0"
authors = ["Andy Grove <[email protected]>"]
homepage = "https://github.com/sqlparser-rs/sqlparser-rs"
version = "0.53.0"
authors = ["Apache DataFusion <[email protected]>"]
homepage = "https://github.com/apache/datafusion-sqlparser-rs"
documentation = "https://docs.rs/sqlparser/"
keywords = ["ansi", "sql", "lexer", "parser"]
repository = "https://github.com/sqlparser-rs/sqlparser-rs"
repository = "https://github.com/apache/datafusion-sqlparser-rs"
license = "Apache-2.0"
include = [
"src/**/*.rs",
Expand Down Expand Up @@ -51,19 +51,13 @@ serde = { version = "1.0", features = ["derive"], optional = true }
# of dev-dependencies because of
# https://github.com/rust-lang/cargo/issues/1596
serde_json = { version = "1.0", optional = true }
sqlparser_derive = { version = "0.2.0", path = "derive", optional = true }
sqlparser_derive = { version = "0.3.0", path = "derive", optional = true }

[dev-dependencies]
simple_logger = "5.0"
matches = "0.1"
pretty_assertions = "1"

[package.metadata.release]
# Instruct `cargo release` to not run `cargo publish` locally:
# https://github.com/sunng87/cargo-release/blob/master/docs/reference.md#config-fields
# See docs/releasing.md for details.
publish = false

[package.metadata.docs.rs]
# Document these features on docs.rs
features = ["serde", "visitor"]
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Extensible SQL Lexer and Parser for Rust

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
Expand Down Expand Up @@ -81,15 +100,37 @@ similar semantics are represented with the same AST. We welcome PRs to fix such
issues and distinguish different syntaxes in the AST.


## Source Locations (Work in Progress)

This crate allows recovering source locations from AST nodes via the [Spanned]
trait, which can be used for advanced diagnostics tooling. Note that this
feature is a work in progress and many nodes report missing or inaccurate spans.
Please see [this ticket] for information on how to contribute missing
improvements.

[Spanned]: https://docs.rs/sqlparser/latest/sqlparser/ast/trait.Spanned.html
[this ticket]: https://github.com/apache/datafusion-sqlparser-rs/issues/1548

```rust
// Parse SQL
let ast = Parser::parse_sql(&GenericDialect, "SELECT A FROM B").unwrap();

// The source span can be retrieved with start and end locations
assert_eq!(ast[0].span(), Span {
start: Location::of(1, 1),
end: Location::of(1, 16),
});
```

## SQL compliance

SQL was first standardized in 1987, and revisions of the standard have been
published regularly since. Most revisions have added significant new features to
the language, and as a result no database claims to support the full breadth of
features. This parser currently supports most of the SQL-92 syntax, plus some
syntax from newer versions that have been explicitly requested, plus some MSSQL,
PostgreSQL, and other dialect-specific syntax. Whenever possible, the [online
SQL:2016 grammar][sql-2016-grammar] is used to guide what syntax to accept.
syntax from newer versions that have been explicitly requested, plus various
other dialect-specific syntax. Whenever possible, the [online SQL:2016
grammar][sql-2016-grammar] is used to guide what syntax to accept.

Unfortunately, stating anything more specific about compliance is difficult.
There is no publicly available test suite that can assess compliance
Expand Down Expand Up @@ -191,6 +232,18 @@ Our goal as maintainers is to facilitate the integration
of various features from various contributors, but not to provide the
implementations ourselves, as we simply don't have the resources.

### Benchmarking

There are several micro benchmarks in the `sqlparser_bench` directory.
You can run them with:

```
git checkout main
cd sqlparser_bench
cargo bench
git checkout <your branch>
cargo bench
```

## Licensing

Expand Down
Loading
Loading