|
30 | 30 | #include "compute/BoltPlanConverter.h" |
31 | 31 | #include "config/BoltConfig.h" |
32 | 32 | #include "config/GlutenConfig.h" |
| 33 | +#include "jni/TaskContextJniWrapper.h" |
33 | 34 | #include "memory/BoltGlutenMemoryManager.h" |
34 | 35 | #include "operators/serializer/BoltRowToColumnarConverter.h" |
35 | 36 | #include "utils/ConfigExtractor.h" |
@@ -66,18 +67,18 @@ BoltRuntime::BoltRuntime( |
66 | 67 | const std::string& kind, |
67 | 68 | BoltMemoryManager* vmm, |
68 | 69 | ThreadManager* threadManager, |
69 | | - const std::unordered_map<std::string, std::string>& confMap, |
70 | | - int64_t taskId) |
71 | | - : Runtime(kind, vmm, threadManager, confMap, taskId) { |
| 70 | + const std::unordered_map<std::string, std::string>& confMap) |
| 71 | + : Runtime(kind, vmm, threadManager, confMap) { |
72 | 72 | // Refresh session config. |
73 | 73 | boltCfg_ = |
74 | 74 | std::make_shared<bytedance::bolt::config::ConfigBase>(std::unordered_map<std::string, std::string>(confMap_)); |
75 | 75 |
|
76 | 76 | gluten::BoltGlutenMemoryManager::init(BoltBackend::getCombinedConf(boltCfg_)->rawConfigs()); |
77 | 77 |
|
78 | 78 | if (gluten::BoltGlutenMemoryManager::enabled()) { |
| 79 | + const auto taskAttemptId = gluten::getCurrentSparkTaskAttemptId(); |
79 | 80 | auto holder = gluten::BoltGlutenMemoryManager::getMemoryManagerHolder( |
80 | | - memoryManager()->name(), taskId, reinterpret_cast<int64_t>(memoryManager())); |
| 81 | + "", taskAttemptId, reinterpret_cast<int64_t>(memoryManager())); |
81 | 82 | auto mm = holder->getManager(); |
82 | 83 | leafPool_ = mm->getLeafMemoryPool(); |
83 | 84 | aggregatePool_ = mm->getAggregateMemoryPool(); |
@@ -217,8 +218,9 @@ std::shared_ptr<ResultIterator> BoltRuntime::createResultIterator( |
217 | 218 | std::weak_ptr<ResultIterator> weakAns = ans; |
218 | 219 | auto spiller = std::make_shared<OperatorSpiller>(weakAns); |
219 | 220 | auto genericSpiller = std::dynamic_pointer_cast<bytedance::bolt::memory::sparksql::Spiller>(spiller); |
| 221 | + const auto taskAttemptId = gluten::getCurrentSparkTaskAttemptId(); |
220 | 222 | auto holder = gluten::BoltGlutenMemoryManager::getMemoryManagerHolder( |
221 | | - memoryManager()->name(), taskId(), reinterpret_cast<int64_t>(memoryManager())); |
| 223 | + "", taskAttemptId, reinterpret_cast<int64_t>(memoryManager())); |
222 | 224 | holder->appendSpiller(genericSpiller); |
223 | 225 | } |
224 | 226 |
|
@@ -368,8 +370,9 @@ std::shared_ptr<ShuffleWriterBase> BoltRuntime::createShuffleWriter( |
368 | 370 | auto weakShuffleWriter = std::weak_ptr<ShuffleWriterBase>(shuffleWriter); |
369 | 371 | auto spiller = std::make_shared<ShuffleSpiller>(weakShuffleWriter); |
370 | 372 | auto genericSpiller = std::dynamic_pointer_cast<bytedance::bolt::memory::sparksql::Spiller>(spiller); |
| 373 | + const auto taskAttemptId = gluten::getCurrentSparkTaskAttemptId(); |
371 | 374 | auto holder = gluten::BoltGlutenMemoryManager::getMemoryManagerHolder( |
372 | | - memoryManager()->name(), taskId(), reinterpret_cast<int64_t>(memoryManager())); |
| 375 | + "", taskAttemptId, reinterpret_cast<int64_t>(memoryManager())); |
373 | 376 | holder->appendSpiller(genericSpiller); |
374 | 377 | } |
375 | 378 | return shuffleWriter; |
|
0 commit comments