Ql_algiterop Class Reference

#include <Ql_algiterop.hxx>

Inherits Ql_iterop.

Inherited by Ql_upiterop.

Inheritance diagram for Ql_algiterop:

[legend]
Collaboration diagram for Ql_algiterop:
[legend]
List of all members.

Public Member Functions

 Ql_algiterop (int, Ql_iterop *, int)
 ~Ql_algiterop ()
Ql_scanop * scan_vars (int i)
Ql_scanop ** scan_vars ()
int nb_scan_vars ()
Ql_scanop * schema_scan_vars (int i)
Ql_scanop ** schema_scan_vars ()
int nb_schema_scan_vars ()
Ql_scanop * data_scan_vars (int i)
Ql_scanop ** data_scan_vars ()
int nb_data_scan_vars ()
Ql_operation * criteria (int i)
Ql_operation ** criteria ()
int nb_criteria ()
Ql_operation * projection ()
Ql_operation * projection (int i)
int res_computed ()
int nb_proj ()
void scan_vars (Ql_scanop **v)
void nb_scan_vars (int n)
void schema_scan_vars (Ql_scanop **v)
void nb_schema_scan_vars (int n)
void data_scan_vars (Ql_scanop **v)
void nb_data_scan_vars (int n)
void inc_nb_scan_vars ()
void inc_nb_schema_scan_vars ()
void inc_nb_data_scan_vars ()
void criteria (Ql_operation **c)
void nb_criteria (int n)
void projection (Ql_operation **c)
void res_computed (int n)
void nb_proj (int n)
Ql_operation * exists_var (char *)
int is_equiv (Ql_operation *, Ql_renaming *, Ql_iterop *)
int type_infer (int *)
int add_proj_criteria_sfw (Ql_query *, Ql_tree_node *, Ql_dup_cell *, Ql_argument *, int *, Ql_iterop *)
void add_condition_in_criterium_sfw (Ql_operation *, int)
void my_add_condition_in_criterium_sfw (Ql_operation *, int)
int add_proj_criteria_sort (Ql_query *, Ql_tree_node *, Ql_dup_cell *, Ql_argument *, int *)
int add_criteria_group (Ql_query *, Ql_tree_node *, Ql_dup_cell *, Ql_argument *, int *)
int add_partition_group (int *)
int add_with_group (Ql_query *, Ql_tree_node *, Ql_dup_cell *, Ql_argument *, int *)
int add_proj_group (Ql_query *, Ql_tree_node *, int *)
void sfw_order_scans ()
void optimize (int *)

Detailed Description

Class Ql_algiterop groups the algebraic iterators (JSP). They are characterised by scan operations, a list of projections and criteria for selection

Author:
Grigoris Karvounarakis
Version:
1.0


Constructor & Destructor Documentation

Ql_algiterop::Ql_algiterop ( int  n,
Ql_iterop *  i,
int  li 
)

Construction of an algiterop operation. Parameters are used for the initialization of superclass Ql_iterop

Ql_algiterop::~Ql_algiterop (  ) 

Destruction of an algiterop operation


Member Function Documentation

Ql_scanop* Ql_algiterop::scan_vars ( int  i  )  [inline]

Returns:
the ith scan variable defined in this iterator

Ql_scanop** Ql_algiterop::scan_vars (  )  [inline]

Returns:
the array of scan variables defined in this iterator

int Ql_algiterop::nb_scan_vars (  )  [inline]

Returns:
the number of scan variables defined in this iterator

Ql_scanop* Ql_algiterop::schema_scan_vars ( int  i  )  [inline]

Returns:
the ith schema scan variable defined in this iterator

Ql_scanop** Ql_algiterop::schema_scan_vars (  )  [inline]

Returns:
the array of schema scan variables defined in this iterator

int Ql_algiterop::nb_schema_scan_vars (  )  [inline]

Returns:
the number of schema scan variables defined in this iterator

Ql_scanop* Ql_algiterop::data_scan_vars ( int  i  )  [inline]

Returns:
the ith data scan variable defined in this iterator

Ql_scanop** Ql_algiterop::data_scan_vars (  )  [inline]

Returns:
the array of data scan variables defined in this iterator

int Ql_algiterop::nb_data_scan_vars (  )  [inline]

Returns:
the number of data scan variables defined in this iterator

Ql_operation* Ql_algiterop::criteria ( int  i  )  [inline]

Returns:
the criteria (filtering conditions) that depend only on the (i-1)th variable (position 0 holds join conditions)

Ql_operation** Ql_algiterop::criteria (  )  [inline]

Returns:
the array of criteria of this iterator

int Ql_algiterop::nb_criteria (  )  [inline]

Returns:
the number of criteria

Ql_operation* Ql_algiterop::projection (  )  [inline]

Returns:
the first element of the list of projections

Ql_operation* Ql_algiterop::projection ( int  i  )  [inline]

Returns:
the ith element of the list of projections

int Ql_algiterop::res_computed (  )  [inline]

Returns:
true if this JSP is a nested one and its result has already been computed at least once. In this case, a bag to store results of this type has already been created, and we don't need to create a new one

int Ql_algiterop::nb_proj (  )  [inline]

Returns:
the number of projections

void Ql_algiterop::scan_vars ( Ql_scanop **  v  )  [inline]

Set the array of scan variables defined in this iterator to v

void Ql_algiterop::nb_scan_vars ( int  n  )  [inline]

Set the number of scan variables defined in this iterator to n

void Ql_algiterop::schema_scan_vars ( Ql_scanop **  v  )  [inline]

Set the array of schema scan variables defined in this iterator to v

void Ql_algiterop::nb_schema_scan_vars ( int  n  )  [inline]

Set the number of schema scan variables defined in this iterator to n

void Ql_algiterop::data_scan_vars ( Ql_scanop **  v  )  [inline]

Set the array of data scan variables defined in this iterator to v

void Ql_algiterop::nb_data_scan_vars ( int  n  )  [inline]

Set the number of data scan variables defined in this iterator to n

void Ql_algiterop::inc_nb_scan_vars (  )  [inline]

Increase the number of scan variables defined in this iterator by 1

void Ql_algiterop::inc_nb_schema_scan_vars (  )  [inline]

Increase the number of schema scan variables defined in this iterator by 1

void Ql_algiterop::inc_nb_data_scan_vars (  )  [inline]

Increase the number of data scan variables defined in this iterator by 1

void Ql_algiterop::criteria ( Ql_operation **  c  )  [inline]

Set the array of criteria for this iterator to c

void Ql_algiterop::nb_criteria ( int  n  )  [inline]

Set the number of criteria to n

void Ql_algiterop::projection ( Ql_operation **  c  )  [inline]

Set the list of projections for this iterator to c

void Ql_algiterop::res_computed ( int  n  )  [inline]

Set an indicator to true (1) the first time that the result of "this" iterator is computed (and a corresponding bag is created), so that if there is a next time, we don't need to create the bag again

void Ql_algiterop::nb_proj ( int  n  )  [inline]

Set the number of projections to n

Ql_operation * Ql_algiterop::exists_var ( char *  var_name  )  [virtual]

Look for a variable in an algebraic iterator and its embedding iterators. Recursive function

Parameters:
the name of the variable we are looking for

Implements Ql_iterop.

int Ql_algiterop::is_equiv ( Ql_operation *  op,
Ql_renaming *  renaming,
Ql_iterop *  circle 
) [virtual]

USED FOR TESTING THE EQUIVALENCE OF TWO ITERATORS.

The function is_equiv is recursive and is called in turn on every couple of OPERATIONS (i.e. iterator and non iterator) inside the iterators being tested until failure or success. It is always invoked with two parameters: one indicating the iterator on which the iterators we are testing depends (NULL if constant), and one indicating possible scan variables renaming of the inner iterators (the original couple of iterators + couples of iterators found on the way going down). The idea is that inside the surrounding iterator (circle <> NULL), the two operations must be equivalent (scan variable renaming) and that outside (circle == NULL) they must be strictly equal (i.e. pointers equality)

Parameters:
op the operation to check equivalence with
renaming possible scan variables renaming of the inner iterators (the original couple of iterators + couples of iterators found on the way going down)
circle indicates if we are inside a surrounding iterator (if <> NULL) or just inside the main query and not inside any iterator (if == NULL)

Implements Ql_operation.

int Ql_algiterop::type_infer ( int *  error_code  ) 

Type inference for an algebraic iterator. Creates type for the result as well as a bag to store it, if necessary

Reimplemented in Ql_upiterop.

int Ql_algiterop::add_proj_criteria_sfw ( Ql_query *  query,
Ql_tree_node *  query_tree,
Ql_dup_cell *  cnf_dup_table,
Ql_argument *  ql_arguments,
int *  error_code,
Ql_iterop *  current_iter 
)

Used for constructing the projection and criteria attributes of a sfw filter. A sfw always has one criterium per scan variable + 1. v_criteria[0] is used for the conditions depending one more than one variables (join conditions) or on another iterator (join or dependent join conditions) (and-ed if more than one/null if none). Conditions on others iterator occur too rarely to be optimized. They won't be evaluated more than needed anyway. v_criteria[0] is tested after each new assignment of any of the scan variables. v_criteria[i] contains the conditions dependending on one scan variable only (anded if more than one/null if none) and i=the scan var position + 1. For anding together several criteria, we use the above function (add_condition_in_criterium_sfw()). v_criteria[i] is evaluated after each assignment on variable i, if it is not "pushable" to the underlying DBMS, (i.e. expressible in its query language) * so that it can be pushed in the scan query and be evaluated by the DBMS.

Parameters:
query the query graph
query_tree the parse tree of the query
cnf_dup_table a table containing should be duplicated syntactical subtrees (because of conjunctive normal form)
ql_arguments 
error_code a placeholder, where an error code is put, in case of error
Returns:
KO (1) if there was an error and set the error_code, OK (0) otherwise

void Ql_algiterop::add_condition_in_criterium_sfw ( Ql_operation *  one_condition,
int  criterium_pos 
)

Add a condition in a sfw criterium If the criterium is empty, just put it in If it contains an and_n op, add a parameter in the and operation If it contains another op, create an and operation and add the new op and the existing op as its parameters

Parameters:
one_condition the condition to be added
criterium_pos the position in the criteria array where the condition should be put. If it is a filtering condition (that depends only on one variable) it is put in criteria[i+1], where i is the position of the variable in the scan vars array. Join conditions (that depends on more than one scan variables) are put in criteria[0]

void Ql_algiterop::my_add_condition_in_criterium_sfw ( Ql_operation *  condition,
int  criterium_pos 
)

Simpler version of the add_proj_criteria_sfw. Creates always nested binary and operations, instead of n-ary, in the case of multiple conditions that should be put in the same position in the criteria array

Parameters:
one_condition the condition to be added
criterium_pos the position in the criteria array where the condition should be put. If it is a filtering condition (that depends only on one variable) it is put in criteria[i+1], where i is the position of the variable in the scan vars array. Join conditions (that depends on more than one scan variables) are put in criteria[0]

int Ql_algiterop::add_proj_criteria_sort ( Ql_query *  query,
Ql_tree_node *  query_tree,
Ql_dup_cell *  cnf_dup_table,
Ql_argument *  ql_arguments,
int *  error_code 
)

-- Not implemented in current version! -- Used for constructing the proj and criteria attributes of a sort.

int Ql_algiterop::add_criteria_group ( Ql_query *  query,
Ql_tree_node *  query_tree,
Ql_dup_cell *  cnf_dup_table,
Ql_argument *  ql_arguments,
int *  error_code 
)

-- Not implemented in current version! -- Used for constructing the criteria attributes of a group

int Ql_algiterop::add_partition_group ( int *  error_code  ) 

-- Not implemented in current version! -- Used for constructing the partition name_var for a group

int Ql_algiterop::add_with_group ( Ql_query *  query,
Ql_tree_node *  query_tree,
Ql_dup_cell *  cnf_dup_table,
Ql_argument *  ql_arguments,
int *  error_code 
)

-- Not implemented in current version! -- Used for constructing the with name_vars for a group

int Ql_algiterop::add_proj_group ( Ql_query *  query,
Ql_tree_node *  query_tree,
int *  error_code 
)

-- Not implemented in current version! -- Used for constructing the projection att for a group

void Ql_algiterop::sfw_order_scans (  ) 

Reorder the scans in this iterator so that schema scans are evaluated before data scans

void Ql_algiterop::optimize ( int *   )  [inline]

Dummy method - no explicit optimization/rewriting implemented ... yet, except for scans reordering by sfw_order_scans()


The documentation for this class was generated from the following files:
Generated on Thu Oct 26 16:42:06 2006 for rul by  doxygen 1.5.0