alamb commented on code in PR #12610: URL: https://github.com/apache/datafusion/pull/12610#discussion_r1774984617
########## datafusion/sql/src/unparser/expr.rs: ########## @@ -219,12 +219,24 @@ impl Unparser<'_> { } Expr::Cast(Cast { expr, data_type }) => { let inner_expr = self.expr_to_sql_inner(expr)?; - Ok(ast::Expr::Cast { - kind: ast::CastKind::Cast, - expr: Box::new(inner_expr), - data_type: self.arrow_dtype_to_ast_dtype(data_type)?, - format: None, - }) + match data_type { + DataType::Dictionary(_, _) => match inner_expr { + // Dictionary values don't need to be cast to other types when rewritten back to sql Review Comment: this is another example of where logical types as discussed in #11513 might make sense -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org