alamb commented on code in PR #5806:
URL: https://github.com/apache/arrow-datafusion/pull/5806#discussion_r1154723845
##########
datafusion/sql/Cargo.toml:
##########
@@ -38,6 +38,7 @@ unicode_expressions = []
[dependencies]
arrow-schema = { workspace = true }
+arrow = { workspace = true }
datafusion-common = { path = "../common", version = "21.0.0" }
Review Comment:
`datafusion-common` already depends on arrow so this is no new (net)
dependency
##########
datafusion/sql/src/expr/value.rs:
##########
@@ -202,11 +203,17 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
}
};
- let leading_field = leading_field
- .as_ref()
- .map(|dt| dt.to_string())
- .unwrap_or_else(|| "second".to_string());
+ // leading_field really means the unit if specified
+ // for example, "month" in `INTERVAL '5' month`
- Ok(lit(parse_interval(&leading_field, &value)?))
+ let value = if let Some(leading_field) = leading_field.as_ref() {
+ format!("{value} {leading_field}")
+ } else {
+ // default to seconds for the units
+ format!("{value} seconds")
Review Comment:
this is the same default as previously
##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -601,14 +593,7 @@ fn coerce_arguments_for_signature(
/// Cast `expr` to the specified type, if possible
fn cast_expr(expr: &Expr, to_type: &DataType, schema: &DFSchema) ->
Result<Expr> {
- // Special case until Interval coercion is handled in arrow-rs
Review Comment:
🎉 for avoiding the special cases
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]