| 101 | } |
| 102 | |
| 103 | Status HdfsTableSink::Prepare(RuntimeState* state, MemTracker* parent_mem_tracker) { |
| 104 | SCOPED_TIMER(profile()->total_time_counter()); |
| 105 | RETURN_IF_ERROR(TableSinkBase::Prepare(state, parent_mem_tracker)); |
| 106 | unique_id_str_ = PrintId(state->fragment_instance_id(), "-"); |
| 107 | |
| 108 | // Resolve table id and set input tuple descriptor. |
| 109 | table_desc_ = static_cast<const HdfsTableDescriptor*>( |
| 110 | state->desc_tbl().GetTableDescriptor(table_id_)); |
| 111 | |
| 112 | if (table_desc_ == nullptr) { |
| 113 | stringstream error_msg; |
| 114 | error_msg << "Failed to get table descriptor for table id: " << table_id_; |
| 115 | return Status(error_msg.str()); |
| 116 | } |
| 117 | |
| 118 | staging_dir_ = Substitute("$0/_impala_insert_staging/$1", table_desc_->hdfs_base_dir(), |
| 119 | PrintId(state->query_id(), "_")); |
| 120 | |
| 121 | // Sanity check. |
| 122 | if (!IsIceberg()) { |
| 123 | DCHECK_LE(partition_key_expr_evals_.size(), table_desc_->num_cols()) |
| 124 | << DebugString(); |
| 125 | DCHECK_EQ(partition_key_expr_evals_.size(), table_desc_->num_clustering_cols()) |
| 126 | << DebugString(); |
| 127 | DCHECK_GE(output_expr_evals_.size(), |
| 128 | table_desc_->num_cols() - table_desc_->num_clustering_cols()) << DebugString(); |
| 129 | } |
| 130 | |
| 131 | return Status::OK(); |
| 132 | } |
| 133 | |
| 134 | void HdfsTableSink::BuildPartitionDescMap() { |
| 135 | for (const HdfsTableDescriptor::PartitionIdToDescriptorMap::value_type& id_to_desc: |
nothing calls this directly
no test coverage detected