ashkapsky / BigDatalog

Apache License 2.0
57 stars 20 forks source link

NullPointerException for recursion of type a<-b, b<-a #7

Open thomasrebele opened 7 years ago

thomasrebele commented 7 years ago

Hello,

I tried to execute the query rel(X,Y) with the following datalog program:

rel2(X,Y) <- rel1(X,Y). 
rel2(X,Z) <- rel3(X,Y), rel1(Y,Z). 
rel3(X,Z) <- rel2(X,Y), rel1(Y,Z). 
database({ rel1(X:string, Y:string) }).

and the following data for rel1:

a   b
b   c

I expect the output rel3(a,c). However I get a NullPointerException instead:

17/10/14 23:16:44 INFO BigDatalogContext: BigDatalog Query: "rel3(A,B)"
17/10/14 23:16:44 INFO BigDatalogContext: ** START Operator Program START **
17/10/14 23:16:44 INFO BigDatalogContext: 
0: rel3(X, Y) <RECURSIVE_CLIQUE>(Recursion: LINEAR, Evaluation Type: SemiNaive)
Exit Rules: 
Recursive Rules: 
 1: (X, Y) <DISTINCT PROJECT>
  2: (0.Y = 1.X) <JOIN>
   3: rel2(X, Y) <MUTUAL_RECURSIVE_CLIQUE>(Recursion: LINEAR, Evaluation Type: SemiNaive)
   Exit Rules: 
    4: rel1(X, Y) <BASE_RELATION>
   Recursive Rules: 
    4: (X, Y) <DISTINCT PROJECT>
     5: (0.Y = 1.X) <JOIN>
      6: rel3(X, Y) <RECURSIVE_RELATION>
      6: rel1(X, Y) <BASE_RELATION>
   3: rel1(X, Y) <BASE_RELATION>
17/10/14 23:16:44 INFO BigDatalogContext: ** END Operator Program END **
17/10/14 23:16:44 INFO BigDatalogContext: ** START BigDatalog Program START **
Exception in thread "main" java.lang.NullPointerException
    at edu.ucla.cs.wis.bigdatalog.spark.logical.LogicalPlanGenerator.getPlan(LogicalPlanGenerator.scala:74)
    at edu.ucla.cs.wis.bigdatalog.spark.logical.LogicalPlanGenerator.getPlan(LogicalPlanGenerator.scala:101)
    at edu.ucla.cs.wis.bigdatalog.spark.logical.LogicalPlanGenerator.getPlan(LogicalPlanGenerator.scala:70)
    at edu.ucla.cs.wis.bigdatalog.spark.logical.LogicalPlanGenerator.generateSparkProgram(LogicalPlanGenerator.scala:66)
    at edu.ucla.cs.wis.bigdatalog.spark.BigDatalogContext.generateProgram(BigDatalogContext.scala:149)
    at edu.ucla.cs.wis.bigdatalog.spark.BigDatalogContext.query(BigDatalogContext.scala:137)
    at bigdatalog.Main.main(Main.java:59)
17/10/14 23:16:44 INFO SparkContext: Invoking stop() from shutdown hook

Is there any way to get it working?