Skip to content

Commit

Permalink
Remove core::Config class and its usage (facebookincubator#10756)
Browse files Browse the repository at this point in the history
Summary:
As a config migration effort, remove core::Config class as all dependencies have migrated as of now.

Pull Request resolved: facebookincubator#10756

Reviewed By: xiaoxmeng

Differential Revision: D61272598

Pulled By: tanjialiang

fbshipit-source-id: f94cb05c592dbf2e8e6165d5a7636d3b01a27684
  • Loading branch information
tanjialiang authored and facebook-github-bot committed Aug 15, 2024
1 parent 94763e7 commit 4fdc4d4
Show file tree
Hide file tree
Showing 20 changed files with 13 additions and 316 deletions.
6 changes: 0 additions & 6 deletions velox/connectors/Connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,6 @@ class ConnectorFactory {
std::shared_ptr<const config::ConfigBase> config,
folly::Executor* executor = nullptr) = 0;

// TODO(jtan6): [Config Refactor] Remove this old API when refactor is done.
virtual std::shared_ptr<Connector> newConnector(
const std::string& id,
std::shared_ptr<const Config> config,
folly::Executor* executor = nullptr) = 0;

private:
const std::string name_;
};
Expand Down
12 changes: 0 additions & 12 deletions velox/connectors/fuzzer/FuzzerConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "velox/common/config/Config.h"
#include "velox/connectors/Connector.h"
#include "velox/connectors/fuzzer/FuzzerConnectorSplit.h"
#include "velox/core/Config.h"
#include "velox/vector/fuzzer/VectorFuzzer.h"

namespace facebook::velox::connector::fuzzer {
Expand Down Expand Up @@ -145,17 +144,6 @@ class FuzzerConnectorFactory : public ConnectorFactory {
folly::Executor* executor = nullptr) override {
return std::make_shared<FuzzerConnector>(id, config, executor);
}

std::shared_ptr<Connector> newConnector(
const std::string& id,
std::shared_ptr<const Config> config,
folly::Executor* executor = nullptr) override {
std::shared_ptr<const config::ConfigBase> convertedConfig;
convertedConfig = config == nullptr
? nullptr
: std::make_shared<config::ConfigBase>(config->valuesCopy());
return newConnector(id, convertedConfig, executor);
}
};

} // namespace facebook::velox::connector::fuzzer
11 changes: 0 additions & 11 deletions velox/connectors/hive/HiveConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ class HiveConnectorFactory : public ConnectorFactory {
folly::Executor* executor = nullptr) override {
return std::make_shared<HiveConnector>(id, config, executor);
}

std::shared_ptr<Connector> newConnector(
const std::string& id,
std::shared_ptr<const Config> config,
folly::Executor* executor = nullptr) override {
std::shared_ptr<const config::ConfigBase> convertedConfig;
convertedConfig = config == nullptr
? nullptr
: std::make_shared<config::ConfigBase>(config->valuesCopy());
return newConnector(id, convertedConfig, executor);
}
};

class HiveHadoop2ConnectorFactory : public HiveConnectorFactory {
Expand Down
7 changes: 0 additions & 7 deletions velox/connectors/tests/ConnectorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ class TestConnectorFactory : public connector::ConnectorFactory {

TestConnectorFactory() : ConnectorFactory(kConnectorFactoryName) {}

std::shared_ptr<Connector> newConnector(
const std::string& id,
std::shared_ptr<const Config> /*config*/,
folly::Executor* /*executor*/ = nullptr) override {
return std::make_shared<TestConnector>(id);
}

std::shared_ptr<Connector> newConnector(
const std::string& id,
std::shared_ptr<const config::ConfigBase> /*config*/,
Expand Down
12 changes: 0 additions & 12 deletions velox/connectors/tpch/TpchConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "velox/common/config/Config.h"
#include "velox/connectors/Connector.h"
#include "velox/connectors/tpch/TpchConnectorSplit.h"
#include "velox/core/Config.h"
#include "velox/tpch/gen/TpchGen.h"

namespace facebook::velox::connector::tpch {
Expand Down Expand Up @@ -175,17 +174,6 @@ class TpchConnectorFactory : public ConnectorFactory {
folly::Executor* executor = nullptr) override {
return std::make_shared<TpchConnector>(id, config, executor);
}

std::shared_ptr<Connector> newConnector(
const std::string& id,
std::shared_ptr<const Config> config,
folly::Executor* executor = nullptr) override {
std::shared_ptr<const config::ConfigBase> convertedConfig;
convertedConfig = config == nullptr
? nullptr
: std::make_shared<config::ConfigBase>(config->valuesCopy());
return newConnector(id, convertedConfig, executor);
}
};

} // namespace facebook::velox::connector::tpch
7 changes: 0 additions & 7 deletions velox/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ if(${VELOX_BUILD_TESTING})
add_subdirectory(tests)
endif()

velox_add_library(velox_config Config.cpp)
velox_link_libraries(
velox_config
PUBLIC velox_exception Folly::folly
PRIVATE velox_type_tz)

velox_add_library(
velox_core
Expressions.cpp
Expand All @@ -34,7 +28,6 @@ velox_link_libraries(
velox_core
PUBLIC velox_arrow_bridge
velox_caching
velox_config
velox_common_config
velox_connector
velox_exception
Expand Down
58 changes: 0 additions & 58 deletions velox/core/Config.cpp

This file was deleted.

141 changes: 0 additions & 141 deletions velox/core/Config.h

This file was deleted.

3 changes: 1 addition & 2 deletions velox/core/QueryConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
#pragma once

#include "velox/common/config/Config.h"
#include "velox/core/Config.h"

namespace facebook::velox::core {

/// A simple wrapper around velox::Config. Defines constants for query
/// A simple wrapper around velox::ConfigBase. Defines constants for query
/// config properties and accessor methods.
/// Create per query context. Does not have a singleton instance.
/// Does not allow altering properties on the fly. Only at creation time.
Expand Down
29 changes: 0 additions & 29 deletions velox/core/QueryCtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "velox/core/QueryCtx.h"
#include "velox/common/base/SpillConfig.h"
#include "velox/common/config/Config.h"
#include "velox/core/Config.h"

namespace facebook::velox::core {

Expand All @@ -43,34 +42,6 @@ std::shared_ptr<QueryCtx> QueryCtx::create(
return queryCtx;
}

// static
std::shared_ptr<QueryCtx> QueryCtx::create(
folly::Executor* executor,
QueryConfig&& queryConfig,
std::unordered_map<std::string, std::shared_ptr<Config>> connectorConfigs,
cache::AsyncDataCache* cache,
std::shared_ptr<memory::MemoryPool> pool,
folly::Executor* spillExecutor,
const std::string& queryId) {
std::unordered_map<std::string, std::shared_ptr<config::ConfigBase>>
convertedConfigs;
for (const auto& pair : connectorConfigs) {
convertedConfigs.insert(
{pair.first,
std::make_shared<config::ConfigBase>(pair.second->valuesCopy())});
}
std::shared_ptr<QueryCtx> queryCtx(new QueryCtx(
executor,
std::move(queryConfig),
std::move(convertedConfigs),
cache,
std::move(pool),
spillExecutor,
queryId));
queryCtx->maybeSetReclaimer();
return queryCtx;
}

QueryCtx::QueryCtx(
folly::Executor* executor,
QueryConfig&& queryConfig,
Expand Down
11 changes: 0 additions & 11 deletions velox/core/QueryCtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ class QueryCtx : public std::enable_shared_from_this<QueryCtx> {
folly::Executor* spillExecutor = nullptr,
const std::string& queryId = "");

// TODO(jtan6): [Config Refactor] Remove this old API after refactoring is
// done.
static std::shared_ptr<QueryCtx> create(
folly::Executor* executor,
QueryConfig&& queryConfig,
std::unordered_map<std::string, std::shared_ptr<Config>> connectorConfigs,
cache::AsyncDataCache* cache = cache::AsyncDataCache::getInstance(),
std::shared_ptr<memory::MemoryPool> pool = nullptr,
folly::Executor* spillExecutor = nullptr,
const std::string& queryId = "");

static std::string generatePoolName(const std::string& queryId);

memory::MemoryPool* pool() const {
Expand Down
Loading

0 comments on commit 4fdc4d4

Please sign in to comment.