net.sf.saffron.sql2rel
Class SqlToRelConverter.Blackboard

java.lang.Object
  |
  +--net.sf.saffron.sql2rel.SqlToRelConverter.Blackboard
Enclosing class:
SqlToRelConverter

private class SqlToRelConverter.Blackboard
extends Object

Workspace for translating an individual SELECT statement (or sub-SELECT).


Field Summary
private  SaffronRel[] inputs
           
private  HashMap mapSubqueryToExpr
          Maps IN and EXISTS sub-queries to the expressions which will be used to access them.
private  SaffronRel root
           
(package private)  SqlValidator.Scope scope
          Collection of SaffronRel objects which correspond to a SELECT statement.
private  ArrayList subqueries
          List of IN and EXISTS nodes inside this SELECT statement (but not inside sub-queries).
 
Constructor Summary
(package private) SqlToRelConverter.Blackboard(SqlValidator.Scope scope)
          Creates a Blackboard
 
Method Summary
private  ArrayList flatten(SaffronRel[] rels)
           
private  void flatten(SaffronRel[] rels, ArrayList list)
           
(package private)  RexNode lookup(int offset, SaffronRel[] inputs, boolean isParent, String varName)
          Creates an expression with which to reference expression, whose offset in its from-list is offset.
(package private)  RexNode lookupExp(String name)
          Returns an expression with which to reference a from-list item.
 RexNode register(SaffronRel rel)
          Registers a relational expression
 void registerSubquery(SqlNode node)
           
(package private)  void setRoot(SaffronRel root)
           
(package private)  void setRoot(SaffronRel[] inputs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scope

final SqlValidator.Scope scope
Collection of SaffronRel objects which correspond to a SELECT statement.


root

private SaffronRel root

inputs

private SaffronRel[] inputs

subqueries

private final ArrayList subqueries
List of IN and EXISTS nodes inside this SELECT statement (but not inside sub-queries).


mapSubqueryToExpr

private final HashMap mapSubqueryToExpr
Maps IN and EXISTS sub-queries to the expressions which will be used to access them.

Constructor Detail

SqlToRelConverter.Blackboard

SqlToRelConverter.Blackboard(SqlValidator.Scope scope)
Creates a Blackboard

Pre-condition:
scope != null
Method Detail

register

public RexNode register(SaffronRel rel)
Registers a relational expression

Parameters:
rel - Relational expression
Returns:
Expression with which to refer to the row (or partial row) coming from this relational expression's side of the join.

setRoot

void setRoot(SaffronRel root)

setRoot

void setRoot(SaffronRel[] inputs)

lookupExp

RexNode lookupExp(String name)
Returns an expression with which to reference a from-list item.

Parameters:
name - the alias of the from item
Returns:
a Variable or FieldAccess

lookup

RexNode lookup(int offset,
               SaffronRel[] inputs,
               boolean isParent,
               String varName)
Creates an expression with which to reference expression, whose offset in its from-list is offset.


flatten

private ArrayList flatten(SaffronRel[] rels)

flatten

private void flatten(SaffronRel[] rels,
                     ArrayList list)

registerSubquery

public void registerSubquery(SqlNode node)

SourceForge.net_Logo