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

Method GetIsNull

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

Source from the content-addressed store, hash-verified

230}
231
232llvm::Value* CodegenAnyVal::GetIsNull(const char* name) const {
233 switch (type_.type) {
234 case TYPE_BIGINT:
235 case TYPE_DOUBLE: {
236 // Lowered type is of form { i8, * }. Get the i8 value.
237 // On aarch64, Lowered type is of form { i64, * }
238 llvm::Value* is_null = builder_->CreateExtractValue(value_, 0);
239#ifndef __aarch64__
240 DCHECK(is_null->getType() == codegen_->i8_type());
241#else
242 DCHECK(is_null->getType() == codegen_->i64_type());
243#endif
244 return builder_->CreateTrunc(is_null, codegen_->bool_type(), name);
245 }
246 case TYPE_DECIMAL: {
247 // Lowered type is of the form { {i8}, ... }
248 uint32_t idxs[] = {0, 0};
249 llvm::Value* is_null_i8 = builder_->CreateExtractValue(value_, idxs);
250 DCHECK(is_null_i8->getType() == codegen_->i8_type());
251 return builder_->CreateTrunc(is_null_i8, codegen_->bool_type(), name);
252 }
253 case TYPE_STRING:
254 case TYPE_VARCHAR:
255 case TYPE_CHAR:
256 case TYPE_FIXED_UDA_INTERMEDIATE:
257 case TYPE_TIMESTAMP:
258 case TYPE_ARRAY:
259 case TYPE_MAP:
260 case TYPE_STRUCT: {
261 // Lowered type is of form { i64, *}. Get the first byte of the i64 value.
262 llvm::Value* v = builder_->CreateExtractValue(value_, 0);
263 DCHECK(v->getType() == codegen_->i64_type());
264 return builder_->CreateTrunc(v, codegen_->bool_type(), name);
265 }
266 case TYPE_BOOLEAN:
267 case TYPE_TINYINT:
268 case TYPE_SMALLINT:
269 case TYPE_INT:
270 case TYPE_DATE:
271 case TYPE_FLOAT:
272 // Lowered type is an integer. Get the first byte.
273 return builder_->CreateTrunc(value_, codegen_->bool_type(), name);
274 default:
275 DCHECK(false);
276 return NULL;
277 }
278}
279
280void CodegenAnyVal::SetIsNull(llvm::Value* is_null) {
281 switch(type_.type) {

Callers 8

CodegenComputeFnMethod · 0.80
CodegenEqualsMethod · 0.80
CodegenUpdateSlotMethod · 0.80
CodegenEvalConjunctsMethod · 0.80
CodegenLexicalCompareMethod · 0.80

Calls 4

i8_typeMethod · 0.80
i64_typeMethod · 0.80
bool_typeMethod · 0.80
getTypeMethod · 0.65

Tested by

no test coverage detected