-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fixes to ORDER BY name resolution and null ordering bug #418
Conversation
…ref lower to also lower on from vars
a9e9e5b
to
d0fd94e
Compare
Conformance comparison report
Number passing in both: 5607 Number failing in both: 694 Number passing in Base (2cbc7a4) but now fail: 0 Number failing in Base (2cbc7a4) but now pass: 42 The following test(s) were previously failing but now pass. Before merging, confirm they are intended to pass: Click here to see
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #418 +/- ##
==========================================
+ Coverage 81.82% 82.05% +0.23%
==========================================
Files 62 62
Lines 15548 15706 +158
Branches 15548 15706 +158
==========================================
+ Hits 12722 12888 +166
+ Misses 2307 2299 -8
Partials 519 519
☔ View full report in Codecov by Sentry. |
Co-authored-by: Josh Pschorr <josh@pschorr.dev>
let wrap = NullSortedValue::<false, Value>; | ||
let (l, r) = (wrap(l.as_ref()), wrap(r.as_ref())); | ||
r.cmp(&l) | ||
} | ||
EvalOrderBySortSpec::DescNullsLast => { | ||
let wrap = NullSortedValue::<true, Value>; | ||
let (l, r) = (wrap(l.as_ref()), wrap(r.as_ref())); | ||
r.cmp(&l) |
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.
These are doing the correct ordering with respect to null/missing values.
For DescNullsFirst
, it'll do the full ordering with nulls assigned to be Ordering::Greater
(i.e. the false). Since we do r
compared to l
, the result is flipped, so this will order in descending order with the null/missing values first.
For DescNullsLast
, it'll do the full ordering with nulls assigned to be Ordering::Less
(i.e. the true). And since we do r
compared to l
, the result is flipped. This will order in descending order with the null/missing values last.
I noticed these were not part of the conformance tests, so added some tests in this PR: partiql/partiql-tests#106.
(PR targets
change-var-resolution
branch. Once #416 is merged in, this PR will targetmain
)Fixes some previous bugs to get more ORDER BY tests to pass:
Ord
trait implementation always assumedNULLS FIRST
. So even though the ORDER BY allowed configuringNULLS FIRST
orNULLS LAST
, nested collections would not sort according to the specified sort order. E.g. comparing[null]
with[1]
withNULLS LAST
should returnOrdering::Greater
but instead returnedOrdering::Less
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.