Skip to content

[Backport] SQL: More straightforward handling of join planning.#9659

Merged
fjy merged 1 commit intoapache:0.18.0from
gianm:backport-9648-to-0.18.0
Apr 10, 2020
Merged

[Backport] SQL: More straightforward handling of join planning.#9659
fjy merged 1 commit intoapache:0.18.0from
gianm:backport-9648-to-0.18.0

Conversation

@gianm
Copy link
Copy Markdown
Contributor

@gianm gianm commented Apr 9, 2020

Backport of #9648 to 0.18.0.

* SQL: More straightforward handling of join planning.

Two changes that simplify how joins are planned:

1) Stop using JoinProjectTransposeRule as a way of guiding subquery
removal. Instead, add logic to DruidJoinRule that identifies removable
subqueries and removes them at the point of creating a DruidJoinQueryRel.
This approach reduces the size of the planning space and allows the
planner to complete quickly.

2) Remove rules that reorder joins. Not because of an impact on the
planning time (it seems minimal), but because the decisions that the
planner was making in the new tests were sometimes worse than the
user-provided order. I think we'll need to go with the user-provided
order for now, and revisit reordering when we can add more smarts to
the cost estimator.

A third change updates numeric ExprEval classes to store their
value as a boxed type that corresponds to what it is supposed to be.
This is useful because it affects the behavior of "asString", and
is included in this patch because it is needed for the new test
"testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse". This
test relies on CAST('6', 'DOUBLE') stringifying to "6.0" like an
actual double would.

Fixes apache#9646.

* Fix comments.

* Fix tests.
@fjy fjy merged commit 95a4d2a into apache:0.18.0 Apr 10, 2020
@gianm gianm deleted the backport-9648-to-0.18.0 branch April 10, 2020 19:48
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.

2 participants