Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.udo.cs.miningmart.compiler.utils
Class RandomPartition

    java.lang.Object
      edu.udo.cs.miningmart.compiler.utils.RandomPartition

    public class RandomPartition

extends java.lang.Object

Objects of this class randomly split a source columnset into partitions of approximately equal size.

Version:
  $Id: RandomPartition.java,v 1.5 2006/09/29 17:20:01 euler Exp $
Author:
  Martin Scholz

Field Summary
`protected java.util.Vector` | `allRowIds`
`static long` | `COMMIT_LIMIT`
`protected boolean` | `materializedInput`
`protected java.lang.String` | `numericDatatypeName`
`protected java.lang.String` | `rowIdentifierName`
`protected java.lang.String[]` | `thePrimaryKey`
`protected boolean` | `usingMysql`
`protected boolean` | `usingOracle`
`protected boolean` | `usingPostgres`

Constructor Summary
`RandomPartition(Columnset sourceCs, java.util.Collection selectedColumns, java.lang.String[] destTableNames, boolean stopWithTempTable, java.lang.String tempTable, java.lang.Long rowcount, java.lang.Long seed, CompilerDatabaseService db)` This constructor does not affect in drawing a single sample, but the source columnset is randomly split into partitions of equal size.

Method Summary
`protected void` | `commit()`
`protected void` | `dbWrite(java.lang.String sql)`
`protected void` | `deleteTable(java.lang.String tableName)` Helper method to delete a table and to ignore a possible "table does not exist" exception.
`double` | `getNextRandomDouble()`
`long` | `getRowCount()`
`java.lang.String` | `getSourceAttributeDefinitions()`
`java.lang.String` | `getSourceAttributes()`
`java.util.Collection` | `getSourceTableColumns()`
`java.lang.String` | `getSourceTableName()`
`java.lang.String` | `getTempTableName()`
`boolean` | `isStopWithTempTable()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### COMMIT_LIMIT

    public static final long COMMIT_LIMIT

See Also:
  Constant Field Values

### materializedInput

    protected boolean materializedInput

### usingPostgres

    protected boolean usingPostgres

### usingOracle

    protected boolean usingOracle

### usingMysql

    protected boolean usingMysql

### allRowIds

    protected java.util.Vector allRowIds

### thePrimaryKey

    protected java.lang.String[] thePrimaryKey

### numericDatatypeName

    protected java.lang.String numericDatatypeName

### rowIdentifierName

    protected java.lang.String rowIdentifierName

Constructor Detail

### RandomPartition

    public RandomPartition(Columnset sourceCs,
                           java.util.Collection selectedColumns,
                           java.lang.String[] destTableNames,
                           boolean stopWithTempTable,
                           java.lang.String tempTable,
                           java.lang.Long rowcount,
                           java.lang.Long seed,
                           CompilerDatabaseService db)
                    throws M4CompilerError

  This constructor does not affect in drawing a single sample, but the source columnset is randomly split into partitions of equal size.

  Parameters:
    `sourceCs` - the source `Columnset` to draw a sample from
    `selectedColumns` - if not `null` then this `Collection` of `Column` names in uppercase letters specifies, which `Column`s to copy into the partitioned tables. `null` means to copy all `Column`s of the `Columnset`.
    `destTableNames` - an array specifying the names of the output tables.
    `stopWithTempTable` - If this value is true, then the output of the object is the temporary table, rather than the segmented tables. The array destTableNames must not be `null` in this case, because it implicitly specifies the number of segments.
    `tempTable` - the name of the temporary table used by this class
    `rowcount` - the number of rows in the source `Columnset`, or `null`, if this value is not known in advance. The number of rows is calculated by the class in the latter case.
    `seed` - the random seed to be used or `null` to use a "random" random seed.
    `db` - a reference to the thread's `edu.udo.cs.miningmart.m4.core.utils.DB` object.
  Throws:
    `M4CompilerError` - if the sampling fails.

Method Detail

### isStopWithTempTable

    public boolean isStopWithTempTable()

  Returns:
    true, if the object's result should be the temporary table

### getSourceAttributes

    public java.lang.String getSourceAttributes()
                                         throws M4CompilerError

  Returns:
    a comma separated list of the source columnset's attribute names "registered" as M4 columns.
  Throws:
    `M4CompilerError`

### getSourceAttributeDefinitions

    public java.lang.String getSourceAttributeDefinitions()
                                                   throws M4CompilerError

  Returns:
    the list of attributes "registered" as columns, in the format necessary for an SQL `SELECT` statement. If columns are "virtual", then the SQL definition followed by the name is returned.
  Throws:
    `M4CompilerError`

### getSourceTableName

    public java.lang.String getSourceTableName()

  Returns:
    name of the source columnset

### getSourceTableColumns

    public java.util.Collection getSourceTableColumns()
                                               throws M4CompilerError

  Returns:
    collection of columns of the source columnset
  Throws:
    `M4CompilerError`

### getTempTableName

    public java.lang.String getTempTableName()

  Returns:
    name of the temporary table to use

### getRowCount

    public long getRowCount()

  Returns:
    number of rows of the source columnset

### getNextRandomDouble

    public double getNextRandomDouble()

  Returns:
    a new uniformly distributed random double

### dbWrite

    protected void dbWrite(java.lang.String sql)
                    throws java.sql.SQLException,
                           DbConnectionClosed

  Parameters:
    `sql` - an sql string to be executed in the business database.
  Throws:
    `an` - `SQLException`, if the database operations fail.
    `an` - `DbConnectionClosed`, if the database connection has been closed after a request to stop the thread.
    `java.sql.SQLException`
    `DbConnectionClosed`

### deleteTable

    protected void deleteTable(java.lang.String tableName)
                        throws M4CompilerError

  Helper method to delete a table and to ignore a possible "table does not exist" exception.

  Throws:
    `M4CompilerError`
  See Also:
    `edu.udo.cs.miningmart.m4.core.utils.DB#dropBusinessTable(String)`

### commit

    protected void commit()
                   throws DbConnectionClosed,
                          java.sql.SQLException

  Throws:
    `DbConnectionClosed`
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005