-
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
Keep the float information in scalar_to_sql #12609
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.
Thanks @Sevenannn! I think this PR is fine to merge as is. I do have a comment about how we can keep the generated SQL a bit nicer to read for humans, while still solving the issue this PR wants to solve.
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.
This is great, thanks!
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 @Sevenannn it looks good to me 👍
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 @Sevenannn and @phillipleblanc and @goldmedal for the reivews
* Keep the float information in scalar_to_sql * Format float value instead of using string, and update test case
Which issue does this PR close?
No correlated issue
Rationale for this change
The unparser omits the float scalar value information, causing incorrect sql from unparser.
When sending a query like
to Datafusion, the query plan related to the scalar value is
However, the unparser omits the
Float64()
information, causing wrong query from unparserThis will cause incorrect data in some engine, for example, in postgres
3 / 2
is1
and3.0/2.0
is1.5
What changes are included in this PR?
.0
for float values without decimal digitsAre these changes tested?
Yes
Are there any user-facing changes?
User will receive float scalar value that correctly preserves the float information.