-
Notifications
You must be signed in to change notification settings - Fork 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
Add value traversal methods to Type #12797
Conversation
Relates to #3316 |
@martint @losipiuk @sopel39 @rzeyde-varada @raunaqmorarka If we don't want to add this to |
core/trino-spi/src/main/java/io/trino/spi/type/AbstractIntType.java
Outdated
Show resolved
Hide resolved
I like the interface. The other option to model that would be a new operator. But then it would be hard to consume that in the Iceberg connector - which is the sole use for now. |
thanks @losipiuk @martint @sopel39 @rzeyde-varada @raunaqmorarka thoughts? |
The new API lgtm, we should be able to use it in #3316 to find adjacent value and then use existing methods for equality check with adjacent value for implementing |
@martint thoughts? |
apparently not useful, hence maybe no thoughts. |
Needed for #14452 |
3de0faf
to
eade8ec
Compare
eade8ec
to
37956ed
Compare
37956ed
to
3175ae7
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.
I liked it before. Stil like it.
3175ae7
to
cfdd3cd
Compare
(just rebased on current state of #14747) |
/** | ||
* Returns the maximum value that compares less than {@code value}. | ||
* <p> | ||
* The type of the value must match {@link #getJavaType}. |
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 can't match getJavaType. For types such as smallint, integer, bigint, getJavaType returns long.class
. This method takes an Object, so it doesn't support primitive values (they would need to be boxed).
In general, I'm not sure I like how this method tries to be generic for all types but:
- It's only supported for orderable types
- The signature is not tight enough to represent all carrier types safely.
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 can't match getJavaType. For types such as smallint, integer, bigint, getJavaType returns
long.class
. This method takes an Object, so it doesn't support primitive values (they would need to be boxed).
yes, I meant boxing here
btw this is modeled like we did for getRange in e23e317#diff-3eedf5cda66ac7a68eb48f4eee146a4ccf5658fd07436ba5b279a089294a5c0cR174
It's only supported for orderable types
yes, same as getRange
non-orderable types will remove Optional.empty()
since there is no "next" nor "previous"
The signature is not tight enough to represent all carrier types safely.
this part i did not understand.
@martint can you please clarify?
cfdd3cd
to
5f601bc
Compare
5f601bc
to
5bc6b78
Compare
Added value traversal for few more types, so that Iceberg-side of things is fully redundant. |
CI #14441 |
#12795 introduces some awesome value traversal utilities in Iceberg connector.
This PR makes them available to everyone.