Open wukefe opened 7 years ago
SQL code
select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1994-01-01' and l_shipdate < date '1994-01-01' + interval '1' year and l_discount between .06 - 0.01 and .06 + 0.01 and l_quantity < 24;
MAL code (for WHERE)
... | X_137:bat[:lng] := sql.bind(X_3,"sys","lineitem","l_discount",0:int,0:int,8:int); | ... | C_114:bat[:oid] := sql.tid(X_3,"sys","lineitem",0:int,8:int); | | X_48:date := mtime.addmonths("1994-01-01":date,12:int); | | C_171 := algebra.subselect(X_147,C_114,"1994-01-01":date,X_48,true,false,false); | | C_179 := algebra.subselect(X_137,C_171,5:lng,7:lng,true,true,false); | | C_187 := algebra.thetasubselect(X_129,C_179,2400:lng,"<"); |
mtime.addmonths
algebra.subselect
algebra.thetasubselect
discount
sql.bind
MonetDB MAL details (An Example from TPC-H Q6)
Code snippet
SQL code
MAL code (for WHERE)
Details
mtime.addmonths
: returns a new date by adding monthsalgebra.subselect
: selects items by a boolean mask ()algebra.thetasubselect
: see source codeRemaining questions
discount
is treated as a long int column.sql.bind