Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
notfilippo committed Oct 9, 2024
1 parent 54ed6b7 commit 88c75fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion datafusion/sql/src/unparser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2363,7 +2363,7 @@ mod tests {
expr: Box::new(col("a")),
data_type: DataType::Float64,
}),
Expr::Literal(ScalarValue::Int64(Some(2))),
Expr::from(ScalarValue::Int64(Some(2))),
],
});
let ast = unparser.expr_to_sql(&expr)?;
Expand Down
14 changes: 11 additions & 3 deletions datafusion/sql/src/unparser/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use datafusion_common::{
Column, DataFusionError, Result, ScalarValue,
};
use datafusion_expr::{
utils::grouping_set_to_exprlist, Aggregate, Expr, LogicalPlan, Window,
utils::grouping_set_to_exprlist, Aggregate, Expr, LogicalPlan, Scalar, Window,
};
use sqlparser::ast;

Expand Down Expand Up @@ -209,7 +209,11 @@ pub(crate) fn date_part_to_sql(
match (style, date_part_args.len()) {
(DateFieldExtractStyle::Extract, 2) => {
let date_expr = unparser.expr_to_sql(&date_part_args[1])?;
if let Expr::Literal(ScalarValue::Utf8(Some(field))) = &date_part_args[0] {
if let Expr::Literal(Scalar {
value: ScalarValue::Utf8(Some(field)),
..
}) = &date_part_args[0]
{
let field = match field.to_lowercase().as_str() {
"year" => ast::DateTimeField::Year,
"month" => ast::DateTimeField::Month,
Expand All @@ -230,7 +234,11 @@ pub(crate) fn date_part_to_sql(
(DateFieldExtractStyle::Strftime, 2) => {
let column = unparser.expr_to_sql(&date_part_args[1])?;

if let Expr::Literal(ScalarValue::Utf8(Some(field))) = &date_part_args[0] {
if let Expr::Literal(Scalar {
value: ScalarValue::Utf8(Some(field)),
..
}) = &date_part_args[0]
{
let field = match field.to_lowercase().as_str() {
"year" => "%Y",
"month" => "%m",
Expand Down
2 changes: 1 addition & 1 deletion datafusion/substrait/src/logical_plan/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,7 @@ mod test {
let ctx = SessionContext::new();

// One expression, empty input schema
let expr = Expr::Literal(ScalarValue::Int32(Some(42)));
let expr = Expr::from(ScalarValue::Int32(Some(42)));
let field = Field::new("out", DataType::Int32, false);
let empty_schema = DFSchemaRef::new(DFSchema::empty());
let substrait =
Expand Down

0 comments on commit 88c75fc

Please sign in to comment.