Skip to content

Commit 1bf6194

Browse files
committed
[native] Remove BaseVeloxQueryConfig (prestodb#25758)
Summary: Remove BaseVeloxQueryConfig as it is not used. Reviewed By: xiaoxmeng Differential Revision: D80124169
1 parent 02a0622 commit 1bf6194

File tree

7 files changed

+27
-274
lines changed

7 files changed

+27
-274
lines changed

presto-native-execution/presto_cpp/main/PrestoServer.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ PrestoServer::~PrestoServer() {}
196196
void PrestoServer::run() {
197197
auto systemConfig = SystemConfig::instance();
198198
auto nodeConfig = NodeConfig::instance();
199-
auto baseVeloxQueryConfig = BaseVeloxQueryConfig::instance();
200199
int httpPort{0};
201200

202201
std::string certPath;
@@ -212,9 +211,6 @@ void PrestoServer::run() {
212211
fmt::format("{}/config.properties", configDirectoryPath_));
213212
nodeConfig->initialize(
214213
fmt::format("{}/node.properties", configDirectoryPath_));
215-
// velox.properties is optional.
216-
baseVeloxQueryConfig->initialize(
217-
fmt::format("{}/velox.properties", configDirectoryPath_), true);
218214

219215
httpPort = systemConfig->httpServerHttpPort();
220216
if (systemConfig->httpServerHttpsEnabled()) {
@@ -319,9 +315,15 @@ void PrestoServer::run() {
319315
httpsSocketAddress.setFromLocalPort(httpsPort.value());
320316
}
321317

322-
const bool http2Enabled = SystemConfig::instance()->httpServerHttp2Enabled();
318+
const bool http2Enabled =
319+
SystemConfig::instance()->httpServerHttp2Enabled();
323320
httpsConfig = std::make_unique<http::HttpsConfig>(
324-
httpsSocketAddress, certPath, keyPath, ciphers, reusePort, http2Enabled);
321+
httpsSocketAddress,
322+
certPath,
323+
keyPath,
324+
ciphers,
325+
reusePort,
326+
http2Enabled);
325327
}
326328

327329
httpServer_ = std::make_unique<http::HttpServer>(

presto-native-execution/presto_cpp/main/PrestoServerOperations.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ std::string PrestoServerOperations::veloxQueryConfigOperation(
177177
"Have set system property value '{}' to '{}'. Old value was '{}'.\n",
178178
name,
179179
value,
180-
BaseVeloxQueryConfig::instance()
180+
SystemConfig::instance()
181181
->setValue(name, value)
182182
.value_or("<default>"));
183183
}
@@ -190,7 +190,7 @@ std::string PrestoServerOperations::veloxQueryConfigOperation(
190190
ServerOperation::actionString(op.action));
191191
return fmt::format(
192192
"{}\n",
193-
BaseVeloxQueryConfig::instance()->optionalProperty(name).value_or(
193+
SystemConfig::instance()->optionalProperty(name).value_or(
194194
"<default>"));
195195
}
196196
default:

presto-native-execution/presto_cpp/main/PrestoToVeloxQueryConfig.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ void updateFromSystemConfigs(
168168

169169
velox::core::QueryConfig toVeloxConfigs(
170170
const protocol::SessionRepresentation& session) {
171-
// Use base velox query config as the starting point and add Presto session
172-
// properties on top of it.
173-
auto configs = BaseVeloxQueryConfig::instance()->values();
171+
std::unordered_map<std::string, std::string> configs;
174172

175173
// Firstly apply Presto system properties to Velox query config.
176174
updateFromSystemConfigs(configs);

presto-native-execution/presto_cpp/main/common/Configs.cpp

Lines changed: 6 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ SystemConfig::SystemConfig() {
260260
NUM_PROP(kExchangeIoEvbViolationThresholdMs, 1000),
261261
NUM_PROP(kHttpSrvIoEvbViolationThresholdMs, 1000),
262262
NUM_PROP(kMaxLocalExchangePartitionBufferSize, 65536),
263-
BOOL_PROP(kTextWriterEnabled, false),
263+
BOOL_PROP(kTextWriterEnabled, false),
264264
};
265265
}
266266

@@ -910,17 +910,16 @@ std::string SystemConfig::pluginDir() const {
910910
}
911911

912912
int32_t SystemConfig::exchangeIoEvbViolationThresholdMs() const {
913-
return optionalProperty<int32_t>(kExchangeIoEvbViolationThresholdMs)
914-
.value();
913+
return optionalProperty<int32_t>(kExchangeIoEvbViolationThresholdMs).value();
915914
}
916915

917916
int32_t SystemConfig::httpSrvIoEvbViolationThresholdMs() const {
918-
return optionalProperty<int32_t>(kHttpSrvIoEvbViolationThresholdMs)
919-
.value();
917+
return optionalProperty<int32_t>(kHttpSrvIoEvbViolationThresholdMs).value();
920918
}
921919

922920
uint64_t SystemConfig::maxLocalExchangePartitionBufferSize() const {
923-
return optionalProperty<uint64_t>(kMaxLocalExchangePartitionBufferSize).value();
921+
return optionalProperty<uint64_t>(kMaxLocalExchangePartitionBufferSize)
922+
.value();
924923
}
925924

926925
bool SystemConfig::textWriterEnabled() const {
@@ -949,8 +948,7 @@ std::string NodeConfig::nodeEnvironment() const {
949948
}
950949

951950
int NodeConfig::prometheusExecutorThreads() const {
952-
static constexpr int
953-
kNodePrometheusExecutorThreadsDefault = 2;
951+
static constexpr int kNodePrometheusExecutorThreadsDefault = 2;
954952
auto resultOpt = optionalProperty<int>(kNodePrometheusExecutorThreads);
955953
if (resultOpt.has_value()) {
956954
return resultOpt.value();
@@ -992,115 +990,4 @@ std::string NodeConfig::nodeInternalAddress(
992990
}
993991
}
994992

995-
BaseVeloxQueryConfig::BaseVeloxQueryConfig() {
996-
// Use empty instance to get default property values.
997-
velox::core::QueryConfig c{{}};
998-
using namespace velox::core;
999-
registeredProps_ =
1000-
std::unordered_map<std::string, folly::Optional<std::string>>{
1001-
BOOL_PROP(kMutableConfig, false),
1002-
STR_PROP(QueryConfig::kSessionTimezone, c.sessionTimezone()),
1003-
BOOL_PROP(
1004-
QueryConfig::kAdjustTimestampToTimezone,
1005-
c.adjustTimestampToTimezone()),
1006-
BOOL_PROP(QueryConfig::kExprEvalSimplified, c.exprEvalSimplified()),
1007-
BOOL_PROP(QueryConfig::kExprTrackCpuUsage, c.exprTrackCpuUsage()),
1008-
BOOL_PROP(
1009-
QueryConfig::kOperatorTrackCpuUsage, c.operatorTrackCpuUsage()),
1010-
BOOL_PROP(
1011-
QueryConfig::kCastMatchStructByName, c.isMatchStructByName()),
1012-
NUM_PROP(
1013-
QueryConfig::kMaxLocalExchangeBufferSize,
1014-
c.maxLocalExchangeBufferSize()),
1015-
NUM_PROP(
1016-
QueryConfig::kMaxPartialAggregationMemory,
1017-
c.maxPartialAggregationMemoryUsage()),
1018-
NUM_PROP(
1019-
QueryConfig::kMaxExtendedPartialAggregationMemory,
1020-
c.maxExtendedPartialAggregationMemoryUsage()),
1021-
NUM_PROP(
1022-
QueryConfig::kAbandonPartialAggregationMinRows,
1023-
c.abandonPartialAggregationMinRows()),
1024-
NUM_PROP(
1025-
QueryConfig::kAbandonPartialAggregationMinPct,
1026-
c.abandonPartialAggregationMinPct()),
1027-
NUM_PROP(
1028-
QueryConfig::kMaxPartitionedOutputBufferSize,
1029-
c.maxPartitionedOutputBufferSize()),
1030-
NUM_PROP(
1031-
QueryConfig::kPreferredOutputBatchBytes,
1032-
c.preferredOutputBatchBytes()),
1033-
NUM_PROP(
1034-
QueryConfig::kPreferredOutputBatchRows,
1035-
c.preferredOutputBatchRows()),
1036-
NUM_PROP(QueryConfig::kMaxOutputBatchRows, c.maxOutputBatchRows()),
1037-
BOOL_PROP(
1038-
QueryConfig::kHashAdaptivityEnabled, c.hashAdaptivityEnabled()),
1039-
BOOL_PROP(
1040-
QueryConfig::kAdaptiveFilterReorderingEnabled,
1041-
c.adaptiveFilterReorderingEnabled()),
1042-
BOOL_PROP(QueryConfig::kSpillEnabled, c.spillEnabled()),
1043-
BOOL_PROP(
1044-
QueryConfig::kAggregationSpillEnabled,
1045-
c.aggregationSpillEnabled()),
1046-
BOOL_PROP(QueryConfig::kJoinSpillEnabled, c.joinSpillEnabled()),
1047-
BOOL_PROP(QueryConfig::kOrderBySpillEnabled, c.orderBySpillEnabled()),
1048-
NUM_PROP(QueryConfig::kMaxSpillBytes, c.maxSpillBytes()),
1049-
NUM_PROP(QueryConfig::kMaxSpillLevel, c.maxSpillLevel()),
1050-
NUM_PROP(QueryConfig::kMaxSpillFileSize, c.maxSpillFileSize()),
1051-
NUM_PROP(
1052-
QueryConfig::kSpillStartPartitionBit, c.spillStartPartitionBit()),
1053-
NUM_PROP(
1054-
QueryConfig::kSpillNumPartitionBits, c.spillNumPartitionBits()),
1055-
NUM_PROP(
1056-
QueryConfig::kSpillableReservationGrowthPct,
1057-
c.spillableReservationGrowthPct()),
1058-
BOOL_PROP(
1059-
QueryConfig::kPrestoArrayAggIgnoreNulls,
1060-
c.prestoArrayAggIgnoreNulls()),
1061-
BOOL_PROP(
1062-
QueryConfig::kSelectiveNimbleReaderEnabled,
1063-
c.selectiveNimbleReaderEnabled()),
1064-
NUM_PROP(QueryConfig::kMaxOutputBufferSize, c.maxOutputBufferSize()),
1065-
};
1066-
}
1067-
1068-
BaseVeloxQueryConfig* BaseVeloxQueryConfig::instance() {
1069-
static std::unique_ptr<BaseVeloxQueryConfig> instance =
1070-
std::make_unique<BaseVeloxQueryConfig>();
1071-
return instance.get();
1072-
}
1073-
1074-
void BaseVeloxQueryConfig::updateLoadedValues(
1075-
std::unordered_map<std::string, std::string>& values) const {
1076-
// Update velox config with values from presto system config.
1077-
auto systemConfig = SystemConfig::instance();
1078-
1079-
using namespace velox::core;
1080-
std::unordered_map<std::string, std::string> updatedValues{};
1081-
1082-
auto taskWriterCount = systemConfig->taskWriterCount();
1083-
if (taskWriterCount.has_value()) {
1084-
updatedValues[QueryConfig::kTaskWriterCount] =
1085-
std::to_string(taskWriterCount.value());
1086-
}
1087-
auto taskPartitionedWriterCount = systemConfig->taskPartitionedWriterCount();
1088-
if (taskPartitionedWriterCount.has_value()) {
1089-
updatedValues[QueryConfig::kTaskPartitionedWriterCount] =
1090-
std::to_string(taskPartitionedWriterCount.value());
1091-
}
1092-
1093-
std::stringstream updated;
1094-
for (const auto& pair : updatedValues) {
1095-
updated << " " << pair.first << "=" << pair.second << "\n";
1096-
values[pair.first] = pair.second;
1097-
}
1098-
auto str = updated.str();
1099-
if (!str.empty()) {
1100-
PRESTO_STARTUP_LOG(INFO)
1101-
<< "Updated in '" << filePath_ << "' from SystemProperties:\n"
1102-
<< str;
1103-
}
1104-
}
1105-
1106993
} // namespace facebook::presto

presto-native-execution/presto_cpp/main/common/Configs.h

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ class ConfigBase {
4343
}
4444

4545
/// DO NOT DELETE THIS METHOD!
46-
/// The method is used to register new properties after the config class is created.
47-
/// Returns true if succeeded, false if failed (due to the property already
48-
/// registered).
46+
/// The method is used to register new properties after the config class is
47+
/// created. Returns true if succeeded, false if failed (due to the property
48+
/// already registered).
4949
bool registerProperty(
50-
const std::string& propertyName,
51-
const folly::Optional<std::string>& defaultValue = {});
50+
const std::string& propertyName,
51+
const folly::Optional<std::string>& defaultValue = {});
5252

5353
/// Adds or replaces value at the given key. Can be used by debugging or
5454
/// testing code.
@@ -721,10 +721,6 @@ class SystemConfig : public ConfigBase {
721721
/// Optional string containing the path to the plugin directory
722722
static constexpr std::string_view kPluginDir{"plugin.dir"};
723723

724-
/// Below are the Presto properties from config.properties that get converted
725-
/// to their velox counterparts in BaseVeloxQueryConfig and used solely from
726-
/// BaseVeloxQueryConfig.
727-
728724
/// Uses legacy version of array_agg which ignores nulls.
729725
static constexpr std::string_view kUseLegacyArrayAgg{
730726
"deprecated.legacy-array-agg"};
@@ -752,7 +748,7 @@ class SystemConfig : public ConfigBase {
752748

753749
// Max wait time for exchange request in seconds.
754750
static constexpr std::string_view kRequestDataSizesMaxWaitSec{
755-
"exchange.http-client.request-data-sizes-max-wait-sec"};
751+
"exchange.http-client.request-data-sizes-max-wait-sec"};
756752

757753
static constexpr std::string_view kExchangeIoEvbViolationThresholdMs{
758754
"exchange.io-evb-violation-threshold-ms"};
@@ -764,8 +760,7 @@ class SystemConfig : public ConfigBase {
764760

765761
// Add to temporarily help with gradual rollout for text writer
766762
// TODO: remove once text writer is fully rolled out
767-
static constexpr std::string_view kTextWriterEnabled{
768-
"text-writer-enabled"};
763+
static constexpr std::string_view kTextWriterEnabled{"text-writer-enabled"};
769764

770765
SystemConfig();
771766

@@ -1069,7 +1064,8 @@ class NodeConfig : public ConfigBase {
10691064
static constexpr std::string_view kNodeInternalAddress{
10701065
"node.internal-address"};
10711066
static constexpr std::string_view kNodeLocation{"node.location"};
1072-
static constexpr std::string_view kNodePrometheusExecutorThreads{"node.prometheus.num-executor-threads"};
1067+
static constexpr std::string_view kNodePrometheusExecutorThreads{
1068+
"node.prometheus.num-executor-threads"};
10731069

10741070
NodeConfig();
10751071

@@ -1089,19 +1085,4 @@ class NodeConfig : public ConfigBase {
10891085
std::string nodeLocation() const;
10901086
};
10911087

1092-
/// Used only in the single instance as the source of the initial properties for
1093-
/// velox::QueryConfig. Not designed for actual property access during a query
1094-
/// run.
1095-
class BaseVeloxQueryConfig : public ConfigBase {
1096-
public:
1097-
BaseVeloxQueryConfig();
1098-
1099-
virtual ~BaseVeloxQueryConfig() = default;
1100-
1101-
void updateLoadedValues(
1102-
std::unordered_map<std::string, std::string>& values) const override;
1103-
1104-
static BaseVeloxQueryConfig* instance();
1105-
};
1106-
11071088
} // namespace facebook::presto

0 commit comments

Comments
 (0)