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

Method CodegenProcessBuildBatch

be/src/exec/partitioned-hash-join-builder.cc:1391–1469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1389}
1390
1391Status PhjBuilderConfig::CodegenProcessBuildBatch(LlvmCodeGen* codegen,
1392 llvm::Function* hash_fn, llvm::Function* murmur_hash_fn, llvm::Function* eval_row_fn,
1393 llvm::Function* insert_filters_fn) {
1394 llvm::Function* process_build_batch_fn =
1395 codegen->GetFunction(IRFunction::PHJ_PROCESS_BUILD_BATCH, true);
1396 DCHECK(process_build_batch_fn != nullptr);
1397
1398 // Replace call sites
1399 int replaced =
1400 codegen->ReplaceCallSites(process_build_batch_fn, eval_row_fn, "EvalBuildRow");
1401 DCHECK_REPLACE_COUNT(replaced, 1);
1402
1403 replaced = codegen->ReplaceCallSites(
1404 process_build_batch_fn, insert_filters_fn, "InsertRuntimeFilters");
1405 DCHECK_REPLACE_COUNT(replaced, 1);
1406
1407 HashTableCtx::HashTableReplacedConstants replaced_constants;
1408 const bool stores_duplicates = true;
1409 const int num_build_tuples = input_row_desc_->tuple_descriptors().size();
1410 // Replace some hash table parameters with constants.
1411 RETURN_IF_ERROR(HashTableCtx::ReplaceHashTableConstants(codegen, *hash_table_config_,
1412 stores_duplicates, num_build_tuples, process_build_batch_fn, &replaced_constants));
1413 DCHECK_GE(replaced_constants.stores_nulls, 1);
1414 DCHECK_EQ(replaced_constants.finds_some_nulls, 0);
1415 DCHECK_EQ(replaced_constants.stores_duplicates, 0);
1416 DCHECK_EQ(replaced_constants.stores_tuples, 0);
1417 DCHECK_EQ(replaced_constants.quadratic_probing, 0);
1418
1419 llvm::Value* is_null_aware_arg = codegen->GetArgument(process_build_batch_fn, 5);
1420 is_null_aware_arg->replaceAllUsesWith(
1421 codegen->GetBoolConstant(join_op_ == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN));
1422
1423 llvm::Function* process_build_batch_fn_level0 =
1424 codegen->CloneFunction(process_build_batch_fn);
1425
1426 // Always build runtime filters at level0 (if there are any).
1427 // Note that the first argument of this function is the return value.
1428 llvm::Value* build_filter_l0_arg =
1429 codegen->GetArgument(process_build_batch_fn_level0, 4);
1430 build_filter_l0_arg->replaceAllUsesWith(
1431 codegen->GetBoolConstant(filter_descs_.size() > 0));
1432
1433 // process_build_batch_fn_level0 uses CRC hash if available,
1434 replaced =
1435 codegen->ReplaceCallSites(process_build_batch_fn_level0, hash_fn, "HashRow");
1436 DCHECK_REPLACE_COUNT(replaced, 1);
1437
1438 // process_build_batch_fn uses murmur
1439 replaced =
1440 codegen->ReplaceCallSites(process_build_batch_fn, murmur_hash_fn, "HashRow");
1441 DCHECK_REPLACE_COUNT(replaced, 1);
1442
1443 // Never build filters after repartitioning, as all rows have already been added to the
1444 // filters during the level0 build. Note that the first argument of this function is the
1445 // return value.
1446 llvm::Value* build_filter_arg = codegen->GetArgument(process_build_batch_fn, 4);
1447 build_filter_arg->replaceAllUsesWith(codegen->false_value());
1448

Callers

nothing calls this directly

Calls 11

OKFunction · 0.85
ReplaceCallSitesMethod · 0.80
GetArgumentMethod · 0.80
GetBoolConstantMethod · 0.80
CloneFunctionMethod · 0.80
false_valueMethod · 0.80
FinalizeFunctionMethod · 0.80
StatusClass · 0.70
GetFunctionMethod · 0.45
sizeMethod · 0.45
AddFunctionToJitMethod · 0.45

Tested by

no test coverage detected