| 33 | namespace impala { |
| 34 | |
| 35 | Status UnpivotPlanNode::Init(const TPlanNode& tnode, FragmentState* state) { |
| 36 | DCHECK(tnode.__isset.unpivot_node); |
| 37 | RETURN_IF_ERROR(PlanNode::Init(tnode, state)); |
| 38 | DCHECK(tnode.row_tuples.size() == 1); |
| 39 | tuple_desc_ = state->desc_tbl().GetTupleDescriptor(tnode.row_tuples[0]); |
| 40 | RETURN_IF_ERROR(ScalarExpr::Create(tnode.unpivot_node.source_exprs, |
| 41 | *(children_[0]->row_descriptor_), state, &source_exprs_)); |
| 42 | DCHECK_EQ(tuple_desc_->slots().size(), source_exprs_.size()); |
| 43 | num_unpivot_columns_ = tnode.unpivot_node.num_unpivot_columns; |
| 44 | if (tnode.unpivot_node.__isset.data_slot_id) { |
| 45 | data_slot_id_ = tnode.unpivot_node.data_slot_id; |
| 46 | DCHECK(tnode.unpivot_node.__isset.data_exprs); |
| 47 | RETURN_IF_ERROR(ScalarExpr::Create(tnode.unpivot_node.data_exprs, |
| 48 | *(children_[0]->row_descriptor_), state, &data_exprs_)); |
| 49 | } |
| 50 | if (tnode.unpivot_node.__isset.header_slot_id) { |
| 51 | header_slot_id_ = tnode.unpivot_node.header_slot_id; |
| 52 | DCHECK(tnode.unpivot_node.__isset.header_exprs); |
| 53 | RETURN_IF_ERROR(ScalarExpr::Create(tnode.unpivot_node.header_exprs, |
| 54 | *(children_[0]->row_descriptor_), state, &header_exprs_)); |
| 55 | } |
| 56 | return Status::OK(); |
| 57 | } |
| 58 | |
| 59 | void UnpivotPlanNode::Close() { |
| 60 | for (auto expr : source_exprs_) { |
nothing calls this directly
no test coverage detected