net.sf.farrago.test
Class FarragoStatsUtil

java.lang.Object
  extended by net.sf.farrago.test.FarragoStatsUtil

public class FarragoStatsUtil
extends Object

Utility class for manipulating statistics stored in the catalog

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/test/FarragoStatsUtil.java#18 $
Author:
John Pham

Field Summary
static int DEFAULT_HISTOGRAM_BAR_COUNT
           
 
Constructor Summary
FarragoStatsUtil()
           
 
Method Summary
static void createColumnHistogram(FarragoSession session, String catalogName, String schemaName, String tableName, String columnName, long distinctValues, int samplePercent, long sampleDistinctValues, int distributionType, String valueDigits)
          Creates a column histogram
private static List<FemColumnHistogramBar> createColumnHistogramBars(FarragoRepos repos, FemAbstractColumn column, long distinctValues, int barCount, long rowsPerBar, long rowsLastBar, int distributionType, String valueDigits)
           
private static List<Long> createValueCounts(int barCount, long distinctValueCount, int distributionType)
           
private static List<String> createValues(int barCount, String valueDigits, int distributionType, List<Long> valueCounts)
           
static CwmCatalog lookupCatalog(FarragoSession session, FarragoRepos repos, String catalogName)
           
static FemAbstractColumn lookupColumn(FemAbstractColumnSet columnSet, String columnName)
           
static FemAbstractColumnSet lookupColumnSet(FarragoSession session, FarragoRepos repos, String catalogName, String schemaName, String tableName)
          Maps a table, given its name components, to its corresponding FemAbstractColumnSet
static FemAbstractColumnSet lookupColumnSet(FemLocalSchema schema, String tableName)
           
private static FemLocalIndex lookupIndex(FemLocalSchema schema, String indexName)
           
static FemLocalSchema lookupSchema(FarragoSession session, CwmCatalog catalog, String schemaName)
           
static void setIndexPageCount(FarragoSession session, String catalogName, String schemaName, String indexName, long pageCount)
           
static void setTableRowCount(FarragoSession session, String catalogName, String schemaName, String tableName, long rowCount)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HISTOGRAM_BAR_COUNT

public static final int DEFAULT_HISTOGRAM_BAR_COUNT
See Also:
Constant Field Values
Constructor Detail

FarragoStatsUtil

public FarragoStatsUtil()
Method Detail

setTableRowCount

public static void setTableRowCount(FarragoSession session,
                                    String catalogName,
                                    String schemaName,
                                    String tableName,
                                    long rowCount)
                             throws SqlValidatorException
Throws:
SqlValidatorException

lookupCatalog

public static CwmCatalog lookupCatalog(FarragoSession session,
                                       FarragoRepos repos,
                                       String catalogName)
                                throws SqlValidatorException
Throws:
SqlValidatorException

lookupSchema

public static FemLocalSchema lookupSchema(FarragoSession session,
                                          CwmCatalog catalog,
                                          String schemaName)
                                   throws SqlValidatorException
Throws:
SqlValidatorException

lookupColumnSet

public static FemAbstractColumnSet lookupColumnSet(FemLocalSchema schema,
                                                   String tableName)
                                            throws SqlValidatorException
Throws:
SqlValidatorException

lookupColumnSet

public static FemAbstractColumnSet lookupColumnSet(FarragoSession session,
                                                   FarragoRepos repos,
                                                   String catalogName,
                                                   String schemaName,
                                                   String tableName)
                                            throws SqlValidatorException
Maps a table, given its name components, to its corresponding FemAbstractColumnSet

Parameters:
session - currrent session
repos - repository associated with the session
catalogName - catalog name for the table
schemaName - schema name for the table
tableName - table name
Returns:
FemAbstractColumnSet corresponding to the desired table
Throws:
SqlValidatorException

setIndexPageCount

public static void setIndexPageCount(FarragoSession session,
                                     String catalogName,
                                     String schemaName,
                                     String indexName,
                                     long pageCount)
                              throws SqlValidatorException
Throws:
SqlValidatorException

createColumnHistogram

public static void createColumnHistogram(FarragoSession session,
                                         String catalogName,
                                         String schemaName,
                                         String tableName,
                                         String columnName,
                                         long distinctValues,
                                         int samplePercent,
                                         long sampleDistinctValues,
                                         int distributionType,
                                         String valueDigits)
                                  throws SqlValidatorException
Creates a column histogram

Throws:
SqlValidatorException

createColumnHistogramBars

private static List<FemColumnHistogramBar> createColumnHistogramBars(FarragoRepos repos,
                                                                     FemAbstractColumn column,
                                                                     long distinctValues,
                                                                     int barCount,
                                                                     long rowsPerBar,
                                                                     long rowsLastBar,
                                                                     int distributionType,
                                                                     String valueDigits)

createValues

private static List<String> createValues(int barCount,
                                         String valueDigits,
                                         int distributionType,
                                         List<Long> valueCounts)

createValueCounts

private static List<Long> createValueCounts(int barCount,
                                            long distinctValueCount,
                                            int distributionType)

lookupIndex

private static FemLocalIndex lookupIndex(FemLocalSchema schema,
                                         String indexName)
                                  throws SqlValidatorException
Throws:
SqlValidatorException

lookupColumn

public static FemAbstractColumn lookupColumn(FemAbstractColumnSet columnSet,
                                             String columnName)
                                      throws SqlValidatorException
Throws:
SqlValidatorException