Reputation: 23
I am trying to understand the MAL statements for joining three tables. I came across the bind
function in MAL statement. I have a table
named lineitem
with l_quantity
in it. So what does the following statements mean?
( X_94:bat[:oid,:oid], X_95:bat[:oid,:int] ) :=
sql.bind(X_4, "sys", "lineitem", "l_quantity", 2, 0, 4);
( X_96:bat[:oid,:oid], X_97:bat[:oid,:int] ) :=
sql.bind(X_4, "sys", "lineitem", "l_quantity", 2, 1, 4);
What does the 5th and 6th argument mean?
Upvotes: 0
Views: 158
Reputation: 2745
From src/sql/backends/monet5/sql.mal
:
pattern bind(mvc:int,
schema:str,
table:str,
column:str,
access:int,
part_nr:int,
nr_parts:int )
(uid:bat[:oid],uval:bat[:any_1])
address mvc_bind_wrap
comment "Bind the 'schema.table.column' BAT with access kind:
0 - base table
1 - inserts
2 - updates";
Argument 5 is access type. In your example, those instructions are accessing update columns (they only contain updates, not the original data). Later in the plan they will be merged with the corresponding columns of type 0.
Argument 6 goes together with argument 7. The two instructions you posted
bind to the first two chunks of 4 (7th argument) of a horizontally partitioned column. Whether and how this partitioning takes pace is controlled dynamically by the mitosis
optimizer.
Upvotes: 0