Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataStruct.struct_vector(i).child(j) leads to assertion failure #272

Open
solidsnack opened this issue Mar 7, 2024 · 0 comments
Open

DataStruct.struct_vector(i).child(j) leads to assertion failure #272

solidsnack opened this issue Mar 7, 2024 · 0 comments

Comments

@solidsnack
Copy link

This project has brought me quite close to realizing a new extension of DuckDB.

I'm using duckdb-rs@919f145 with features = ["bundled", "vtab-loadable"] on a 2022 M2 Mac.

In a VTab::func implementation, I would like to update a structured column. That's easy enough -- get the column and then get its subcolumns and update each one. However, something goes wrong when calling StructVector.child()

Assertion failed: (dynamic_cast<TARGET *>(this)), function Cast, file vector_buffer.hpp, line 132.
Abort trap: 6

This function just calls duckdb_struct_vector_get_child, though, so it's hard to see how there could be anything wrong with it. That function ultimately delegates to StructVector::GetEntries (in C++). Inserting std::cout << ... lines indicates that all the types are as expected:

  • vector.GetType().id() is 100, equal to LogicalTypeId::STRUCT
  • vector.auxiliary->GetBufferType() is 5, equal to VectorBufferType::STRUCT_BUFFER

However, the call to vector.auxiliary->Cast<VectorStructBuffer>() fails. It turns out there is a dynamic cast in that function, as a kind of assert:

D_ASSERT(dynamic_cast<TARGET *>(this));

This is what is failing. Commenting it out seems to lead to no problems. Then I am able to get the flat buffers and add data to them (with Inserter or using .set_null(), &c) and query the results in DuckDB.

This recent commit may be related: duckdb/duckdb@837211d

@solidsnack solidsnack changed the title DataStruct.struct_vector(<i>).child(<j>) leads to assertion failure DataStruct.struct_vector(i).child(j) leads to assertion failure Mar 7, 2024
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

No branches or pull requests

1 participant