net.sf.farrago.query
Class FarragoReduceExpressionsRule.ReducibleExprLocator

java.lang.Object
  extended by org.eigenbase.rex.RexVisitorImpl<Void>
      extended by net.sf.farrago.query.FarragoReduceExpressionsRule.ReducibleExprLocator
All Implemented Interfaces:
RexVisitor<Void>
Enclosing class:
FarragoReduceExpressionsRule

private static class FarragoReduceExpressionsRule.ReducibleExprLocator
extends RexVisitorImpl<Void>

Helper class used to locate expressions that either can be reduced to literals or contain redundant casts.


Nested Class Summary
(package private) static class FarragoReduceExpressionsRule.ReducibleExprLocator.Constancy
           
 
Field Summary
private  List<Boolean> addCasts
           
private  List<RexNode> constExprs
           
private  List<SqlOperator> parentCallTypeStack
           
private  FarragoSessionPreparingStmt preparingStmt
           
private  List<RexNode> removableCasts
           
private  List<FarragoReduceExpressionsRule.ReducibleExprLocator.Constancy> stack
           
 
Fields inherited from class org.eigenbase.rex.RexVisitorImpl
deep
 
Constructor Summary
FarragoReduceExpressionsRule.ReducibleExprLocator(FarragoSessionPreparingStmt preparingStmt, List<RexNode> constExprs, List<Boolean> addCasts, List<RexNode> removableCasts)
           
 
Method Summary
private  void addResult(RexNode exp)
           
 void analyze(RexNode exp)
           
private  void analyzeCall(RexCall call, FarragoReduceExpressionsRule.ReducibleExprLocator.Constancy callConstancy)
           
private  Void pushVariable()
           
private  void reduceCasts(RexCall outerCast)
           
 Void visitCall(RexCall call)
           
 Void visitCorrelVariable(RexCorrelVariable correlVariable)
           
 Void visitDynamicParam(RexDynamicParam dynamicParam)
           
 Void visitFieldAccess(RexFieldAccess fieldAccess)
           
 Void visitInputRef(RexInputRef inputRef)
           
 Void visitLiteral(RexLiteral literal)
           
 Void visitOver(RexOver over)
           
 Void visitRangeRef(RexRangeRef rangeRef)
           
 
Methods inherited from class org.eigenbase.rex.RexVisitorImpl
visitArrayAnd, visitArrayOr, visitLocalRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preparingStmt

private final FarragoSessionPreparingStmt preparingStmt

stack

private final List<FarragoReduceExpressionsRule.ReducibleExprLocator.Constancy> stack

constExprs

private final List<RexNode> constExprs

addCasts

private final List<Boolean> addCasts

removableCasts

private final List<RexNode> removableCasts

parentCallTypeStack

private final List<SqlOperator> parentCallTypeStack
Constructor Detail

FarragoReduceExpressionsRule.ReducibleExprLocator

FarragoReduceExpressionsRule.ReducibleExprLocator(FarragoSessionPreparingStmt preparingStmt,
                                                  List<RexNode> constExprs,
                                                  List<Boolean> addCasts,
                                                  List<RexNode> removableCasts)
Method Detail

analyze

public void analyze(RexNode exp)

pushVariable

private Void pushVariable()

addResult

private void addResult(RexNode exp)

visitInputRef

public Void visitInputRef(RexInputRef inputRef)
Specified by:
visitInputRef in interface RexVisitor<Void>
Overrides:
visitInputRef in class RexVisitorImpl<Void>

visitLiteral

public Void visitLiteral(RexLiteral literal)
Specified by:
visitLiteral in interface RexVisitor<Void>
Overrides:
visitLiteral in class RexVisitorImpl<Void>

visitOver

public Void visitOver(RexOver over)
Specified by:
visitOver in interface RexVisitor<Void>
Overrides:
visitOver in class RexVisitorImpl<Void>

visitCorrelVariable

public Void visitCorrelVariable(RexCorrelVariable correlVariable)
Specified by:
visitCorrelVariable in interface RexVisitor<Void>
Overrides:
visitCorrelVariable in class RexVisitorImpl<Void>

visitCall

public Void visitCall(RexCall call)
Specified by:
visitCall in interface RexVisitor<Void>
Overrides:
visitCall in class RexVisitorImpl<Void>

analyzeCall

private void analyzeCall(RexCall call,
                         FarragoReduceExpressionsRule.ReducibleExprLocator.Constancy callConstancy)

reduceCasts

private void reduceCasts(RexCall outerCast)

visitDynamicParam

public Void visitDynamicParam(RexDynamicParam dynamicParam)
Specified by:
visitDynamicParam in interface RexVisitor<Void>
Overrides:
visitDynamicParam in class RexVisitorImpl<Void>

visitRangeRef

public Void visitRangeRef(RexRangeRef rangeRef)
Specified by:
visitRangeRef in interface RexVisitor<Void>
Overrides:
visitRangeRef in class RexVisitorImpl<Void>

visitFieldAccess

public Void visitFieldAccess(RexFieldAccess fieldAccess)
Specified by:
visitFieldAccess in interface RexVisitor<Void>
Overrides:
visitFieldAccess in class RexVisitorImpl<Void>