diff --git a/presto-native-execution/presto_cpp/main/CMakeLists.txt b/presto-native-execution/presto_cpp/main/CMakeLists.txt index 7de56fb0379c7..2d6e883163231 100644 --- a/presto-native-execution/presto_cpp/main/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/CMakeLists.txt @@ -17,10 +17,7 @@ add_subdirectory(thrift) add_subdirectory(connectors) add_subdirectory(functions) add_subdirectory(tool) - -add_library(presto_session_properties SessionProperties.cpp) - -target_link_libraries(presto_session_properties ${FOLLY_WITH_DEPENDENCIES}) +add_subdirectory(properties) add_library( presto_server_lib diff --git a/presto-native-execution/presto_cpp/main/PrestoServer.cpp b/presto-native-execution/presto_cpp/main/PrestoServer.cpp index bb09538e44d46..e501dba93125a 100644 --- a/presto-native-execution/presto_cpp/main/PrestoServer.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoServer.cpp @@ -22,7 +22,6 @@ #include "presto_cpp/main/CoordinatorDiscoverer.h" #include "presto_cpp/main/PeriodicMemoryChecker.h" #include "presto_cpp/main/PeriodicTaskManager.h" -#include "presto_cpp/main/SessionProperties.h" #include "presto_cpp/main/SignalHandler.h" #include "presto_cpp/main/TaskResource.h" #include "presto_cpp/main/common/ConfigReader.h" @@ -44,6 +43,7 @@ #include "presto_cpp/main/operators/ShuffleExchangeSource.h" #include "presto_cpp/main/operators/ShuffleRead.h" #include "presto_cpp/main/operators/ShuffleWrite.h" +#include "presto_cpp/main/properties/session/SessionProperties.h" #include "presto_cpp/main/types/ExpressionOptimizer.h" #include "presto_cpp/main/types/PrestoToVeloxQueryPlan.h" #include "presto_cpp/main/types/VeloxPlanConversion.h" diff --git a/presto-native-execution/presto_cpp/main/PrestoToVeloxQueryConfig.cpp b/presto-native-execution/presto_cpp/main/PrestoToVeloxQueryConfig.cpp index 0c3859b6c93e2..e7e450ad15d97 100644 --- a/presto-native-execution/presto_cpp/main/PrestoToVeloxQueryConfig.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoToVeloxQueryConfig.cpp @@ -13,8 +13,8 @@ */ #include "presto_cpp/main/PrestoToVeloxQueryConfig.h" -#include "presto_cpp/main/SessionProperties.h" #include "presto_cpp/main/common/Configs.h" +#include "presto_cpp/main/properties/session/SessionProperties.h" #include "velox/common/compression/Compression.h" #include "velox/core/QueryConfig.h" #include "velox/type/tz/TimeZoneMap.h" diff --git a/presto-native-execution/presto_cpp/main/QueryContextManager.cpp b/presto-native-execution/presto_cpp/main/QueryContextManager.cpp index 3598603c300eb..c1c3e307cb0ef 100644 --- a/presto-native-execution/presto_cpp/main/QueryContextManager.cpp +++ b/presto-native-execution/presto_cpp/main/QueryContextManager.cpp @@ -15,8 +15,8 @@ #include "presto_cpp/main/QueryContextManager.h" #include #include "presto_cpp/main/PrestoToVeloxQueryConfig.h" -#include "presto_cpp/main/SessionProperties.h" #include "presto_cpp/main/common/Configs.h" +#include "presto_cpp/main/properties/session/SessionProperties.h" #include "velox/connectors/hive/HiveConfig.h" #include "velox/core/QueryConfig.h" diff --git a/presto-native-execution/presto_cpp/main/common/Utils.cpp b/presto-native-execution/presto_cpp/main/common/Utils.cpp index 6befe209fc0b8..012d1c9b372a4 100644 --- a/presto-native-execution/presto_cpp/main/common/Utils.cpp +++ b/presto-native-execution/presto_cpp/main/common/Utils.cpp @@ -23,6 +23,10 @@ namespace facebook::presto::util { +std::string boolToLowerCaseString(bool value) { + return value ? "true" : "false"; +} + DateTime toISOTimestamp(uint64_t timeMilli) { char buf[80]; time_t timeSecond = timeMilli / 1000; diff --git a/presto-native-execution/presto_cpp/main/common/Utils.h b/presto-native-execution/presto_cpp/main/common/Utils.h index 60e0a1a4a32d7..fc6d3d21c94b3 100644 --- a/presto-native-execution/presto_cpp/main/common/Utils.h +++ b/presto-native-execution/presto_cpp/main/common/Utils.h @@ -25,6 +25,9 @@ namespace facebook::presto::util { #define PRESTO_SHUTDOWN_LOG(severity) \ LOG(severity) << PRESTO_SHUTDOWN_LOG_PREFIX +/// Convert boolean to lowercase string representation. +std::string boolToLowerCaseString(bool value); + using DateTime = std::string; DateTime toISOTimestamp(uint64_t timeMilli); diff --git a/presto-native-execution/presto_cpp/main/properties/CMakeLists.txt b/presto-native-execution/presto_cpp/main/properties/CMakeLists.txt new file mode 100644 index 0000000000000..15a18ff510afa --- /dev/null +++ b/presto-native-execution/presto_cpp/main/properties/CMakeLists.txt @@ -0,0 +1,13 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +add_subdirectory(session) diff --git a/presto-native-execution/presto_cpp/main/properties/session/CMakeLists.txt b/presto-native-execution/presto_cpp/main/properties/session/CMakeLists.txt new file mode 100644 index 0000000000000..d871682defe6c --- /dev/null +++ b/presto-native-execution/presto_cpp/main/properties/session/CMakeLists.txt @@ -0,0 +1,28 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +add_library(presto_session_properties_provider SessionPropertiesProvider.cpp) + +target_link_libraries( + presto_session_properties_provider + ${FOLLY_WITH_DEPENDENCIES} + presto_protocol + presto_common +) + +add_library(presto_session_properties SessionProperties.cpp) + +target_link_libraries(presto_session_properties presto_session_properties_provider) + +if(PRESTO_ENABLE_TESTING) + add_subdirectory(tests) +endif() diff --git a/presto-native-execution/presto_cpp/main/SessionProperties.cpp b/presto-native-execution/presto_cpp/main/properties/session/SessionProperties.cpp similarity index 92% rename from presto-native-execution/presto_cpp/main/SessionProperties.cpp rename to presto-native-execution/presto_cpp/main/properties/session/SessionProperties.cpp index ac01207a37e23..2edd61368dd3b 100644 --- a/presto-native-execution/presto_cpp/main/SessionProperties.cpp +++ b/presto-native-execution/presto_cpp/main/properties/session/SessionProperties.cpp @@ -11,36 +11,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "presto_cpp/main/SessionProperties.h" +#include "presto_cpp/main/properties/session/SessionProperties.h" +#include "presto_cpp/main/common/Utils.h" #include "velox/core/QueryConfig.h" using namespace facebook::velox; namespace facebook::presto { -namespace { -const std::string boolToString(bool value) { - return value ? "true" : "false"; -} -} // namespace - SessionProperties* SessionProperties::instance() { static std::unique_ptr instance = std::make_unique(); return instance.get(); } -void SessionProperties::addSessionProperty( - const std::string& name, - const std::string& description, - const TypePtr& type, - bool isHidden, - const std::optional veloxConfig, - const std::string& defaultValue) { - sessionProperties_[name] = std::make_shared( - name, description, type->toString(), isHidden, veloxConfig, defaultValue); -} - // List of native session properties is kept as the source of truth here. SessionProperties::SessionProperties() { using velox::core::QueryConfig; @@ -53,7 +37,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kExprEvalSimplified, - boolToString(c.exprEvalSimplified())); + util::boolToLowerCaseString(c.exprEvalSimplified())); addSessionProperty( kExprMaxArraySizeInReduce, @@ -169,7 +153,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kJoinSpillEnabled, - boolToString(c.joinSpillEnabled())); + util::boolToLowerCaseString(c.joinSpillEnabled())); addSessionProperty( kWindowSpillEnabled, @@ -177,7 +161,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kWindowSpillEnabled, - boolToString(c.windowSpillEnabled())); + util::boolToLowerCaseString(c.windowSpillEnabled())); addSessionProperty( kWriterSpillEnabled, @@ -185,7 +169,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kWriterSpillEnabled, - boolToString(c.writerSpillEnabled())); + util::boolToLowerCaseString(c.writerSpillEnabled())); addSessionProperty( kWriterFlushThresholdBytes, @@ -203,7 +187,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kRowNumberSpillEnabled, - boolToString(c.rowNumberSpillEnabled())); + util::boolToLowerCaseString(c.rowNumberSpillEnabled())); addSessionProperty( kMarkDistinctSpillEnabled, @@ -211,7 +195,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kMarkDistinctSpillEnabled, - boolToString(c.markDistinctSpillEnabled())); + util::boolToLowerCaseString(c.markDistinctSpillEnabled())); addSessionProperty( kSpillerNumPartitionBits, @@ -228,7 +212,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kTopNRowNumberSpillEnabled, - boolToString(c.topNRowNumberSpillEnabled())); + util::boolToLowerCaseString(c.topNRowNumberSpillEnabled())); addSessionProperty( kValidateOutputFromOperators, @@ -240,7 +224,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kValidateOutputFromOperators, - boolToString(c.validateOutputFromOperators())); + util::boolToLowerCaseString(c.validateOutputFromOperators())); addSessionProperty( kDebugDisableExpressionWithPeeling, @@ -249,7 +233,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kDebugDisableExpressionWithPeeling, - boolToString(c.debugDisableExpressionsWithPeeling())); + util::boolToLowerCaseString(c.debugDisableExpressionsWithPeeling())); addSessionProperty( kDebugDisableCommonSubExpressions, @@ -259,7 +243,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kDebugDisableCommonSubExpressions, - boolToString(c.debugDisableCommonSubExpressions())); + util::boolToLowerCaseString(c.debugDisableCommonSubExpressions())); addSessionProperty( kDebugDisableExpressionWithMemoization, @@ -270,7 +254,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kDebugDisableExpressionWithMemoization, - boolToString(c.debugDisableExpressionsWithMemoization())); + util::boolToLowerCaseString(c.debugDisableExpressionsWithMemoization())); addSessionProperty( kDebugDisableExpressionWithLazyInputs, @@ -280,7 +264,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kDebugDisableExpressionWithLazyInputs, - boolToString(c.debugDisableExpressionsWithLazyInputs())); + util::boolToLowerCaseString(c.debugDisableExpressionsWithLazyInputs())); addSessionProperty( kDebugMemoryPoolNameRegex, @@ -314,7 +298,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kSelectiveNimbleReaderEnabled, - boolToString(c.selectiveNimbleReaderEnabled())); + util::boolToLowerCaseString(c.selectiveNimbleReaderEnabled())); addSessionProperty( kQueryTraceEnabled, @@ -322,7 +306,7 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kQueryTraceEnabled, - boolToString(c.queryTraceEnabled())); + util::boolToLowerCaseString(c.queryTraceEnabled())); addSessionProperty( kQueryTraceDir, @@ -668,27 +652,8 @@ SessionProperties::SessionProperties() { BOOLEAN(), false, QueryConfig::kAggregationMemoryCompactionReclaimEnabled, - boolToString(c.aggregationMemoryCompactionReclaimEnabled())); -} - -const std::string SessionProperties::toVeloxConfig( - const std::string& name) const { - auto it = sessionProperties_.find(name); - if (it != sessionProperties_.end() && - it->second->getVeloxConfig().has_value()) { - return it->second->getVeloxConfig().value(); - } - return name; -} - -json SessionProperties::serialize() const { - json j = json::array(); - json tj; - for (const auto& sessionProperty : sessionProperties_) { - protocol::to_json(tj, sessionProperty.second->getMetadata()); - j.push_back(tj); - } - return j; + util::boolToLowerCaseString( + c.aggregationMemoryCompactionReclaimEnabled())); } bool SessionProperties::useVeloxGeospatialJoin() const { diff --git a/presto-native-execution/presto_cpp/main/SessionProperties.h b/presto-native-execution/presto_cpp/main/properties/session/SessionProperties.h similarity index 86% rename from presto-native-execution/presto_cpp/main/SessionProperties.h rename to presto-native-execution/presto_cpp/main/properties/session/SessionProperties.h index 29d98540b05ac..f846eb2fe9175 100644 --- a/presto-native-execution/presto_cpp/main/SessionProperties.h +++ b/presto-native-execution/presto_cpp/main/properties/session/SessionProperties.h @@ -13,65 +13,14 @@ */ #pragma once -#include "presto_cpp/external/json/nlohmann/json.hpp" -#include "presto_cpp/presto_protocol/core/presto_protocol_core.h" -#include "velox/type/Type.h" - -using json = nlohmann::json; +#include "presto_cpp/main/properties/session/SessionPropertiesProvider.h" namespace facebook::presto { -/// This is the interface of the session property. -/// Note: This interface should align with java coordinator. -class SessionProperty { - public: - SessionProperty( - const std::string& name, - const std::string& description, - const std::string& typeSignature, - bool hidden, - const std::optional veloxConfig, - const std::string& defaultValue) - : metadata_({name, description, typeSignature, defaultValue, hidden}), - veloxConfig_(veloxConfig), - value_(defaultValue) {} - - const protocol::SessionPropertyMetadata getMetadata() { - return metadata_; - } - - const std::optional getVeloxConfig() { - return veloxConfig_; - } - - const std::string getValue() { - return value_; - } - - void updateValue(const std::string& value) { - value_ = value; - } - - bool operator==(const SessionProperty& other) const { - const auto otherMetadata = other.metadata_; - return metadata_.name == otherMetadata.name && - metadata_.description == otherMetadata.description && - metadata_.typeSignature == otherMetadata.typeSignature && - metadata_.hidden == otherMetadata.hidden && - metadata_.defaultValue == otherMetadata.defaultValue && - veloxConfig_ == other.veloxConfig_; - } - - private: - const protocol::SessionPropertyMetadata metadata_; - const std::optional veloxConfig_; - std::string value_; -}; - /// Defines all system session properties supported by native worker to ensure /// that they are the source of truth and to differentiate them from Java based /// session properties. Also maps the native session properties to velox. -class SessionProperties { +class SessionProperties : public SessionPropertiesProvider { public: /// Enable simplified path in expression evaluation. static constexpr const char* kExprEvalSimplified = @@ -430,47 +379,11 @@ class SessionProperties { static constexpr const char* kAggregationMemoryCompactionReclaimEnabled = "native_aggregation_memory_compaction_reclaim_enabled"; - inline bool hasVeloxConfig(const std::string& key) { - auto sessionProperty = sessionProperties_.find(key); - if (sessionProperty == sessionProperties_.end()) { - // In this case a queryConfig is being created so we should return - // true since it will also have a veloxConfig. - return true; - } - return sessionProperty->second->getVeloxConfig().has_value(); - } - - inline void updateSessionPropertyValue( - const std::string& key, - const std::string& value) { - auto sessionProperty = sessionProperties_.find(key); - VELOX_CHECK(sessionProperty != sessionProperties_.end()); - sessionProperty->second->updateValue(value); - } - static SessionProperties* instance(); SessionProperties(); - /// Utility function to translate a config name in Presto to its equivalent in - /// Velox. Returns 'name' as is if there is no mapping. - const std::string toVeloxConfig(const std::string& name) const; - - json serialize() const; - bool useVeloxGeospatialJoin() const; - - private: - void addSessionProperty( - const std::string& name, - const std::string& description, - const velox::TypePtr& type, - bool isHidden, - const std::optional veloxConfig, - const std::string& defaultValue); - - std::unordered_map> - sessionProperties_; }; } // namespace facebook::presto diff --git a/presto-native-execution/presto_cpp/main/properties/session/SessionPropertiesProvider.cpp b/presto-native-execution/presto_cpp/main/properties/session/SessionPropertiesProvider.cpp new file mode 100644 index 0000000000000..df62dfe236150 --- /dev/null +++ b/presto-native-execution/presto_cpp/main/properties/session/SessionPropertiesProvider.cpp @@ -0,0 +1,58 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "presto_cpp/main/properties/session/SessionPropertiesProvider.h" +#include +#include "presto_cpp/main/common/Utils.h" +#include "presto_cpp/presto_protocol/core/presto_protocol_core.h" + +namespace facebook::presto { + +void SessionPropertiesProvider::addSessionProperty( + const std::string& name, + const std::string& description, + const facebook::velox::TypePtr& type, + bool isHidden, + const std::optional veloxConfig, + const std::string& defaultValue) { + sessionProperties_[name] = std::make_shared( + name, + description, + boost::algorithm::to_lower_copy(type->toString()), + isHidden, + veloxConfig, + defaultValue); +} + +const std::string SessionPropertiesProvider::toVeloxConfig( + const std::string& name) const { + auto it = sessionProperties_.find(name); + if (it != sessionProperties_.end() && + it->second->getVeloxConfig().has_value()) { + return it->second->getVeloxConfig().value(); + } + return name; +} + +json SessionPropertiesProvider::serialize() const { + json j = json::array(); + json tj; + for (const auto& sessionProperty : sessionProperties_) { + protocol::to_json(tj, sessionProperty.second->getMetadata()); + j.push_back(tj); + } + return j; +} + +} // namespace facebook::presto diff --git a/presto-native-execution/presto_cpp/main/properties/session/SessionPropertiesProvider.h b/presto-native-execution/presto_cpp/main/properties/session/SessionPropertiesProvider.h new file mode 100644 index 0000000000000..29ba325eadb49 --- /dev/null +++ b/presto-native-execution/presto_cpp/main/properties/session/SessionPropertiesProvider.h @@ -0,0 +1,123 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include "presto_cpp/external/json/nlohmann/json.hpp" +#include "presto_cpp/presto_protocol/core/presto_protocol_core.h" +#include "velox/type/Type.h" + +using json = nlohmann::json; + +namespace facebook::presto { + +/// This is the interface of the session property. +/// Note: This interface should align with java coordinator. +class SessionProperty { + public: + SessionProperty( + const std::string& name, + const std::string& description, + const std::string& typeSignature, + bool hidden, + const std::optional veloxConfig, + const std::string& defaultValue) + : metadata_({name, description, typeSignature, defaultValue, hidden}), + veloxConfig_(veloxConfig), + value_(defaultValue) {} + + const protocol::SessionPropertyMetadata getMetadata() { + return metadata_; + } + + const std::optional getVeloxConfig() { + return veloxConfig_; + } + + const std::string getValue() { + return value_; + } + + void updateValue(const std::string& value) { + value_ = value; + } + + bool operator==(const SessionProperty& other) const { + const auto otherMetadata = other.metadata_; + return metadata_.name == otherMetadata.name && + metadata_.description == otherMetadata.description && + metadata_.typeSignature == otherMetadata.typeSignature && + metadata_.hidden == otherMetadata.hidden && + metadata_.defaultValue == otherMetadata.defaultValue && + veloxConfig_ == other.veloxConfig_; + } + + private: + const protocol::SessionPropertyMetadata metadata_; + const std::optional veloxConfig_; + std::string value_; +}; + +/// Base class providing default implementations for session property +/// management. Subclasses can specialize initialization while inheriting common +/// serialization and configuration mapping functionality. +class SessionPropertiesProvider { + public: + virtual ~SessionPropertiesProvider() = default; + + /// Translate a config name to its equivalent Velox config name. + /// Returns 'name' as is if there is no mapping. + const std::string toVeloxConfig(const std::string& name) const; + + /// Serialize all properties to JSON. + json serialize() const; + + /// Check if a property has a corresponding Velox config. + inline bool hasVeloxConfig(const std::string& key) { + auto sessionProperty = sessionProperties_.find(key); + if (sessionProperty == sessionProperties_.end()) { + // In this case a queryConfig is being created so we should return + // true since it will also have a veloxConfig. + return true; + } + return sessionProperty->second->getVeloxConfig().has_value(); + } + + /// Update the value of a session property. + inline void updateSessionPropertyValue( + const std::string& key, + const std::string& value) { + auto sessionProperty = sessionProperties_.find(key); + VELOX_CHECK(sessionProperty != sessionProperties_.end()); + sessionProperty->second->updateValue(value); + } + + protected: + /// Add a session property with metadata (for use by subclasses during init). + void addSessionProperty( + const std::string& name, + const std::string& description, + const velox::TypePtr& type, + bool isHidden, + const std::optional veloxConfig, + const std::string& defaultValue); + + /// Map of session property name to SessionProperty + std::unordered_map> + sessionProperties_; +}; + +} // namespace facebook::presto diff --git a/presto-native-execution/presto_cpp/main/properties/session/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/properties/session/tests/CMakeLists.txt new file mode 100644 index 0000000000000..f7a03492f92fd --- /dev/null +++ b/presto-native-execution/presto_cpp/main/properties/session/tests/CMakeLists.txt @@ -0,0 +1,24 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +add_executable(presto_session_properties_test SessionPropertiesTest.cpp) + +add_test(NAME presto_session_properties_test COMMAND presto_session_properties_test) + +target_link_libraries( + presto_session_properties_test + presto_session_properties + presto_protocol + GTest::gmock + GTest::gtest_main + ${FOLLY_WITH_DEPENDENCIES} +) diff --git a/presto-native-execution/presto_cpp/main/tests/SessionPropertiesTest.cpp b/presto-native-execution/presto_cpp/main/properties/session/tests/SessionPropertiesTest.cpp similarity index 99% rename from presto-native-execution/presto_cpp/main/tests/SessionPropertiesTest.cpp rename to presto-native-execution/presto_cpp/main/properties/session/tests/SessionPropertiesTest.cpp index f46dd0367347c..2d8d18ddee46e 100644 --- a/presto-native-execution/presto_cpp/main/tests/SessionPropertiesTest.cpp +++ b/presto-native-execution/presto_cpp/main/properties/session/tests/SessionPropertiesTest.cpp @@ -13,7 +13,7 @@ */ #include -#include "presto_cpp/main/SessionProperties.h" +#include "presto_cpp/main/properties/session/SessionProperties.h" #include "velox/core/QueryConfig.h" using namespace facebook::presto; diff --git a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt index 4deeaeb1f9111..b31ce9cf017be 100644 --- a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt @@ -21,7 +21,6 @@ add_executable( PrestoToVeloxQueryConfigTest.cpp QueryContextCacheTest.cpp ServerOperationTest.cpp - SessionPropertiesTest.cpp TaskManagerTest.cpp QueryContextManagerTest.cpp TaskInfoTest.cpp diff --git a/presto-native-execution/presto_cpp/main/tests/PrestoToVeloxQueryConfigTest.cpp b/presto-native-execution/presto_cpp/main/tests/PrestoToVeloxQueryConfigTest.cpp index 1d7b770558918..b049ac97744b7 100644 --- a/presto-native-execution/presto_cpp/main/tests/PrestoToVeloxQueryConfigTest.cpp +++ b/presto-native-execution/presto_cpp/main/tests/PrestoToVeloxQueryConfigTest.cpp @@ -16,8 +16,8 @@ #include #include "presto_cpp/main/PrestoToVeloxQueryConfig.h" -#include "presto_cpp/main/SessionProperties.h" #include "presto_cpp/main/common/Configs.h" +#include "presto_cpp/main/properties/session/SessionProperties.h" #include "presto_cpp/presto_protocol/core/presto_protocol_core.h" #include "velox/core/QueryConfig.h" diff --git a/presto-native-execution/presto_cpp/main/types/PrestoToVeloxQueryPlan.cpp b/presto-native-execution/presto_cpp/main/types/PrestoToVeloxQueryPlan.cpp index a869d0e3a26dd..ddb990fcb39ca 100644 --- a/presto-native-execution/presto_cpp/main/types/PrestoToVeloxQueryPlan.cpp +++ b/presto-native-execution/presto_cpp/main/types/PrestoToVeloxQueryPlan.cpp @@ -28,13 +28,13 @@ #include "velox/core/Expressions.h" // clang-format on -#include "presto_cpp/main/SessionProperties.h" #include "presto_cpp/main/common/Utils.h" #include "presto_cpp/main/connectors/PrestoToVeloxConnectorUtils.h" #include "presto_cpp/main/operators/BroadcastWrite.h" #include "presto_cpp/main/operators/PartitionAndSerialize.h" #include "presto_cpp/main/operators/ShuffleRead.h" #include "presto_cpp/main/operators/ShuffleWrite.h" +#include "presto_cpp/main/properties/session/SessionProperties.h" #include "presto_cpp/main/types/TypeParser.h" #include "velox/exec/TraceUtil.h"