You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@quickstep.apache.org by zuyu <gi...@git.apache.org> on 2017/01/20 01:10:59 UTC

[GitHub] incubator-quickstep pull request #165: Added Operator support for Partitione...

GitHub user zuyu opened a pull request:

    https://github.com/apache/incubator-quickstep/pull/165

    Added Operator support for Partitioned HashJoin.

    Assigned to @hbdeshmukh or @jianqiao.
    
    This PR allows `HashJoin` to accept partitioned info. By default, there is no partition, and `num_partitions` is `1`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/incubator-quickstep partitioned_join_hash_table

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-quickstep/pull/165.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #165
    
----
commit 8e452194cf5c4e8e33865ada905b7b123ca281a2
Author: Zuyu Zhang <zu...@apache.org>
Date:   2017-01-17T21:18:08Z

    Added Operator support for Partitioned HashJoin.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep pull request #165: Added Operator support for Partitione...

Posted by zuyu <gi...@git.apache.org>.
Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/165#discussion_r97175897
  
    --- Diff: storage/StorageBlockInfo.hpp ---
    @@ -49,6 +50,8 @@ static constexpr int kBlockIdDomainLengthInDigits = std::numeric_limits<block_id
     static constexpr int kBlockIdCounterLengthInDigits = std::numeric_limits<block_id_counter>::digits10;
     static constexpr block_id_domain kMaxDomain = static_cast<block_id_domain>(0xFFFF);
     
    +typedef std::vector<block_id> blocks_in_partition;
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep pull request #165: Added Operator support for Partitione...

Posted by jianqiao <gi...@git.apache.org>.
Github user jianqiao commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/165#discussion_r97169709
  
    --- Diff: relational_operators/HashJoinOperator.cpp ---
    @@ -207,49 +207,43 @@ bool HashJoinOperator::getAllNonOuterJoinWorkOrders(
             query_context->getScalarGroup(selection_index_);
         InsertDestination *output_destination =
             query_context->getInsertDestination(output_destination_index_);
    -    const JoinHashTable &hash_table =
    -        *(query_context->getJoinHashTable(hash_table_index_));
     
         if (probe_relation_is_stored_) {
    -      if (!started_) {
    -        for (const block_id probe_block_id : probe_relation_block_ids_) {
    +      if (started_) {
    +        return true;
    +      }
    +
    +      for (std::size_t part_id = 0; part_id < num_partitions_; ++part_id) {
    +        const JoinHashTable &hash_table =
    +            *(query_context->getJoinHashTable(hash_table_index_, part_id));
    +
    +        for (const block_id probe_block_id : probe_relation_block_ids_[part_id]) {
               container->addNormalWorkOrder(
    -              new JoinWorkOrderClass(query_id_,
    -                                     build_relation_,
    -                                     probe_relation_,
    -                                     join_key_attributes_,
    -                                     any_join_key_attributes_nullable_,
    -                                     probe_block_id,
    -                                     residual_predicate,
    -                                     selection,
    -                                     hash_table,
    -                                     output_destination,
    -                                     storage_manager,
    +              new JoinWorkOrderClass(query_id_, build_relation_, probe_relation_, join_key_attributes_,
    +                                     any_join_key_attributes_nullable_, num_partitions_, part_id, probe_block_id,
    +                                     residual_predicate, selection, hash_table, output_destination, storage_manager,
                                          CreateLIPFilterAdaptiveProberHelper(lip_deployment_index_, query_context)),
                   op_index_);
             }
    -        started_ = true;
           }
    -      return started_;
    +      started_ = true;
    +      return true;
         } else {
    -      while (num_workorders_generated_ < probe_relation_block_ids_.size()) {
    -        container->addNormalWorkOrder(
    -            new JoinWorkOrderClass(
    -                query_id_,
    -                build_relation_,
    -                probe_relation_,
    -                join_key_attributes_,
    -                any_join_key_attributes_nullable_,
    -                probe_relation_block_ids_[num_workorders_generated_],
    -                residual_predicate,
    -                selection,
    -                hash_table,
    -                output_destination,
    -                storage_manager,
    -                CreateLIPFilterAdaptiveProberHelper(lip_deployment_index_, query_context)),
    -            op_index_);
    -        ++num_workorders_generated_;
    -      }  // end while
    +      for (std::size_t part_id = 0; part_id < num_partitions_; ++part_id) {
    --- End diff --
    
    I see. It should be good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep pull request #165: Added Operator support for Partitione...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-quickstep/pull/165


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep pull request #165: Added Operator support for Partitione...

Posted by zuyu <gi...@git.apache.org>.
Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/165#discussion_r97168597
  
    --- Diff: relational_operators/HashJoinOperator.cpp ---
    @@ -207,49 +207,43 @@ bool HashJoinOperator::getAllNonOuterJoinWorkOrders(
             query_context->getScalarGroup(selection_index_);
         InsertDestination *output_destination =
             query_context->getInsertDestination(output_destination_index_);
    -    const JoinHashTable &hash_table =
    -        *(query_context->getJoinHashTable(hash_table_index_));
     
         if (probe_relation_is_stored_) {
    -      if (!started_) {
    -        for (const block_id probe_block_id : probe_relation_block_ids_) {
    +      if (started_) {
    +        return true;
    +      }
    +
    +      for (std::size_t part_id = 0; part_id < num_partitions_; ++part_id) {
    +        const JoinHashTable &hash_table =
    +            *(query_context->getJoinHashTable(hash_table_index_, part_id));
    +
    +        for (const block_id probe_block_id : probe_relation_block_ids_[part_id]) {
               container->addNormalWorkOrder(
    -              new JoinWorkOrderClass(query_id_,
    -                                     build_relation_,
    -                                     probe_relation_,
    -                                     join_key_attributes_,
    -                                     any_join_key_attributes_nullable_,
    -                                     probe_block_id,
    -                                     residual_predicate,
    -                                     selection,
    -                                     hash_table,
    -                                     output_destination,
    -                                     storage_manager,
    +              new JoinWorkOrderClass(query_id_, build_relation_, probe_relation_, join_key_attributes_,
    +                                     any_join_key_attributes_nullable_, num_partitions_, part_id, probe_block_id,
    +                                     residual_predicate, selection, hash_table, output_destination, storage_manager,
                                          CreateLIPFilterAdaptiveProberHelper(lip_deployment_index_, query_context)),
                   op_index_);
             }
    -        started_ = true;
           }
    -      return started_;
    +      started_ = true;
    +      return true;
         } else {
    -      while (num_workorders_generated_ < probe_relation_block_ids_.size()) {
    -        container->addNormalWorkOrder(
    -            new JoinWorkOrderClass(
    -                query_id_,
    -                build_relation_,
    -                probe_relation_,
    -                join_key_attributes_,
    -                any_join_key_attributes_nullable_,
    -                probe_relation_block_ids_[num_workorders_generated_],
    -                residual_predicate,
    -                selection,
    -                hash_table,
    -                output_destination,
    -                storage_manager,
    -                CreateLIPFilterAdaptiveProberHelper(lip_deployment_index_, query_context)),
    -            op_index_);
    -        ++num_workorders_generated_;
    -      }  // end while
    +      for (std::size_t part_id = 0; part_id < num_partitions_; ++part_id) {
    --- End diff --
    
    It depends on the input relation and the optimizer. The former may have given partitions (i.e., 4), and the latter may add an explicit partition phase for a relation w/o partitions.
    
    I do so to minimize the code changes without hurting the performance much.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep pull request #165: Added Operator support for Partitione...

Posted by jianqiao <gi...@git.apache.org>.
Github user jianqiao commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/165#discussion_r97168067
  
    --- Diff: relational_operators/HashJoinOperator.cpp ---
    @@ -207,49 +207,43 @@ bool HashJoinOperator::getAllNonOuterJoinWorkOrders(
             query_context->getScalarGroup(selection_index_);
         InsertDestination *output_destination =
             query_context->getInsertDestination(output_destination_index_);
    -    const JoinHashTable &hash_table =
    -        *(query_context->getJoinHashTable(hash_table_index_));
     
         if (probe_relation_is_stored_) {
    -      if (!started_) {
    -        for (const block_id probe_block_id : probe_relation_block_ids_) {
    +      if (started_) {
    +        return true;
    +      }
    +
    +      for (std::size_t part_id = 0; part_id < num_partitions_; ++part_id) {
    +        const JoinHashTable &hash_table =
    +            *(query_context->getJoinHashTable(hash_table_index_, part_id));
    +
    +        for (const block_id probe_block_id : probe_relation_block_ids_[part_id]) {
               container->addNormalWorkOrder(
    -              new JoinWorkOrderClass(query_id_,
    -                                     build_relation_,
    -                                     probe_relation_,
    -                                     join_key_attributes_,
    -                                     any_join_key_attributes_nullable_,
    -                                     probe_block_id,
    -                                     residual_predicate,
    -                                     selection,
    -                                     hash_table,
    -                                     output_destination,
    -                                     storage_manager,
    +              new JoinWorkOrderClass(query_id_, build_relation_, probe_relation_, join_key_attributes_,
    +                                     any_join_key_attributes_nullable_, num_partitions_, part_id, probe_block_id,
    +                                     residual_predicate, selection, hash_table, output_destination, storage_manager,
                                          CreateLIPFilterAdaptiveProberHelper(lip_deployment_index_, query_context)),
                   op_index_);
             }
    -        started_ = true;
           }
    -      return started_;
    +      started_ = true;
    +      return true;
         } else {
    -      while (num_workorders_generated_ < probe_relation_block_ids_.size()) {
    -        container->addNormalWorkOrder(
    -            new JoinWorkOrderClass(
    -                query_id_,
    -                build_relation_,
    -                probe_relation_,
    -                join_key_attributes_,
    -                any_join_key_attributes_nullable_,
    -                probe_relation_block_ids_[num_workorders_generated_],
    -                residual_predicate,
    -                selection,
    -                hash_table,
    -                output_destination,
    -                storage_manager,
    -                CreateLIPFilterAdaptiveProberHelper(lip_deployment_index_, query_context)),
    -            op_index_);
    -        ++num_workorders_generated_;
    -      }  // end while
    +      for (std::size_t part_id = 0; part_id < num_partitions_; ++part_id) {
    --- End diff --
    
    How many partitions would we expect to have in typical situations?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep issue #165: Added Operator support for Partitioned HashJ...

Posted by jianqiao <gi...@git.apache.org>.
Github user jianqiao commented on the issue:

    https://github.com/apache/incubator-quickstep/pull/165
  
    LGTM. Merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep pull request #165: Added Operator support for Partitione...

Posted by jianqiao <gi...@git.apache.org>.
Github user jianqiao commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/165#discussion_r97165573
  
    --- Diff: storage/StorageBlockInfo.hpp ---
    @@ -49,6 +50,8 @@ static constexpr int kBlockIdDomainLengthInDigits = std::numeric_limits<block_id
     static constexpr int kBlockIdCounterLengthInDigits = std::numeric_limits<block_id_counter>::digits10;
     static constexpr block_id_domain kMaxDomain = static_cast<block_id_domain>(0xFFFF);
     
    +typedef std::vector<block_id> blocks_in_partition;
    --- End diff --
    
    `block_in_partition` is not a primitive type. Perhaps use `BlockInPartition`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---