Conversation
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public enum JoinHint |
There was a problem hiding this comment.
I think it would be better to not have this as an enum - and you could probably use as(JoinAlgorithm.class) or asJoinAlgorithm() to obtain the current value
There was a problem hiding this comment.
There's an issue with that, Calcite only seems to accept certain keywords as hints, and this is sort_merge. Trying to replace the hint name with sortMerge seems to make it not read by calcite.
There was a problem hiding this comment.
doesn't really mattter - I was just thinking something like:
public abstract class DruidHint {
abstract T as(Class<T> clazz);
public static DruidHint fromRelHint(RelHint rh) {
// factory method
}
static abstrat class DruidJoinHint extends DruidHint {}
static class SortMerge extends DruidJoinHint {
String name() { "sort_merge"; }
as() ... { return
}
}
There was a problem hiding this comment.
Made some changes to make it more in line with this, please take a look
| @JsonCreator | ||
| public static JoinHint fromString(final String id) | ||
| { |
There was a problem hiding this comment.
I don't think this should be serializable by jackson; if it gets on the wire it should be a JoinAlgorithm already
There was a problem hiding this comment.
I think it might have been to deserializer it for the planner context at some point
There was a problem hiding this comment.
I don't think this JoinHint should be serialized
if its not in use I think it would be better to remove it
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public enum JoinHint |
There was a problem hiding this comment.
doesn't really mattter - I was just thinking something like:
public abstract class DruidHint {
abstract T as(Class<T> clazz);
public static DruidHint fromRelHint(RelHint rh) {
// factory method
}
static abstrat class DruidJoinHint extends DruidHint {}
static class SortMerge extends DruidJoinHint {
String name() { "sort_merge"; }
as() ... { return
}
}
| @JsonCreator | ||
| public static JoinHint fromString(final String id) | ||
| { |
There was a problem hiding this comment.
I don't think this JoinHint should be serialized
if its not in use I think it would be better to remove it
| private static HintStrategyTable createHintStrategies() | ||
| { | ||
| return HintStrategyTable.builder() | ||
| .hintStrategy(JoinHint.BROADCAST.name(), HintPredicates.JOIN) |
There was a problem hiding this comment.
is the usage of name() intended here?
because I think that will return BROADCAST the "name" of the enum key and not the id!
There was a problem hiding this comment.
note: this method returning HintStrategyTable could live inside DruidHint if that's created
There was a problem hiding this comment.
Moved to DruidHint
|
|
||
| public static JoinAlgorithm getJoinAlgorithm(Join join, PlannerContext plannerContext) | ||
| { | ||
| RelHint closestHint = null; |
There was a problem hiding this comment.
note: I was thinking to use DruidJoinHint here.. so that you can't even set closesHint to a non-join hint...but its not really important
There was a problem hiding this comment.
Keeping the RelHint allows keeping track the closestHint's path length, to compare in the for loop. We do have a check to see if it's a join hint in the loop so this should be fine
Rebased and addressed some issues of #17406
Currently, using the query context, all joins in a query can be hinted to either broadcast or sort merge join. However, this does not allow this to be set at a join level.
Add support for hints to queries, which can dictate the join type.
Syntax
Note
Calcite does not expose if the hint is at a particular join level, and allows inheritance of hints from parent nodes. This causes join hints to to affect inner queries. Additional join hints can be added to inner queries as a workaround.
Release notes
This PR has: