Skip to content

Commit c95affc

Browse files
committed
Update for new APIs
1 parent 68363eb commit c95affc

File tree

7 files changed

+23
-1
lines changed

7 files changed

+23
-1
lines changed

datafusion/sql/src/expr/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
272272
expr,
273273
data_type,
274274
format,
275+
array: _,
275276
} => {
276277
self.sql_cast_to_expr(*expr, &data_type, format, schema, planner_context)
277278
}
@@ -281,6 +282,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
281282
expr,
282283
data_type,
283284
format,
285+
array: _,
284286
} => {
285287
if let Some(format) = format {
286288
return not_impl_err!("CAST with format is not supported: {format}");

datafusion/sql/src/select.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
361361
// Process distinct clause
362362
let plan = match select.distinct {
363363
None => Ok(plan),
364+
Some(Distinct::All) => Ok(plan),
364365
Some(Distinct::Distinct) => {
365366
LogicalPlanBuilder::from(plan).distinct()?.build()
366367
}

datafusion/sql/src/statement.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
342342
refresh_mode,
343343
initialize,
344344
require_user,
345+
partition_of: _,
346+
for_values: _,
345347
}) => {
346348
if temporary {
347349
return not_impl_err!("Temporary tables not supported")?;
@@ -990,6 +992,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
990992
settings,
991993
format_clause,
992994
insert_token: _insert_token, // record the location the `INSERT` token
995+
optimizer_hint: _,
993996
}) => {
994997
let table_name = match table {
995998
TableObject::TableName(table_name) => table_name,
@@ -1059,6 +1062,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
10591062
or,
10601063
limit,
10611064
update_token: _,
1065+
optimizer_hint: _,
10621066
}) => {
10631067
let from_clauses =
10641068
from.map(|update_table_from_kind| match update_table_from_kind {
@@ -1091,6 +1095,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
10911095
order_by,
10921096
limit,
10931097
delete_token: _,
1098+
optimizer_hint: _,
10941099
}) => {
10951100
if !tables.is_empty() {
10961101
plan_err!("DELETE <TABLE> not supported")?;
@@ -1397,6 +1402,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
13971402
cascade,
13981403
on_cluster,
13991404
table,
1405+
if_exists: _,
14001406
}) => {
14011407
let _ = table; // Support TRUNCATE TABLE and TRUNCATE syntax
14021408
if table_names.len() != 1 {

datafusion/sql/src/unparser/ast.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,9 @@ impl SelectBuilder {
315315
}
316316
pub fn build(&self) -> Result<ast::Select, BuilderError> {
317317
Ok(ast::Select {
318+
optimizer_hint: None,
318319
distinct: self.distinct.clone(),
320+
select_modifiers: None,
319321
top_before_distinct: false,
320322
top: self.top.clone(),
321323
projection: self.projection.clone().unwrap_or_default(),
@@ -340,7 +342,7 @@ impl SelectBuilder {
340342
named_window: self.named_window.clone(),
341343
qualify: self.qualify.clone(),
342344
value_table_mode: self.value_table_mode,
343-
connect_by: None,
345+
connect_by: Vec::new(),
344346
window_before_qualify: false,
345347
prewhere: None,
346348
select_token: AttachedToken::empty(),
@@ -608,6 +610,7 @@ impl DerivedRelationBuilder {
608610
}
609611
},
610612
alias: self.alias.clone(),
613+
sample: None,
611614
})
612615
}
613616
fn create_empty() -> Self {

datafusion/sql/src/unparser/dialect.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ impl PostgreSqlDialect {
372372
kind: ast::CastKind::Cast,
373373
expr: Box::new(expr.clone()),
374374
data_type: ast::DataType::Numeric(ast::ExactNumberInfo::None),
375+
array: false,
375376
format: None,
376377
};
377378
}

datafusion/sql/src/unparser/expr.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ impl Unparser<'_> {
494494
kind: ast::CastKind::TryCast,
495495
expr: Box::new(inner_expr),
496496
data_type: self.arrow_dtype_to_ast_dtype(data_type)?,
497+
array: false,
497498
format: None,
498499
})
499500
}
@@ -1145,6 +1146,7 @@ impl Unparser<'_> {
11451146
kind: ast::CastKind::Cast,
11461147
expr: Box::new(ast::Expr::value(SingleQuotedString(ts))),
11471148
data_type: self.dialect.timestamp_cast_dtype(&time_unit, &None),
1149+
array: false,
11481150
format: None,
11491151
})
11501152
}
@@ -1167,6 +1169,7 @@ impl Unparser<'_> {
11671169
kind: ast::CastKind::Cast,
11681170
expr: Box::new(ast::Expr::value(SingleQuotedString(time))),
11691171
data_type: ast::DataType::Time(None, TimezoneInfo::None),
1172+
array: false,
11701173
format: None,
11711174
})
11721175
}
@@ -1184,13 +1187,15 @@ impl Unparser<'_> {
11841187
kind: ast::CastKind::Cast,
11851188
expr: Box::new(inner_expr),
11861189
data_type: self.arrow_dtype_to_ast_dtype(data_type)?,
1190+
array: false,
11871191
format: None,
11881192
}),
11891193
},
11901194
_ => Ok(ast::Expr::Cast {
11911195
kind: ast::CastKind::Cast,
11921196
expr: Box::new(inner_expr),
11931197
data_type: self.arrow_dtype_to_ast_dtype(data_type)?,
1198+
array: false,
11941199
format: None,
11951200
}),
11961201
}
@@ -1332,6 +1337,7 @@ impl Unparser<'_> {
13321337
date.to_string(),
13331338
))),
13341339
data_type: ast::DataType::Date,
1340+
array: false,
13351341
format: None,
13361342
})
13371343
}
@@ -1355,6 +1361,7 @@ impl Unparser<'_> {
13551361
datetime.to_string(),
13561362
))),
13571363
data_type: self.ast_type_for_date64_in_cast(),
1364+
array: false,
13581365
format: None,
13591366
})
13601367
}

datafusion/sql/src/utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ pub(crate) fn value_to_string(value: &Value) -> Option<String> {
331331
Value::Number(_, _) | Value::Boolean(_) => Some(value.to_string()),
332332
Value::UnicodeStringLiteral(s) => Some(s.to_string()),
333333
Value::EscapedStringLiteral(s) => Some(s.to_string()),
334+
Value::QuoteDelimitedStringLiteral(s)
335+
| Value::NationalQuoteDelimitedStringLiteral(s) => Some(s.value.to_string()),
334336
Value::DoubleQuotedString(_)
335337
| Value::NationalStringLiteral(_)
336338
| Value::SingleQuotedByteStringLiteral(_)

0 commit comments

Comments
 (0)