-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The native Arrow Flight connector can be used to connect to any Arrow Flight enabled Data Source. The metadata layer is handled by the Presto coordinator and does not need to be re-implemented in C++. Any Java connector that inherits from `presto-base-arrow-flight` can use this connector as it's counterpart for the Prestissimo layer. Different Arrow-Flight enabled data sources can differ in authentication styles. A plugin-style interface is provided to handle such cases with custom authentication code by extending `arrow_flight::auth::Authenticator`. RFC: https://github.com/prestodb/rfcs/blob/main/RFC-0004-arrow-flight-connector.md#prestissimo-implementation Co-authored-by: Ashwin Kumar <Ashwin.Kumar6@ibm.com> Co-authored-by: Rijin-N <rijin.n@ibm.com> Co-authored-by: Nischay Yadav <Nischay.Yadav@ibm.com>
- Loading branch information
1 parent
83e9709
commit cc96d0a
Showing
68 changed files
with
3,416 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 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_connector Registration.cpp PrestoToVeloxConnector.cpp | ||
SystemConnector.cpp) | ||
|
||
if(PRESTO_ENABLE_ARROW_FLIGHT_CONNECTOR) | ||
add_subdirectory(arrow_flight) | ||
target_link_libraries(presto_connector presto_flight_connector) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
presto-native-execution/presto_cpp/main/connectors/Registration.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* 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/connectors/Registration.h" | ||
#include "presto_cpp/main/connectors/SystemConnector.h" | ||
|
||
#ifdef PRESTO_ENABLE_ARROW_FLIGHT_CONNECTOR | ||
#include "presto_cpp/main/connectors/arrow_flight/ArrowFlightConnector.h" | ||
#include "presto_cpp/main/connectors/arrow_flight/ArrowPrestoToVeloxConnector.h" | ||
#endif | ||
|
||
#include "velox/connectors/hive/HiveConnector.h" | ||
#include "velox/connectors/tpch/TpchConnector.h" | ||
|
||
namespace facebook::presto { | ||
namespace { | ||
|
||
constexpr char const* kHiveHadoop2ConnectorName = "hive-hadoop2"; | ||
constexpr char const* kIcebergConnectorName = "iceberg"; | ||
|
||
void registerConnectorFactories() { | ||
// These checks for connector factories can be removed after we remove the | ||
// registrations from the Velox library. | ||
if (!velox::connector::hasConnectorFactory( | ||
velox::connector::hive::HiveConnectorFactory::kHiveConnectorName)) { | ||
velox::connector::registerConnectorFactory( | ||
std::make_shared<velox::connector::hive::HiveConnectorFactory>()); | ||
velox::connector::registerConnectorFactory( | ||
std::make_shared<velox::connector::hive::HiveConnectorFactory>( | ||
kHiveHadoop2ConnectorName)); | ||
} | ||
if (!velox::connector::hasConnectorFactory( | ||
velox::connector::tpch::TpchConnectorFactory::kTpchConnectorName)) { | ||
velox::connector::registerConnectorFactory( | ||
std::make_shared<velox::connector::tpch::TpchConnectorFactory>()); | ||
} | ||
|
||
// Register Velox connector factory for iceberg. | ||
// The iceberg catalog is handled by the hive connector factory. | ||
if (!velox::connector::hasConnectorFactory(kIcebergConnectorName)) { | ||
velox::connector::registerConnectorFactory( | ||
std::make_shared<velox::connector::hive::HiveConnectorFactory>( | ||
kIcebergConnectorName)); | ||
} | ||
|
||
#ifdef PRESTO_ENABLE_ARROW_FLIGHT_CONNECTOR | ||
if (!velox::connector::hasConnectorFactory( | ||
ArrowFlightConnectorFactory::kArrowFlightConnectorName)) { | ||
velox::connector::registerConnectorFactory( | ||
std::make_shared<ArrowFlightConnectorFactory>()); | ||
} | ||
#endif | ||
} | ||
} // namespace | ||
|
||
void registerConnectors() { | ||
registerConnectorFactories(); | ||
|
||
registerPrestoToVeloxConnector(std::make_unique<HivePrestoToVeloxConnector>( | ||
velox::connector::hive::HiveConnectorFactory::kHiveConnectorName)); | ||
registerPrestoToVeloxConnector( | ||
std::make_unique<HivePrestoToVeloxConnector>(kHiveHadoop2ConnectorName)); | ||
registerPrestoToVeloxConnector( | ||
std::make_unique<IcebergPrestoToVeloxConnector>(kIcebergConnectorName)); | ||
registerPrestoToVeloxConnector(std::make_unique<TpchPrestoToVeloxConnector>( | ||
velox::connector::tpch::TpchConnectorFactory::kTpchConnectorName)); | ||
|
||
// Presto server uses system catalog or system schema in other catalogs | ||
// in different places in the code. All these resolve to the SystemConnector. | ||
// Depending on where the operator or column is used, different prefixes can | ||
// be used in the naming. So the protocol class is mapped | ||
// to all the different prefixes for System tables/columns. | ||
registerPrestoToVeloxConnector( | ||
std::make_unique<SystemPrestoToVeloxConnector>("$system")); | ||
registerPrestoToVeloxConnector( | ||
std::make_unique<SystemPrestoToVeloxConnector>("system")); | ||
registerPrestoToVeloxConnector( | ||
std::make_unique<SystemPrestoToVeloxConnector>("$system@system")); | ||
|
||
#ifdef PRESTO_ENABLE_ARROW_FLIGHT_CONNECTOR | ||
registerPrestoToVeloxConnector(std::make_unique<ArrowPrestoToVeloxConnector>( | ||
ArrowFlightConnectorFactory::kArrowFlightConnectorName)); | ||
#endif | ||
} | ||
} // namespace facebook::presto |
20 changes: 20 additions & 0 deletions
20
presto-native-execution/presto_cpp/main/connectors/Registration.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 | ||
|
||
namespace facebook::presto { | ||
|
||
void registerConnectors(); | ||
|
||
} // namespace facebook::presto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
presto-native-execution/presto_cpp/main/connectors/arrow_flight/ArrowFlightConfig.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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/connectors/arrow_flight/ArrowFlightConfig.h" | ||
|
||
namespace facebook::presto { | ||
|
||
std::string ArrowFlightConfig::authenticatorName() { | ||
return config_->get<std::string>(kAuthenticatorName, "none"); | ||
} | ||
|
||
std::optional<std::string> ArrowFlightConfig::defaultServerHostname() { | ||
return static_cast<std::optional<std::string>>( | ||
config_->get<std::string>(kDefaultServerHost)); | ||
} | ||
|
||
std::optional<uint16_t> ArrowFlightConfig::defaultServerPort() { | ||
return static_cast<std::optional<uint16_t>>( | ||
config_->get<uint16_t>(kDefaultServerPort)); | ||
} | ||
|
||
bool ArrowFlightConfig::defaultServerSslEnabled() { | ||
return config_->get<bool>(kDefaultServerSslEnabled, false); | ||
} | ||
|
||
bool ArrowFlightConfig::serverVerify() { | ||
return config_->get<bool>(kServerVerify, true); | ||
} | ||
|
||
std::optional<std::string> ArrowFlightConfig::serverSslCertificate() { | ||
return static_cast<std::optional<std::string>>( | ||
config_->get<std::string>(kServerSslCertificate)); | ||
} | ||
|
||
} // namespace facebook::presto |
Oops, something went wrong.