Skip to content

Segfault #1

Open
Open
@lmangani

Description

@lmangani

We have two version of this extension:

Working Example

main: the main branch contains a version based on a table function.

It invokes wvlet functions correctly, converts input to SQL and returns results:

D select * from wvlet('from [[1]] as numbers(a)');
-- wvlet version=0.0.0+1-d1d99f7b, src=01JEVTWDECV00NJH6Z93KYQE8J.wv:1
select * from (values (1)) as numbers(a)
┌───────┐
│   a   │
│ int32 │
├───────┤
│     1 │
└───────┘
string query = input[i].GetString();
        std::string json = "[\"-q\", \"" + query + "\"]";
        
        const char* sql_result = wvlet_compile_query(json.c_str());

Failing Example

query-planner: this branch contains a query planner version.

Same library, same functions. In this version, invoking wvlet causes a segfault when trying to convert to SQL, before even attempting to return data into DuckDB:

D from [[1]] as numbers(a);
segfault

The code is essentially the same, and the passed types are correct.

  std::string json = "[\"-q\", \"" + query + "\"]";
  wvlet_compile_main(json.c_str());
  const char* sql_result = wvlet_compile_query(json.c_str());
  if (!sql_result || strlen(sql_result) == 0) {
    throw std::runtime_error("Failed to compile wvlet script");
  }

⚠️ Tracing shows the library segfaults while trying to dereference a null pointer.

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