simpledb.materialize
Class SortPlan

java.lang.Object
  extended by simpledb.materialize.SortPlan
All Implemented Interfaces:
Plan

public class SortPlan
extends Object
implements Plan

The Plan class for the sort operator.

Author:
Edward Sciore

Constructor Summary
SortPlan(Plan p, List<String> sortfields, Transaction tx)
          Creates a sort plan for the specified query.
 
Method Summary
 int blocksAccessed()
          Returns the number of blocks in the sorted table, which is the same as it would be in a materialized table.
 int distinctValues(String fldname)
          Returns the number of distinct field values in the sorted table, which is the same as in the underlying query.
 Scan open()
          This method is where most of the action is.
 int recordsOutput()
          Returns the number of records in the sorted table, which is the same as in the underlying query.
 Schema schema()
          Returns the schema of the sorted table, 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

SortPlan

public SortPlan(Plan p,
                List<String> sortfields,
                Transaction tx)
Creates a sort plan for the specified query.

Parameters:
p - the plan for the underlying query
sortfields - the fields to sort by
tx - the calling transaction
Method Detail

open

public Scan open()
This method is where most of the action is. Up to 2 sorted temporary tables are created, and are passed into SortScan for final merging.

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

blocksAccessed

public int blocksAccessed()
Returns the number of blocks in the sorted table, which is the same as it would be in a materialized table. It does not include the one-time cost of materializing and sorting the records.

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

recordsOutput

public int recordsOutput()
Returns the number of records in the sorted table, which is the same as in the underlying query.

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

distinctValues

public int distinctValues(String fldname)
Returns the number of distinct field values in the sorted table, which is the same as in the underlying query.

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 sorted table, 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.