MCPcopy Create free account
hub / github.com/apache/impala / Prepare

Method Prepare

be/src/exec/blocking-join-node.cc:74–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74Status BlockingJoinNode::Prepare(RuntimeState* state) {
75 DCHECK_EQ(UseSeparateBuild(state->query_options()) ? 1 : 2, children_.size());
76 SCOPED_TIMER(runtime_profile_->total_time_counter());
77 RETURN_IF_ERROR(ExecNode::Prepare(state));
78
79 probe_timer_ = ADD_TIMER(runtime_profile(), "ProbeTime");
80 probe_row_counter_ = ADD_COUNTER(runtime_profile(), "ProbeRows", TUnit::UNIT);
81
82 // The right child (if present) must match the build row layout.
83 DCHECK(children_.size() == 1 || build_row_desc().Equals(*children_[1]->row_desc()))
84 << build_row_desc().DebugString() << " " << children_[1]->row_desc()->DebugString();
85 // Validate the row desc layout is what we expect because the current join
86 // implementation relies on it to enable some optimizations.
87 int num_probe_tuples = probe_row_desc().tuple_descriptors().size();
88 int num_build_tuples = build_row_desc().tuple_descriptors().size();
89
90#ifndef NDEBUG
91 switch (join_op_) {
92 case TJoinOp::LEFT_ANTI_JOIN:
93 case TJoinOp::LEFT_SEMI_JOIN:
94 case TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN:
95 case TJoinOp::ICEBERG_DELETE_JOIN: {
96 // Only return the surviving probe-side tuples.
97 DCHECK(row_desc()->Equals(probe_row_desc()));
98 break;
99 }
100 case TJoinOp::RIGHT_ANTI_JOIN:
101 case TJoinOp::RIGHT_SEMI_JOIN: {
102 // Only return the surviving build-side tuples.
103 DCHECK(row_desc()->Equals(build_row_desc()));
104 break;
105 }
106 default: {
107 // The join node returns a row that is a concatenation of the left side and build
108 // side row desc's. For example if the probe row had 1 tuple and the build row had
109 // 2, the resulting row desc of the join node would have 3 tuples with:
110 // result[0] = left[0]
111 // result[1] = build[0]
112 // result[2] = build[1]
113 for (int i = 0; i < num_probe_tuples; ++i) {
114 TupleDescriptor* desc = probe_row_desc().tuple_descriptors()[i];
115 DCHECK_EQ(i, row_desc()->GetTupleIdx(desc->id()));
116 }
117 for (int i = 0; i < num_build_tuples; ++i) {
118 TupleDescriptor* desc = build_row_desc().tuple_descriptors()[i];
119 DCHECK_EQ(num_probe_tuples + i, row_desc()->GetTupleIdx(desc->id()))
120 << row_desc()->DebugString() << "\n" << probe_row_desc().DebugString() << "\n"
121 << build_row_desc().DebugString();
122 }
123 break;
124 }
125 }
126#endif
127
128 probe_tuple_row_size_ = num_probe_tuples * sizeof(Tuple*);
129 build_tuple_row_size_ = num_build_tuples * sizeof(Tuple*);
130
131 if (IsSemiJoin(join_op_)) {

Callers

nothing calls this directly

Calls 11

IsSemiJoinFunction · 0.85
OKFunction · 0.85
total_time_counterMethod · 0.80
batch_sizeMethod · 0.80
resetMethod · 0.65
sizeMethod · 0.45
EqualsMethod · 0.45
row_descMethod · 0.45
DebugStringMethod · 0.45
GetTupleIdxMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected