Keep the float information in scalar_to_sql#12609
Merged
alamb merged 2 commits intoapache:mainfrom Sep 25, 2024
Merged
Conversation
Contributor
phillipleblanc
left a comment
There was a problem hiding this comment.
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.
phillipleblanc
approved these changes
Sep 25, 2024
Contributor
phillipleblanc
left a comment
There was a problem hiding this comment.
This is great, thanks!
goldmedal
approved these changes
Sep 25, 2024
Contributor
goldmedal
left a comment
There was a problem hiding this comment.
Thanks @Sevenannn it looks good to me 👍
alamb
approved these changes
Sep 25, 2024
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you @Sevenannn and @phillipleblanc and @goldmedal for the reivews
This was referenced Sep 25, 2024
bgjackma
pushed a commit
to bgjackma/datafusion
that referenced
this pull request
Sep 25, 2024
* Keep the float information in scalar_to_sql * Format float value instead of using string, and update test case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 / 2is1and3.0/2.0is1.5What changes are included in this PR?
.0for 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.