Convert and Propagate Join hints#17406
Conversation
| @Override | ||
| protected String getString(RelNode node) | ||
| { | ||
| final List<String> hintsCollect = new ArrayList<>(); |
There was a problem hiding this comment.
note: this could be created as a field in the HintCollector
There was a problem hiding this comment.
Created a method inside HintCollecter to get the hints converted as String
| if (!scan.getHints().isEmpty()) { | ||
| this.hintsCollect.add("TableScan:" + scan.getHints()); | ||
| } |
There was a problem hiding this comment.
note: you could remove all these conditionals; add a collectHints method with kinda the same content; and use relNode.getClass().getSimpleName() to get TableScan and similar names
There was a problem hiding this comment.
This would not give the abstracted class names, Initially I copied this calcite. But i guess for our case we doent need to have all those implementations. removed and modified as mentioned in the other comments
| } | ||
|
|
||
| if (!plannerContext.getJoinAlgorithm().requiresSubquery() | ||
| if (!QueryUtils.getJoinAlgorithm(join, plannerContext).requiresSubquery() |
There was a problem hiding this comment.
note: I feel like both PlannerContext and QueryUtils is a bit unfortunate place for these....
have you considered placing it in JoinAlgorithm?
you should probably also extract a JoinAlgorithm to a local variable
There was a problem hiding this comment.
Will move this out from QueryUtils in next batch of changes where I need to update the method as well.
| if (join.getHints().isEmpty()) { | ||
| return plannerContext.getJoinAlgorithm(); | ||
| } | ||
|
|
||
| return JoinHint.fromString(join.getHints().get(0).hintName).getJoinAlgorithm(); |
There was a problem hiding this comment.
this may work right now but it assumes that there is only one hint and that may only be a JoinHint
| * | ||
| * @return HintStrategyTable instance | ||
| */ | ||
| private static HintStrategyTable createHintStrategies() |
There was a problem hiding this comment.
note: I'm not sure if the HintTools class is needed; you could just have this method alone...its already static
There was a problem hiding this comment.
We might need this as we would also have to add the predicates
| "duration" : __DURATION__ | ||
| "sort" : true | ||
| } ] | ||
| !msqPlan |
There was a problem hiding this comment.
note: its near impossible to read these msq plans....not sure what we could do about that
|
I was looking into this a bit and here is what I've found:
...this is just unfortunate - I think it was unexpected
based on the above and some ideas during debugging I came with some ideas around:
ex: maybe we could start with an even simpler model and only introduce
|
|
This pull request has been marked as stale due to 60 days of inactivity. |
|
This pull request/issue has been closed due to lack of activity. If you think that |
Description
This commit aims to propagate sql join hints to pick the specific join algorithm
Release note
Key changed/added classes in this PR
CalcitePlannerDataSourcePlanJoinDataSourceThis PR has: