simpledb.query
Class SelectPlan

java.lang.Object
  extended by simpledb.query.SelectPlan
All Implemented Interfaces:
Plan

public class SelectPlan
extends Object
implements Plan

The Plan class corresponding to the select relational algebra operator.

Author:
Edward Sciore

Constructor Summary
SelectPlan(Plan p, Predicate pred)
          Creates a new select node in the query tree, having the specified subquery and predicate.
 
Method Summary
 int blocksAccessed()
          Estimates the number of block accesses in the selection, which is the same as in the underlying query.
 int distinctValues(String fldname)
          Estimates the number of distinct field values in the projection.
 Scan open()
          Creates a select scan for this query.
 int recordsOutput()
          Estimates the number of output records in the selection, which is determined by the reduction factor of the predicate.
 Schema schema()
          Returns the schema of the selection, which is the same as in the underlying query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectPlan

public SelectPlan(Plan p,
                  Predicate pred)
Creates a new select node in the query tree, having the specified subquery and predicate.

Parameters:
p - the subquery
pred - the predicate
Method Detail

open

public Scan open()
Creates a select scan for this query.

Specified by:
open in interface Plan
Returns:
a scan
See Also:
Plan.open()

blocksAccessed

public int blocksAccessed()
Estimates the number of block accesses in the selection, which is the same as in the underlying query.

Specified by:
blocksAccessed in interface Plan
Returns:
the estimated number of block accesses
See Also:
Plan.blocksAccessed()

recordsOutput

public int recordsOutput()
Estimates the number of output records in the selection, which is determined by the reduction factor of the predicate.

Specified by:
recordsOutput in interface Plan
Returns:
the estimated number of output records
See Also:
Plan.recordsOutput()

distinctValues

public int distinctValues(String fldname)
Estimates the number of distinct field values in the projection. If the predicate contains a term equating the specified field to a constant, then this value will be 1. Otherwise, it will be the number of the distinct values in the underlying query (but not more than the size of the output table).

Specified by:
distinctValues in interface Plan
Parameters:
fldname - the name of a field
Returns:
the estimated number of distinct field values in the output
See Also:
Plan.distinctValues(java.lang.String)

schema

public Schema schema()
Returns the schema of the selection, which is the same as in the underlying query.

Specified by:
schema in interface Plan
Returns:
the query's schema
See Also:
Plan.schema()


Copyright © 2011. All Rights Reserved.