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

Method GetIntValInterpreted

be/src/exprs/kudu-partition-expr.cc:89–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89IntVal KuduPartitionExpr::GetIntValInterpreted(
90 ScalarExprEvaluator* eval, const TupleRow* row) const {
91 FunctionContext* fn_ctx = eval->fn_context(fn_ctx_idx_);
92 KuduPartitionExprCtx* ctx = reinterpret_cast<KuduPartitionExprCtx*>(
93 fn_ctx->GetFunctionState(FunctionContext::THREAD_LOCAL));
94 DCHECK(ctx != nullptr);
95 kudu::KuduPartialRow* kudu_row = ctx->row.get();
96 for (int i = 0; i < children_.size(); ++i) {
97 void* val = eval->GetValue(*GetChild(i), row);
98 if (val == NULL) {
99 // We don't currently support nullable partition columns, but pass it along and let
100 // the KuduTableSink generate the error message.
101 return IntVal(-1);
102 }
103 int col = tkudu_partition_expr_.referenced_columns[i];
104 const ColumnDescriptor& col_desc = table_desc_->col_descs()[col];
105 const ColumnType& type = col_desc.type();
106 DCHECK_EQ(GetChild(i)->type().type, type.type);
107 Status s = WriteKuduValue(col, type, val, false, kudu_row);
108 // This can only fail if we set a col to an incorect type, which would be a bug in
109 // planning, so we can DCHECK.
110 DCHECK(s.ok()) << "WriteKuduValue failed for col = " << col_desc.name()
111 << " and type = " << col_desc.type() << ": " << s.GetDetail();
112 }
113
114 int32_t kudu_partition = -1;
115 kudu::Status s = ctx->partitioner->PartitionRow(*kudu_row, &kudu_partition);
116 // This can only fail if we fail to supply some of the partition cols, which would be a
117 // bug in planning, so we can DCHECK.
118 DCHECK(s.ok()) << "KuduPartitioner::PartitionRow failed on row = '"
119 << kudu_row->ToString() << "': " << s.ToString();
120 return IntVal(kudu_partition);
121}
122
123/// Codegens code that retrieves the KuduPartialRow and KuduPartitioner pointers stored in
124/// the function context. Sets *kudu_row_ptr' and '*kudu_partitioner_ptr' to point to the

Callers

nothing calls this directly

Calls 12

IntValClass · 0.85
WriteKuduValueFunction · 0.85
fn_contextMethod · 0.80
GetFunctionStateMethod · 0.80
GetDetailMethod · 0.80
getMethod · 0.65
sizeMethod · 0.45
GetValueMethod · 0.45
typeMethod · 0.45
okMethod · 0.45
nameMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected