simpledb.query
Class ProductPlan

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

public class ProductPlan
extends Object
implements Plan

The Plan class corresponding to the product relational algebra operator.

Author:
Edward Sciore

Constructor Summary
ProductPlan(Plan p1, Plan p2)
          Creates a new product node in the query tree, having the two specified subqueries.
 
Method Summary
 int blocksAccessed()
          Estimates the number of block accesses in the product.
 int distinctValues(String fldname)
          Estimates the distinct number of field values in the product.
 Scan open()
          Creates a product scan for this query.
 int recordsOutput()
          Estimates the number of output records in the product.
 Schema schema()
          Returns the schema of the product, which is the union of the schemas of the underlying queries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProductPlan

public ProductPlan(Plan p1,
                   Plan p2)
Creates a new product node in the query tree, having the two specified subqueries.

Parameters:
p1 - the left-hand subquery
p2 - the right-hand subquery
Method Detail

open

public Scan open()
Creates a product 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 product. The formula is:
 B(product(p1,p2)) = B(p1) + R(p1)*B(p2) 

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 product. The formula is:
 R(product(p1,p2)) = R(p1)*R(p2) 

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 distinct number of field values in the product. Since the product does not increase or decrease field values, the estimate is the same as in the appropriate 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 product, which is the union of the schemas of the underlying queries.

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


Copyright © 2011. All Rights Reserved.