| 1411 | } |
| 1412 | |
| 1413 | Status PartitionedHashJoinPlanNode::CodegenProcessProbeBatch( |
| 1414 | LlvmCodeGen* codegen, TPrefetchMode::type prefetch_mode) { |
| 1415 | // Codegen for hashing rows |
| 1416 | llvm::Function* hash_fn; |
| 1417 | llvm::Function* murmur_hash_fn; |
| 1418 | |
| 1419 | RETURN_IF_ERROR( |
| 1420 | HashTableCtx::CodegenHashRow(codegen, false, *hash_table_config_, &hash_fn)); |
| 1421 | RETURN_IF_ERROR( |
| 1422 | HashTableCtx::CodegenHashRow(codegen, true, *hash_table_config_, &murmur_hash_fn)); |
| 1423 | |
| 1424 | // Get cross compiled function |
| 1425 | IRFunction::Type ir_fn = IRFunction::FN_END; |
| 1426 | switch (join_op_) { |
| 1427 | case TJoinOp::INNER_JOIN: |
| 1428 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_INNER_JOIN; |
| 1429 | break; |
| 1430 | case TJoinOp::LEFT_OUTER_JOIN: |
| 1431 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_LEFT_OUTER_JOIN; |
| 1432 | break; |
| 1433 | case TJoinOp::LEFT_SEMI_JOIN: |
| 1434 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_LEFT_SEMI_JOIN; |
| 1435 | break; |
| 1436 | case TJoinOp::LEFT_ANTI_JOIN: |
| 1437 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_LEFT_ANTI_JOIN; |
| 1438 | break; |
| 1439 | case TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN: |
| 1440 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_NULL_AWARE_LEFT_ANTI_JOIN; |
| 1441 | break; |
| 1442 | case TJoinOp::RIGHT_OUTER_JOIN: |
| 1443 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_RIGHT_OUTER_JOIN; |
| 1444 | break; |
| 1445 | case TJoinOp::RIGHT_SEMI_JOIN: |
| 1446 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_RIGHT_SEMI_JOIN; |
| 1447 | break; |
| 1448 | case TJoinOp::RIGHT_ANTI_JOIN: |
| 1449 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_RIGHT_ANTI_JOIN; |
| 1450 | break; |
| 1451 | case TJoinOp::FULL_OUTER_JOIN: |
| 1452 | ir_fn = IRFunction::PHJ_PROCESS_PROBE_BATCH_FULL_OUTER_JOIN; |
| 1453 | break; |
| 1454 | default: |
| 1455 | DCHECK(false); |
| 1456 | } |
| 1457 | llvm::Function* process_probe_batch_fn = codegen->GetFunction(ir_fn, true); |
| 1458 | DCHECK(process_probe_batch_fn != nullptr); |
| 1459 | process_probe_batch_fn->setName("ProcessProbeBatch"); |
| 1460 | |
| 1461 | // Verifies that ProcessProbeBatch() has weak_odr linkage so it's not discarded even |
| 1462 | // if it's not referenced. See http://llvm.org/docs/LangRef.html#linkage-types |
| 1463 | DCHECK(process_probe_batch_fn->getLinkage() == llvm::GlobalValue::WeakODRLinkage) |
| 1464 | << LlvmCodeGen::Print(process_probe_batch_fn); |
| 1465 | |
| 1466 | // Replace the parameter 'prefetch_mode' with constant. |
| 1467 | llvm::Value* prefetch_mode_arg = codegen->GetArgument(process_probe_batch_fn, 1); |
| 1468 | DCHECK_GE(prefetch_mode, TPrefetchMode::NONE); |
| 1469 | DCHECK_LE(prefetch_mode, TPrefetchMode::HT_BUCKET); |
| 1470 | prefetch_mode_arg->replaceAllUsesWith(codegen->GetI32Constant(prefetch_mode)); |
nothing calls this directly
no test coverage detected