Skip to content

Commit

Permalink
Rename duckdb/postgres extension (#3380)
Browse files Browse the repository at this point in the history
  • Loading branch information
acquamarin committed Apr 25, 2024
1 parent 6d763fe commit a121cd4
Show file tree
Hide file tree
Showing 36 changed files with 114 additions and 114 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,13 @@ jobs:
- uses: actions/checkout@v3

- name: Update PostgreSQL host
working-directory: extension/postgres_scanner/test/test_files
working-directory: extension/postgres/test/test_files
env:
FNAME: postgres_scanner.test
FNAME: postgres.test
FIND: "localhost"
run: |
node -e 'fs=require("fs");fs.readFile(process.env.FNAME,"utf8",(err,data)=>{if(err!=null)throw err;fs.writeFile(process.env.FNAME,data.replaceAll(process.env.FIND,process.env.PG_HOST),"utf8",e=>{if(e!=null)throw e;});});'
cat postgres_scanner.test
cat postgres.test
- name: Install dependencies
run: pip install rangehttpserver
Expand Down Expand Up @@ -533,13 +533,13 @@ jobs:
- uses: actions/checkout@v3

- name: Update PostgreSQL host
working-directory: extension/postgres_scanner/test/test_files
working-directory: extension/postgres/test/test_files
env:
FNAME: postgres_scanner.test
FNAME: postgres.test
FIND: "localhost"
run: |
node -e 'fs=require("fs");fs.readFile(process.env.FNAME,"utf8",(err,data)=>{if(err!=null)throw err;fs.writeFile(process.env.FNAME,data.replaceAll(process.env.FIND,process.env.PG_HOST),"utf8",e=>{if(e!=null)throw e;});});'
cat postgres_scanner.test
cat postgres.test
- name: Install dependencies
run: pip3 install --break-system-packages rangehttpserver
Expand Down Expand Up @@ -575,13 +575,13 @@ jobs:
run: pip install rangehttpserver

- name: Update PostgreSQL host
working-directory: extension/postgres_scanner/test/test_files
working-directory: extension/postgres/test/test_files
env:
FNAME: postgres_scanner.test
FNAME: postgres.test
FIND: "localhost"
run: |
node -e 'fs=require("fs");fs.readFile(process.env.FNAME,"utf8",(err,data)=>{if(err!=null)throw err;fs.writeFile(process.env.FNAME,data.replaceAll(process.env.FIND,process.env.PG_HOST),"utf8",e=>{if(e!=null)throw e;});});'
cat postgres_scanner.test
cat postgres.test
- name: Extension test
shell: cmd
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ add_subdirectory(third_party)
if(${BUILD_KUZU})
add_definitions(-DKUZU_ROOT_DIRECTORY="${PROJECT_SOURCE_DIR}")
add_definitions(-DKUZU_CMAKE_VERSION="${CMAKE_PROJECT_VERSION}")
add_definitions(-DKUZU_EXTENSION_VERSION="0.2.8")
add_definitions(-DKUZU_EXTENSION_VERSION="0.2.9")

include_directories(src/include)

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ allconfig:
$(call config-cmake-release, \
-DBUILD_BENCHMARK=TRUE \
-DBUILD_EXAMPLES=TRUE \
-DBUILD_EXTENSIONS="httpfs;duckdb_scanner;postgres_scanner" \
-DBUILD_EXTENSIONS="httpfs;duckdb;postgres" \
-DBUILD_JAVA=TRUE \
-DBUILD_NODEJS=TRUE \
-DBUILD_PYTHON=TRUE \
Expand All @@ -79,7 +79,7 @@ alldebug:
$(call run-cmake-debug, \
-DBUILD_BENCHMARK=TRUE \
-DBUILD_EXAMPLES=TRUE \
-DBUILD_EXTENSIONS="httpfs;duckdb_scanner;postgres_scanner" \
-DBUILD_EXTENSIONS="httpfs;duckdb;postgres" \
-DBUILD_JAVA=TRUE \
-DBUILD_NODEJS=TRUE \
-DBUILD_PYTHON=TRUE \
Expand Down Expand Up @@ -162,7 +162,7 @@ example:

extension-test:
$(call run-cmake-release, \
-DBUILD_EXTENSIONS="httpfs;duckdb_scanner;postgres_scanner" \
-DBUILD_EXTENSIONS="httpfs;duckdb;postgres" \
-DBUILD_EXTENSION_TESTS=TRUE \
-DENABLE_ADDRESS_SANITIZER=TRUE \
)
Expand All @@ -171,13 +171,13 @@ extension-test:

extension-debug:
$(call run-cmake-debug, \
-DBUILD_EXTENSIONS="httpfs;duckdb_scanner;postgres_scanner" \
-DBUILD_EXTENSIONS="httpfs;duckdb;postgres" \
-DBUILD_KUZU=FALSE \
)

extension-release:
$(call run-cmake-release, \
-DBUILD_EXTENSIONS="httpfs;duckdb_scanner;postgres_scanner" \
-DBUILD_EXTENSIONS="httpfs;duckdb;postgres" \
-DBUILD_KUZU=FALSE \
)

Expand Down
8 changes: 4 additions & 4 deletions extension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ if("httpfs" IN_LIST BUILD_EXTENSIONS)
add_subdirectory(httpfs)
endif()

if ("duckdb_scanner" IN_LIST BUILD_EXTENSIONS)
if ("duckdb" IN_LIST BUILD_EXTENSIONS)
if(NOT __32BIT__)
# DuckDB does not officially support 32-bit builds, so we disable the
# extension for 32-bit builds
add_subdirectory(duckdb_scanner)
add_subdirectory(duckdb)
endif()
endif()

if ("postgres_scanner" IN_LIST BUILD_EXTENSIONS)
if ("postgres" IN_LIST BUILD_EXTENSIONS)
if(NOT __32BIT__)
# DuckDB does not officially support 32-bit builds, so we disable the
# extension for 32-bit builds
add_subdirectory(postgres_scanner)
add_subdirectory(postgres)
endif()
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ include_directories(
src/include
${DuckDB_INCLUDE_DIRS})

add_library(duckdb_scanner
add_library(duckdb_extension
SHARED
src/duckdb_scanner_extension.cpp
src/duckdb_extension.cpp
src/duckdb_storage.cpp
src/duckdb_scan.cpp
src/duckdb_type_converter.cpp
src/duckdb_catalog.cpp
src/duckdb_table_catalog_entry.cpp
src/duckdb_functions.cpp)

set_target_properties(duckdb_scanner
set_target_properties(duckdb_extension
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build"
)

target_link_libraries(duckdb_scanner
target_link_libraries(duckdb_extension
PRIVATE
${DuckDB_LIBRARIES})

set_target_properties(duckdb_scanner PROPERTIES
OUTPUT_NAME duckdb_scanner
set_target_properties(duckdb_extension PROPERTIES
OUTPUT_NAME duckdb
PREFIX "lib"
SUFFIX ".kuzu_extension"
)
Expand All @@ -59,9 +59,9 @@ if (WIN32)
# for its small libraries anyways...
# Future work could make it possible to embed extension into kuzu,
# which would help fix this problem.
target_link_libraries(duckdb_scanner PRIVATE kuzu)
target_link_libraries(duckdb_extension PRIVATE kuzu)
endif()

if (APPLE)
set_target_properties(duckdb_scanner PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
set_target_properties(duckdb_extension PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif ()
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "duckdb_type_converter.h"

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

void DuckDBCatalog::init() {
auto [db, con] = getConnection(dbPath);
Expand All @@ -25,8 +25,8 @@ void DuckDBCatalog::init() {
if (resultChunk == nullptr || resultChunk->size() == 0) {
return;
}
duckdb_scanner::duckdb_conversion_func_t conversionFunc;
duckdb_scanner::getDuckDBVectorConversionFunc(common::PhysicalTypeID::STRING, conversionFunc);
duckdb_extension::duckdb_conversion_func_t conversionFunc;
duckdb_extension::getDuckDBVectorConversionFunc(common::PhysicalTypeID::STRING, conversionFunc);
conversionFunc(resultChunk->data[0], tableNamesVector, resultChunk->size());
for (auto i = 0u; i < resultChunk->size(); i++) {
auto tableName = tableNamesVector.getValue<common::ku_string_t>(i).getAsString();
Expand Down Expand Up @@ -114,7 +114,7 @@ std::unique_ptr<binder::BoundCreateTableInfo> DuckDBCatalog::bindCreateTableInfo
return nullptr;
}
return std::make_unique<binder::BoundCreateTableInfo>(common::TableType::FOREIGN, tableName,
std::make_unique<duckdb_scanner::BoundExtraCreateDuckDBTableInfo>(dbPath, catalogName,
std::make_unique<duckdb_extension::BoundExtraCreateDuckDBTableInfo>(dbPath, catalogName,
getDefaultSchemaName(), std::move(propertyInfos)));
}

Expand All @@ -133,5 +133,5 @@ std::pair<duckdb::DuckDB, duckdb::Connection> DuckDBCatalog::getConnection(
}
}

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#include "duckdb_scanner_extension.h"
#include "duckdb_extension.h"

#include "duckdb_storage.h"
#include "main/database.h"

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

void DuckDBScannerExtension::load(main::ClientContext* context) {
void DuckDBExtension::load(main::ClientContext* context) {
auto db = context->getDatabase();
db->registerStorageExtension("duckdb", std::make_unique<DuckDBStorageExtension>(db));
}

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu

extern "C" {
Expand All @@ -23,6 +23,6 @@ extern "C" {
#define INIT_EXPORT __attribute__((visibility("default")))
#endif
INIT_EXPORT void init(kuzu::main::ClientContext* context) {
kuzu::duckdb_scanner::DuckDBScannerExtension::load(context);
kuzu::duckdb_extension::DuckDBExtension::load(context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace kuzu::main;
using namespace kuzu::common;

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

static offset_t DuckDBClearCacheTableFunc(TableFuncInput& input, TableFuncOutput& output) {
auto& dataChunk = output.dataChunk;
Expand Down Expand Up @@ -39,5 +39,5 @@ DuckDBClearCacheFunction::DuckDBClearCacheFunction()
function::CallFunction::initSharedState, function::CallFunction::initEmptyLocalState,
std::vector<LogicalTypeID>{}} {}

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace kuzu::function;
using namespace kuzu::common;

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

void getDuckDBVectorConversionFunc(PhysicalTypeID physicalTypeID,
duckdb_conversion_func_t& conversion_func);
Expand Down Expand Up @@ -247,5 +247,5 @@ TableFunction getScanFunction(DuckDBScanBindData bindData) {
std::vector<LogicalTypeID>{});
}

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "extension/extension.h"

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

static std::string getCatalogNameFromPath(const std::string& dbPath) {
std::filesystem::path path(dbPath);
Expand Down Expand Up @@ -50,5 +50,5 @@ bool DuckDBStorageExtension::canHandleDB(std::string dbType_) const {
return dbType_ == dbType;
}

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "common/string_utils.h"

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

using namespace kuzu::common;

Expand Down Expand Up @@ -138,5 +138,5 @@ std::vector<StructField> DuckDBTypeConverter::parseStructTypeInfo(
return structFields;
}

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#pragma GCC diagnostic pop

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

struct BoundExtraCreateDuckDBTableInfo : public binder::BoundExtraCreateTableInfo {
std::string dbPath;
Expand Down Expand Up @@ -64,5 +64,5 @@ class DuckDBCatalog : public extension::CatalogExtension {
common::ValueVector tableNamesVector;
};

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#include "extension/extension.h"

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

class DuckDBScannerExtension final : public extension::Extension {
class DuckDBExtension final : public extension::Extension {
public:
static void load(main::ClientContext* context);
};

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "main/database_manager.h"

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

struct DuckDBClearCacheBindData : public function::CallTableFuncBindData {
main::DatabaseManager* databaseManager;
Expand All @@ -29,5 +29,5 @@ struct DuckDBClearCacheFunction final : public function::TableFunction {
DuckDBClearCacheFunction();
};

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#pragma GCC diagnostic pop

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

using duckdb_conversion_func_t = std::function<void(duckdb::Vector& duckDBVector,
common::ValueVector& result, uint64_t numValues)>;
Expand Down Expand Up @@ -41,5 +41,5 @@ void getDuckDBVectorConversionFunc(common::PhysicalTypeID physicalTypeID,

function::TableFunction getScanFunction(DuckDBScanBindData bindData);

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "storage/storage_extension.h"

namespace kuzu {
namespace duckdb_scanner {
namespace duckdb_extension {

class DuckDBStorageExtension final : public storage::StorageExtension {
public:
Expand All @@ -15,5 +15,5 @@ class DuckDBStorageExtension final : public storage::StorageExtension {
bool canHandleDB(std::string dbType) const override;
};

} // namespace duckdb_scanner
} // namespace duckdb_extension
} // namespace kuzu
Loading

0 comments on commit a121cd4

Please sign in to comment.