Refactoring the filtering conditions in the current ExecNode from an expression tree to an array can simplify the process of adding runtime filters. It eliminates the need for complex merge operations and removes the requirement for the frontend to combine expressions into a single entity. By representing the filtering conditions as an array, each condition can be treated individually, making it easier to add runtime filters without the need for complex merging logic. The array can store the individual conditions, and the runtime filter logic can iterate through the array to apply the filters as needed. This refactoring simplifies the codebase, improves readability, and reduces the complexity associated with handling filtering conditions and adding runtime filters. It separates the conditions into discrete entities, enabling more straightforward manipulation and management within the execution node.
88 lines
2.9 KiB
C++
88 lines
2.9 KiB
C++
// 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 <stdint.h>
|
|
|
|
#include <iosfwd>
|
|
#include <memory>
|
|
#include <set>
|
|
#include <vector>
|
|
|
|
#include "common/global_types.h"
|
|
#include "exec/exec_node.h"
|
|
#include "vec/core/block.h"
|
|
#include "vec/exprs/vexpr_fwd.h"
|
|
|
|
namespace doris {
|
|
|
|
class ObjectPool;
|
|
class TPlanNode;
|
|
class DescriptorTbl;
|
|
class RuntimeState;
|
|
class Status;
|
|
class SlotDescriptor;
|
|
class TupleDescriptor;
|
|
|
|
namespace vectorized {
|
|
|
|
class VRepeatNode : public ExecNode {
|
|
public:
|
|
VRepeatNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl& descs);
|
|
~VRepeatNode() override = default;
|
|
|
|
Status init(const TPlanNode& tnode, RuntimeState* state = nullptr) override;
|
|
Status prepare(RuntimeState* state) override;
|
|
Status alloc_resource(RuntimeState* state) override;
|
|
Status open(RuntimeState* state) override;
|
|
void release_resource(RuntimeState* state) override;
|
|
Status get_next(RuntimeState* state, Block* block, bool* eos) override;
|
|
Status close(RuntimeState* state) override;
|
|
|
|
Status pull(RuntimeState* state, vectorized::Block* output_block, bool* eos) override;
|
|
Status push(RuntimeState* state, vectorized::Block* input_block, bool eos) override;
|
|
bool need_more_input_data() const;
|
|
Block* get_child_block() { return &_child_block; }
|
|
|
|
void debug_string(int indentation_level, std::stringstream* out) const override;
|
|
|
|
private:
|
|
Status get_repeated_block(Block* child_block, int repeat_id_idx, Block* output_block);
|
|
|
|
// Slot id set used to indicate those slots need to set to null.
|
|
std::vector<std::set<SlotId>> _slot_id_set_list;
|
|
// all slot id
|
|
std::set<SlotId> _all_slot_ids;
|
|
// An integer bitmap list, it indicates the bit position of the exprs not null.
|
|
std::vector<int64_t> _repeat_id_list;
|
|
std::vector<std::vector<int64_t>> _grouping_list;
|
|
TupleId _output_tuple_id;
|
|
const TupleDescriptor* _output_tuple_desc;
|
|
|
|
Block _child_block;
|
|
std::unique_ptr<Block> _intermediate_block {};
|
|
|
|
std::vector<SlotDescriptor*> _output_slots;
|
|
|
|
VExprContextSPtrs _expr_ctxs;
|
|
bool _child_eos;
|
|
int _repeat_id_idx;
|
|
};
|
|
} // namespace vectorized
|
|
} // namespace doris
|