Skip to content

Commit 6b8b076

Browse files
committed
Merge branch 'main' into feature/function_orderby
# Conflicts: # src/parser.rs
2 parents 22b0b7c + 097e7ad commit 6b8b076

26 files changed

+1666
-206
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ $ cargo run --feature json_example --example cli FILENAME.sql [--dialectname]
4545
"--snowflake" => Box::new(SnowflakeDialect {}),
4646
"--hive" => Box::new(HiveDialect {}),
4747
"--redshift" => Box::new(RedshiftSqlDialect {}),
48+
"--clickhouse" => Box::new(ClickHouseDialect {}),
4849
"--generic" | "" => Box::new(GenericDialect {}),
4950
s => panic!("Unexpected parameter: {s}"),
5051
};

src/ast/helpers/stmt_data_loading.rs

Lines changed: 27 additions & 0 deletions
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)