system.query_processing.operators module¶
Concrete query-processing operators: scan, filter, simple hash join, semi-join, print, collect, count.
- class system.query_processing.operators.Relation(name: str, data: list)[source]¶
Bases:
OperatorRelation operator to iterate over the given list of tuples.
- interpret_open()[source]¶
See
Operator.interpret_open().Source operator: pushes every tuple of the in-memory list to the parent.
- interpret_next(tup)[source]¶
See
Operator.interpret_next().Unreachable: a source operator has no child that could push to it.
- class system.query_processing.operators.Scan(file: str, num_tuples: int = inf)[source]¶
Bases:
OperatorScan operator to iterate over the given number of tuples in the underlying storage file.
- interpret_open()[source]¶
See
Operator.interpret_open().Source operator: reads the pickled tuples from the storage file and pushes up to
num_tuplesof them to the parent.
- interpret_next(tup)[source]¶
See
Operator.interpret_next().Unreachable: a source operator has no child that could push to it.
- class system.query_processing.operators.Filter(child: Operator, pred: str)[source]¶
Bases:
OperatorFilter operator to select tuples according to the given predicate.
- interpret_next(tup)[source]¶
See
Operator.interpret_next().Pushes the tuple to the parent only if the predicate evaluates to true.
- class system.query_processing.operators.SHJ(left_child: Operator, right_child: Operator, left_attr: str, right_attr: str)[source]¶
Bases:
OperatorSimple-hash join operator to join the two children inputs according to the given join attributes.
- interpret_open()[source]¶
See
Operator.interpret_open().Builds the hash table from the left child, then probes it with the right child.
- interpret_next(tup)[source]¶
See
Operator.interpret_next().In the build phase inserts the tuple into the hash table; in the probe phase joins it with matching build tuples and pushes the merged tuples.
- class system.query_processing.operators.SemiJ(left_child: Operator, right_child: Operator, left_attr: str, right_attr: str)[source]¶
Bases:
Operator(Left) Semi-join operator to reduce the first input relation based on the join results according to the given join attributes with the second input relation.
- interpret_open()[source]¶
See
Operator.interpret_open().Builds the hash table from the RIGHT child, then probes it with the LEFT child.
- interpret_next(tup)[source]¶
See
Operator.interpret_next().In the build phase inserts the right tuple into the hash table; in the probe phase pushes the left tuple unchanged if a match exists (no merge).
- class system.query_processing.operators.Print(child: Operator)[source]¶
Bases:
OperatorPrint operator to print tuples to the console.
- interpret_next(tup)[source]¶
See
Operator.interpret_next().Prints the tuple’s values to the console; this is a sink, so nothing is pushed.
- class system.query_processing.operators.Collect(child: Operator)[source]¶
Bases:
OperatorCollect operator to collect all resulting tuples.
- interpret_open()[source]¶
See
Operator.interpret_open().Resets the result list and opens the single child operator.
- interpret_next(tup)[source]¶
See
Operator.interpret_next().Appends the tuple’s values to the result list; this is a sink, so nothing is pushed.
- class system.query_processing.operators.Count(child: Operator)[source]¶
Bases:
OperatorCount operator to count all resulting tuples.
- interpret_open()[source]¶
See
Operator.interpret_open().Resets the tuple counter and opens the single child operator.
- interpret_next(tup)[source]¶
See
Operator.interpret_next().Increments the tuple counter; this is a sink, so nothing is pushed.