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

Method SetIsNull

be/src/codegen/codegen-anyval.cc:280–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280void CodegenAnyVal::SetIsNull(llvm::Value* is_null) {
281 switch(type_.type) {
282 case TYPE_BIGINT:
283 case TYPE_DOUBLE: {
284 // Lowered type is of form { i8, * }. Set the i8 value to 'is_null'.
285 // On aarch64, lowered type is of form { i64, * }
286#ifndef __aarch64__
287 llvm::Value* is_null_ext =
288 builder_->CreateZExt(is_null, codegen_->i8_type(), "is_null_ext");
289#else
290 llvm::Value* is_null_ext =
291 builder_->CreateZExt(is_null, codegen_->i64_type(), "is_null_ext");
292#endif
293 value_ = builder_->CreateInsertValue(value_, is_null_ext, 0, name_);
294 break;
295 }
296 case TYPE_DECIMAL: {
297 // Lowered type is of form { {i8}, [15 x i8], {i128} }. Set the i8 value to
298 // 'is_null'.
299 llvm::Value* is_null_ext =
300 builder_->CreateZExt(is_null, codegen_->i8_type(), "is_null_ext");
301 // Index into the {i8} struct as well as the outer struct.
302 uint32_t idxs[] = {0, 0};
303 value_ = builder_->CreateInsertValue(value_, is_null_ext, idxs, name_);
304 break;
305 }
306 case TYPE_STRING:
307 case TYPE_VARCHAR:
308 case TYPE_CHAR:
309 case TYPE_FIXED_UDA_INTERMEDIATE:
310 case TYPE_TIMESTAMP:
311 case TYPE_ARRAY:
312 case TYPE_MAP:
313 case TYPE_STRUCT: {
314 // Lowered type is of the form { i64, * }. Set the first byte of the i64 value to
315 // 'is_null'
316 llvm::Value* v = builder_->CreateExtractValue(value_, 0);
317 v = builder_->CreateAnd(v, -0x100LL, "masked");
318 llvm::Value* is_null_ext =
319 builder_->CreateZExt(is_null, v->getType(), "is_null_ext");
320 v = builder_->CreateOr(v, is_null_ext);
321 value_ = builder_->CreateInsertValue(value_, v, 0, name_);
322 break;
323 }
324 case TYPE_BOOLEAN:
325 case TYPE_TINYINT:
326 case TYPE_SMALLINT:
327 case TYPE_INT:
328 case TYPE_DATE:
329 case TYPE_FLOAT: {
330 // Lowered type is an integer. Set the first byte to 'is_null'.
331 value_ = builder_->CreateAnd(value_, -0x100LL, "masked");
332 llvm::Value* is_null_ext =
333 builder_->CreateZExt(is_null, value_->getType(), "is_null_ext");
334 value_ = builder_->CreateOr(value_, is_null_ext, name_);
335 break;
336 }
337 default:

Callers 3

CodegenComputeFnMethod · 0.80
CodegenUpdateSlotMethod · 0.80

Calls 4

i8_typeMethod · 0.80
i64_typeMethod · 0.80
getTypeMethod · 0.65
DebugStringMethod · 0.45

Tested by

no test coverage detected