Skip to content

Error compiling storage/ducklake_insert.cpp while building ducklake-iceberg #593

@youattd

Description

@youattd

Seeing a repeatable compile error while trying to build duckdb-iceberg. On the surface it looks like a type conflict in the function return value and the type of result allocated using make_uniq. Opened this as a question since it happens when trying to build duckdb-iceberg which pulls in ducklake from a cmake file, and checks out a specific commit hash for ducklake. So not certain there's not a missing include file or it's finding or using a wrong include file.

Behavior seems to be the same whether we checkout duckdb_iceberg/duckdb at main, v1.4.1. recent v1.4.2 tag or let it default to whatever duckdb-iceberg checks out.

$ cd duckdb_iceberg/
$ ls
CMakeLists.txt  data  duckdb  extension-ci-tools  extension_config.cmake  LICENSE  Makefile  README.md  scripts  src  test  vcpkg_installed  vcpkg.json
$ git status
HEAD detached at 5f5cd041

$ cd duckdb
$ git status
HEAD detached at 68d7555f68
nothing to commit, working tree clean

Here's the error:

[ 51%] Building CXX object extension/ducklake/src/storage/CMakeFiles/ducklake_storage.dir/ducklake_inlined_data_reader.cpp.o
[ 51%] Building CXX object extension/ducklake/src/storage/CMakeFiles/ducklake_storage.dir/ducklake_insert.cpp.o
/duckdb_iceberg-1.4.2/build/release/_deps/ducklake_extension_fc-src/src/storage/ducklake_insert.cpp: In static member function 'static duckdb::unique_ptr<duckdb::LogicalOperator> duckdb::DuckLakeInsert::InsertCasts(duckdb::Binder&, duckdb::unique_ptr<duckdb::LogicalOperator>&)':

/duckdb_iceberg-1.4.2/build/release/_deps/ducklake_extension_fc-src/src/storage/ducklake_insert.cpp:670:16: error: could not convert 'result' from 'unique_ptr<duckdb::LogicalProjection,default_delete<duckdb::LogicalProjection>,[...]>' to 'unique_ptr<duckdb::LogicalOperator,default_delete<duckdb::LogicalOperator>,[...]>'
  670 |         return result;
      |                ^~~~~~
      |                |
      |                unique_ptr<duckdb::LogicalProjection,default_delete<duckdb::LogicalProjection>,[...]>
gmake[3]: *** [extension/ducklake/src/storage/CMakeFiles/ducklake_storage.dir/build.make:174: extension/ducklake/src/storage/CMakeFiles/ducklake_storage.dir/ducklake_insert.cpp.o] Error 1
gmake[3]: Leaving directory '/duckdb_iceberg-1.4.2/build/release'
gmake[2]: *** [CMakeFiles/Makefile2:8746: extension/ducklake/src/storage/CMakeFiles/ducklake_storage.dir/all] Error 2
gmake[2]: Leaving directory '/duckdb_iceberg-1.4.2/build/release'
gmake[1]: *** [Makefile:136: all] Error 2
gmake[1]: Leaving directory '/duckdb_iceberg-1.4.2/build/release'
make: *** [extension-ci-tools/makefiles/duckdb_extension.Makefile:161: release] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.Jtmc9d (%build)

here's the function (and file https://github.com/duckdb/ducklake/blob/main/src/storage/ducklake_insert.cpp). The function was added in the September 2025 timeframe according to blame:

// Note template type is LogicalOperator
unique_ptr<LogicalOperator> DuckLakeInsert::InsertCasts(Binder &binder, unique_ptr<LogicalOperator> &plan) {
    vector<unique_ptr<Expression>> cast_expressions;

    auto &types = plan->types;
    auto bindings = plan->GetColumnBindings();

    for (idx_t col_idx = 0; col_idx < types.size(); col_idx++) {
        auto &type = types[col_idx];
        auto &binding = bindings[col_idx];
        auto ref_expr = make_uniq<BoundColumnRefExpression>(type, binding);
        if (DuckLakeTypes::RequiresCast(type)) {
            auto new_type = DuckLakeTypes::GetCastedType(type);
            cast_expressions.push_back(
                BoundCastExpression::AddCastToType(binder.context, std::move(ref_expr), new_type));
        } else {
            cast_expressions.push_back(std::move(ref_expr));
        }
    }

    // Note template type is LogicalProjection
    auto result = make_uniq<LogicalProjection>(binder.GenerateTableIndex(), std::move(cast_expressions));
    result->children.push_back(std::move(plan));

    return result;
}

note the auto result templated type of LogicalProjection and the func's declared return type of templated LogicalOperator. They have the same pattern in other files, but in those the return type matches ptr result type.

It uses a utility function make_uniq (obviously), which uses c++ template type forwarding, so suspected at one point that it may be a newer gcc feature. The compiler used is the default on Alma 9: c++ (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5)

The path to that file (from a sandbox build) is /duckdb_iceberg-1.4.2/build/release/_deps/ducklake_extension_fc-src/src/storage/ducklake_insert.cpp

here's the cmake file w/the embedded hard coded commit hash to pull. this is in the duckdb repo https://github.com/duckdb/duckdb/blob/68d7555f68bd25c1a251ccca2e6338949c33986a/.github/config/extensions/ducklake.cmake

and the make_uniq helper func is declared here https://github.com/duckdb/duckdb/blob/68d7555f68bd25c1a251ccca2e6338949c33986a/src/include/duckdb/common/helper.hpp

Any advice is welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions