-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HIVE-28729: Apply nulls order setting in Reduce Sink operator of join branches #5626
HIVE-28729: Apply nulls order setting in Reduce Sink operator of join branches #5626
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some minor comments but LGTM so it can go in if we get a green run.
One general question is if this "bug" affects somehow the correctness of some queries. Do we get wrong results without this fix?
@@ -56,20 +57,28 @@ | |||
*/ | |||
public class HiveInsertExchange4JoinRule extends RelOptRule { | |||
|
|||
protected static transient final Logger LOG = LoggerFactory | |||
.getLogger(HiveInsertExchange4JoinRule.class); | |||
protected static final Logger LOG = LoggerFactory.getLogger(HiveInsertExchange4JoinRule.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logger does not seem to be used so I guess we can drop it entirely along with the relevant imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
public static HiveInsertExchange4JoinRule exchangeBelowMultiJoin( | ||
RelFieldCollation.NullDirection defaultAscNullDirection) { | ||
return new HiveInsertExchange4JoinRule(HiveMultiJoin.class, defaultAscNullDirection); | ||
} | ||
|
||
|
||
/** Rule that creates Exchange operators under a Join operator. */ | ||
public static final HiveInsertExchange4JoinRule EXCHANGE_BELOW_JOIN = | ||
new HiveInsertExchange4JoinRule(Join.class); | ||
public static HiveInsertExchange4JoinRule exchangeBelowJoin( | ||
RelFieldCollation.NullDirection defaultAscNullDirection) { | ||
return new HiveInsertExchange4JoinRule(Join.class, defaultAscNullDirection); | ||
} | ||
|
||
private final RelFieldCollation.NullDirection defaultAscNullDirection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a big advantage in introducing the static factories. Since the constructor is public we could just keep that one. If we want to make the rule creation shorter then we could have a static factory with a shorter name (e.g., of(clazz,nullDirection)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the factory methods. Using constructor in CalcitePlanner
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveInsertExchange4JoinRule.java
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
What changes were proposed in this pull request?
Use the default null order configured via
hive.default.nulls.last
in the Calcite ruleHiveInsertExchange4JoinRule.java
when creating sort keys. This rule is used only whenhive.cbo.returnpath.hiveop
is enabled.Why are the changes needed?
The setting
hive.default.nulls.last
doesn't have affect to theHiveSortExchange
operators created by this rule and the RS operators built from them.Does this PR introduce any user-facing change?
Explain output of query plans has join operation may change.
Is the change a dependency upgrade?
No.
How was this patch tested?