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

Nebula does not handle NaN comparision correctly #4894

Closed
codesigner opened this issue Nov 17, 2022 · 1 comment
Closed

Nebula does not handle NaN comparision correctly #4894

codesigner opened this issue Nov 17, 2022 · 1 comment
Assignees
Labels
type/bug Type: something is unexpected

Comments

@codesigner
Copy link
Contributor

Please check the FAQ documentation before raising an issue

Describe the bug (required)

Executing the query below in Neo4j return with 36 result:

$ MATCH (n0)-[e0:EDGE_0{edgeProp_0_0: true}]->() WHERE (n0.id IN [2,4,6,11,14,20,21,26]) AND ((e0.edgeProp_0_6 <= (- (- e0.edgeProp_0_4))) XOR ((e0.edgeProp_0_2 >= e0.edgeProp_0_6) XOR (e0.edgeProp_0_1 OR e0.edgeProp_0_1))) MATCH (n1)-[]->()-[]-(n2) WHERE (n1.id = 23) AND ((((e0.edgeProp_0_2 / (e0.edgeProp_0_6 * e0.edgeProp_0_4)) * 0.781222) % ((e0.edgeProp_0_4 / e0.edgeProp_0_5) + e0.edgeProp_0_2)) < (((e0.edgeProp_0_6 / e0.edgeProp_0_2) % e0.edgeProp_0_5) * e0.edgeProp_0_2)) MATCH (n2)-[e1]->(n3) WHERE ((e0.edgeProp_0_6 >= ((e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5))) XOR ((e0.edgeProp_0_0 OR e0.edgeProp_0_0) OR (e0.edgeProp_0_0 OR e0.edgeProp_0_1))) RETURN count(*)

╒══════════╕
│"count(*)"│
╞══════════╡
│36 │
└──────────┘
while the same query in nebula reutrn nothing:

(root@nebula) [huskie_nebula]> MATCH (n0)-[e0:EDGE_0{edgeProp_0_0: true}]->() WHERE (id(n0) IN [2,4,6,11,14,20,21,26]) AND ((e0.edgeProp_0_6 <= (- (- e0.edgeProp_0_4))) XOR ((e0.edgeProp_0_2 >= e0.edgeProp_0_6) XOR (e0.edgeProp_0_1 OR e0.edgeProp_0_1))) MATCH (n1)-[]->()-[]-(n2) WHERE (id(n1) == 23) AND ((((e0.edgeProp_0_2 / (e0.edgeProp_0_6 * e0.edgeProp_0_4)) * 0.781222) % ((e0.edgeProp_0_4 / e0.edgeProp_0_5) + e0.edgeProp_0_2)) < (((e0.edgeProp_0_6 / e0.edgeProp_0_2) % e0.edgeProp_0_5) * e0.edgeProp_0_2)) MATCH (n2)-[e1]->(n3) WHERE ((e0.edgeProp_0_6 >= ((e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5))) XOR ((e0.edgeProp_0_0 OR e0.edgeProp_0_0) OR (e0.edgeProp_0_0 OR e0.edgeProp_0_1))) RETURN count()
+----------+
| count(
) |
+----------+
| 0 |
+----------+
Got 1 rows (time spent 19.288ms/33.787708ms)

Thu, 03 Nov 2022 18:16:57 CST

(root@nebula) [huskie_nebula]>
digging into the detail we found that nebual does handle NaN semanti correctly:

look at the query executed in Neo4j below:

MATCH (n0)-[e0:EDGE_0{edgeProp_0_0: true}]->() WHERE (n0.id IN [2,4,6,11,14,20,21,26]) AND ((e0.edgeProp_0_6 <= (- (- e0.edgeProp_0_4))) XOR ((e0.edgeProp_0_2 >= e0.edgeProp_0_6) XOR (e0.edgeProp_0_1 OR e0.edgeProp_0_1))) MATCH (n1)-[]->()-[]-(n2) WHERE (n1.id = 23) AND ((((e0.edgeProp_0_2 / (e0.edgeProp_0_6 * e0.edgeProp_0_4)) * 0.781222) % ((e0.edgeProp_0_4 / e0.edgeProp_0_5) + e0.edgeProp_0_2)) < (((e0.edgeProp_0_6 / e0.edgeProp_0_2) % e0.edgeProp_0_5) * e0.edgeProp_0_2)) return (e0.edgeProp_0_6 >= ( (e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5))) as bval, e0.edgeProp_0_6, e0.edgeProp_0_4, e0.edgeProp_0_5, (e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5) as kk

╒══════╤═════════════════╤═════════════════╤═════════════════╤════╕
│"bval"│"e0.edgeProp_0_6"│"e0.edgeProp_0_4"│"e0.edgeProp_0_5"│"kk"│
╞══════╪═════════════════╪═════════════════╪═════════════════╪════╡
│false │60 │0.774213 │112 │NaN │
├──────┼─────────────────┼─────────────────┼─────────────────┼────┤
│false │60 │0.774213 │112 │NaN │
├──────┼─────────────────┼─────────────────┼─────────────────┼────┤
│false │60 │0.774213 │112 │NaN │
├──────┼─────────────────┼─────────────────┼─────────────────┼────┤
│false │126 │0.313447 │133 │NaN │
├──────┼─────────────────┼─────────────────┼─────────────────┼────┤
│false │126 │0.313447 │133 │NaN │
├──────┼─────────────────┼─────────────────┼─────────────────┼────┤
│false │126 │0.313447 │133 │NaN │
├──────┼─────────────────┼─────────────────┼─────────────────┼────┤
│false │150 │0.552671 │95 │NaN │
├──────┼─────────────────┼─────────────────┼─────────────────┼────┤
│false │150 │0.552671 │95 │NaN │
├──────┼─────────────────┼─────────────────┼─────────────────┼────┤
│false │150 │0.552671 │95 │NaN │
└──────┴─────────────────┴─────────────────┴─────────────────┴────┘
For neo4j (e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5) return NaN and the NaN comparision (e0.edgeProp_0_6 >= ((e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5))) as bVal return false as expected, see wiki NaN comparision for more details.

but for Nebula, there is no NaN semantic the the comparision (e0.edgeProp_0_6 >= ((e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5))) as bVal return NULL

(root@nebula) [huskie_nebula]> MATCH (n0)-[e0:EDGE_0{edgeProp_0_0: true}]->() WHERE (id(n0) IN [2,4,6,11,14,20,21,26]) AND ((e0.edgeProp_0_6 <= (- (- e0.edgeProp_0_4))) XOR ((e0.edgeProp_0_2 >= e0.edgeProp_0_6) XOR (e0.edgeProp_0_1 OR e0.edgeProp_0_1))) MATCH (n1)-[]->()-[]-(n2) WHERE (id(n1) == 23) AND ((((e0.edgeProp_0_2 / (e0.edgeProp_0_6 * e0.edgeProp_0_4)) * 0.781222) % ((e0.edgeProp_0_4 / e0.edgeProp_0_5) + e0.edgeProp_0_2)) < (((e0.edgeProp_0_6 / e0.edgeProp_0_2) % e0.edgeProp_0_5) * e0.edgeProp_0_2)) return (e0.edgeProp_0_6 >= ((e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5))) as bVal, e0.edgeProp_0_6, e0.edgeProp_0_4, e0.edgeProp_0_5, (e0.edgeProp_0_4 % e0.edgeProp_0_6) % (e0.edgeProp_0_5 - e0.edgeProp_0_5) as kk
+----------+-----------------+--------------------+-----------------+-------------+
| bVal | e0.edgeProp_0_6 | e0.edgeProp_0_4 | e0.edgeProp_0_5 | kk |
+----------+-----------------+--------------------+-----------------+-------------+
| NULL | 60 | 0.7742130160331726 | 112 | DIV_BY_ZERO |
| NULL | 60 | 0.7742130160331726 | 112 | DIV_BY_ZERO |
| NULL | 60 | 0.7742130160331726 | 112 | DIV_BY_ZERO |
| NULL | 150 | 0.5526710152626038 | 95 | DIV_BY_ZERO |
| NULL | 150 | 0.5526710152626038 | 95 | DIV_BY_ZERO |
| NULL | 150 | 0.5526710152626038 | 95 | DIV_BY_ZERO |
| NULL | 126 | 0.3134469985961914 | 133 | DIV_BY_ZERO |
| NULL | 126 | 0.3134469985961914 | 133 | DIV_BY_ZERO |
| NULL | 126 | 0.3134469985961914 | 133 | DIV_BY_ZERO |
+----------+-----------------+--------------------+-----------------+-------------+
Got 9 rows (time spent 13.305ms/26.684042ms)

Thu, 03 Nov 2022 18:22:14 CST

(root@nebula) [huskie_nebula]>

Your Environments (required)

  • OS: uname -a
  • Compiler: g++ --version or clang++ --version
  • CPU: lscpu
  • Commit id (e.g. a3ffc7d8)

How To Reproduce(required)

Steps to reproduce the behavior:

  1. Step 1
  2. Step 2
  3. Step 3

Expected behavior

Additional context

@codesigner codesigner added the type/bug Type: something is unexpected label Nov 17, 2022
@codesigner codesigner self-assigned this Nov 17, 2022
@codesigner
Copy link
Contributor Author

#4893 fixed this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Type: something is unexpected
Projects
None yet
Development

No branches or pull requests

1 participant