Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion datafusion/sql/src/unparser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,9 @@ impl Unparser<'_> {
let inner_expr = self.expr_to_sql_inner(expr)?;
match inner_expr {
ast::Expr::Value(_) => match data_type {
DataType::Dictionary(_, _) | DataType::Binary => Ok(inner_expr),
DataType::Dictionary(_, _) | DataType::Binary | DataType::BinaryView => {
Ok(inner_expr)
}
_ => Ok(ast::Expr::Cast {
kind: ast::CastKind::Cast,
expr: Box::new(inner_expr),
Expand Down Expand Up @@ -2204,6 +2206,13 @@ mod tests {
data_type: DataType::Binary,
}),
"'blah'",
Expr::Cast(Cast {
expr: Box::new(Expr::Literal(ScalarValue::Utf8(Some(
"blah".to_string(),
)))),
data_type: DataType::BinaryView,
}),
"'blah'",
)];
for (value, expected) in tests {
let dialect = CustomDialectBuilder::new().build();
Expand Down