From 4f8c525b1cba1f661e16bdd42ec1e7f68cd76c4b Mon Sep 17 00:00:00 2001 From: wraymo Date: Tue, 25 Mar 2025 03:19:36 +0000 Subject: [PATCH 01/11] Add CLP connector native code --- .../presto_cpp/main/CMakeLists.txt | 1 + .../connectors/PrestoToVeloxConnector.cpp | 68 ++++++- .../main/connectors/PrestoToVeloxConnector.h | 29 ++- .../main/connectors/Registration.cpp | 9 + .../presto_cpp/main/tests/CMakeLists.txt | 1 + .../main/types/tests/CMakeLists.txt | 3 + .../tests/PrestoToVeloxConnectorTest.cpp | 2 + .../presto_cpp/presto_protocol/Makefile | 11 +- .../connector/clp/ClpConnectorProtocol.h | 29 +++ .../clp/presto_protocol-json-cpp.mustache | 146 +++++++++++++ .../clp/presto_protocol-json-hpp.mustache | 68 +++++++ .../connector/clp/presto_protocol_clp.cpp | 191 ++++++++++++++++++ .../connector/clp/presto_protocol_clp.h | 99 +++++++++ .../connector/clp/presto_protocol_clp.json | 121 +++++++++++ .../connector/clp/presto_protocol_clp.yml | 39 ++++ .../clp/special/ClpColumnHandle.hpp.inc | 33 +++ .../clp/special/ClpTransactionHandle.cpp.inc | 30 +++ .../clp/special/ClpTransactionHandle.hpp.inc | 28 +++ .../presto_protocol/presto_protocol.cpp | 1 + .../presto_protocol/presto_protocol.h | 1 + 20 files changed, 906 insertions(+), 4 deletions(-) create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/ClpConnectorProtocol.h create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol-json-cpp.mustache create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol-json-hpp.mustache create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.yml create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpColumnHandle.hpp.inc create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpTransactionHandle.cpp.inc create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpTransactionHandle.hpp.inc diff --git a/presto-native-execution/presto_cpp/main/CMakeLists.txt b/presto-native-execution/presto_cpp/main/CMakeLists.txt index c1f42336991bd..0336238c331d2 100644 --- a/presto-native-execution/presto_cpp/main/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/CMakeLists.txt @@ -55,6 +55,7 @@ target_link_libraries( velox_abfs velox_aggregates velox_caching + velox_clp_connector velox_common_base velox_core velox_dwio_common_exception diff --git a/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp b/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp index 52f33909d241e..e1062a9a89c59 100644 --- a/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp +++ b/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp @@ -15,11 +15,15 @@ #include "presto_cpp/main/connectors/PrestoToVeloxConnector.h" #include "presto_cpp/main/types/PrestoToVeloxExpr.h" #include "presto_cpp/main/types/TypeParser.h" +#include "presto_cpp/presto_protocol/connector/clp/ClpConnectorProtocol.h" #include "presto_cpp/presto_protocol/connector/hive/HiveConnectorProtocol.h" #include "presto_cpp/presto_protocol/connector/iceberg/IcebergConnectorProtocol.h" #include "presto_cpp/presto_protocol/connector/tpch/TpchConnectorProtocol.h" #include +#include "velox/connectors/clp/ClpColumnHandle.h" +#include "velox/connectors/clp/ClpConnectorSplit.h" +#include "velox/connectors/clp/ClpTableHandle.h" #include "velox/connectors/hive/HiveConnector.h" #include "velox/connectors/hive/HiveConnectorSplit.h" #include "velox/connectors/hive/HiveDataSink.h" @@ -1412,9 +1416,11 @@ IcebergPrestoToVeloxConnector::toVeloxColumnHandle( // constructor similar to how Hive Connector is handling for bucketing velox::type::fbhive::HiveTypeParser hiveTypeParser; auto type = stringToType(icebergColumn->type, typeParser); - connector::hive::HiveColumnHandle::ColumnParseParameters columnParseParameters; + connector::hive::HiveColumnHandle::ColumnParseParameters + columnParseParameters; if (type->isDate()) { - columnParseParameters.partitionDateValueFormat = connector::hive::HiveColumnHandle::ColumnParseParameters::kDaysSinceEpoch; + columnParseParameters.partitionDateValueFormat = connector::hive:: + HiveColumnHandle::ColumnParseParameters::kDaysSinceEpoch; } return std::make_unique( icebergColumn->columnIdentity.name, @@ -1548,4 +1554,62 @@ std::unique_ptr TpchPrestoToVeloxConnector::createConnectorProtocol() const { return std::make_unique(); } + +std::unique_ptr +ClpPrestoToVeloxConnector::toVeloxSplit( + const protocol::ConnectorId& catalogId, + const protocol::ConnectorSplit* connectorSplit, + const protocol::SplitContext* splitContext) const { + auto clpSplit = dynamic_cast(connectorSplit); + VELOX_CHECK_NOT_NULL( + clpSplit, "Unexpected split type {}", connectorSplit->_type); + return std::make_unique( + catalogId, clpSplit->path); +} + +std::unique_ptr +ClpPrestoToVeloxConnector::toVeloxColumnHandle( + const protocol::ColumnHandle* column, + const TypeParser& typeParser) const { + auto clpColumn = dynamic_cast(column); + VELOX_CHECK_NOT_NULL( + clpColumn, "Unexpected column handle type {}", column->_type); + return std::make_unique( + clpColumn->columnName, + clpColumn->originalColumnName, + typeParser.parse(clpColumn->columnType), + clpColumn->nullable); +} + +std::unique_ptr +ClpPrestoToVeloxConnector::toVeloxTableHandle( + const protocol::TableHandle& tableHandle, + const VeloxExprConverter& exprConverter, + const TypeParser& typeParser, + std::unordered_map< + std::string, + std::shared_ptr>& assignments) const { + auto clpLayout = + std::dynamic_pointer_cast( + tableHandle.connectorTableLayout); + VELOX_CHECK_NOT_NULL( + clpLayout, + "Unexpected layout type {}", + tableHandle.connectorTableLayout->_type); + auto storageType = + (clpLayout->table.storageType == protocol::clp::StorageType::S3) + ? connector::clp::ClpTableHandle::StorageType::kS3 + : connector::clp::ClpTableHandle::StorageType::kFS; + return std::make_unique( + tableHandle.connectorId, + clpLayout->table.schemaTableName.table, + storageType, + clpLayout->kqlQuery); +} + +std::unique_ptr +ClpPrestoToVeloxConnector::createConnectorProtocol() const { + return std::make_unique(); +} + } // namespace facebook::presto diff --git a/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.h b/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.h index b9a763c5b8aa6..c20fa3fd3a73e 100644 --- a/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.h +++ b/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.h @@ -13,9 +13,9 @@ */ #pragma once +#include "presto_cpp/main/types/PrestoToVeloxExpr.h" #include "presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.h" #include "presto_cpp/presto_protocol/core/ConnectorProtocol.h" -#include "presto_cpp/main/types/PrestoToVeloxExpr.h" #include "velox/connectors/Connector.h" #include "velox/connectors/hive/TableHandle.h" #include "velox/core/PlanNode.h" @@ -223,4 +223,31 @@ class TpchPrestoToVeloxConnector final : public PrestoToVeloxConnector { std::unique_ptr createConnectorProtocol() const final; }; + +class ClpPrestoToVeloxConnector final : public PrestoToVeloxConnector { + public: + explicit ClpPrestoToVeloxConnector(std::string connectorName) + : PrestoToVeloxConnector(std::move(connectorName)) {} + + std::unique_ptr toVeloxSplit( + const protocol::ConnectorId& catalogId, + const protocol::ConnectorSplit* connectorSplit, + const protocol::SplitContext* splitContext) const final; + + std::unique_ptr toVeloxColumnHandle( + const protocol::ColumnHandle* column, + const TypeParser& typeParser) const final; + + std::unique_ptr toVeloxTableHandle( + const protocol::TableHandle& tableHandle, + const VeloxExprConverter& exprConverter, + const TypeParser& typeParser, + std::unordered_map< + std::string, + std::shared_ptr>& assignments) + const final; + + std::unique_ptr createConnectorProtocol() + const final; +}; } // namespace facebook::presto diff --git a/presto-native-execution/presto_cpp/main/connectors/Registration.cpp b/presto-native-execution/presto_cpp/main/connectors/Registration.cpp index d6f6555fb8a22..2d26796cae72f 100644 --- a/presto-native-execution/presto_cpp/main/connectors/Registration.cpp +++ b/presto-native-execution/presto_cpp/main/connectors/Registration.cpp @@ -19,6 +19,7 @@ #include "presto_cpp/main/connectors/arrow_flight/ArrowPrestoToVeloxConnector.h" #endif +#include "velox/connectors/clp/ClpConnector.h" #include "velox/connectors/hive/HiveConnector.h" #include "velox/connectors/tpch/TpchConnector.h" @@ -45,6 +46,12 @@ void registerConnectorFactories() { std::make_shared()); } + if (!velox::connector::hasConnectorFactory( + velox::connector::clp::ClpConnectorFactory::kClpConnectorName)) { + velox::connector::registerConnectorFactory( + std::make_shared()); + } + // Register Velox connector factory for iceberg. // The iceberg catalog is handled by the hive connector factory. if (!velox::connector::hasConnectorFactory(kIcebergConnectorName)) { @@ -74,6 +81,8 @@ void registerConnectors() { std::make_unique(kIcebergConnectorName)); registerPrestoToVeloxConnector(std::make_unique( velox::connector::tpch::TpchConnectorFactory::kTpchConnectorName)); + registerPrestoToVeloxConnector(std::make_unique( + velox::connector::clp::ClpConnectorFactory::kClpConnectorName)); // Presto server uses system catalog or system schema in other catalogs // in different places in the code. All these resolve to the SystemConnector. diff --git a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt index 74c2dc24b495f..8638ef42e0a35 100644 --- a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt @@ -47,6 +47,7 @@ target_link_libraries( $ velox_hive_connector velox_tpch_connector + velox_clp_connector velox_presto_serializer velox_functions_prestosql velox_aggregates diff --git a/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt index 9286f3296bb09..99741b42abff2 100644 --- a/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt @@ -27,6 +27,7 @@ target_link_libraries( velox_dwio_orc_reader velox_hive_connector velox_tpch_connector + velox_clp_connector velox_exec velox_dwio_common_exception presto_type_converter @@ -64,6 +65,7 @@ target_link_libraries( velox_functions_lib velox_hive_connector velox_tpch_connector + velox_clp_connector velox_hive_partition_function velox_presto_serializer velox_serialization @@ -96,6 +98,7 @@ target_link_libraries( velox_dwio_common velox_hive_connector velox_tpch_connector + velox_clp_connector GTest::gtest GTest::gtest_main) diff --git a/presto-native-execution/presto_cpp/main/types/tests/PrestoToVeloxConnectorTest.cpp b/presto-native-execution/presto_cpp/main/types/tests/PrestoToVeloxConnectorTest.cpp index a88b235686498..9398e4b65d961 100644 --- a/presto-native-execution/presto_cpp/main/types/tests/PrestoToVeloxConnectorTest.cpp +++ b/presto-native-execution/presto_cpp/main/types/tests/PrestoToVeloxConnectorTest.cpp @@ -33,6 +33,8 @@ TEST_F(PrestoToVeloxConnectorTest, registerVariousConnectors) { "iceberg", std::make_unique("iceberg"))); connectorList.emplace_back( std::pair("tpch", std::make_unique("tpch"))); + connectorList.emplace_back( + std::pair("clp", std::make_unique("clp"))); for (auto& [connectorName, connector] : connectorList) { registerPrestoToVeloxConnector(std::move(connector)); diff --git a/presto-native-execution/presto_cpp/presto_protocol/Makefile b/presto-native-execution/presto_cpp/presto_protocol/Makefile index 09b43df28b4f5..143b2a22860ba 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/Makefile +++ b/presto-native-execution/presto_cpp/presto_protocol/Makefile @@ -52,12 +52,20 @@ presto_protocol-cpp: presto_protocol-json chevron -d connector/arrow_flight/presto_protocol_arrow_flight.json connector/arrow_flight/presto_protocol-json-hpp.mustache >> connector/arrow_flight/presto_protocol_arrow_flight.h clang-format -style=file -i connector/arrow_flight/presto_protocol_arrow_flight.h connector/arrow_flight/presto_protocol_arrow_flight.cpp -presto_protocol-json: + # build clp connector related structs + echo "// DO NOT EDIT : This file is generated by chevron" > connector/clp/presto_protocol_clp.cpp + chevron -d connector/clp/presto_protocol_clp.json connector/clp/presto_protocol-json-cpp.mustache >> connector/clp/presto_protocol_clp.cpp + echo "// DO NOT EDIT : This file is generated by chevron" > connector/clp/presto_protocol_clp.h + chevron -d connector/clp/presto_protocol_clp.json connector/clp/presto_protocol-json-hpp.mustache >> connector/clp/presto_protocol_clp.h + clang-format -style=file -i connector/clp/presto_protocol_clp.h connector/clp/presto_protocol_clp.cpp + +presto_protocol-json: ./java-to-struct-json.py --config core/presto_protocol_core.yml core/special/*.java core/special/*.inc -j | jq . > core/presto_protocol_core.json ./java-to-struct-json.py --config connector/hive/presto_protocol_hive.yml connector/hive/special/*.inc -j | jq . > connector/hive/presto_protocol_hive.json ./java-to-struct-json.py --config connector/iceberg/presto_protocol_iceberg.yml connector/iceberg/special/*.inc -j | jq . > connector/iceberg/presto_protocol_iceberg.json ./java-to-struct-json.py --config connector/tpch/presto_protocol_tpch.yml connector/tpch/special/*.inc -j | jq . > connector/tpch/presto_protocol_tpch.json ./java-to-struct-json.py --config connector/arrow_flight/presto_protocol_arrow_flight.yml connector/arrow_flight/special/*.inc -j | jq . > connector/arrow_flight/presto_protocol_arrow_flight.json + ./java-to-struct-json.py --config connector/clp/presto_protocol_clp.yml connector/clp/special/*.inc -j | jq . > connector/clp/presto_protocol_clp.json presto_protocol.proto: presto_protocol-json pystache presto_protocol-protobuf.mustache core/presto_protocol_core.json > core/presto_protocol_core.proto @@ -65,3 +73,4 @@ presto_protocol.proto: presto_protocol-json pystache presto_protocol-protobuf.mustache connector/iceberg/presto_protocol_iceberg.json > connector/iceberg/presto_protocol_iceberg.proto pystache presto_protocol-protobuf.mustache connector/tpch/presto_protocol_tpch.json > connector/tpch/presto_protocol_tpch.proto pystache presto_protocol-protobuf.mustache connector/arrow_flight/presto_protocol_arrow_flight.json > connector/arrow_flight/presto_protocol_arrow_flight.proto + pystache presto_protocol-protobuf.mustache connector/clp/presto_protocol_clp.json > connector/clp/presto_protocol_clp.proto diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/ClpConnectorProtocol.h b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/ClpConnectorProtocol.h new file mode 100644 index 0000000000000..5b1e76b4606c4 --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/ClpConnectorProtocol.h @@ -0,0 +1,29 @@ +/* + * 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 "presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h" +#include "presto_cpp/presto_protocol/core/ConnectorProtocol.h" + +namespace facebook::presto::protocol::clp { +using ClpConnectorProtocol = ConnectorProtocolTemplate< + ClpTableHandle, + ClpTableLayoutHandle, + ClpColumnHandle, + NotImplemented, + NotImplemented, + ClpSplit, + NotImplemented, + ClpTransactionHandle, + NotImplemented>; +} // namespace facebook::presto::protocol::clp diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol-json-cpp.mustache b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol-json-cpp.mustache new file mode 100644 index 0000000000000..f30beed5a875a --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol-json-cpp.mustache @@ -0,0 +1,146 @@ +/* + * 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. + */ +// presto_protocol.prolog.cpp +// + +{{#.}} +{{#comment}} +{{comment}} +{{/comment}} +{{/.}} + + +#include "presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h" +using namespace std::string_literals; + +namespace facebook::presto::protocol::clp { + +void to_json(json& j, const ClpTransactionHandle& p) { + j = json::array(); + j.push_back(p._type); + j.push_back(p.instance); +} + +void from_json(const json& j, ClpTransactionHandle& p) { + j[0].get_to(p._type); + j[1].get_to(p.instance); +} +} // namespace facebook::presto::protocol +{{#.}} +{{#cinc}} +{{&cinc}} +{{/cinc}} +{{^cinc}} +{{#struct}} +namespace facebook::presto::protocol::clp { + {{#super_class}} + {{&class_name}}::{{&class_name}}() noexcept { + _type = "{{json_key}}"; + } + {{/super_class}} + + void to_json(json& j, const {{&class_name}}& p) { + j = json::object(); + {{#super_class}} + j["@type"] = "{{&json_key}}"; + {{/super_class}} + {{#fields}} + to_json_key(j, "{{&field_name}}", p.{{field_name}}, "{{&class_name}}", "{{&field_text}}", "{{&field_name}}"); + {{/fields}} + } + + void from_json(const json& j, {{&class_name}}& p) { + {{#super_class}} + p._type = j["@type"]; + {{/super_class}} + {{#fields}} + from_json_key(j, "{{&field_name}}", p.{{field_name}}, "{{&class_name}}", "{{&field_text}}", "{{&field_name}}"); + {{/fields}} + } +} +{{/struct}} +{{#enum}} +namespace facebook::presto::protocol::clp { + //Loosly copied this here from NLOHMANN_JSON_SERIALIZE_ENUM() + + // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays + static const std::pair<{{&class_name}}, json> + {{&class_name}}_enum_table[] = { // NOLINT: cert-err58-cpp + {{#elements}} + { {{&class_name}}::{{&element}}, "{{&element}}" }{{^_last}},{{/_last}} + {{/elements}} + }; + void to_json(json& j, const {{&class_name}}& e) + { + static_assert(std::is_enum<{{&class_name}}>::value, "{{&class_name}} must be an enum!"); + const auto* it = std::find_if(std::begin({{&class_name}}_enum_table), std::end({{&class_name}}_enum_table), + [e](const std::pair<{{&class_name}}, json>& ej_pair) -> bool + { + return ej_pair.first == e; + }); + j = ((it != std::end({{&class_name}}_enum_table)) ? it : std::begin({{&class_name}}_enum_table))->second; + } + void from_json(const json& j, {{&class_name}}& e) + { + static_assert(std::is_enum<{{&class_name}}>::value, "{{&class_name}} must be an enum!"); + const auto* it = std::find_if(std::begin({{&class_name}}_enum_table), std::end({{&class_name}}_enum_table), + [&j](const std::pair<{{&class_name}}, json>& ej_pair) -> bool + { + return ej_pair.second == j; + }); + e = ((it != std::end({{&class_name}}_enum_table)) ? it : std::begin({{&class_name}}_enum_table))->first; + } +} +{{/enum}} +{{#abstract}} +namespace facebook::presto::protocol::clp { + void to_json(json& j, const std::shared_ptr<{{&class_name}}>& p) { + if ( p == nullptr ) { + return; + } + String type = p->_type; + + {{#subclasses}} + if ( type == "{{&key}}" ) { + j = *std::static_pointer_cast<{{&type}}>(p); + return; + } + {{/subclasses}} + + throw TypeError(type + " no abstract type {{&class_name}} {{&key}}"); + } + + void from_json(const json& j, std::shared_ptr<{{&class_name}}>& p) { + String type; + try { + type = p->getSubclassKey(j); + } catch (json::parse_error &e) { + throw ParseError(std::string(e.what()) + " {{&class_name}} {{&key}} {{&class_name}}"); + } + + {{#subclasses}} + if ( type == "{{&key}}" ) { + std::shared_ptr<{{&type}}> k = std::make_shared<{{&type}}>(); + j.get_to(*k); + p = std::static_pointer_cast<{{&class_name}}>(k); + return; + } + {{/subclasses}} + + throw TypeError(type + " no abstract type {{&class_name}} {{&key}}"); + } +} +{{/abstract}} +{{/cinc}} +{{/.}} diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol-json-hpp.mustache b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol-json-hpp.mustache new file mode 100644 index 0000000000000..f903bd681a5c2 --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol-json-hpp.mustache @@ -0,0 +1,68 @@ +/* + * 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 + +{{#.}} +{{#comment}} +{{comment}} +{{/comment}} +{{/.}} + +#include +#include + +#include "presto_cpp/external/json/nlohmann/json.hpp" +#include "presto_cpp/presto_protocol/core/presto_protocol_core.h" + +namespace facebook::presto::protocol::clp { +struct ClpTransactionHandle : public ConnectorTransactionHandle { + String instance = {}; + }; +void to_json(json& j, const ClpTransactionHandle& p); + +void from_json(const json& j, ClpTransactionHandle& p); +} //namespace facebook::presto::protocol +{{#.}} +{{#hinc}} +{{&hinc}} +{{/hinc}} +{{^hinc}} +{{#struct}} +namespace facebook::presto::protocol::clp { + struct {{class_name}} {{#super_class}}: public {{super_class}}{{/super_class}}{ + {{#fields}} + {{#field_local}}{{#optional}}std::shared_ptr<{{/optional}}{{&field_text}}{{#optional}}>{{/optional}} {{&field_name}} = {};{{/field_local}} + {{/fields}} + + {{#super_class}} + {{class_name}}() noexcept; + {{/super_class}} + }; + void to_json(json& j, const {{class_name}}& p); + void from_json(const json& j, {{class_name}}& p); +} +{{/struct}} +{{#enum}} +namespace facebook::presto::protocol::clp { + enum class {{class_name}} { + {{#elements}} + {{&element}}{{^_last}},{{/_last}} + {{/elements}} + }; + extern void to_json(json& j, const {{class_name}}& e); + extern void from_json(const json& j, {{class_name}}& e); +} +{{/enum}} +{{/hinc}} +{{/.}} diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp new file mode 100644 index 0000000000000..0356d2dbc946b --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp @@ -0,0 +1,191 @@ +// DO NOT EDIT : This file is generated by chevron +/* + * 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. + */ +// presto_protocol.prolog.cpp +// + +// This file is generated DO NOT EDIT @generated + +#include "presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h" +using namespace std::string_literals; + +namespace facebook::presto::protocol::clp { + +void to_json(json& j, const ClpTransactionHandle& p) { + j = json::array(); + j.push_back(p._type); + j.push_back(p.instance); +} + +void from_json(const json& j, ClpTransactionHandle& p) { + j[0].get_to(p._type); + j[1].get_to(p.instance); +} +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +ClpColumnHandle::ClpColumnHandle() noexcept { + _type = "clp"; +} + +void to_json(json& j, const ClpColumnHandle& p) { + j = json::object(); + j["@type"] = "clp"; + to_json_key( + j, "columnName", p.columnName, "ClpColumnHandle", "String", "columnName"); + to_json_key( + j, + "originalColumnName", + p.originalColumnName, + "ClpColumnHandle", + "String", + "originalColumnName"); + to_json_key( + j, "columnType", p.columnType, "ClpColumnHandle", "Type", "columnType"); + to_json_key(j, "nullable", p.nullable, "ClpColumnHandle", "bool", "nullable"); +} + +void from_json(const json& j, ClpColumnHandle& p) { + p._type = j["@type"]; + from_json_key( + j, "columnName", p.columnName, "ClpColumnHandle", "String", "columnName"); + from_json_key( + j, + "originalColumnName", + p.originalColumnName, + "ClpColumnHandle", + "String", + "originalColumnName"); + from_json_key( + j, "columnType", p.columnType, "ClpColumnHandle", "Type", "columnType"); + from_json_key( + j, "nullable", p.nullable, "ClpColumnHandle", "bool", "nullable"); +} +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +ClpSplit::ClpSplit() noexcept { + _type = "clp"; +} + +void to_json(json& j, const ClpSplit& p) { + j = json::object(); + j["@type"] = "clp"; + to_json_key(j, "path", p.path, "ClpSplit", "String", "path"); +} + +void from_json(const json& j, ClpSplit& p) { + p._type = j["@type"]; + from_json_key(j, "path", p.path, "ClpSplit", "String", "path"); +} +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +// Loosly copied this here from NLOHMANN_JSON_SERIALIZE_ENUM() + +// NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays +static const std::pair StorageType_enum_table[] = + { // NOLINT: cert-err58-cpp + {StorageType::FS, "FS"}, + {StorageType::S3, "S3"}}; +void to_json(json& j, const StorageType& e) { + static_assert( + std::is_enum::value, "StorageType must be an enum!"); + const auto* it = std::find_if( + std::begin(StorageType_enum_table), + std::end(StorageType_enum_table), + [e](const std::pair& ej_pair) -> bool { + return ej_pair.first == e; + }); + j = ((it != std::end(StorageType_enum_table)) + ? it + : std::begin(StorageType_enum_table)) + ->second; +} +void from_json(const json& j, StorageType& e) { + static_assert( + std::is_enum::value, "StorageType must be an enum!"); + const auto* it = std::find_if( + std::begin(StorageType_enum_table), + std::end(StorageType_enum_table), + [&j](const std::pair& ej_pair) -> bool { + return ej_pair.second == j; + }); + e = ((it != std::end(StorageType_enum_table)) + ? it + : std::begin(StorageType_enum_table)) + ->first; +} +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +ClpTableHandle::ClpTableHandle() noexcept { + _type = "clp"; +} + +void to_json(json& j, const ClpTableHandle& p) { + j = json::object(); + j["@type"] = "clp"; + to_json_key( + j, + "schemaTableName", + p.schemaTableName, + "ClpTableHandle", + "SchemaTableName", + "schemaTableName"); + to_json_key( + j, + "storageType", + p.storageType, + "ClpTableHandle", + "StorageType", + "storageType"); +} + +void from_json(const json& j, ClpTableHandle& p) { + p._type = j["@type"]; + from_json_key( + j, + "schemaTableName", + p.schemaTableName, + "ClpTableHandle", + "SchemaTableName", + "schemaTableName"); + from_json_key( + j, + "storageType", + p.storageType, + "ClpTableHandle", + "StorageType", + "storageType"); +} +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +ClpTableLayoutHandle::ClpTableLayoutHandle() noexcept { + _type = "clp"; +} + +void to_json(json& j, const ClpTableLayoutHandle& p) { + j = json::object(); + j["@type"] = "clp"; + to_json_key( + j, "table", p.table, "ClpTableLayoutHandle", "ClpTableHandle", "table"); + to_json_key( + j, "kqlQuery", p.kqlQuery, "ClpTableLayoutHandle", "String", "kqlQuery"); +} + +void from_json(const json& j, ClpTableLayoutHandle& p) { + p._type = j["@type"]; + from_json_key( + j, "table", p.table, "ClpTableLayoutHandle", "ClpTableHandle", "table"); + from_json_key( + j, "kqlQuery", p.kqlQuery, "ClpTableLayoutHandle", "String", "kqlQuery"); +} +} // namespace facebook::presto::protocol::clp diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h new file mode 100644 index 0000000000000..7bbe0b97730fc --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h @@ -0,0 +1,99 @@ +// DO NOT EDIT : This file is generated by chevron +/* + * 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 + +// This file is generated DO NOT EDIT @generated + +#include +#include + +#include "presto_cpp/external/json/nlohmann/json.hpp" +#include "presto_cpp/presto_protocol/core/presto_protocol_core.h" + +namespace facebook::presto::protocol::clp { +struct ClpTransactionHandle : public ConnectorTransactionHandle { + String instance = {}; +}; +void to_json(json& j, const ClpTransactionHandle& p); + +void from_json(const json& j, ClpTransactionHandle& p); +} // namespace facebook::presto::protocol::clp +/* + * 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. + */ + +// ClpColumnHandle is special since it needs an implementation of +// operator<(). + +namespace facebook::presto::protocol::clp { +struct ClpColumnHandle : public ColumnHandle { + String columnName = {}; + String originalColumnName = {}; + Type columnType = {}; + boolean nullable = {}; + + ClpColumnHandle() noexcept; + + bool operator<(const ColumnHandle& o) const override { + return columnName < dynamic_cast(o).columnName; + } +}; +void to_json(json& j, const ClpColumnHandle& p); +void from_json(const json& j, ClpColumnHandle& p); +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +struct ClpSplit : public ConnectorSplit { + String path = {}; + + ClpSplit() noexcept; +}; +void to_json(json& j, const ClpSplit& p); +void from_json(const json& j, ClpSplit& p); +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +enum class StorageType { FS, S3 }; +extern void to_json(json& j, const StorageType& e); +extern void from_json(const json& j, StorageType& e); +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +struct ClpTableHandle : public ConnectorTableHandle { + SchemaTableName schemaTableName = {}; + StorageType storageType = {}; + + ClpTableHandle() noexcept; +}; +void to_json(json& j, const ClpTableHandle& p); +void from_json(const json& j, ClpTableHandle& p); +} // namespace facebook::presto::protocol::clp +namespace facebook::presto::protocol::clp { +struct ClpTableLayoutHandle : public ConnectorTableLayoutHandle { + ClpTableHandle table = {}; + std::shared_ptr kqlQuery = {}; + + ClpTableLayoutHandle() noexcept; +}; +void to_json(json& j, const ClpTableLayoutHandle& p); +void from_json(const json& j, ClpTableLayoutHandle& p); +} // namespace facebook::presto::protocol::clp diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json new file mode 100644 index 0000000000000..a565e25f40767 --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json @@ -0,0 +1,121 @@ +[ + { + "comment": "// This file is generated DO NOT EDIT @generated" + }, + { + "class_name": "ClpColumnHandle", + "hinc": "/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ClpColumnHandle is special since it needs an implementation of\n// operator<().\n\nnamespace facebook::presto::protocol::clp {\nstruct ClpColumnHandle : public ColumnHandle {\n String columnName = {};\n String originalColumnName = {};\n Type columnType = {};\n boolean nullable = {};\n\n ClpColumnHandle() noexcept;\n\n bool operator<(const ColumnHandle& o) const override {\n return columnName < dynamic_cast(o).columnName;\n }\n};\nvoid to_json(json& j, const ClpColumnHandle& p);\nvoid from_json(const json& j, ClpColumnHandle& p);\n} // namespace facebook::presto::protocol::clp", + "struct": true, + "fields": [ + { + "field_type": "String", + "field_name": "columnName", + "field_text": "String", + "_N": 1, + "field_local": true + }, + { + "field_type": "String", + "field_name": "originalColumnName", + "field_text": "String", + "_N": 2, + "field_local": true + }, + { + "field_type": "Type", + "field_name": "columnType", + "field_text": "Type", + "_N": 3, + "field_local": true + }, + { + "field_type": "boolean", + "field_name": "nullable", + "field_text": "bool", + "_N": 4, + "field_local": true + } + ], + "subclass": true, + "super_class": "ColumnHandle", + "json_key": "clp" + }, + { + "class_name": "ClpSplit", + "struct": true, + "fields": [ + { + "field_type": "String", + "field_name": "path", + "field_text": "String", + "_N": 1, + "field_local": true + } + ], + "subclass": true, + "super_class": "ConnectorSplit", + "json_key": "clp" + }, + { + "class_name": "StorageType", + "enum": true, + "elements": [ + { + "element": "FS", + "_N": 1 + }, + { + "element": "S3", + "_N": 2, + "_last": true + } + ] + }, + { + "class_name": "ClpTableHandle", + "struct": true, + "fields": [ + { + "field_type": "SchemaTableName", + "field_name": "schemaTableName", + "field_text": "SchemaTableName", + "_N": 1, + "field_local": true + }, + { + "field_type": "StorageType", + "field_name": "storageType", + "field_text": "StorageType", + "_N": 2, + "field_local": true + } + ], + "subclass": true, + "super_class": "ConnectorTableHandle", + "json_key": "clp" + }, + { + "class_name": "ClpTableLayoutHandle", + "struct": true, + "fields": [ + { + "field_type": "ClpTableHandle", + "field_name": "table", + "field_text": "ClpTableHandle", + "_N": 1, + "field_local": true + }, + { + "field_type": "Optional", + "field_name": "kqlQuery", + "field_text": "String", + "optional": true, + "_N": 2, + "field_local": true + } + ], + "subclass": true, + "super_class": "ConnectorTableLayoutHandle", + "json_key": "clp" + } +] diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.yml b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.yml new file mode 100644 index 0000000000000..18fb7467967ba --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.yml @@ -0,0 +1,39 @@ +# 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. + +AbstractClasses: + ColumnHandle: + super: JsonEncodedSubclass + comparable: true + subclasses: + - { name: ClpColumnHandle, key: clp } + + ConnectorTableHandle: + super: JsonEncodedSubclass + subclasses: + - { name: ClpTableHandle, key: clp } + + ConnectorTableLayoutHandle: + super: JsonEncodedSubclass + subclasses: + - { name: ClpTableLayoutHandle, key: clp } + + ConnectorSplit: + super: JsonEncodedSubclass + subclasses: + - { name: ClpSplit, key: clp } + +JavaClasses: + - presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpColumnHandle.java + - presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpTableHandle.java + - presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpTableLayoutHandle.java + - presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpSplit.java diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpColumnHandle.hpp.inc b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpColumnHandle.hpp.inc new file mode 100644 index 0000000000000..bb076b8ff23db --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpColumnHandle.hpp.inc @@ -0,0 +1,33 @@ +/* + * 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. + */ + +// ClpColumnHandle is special since it needs an implementation of +// operator<(). + +namespace facebook::presto::protocol::clp { +struct ClpColumnHandle : public ColumnHandle { + String columnName = {}; + String originalColumnName = {}; + Type columnType = {}; + boolean nullable = {}; + + ClpColumnHandle() noexcept; + + bool operator<(const ColumnHandle& o) const override { + return columnName < dynamic_cast(o).columnName; + } +}; +void to_json(json& j, const ClpColumnHandle& p); +void from_json(const json& j, ClpColumnHandle& p); +} // namespace facebook::presto::protocol::clp diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpTransactionHandle.cpp.inc b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpTransactionHandle.cpp.inc new file mode 100644 index 0000000000000..a753f42ab61f1 --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpTransactionHandle.cpp.inc @@ -0,0 +1,30 @@ +/* + * 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. + */ + +// ClpTransactionHandle is special since +// the corresponding class in Java is an enum. + +namespace facebook::presto::protocol::clp { + +void to_json(json& j, const ClpTransactionHandle& p) { + j = json::array(); + j.push_back(p._type); + j.push_back(p.instance); +} + +void from_json(const json& j, ClpTransactionHandle& p) { + j[0].get_to(p._type); + j[1].get_to(p.instance); +} +} // namespace facebook::presto::protocol::clp diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpTransactionHandle.hpp.inc b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpTransactionHandle.hpp.inc new file mode 100644 index 0000000000000..fc873366389eb --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/special/ClpTransactionHandle.hpp.inc @@ -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. + */ + +// ClpTransactionHandle is special since +// the corresponding class in Java is an enum. + +namespace facebook::presto::protocol::clp { + +struct ClpTransactionHandle : public ConnectorTransactionHandle { + String instance = {}; +}; + +void to_json(json& j, const ClpTransactionHandle& p); + +void from_json(const json& j, ClpTransactionHandle& p); + +} // namespace facebook::presto::protocol::clp diff --git a/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.cpp b/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.cpp index 24f24f27f87a3..0c0362ac434eb 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.cpp @@ -16,6 +16,7 @@ // DEPRECATED: This file is deprecated and will be removed in future versions. #include "presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.cpp" +#include "presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp" #include "presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp" #include "presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp" #include "presto_cpp/presto_protocol/connector/tpch/presto_protocol_tpch.cpp" diff --git a/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.h b/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.h index c43ec92629f44..ba3bf29d4648f 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.h +++ b/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.h @@ -17,6 +17,7 @@ // DEPRECATED: This file is deprecated and will be removed in future versions. #include "presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.h" +#include "presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h" #include "presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.h" #include "presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.h" #include "presto_cpp/presto_protocol/connector/tpch/presto_protocol_tpch.h" From 754026b78be76a02d9cc879f75b61ee65be9ad6b Mon Sep 17 00:00:00 2001 From: wraymo Date: Tue, 8 Jul 2025 09:31:56 -0400 Subject: [PATCH 02/11] update protocol code --- .../connector/clp/presto_protocol_clp.cpp | 65 +++++-------------- .../connector/clp/presto_protocol_clp.h | 22 +------ .../connector/clp/presto_protocol_clp.json | 31 ++++----- .../presto_protocol/java-to-struct-json.py | 2 +- 4 files changed, 31 insertions(+), 89 deletions(-) diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp index 0356d2dbc946b..aa47514132c2b 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp @@ -89,43 +89,6 @@ void from_json(const json& j, ClpSplit& p) { } } // namespace facebook::presto::protocol::clp namespace facebook::presto::protocol::clp { -// Loosly copied this here from NLOHMANN_JSON_SERIALIZE_ENUM() - -// NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays -static const std::pair StorageType_enum_table[] = - { // NOLINT: cert-err58-cpp - {StorageType::FS, "FS"}, - {StorageType::S3, "S3"}}; -void to_json(json& j, const StorageType& e) { - static_assert( - std::is_enum::value, "StorageType must be an enum!"); - const auto* it = std::find_if( - std::begin(StorageType_enum_table), - std::end(StorageType_enum_table), - [e](const std::pair& ej_pair) -> bool { - return ej_pair.first == e; - }); - j = ((it != std::end(StorageType_enum_table)) - ? it - : std::begin(StorageType_enum_table)) - ->second; -} -void from_json(const json& j, StorageType& e) { - static_assert( - std::is_enum::value, "StorageType must be an enum!"); - const auto* it = std::find_if( - std::begin(StorageType_enum_table), - std::end(StorageType_enum_table), - [&j](const std::pair& ej_pair) -> bool { - return ej_pair.second == j; - }); - e = ((it != std::end(StorageType_enum_table)) - ? it - : std::begin(StorageType_enum_table)) - ->first; -} -} // namespace facebook::presto::protocol::clp -namespace facebook::presto::protocol::clp { ClpTableHandle::ClpTableHandle() noexcept { _type = "clp"; } @@ -141,12 +104,7 @@ void to_json(json& j, const ClpTableHandle& p) { "SchemaTableName", "schemaTableName"); to_json_key( - j, - "storageType", - p.storageType, - "ClpTableHandle", - "StorageType", - "storageType"); + j, "tablePath", p.tablePath, "ClpTableHandle", "String", "tablePath"); } void from_json(const json& j, ClpTableHandle& p) { @@ -159,12 +117,7 @@ void from_json(const json& j, ClpTableHandle& p) { "SchemaTableName", "schemaTableName"); from_json_key( - j, - "storageType", - p.storageType, - "ClpTableHandle", - "StorageType", - "storageType"); + j, "tablePath", p.tablePath, "ClpTableHandle", "String", "tablePath"); } } // namespace facebook::presto::protocol::clp namespace facebook::presto::protocol::clp { @@ -179,6 +132,13 @@ void to_json(json& j, const ClpTableLayoutHandle& p) { j, "table", p.table, "ClpTableLayoutHandle", "ClpTableHandle", "table"); to_json_key( j, "kqlQuery", p.kqlQuery, "ClpTableLayoutHandle", "String", "kqlQuery"); + to_json_key( + j, + "metadataFilterQuery", + p.metadataFilterQuery, + "ClpTableLayoutHandle", + "String", + "metadataFilterQuery"); } void from_json(const json& j, ClpTableLayoutHandle& p) { @@ -187,5 +147,12 @@ void from_json(const json& j, ClpTableLayoutHandle& p) { j, "table", p.table, "ClpTableLayoutHandle", "ClpTableHandle", "table"); from_json_key( j, "kqlQuery", p.kqlQuery, "ClpTableLayoutHandle", "String", "kqlQuery"); + from_json_key( + j, + "metadataFilterQuery", + p.metadataFilterQuery, + "ClpTableLayoutHandle", + "String", + "metadataFilterQuery"); } } // namespace facebook::presto::protocol::clp diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h index 7bbe0b97730fc..6fc9e3dd5ac2c 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h @@ -30,20 +30,6 @@ void to_json(json& j, const ClpTransactionHandle& p); void from_json(const json& j, ClpTransactionHandle& p); } // namespace facebook::presto::protocol::clp -/* - * 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. - */ - // ClpColumnHandle is special since it needs an implementation of // operator<(). @@ -73,14 +59,9 @@ void to_json(json& j, const ClpSplit& p); void from_json(const json& j, ClpSplit& p); } // namespace facebook::presto::protocol::clp namespace facebook::presto::protocol::clp { -enum class StorageType { FS, S3 }; -extern void to_json(json& j, const StorageType& e); -extern void from_json(const json& j, StorageType& e); -} // namespace facebook::presto::protocol::clp -namespace facebook::presto::protocol::clp { struct ClpTableHandle : public ConnectorTableHandle { SchemaTableName schemaTableName = {}; - StorageType storageType = {}; + String tablePath = {}; ClpTableHandle() noexcept; }; @@ -91,6 +72,7 @@ namespace facebook::presto::protocol::clp { struct ClpTableLayoutHandle : public ConnectorTableLayoutHandle { ClpTableHandle table = {}; std::shared_ptr kqlQuery = {}; + std::shared_ptr metadataFilterQuery = {}; ClpTableLayoutHandle() noexcept; }; diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json index a565e25f40767..6d73bc0c22128 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json @@ -4,7 +4,7 @@ }, { "class_name": "ClpColumnHandle", - "hinc": "/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ClpColumnHandle is special since it needs an implementation of\n// operator<().\n\nnamespace facebook::presto::protocol::clp {\nstruct ClpColumnHandle : public ColumnHandle {\n String columnName = {};\n String originalColumnName = {};\n Type columnType = {};\n boolean nullable = {};\n\n ClpColumnHandle() noexcept;\n\n bool operator<(const ColumnHandle& o) const override {\n return columnName < dynamic_cast(o).columnName;\n }\n};\nvoid to_json(json& j, const ClpColumnHandle& p);\nvoid from_json(const json& j, ClpColumnHandle& p);\n} // namespace facebook::presto::protocol::clp", + "hinc": "// ClpColumnHandle is special since it needs an implementation of\n// operator<().\n\nnamespace facebook::presto::protocol::clp {\nstruct ClpColumnHandle : public ColumnHandle {\n String columnName = {};\n String originalColumnName = {};\n Type columnType = {};\n boolean nullable = {};\n\n ClpColumnHandle() noexcept;\n\n bool operator<(const ColumnHandle& o) const override {\n return columnName < dynamic_cast(o).columnName;\n }\n};\nvoid to_json(json& j, const ClpColumnHandle& p);\nvoid from_json(const json& j, ClpColumnHandle& p);\n} // namespace facebook::presto::protocol::clp", "struct": true, "fields": [ { @@ -56,21 +56,6 @@ "super_class": "ConnectorSplit", "json_key": "clp" }, - { - "class_name": "StorageType", - "enum": true, - "elements": [ - { - "element": "FS", - "_N": 1 - }, - { - "element": "S3", - "_N": 2, - "_last": true - } - ] - }, { "class_name": "ClpTableHandle", "struct": true, @@ -83,9 +68,9 @@ "field_local": true }, { - "field_type": "StorageType", - "field_name": "storageType", - "field_text": "StorageType", + "field_type": "String", + "field_name": "tablePath", + "field_text": "String", "_N": 2, "field_local": true } @@ -112,6 +97,14 @@ "optional": true, "_N": 2, "field_local": true + }, + { + "field_type": "Optional", + "field_name": "metadataFilterQuery", + "field_text": "String", + "optional": true, + "_N": 3, + "field_local": true } ], "subclass": true, diff --git a/presto-native-execution/presto_cpp/presto_protocol/java-to-struct-json.py b/presto-native-execution/presto_cpp/presto_protocol/java-to-struct-json.py index 98888d194f7b2..0f39c41e1cf44 100755 --- a/presto-native-execution/presto_cpp/presto_protocol/java-to-struct-json.py +++ b/presto-native-execution/presto_cpp/presto_protocol/java-to-struct-json.py @@ -170,7 +170,7 @@ def member_name(name): def special(filepath, current_class, key, classes, depends): classes[current_class].class_name = current_class (status, stdout, stderr) = classes[current_class][key] = util.run( - "../../velox/scripts/license-header.py --header ../../license.header --remove " + "../../velox/scripts/checks/license-header.py --header ../../license.header --remove " + filepath ) classes[current_class][key] = stdout From af78eb3db22febf5130d08ca789a934621d190a4 Mon Sep 17 00:00:00 2001 From: wraymo Date: Tue, 8 Jul 2025 16:39:08 -0400 Subject: [PATCH 03/11] fix storageType --- .../presto_cpp/main/connectors/PrestoToVeloxConnector.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp b/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp index e1062a9a89c59..beee96f467c6f 100644 --- a/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp +++ b/presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp @@ -1596,14 +1596,9 @@ ClpPrestoToVeloxConnector::toVeloxTableHandle( clpLayout, "Unexpected layout type {}", tableHandle.connectorTableLayout->_type); - auto storageType = - (clpLayout->table.storageType == protocol::clp::StorageType::S3) - ? connector::clp::ClpTableHandle::StorageType::kS3 - : connector::clp::ClpTableHandle::StorageType::kFS; return std::make_unique( tableHandle.connectorId, clpLayout->table.schemaTableName.table, - storageType, clpLayout->kqlQuery); } From 7f45c1b7a6fd337a474d08ac7010f257b1284d67 Mon Sep 17 00:00:00 2001 From: wraymo Date: Thu, 10 Jul 2025 09:29:16 -0400 Subject: [PATCH 04/11] fix indent --- .../presto_cpp/presto_protocol/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/presto-native-execution/presto_cpp/presto_protocol/Makefile b/presto-native-execution/presto_cpp/presto_protocol/Makefile index 143b2a22860ba..f9a7a228ca717 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/Makefile +++ b/presto-native-execution/presto_cpp/presto_protocol/Makefile @@ -53,11 +53,11 @@ presto_protocol-cpp: presto_protocol-json clang-format -style=file -i connector/arrow_flight/presto_protocol_arrow_flight.h connector/arrow_flight/presto_protocol_arrow_flight.cpp # build clp connector related structs - echo "// DO NOT EDIT : This file is generated by chevron" > connector/clp/presto_protocol_clp.cpp - chevron -d connector/clp/presto_protocol_clp.json connector/clp/presto_protocol-json-cpp.mustache >> connector/clp/presto_protocol_clp.cpp - echo "// DO NOT EDIT : This file is generated by chevron" > connector/clp/presto_protocol_clp.h - chevron -d connector/clp/presto_protocol_clp.json connector/clp/presto_protocol-json-hpp.mustache >> connector/clp/presto_protocol_clp.h - clang-format -style=file -i connector/clp/presto_protocol_clp.h connector/clp/presto_protocol_clp.cpp + echo "// DO NOT EDIT : This file is generated by chevron" > connector/clp/presto_protocol_clp.cpp + chevron -d connector/clp/presto_protocol_clp.json connector/clp/presto_protocol-json-cpp.mustache >> connector/clp/presto_protocol_clp.cpp + echo "// DO NOT EDIT : This file is generated by chevron" > connector/clp/presto_protocol_clp.h + chevron -d connector/clp/presto_protocol_clp.json connector/clp/presto_protocol-json-hpp.mustache >> connector/clp/presto_protocol_clp.h + clang-format -style=file -i connector/clp/presto_protocol_clp.h connector/clp/presto_protocol_clp.cpp presto_protocol-json: ./java-to-struct-json.py --config core/presto_protocol_core.yml core/special/*.java core/special/*.inc -j | jq . > core/presto_protocol_core.json From d2a5fd2208f567f1f98b45d18d3a09b8c456c6f0 Mon Sep 17 00:00:00 2001 From: wraymo Date: Thu, 10 Jul 2025 10:14:03 -0400 Subject: [PATCH 05/11] advance velox --- presto-native-execution/velox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presto-native-execution/velox b/presto-native-execution/velox index 52f4e376b2b7b..749d28944723a 160000 --- a/presto-native-execution/velox +++ b/presto-native-execution/velox @@ -1 +1 @@ -Subproject commit 52f4e376b2b7baf61b22a857f719cbe856bd9c0e +Subproject commit 749d28944723ad746b60ca7073f42b3df9896ff4 From f118e47d8a822e56b2d2970de352ba40baaa7155 Mon Sep 17 00:00:00 2001 From: wraymo Date: Thu, 10 Jul 2025 15:23:05 -0400 Subject: [PATCH 06/11] add a flag --- presto-native-execution/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/presto-native-execution/CMakeLists.txt b/presto-native-execution/CMakeLists.txt index f6d6950c00983..f9b2da3f2c9cf 100644 --- a/presto-native-execution/CMakeLists.txt +++ b/presto-native-execution/CMakeLists.txt @@ -31,7 +31,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}") # Known warnings that are benign can be disabled. set(DISABLED_WARNINGS - "-Wno-nullability-completeness -Wno-deprecated-declarations") + "-Wno-nullability-completeness \ + -Wno-deprecated-declarations \ + -Wno-restrict") # Important warnings that must be explicitly enabled. set(ENABLE_WARNINGS "-Wreorder") From cfd3ad149ae61be248ca9e814749a7d0c9414ffe Mon Sep 17 00:00:00 2001 From: wraymo Date: Thu, 10 Jul 2025 20:23:57 -0400 Subject: [PATCH 07/11] try fix --- presto-native-execution/presto_cpp/main/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/presto-native-execution/presto_cpp/main/CMakeLists.txt b/presto-native-execution/presto_cpp/main/CMakeLists.txt index 0336238c331d2..b072a92990ba0 100644 --- a/presto-native-execution/presto_cpp/main/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/CMakeLists.txt @@ -55,7 +55,6 @@ target_link_libraries( velox_abfs velox_aggregates velox_caching - velox_clp_connector velox_common_base velox_core velox_dwio_common_exception @@ -116,7 +115,8 @@ add_executable(presto_server PrestoMain.cpp) # However, we also would need to add its dependencies (tpch_gen etc). # TODO change the target in Velox to a library target then we can move this to the # presto_server_lib. -target_link_libraries(presto_server presto_server_lib velox_tpch_connector) +target_link_libraries(presto_server presto_server_lib velox_tpch_connector + velox_clp_connector) # Clang requires explicit linking with libatomic. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" From 50563eee99ef45bfc660aa51c0cb9b2a8434a666 Mon Sep 17 00:00:00 2001 From: anlowee Date: Fri, 11 Jul 2025 11:27:28 -0400 Subject: [PATCH 08/11] Fix --- presto-native-execution/presto_cpp/main/CMakeLists.txt | 4 ++-- .../presto_cpp/main/connectors/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/presto-native-execution/presto_cpp/main/CMakeLists.txt b/presto-native-execution/presto_cpp/main/CMakeLists.txt index b072a92990ba0..0336238c331d2 100644 --- a/presto-native-execution/presto_cpp/main/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/CMakeLists.txt @@ -55,6 +55,7 @@ target_link_libraries( velox_abfs velox_aggregates velox_caching + velox_clp_connector velox_common_base velox_core velox_dwio_common_exception @@ -115,8 +116,7 @@ add_executable(presto_server PrestoMain.cpp) # However, we also would need to add its dependencies (tpch_gen etc). # TODO change the target in Velox to a library target then we can move this to the # presto_server_lib. -target_link_libraries(presto_server presto_server_lib velox_tpch_connector - velox_clp_connector) +target_link_libraries(presto_server presto_server_lib velox_tpch_connector) # Clang requires explicit linking with libatomic. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" diff --git a/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt b/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt index c462873708b0b..210ca51d9e840 100644 --- a/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt @@ -18,4 +18,4 @@ if(PRESTO_ENABLE_ARROW_FLIGHT_CONNECTOR) endif() target_link_libraries(presto_connectors presto_velox_expr_conversion - velox_type_fbhive) + velox_type_fbhive velox_clp_connector) From 5ff4aa89e11f941c990d0662f48e582485f1e9fa Mon Sep 17 00:00:00 2001 From: anlowee Date: Fri, 11 Jul 2025 21:38:45 +0000 Subject: [PATCH 09/11] Bump velox version --- presto-native-execution/velox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presto-native-execution/velox b/presto-native-execution/velox index 749d28944723a..fbb5aa7778643 160000 --- a/presto-native-execution/velox +++ b/presto-native-execution/velox @@ -1 +1 @@ -Subproject commit 749d28944723ad746b60ca7073f42b3df9896ff4 +Subproject commit fbb5aa77786439457ac80b0a241db900c611353d From 46155a72a57575061cf905f0eb08ddeac92bb564 Mon Sep 17 00:00:00 2001 From: "Xiaochong(Eddy) Wei" <40865608+anlowee@users.noreply.github.com> Date: Sat, 12 Jul 2025 09:14:11 -0400 Subject: [PATCH 10/11] Apply suggestions from code review Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com> --- presto-native-execution/CMakeLists.txt | 4 +++- .../presto_cpp/main/tests/CMakeLists.txt | 2 +- .../presto_cpp/main/types/tests/CMakeLists.txt | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/presto-native-execution/CMakeLists.txt b/presto-native-execution/CMakeLists.txt index f9b2da3f2c9cf..f4644dd09bba3 100644 --- a/presto-native-execution/CMakeLists.txt +++ b/presto-native-execution/CMakeLists.txt @@ -29,7 +29,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) message("Appending CMAKE_CXX_FLAGS with ${SCRIPT_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}") -# Known warnings that are benign can be disabled. +# Known warnings that are benign can be disabled: +# - `restrict` since it triggers a bug in gcc 12. See +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 set(DISABLED_WARNINGS "-Wno-nullability-completeness \ -Wno-deprecated-declarations \ diff --git a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt index 8638ef42e0a35..2dec578a32021 100644 --- a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt @@ -45,9 +45,9 @@ target_link_libraries( velox_dwio_common_test_utils $ $ + velox_clp_connector velox_hive_connector velox_tpch_connector - velox_clp_connector velox_presto_serializer velox_functions_prestosql velox_aggregates diff --git a/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt index 99741b42abff2..748b884e05abd 100644 --- a/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt @@ -25,9 +25,9 @@ target_link_libraries( presto_protocol velox_dwio_common velox_dwio_orc_reader + velox_clp_connector velox_hive_connector velox_tpch_connector - velox_clp_connector velox_exec velox_dwio_common_exception presto_type_converter @@ -63,9 +63,9 @@ target_link_libraries( velox_exec_test_lib velox_functions_prestosql velox_functions_lib + velox_clp_connector velox_hive_connector velox_tpch_connector - velox_clp_connector velox_hive_partition_function velox_presto_serializer velox_serialization @@ -96,9 +96,9 @@ target_link_libraries( presto_type_converter presto_types velox_dwio_common + velox_clp_connector velox_hive_connector velox_tpch_connector - velox_clp_connector GTest::gtest GTest::gtest_main) From ca813fab5b5c6b711ea75c4563eea9ac4f085901 Mon Sep 17 00:00:00 2001 From: anlowee Date: Sat, 12 Jul 2025 09:19:11 -0400 Subject: [PATCH 11/11] Address comments --- .../presto_cpp/main/connectors/CMakeLists.txt | 2 +- .../main/types/tests/PrestoToVeloxConnectorTest.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt b/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt index 210ca51d9e840..6bcd3aaccadb2 100644 --- a/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt @@ -18,4 +18,4 @@ if(PRESTO_ENABLE_ARROW_FLIGHT_CONNECTOR) endif() target_link_libraries(presto_connectors presto_velox_expr_conversion - velox_type_fbhive velox_clp_connector) + velox_clp_connector velox_type_fbhive) diff --git a/presto-native-execution/presto_cpp/main/types/tests/PrestoToVeloxConnectorTest.cpp b/presto-native-execution/presto_cpp/main/types/tests/PrestoToVeloxConnectorTest.cpp index 9398e4b65d961..fcb6d52c865bc 100644 --- a/presto-native-execution/presto_cpp/main/types/tests/PrestoToVeloxConnectorTest.cpp +++ b/presto-native-execution/presto_cpp/main/types/tests/PrestoToVeloxConnectorTest.cpp @@ -23,6 +23,8 @@ class PrestoToVeloxConnectorTest : public ::testing::Test {}; TEST_F(PrestoToVeloxConnectorTest, registerVariousConnectors) { std::vector>> connectorList; + connectorList.emplace_back( + std::pair("clp", std::make_unique("clp"))); connectorList.emplace_back( std::pair("hive", std::make_unique("hive"))); connectorList.emplace_back(std::pair( @@ -33,8 +35,6 @@ TEST_F(PrestoToVeloxConnectorTest, registerVariousConnectors) { "iceberg", std::make_unique("iceberg"))); connectorList.emplace_back( std::pair("tpch", std::make_unique("tpch"))); - connectorList.emplace_back( - std::pair("clp", std::make_unique("clp"))); for (auto& [connectorName, connector] : connectorList) { registerPrestoToVeloxConnector(std::move(connector));