Skip to content

Commit 52482b3

Browse files
iskakaushikAviRaboahpawel-big-lebowskialambaljazerzen
authored
Merge Upstream (#6)
* Support identifiers beginning with digits in MySQL (#856) * support COPY INTO in snowflake (#841) Signed-off-by: Pawel Leszczynski <[email protected]> * Add `dialect_from_str` and improve `Dialect` documentation (#848) * Add `dialect_from_str` and improve `Dialect` documentation * cleanup * fix compilation with nostd * Support multiple-table DELETE syntax (#855) * Support `DISTINCT ON (...)` (#852) * Support "DISTINCT ON (...)" * a test * fix the merge * Test trailing commas (#859) * test: add tests for trailing commas * tweaks * Add support for query source in COPY .. TO statement (#858) * Add support for query source in COPY .. TO statement * Fix compile error * Fix logical merge conflict (#865) * Fix tiny typo in custom_sql_parser.md (#864) * Make Expr::Interval its own struct (#872) * Make Expr::Interval its own struct * Add test interval display * Fix cargo fmt * Include license file in published crate (#871) * Add support for multiple expressions, order by in aggregations (#879) * Add support for multiple expressions, order by in aggregations * Fix formatting errors * Resolve linter errors * Add parse_multipart_identifier function to parser (#860) * Add parse_multipart_identifier function to parser * Update doc for parse_multipart_identifier * Fix conflict * feat: Add custom operator (#868) * feat: Add custom operator From #863 - It doesn't parse anything — I'm not sure how to parse ` SELECT 'a' REGEXP '^[a-d]';` with `REGEXP` as the operator... (but fine for my narrow purpose) - If we need tests, where would I add them? * Update src/ast/operator.rs --------- Co-authored-by: Andrew Lamb <[email protected]> * feat: Support MySQL's `DIV` operator (#876) * feat: MySQL's DIV operator * fix: do not use `_` prefix for used variable --------- Co-authored-by: Andrew Lamb <[email protected]> * truncate: table as optional keyword (#883) Signed-off-by: Maciej Obuchowski <[email protected]> * feat: add DuckDB dialect (#878) * feat: add DuckDB dialect * formatting * fix conflict * support // in GenericDialect * add DucDbDialect to all_dialects * add comment from suggestion Co-authored-by: Andrew Lamb <[email protected]> * fix: support // in GenericDialect --------- Co-authored-by: Andrew Lamb <[email protected]> * Add support for first, last aggregate function parsing (#882) * Add order by parsing to functions * Fix doc error * minor changes * Named window frames (#881) * after over clause, named window can be parsed with window ... as after having clause * Lint errors are fixed * Support for multiple windows * fix lint errors * simplifications * rename function * Rewrite named window search in functional style * Test added and some minor changes * Minor changes on tests and namings, and semantic check is removed --------- Co-authored-by: Mustafa Akur <[email protected]> Co-authored-by: Mehmet Ozan Kabak <[email protected]> * Fix merge conflict (#885) * Update CHANGELOG for `0.34.0` release (#884) * chore: Release sqlparser version 0.34.0 * Update criterion requirement from 0.4 to 0.5 in /sqlparser_bench (#890) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: Pawel Leszczynski <[email protected]> Signed-off-by: Maciej Obuchowski <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: AviRaboah <[email protected]> Co-authored-by: pawel.leszczynski <[email protected]> Co-authored-by: Andrew Lamb <[email protected]> Co-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Armin Primadi <[email protected]> Co-authored-by: Okue <[email protected]> Co-authored-by: Andrew Kane <[email protected]> Co-authored-by: Mustafa Akur <[email protected]> Co-authored-by: Jeffrey <[email protected]> Co-authored-by: Maximilian Roos <[email protected]> Co-authored-by: eitsupi <[email protected]> Co-authored-by: Maciej Obuchowski <[email protected]> Co-authored-by: Berkay Şahin <[email protected]> Co-authored-by: Mustafa Akur <[email protected]> Co-authored-by: Mehmet Ozan Kabak <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 3203d7a commit 52482b3

31 files changed

+2177
-261
lines changed

CHANGELOG.md

+31
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,37 @@ Given that the parser produces a typed AST, any changes to the AST will technica
88
## [Unreleased]
99
Check https://github.com/sqlparser-rs/sqlparser-rs/commits/main for undocumented changes.
1010

11+
## [0.34.0] 2023-05-19
12+
13+
### Added
14+
15+
* Support named window frames (#881) - Thanks @berkaysynnada, @mustafasrepo, and @ozankabak
16+
* Support for `ORDER BY` clauses in aggregate functions (#882) - Thanks @mustafasrepo
17+
* Support `DuckDB` dialect (#878) - Thanks @eitsupi
18+
* Support optional `TABLE` keyword for `TRUNCATE TABLE` (#883) - Thanks @mobuchowski
19+
* Support MySQL's `DIV` operator (#876) - Thanks @eitsupi
20+
* Support Custom operators (#868) - Thanks @max-sixty
21+
* Add `Parser::parse_multipart_identifier` (#860) - Thanks @Jefffrey
22+
* Support for multiple expressions, order by in `ARRAY_AGG` (#879) - Thanks @mustafasrepo
23+
* Support for query source in `COPY .. TO` statement (#858) - Thanks @aprimadi
24+
* Support `DISTINCT ON (...)` (#852) - Thanks @aljazerzen
25+
* Support multiple-table `DELETE` syntax (#855) - Thanks @AviRaboah
26+
* Support `COPY INTO` in `SnowflakeDialect` (#841) - Thanks @pawel-big-lebowski
27+
* Support identifiers beginning with digits in MySQL (#856) - Thanks @AviRaboah
28+
29+
### Changed
30+
* Include license file in published crate (#871) - Thanks @ankane
31+
* Make `Expr::Interval` its own struct (#872) - Thanks @aprimadi
32+
* Add dialect_from_str and improve Dialect documentation (#848) - Thanks @alamb
33+
* Add clickhouse to example (#849) - Thanks @anglinb
34+
35+
### Fixed
36+
* Fix merge conflict (#885) - Thanks @alamb
37+
* Fix tiny typo in custom_sql_parser.md (#864) - Thanks @okue
38+
* Fix logical merge conflict (#865) - Thanks @alamb
39+
* Test trailing commas (#859) - Thanks @aljazerzen
40+
41+
1142
## [0.33.0] 2023-04-10
1243

1344
### Added

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "sqlparser"
33
description = "Extensible SQL Lexer and Parser with support for ANSI SQL:2011"
4-
version = "0.33.0"
4+
version = "0.34.0"
55
authors = ["Andy Grove <[email protected]>"]
66
homepage = "https://github.com/sqlparser-rs/sqlparser-rs"
77
documentation = "https://docs.rs/sqlparser/"
@@ -11,6 +11,7 @@ license = "Apache-2.0"
1111
include = [
1212
"src/**/*.rs",
1313
"Cargo.toml",
14+
"LICENSE.TXT",
1415
]
1516
edition = "2021"
1617

docs/custom_sql_parser.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ The concept is simply to write a new parser that delegates to the ANSI parser so
66

77
I also plan on building in specific support for custom data types, where a lambda function can be passed to the parser to parse data types.
88

9-
For an example of this, see the [DataFusion](https://github.com/apache/arrow-datafusion) project and its [query planner] (https://github.com/apache/arrow-datafusion/tree/master/datafusion/sql).
9+
For an example of this, see the [DataFusion](https://github.com/apache/arrow-datafusion) project and its [query planner](https://github.com/apache/arrow-datafusion/tree/master/datafusion/sql).
1010

examples/cli.rs

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ $ cargo run --feature json_example --example cli FILENAME.sql [--dialectname]
4646
"--hive" => Box::new(HiveDialect {}),
4747
"--redshift" => Box::new(RedshiftSqlDialect {}),
4848
"--clickhouse" => Box::new(ClickHouseDialect {}),
49+
"--duckdb" => Box::new(DuckDbDialect {}),
4950
"--generic" | "" => Box::new(GenericDialect {}),
5051
s => panic!("Unexpected parameter: {s}"),
5152
};

sqlparser_bench/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2018"
88
sqlparser = { path = "../" }
99

1010
[dev-dependencies]
11-
criterion = "0.4"
11+
criterion = "0.5"
1212

1313
[[bench]]
1414
name = "sqlparser_bench"

src/ast/helpers/stmt_data_loading.rs

+27
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use core::fmt::Formatter;
2424
#[cfg(feature = "serde")]
2525
use serde::{Deserialize, Serialize};
2626

27+
use crate::ast::Ident;
2728
#[cfg(feature = "visitor")]
2829
use sqlparser_derive::{Visit, VisitMut};
2930

@@ -63,6 +64,16 @@ pub struct DataLoadingOption {
6364
pub value: String,
6465
}
6566

67+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
68+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
69+
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
70+
pub struct StageLoadSelectItem {
71+
pub alias: Option<Ident>,
72+
pub file_col_num: i32,
73+
pub element: Option<Ident>,
74+
pub item_as: Option<Ident>,
75+
}
76+
6677
impl fmt::Display for StageParamsObject {
6778
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6879
let url = &self.url.as_ref();
@@ -121,3 +132,19 @@ impl fmt::Display for DataLoadingOption {
121132
Ok(())
122133
}
123134
}
135+
136+
impl fmt::Display for StageLoadSelectItem {
137+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
138+
if self.alias.is_some() {
139+
write!(f, "{}.", self.alias.as_ref().unwrap())?;
140+
}
141+
write!(f, "${}", self.file_col_num)?;
142+
if self.element.is_some() {
143+
write!(f, ":{}", self.element.as_ref().unwrap())?;
144+
}
145+
if self.item_as.is_some() {
146+
write!(f, " AS {}", self.item_as.as_ref().unwrap())?;
147+
}
148+
Ok(())
149+
}
150+
}

0 commit comments

Comments
 (0)