Skip to content

fix(span_table_functions): explicit unique_ptr<BinsBindData> -> unique_ptr<FunctionData> in Copy()#173

Open
estebanzimanyi wants to merge 2 commits into
MobilityDB:fix/bump-meos-pinfrom
estebanzimanyi:fix/span-bins-bind-copy-unique-ptr-conv
Open

fix(span_table_functions): explicit unique_ptr<BinsBindData> -> unique_ptr<FunctionData> in Copy()#173
estebanzimanyi wants to merge 2 commits into
MobilityDB:fix/bump-meos-pinfrom
estebanzimanyi:fix/span-bins-bind-copy-unique-ptr-conv

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

GCC + DuckDB 1.4.4's unique_ptr does not implicitly convert derived to base, so return r; in BinsBindData::Copy() fails to compile:

src/temporal/span_table_functions.cpp:47:16: error: could not convert 'r'
  from 'unique_ptr<duckdb::{anonymous}::BinsBindData,...>'
  to 'unique_ptr<duckdb::FunctionData,...>'

This is a pre-existing main-branch issue that fires on a clean local build with the current vcpkg-pinned DuckDB 1.4.4. It was masked in earlier DuckDB versions which allowed the implicit derived-to-base unique_ptr conversion.

Fix

Use DuckDB's unique_ptr_cast<SRC, TGT> helper (defined in duckdb/src/include/duckdb/common/helper.hpp:130) to do the conversion explicitly:

-        return r;
+        return unique_ptr_cast<BinsBindData, FunctionData>(std::move(r));

Matches the canonical DuckDB-core pattern (see e.g. duckdb/src/include/duckdb/function/table/table_scan.hpp's TableScanBindData::Copy() which does return std::move(bind_data); for the same shape).

No behaviour change

The move is exactly what the implicit conversion would have done if the compiler accepted it. The unique_ptr_cast helper is a transparent reinterpret + ownership-transfer.

Verification

Surfaced by a fresh local build (GEN=ninja make release on a clean checkout of main + vcpkg's MEOS + DuckDB v1.4.4 submodule). After this fix, the build proceeds past span_table_functions.cpp.

estebanzimanyi added a commit to estebanzimanyi/MobilityDuck that referenced this pull request May 21, 2026
PR MobilityDB#129's base (feat/parity-final-batch / PR MobilityDB#130) does not yet carry
the PR MobilityDB#173 fix for src/temporal/span_table_functions.cpp:47.  Cherry-
picking the th3index payload onto current MobilityDB#130 inherits the DuckDB
1.4.4 implicit derived->base unique_ptr conversion error.

This polyfill applies the same fix as MobilityDB#173 (uses unique_ptr_cast),
matching the polyfill pattern from the feat/geography-* stack.
Adds the SIZEOF_LONG_LONG emission to the rendered pg_config.h so the
DuckDB-Wasm (wasm32-emscripten / ILP32) build of MEOS no longer fails the
pg_bitutils integer-width check.
…e_ptr<FunctionData> in Copy()

GCC + DuckDB 1.4.4's unique_ptr does not implicitly convert
derived->base, so 'return r;' in BinsBindData::Copy() fails to compile:

  error: could not convert 'r' from 'unique_ptr<duckdb::{anonymous}::BinsBindData,...>'
                                to 'unique_ptr<duckdb::FunctionData,...>'

Use duckdb's unique_ptr_cast helper (from duckdb/common/helper.hpp) to
do the conversion explicitly, matching the canonical pattern used by
DuckDB core (e.g. table_scan.hpp's TableScanBindData::Copy()).  No
behaviour change; the move is exactly what the implicit conversion
would have done if the compiler accepted it.
@estebanzimanyi estebanzimanyi changed the base branch from main to fix/bump-meos-pin May 30, 2026 08:00
@estebanzimanyi estebanzimanyi force-pushed the fix/span-bins-bind-copy-unique-ptr-conv branch from a7afcbd to 8c79a14 Compare May 30, 2026 08:00
@estebanzimanyi estebanzimanyi force-pushed the fix/bump-meos-pin branch 4 times, most recently from fa2de57 to 17588c0 Compare June 2, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant