Github user zuyu commented on a diff in the pull request:
https://github.com/apache/incubator-quickstep/pull/300#discussion_r186265132
--- Diff: query_optimizer/ExecutionGenerator.cpp ---
@@ -966,7 +975,9 @@ void ExecutionGenerator::convertHashJoin(const
P::HashJoinPtr &physical_plan) {
const CatalogRelation *probe_relation = probe_relation_info->relation;
// FIXME(quickstep-team): Add support for self-join.
- if (build_relation == probe_relation) {
+ // We check to see if the build_predicate is null as certain queries that
+ // support hash-select fuse will result in the first check being true.
+ if (build_relation == probe_relation && physical_plan->build_predicate()
== nullptr) {
--- End diff --
This change introduces a bug, because the execution engine uses the
relation id to determine the build or the probe side. In the self-join case, it
thus always goes to the if-case (mostly the build side), even we actually
reference the probe side with the same relation id.
We do not need any further action for this, because #347 will introduce the
self-join.
---