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
Unexpected result of ge
on -0.0
and 0.0
under magic rewrite
#122
Comments
Interesting, seems that this only happens with -0.0 and not with any other number. |
The gist of the problem can be summarized in:
The result is
Not sure what can be done. Going the python way basically means that we will eliminate -0.0 from numbers, and I'm not sure that's what we want to do. Making the second one At least throwing away -0.0 is self-consistent. So if everything else fails, maybe we will go the Python way. |
It seems Rust agrees with python:
passes. |
Hi @zh217 I have a small question. For this test case, is this problem caused by the transformation of |
No, magic rewrite doesn't change that. It is caused by magic rewrite enabling range scan on the relation |
I got it! Thank you very much! |
I'm very sorry to disturb you. But I have another question. When does the magic set rewrite get triggered?
But this program produces correct results, which means it not triggers range scan. (By the way, there is a small error in the document of magic set rewrite https://docs.cozodb.org/en/latest/execution.html#magic-set-rewrites, the first line of the example should be |
Hi @zh217 so sorry to disturb you. Do you have documents available that outlines the specific case under which the magic set rewrite is applied? I just have the questions mentioned above. |
Sorry I haven't had time to look at the above behaviour yet. Magic set rewriting is a standard optimization technique for optimizing Datalog programs, and there are quite a few review articles describing it in details, the one easiest to read is probably Datalog and Recursive Query Processing. Our implementation follows their descriptions. Note that the rewriting technique only applies to pure Datalog, that is, without negation, aggregation, etc., so any time any of these are encountered they are left as it is. Once you know the terminologies of magic set rewriting, the result of |
I got it! Thank you very much for taking the time to respond to me amid your busy schedule! |
Hi,
Consider the following program:
I get the results
[[null, -0.0], [null, 0.0]]
, but the value ofnwku
is[[null]]
and the value ofxukw
is[[0.0, null]]
, so the result ofssie
should not be[null, -0.0]
.I also tried to add
:disable_magic_rewrite true
, then I got correct results.I can reproduce this on version
0.7.1
The text was updated successfully, but these errors were encountered: