morningman commented on a change in pull request #3034: implements intersect node URL: https://github.com/apache/incubator-doris/pull/3034#discussion_r387659036
########## File path: be/src/exec/intersect_node.h ########## @@ -38,61 +44,36 @@ class IntersectNode : public ExecNode { virtual Status init(const TPlanNode& tnode, RuntimeState* state = nullptr); virtual Status prepare(RuntimeState* state); - virtual void codegen(RuntimeState* state); virtual Status open(RuntimeState* state); virtual Status get_next(RuntimeState* state, RowBatch* row_batch, bool* eos); // virtual Status reset(RuntimeState* state); virtual Status close(RuntimeState* state); private: - /// Tuple id resolved in Prepare() to set tuple_desc_; - const int _tuple_id; - - /// Descriptor for tuples this union node constructs. - const TupleDescriptor* _tuple_desc; - - /// Index of the first non-passthrough child; i.e. a child that needs materialization. - /// 0 when all children are materialized, '_children.size()' when no children are - /// materialized. - const int _first_materialized_child_idx; - - /// Const exprs materialized by this node. These exprs don't refer to any children. - /// Only materialized by the first fragment instance to avoid duplication. + // Const exprs materialized by this node. These exprs don't refer to any children. + // Only materialized by the first fragment instance to avoid duplication. std::vector<std::vector<ExprContext*>> _const_expr_lists; - /// Exprs materialized by this node. The i-th result expr list refers to the i-th child. + // Exprs materialized by this node. The i-th result expr list refers to the i-th child. std::vector<std::vector<ExprContext*>> _child_expr_lists; - ///////////////////////////////////////// - /// BEGIN: Members that must be Reset() - - /// Index of current child. - int _child_idx; - - /// Current row batch of current child. We reset the pointer to a new RowBatch - /// when switching to a different child. - std::unique_ptr<RowBatch> _child_batch; - - /// Index of current row in child_row_batch_. - int _child_row_idx; - - typedef void (*IntersectMaterializeBatchFn)(IntersectNode*, RowBatch*, uint8_t**); - /// Vector of pointers to codegen'ed materialize_batch functions. The vector contains one - /// function for each child. The size of the vector should be equal to the number of - /// children. If a child is passthrough, there should be a NULL for that child. If - /// Codegen is disabled, there should be a NULL for every child. - std::vector<IntersectMaterializeBatchFn> _codegend_except_materialize_batch_fns; + boost::scoped_ptr<HashTable> _hash_tbl; + HashTable::Iterator _hash_tbl_iterator; + boost::scoped_ptr<RowBatch> _probe_batch; - /// Saved from the last to GetNext() on the current child. - bool _child_eos; + boost::scoped_ptr<MemPool> _build_pool; // holds everything referenced in _hash_tbl - /// Index of current const result expr list. - int _const_expr_list_idx; + // _build_tuple_idx[i] is the tuple index of child(1)'s tuple[i] in the output row + std::vector<int> _build_tuple_idx; + int _build_tuple_size; + int _build_tuple_row_size; + std::vector<bool> _find_nulls; - /// Index of the child that needs to be closed on the next GetNext() call. Should be set - /// to -1 if no child needs to be closed. - int _to_close_child_idx; + // for right outer joins, keep track of what's been joined + typedef boost::unordered_set<TupleRow*> TempTupleRowSet; + TempTupleRowSet _temp_rows; Review comment: Not used? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org