edu.udo.cs.miningmart.compiler.utils
Class RandomPartition
java.lang.Object
edu.udo.cs.miningmart.compiler.utils.Sampling
edu.udo.cs.miningmart.compiler.utils.RandomPartition
- public class RandomPartition
- extends edu.udo.cs.miningmart.compiler.utils.Sampling
Objects of this class randomly split a source columnset into partitions of approximately
equal size.
- Version:
- $Id: RandomPartition.java,v 1.3 2006/04/11 14:10:19 euler Exp $
- Author:
- Martin Scholz
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
allRowIds
protected java.util.Vector allRowIds
thePrimaryKey
protected java.lang.String[] thePrimaryKey
numericDatatypeName
protected java.lang.String numericDatatypeName
rowIdentifierName
protected java.lang.String rowIdentifierName
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 fromselectedColumns
- 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 classrowcount
- 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.
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
Copyright © 2001-2005