Skip to content

Conversation

@jha-gunjan
Copy link

@jha-gunjan jha-gunjan commented Feb 12, 2019

Fixes #11444 . Cherry pick of TupleDomain.java from trinodb/trino#226

Query PlanPrinter uses TupleDomain, which was giving unpredictable
order of tuples due to the use of HashMap/HashSet.
Switched to LinkedHashMap/LinkedHashSet to get predictable ordering.

@jha-gunjan jha-gunjan force-pushed the QueryPlanChange branch 2 times, most recently from 1f588e8 to fcb5c96 Compare February 13, 2019 19:56
@mbasmanova mbasmanova self-assigned this Feb 13, 2019
@jha-gunjan jha-gunjan force-pushed the QueryPlanChange branch 2 times, most recently from 42126ca to b179925 Compare February 14, 2019 00:11
Copy link
Contributor

Choose a reason for hiding this comment

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

@jha-gunjan Hmm.... SPI cannot have a dependency on guava. I guess, that means that we can't use ImmutableMap in TuppleDomain. Let's find another way.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sopel39 @findepi Karol, Piotr, would you have a suggestion on how to make TuppleDomain produce predictable order of columns?

Copy link
Contributor

Choose a reason for hiding this comment

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

@mbasmanova @jha-gunjan Maria, Gunjan, this is already fixed in upstream -- https://github.com/prestosql/presto
🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

You can make something similar to trinodb/trino#226 (or simply cherry pick that).

@mbasmanova mbasmanova changed the title Changes for predictable Map iteration order using LinkedHashmap. Improve explain by predictably ordering predicates Feb 15, 2019
@mbasmanova mbasmanova requested a review from arhimondr February 15, 2019 21:52
Copy link
Member

@arhimondr arhimondr left a comment

Choose a reason for hiding this comment

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

Why don't just use the ImmutableSet and ImmutableMap from Guava? These classes preserve the order.

Additionally it would be nice to have a unit test.

@jha-gunjan jha-gunjan force-pushed the QueryPlanChange branch 2 times, most recently from 012e7e2 to 0bd410b Compare February 21, 2019 06:52
@jha-gunjan
Copy link
Author

Why don't just use the ImmutableSet and ImmutableMap from Guava? These classes preserve the order.

Additionally it would be nice to have a unit test.

Guava not imported in presto-spi.
Unit test cherry picked.

@jha-gunjan jha-gunjan closed this Feb 21, 2019
@jha-gunjan jha-gunjan reopened this Feb 21, 2019
@findepi
Copy link
Contributor

findepi commented Feb 21, 2019

Cherry pick of TupleDomain.java from prestosql/presto#226

@jha-gunjan when you're cherry picking a commit, it would be nice to retain authorship information.

@jha-gunjan
Copy link
Author

jha-gunjan commented Feb 21, 2019

Cherry pick of TupleDomain.java from prestosql/presto#226

@jha-gunjan when you're cherry picking a commit, it would be nice to retain authorship information.

Thanks - I prefer that too - however, due to diverging branches and potential conflicts/renames - I manually cherry-picked this time. Added authorship info manually.

Copy link
Member

@arhimondr arhimondr left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for doing this.

Few additional comments.

Also:

If you decided to address these comments, feel free to address them in a separate commit with your own authorship.

Fixes prestodb#11444 Improve plan stability
Uses Linked HashMap/HashSet to add ordering of keys.
@arhimondr arhimondr merged commit 5948ebd into prestodb:master Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants