Make map and array functions use IS DISTINCT semantics as appropriate#9841
Conversation
efb047a to
8d227cc
Compare
|
I've split the refactor commits into #9901; only the last four commits here are part of this PR. (The failing test is related to that PR, not this one.) |
thanks |
|
I'm not actually sure we should make this change for some of the Map functions (unless we also define Maps as using distinctness instead of equality for key lookups, which I don't think is an especially good idea). Alternatively, we could make the map functions check for not-equal-but-not-distinct values and fail on them, which I think might be better (though it would make the functions a bit slower to maintain a second (Right now, the only not-equal-but-not-distinct value I know of is NaN, and floating-point types shouldn't really be used as map keys anyway because they don't do equality comparison well.) |
9a3407b to
09b2683
Compare
09b2683 to
cc1722b
Compare
cc1722b to
4c61099
Compare
|
rebased after #9905 merged. |
|
This looks directionally correct and nicely simple :) |
4c61099 to
87014bf
Compare
|
Rebased and added a test for There still is no test for |
double to long ( input 1.1 and 1.2) or vice versa (input: certain consecutive values over 2^53) |
|
Casting to duplicate keys is already tested, so I guess I don't need to add a new test for that here. |
87014bf to
4da89e5
Compare
|
Rebased onto master. |
|
@martint Look good to you? |
4da89e5 to
d234d77
Compare
d234d77 to
16b1c21
Compare
|
@jirassimok I had an offline discussion with @dain and he said that while he thought it looked directionally correct he wouldn't have time to complete a full review. @findepi or @losipiuk could either of you provide a review to close this issue? CC: @martint |
core/trino-main/src/test/java/io/trino/operator/scalar/TestArrayExceptFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/scalar/ArrayUnionFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/type/TestArrayOperators.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/operator/aggregation/TestMultimapAggAggregation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
You can somewhat test it with:
select cast(map(array['NaN', 'NaN '], array[1, 2]) as map<double, bigint>);
It will fail now. It used to not.
|
Code looks good for me. I would love to learn more about motivation. It is not obvious to me what semantics should be actually, hence why is this a fix for "correctness" issue. @findepi please comment. |
that's an old conversion... this is @dain 's comment prestodb/presto#11979 (comment) |
7806271 to
c4b5c06
Compare
|
Rebased onto master. |
|
please do rebase |
c4b5c06 to
d805c3e
Compare
d805c3e to
73eb50b
Compare
|
Yeah I think. @jirassimok can you update PR description to use tample (specifically putting release notes entry there) :) |
|
Added release note to PR description. |
73eb50b to
8ae6fe0
Compare
|
rebased |
This addresses #560.
Release note: