Skip to content

[BUG] Node null-check predicate aborts with vertex variable missing property #191

@d1zzy126

Description

@d1zzy126

Describe the bug
NeuG aborts on a valid null-check predicate over a bound node variable. A simple query like MATCH (a:Node) WHERE a IS NOT NULL RETURN 1 should execute normally, but the reproduced build aborts in variable.cc:274 with vertex variable missing property, then exits with signal 6.

Execution Logs
The commands below reproduce the issue.

from __future__ import annotations

import shutil
import tempfile
from pathlib import Path

from neug import Database


def main() -> None:
    db_path = Path(tempfile.mkdtemp(prefix="neug_bug_005_"))
    print(f"Using database path: {db_path}", flush=True)

    db = Database(str(db_path), mode="w")
    conn = db.connect()

    setup = [
        ("CREATE NODE TABLE Node(id INT64, PRIMARY KEY(id));", "schema"),
        ("CREATE (a:Node {id: 1});", "update"),
    ]

    try:
        for idx, (query, mode) in enumerate(setup, start=1):
            print(f"STEP {idx}: {query}", flush=True)
            conn.execute(query, access_mode=mode)

        control_query = "MATCH (a:Node) RETURN 1"
        print(f"STEP {len(setup) + 1}: {control_query}", flush=True)
        control_rows = list(conn.execute(control_query, access_mode="read"))
        print(f"Control result: {control_rows}", flush=True)

        crash_query = "MATCH (a:Node) WHERE a IS NOT NULL RETURN 1"
        print(f"STEP {len(setup) + 2}: {crash_query}", flush=True)
        print("Expected: query returns one row.", flush=True)
        print(
            "Actual on the reproduced NeuG build: process aborts with "
            "`vertex variable missing property` followed by signal 6.",
            flush=True,
        )
        list(conn.execute(crash_query, access_mode="read"))
    finally:
        try:
            conn.close()
        except Exception:
            pass
        try:
            db.close()
        except Exception:
            pass
        shutil.rmtree(db_path, ignore_errors=True)


if __name__ == "__main__":
    main()

Expected behavior
The query should execute normally, just like the control query without the null-check predicate.

Error Message
Observed output from a reproduced run:

Using database path: /tmp/neug_bug_005_xxxxxxxx
STEP 1: CREATE NODE TABLE Node(id INT64, PRIMARY KEY(id));
STEP 2: CREATE (a:Node {id: 1});
STEP 3: MATCH (a:Node) RETURN 1
Control result: [[1]]
STEP 4: MATCH (a:Node) WHERE a IS NOT NULL RETURN 1
Expected: query returns one row.
Actual on the reproduced NeuG build: process aborts with `vertex variable missing property` followed by signal 6.
F... variable.cc:274] vertex variable missing property: tag {
  id: 0
}
...
E... neug_binding.cc:45] Received signal 6, Remove all filelocks

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions