Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -732,12 +732,18 @@ jobs:
uv-key: ${{ steps.uv.outputs.cache-key }}

duckdb-extension:
name: DuckDB Extension
name: DuckDB Extension (${{ matrix.duckdb }})
needs: check-rust-changes
if: needs.check-rust-changes.outputs.duckdb_changed == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
duckdb: [v1.5.6, v2.0-cyanoptera]
env:
GEN: ninja
DUCKDB_VERSION: ${{ matrix.duckdb }}
SIDEMANTIC_NATIVE_PEG: ${{ matrix.duckdb == 'v2.0-cyanoptera' && '1' || '' }}

steps:
- uses: actions/checkout@v4
Expand All @@ -753,7 +759,7 @@ jobs:

- name: Fetch DuckDB dependencies
working-directory: sidemantic-duckdb
run: make deps DUCKDB_VERSION=v1.5.5
run: make deps

- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y ninja-build
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/duckdb-extension-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
workflow_dispatch:
inputs:
duckdb_version:
description: "DuckDB tag used for extension build and tests; currently v1.5.5 only"
description: "Stable DuckDB release to package (v1.5.6); Cyanoptera is tested separately in CI"
required: true
default: "v1.5.5"
default: "v1.5.6"
type: string
create_github_release:
description: "Create or update a GitHub release with extension artifacts"
Expand Down Expand Up @@ -55,11 +55,11 @@ jobs:
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
VERSION="$REQUESTED_VERSION"
else
VERSION="v1.5.5"
VERSION="v1.5.6"
fi

# Keep in sync with SUPPORTED_DUCKDB_VERSION in the extension Makefile.
if [ "$VERSION" != "v1.5.5" ]; then
# Publish stable artifacts only. CI separately tests the pinned PEG development build.
if [ "$VERSION" != "v1.5.6" ]; then
echo "Unsupported DuckDB version" >&2
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion docs/rust-native-runtime-packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Python remains the default engine; installing the Rust bindings does not promote
Workflow files live in `.github/workflows/`. Rust crate and wheel versions must
match; package metadata tests enforce this. Root Python and WASM versions are
separate. The DuckDB extension is tied to the DuckDB build version, currently
`v1.5.5`. Do not use a release intended for a different DuckDB ABI.
`v1.5.6`. Do not use a release intended for a different DuckDB ABI.

## Install from a checkout or downloaded artifact

Expand Down
74 changes: 73 additions & 1 deletion sidemantic-duckdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,78 @@ set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension)
project(${TARGET_NAME})
include_directories(src/include)

# Probe the host headers: extension builds can contain multiple DuckDB checkouts.
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
function(sidemantic_detect_apis)
cmake_push_check_state(RESET)
get_directory_property(CMAKE_REQUIRED_INCLUDES INCLUDE_DIRECTORIES)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(host_api "${CMAKE_SOURCE_DIR};${CMAKE_CXX_COMPILER}")
foreach(header parser/parser_extension.hpp function/table_function.hpp
parser/expression/columnref_expression.hpp parser/tableref/basetableref.hpp
parser/parser_options.hpp parser/expression/constant_expression.hpp
parser/statement/insert_statement.hpp
parser/grammar_extension.hpp parser/peg/compiled_grammar.hpp)
if(EXISTS "${CMAKE_SOURCE_DIR}/src/include/duckdb/${header}")
file(SHA256 "${CMAKE_SOURCE_DIR}/src/include/duckdb/${header}" header_hash)
string(APPEND host_api ";${header_hash}")
endif()
endforeach()
if(NOT SIDEMANTIC_HOST_API STREQUAL host_api)
foreach(api TOKEN_PARSE_FN NEW_IDENTIFIER_API NEW_EXPRESSION_API QUALIFIED_TABLE_API BUILTIN_PARSER_OPTIONS LITERAL_API GRAMMAR_EXTENSION INSERT_QUERY_NODE)
unset(SIDEMANTIC_${api} CACHE)
endforeach()
set(SIDEMANTIC_HOST_API "${host_api}" CACHE INTERNAL "DuckDB headers used for compatibility probes" FORCE)
endif()
check_cxx_source_compiles("
#include <duckdb/parser/parser_extension.hpp>
#include <type_traits>
using namespace duckdb;
using Callback = ParserExtensionParseResult (*)(ParserExtensionInfo *, const vector<SimpleToken> &);
static_assert(std::is_same<parse_function_t, Callback>::value, \"token callback\");
" SIDEMANTIC_TOKEN_PARSE_FN)
check_cxx_source_compiles("
#include <duckdb/function/table_function.hpp>
#include <type_traits>
using namespace duckdb;
using Callback = unique_ptr<FunctionData> (*)(ClientContext &, TableFunctionBindInput &, vector<LogicalType> &, vector<Identifier> &);
static_assert(std::is_same<table_function_bind_t, Callback>::value, \"identifier names\");
" SIDEMANTIC_NEW_IDENTIFIER_API)
check_cxx_source_compiles("
#include <duckdb/parser/expression/columnref_expression.hpp>
void probe(duckdb::ColumnRefExpression &expr) { expr.ColumnNames(); }
" SIDEMANTIC_NEW_EXPRESSION_API)
check_cxx_source_compiles("
#include <duckdb/parser/tableref/basetableref.hpp>
void probe(duckdb::BaseTableRef &ref) { ref.GetQualifiedName(); }
" SIDEMANTIC_QUALIFIED_TABLE_API)
check_cxx_source_compiles("
#include <duckdb/parser/parser_options.hpp>
void probe() { duckdb::ParserOptions::Builtin(); }
" SIDEMANTIC_BUILTIN_PARSER_OPTIONS)
check_cxx_source_compiles("
#include <duckdb/parser/expression/constant_expression.hpp>
void probe() { duckdb::ConstantExpression::String(duckdb::string()); }
" SIDEMANTIC_LITERAL_API)
check_cxx_source_compiles("
#include <duckdb/parser/statement/insert_statement.hpp>
void probe(duckdb::InsertStatement &stmt) { (void)stmt.node->select_statement; }
" SIDEMANTIC_INSERT_QUERY_NODE)
check_cxx_source_compiles("
#include <duckdb/parser/grammar_extension.hpp>
#include <duckdb/parser/peg/compiled_grammar.hpp>
void probe(const duckdb::ClientContext &context) {
duckdb::CompiledGrammar::Create(context, {\"sidemantic\"});
duckdb::GrammarChange::PrependChoice(\"Statement\", \"SidemanticStatement\");
}
" SIDEMANTIC_GRAMMAR_EXTENSION)
configure_file(src/include/sidemantic_compat.hpp.in sidemantic_compat.hpp)
cmake_pop_check_state()
endfunction()
sidemantic_detect_apis()
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# Path to sidemantic-rs
set(SIDEMANTIC_RS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../sidemantic-rs")
set(SIDEMANTIC_CARGO_TARGET_DIR "${SIDEMANTIC_RS_DIR}/target" CACHE PATH "Cargo target directory for sidemantic-rs")
Expand Down Expand Up @@ -73,7 +145,7 @@ add_custom_target(sidemantic_rust_staticlib DEPENDS "${SIDEMANTIC_LIB}")
# Include Rust library headers
include_directories(${SIDEMANTIC_INCLUDE})

set(EXTENSION_SOURCES src/sidemantic_extension.cpp)
set(EXTENSION_SOURCES src/sidemantic_extension.cpp src/sidemantic_parser.cpp src/sidemantic_grammar.cpp src/sidemantic_catalog.cpp)

build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES})
build_loadable_extension(${TARGET_NAME} " " ${EXTENSION_SOURCES})
Expand Down
16 changes: 12 additions & 4 deletions sidemantic-duckdb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ PROJ_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
# Configuration of extension
EXT_NAME=sidemantic
EXT_CONFIG=${PROJ_DIR}extension_config.cmake
SUPPORTED_DUCKDB_VERSION := v1.5.5
SUPPORTED_DUCKDB_VERSION := v1.5.6
SUPPORTED_DUCKDB_NEXT := v2.0-cyanoptera
# Pin the moving development branch to the native PEG API exercised by CI.
DUCKDB_NEXT_COMMIT := 80e17fc252edd6d9e9b090ae00a1100daef4876a
DUCKDB_VERSION ?= $(SUPPORTED_DUCKDB_VERSION)
# Exercise coexistence with the parser override preloaded by packaged shells.
DEFAULT_TEST_EXTENSION_DEPS := autocomplete

.PHONY: deps
deps:
@if [ "$(DUCKDB_VERSION)" != "$(SUPPORTED_DUCKDB_VERSION)" ]; then \
echo "DUCKDB_VERSION=$(DUCKDB_VERSION) is unsupported by the vendored extension-ci-tools checkout."; \
echo "Use DUCKDB_VERSION=$(SUPPORTED_DUCKDB_VERSION), or update extension-ci-tools and this guard together."; \
@if [ "$(DUCKDB_VERSION)" != "$(SUPPORTED_DUCKDB_VERSION)" ] && [ "$(DUCKDB_VERSION)" != "$(SUPPORTED_DUCKDB_NEXT)" ]; then \
echo "Use DUCKDB_VERSION=$(SUPPORTED_DUCKDB_VERSION) or $(SUPPORTED_DUCKDB_NEXT)."; \
exit 1; \
fi
@if [ ! -d duckdb/.git ]; then \
rm -rf duckdb; \
git clone --depth 1 --branch $(DUCKDB_VERSION) https://github.com/duckdb/duckdb.git duckdb; \
fi
@if [ "$(DUCKDB_VERSION)" = "$(SUPPORTED_DUCKDB_NEXT)" ]; then \
git -C duckdb fetch --depth 1 origin $(DUCKDB_NEXT_COMMIT); \
git -C duckdb checkout --detach $(DUCKDB_NEXT_COMMIT); \
else \
git -C duckdb fetch --depth 1 origin refs/tags/$(DUCKDB_VERSION):refs/tags/$(DUCKDB_VERSION); \
git -C duckdb checkout $(DUCKDB_VERSION); \
Expand Down
Loading
Loading