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

Segfault #1

Open
lmangani opened this issue Dec 12, 2024 · 0 comments
Open

Segfault #1

lmangani opened this issue Dec 12, 2024 · 0 comments

Comments

@lmangani
Copy link
Contributor

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.

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