-
Notifications
You must be signed in to change notification settings - Fork 237
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-1466] Support for UNSIGNED types of TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT in type system #275
base: main
Are you sure you want to change the base?
Conversation
…MINT, INT, BIGINT in type system
2677782
to
629a5ef
Compare
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.
The changes look fine, but it's hard to tell whether all code paths that may be relevant have been handled until we have some end-to-end tests.
Yes, I agree with you, end-to-end testing is very important. Currently, I have tested different unsigned types with |
I am wondering whether it will pay off to actually build a set of classes UnsignedInt, UnsignedShort, etc, which would encapsulate these abstractions in a clean way. I am not sure that this is the right place for them - BTW. But I think you will need them eventually in the runtime of Calcite to properly implement the semantics of unsigned arithmetic. |
I notice that Guava has some of these. |
@mihaibudiu Thank you for your remind, I will try to implement this feature using a class like Guava UnsignedInt. |
Hi @mihaibudiu, I spent some time looking at Guava. Currently, it only provides In addition, I found that MySQL provides another idea, we can handle them by mapping a wider range of Java types. For example, the Through this mapping conversion method, we do not need to add any classes, and the Calcite runtime can handle UNSIGNED types. What do you think of this approach? I will keep trying if you have any suggestions. |
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.
Overall looks good.
core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetThrowsSqlExceptionTest.java
Show resolved
Hide resolved
From my experience, in the long term it pays off to implement the right abstractions. |
Hi @mihaibudiu, thank you for sharing these valuable experiences. These are issues I had not considered before. Since I am still a novice, I will spend some time to understand type checking, expression simplification, etc., and then try to add new UnsignedInt, UnsignedLong and other types. |
For more details, refer jira: https://issues.apache.org/jira/browse/CALCITE-1466