IITDBGroup / gprom

GProM is a middleware that adds support for provenance to database backends.
http://www.cs.iit.edu/%7edbgroup/research/gprom.php
Apache License 2.0
8 stars 5 forks source link

Datalog lineage - spurious lineage for scalar operations in rule heads #96

Closed lordpretzel closed 1 year ago

lordpretzel commented 1 year ago

When using scalar operations in the rule head, the rewritten rule does not match the inputs against the head.

Q(A+B) :- R(A,B). ANS: Q. RP(2). LINEAGE FOR r FOR RESULTS FROM RP.

over instance

 A0 | A1 |
----------
 1  | 1  |
 2  | 3  |
 4  | 1  |

should return

 A0 | A1 |
----------
 2  | 3  |
 4  | 1  |

but does return

 A0 | A1 |
----------
 1  | 1  |
 2  | 3  |
 4  | 1  |

because the rewriting ignores head arguments that are scalar operations

RP(2).
PROV_R(A,B) :- R(A,B), RP(V0).

but should be

RP(2).
PROV_R(A,B) :- R(A,B), RP(V0), V0 = A + B.

This is currently not supported. We can either add support for more complex comparison or add another layer:

RP(2).
PROV_R(A,B) :- , PROV_PRE_R(A,B,V0), RP(V0).
PROV_PRE_R(A,B,A+B) :- R(A,B).
lordpretzel commented 1 year ago

Affected TPC-H queries