saffron.rel
Class AggInternalTranslator

java.lang.Object
  |
  +--openjava.ptree.util.ParseTreeVisitor
        |
        +--openjava.ptree.util.EvaluationShuttle
              |
              +--saffron.rel.InternalTranslator
                    |
                    +--saffron.rel.AggInternalTranslator

class AggInternalTranslator
extends InternalTranslator

Converts expressions to consist only of constants, references to group by expressions (variables called "$group0", etc.), and calls to aggregate functions (variables called "$agg0", etc.).

These names exist only fleetingly, before AggUnpickler converts them to field references in the output record. But if we did not use them, we could not be sure whether a field reference such as $input0.$f1 had been converted.

Throws NotAGroupException.

See Also:
AggUnpickler

Field Summary
(package private)  Vector aggCallVector
           
(package private)  ExpressionList aggInputList
           
(package private)  Expression[] groups
           
(package private)  Rel[] inputs
           
(package private)  InternalTranslator nonAggTranslator
           
(package private)  QueryInfo queryInfo
           
 
Fields inherited from class openjava.ptree.util.EvaluationShuttle
 
Constructor Summary
(package private) AggInternalTranslator(QueryInfo queryInfo, Rel[] inputs, Expression[] groups, ExpressionList aggInputList, Vector aggCallVector)
           
 
Method Summary
 Expression evaluateDown(BinaryExpression p)
           
 Expression evaluateDown(ConditionalExpression p)
           
 Expression evaluateDown(FieldAccess p)
           
 Expression evaluateDown(MethodCall call)
           
 Expression evaluateDown(UnaryExpression p)
           
 Expression evaluateDown(Variable p)
           
 Expression evaluateUp(AliasedExpression p)
           
(package private)  boolean isGoodAgg_obsolete(Expression expression)
           
private  Aggregation lookupBuiltinAggregation(MethodCall call, OJClass[] argTypes)
          Creates and returns an aggregation if call is a call to a builtin, otherwise returns null.
private  Aggregation lookupCustomAggregation(MethodCall call, OJClass[] argTypes)
          Creates and returns an aggregation if call is a call to a custom aggregation, null otherwise.
(package private)  Expression lookupExp(String name)
          Returns an expression with which to reference a from-list item.
private  Expression makeAggExp(Aggregation aggregation, ExpressionList args)
           
private  Expression toGroupReference(Expression expression, boolean fail)
           
 void visit(QueryExpression p)
          Do not walk into a sub-query.
 
Methods inherited from class openjava.ptree.util.EvaluationShuttle
evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateDown, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, evaluateUp, getEnvironment, setEnvironment, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class openjava.ptree.util.ParseTreeVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

groups

Expression[] groups

aggInputList

ExpressionList aggInputList

aggCallVector

Vector aggCallVector

nonAggTranslator

InternalTranslator nonAggTranslator

queryInfo

QueryInfo queryInfo

inputs

Rel[] inputs
Constructor Detail

AggInternalTranslator

AggInternalTranslator(QueryInfo queryInfo,
                      Rel[] inputs,
                      Expression[] groups,
                      ExpressionList aggInputList,
                      Vector aggCallVector)
Method Detail

toGroupReference

private Expression toGroupReference(Expression expression,
                                    boolean fail)

evaluateDown

public Expression evaluateDown(MethodCall call)
                        throws ParseTreeException
Overrides:
evaluateDown in class EvaluationShuttle
ParseTreeException

lookupBuiltinAggregation

private Aggregation lookupBuiltinAggregation(MethodCall call,
                                             OJClass[] argTypes)
Creates and returns an aggregation if call is a call to a builtin, otherwise returns null.


lookupCustomAggregation

private Aggregation lookupCustomAggregation(MethodCall call,
                                            OJClass[] argTypes)
Creates and returns an aggregation if call is a call to a custom aggregation, null otherwise.


makeAggExp

private Expression makeAggExp(Aggregation aggregation,
                              ExpressionList args)
                       throws ParseTreeException
ParseTreeException

evaluateDown

public Expression evaluateDown(FieldAccess p)
Overrides:
evaluateDown in class EvaluationShuttle

evaluateDown

public Expression evaluateDown(UnaryExpression p)
Overrides:
evaluateDown in class EvaluationShuttle

evaluateDown

public Expression evaluateDown(BinaryExpression p)
Overrides:
evaluateDown in class EvaluationShuttle

evaluateDown

public Expression evaluateDown(ConditionalExpression p)
Overrides:
evaluateDown in class EvaluationShuttle

evaluateDown

public Expression evaluateDown(Variable p)
Overrides:
evaluateDown in class InternalTranslator

isGoodAgg_obsolete

boolean isGoodAgg_obsolete(Expression expression)

evaluateUp

public Expression evaluateUp(AliasedExpression p)
Overrides:
evaluateUp in class EvaluationShuttle

visit

public void visit(QueryExpression p)
Do not walk into a sub-query.

Overrides:
visit in class EvaluationShuttle

lookupExp

Expression 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

SourceForge.net_Logo