save-buffer commented on code in PR #13669: URL: https://github.com/apache/arrow/pull/13669#discussion_r1067441595
########## cpp/src/arrow/compute/exec/spilling_join.h: ########## @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <bitset> + +#include "arrow/compute/exec/accumulation_queue.h" +#include "arrow/compute/exec/hash_join.h" +#include "arrow/compute/exec/query_context.h" + +namespace arrow { +namespace compute { +struct PartitionedBloomFilter { + std::unique_ptr<BlockedBloomFilter> in_memory; + std::unique_ptr<BlockedBloomFilter> + partitions[SpillingAccumulationQueue::kNumPartitions]; + + void Find(int64_t hardware_flags, int64_t num_rows, const uint64_t* hashes, + uint8_t* bv); +}; + +class SpillingHashJoin { + public: + using RegisterTaskGroupCallback = std::function<int( + std::function<Status(size_t, int64_t)>, std::function<Status(size_t)>)>; + using StartTaskGroupCallback = std::function<Status(int, int64_t)>; + using AddProbeSideHashColumn = std::function<Status(size_t, ExecBatch*)>; + using BloomFilterFinishedCallback = std::function<Status(size_t)>; + using ApplyBloomFilterCallback = std::function<Status(size_t, ExecBatch*)>; + using OutputBatchCallback = std::function<void(int64_t, ExecBatch)>; + using FinishedCallback = std::function<Status(int64_t)>; + using StartSpillingCallback = std::function<Status(size_t)>; + using PauseProbeSideCallback = std::function<void(int)>; + using ResumeProbeSideCallback = std::function<void(int)>; + + struct CallbackRecord { Review Comment: Yeah we could, I even started switching to it but the code gets a little more convoluted due to the fact that we reuse a bunch of the functions for the HashJoin callback record that gets used internally (see spilling_join.cc:45). So then we'd have to make another class that pipes the callbacks passed to SpillingJoin back into HashJoinImpl. It would work but in my opinion it's messier. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
