-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support to unparse ScalarValue::TimestampNanosecond
to String
#10984
Support to unparse ScalarValue::TimestampNanosecond
to String
#10984
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @goldmedal -- this is a nice contribution
datafusion/sql/src/unparser/expr.rs
Outdated
Ok(ast::Expr::Cast { | ||
kind: ast::CastKind::Cast, | ||
expr: Box::new(ast::Expr::Value(ast::Value::SingleQuotedString( | ||
result.to_string(), | ||
))), | ||
data_type: ast::DataType::Timestamp(None, TimezoneInfo::None), | ||
format: None, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code is repeated in both branches -- we could probably avoid the replication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @alamb, for reminding me of this point. I forgot to refactor this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Thanks @alamb |
…he#10984) * support unparse TimestampNanosecond * cargo fmt * extract the duplicate code
Which issue does this PR close?
Closes #10796 .
Rationale for this change
What changes are included in this PR?
Instead of
array_value_to_string
, I just follow how to convertdatetime
type because I found the timestamp string converted by the arrow formatter would bebut I think the result generated by
datetime::to_string
is more suitable for SQLAre these changes tested?
Yes
Are there any user-facing changes?