Skip to content

Commit 8b38118

Browse files
20001020ycxclaude
andcommitted
fix: update CLP connector for Velox 0.297 API compatibility
Adapt CLP connector to upstream Velox API changes in 0.297: - ConnectorFactory global registry removed: Replace connector::registerConnectorFactory / getConnectorFactory / unregisterConnectorFactory calls with direct factory instantiation (ClpConnectorFactory factory; factory.newConnector(...)) - New type aliases for connector handles: Update createDataSource and ClpDataSource constructor signatures to use ConnectorTableHandlePtr (shared_ptr<const ConnectorTableHandle>) and ColumnHandleMap (unordered_map<string, shared_ptr<const ColumnHandle>>) instead of the non-const shared_ptr variants - Update dynamic_pointer_cast calls to cast to const types to match the new const-qualified pointer types Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a392fc2 commit 8b38118

File tree

12 files changed

+46
-55
lines changed

12 files changed

+46
-55
lines changed

CMake/resolve_dependency_modules/clp.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ include_guard(GLOBAL)
1616
FetchContent_Declare(
1717
clp
1818
GIT_REPOSITORY https://github.com/y-scope/clp.git
19-
GIT_TAG v0.8.0)
19+
GIT_TAG f82e6114160a6addd4727259906bcf621ac9912c)
2020

2121
set(CLP_BUILD_CLP_REGEX_UTILS
2222
OFF

CMake/resolve_dependency_modules/log_surgeon.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ include_guard(GLOBAL)
1616
FetchContent_Declare(
1717
log_surgeon
1818
GIT_REPOSITORY https://github.com/y-scope/log-surgeon.git
19-
GIT_TAG 85d4f2c09c0e55f1fb87cdc8b0f4d13fb1a733e1
19+
GIT_TAG 193e1f91eb137bb935a7f44b13cc8dd945a8d742
2020
OVERRIDE_FIND_PACKAGE)
2121

2222
set(log_surgeon_BUILD_TESTING OFF)

CMake/resolve_dependency_modules/spdlog.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# limitations under the License.
1414
include_guard(GLOBAL)
1515

16-
set(VELOX_SPDLOG_BUILD_VERSION 1.12.0)
16+
set(VELOX_SPDLOG_BUILD_VERSION 1.15.3)
1717
set(VELOX_SPDLOG_BUILD_SHA256_CHECKSUM
18-
4dccf2d10f410c1e2feaff89966bfc49a1abb29ef6f08246335b110e001e09a9)
18+
15a04e69c222eb6c01094b5c7ff8a249b36bb22788d72519646fb85feb267e67)
1919
set(VELOX_SPDLOG_SOURCE_URL
2020
"https://github.com/gabime/spdlog/archive/refs/tags/v${VELOX_SPDLOG_BUILD_VERSION}.tar.gz"
2121
)

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ endif()
582582
velox_resolve_dependency(glog)
583583

584584
velox_set_source(fmt)
585-
velox_resolve_dependency(fmt 9.0.0)
585+
velox_resolve_dependency(fmt 11.2.0)
586586

587587
if(VELOX_ENABLE_COMPRESSION_LZ4)
588588
find_package(lz4 REQUIRED)
@@ -637,13 +637,13 @@ if(${VELOX_ENABLE_CLP_CONNECTOR})
637637
velox_set_source(spdlog)
638638
velox_resolve_dependency(spdlog)
639639

640+
velox_set_source(ystdlib)
641+
velox_resolve_dependency(ystdlib)
642+
640643
# Dependencies that depend on other dependencies
641644
velox_set_source(log_surgeon)
642645
velox_resolve_dependency(log_surgeon)
643646

644-
velox_set_source(ystdlib)
645-
velox_resolve_dependency(ystdlib)
646-
647647
set(clp_SOURCE BUNDLED)
648648
velox_resolve_dependency(clp)
649649
endif()

velox/connectors/clp/ClpColumnHandle.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class ClpColumnHandle : public ColumnHandle {
3030
originalColumnName_(originalColumnName),
3131
columnType_(columnType) {}
3232

33+
const std::string& name() const override {
34+
return columnName_;
35+
}
36+
3337
const std::string& columnName() const {
3438
return columnName_;
3539
}

velox/connectors/clp/ClpConnector.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "clp_s/TimestampPattern.hpp"
18-
1917
#include "velox/connectors/clp/ClpConnector.h"
2018
#include "velox/connectors/clp/ClpDataSource.h"
2119

@@ -28,10 +26,8 @@ ClpConnector::ClpConnector(
2826

2927
std::unique_ptr<DataSource> ClpConnector::createDataSource(
3028
const RowTypePtr& outputType,
31-
const std::shared_ptr<ConnectorTableHandle>& tableHandle,
32-
const std::unordered_map<
33-
std::string,
34-
std::shared_ptr<connector::ColumnHandle>>& columnHandles,
29+
const ConnectorTableHandlePtr& tableHandle,
30+
const connector::ColumnHandleMap& columnHandles,
3531
ConnectorQueryCtx* connectorQueryCtx) {
3632
return std::make_unique<ClpDataSource>(
3733
outputType,
@@ -43,20 +39,16 @@ std::unique_ptr<DataSource> ClpConnector::createDataSource(
4339

4440
std::unique_ptr<DataSink> ClpConnector::createDataSink(
4541
RowTypePtr inputType,
46-
std::shared_ptr<ConnectorInsertTableHandle> connectorInsertTableHandle,
42+
ConnectorInsertTableHandlePtr connectorInsertTableHandle,
4743
ConnectorQueryCtx* connectorQueryCtx,
4844
CommitStrategy commitStrategy) {
4945
VELOX_NYI("createDataSink for ClpConnector is not implemented!");
5046
}
5147

5248
ClpConnectorFactory::ClpConnectorFactory()
53-
: ConnectorFactory(kClpConnectorName) {
54-
clp_s::TimestampPattern::init();
55-
}
49+
: ConnectorFactory(kClpConnectorName) {}
5650

5751
ClpConnectorFactory::ClpConnectorFactory(const char* connectorName)
58-
: ConnectorFactory(connectorName) {
59-
clp_s::TimestampPattern::init();
60-
}
52+
: ConnectorFactory(connectorName) {}
6153

6254
} // namespace facebook::velox::connector::clp

velox/connectors/clp/ClpConnector.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ClpConnector : public Connector {
2828
std::shared_ptr<const config::ConfigBase> config);
2929

3030
[[nodiscard]] const std::shared_ptr<const config::ConfigBase>&
31-
connectorConfig() const override {
31+
connectorConfig() const {
3232
return config_->config();
3333
}
3434

@@ -38,19 +38,17 @@ class ClpConnector : public Connector {
3838

3939
std::unique_ptr<DataSource> createDataSource(
4040
const RowTypePtr& outputType,
41-
const std::shared_ptr<ConnectorTableHandle>& tableHandle,
42-
const std::unordered_map<
43-
std::string,
44-
std::shared_ptr<connector::ColumnHandle>>& columnHandles,
41+
const ConnectorTableHandlePtr& tableHandle,
42+
const connector::ColumnHandleMap& columnHandles,
4543
ConnectorQueryCtx* connectorQueryCtx) override;
4644

47-
bool supportsSplitPreload() override {
45+
bool supportsSplitPreload() const override {
4846
return false;
4947
}
5048

5149
std::unique_ptr<DataSink> createDataSink(
5250
RowTypePtr inputType,
53-
std::shared_ptr<ConnectorInsertTableHandle> connectorInsertTableHandle,
51+
ConnectorInsertTableHandlePtr connectorInsertTableHandle,
5452
ConnectorQueryCtx* connectorQueryCtx,
5553
CommitStrategy commitStrategy) override;
5654

velox/connectors/clp/ClpDataSource.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ namespace facebook::velox::connector::clp {
2929

3030
ClpDataSource::ClpDataSource(
3131
const RowTypePtr& outputType,
32-
const std::shared_ptr<connector::ConnectorTableHandle>& tableHandle,
33-
const std::unordered_map<
34-
std::string,
35-
std::shared_ptr<connector::ColumnHandle>>& columnHandles,
32+
const ConnectorTableHandlePtr& tableHandle,
33+
const connector::ColumnHandleMap& columnHandles,
3634
velox::memory::MemoryPool* pool,
3735
std::shared_ptr<const ClpConfig>& clpConfig)
3836
: pool_(pool), outputType_(outputType) {
39-
auto clpTableHandle = std::dynamic_pointer_cast<ClpTableHandle>(tableHandle);
37+
auto clpTableHandle =
38+
std::dynamic_pointer_cast<const ClpTableHandle>(tableHandle);
4039
storageType_ = clpConfig->storageType();
4140
s3AuthProvider_ = clpConfig->s3AuthProvider();
4241

@@ -47,7 +46,7 @@ ClpDataSource::ClpDataSource(
4746
"ColumnHandle not found for output name: {}",
4847
outputName);
4948
auto clpColumnHandle =
50-
std::dynamic_pointer_cast<ClpColumnHandle>(columnHandle->second);
49+
std::dynamic_pointer_cast<const ClpColumnHandle>(columnHandle->second);
5150
VELOX_CHECK_NOT_NULL(
5251
clpColumnHandle,
5352
"ColumnHandle must be an instance of ClpColumnHandle for output name: {}",

velox/connectors/clp/ClpDataSource.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ class ClpDataSource : public DataSource {
3434
public:
3535
ClpDataSource(
3636
const RowTypePtr& outputType,
37-
const std::shared_ptr<connector::ConnectorTableHandle>& tableHandle,
38-
const std::unordered_map<
39-
std::string,
40-
std::shared_ptr<connector::ColumnHandle>>& columnHandles,
37+
const ConnectorTableHandlePtr& tableHandle,
38+
const connector::ColumnHandleMap& columnHandles,
4139
velox::memory::MemoryPool* pool,
4240
std::shared_ptr<const ClpConfig>& clpConfig);
4341

@@ -60,7 +58,7 @@ class ClpDataSource : public DataSource {
6058
return completedRows_;
6159
}
6260

63-
std::unordered_map<std::string, RuntimeCounter> runtimeStats() override {
61+
std::unordered_map<std::string, RuntimeMetric> getRuntimeStats() override {
6462
return {};
6563
}
6664

velox/connectors/clp/ClpTableHandle.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ class ClpTableHandle : public ConnectorTableHandle {
2525
ClpTableHandle(const std::string& connectorId, const std::string& tableName)
2626
: ConnectorTableHandle(connectorId), tableName_(tableName) {}
2727

28+
const std::string& name() const override {
29+
return tableName_;
30+
}
31+
2832
[[nodiscard]] const std::string& tableName() const {
2933
return tableName_;
3034
}

0 commit comments

Comments
 (0)