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

Datalog lineage TPC-H test queries #93

Open
30 of 38 tasks
lordpretzel opened this issue Oct 9, 2022 · 4 comments
Open
30 of 38 tasks

Datalog lineage TPC-H test queries #93

lordpretzel opened this issue Oct 9, 2022 · 4 comments
Assignees
Labels

Comments

@lordpretzel
Copy link
Collaborator

lordpretzel commented Oct 9, 2022

Queries that work without optimization

  • q01
  • q02
  • q03
  • q04
  • q05
  • q06
  • q07
  • q08
  • q09
  • q10
  • q11
  • q12
  • q13
  • q14
  • q15
  • q17
  • q18
  • q19
  • q20

Queries that work with optimization

  • q01
  • q02
  • q03
  • q04
  • q05
  • q06
  • q07
  • q08
  • q09
  • q10
  • q11
  • q12
  • q13
  • q14
  • q15
  • q17
  • q18
  • q19
  • q20
@lordpretzel
Copy link
Collaborator Author

Q2

PROGRAM:
        Q(S_ACCOUNT_BAL,S_NAME,N_NAME,P_KEY,S_COST,P_MANU,S_ADDR,S_PHONE,S_COMMENT) :- NATION(V9,N_NAME,V10,V11),REGION(V1
0,'EUROPE',V12),SUPPLIER(V13,S_NAME,S_ADDR,V9,S_PHONE,S_ACCOUNT_BAL,S_COMMENT),PART(P_KEY,V14,P_MANU,V15,V16,15,V17,V18,V1
9),PARTSUPP(P_KEY,V13,V20,S_COST,V21),Q2(P_KEY,S_COST).
        RP(X1,X2,X3,X4,X5,X6,X7,X8,X9) :- RTPCQ02(X1,X2,X3,X4,X5,X6,X7,X8,X9).
        Q2(P_KEY,min(S_COST)) :- Q1(X1,X2,X3,P_KEY,S_COST,X5,X6,X7,X8).
        Q1(S_ACCOUNT_BAL,S_NAME,N_NAME,P_KEY,S_COST,P_MANU,S_ADDR,S_PHONE,S_COMMENT) :- NATION(N_KEY,N_NAME,R_KEY,X1),REGI
ON(R_KEY,'EUROPE',X2),SUPPLIER(S_KEY,S_NAME,S_ADDR,N_KEY,S_PHONE,S_ACCOUNT_BAL,S_COMMENT),PART(P_KEY,X3,P_MANU,X4,P_TYPE,1
5,X5,X6,X7),PARTSUPP(P_KEY,S_KEY,X8,S_COST,X9).
        PROV_Q1(X1,X2,X3,P_KEY,S_COST,X5,X6,X7,X8) :- Q1(X1,X2,X3,P_KEY,S_COST,X5,X6,X7,X8),PROV_Q2(P_KEY,V1).
        PROV_Q2(P_KEY,S_COST) :- RP(S_ACCOUNT_BAL,S_NAME,N_NAME,P_KEY,S_COST,P_MANU,S_ADDR,S_PHONE,S_COMMENT).
        PROV_NATION(V9,N_NAME,V10,V11) :- NATION(V9,N_NAME,V10,V11),SUPPLIER(V13,S_NAME,S_ADDR,V9,S_PHONE,S_ACCOUNT_BAL,S_
COMMENT),REGION(V10,'EUROPE',V12),PARTSUPP(P_KEY,V13,V20,S_COST,V21),RP(S_ACCOUNT_BAL,S_NAME,N_NAME,P_KEY,S_COST,P_MANU,S_
ADDR,S_PHONE,S_COMMENT).
        PROV_NATION(N_KEY,N_NAME,R_KEY,X1) :- NATION(N_KEY,N_NAME,R_KEY,X1),SUPPLIER(S_KEY,S_NAME,S_ADDR,N_KEY,S_PHONE,S_A
CCOUNT_BAL,S_COMMENT),REGION(R_KEY,'EUROPE',X2),PARTSUPP(P_KEY,S_KEY,X8,S_COST,X9),PROV_Q1(S_ACCOUNT_BAL,S_NAME,N_NAME,P_K
EY,S_COST,P_MANU,S_ADDR,S_PHONE,S_COMMENT).
ANSWER RELATION:
        PROV_NATION

INFO(mem_mgr.c:655) Create chunk of size 1048576 in context TRANSLATOR_CONTEXT
FATAL(datalog_model_checker.c:115) Predicate of body atom @Q1(S_ACCOUNT_BAL,S_NAME,N_NAME,P_KEY,S_COST,P_MANU,S_ADDR,S_PHO
NE,S_COMMENT) is neither IDB nor EDB (used in facts of present in the database)
ERROR (exception.c:145) exception was thrown (RECOVERABLE) datalog_model_checker.c - 115 - <Predicate of body atom @Q1(S_A
CCOUNT_BAL,S_NAME,N_NAME,P_KEY,S_COST,P_MANU,S_ADDR,S_PHONE,S_COMMENT) is neither IDB nor EDB (used in facts of present in
 the database)>


Error occured
(datalog_model_checker.c:115) 
Predicate of body atom @Q1(S_ACCOUNT_BAL,S_NAME,N_NAME,P_KEY,S_COST,P_MANU,S_ADDR,S_PHONE,S_COMMENT) is neither IDB nor ED
B (used in facts of present in the database)
ABORT BASED ON EXCEPTION wipe <QUERY_CONTEXT>

@lordpretzel lordpretzel added the bug label Oct 9, 2022
@lordpretzel lordpretzel self-assigned this Oct 9, 2022
@lordpretzel
Copy link
Collaborator Author

lordpretzel commented Oct 9, 2022

Q7

Q(SUPP_NATION,CUST_NATION,L_YEAR,sum(VOLUME)) :- QSUB(SUPP_NATION,CUST_NATION,L_YEAR,VOLUME).
        RP(X1,X2,X3,X4) :- RTPCQ07(X1,X2,X3,X4).

QSUB(SUPP_NATION,CUST_NATION,year(L_SD),(L_EXTENDEDPRICE * (1 - L_DISCOUNT))) :- SUPPLIER(L_SK,S2,S3,S_NATIONKEY,S4,S5,S6),LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13),ORDERS(L_OK,L_CK,O1,O2,O3,O4,O5,O6,O7),CUSTOMER(L_CK,C1,C2,C_NATIONKEY,C3,C4,C5,C6),NATION(S_NATIONKEY,SUPP_NATION,N1,N2),NATION(C_NATIONKEY,CUST_NATION,N3,N4),((L_SD >= '1995-01-01')),((L_SD <= '1996-12-31')),((SUPP_NATION = 'FRANCE')),((CUST_NATION = 'GERMANY')).

QSUB(SUPP_NATION,CUST_NATION,year(L_SD),(L_EXTENDEDPRICE * (1 - L_DISCOUNT))) :- SUPPLIER(L_SK,S2,S3,S_NATIONKEY,S4,S5,S6),LINEITEM(L
_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13),ORDERS(L_OK,L_CK,O1,O2,O3,O4,O5,O6,O7),CUSTOMER(L_CK,C1,C2,C_NATIONKEY,C3,C4,C5,C6),NATION(S_NATIONKEY,SUPP_NATION,N1,N2),NATION(C_NATIONKEY,CUST_NATION,N3,N4),((L_SD >= '1995-01-01')),((L_SD <= '1996-12-31')),((SUPP_NATION = 'GERMANY')),((CUST_NATION = 'FRANCE')).

PROV_QSUB(SUPP_NATION,CUST_NATION,L_YEAR,VOLUME) :- QSUB(SUPP_NATION,CUST_NATION,L_YEAR,VOLUME),RP(SUPP_NATION,CUST_NATION,L_YEAR,V1).

PROV_LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13) :- LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13),ORDERS(L_OK,L_CK,O1,O2,O3,O4,O5,O6,O7),SUPPLIER(L_SK,S2,S3,S_NATIONKEY,S4,S5,S6),CUSTOMER(L_CK,C1,C2,C_NATIONKEY,C3,C4,C5,C6),NATION(S_NATIONKEY,SUPP_NATION,N1,N2),NATION(C_NATIONKEY,CUST_NATION,N3,N4),((L_SD >= '1995-01-01')),((L_SD <= '1996-12-31')),((SUPP_NATION = 'FRANCE')),((CUST_NATION = 'GERMANY')),PROV_QSUB(SUPP_NATION,CUST_NATION,V0,V1).

PROV_LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13) :- LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13),ORDERS(L_OK,L_CK,O1,O2,O3,O4,O5,O6,O7),SUPPLIER(L_SK,S2,S3,S_NATIONKEY,S4,S5,S6),CUSTOMER(L_CK,C1,C2,C_NATIONKEY,C3,C4,C5,C6),NATION(S_NATIONKEY,SUPP_NATION,N1,N2),NATION(C_NATIONKEY,CUST_NATION,N3,N4),((L_SD >= '1995-01-01')),((L_SD <= '1996-12-31')),((SUPP_NATION = 'GERMANY')),((CUST_NATION = 'FRANCE')),PROV_QSUB(SUPP_NATION,CUST_NATION,V0,V1).

PROGRAM:
        Q(SUPP_NATION,CUST_NATION,L_YEAR,sum(VOLUME)) :- QSUB(SUPP_NATION,CUST_NATION,L_YEAR,VOLUME).
        RP(X1,X2,X3,X4) :- RTPCQ07(X1,X2,X3,X4).
        QSUB(SUPP_NATION,CUST_NATION,year(L_SD),(L_EXTENDEDPRICE * (1 - L_DISCOUNT))) :- SUPPLIER(L_SK,S2,S3,S_NATIONKEY,S4,S5,S6),LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13),ORDERS(L_OK,L_CK,O1,O2,O3,O4,O5,O6,O7),CUSTOMER(L_CK,C1,C2,C_NATIONKEY,C3,C4,C5,C6),NATION(S_NATIONKEY,SUPP_NATION,N1,N2),NATION(C_NATIONKEY,CUST_NATION,N3,N4),((L_SD >= '1995-01-01')),((L_SD <= '1996-12-31')),((SUPP_NATION = 'FRANCE')),((CUST_NATION = 'GERMANY')).
        QSUB(SUPP_NATION,CUST_NATION,year(L_SD),(L_EXTENDEDPRICE * (1 - L_DISCOUNT))) :- SUPPLIER(L_SK,S2,S3,S_NATIONKEY,S4,S5,S6),LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13),ORDERS(L_OK,L_CK,O1,O2,O3,O4,O5,O6,O7),CUSTOMER(L_CK,C1,C2,C_NATIONKEY,C3,C4,C5,C6),NATION(S_NATIONKEY,SUPP_NATION,N1,N2),NATION(C_NATIONKEY,CUST_NATION,N3,N4),((L_SD >= '1995-01-01')),((L_SD <= '1996-12-31')),((SUPP_NATION = 'GERMANY')),((CUST_NATION = 'FRANCE')).
        PROV_QSUB(SUPP_NATION,CUST_NATION,L_YEAR,VOLUME) :- QSUB(SUPP_NATION,CUST_NATION,L_YEAR,VOLUME),RP(SUPP_NATION,CUST_NATION,L_YEAR,V1).
        PROV_LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13) :- LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13),ORDERS(L_OK,L_CK,O1,O2,O3,O4,O5,O6,O7),SUPPLIER(L_SK,S2,S3,S_NATIONKEY,S4,S5,S6),CUSTOMER(L_CK,C1,C2,C_NATIONKEY,C3,C4,C5,C6),NATION(S_NATIONKEY,SUPP_NATION,N1,N2),NATION(C_NATIONKEY,CUST_NATION,N3,N4),((L_SD >= '1995-01-01')),((L_SD <= '1996-12-31')),((SUPP_NATION = 'FRANCE')),((CUST_NATION = 'GERMANY')),PROV_QSUB(SUPP_NATION,CUST_NATION,V0,V1).
        PROV_LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13) :- LINEITEM(L_OK,L1,L_SK,L2,L3,L_EXTENDEDPRICE,L_DISCOUNT,L6,L7,L8,L_SD,L9,L10,L11,L12,L13),ORDERS(L_OK,L_CK,O1,O2,O3,O4,O5,O6,O7),SUPPLIER(L_SK,S2,S3,S_NATIONKEY,S4,S5,S6),CUSTOMER(L_CK,C1,C2,C_NATIONKEY,C3,C4,C5,C6),NATION(S_NATIONKEY,SUPP_NATION,N1,N2),NATION(C_NATIONKEY,CUST_NATION,N3,N4),((L_SD >= '1995-01-01')),((L_SD <= '1996-12-31')),((SUPP_NATION = 'GERMANY')),((CUST_NATION = 'FRANCE')),PROV_QSUB(SUPP_NATION,CUST_NATION,V0,V1).
ANSWER RELATION:
        PROV_LINEITEM

INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(analyze_dl.c:764) comparison expression:


INFO(mem_mgr.c:655) Create chunk of size 1048576 in context TRANSLATOR_CONTEXT
FATAL(datalog_model_checker.c:122) Predicate of body atom @RP(SUPP_NATION,CUST_NATION,V0,V4) is neither IDB nor EDB (used in facts of present in the database)
ERROR (exception.c:145) exception was thrown (RECOVERABLE) datalog_model_checker.c - 122 - <Predicate of body atom @RP(SUPP_NATION,CUST_NATION,V0,V4) is neither IDB nor EDB (used in facts of present in the database)>

@lordpretzel
Copy link
Collaborator Author

lordpretzel commented Oct 9, 2022

Q11 + Q12 + Q15 + Q19

Endless loop

PROGRAM:
        Q(C1,C2) :- QSUB1(C1,C2),QSUB2(C3),((C2 > C3)).
        RP(X1,X2) :- RTPCQ11(X1,X2).
        QSUB1(PS_PK,sum((PS_SC * PS_AQ))) :- PARTSUPP(PS_PK,PS_SK,PS_AQ,PS_SC,PS2),SUPPLIER(PS_SK,S1,S2,S_NK,S3,S4,S5),NATION(S_NK,'GERMANY',N1,N2).
        QSUB2(sum((C2 * 0.000100))) :- QSUB1(C1,C2).
        PROV_QSUB1(C1,C2) :- RP(C1,C2).
        PROV_QSUB1(C1,C2) :- QSUB1(C1,C2),PROV_QSUB2(V1).
        PROV_QSUB2(C3) :- QSUB1(C1,C2),QSUB2(C3),((C2 > C3)),RP(C1,C2).
        PROV_SUPPLIER(PS_SK,S1,S2,S_NK,S3,S4,S5) :- SUPPLIER(PS_SK,S1,S2,S_NK,S3,S4,S5),PARTSUPP(PS_PK,PS_SK,PS_AQ,PS_SC,PS2),NATION(S_NK,'GERMANY',N1,N2),PROV_QSUB1(PS_PK,V1).
ANSWER RELATION:
        PROV_SUPPLIER
PROGRAM:
        Q(L_SHIPMODE,sum((CASE  WHEN (O_ORDERPRIORITY = '1-URGENT') THEN 1 WHEN (O_ORDERPRIORITY = '2-HIGH') THEN 1 ELSE 0 END)),sum((CASE  WHEN (O_ORDERPRIORITY <> '1-URGENT') THEN (CASE  WHEN (O_ORDERPRIORITY <> '2-HIGH') THEN 1 ELSE 0 END) ELSE 0 END))) :- ORDERS(O_OKEY,X1,X2,X3,X4,O_ORDERPRIORITY,X5,X6,X7),Q2(O_OKEY,L_LINENUMBER,L_SHIPMODE).
        RP(X1,X2,X3) :- RTPCQ12(X1,X2,X3).
        Q2(L_OKEY,L_LINENUMBER,L_SHIPMODE) :- LINEITEM(L_OKEY,V3,V4,L_LINENUMBER,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,L_SHIPMODE,V15),((V12 < V13)),((V11 < V12)),((V13 >= '1994-01-01')),((V13 < '1995-01-01')),((L_SHIPMODE = 'SHIP')).
        Q2(L_OKEY,L_LINENUMBER,L_SHIPMODE) :- LINEITEM(L_OKEY,V3,V4,L_LINENUMBER,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,L_SHIPMODE,V15),((V12 < V13)),((V11 < V12)),((V13 >= '1994-01-01')),((V13 < '1995-01-01')),((L_SHIPMODE = 'SHIP')).
        Q2(L_OKEY,L_LINENUMBER,L_SHIPMODE) :- LINEITEM(L_OKEY,V3,V4,L_LINENUMBER,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,L_SHIPMODE,V15),((V12 < V13)),((V11 < V12)),((V13 >= '1994-01-01')),((V13 < '1995-01-01')),((L_SHIPMODE = 'MAIL')).
        Q2(L_OKEY,L_LINENUMBER,L_SHIPMODE) :- LINEITEM(L_OKEY,V3,V4,L_LINENUMBER,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,L_SHIPMODE,V15),((V12 < V13)),((V11 < V12)),((V13 >= '1994-01-01')),((V13 < '1995-01-01')),((L_SHIPMODE = 'MAIL')).
        PROV_Q2(O_OKEY,L_LINENUMBER,L_SHIPMODE) :- Q2(O_OKEY,L_LINENUMBER,L_SHIPMODE),ORDERS(O_OKEY,X1,X2,X3,X4,O_ORDERPRIORITY,X5,X6,X7),RP(L_SHIPMODE,V2,V3).
        PROV_LINEITEM(L_OKEY,V3,V4,L_LINENUMBER,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,L_SHIPMODE,V15) :- LINEITEM(L_OKEY,V3,V4,L_LINENUMBER,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,L_SHIPMODE,V15),((V12 < V13)),((V11 < V12)),((V13 >= '1994-01-01')),((V13 < '1995-01-01')),((L_SHIPMODE = 'SHIP')),PROV_Q2(L_OKEY,L_LINENUMBER,L_SHIPMODE).
        PROV_LINEITEM(L_OKEY,V3,V4,L_LINENUMBER,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,L_SHIPMODE,V15) :- LINEITEM(L_OKEY,V3,V4,L_LINENUMBER,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,L_SHIPMODE,V15),((V12 < V13)),((V11 < V12)),((V13 >= '1994-01-01')),((V13 < '1995-01-01')),((L_SHIPMODE = 'MAIL')),PROV_Q2(L_OKEY,L_LINENUMBER,L_SHIPMODE).
ANSWER RELATION:
        PROV_LINEITEM
PROGRAM:
        Q(S_SUPPKEY,S_NAME,S_ADDRESS,S_PHONE,REV) :- SUPPLIER(S_SUPPKEY,S_NAME,S_ADDRESS,S1,S_PHONE,S2,S3),Q1(S_SUPPKEY,REV),Q2(REV).
        RP(X1,X2,X3,X4,X5) :- RTPCQ15(X1,X2,X3,X4,X5).
        Q1(L_SUPPKEY,sum((L_EXTP * (1 - L_DISCOUNT)))) :- LINEITEM(L1,L2,L_SUPPKEY,L3,L4,L_EXTP,L_DISCOUNT,L5,L6,L7,L_SHIPDATE,L8,L9,L10,L11,L12),((L_SHIPDATE >= '1996-01-01')),((L_SHIPDATE < '1996-04-01')).
        Q2(max(REV)) :- Q1(Q1,REV).
        PROV_Q1(S_SUPPKEY,REV) :- RP(S_SUPPKEY,S_NAME,S_ADDRESS,S_PHONE,REV).
        PROV_Q1(Q1,REV) :- Q1(Q1,REV),PROV_Q2(V1).
        PROV_Q2(REV) :- RP(S_SUPPKEY,S_NAME,S_ADDRESS,S_PHONE,REV).
        PROV_LINEITEM(L1,L2,L_SUPPKEY,L3,L4,L_EXTP,L_DISCOUNT,L5,L6,L7,L_SHIPDATE,L8,L9,L10,L11,L12) :- LINEITEM(L1,L2,L_SUPPKEY,L3,L4,L_EXTP,L_DISCOUNT,L5,L6,L7,L_SHIPDATE,L8,L9,L10,L11,L12),((L_SHIPDATE >= '1996-01-01')),((L_SHIPDATE < '1996-04-01')),PROV_Q1(L_SUPPKEY,V1).
ANSWER RELATION:
        PROV_LINEITEM
PROGRAM:
        QQUANTITIES(1,1,11).
        QQUANTITIES(2,10,20).
        QQUANTITIES(3,20,30).
        QPSIZE(1,5).
        QPSIZE(2,10).
        QPSIZE(3,15).
        QBRAND(1,'Brand#12').
        QBRAND(2,'Brand#23').
        QBRAND(3,'Brand#34').
        QCONTAINER(1,'SM CASE').
        QCONTAINER(1,'SM BOX').
        QCONTAINER(1,'SM PACK').
        QCONTAINER(1,'SM PKG').
        QCONTAINER(2,'MED BAG').
        QCONTAINER(2,'MED BOX').
        QCONTAINER(2,'MED PACK').
        QCONTAINER(2,'MED PKG').
        QCONTAINER(3,'LG CASE').
        QCONTAINER(3,'LG BOX').
        QCONTAINER(3,'LG PACK').
        QCONTAINER(3,'LG PKG').
        QSHIPMODES('AIR').
        QSHIPMODES('AIR REG').
        Q(sum((L_EXTP * (1 - L_DISCOUNT)))) :- QFILTER(L_ORDERKEY,L_LINENUMBER,L_DISCOUNT,L_EXTP).
        RP(X1) :- RTPCQ19(X1).
        QFILTER(L_ORDERKEY,L_LINENUMBER,L_DISCOUNT,L_EXTP) :- LINEITEM(L_ORDERKEY,P_PARTKEY,L2,L_LINENUMBER,L_QUANTITY,L_EXTP,L_DISCOUNT,L4,L5,L6,L7,L8,L9,'DELIVER IN PERSON',L_SHIPMODE,L10),PART(P_PARTKEY,P1,P2,P_BRAND,P3,P_SIZE,P_CONTAINER,P4,P5),QSHIPMODES(L_SHIPMODE),QQUANTITIES(V5,Q_LOW,Q_HIGH),QCONTAINER(V5,P_CONTAINER),QPSIZE(V5,P_HIGH),QBRAND(V5,P_BRAND),((L_QUANTITY >= Q_LOW)),((L_QUANTITY >= Q_HIGH)),((P_SIZE >= 1)),((P_SIZE <= P_HIGH)).
        QFILTER(L_ORDERKEY,L_LINENUMBER,L_DISCOUNT,L_EXTP) :- LINEITEM(L_ORDERKEY,P_PARTKEY,L2,L_LINENUMBER,L_QUANTITY,L_EXTP,L_DISCOUNT,L4,L5,L6,L7,L8,L9,'DELIVER IN PERSON',L_SHIPMODE,L10),PART(P_PARTKEY,P1,P2,P_BRAND,P3,P_SIZE,P_CONTAINER,P4,P5),QSHIPMODES(L_SHIPMODE),QQUANTITIES(V5,Q_LOW,Q_HIGH),QCONTAINER(V5,P_CONTAINER),QPSIZE(V5,P_HIGH),QBRAND(V5,P_BRAND),((L_QUANTITY >= Q_LOW)),((L_QUANTITY >= Q_HIGH)),((P_SIZE >= 1)),((P_SIZE <= P_HIGH)).
        PROV_QFILTER(L_ORDERKEY,L_LINENUMBER,L_DISCOUNT,L_EXTP) :- QFILTER(L_ORDERKEY,L_LINENUMBER,L_DISCOUNT,L_EXTP),RP(V1).
        PROV_LINEITEM(L_ORDERKEY,P_PARTKEY,L2,L_LINENUMBER,L_QUANTITY,L_EXTP,L_DISCOUNT,L4,L5,L6,L7,L8,L9,'DELIVER IN PERSON',L_SHIPMODE,L10) :- LINEITEM(L_ORDERKEY,P_PARTKEY,L2,L_LINENUMBER,L_QUANTITY,L_EXTP,L_DISCOUNT,L4,L5,L6,L7,L8,L9,'DELIVER IN PERSON',L_SHIPMODE,L10),PROV_QFILTER(L_ORDERKEY,L_LINENUMBER,L_DISCOUNT,L_EXTP).
ANSWER RELATION:
        PROV_LINEITEM

@lordpretzel
Copy link
Collaborator Author

lordpretzel commented Oct 9, 2022

Q17 + Q18

INFO(datalog_lineage.c:144) rewritten program for lineage:



PROGRAM:
        Q(sum((L_EP / 7.000000))) :- QSUB(L_PK,Q2),PART(L_PK,P1,P2,'Brand#23',P3,P4,'MED BOX',P5,P6),LINEITEM(L1,L_PK,L2,L3,L_Q,L_EP,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13),((L_Q < Q2)).
        RP(X1) :- RTPCQ17(X1).
        QSUB(L_PK,avg((0.200000 * L_Q))) :- LINEITEM(L1,L_PK,L2,L3,L_Q,L_EP,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13).
        PROV_QSUB(L_PK,Q2) :- QSUB(L_PK,Q2),PART(L_PK,P1,P2,'Brand#23',P3,P4,'MED BOX',P5,P6),LINEITEM(L1,L_PK,L2,L3,L_Q,L_EP,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13),((L_Q < Q2)),RP(V1).
        PROV_LINEITEM(L1,L_PK,L2,L3,L_Q,L_EP,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13) :- LINEITEM(L1,L_PK,L2,L3,L_Q,L_EP,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13),QSUB(L_PK,Q2),PART(L_PK,P1,P2,'Brand#23',P3,P4,'MED BOX',P5,P6),((L_Q < Q2)),RP(V1).
        PROV_LINEITEM(L1,L_PK,L2,L3,L_Q,L_EP,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13) :- LINEITEM(L1,L_PK,L2,L3,L_Q,L_EP,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13),PROV_QSUB(L_PK,V1).
ANSWER RELATION:
        PROV_LINEITEM

INFO(analyze_dl.c:767) comparison expression:


INFO(analyze_dl.c:767) comparison expression:


INFO(analyze_dl.c:767) comparison expression:


FATAL(datalog_model_checker.c:124) Predicate of body atom @RP(V23) is neither IDB nor EDB (used in facts of present in the database)
ERROR (exception.c:145) exception was thrown (RECOVERABLE) datalog_model_checker.c - 124 - <Predicate of body atom @RP(V23) is neither IDB nor EDB (used in facts of present in the database)>
INFO(datalog_lineage.c:144) rewritten program for lineage:

PROGRAM:
        Q(C_NAME,C_CUSTKEY,O_ORDERKEY,O_ORDERDATE,O_TOTALPRICE,sum(L_QUANTITY)) :- CUSTOMER(C_CUSTKEY,C_NAME,C1,C2,C3,C4,C5,C6),ORDERS(O_ORDERKEY,C_CUSTKEY,O1,O_TOTALPRICE,O_ORDERDATE,O2,O3,O4,O5),LINEITEM(O_ORDERKEY,X1,X2,X3,L_QUANTITY,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14),Q1(O_ORDERKEY,T1),((T1 > 300)).
        RP(X1,X2,X3,X4,X5,X6) :- RTPCQ18(X1,X2,X3,X4,X5,X6).
        Q1(L_ORDERKEY,sum(L_QUANTITY)) :- LINEITEM(L_ORDERKEY,X1,X2,X3,L_QUANTITY,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14).
        PROV_Q1(O_ORDERKEY,T1) :- Q1(O_ORDERKEY,T1),((T1 > 300)),RP(C_NAME,C_CUSTKEY,O_ORDERKEY,O_ORDERDATE,O_TOTALPRICE,V1).
        PROV_LINEITEM(O_ORDERKEY,X1,X2,X3,L_QUANTITY,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14) :- LINEITEM(O_ORDERKEY,X1,X2,X3,L_QUANTITY,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14),RP(C_NAME,C_CUSTKEY,O_ORDERKEY,O_ORDERDATE,O_TOTALPRICE,V1).
        PROV_LINEITEM(L_ORDERKEY,X1,X2,X3,L_QUANTITY,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14) :- LINEITEM(L_ORDERKEY,X1,X2,X3,L_QUANTITY,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14),PROV_Q1(L_ORDERKEY,V1).
ANSWER RELATION:
        PROV_LINEITEM

INFO(analyze_dl.c:767) comparison expression:


INFO(analyze_dl.c:767) comparison expression:


FATAL(datalog_model_checker.c:124) Predicate of body atom @RP(V2,V3,L_ORDERKEY,V4,V5,V6) is neither IDB nor EDB (used in facts of present in the database)
ERROR (exception.c:145) exception was thrown (RECOVERABLE) datalog_model_checker.c - 124 - <Predicate of body atom @RP(V2,V3,L_ORDERKEY,V4,V5,V6) is neither IDB nor EDB (used in facts of present in the database)>


Error occured
(datalog_model_checker.c:124) 
Predicate of body atom @RP(V2,V3,L_ORDERKEY,V4,V5,V6) is neither IDB nor EDB (used in facts of present in the database)
ABORT BASED ON EXCEPTION wipe <QUERY_CONTEXT>

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

No branches or pull requests

1 participant