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.
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-6560] Add supportsNegativeScale in RelDataTypeSystem #3945
[CALCITE-6560] Add supportsNegativeScale in RelDataTypeSystem #3945
Changes from all commits
89a8122
e4d6675
2231e75
a323f87
0646f2d
fa0dd90
6de2916
3178e64
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
You should say that the default type system returns 0,
and that there are no 'special values' (like SCALE_NOT_SPECIFIED).
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.
RelDataTypeSystem is an interface It's strange to add a Java document here. So I added it in RelDataTypeSystemImpl. We have a SCALE_NOT_SPECIFIED in RelDataType for the types where the scale is not allowed.
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.
We currently have both
getMaxScale(SqlTypeName)
andgetMaxNumericScale()
. (The latter delegates to the former.)So should we instead be creating
getMinScale(SqlTypeName)
? It would allow a type system to have different min scales for (say) a decimal and a binary floating point.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 have also noticed this, and we already have a method that returns a fixed value in SqlTypeName#getMinScale. I think we can do it.
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 checked the SQL TypeName#getMinScale and it processed the Interval type, which returns -1 for all other types. Do we need to add this method?
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.
@julianhyde
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.
We should be explicit in the javadoc.
getMaxScale(SqlTypeName)
seems to returnRelDataType.SCALE_NOT_SPECIFIED
(Integer.MIN_VALUE) for any data type that does not support scale. Can you amend its javadoc to state this?The javadoc for
getMinScale(SqlTypeName)
should state its behavior for types that do not support scale. I proposeInteger.MAX_VALUE
.The javadoc for
getMinScale(SqlTypeName)
should also say that the default type system returns 0 forDECIMAL
and interval types. I know it's an interface, but interfaces can and should say what the default or typical behavior is.I guess you should change
supportsNegativeScale()
tosupportsNegativeScale(SqlTypeName)
, and removegetMinNumericScale()
.