-
Notifications
You must be signed in to change notification settings - Fork 582
[GLUTEN-10113][VL] Refactor hive connector register to accept session level config #10585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,8 +94,8 @@ void veloxRuntimeReleaser(Runtime* runtime) { | |
| void VeloxBackend::init( | ||
| std::unique_ptr<AllocationListener> listener, | ||
| const std::unordered_map<std::string, std::string>& conf) { | ||
| backendConf_ = | ||
| std::make_shared<facebook::velox::config::ConfigBase>(std::unordered_map<std::string, std::string>(conf)); | ||
| backendConf_ = std::make_shared<facebook::velox::config::ConfigBase>( | ||
| std::unordered_map<std::string, std::string>(conf), true /*mutable*/); | ||
|
|
||
| globalMemoryManager_ = std::make_unique<VeloxMemoryManager>(kVeloxBackendKind, std::move(listener), *backendConf_); | ||
|
|
||
|
|
@@ -104,7 +104,7 @@ void VeloxBackend::init( | |
| Runtime::registerFactory(kVeloxBackendKind, veloxRuntimeFactory, veloxRuntimeReleaser); | ||
|
|
||
| if (backendConf_->get<bool>(kDebugModeEnabled, false)) { | ||
| LOG(INFO) << "VeloxBackend config:" << printConfig(backendConf_->rawConfigs()); | ||
| LOG(INFO) << "VeloxBackend config:" << printConfig(backendConf_->rawConfigsCopy()); | ||
| } | ||
|
|
||
| // Init glog and log level. | ||
|
|
@@ -181,7 +181,6 @@ void VeloxBackend::init( | |
| #endif | ||
|
|
||
| initJolFilesystem(); | ||
| initConnector(hiveConf); | ||
|
|
||
| velox::dwio::common::registerFileSinks(); | ||
| velox::parquet::registerParquetReaderFactory(); | ||
|
|
@@ -303,15 +302,23 @@ void VeloxBackend::initCache() { | |
| } | ||
|
|
||
| void VeloxBackend::initConnector(const std::shared_ptr<velox::config::ConfigBase>& hiveConf) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move the function to WholeStageResultIterator? |
||
| for (const auto& [key, value] : hiveConf->rawConfigs()) { | ||
| // always update to use new session level conf | ||
| backendConf_->set(key, value); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Users may pass/modify the filesystem related configurations at session level, by setting the keys here it will allow us to pick the latest values |
||
| } | ||
| auto newConf = getHiveConfig(backendConf_); | ||
|
|
||
| auto ioThreads = backendConf_->get<int32_t>(kVeloxIOThreads, kVeloxIOThreadsDefault); | ||
| GLUTEN_CHECK( | ||
| ioThreads >= 0, | ||
| kVeloxIOThreads + " was set to negative number " + std::to_string(ioThreads) + ", this should not happen."); | ||
| if (ioThreads > 0) { | ||
| ioExecutor_ = std::make_unique<folly::IOThreadPoolExecutor>(ioThreads); | ||
| } | ||
| velox::connector::registerConnector( | ||
| std::make_shared<velox::connector::hive::HiveConnector>(kHiveConnectorId, hiveConf, ioExecutor_.get())); | ||
| auto hiveConnector = | ||
| std::make_shared<velox::connector::hive::HiveConnector>(kHiveConnectorId, newConf, ioExecutor_.get()); | ||
| velox::connector::unregisterConnector(kHiveConnectorId); | ||
| velox::connector::registerConnector(hiveConnector); | ||
| #ifdef GLUTEN_ENABLE_GPU | ||
| if (backendConf_->get<bool>(kCudfEnableTableScan, kCudfEnableTableScanDefault) && | ||
| backendConf_->get<bool>(kCudfEnabled, kCudfEnabledDefault)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mutable true make copy the configs when iterating the configs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we generate the HiveConfig by veloxCfg_ in WholeStageResultIterator every time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, here
veloxCfg_contains only session level configurations, it does not cover the configurations defined in spark.conf