Skip to content

Commit

Permalink
Merge pull request #130 from samansmink/add-expression-test
Browse files Browse the repository at this point in the history
Add expression test
  • Loading branch information
samansmink authored Dec 20, 2024
2 parents fd9dc3e + 23f4e9c commit 3b768d9
Show file tree
Hide file tree
Showing 11 changed files with 969 additions and 525 deletions.
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(EXTENSION_SOURCES
src/delta_functions.cpp
src/delta_utils.cpp
src/functions/delta_scan.cpp
src/functions/expression_functions.cpp
src/storage/delta_catalog.cpp
src/storage/delta_schema_entry.cpp
src/storage/delta_table_entry.cpp
Expand Down Expand Up @@ -149,7 +150,8 @@ ExternalProject_Add(
# Build debug build
BUILD_COMMAND
${CMAKE_COMMAND} -E env ${RUST_UNSET_ENV_VARS} ${RUST_ENV_VARS} cargo build
--package delta_kernel_ffi --workspace $<$<CONFIG:Release>:--release> --all-features ${RUST_PLATFORM_PARAM}
--package delta_kernel_ffi --workspace $<$<CONFIG:Release>:--release>
--all-features ${RUST_PLATFORM_PARAM}
# Build DATs
COMMAND
${CMAKE_COMMAND} -E env ${RUST_UNSET_ENV_VARS} ${RUST_ENV_VARS} cargo build
Expand All @@ -176,13 +178,13 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET
add_compile_definitions(DEFINE_DEFAULT_ENGINE)

# Link delta-kernal-rs to static lib
target_link_libraries(
${EXTENSION_NAME} ${DELTA_KERNEL_LIBPATH} ${PLATFORM_LIBS})
target_link_libraries(${EXTENSION_NAME} ${DELTA_KERNEL_LIBPATH}

Check warning on line 181 in CMakeLists.txt

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

Not disabling vptr sanitizer on M1 Macbook - set DISABLE_VPTR_SANITIZER

Check warning on line 181 in CMakeLists.txt

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

Not disabling vptr sanitizer on M1 Macbook - set DISABLE_VPTR_SANITIZER
${PLATFORM_LIBS})
add_dependencies(${EXTENSION_NAME} delta_kernel)

# Link delta-kernal-rs to dynamic lib
target_link_libraries(
${LOADABLE_EXTENSION_NAME} ${DELTA_KERNEL_LIBPATH} ${PLATFORM_LIBS})
target_link_libraries(${LOADABLE_EXTENSION_NAME} ${DELTA_KERNEL_LIBPATH}
${PLATFORM_LIBS})
add_dependencies(${LOADABLE_EXTENSION_NAME} delta_kernel)

install(
Expand Down
7 changes: 6 additions & 1 deletion src/delta_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ class DeltaStorageExtension : public StorageExtension {
};

static void LoadInternal(DatabaseInstance &instance) {
// Load functions
// Load Table functions
for (const auto &function : DeltaFunctions::GetTableFunctions(instance)) {
ExtensionUtil::RegisterFunction(instance, function);
}

// Load Scalar functions
for (const auto &function : DeltaFunctions::GetScalarFunctions(instance)) {
ExtensionUtil::RegisterFunction(instance, function);
}

// Register the "single table" delta catalog (to ATTACH a single delta table)
auto &config = DBConfig::GetConfig(instance);
config.storage_extensions["delta"] = make_uniq<DeltaStorageExtension>();
Expand Down
11 changes: 9 additions & 2 deletions src/delta_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

#include "duckdb.hpp"
#include "duckdb/main/extension_util.hpp"

#include <duckdb/parser/parsed_data/create_scalar_function_info.hpp>
#include "duckdb/parser/parsed_data/create_scalar_function_info.hpp"

namespace duckdb {

Expand All @@ -15,4 +14,12 @@ vector<TableFunctionSet> DeltaFunctions::GetTableFunctions(DatabaseInstance &ins
return functions;
}

vector<ScalarFunctionSet> DeltaFunctions::GetScalarFunctions(DatabaseInstance &instance) {
vector<ScalarFunctionSet> functions;

functions.push_back(GetExpressionFunction(instance));

return functions;
}

}; // namespace duckdb
Loading

0 comments on commit 3b768d9

Please sign in to comment.