net.sf.farrago.query
Class FarragoReduceValuesRule

java.lang.Object
  extended by org.eigenbase.relopt.RelOptRule
      extended by net.sf.farrago.query.FarragoReduceValuesRule

public abstract class FarragoReduceValuesRule
extends RelOptRule

Planner rule which folds projections and filters into an underlying ValuesRel. Returns an EmptyRel if all rows are filtered away.

For example,

select a - b from (values (1, 2), (3, 5), (7, 11)) as t (a, b) where a + b > 4
becomes
select x from (values (-2), (-4))

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/query/FarragoReduceValuesRule.java#7 $
Author:
jhyde

Nested Class Summary
private static class FarragoReduceValuesRule.MyRexShuttle
           
 
Field Summary
static FarragoReduceValuesRule filterInstance
          Singleton instance of this rule which applies to the pattern Filter(Values).
static FarragoReduceValuesRule projectFilterInstance
          Singleton instance of this rule which applies to the pattern Project(Filter(Values)).
static FarragoReduceValuesRule projectInstance
          Singleton instance of this rule which applies to the pattern Project(Values).
private static Logger tracer
           
 
Fields inherited from class org.eigenbase.relopt.RelOptRule
ANY, description, operands
 
Constructor Summary
private FarragoReduceValuesRule(RelOptRuleOperand operand, String desc)
          Creates a new FarragoReduceExpressionsRule object.
 
Method Summary
protected  void apply(RelOptRuleCall call, ProjectRel project, FilterRel filter, ValuesRel values)
          Does the work.
 
Methods inherited from class org.eigenbase.relopt.RelOptRule
convert, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, mergeTraitsAndConvert, mergeTraitsAndConvert, onMatch, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

tracer

private static final Logger tracer

filterInstance

public static final FarragoReduceValuesRule filterInstance
Singleton instance of this rule which applies to the pattern Filter(Values).


projectInstance

public static final FarragoReduceValuesRule projectInstance
Singleton instance of this rule which applies to the pattern Project(Values).


projectFilterInstance

public static final FarragoReduceValuesRule projectFilterInstance
Singleton instance of this rule which applies to the pattern Project(Filter(Values)).

Constructor Detail

FarragoReduceValuesRule

private FarragoReduceValuesRule(RelOptRuleOperand operand,
                                String desc)
Creates a new FarragoReduceExpressionsRule object.

Parameters:
operand - class of rels to which this rule should apply
Method Detail

apply

protected void apply(RelOptRuleCall call,
                     ProjectRel project,
                     FilterRel filter,
                     ValuesRel values)
Does the work.

Parameters:
call - Rule call
project - Project, may be null
filter - Filter, may be null
values - Values rel to be reduced