Skip to content

Commit b7398a5

Browse files
committed
compiles
1 parent f52d210 commit b7398a5

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

datafusion/common/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,10 +726,10 @@ pub fn combine_limit(
726726

727727
#[cfg(test)]
728728
mod tests {
729+
use super::*;
729730
use crate::ScalarValue::Null;
730731
use arrow::array::Float64Array;
731732
use sqlparser::tokenizer::Span;
732-
use super::*;
733733

734734
#[test]
735735
fn test_bisect_linear_left_and_right() -> Result<()> {

datafusion/sql/src/statement.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
694694
// SHOW TABLES IN/FROM are equivalent, this field specifies which the user
695695
// specified, but it doesn't affect the plan so ignore the field
696696
//clause: _,
697-
} =>
698-
{
699-
todo!("Update show tables/ fix for new syntax");
700-
// self.show_tables_to_plan(extended, full, db_name, filter)
701-
},
697+
} => {
698+
todo!("Update show tables/ fix for new syntax");
699+
// self.show_tables_to_plan(extended, full, db_name, filter)
700+
}
702701

703702
Statement::ShowColumns {
704703
extended,
@@ -709,7 +708,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
709708
} => {
710709
todo!("Update show columns / fix for new syntax");
711710
//self.show_columns_to_plan(extended, full, table_name, filter)
712-
},
711+
}
713712

714713
Statement::Insert(Insert {
715714
or,

datafusion/sql/src/unparser/dialect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
use std::sync::Arc;
1919

2020
use arrow_schema::TimeUnit;
21+
use datafusion_common::Result;
2122
use datafusion_expr::Expr;
2223
use regex::Regex;
24+
use sqlparser::tokenizer::Span;
2325
use sqlparser::{
2426
ast::{self, Function, Ident, ObjectName, TimezoneInfo},
2527
keywords::ALL_KEYWORDS,
2628
};
2729

28-
use datafusion_common::Result;
29-
3030
use super::{utils::character_length_to_sql, utils::date_part_to_sql, Unparser};
3131

3232
/// `Dialect` to use for Unparsing

datafusion/sql/src/unparser/expr.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ use arrow_array::types::{
3535
};
3636
use arrow_array::{Date32Array, Date64Array, PrimitiveArray};
3737
use arrow_schema::DataType;
38-
use sqlparser::ast::helpers::attached_token::AttachedToken;
39-
use sqlparser::tokenizer::Span;
4038
use datafusion_common::{
4139
internal_datafusion_err, internal_err, not_impl_err, plan_err, Column, Result,
4240
ScalarValue,
@@ -45,6 +43,8 @@ use datafusion_expr::{
4543
expr::{Alias, Exists, InList, ScalarFunction, Sort, WindowFunction},
4644
Between, BinaryExpr, Case, Cast, Expr, GroupingSet, Like, Operator, TryCast,
4745
};
46+
use sqlparser::ast::helpers::attached_token::AttachedToken;
47+
use sqlparser::tokenizer::Span;
4848

4949
/// Convert a DataFusion [`Expr`] to [`ast::Expr`]
5050
///
@@ -412,7 +412,10 @@ impl Unparser<'_> {
412412
if let Some(qualifier) = qualifier {
413413
let idents: Vec<Ident> =
414414
qualifier.to_vec().into_iter().map(Ident::new).collect();
415-
Ok(ast::Expr::QualifiedWildcard(ObjectName(idents), attached_token))
415+
Ok(ast::Expr::QualifiedWildcard(
416+
ObjectName(idents),
417+
attached_token,
418+
))
416419
} else {
417420
Ok(ast::Expr::Wildcard(attached_token))
418421
}
@@ -1490,7 +1493,6 @@ impl Unparser<'_> {
14901493
value: "UNNEST".to_string(),
14911494
quote_style: None,
14921495
span: Span::empty(),
1493-
14941496
}]),
14951497
args: ast::FunctionArguments::List(ast::FunctionArgumentList {
14961498
duplicate_treatment: None,

datafusion/sql/src/unparser/plan.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use datafusion_expr::{
4242
expr::Alias, BinaryExpr, Distinct, Expr, JoinConstraint, JoinType, LogicalPlan,
4343
LogicalPlanBuilder, Operator, Projection, SortExpr, TableScan,
4444
};
45-
use sqlparser::ast::{self, Ident, SetExpr};
45+
use sqlparser::ast::{self, Ident, SetExpr, TableAliasColumnDef};
4646
use std::sync::Arc;
4747

4848
/// Convert a DataFusion [`LogicalPlan`] to [`ast::Statement`]
@@ -1006,6 +1006,13 @@ impl Unparser<'_> {
10061006
}
10071007

10081008
fn new_table_alias(&self, alias: String, columns: Vec<Ident>) -> ast::TableAlias {
1009+
let columns = columns
1010+
.into_iter()
1011+
.map(|ident| TableAliasColumnDef {
1012+
name: ident,
1013+
data_type: None,
1014+
})
1015+
.collect();
10091016
ast::TableAlias {
10101017
name: self.new_ident_quoted_if_needs(alias),
10111018
columns,

datafusion/sql/src/unparser/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
use std::{cmp::Ordering, sync::Arc, vec};
1919

20+
use super::{
21+
dialect::CharacterLengthStyle, dialect::DateFieldExtractStyle,
22+
rewrite::TableAliasRewriter, Unparser,
23+
};
2024
use datafusion_common::{
2125
internal_err,
2226
tree_node::{Transformed, TransformedResult, TreeNode},
@@ -28,10 +32,6 @@ use datafusion_expr::{
2832
};
2933
use sqlparser::ast;
3034
use sqlparser::tokenizer::Span;
31-
use super::{
32-
dialect::CharacterLengthStyle, dialect::DateFieldExtractStyle,
33-
rewrite::TableAliasRewriter, Unparser,
34-
};
3535

3636
/// Recursively searches children of [LogicalPlan] to find an Aggregate node if exists
3737
/// prior to encountering a Join, TableScan, or a nested subquery (derived table factor).

0 commit comments

Comments
 (0)