-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CALCITE-6389] RexBuilder.removeCastFromLiteral does not preserve semantics for some… #3779
Conversation
…antics for some types of literal Signed-off-by: Mihai Budiu <[email protected]>
Quality Gate passedIssues Measures |
return true; | ||
} | ||
value = value.stripTrailingZeros(); | ||
if (value.scale() < 0) { |
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.
it would be great also to have a test with negative scale
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.
Frankly negative scales are something I don't understand well.
Many SQL dialects do not accept negative scales, but Calcite allegedly does, although there aren't many tests about that.
Maybe we can file a separate issue about testing negative scales in Calcite, I expect it may uncover quite a few bugs.
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 also think that whether negative scales are accepted or not should be a property of the type system.
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 haven't checked it however if you think that it is large area to work with, then separate issue could be probably also ok
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.
Yes, I think that many places in Calcite assume implicitly that decimal scales cannot be negative.
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.
what do we do about this PR in particular?
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.
as you mentioned if there is a separate issue for negative scale is required, could you please file one in Calcite jira?
All the rest is ok to me, thanks
… types of literal
There are at least two other issues that I attempted to fix which uncover this bug, so I decided to make a separate PR for fixing it. This should make the other PRs simpler and less controversial.