Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public static RequestedOrdering ofPrimitiveParts(@Nonnull final List<RequestedOr
Debugger.sanityCheck(() -> Verify.verify(
requestedOrderingParts.stream()
.allMatch(requestedOrderingPart -> requestedOrderingPart.getValue()
.getResultType().isPrimitive())));
.getResultType().isPrimitive() || requestedOrderingPart.getValue().getResultType().isUuid())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I do not agree with this fix. The check makes sure that you never order by something that is not primitive. Isn't a UUID a structure? What happens if I want to order by a UUID column? That should be broken up just like other records should be broken up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #3198 we already added support for UUID as a primitive type in SQL. There is special handling of massaging TupleFieldsProto.UUID messages in the planning and execution codepath (that's what the majority of that PR was about).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that the requestedOrderingPart.getResultType().isPrimitive() doesn't return true if the type is a UUID?

return new RequestedOrdering(requestedOrderingParts, distinctness, isExhaustive);
}

Expand Down
10 changes: 10 additions & 0 deletions yaml-tests/src/test/resources/uuid.yamsql
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,16 @@ test_block:
test_block:
name: uuid-in-index-definition
tests:
-
- query: select b, c from tc order by b
- debugger: insane
- explain: "COVERING(TC1 <,> -> [A: KEY[2], B: KEY[0], C: VALUE[0]]) | MAP (_.B AS B, _.C AS C)"
- result: [{!uuid '0920df1c-be81-4ec1-8a06-2180226f051d', 6},
{!uuid '5394a912-aa8e-40fc-a4bb-ddf3f89ac45b', 3},
{!uuid '64120112-4e39-40c3-94b9-2cc88a52e8df', 5},
{!uuid '99e8e8b1-ac34-4f4d-9f01-1f4a7debf4d6', 1},
{!uuid 'a8708750-d70f-4800-8c3b-13700d5b369f', 2},
{!uuid 'c35ba01f-f8fc-47d7-bb00-f077e8a75682', 4}]
-
- query: select b, c from tc order by b
- explain: "COVERING(TC1 <,> -> [A: KEY[2], B: KEY[0], C: VALUE[0]]) | MAP (_.B AS B, _.C AS C)"
Expand Down
Loading