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

MAP = MAP comparison is not registered, but the comparison can still be executed. #3089

Closed
mxwli opened this issue Mar 19, 2024 · 0 comments · Fixed by #3344
Closed

MAP = MAP comparison is not registered, but the comparison can still be executed. #3089

mxwli opened this issue Mar 19, 2024 · 0 comments · Fixed by #3344
Labels
frontend Frontend, i.e., binder, parser, query planning-related issues

Comments

@mxwli
Copy link
Contributor

mxwli commented Mar 19, 2024

Code: (only works on the 3054-fix branch right now)

conn.execute("CREATE NODE TABLE tab(id int64, mp MAP(double, int64), mp2 MAP(int64, double), mp3 MAP(string, string), primary key(id))")
conn.execute(
        "MERGE (t:tab {id: 0, mp: $1, mp2: $2, mp3: $3}) RETURN t.*",
        {"1": {1.0: 5, 2: 3, 2.2: -1},
         "2": {5: -0.5, 4: -0.0, 0: 2.2},
         "3": {'a': '1', 'b': '2', 'c': '3'}})
conn.execute(
        "MATCH (t:tab) WHERE t.mp = map([1.0, 2.0, 2.2], [5, 3, -1]) RETURN t.*")

The comparison works, but MAP = MAP is not registered as a valid comparison. Interestingly, if we swap out the second map for a parameter in the last query

result = conn.execute(
        "MATCH (t:tab) WHERE t.mp = $1 RETURN t.*",
        {"1": {1.0: 5, 2: 3, 2.2: -1}})

The query throws the following exception:

RuntimeError: Parameter 1 has data type MAP(DOUBLE: INT64) but expects STRING.

indicating that there is likely a conversion to STRING before the map comparison is made.

@mxwli mxwli added the frontend Frontend, i.e., binder, parser, query planning-related issues label Mar 19, 2024
@manh9203 manh9203 mentioned this issue Apr 22, 2024
manh9203 added a commit that referenced this issue Apr 23, 2024
* Register all valid types for comparison functions

* Add tests

* Remove comment
acquamarin pushed a commit that referenced this issue Apr 24, 2024
* Register all valid types for comparison functions

* Add tests

* Remove comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Frontend, i.e., binder, parser, query planning-related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant