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

inline in recursive query trigger an error with query plan #2369

Open
DerZc opened this issue Dec 2, 2022 · 0 comments
Open

inline in recursive query trigger an error with query plan #2369

DerZc opened this issue Dec 2, 2022 · 0 comments

Comments

@DerZc
Copy link

DerZc commented Dec 2, 2022

Hi,

Consider the following program:

.type typeNqqj <: symbol
.type typeOwtl = typeNqqj
.type typeXtnj <: typeNqqj

.decl jlid(A:symbol)
.decl mhvs(A:typeNqqj)
.decl bukb(A:symbol, B:symbol, C:symbol, D:symbol, E:symbol) brie
.decl yqxe(A:symbol, B:typeNqqj, C:typeNqqj, D:typeNqqj, E:typeNqqj, F:typeNqqj) brie
.decl gvgm(A:typeNqqj, B:typeNqqj, C:typeNqqj) btree
.decl dioj(A:typeNqqj, B:symbol, C:symbol, D:typeNqqj, E:typeNqqj, F:symbol) inline brie
.decl xuyd(A:symbol, B:symbol, C:symbol, D:typeNqqj, E:typeNqqj, F:symbol)  btree
.decl mgkt(A:symbol, B:typeNqqj, C:typeNqqj, D:typeNqqj, E:symbol, F:symbol, G:symbol, H:typeNqqj)
.decl bldb(A:symbol, B:typeNqqj, C:typeNqqj) 
.decl bubx(A:typeNqqj, B:symbol, C:symbol, D:typeNqqj, E:typeNqqj, F:typeNqqj, G:typeNqqj, H:symbol) btree
.decl rlnd(A:typeNqqj)
.decl zayg(A:typeNqqj, B:symbol, C:typeNqqj, D:typeNqqj, E:typeNqqj) 
.decl kgbk(A:typeNqqj, B:symbol, C:symbol, D:typeNqqj, E:symbol, F:typeNqqj, G:symbol)  btree
.decl mtpd(A:symbol, B:typeNqqj, C:symbol, D:typeNqqj)  brie
.decl rxcw(A:symbol, B:symbol, C:symbol, D:symbol, E:typeNqqj, F:typeNqqj, G:symbol, H:symbol)
.decl ejei(A:typeNqqj, B:typeNqqj) btree
.decl hfgk(A:symbol, B:typeNqqj, C:symbol, D:symbol)
.decl fyyw(A:symbol, B:typeNqqj, C:typeNqqj, D:typeNqqj)
.decl wkkl(A:symbol, B:symbol, C:symbol, D:symbol)


jlid("R5f").
mhvs("WircMPs8").
wkkl("WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8").
mtpd("WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8").
hfgk("WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8").
rxcw("WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8").
kgbk("WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8").
xuyd("WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8", "WircMPs8").
bldb("WircMPs8", "WircMPs8", "WircMPs8").

bukb(A, A, A, A, A) :- jlid(A).
yqxe(E, B, B, B, B, B) :- mhvs(B), bukb(F, E, D, F, C).
gvgm(A, B, A) :- yqxe(E, B, A, A, A, A), jlid(E).
mgkt(A, B, B, A, A, A, A, A) :- gvgm(_, B, A).
bubx(B, A, F, B, A, A, B, B) :- gvgm(B, A, A), bukb(G, G, E, D, F), gvgm(C, B, B).
rlnd(A) :- dioj(A, C, D, A, A, _).
rlnd(B) :- xuyd(G, G, _, B, A, F).
zayg(E, F, B, C, C) :- gvgm(E, F, H), dioj(B, I, J, C, _, J).
dioj(H, JJ, D, S, S, I) :- zayg(C, JJ, K, T, S), kgbk(L, DD, HH, U, JJ, S, GG), mgkt(KK, AA, H, I, EE, II, JJ, U), bubx(M, FF, BB, F, D, S, T, _), rlnd(H), mtpd(JJ, K, KK, D).
ejei(A, A) :- rlnd(A).
fyyw(C, A, B, B) :- bldb(B, C, A), ejei(B, A).
bubx(K, KK, LL, HH, W, N, HH, F) :- hfgk(QQ, M, "WircMPs8", RR), fyyw(QQ, T, F, Z), wkkl(SS, RR, MM, OO), mtpd(SS, R, PP, Z), xuyd(TT, MM, LL, I, HH, LL), kgbk(P, NN, SS, T, NN, O, PP), fyyw(LL, K, F, N), rxcw(MM, TT, RR, PP, KK, W, RR, MM).
.plan 0:(5,8,4,1,7,2,3,6)

.output bubx

there is a query plan in last rule, I run it with souffle example.dl and an error message:

Error: Ignored execution plan for non-recursive clause in file example.dl at line 48
.plan 0:(5,8,4,1,7,2,3,6)
--------^-----------------

but I check it manually and find it is a recursive query because there is a circle for relation: bubx->dioj->rlnd->ejei->fyyw->bubx.
And I find if I remove the keyword inline for relation dioj, the program can execute correctly.
The version of Souffle is b8b1d69.
This test case is slightly complex because recursive query is hard to reduce, but I will keep working on a simpler one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant