kdl.prox.qgraph2.algebra.experiments
Class MonitoredNST

java.lang.Object
  extended by kdl.prox.dbmgr.NST
      extended by kdl.prox.qgraph2.algebra.experiments.MonitoredNST

public class MonitoredNST
extends NST

MonitoredNST is a subclass of NST. It has no new behavior except that it monitors the main operations, recording running time, result size, etc. and writes this information to the log.

It is a subclass so that other classes (e.g., QGTable) treats it like an NST.

Author: mhay


Field Summary
 
Fields inherited from class kdl.prox.dbmgr.NST
columnList, isReleased, topBATName
 
Constructor Summary
MonitoredNST(java.lang.String[] colBATs, java.lang.String[] colNames, java.lang.String[] colTypes)
           
 
Method Summary
 NST addConstantColumn(java.lang.String colName, java.lang.String type, java.lang.String value)
          Adds a new column to the NST, of the specified type, and with all rows with the same specified value.
 NST addDistinctCountColumn(java.lang.String baseColName, java.lang.String changingColName, java.lang.String colName)
          Adds a column with the count of unique values in column changingColName for each different value of baseColName.
 NST addNumberColumn(java.lang.String newColName)
          Adds a column to the NST with a numbering 0-n (as oid)
 NST copy()
          Returns a copy of this NST
 NST distinct()
           
 NST filter(java.lang.String filterDef)
           
 NST filter(java.lang.String filterDef, java.lang.String colList)
          Returns a MATERIALIZED NST with the filter and set of columns and the selected rows.
 NST groupBy(java.lang.String colList, java.lang.String newColName)
          Adds a column at the end of the NST named newColName in which different values correspond to different values in the specified columns

If the newColName column already exists, it deletes it.

 NST insertRowsFromNST(NST otherNST)
          Gets all the rows from the second NST and inserts them into me.
 NST join(NST otherNST, java.lang.String[] firstColNames, java.lang.String[] secondColNames)
           
static MonitoredNST makeFromNST(NST nst)
           
 NST projectDistinct(java.lang.String colList)
          Selects a set of columns, using the filter command, and then applies a unique.
 
Methods inherited from class kdl.prox.dbmgr.NST
addArithmeticColumn, addColumnFromBATVar, addColumnFromBATVarInternal, addConditionColumn, addConstantColumn, addCopyColumn, addCountColumn, addKeyColumn, addNumberColumn, addRandomBinaryColumn, addRandomColumn, addRandomSortColumn, addStringCleanupColumn, addSubstringColumn, aggregate, aggregate, avg, castColumn, count, count, cross, cross, delete, deleteRows, deleteRows, describe, difference, difference, distinct, fastInsert, fromfile, getColumnCount, getColumnHistogram, getColumnHistogram, getColumnHistogramAsNST, getColumnHistogramAsNST, getColumnValueAsBATName, getDistinctColumnValues, getDistinctColumnValuesBinned, getDistinctColumnValuesCount, getMatchingRows, getNSTColumn, getNSTColumn, getNSTColumnNames, getNSTColumnNamesAsString, getNSTColumns, getNSTColumnTypesAsString, getRandomAggregate, getRowCount, getRowCount, getTwoNSTColumns, groupBy, insertRow, insertRow, insertRows, intersect, intersect, isColumnExists, isReleased, join, join, join, joinUnless, joinUnless, leftOuterJoin, leftOuterJoin, leftOuterJoin, leftOuterJoin, makeWritable, match, max, median, min, orderColumns, print, print, prod, project, randomize, range, rangeSorted, release, removeColumn, renameColumn, renameColumns, replace, save, save, selectRows, selectRows, selectRows, selectRows, selectRows, setIsBATNameColumn, sort, sort, sum, tofile, tofile, union, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitoredNST

public MonitoredNST(java.lang.String[] colBATs,
                    java.lang.String[] colNames,
                    java.lang.String[] colTypes)
Method Detail

addConstantColumn

public NST addConstantColumn(java.lang.String colName,
                             java.lang.String type,
                             java.lang.String value)
Description copied from class: NST
Adds a new column to the NST, of the specified type, and with all rows with the same specified value.

Overrides:
addConstantColumn in class NST
type - -- null gets the type from Monet
value - -- null writes a nil

addDistinctCountColumn

public NST addDistinctCountColumn(java.lang.String baseColName,
                                  java.lang.String changingColName,
                                  java.lang.String colName)
Description copied from class: NST
Adds a column with the count of unique values in column changingColName for each different value of baseColName. For example, suppose we have two columns with the following values:

 A   B
 -----
 1   A
 1   B
 1   C
 !   B
 2   X
 2   Y
 3   A
 

It will create a new column (colName) at the end of the NST with the following values

 A   B  cnt
 ----------
 1   A    3
 1   B    3
 1   C    3
 1   B    3
 2   X    2
 2   Y    2
 3   A    1
 

It works by first putting in a single BAT the baseColName and changingColName tails, then finding the distinct (baseColName, changingColName) combinations, and then doing a histogram based on baseColName. Finally, the resulting BAT with (baseColName | distinct count) is joined with baseColName, so as to expand it and have a row for every row in the NST. This join is added as a new column in the NST.

Overrides:
addDistinctCountColumn in class NST

addNumberColumn

public NST addNumberColumn(java.lang.String newColName)
Description copied from class: NST
Adds a column to the NST with a numbering 0-n (as oid)

Overrides:
addNumberColumn in class NST

copy

public NST copy()
Description copied from class: NST
Returns a copy of this NST

Overrides:
copy in class NST

distinct

public NST distinct()
Overrides:
distinct in class NST

filter

public NST filter(java.lang.String filterDef)
Overrides:
filter in class NST

filter

public NST filter(java.lang.String filterDef,
                  java.lang.String colList)
Description copied from class: NST
Returns a MATERIALIZED NST with the filter and set of columns and the selected rows.

The filter is applied first. Then the resulting (filtered) NST is copy-d over with the desired columns. Finally, if the rowList doesn't specify from,to, an order column is added to the NST (random order or not) and a new filter is applied to the NST to keep the desired rows.

Overrides:
filter in class NST
colList - (optional, "*" by default)
Returns:
See Also:
class for information about the filterDef, method for information about the colList

groupBy

public NST groupBy(java.lang.String colList,
                   java.lang.String newColName)
Description copied from class: NST
Adds a column at the end of the NST named newColName in which different values correspond to different values in the specified columns

If the newColName column already exists, it deletes it.

Overrides:
groupBy in class NST
newColName - (optional, group_id by default)

insertRowsFromNST

public NST insertRowsFromNST(NST otherNST)
Description copied from class: NST
Gets all the rows from the second NST and inserts them into me. Recodes the heads of the otherNST, to avoid duplicates Other NST must have the same number of columns (and types) as me

Overrides:
insertRowsFromNST in class NST
Returns:
this NST

join

public NST join(NST otherNST,
                java.lang.String[] firstColNames,
                java.lang.String[] secondColNames)
Overrides:
join in class NST

makeFromNST

public static MonitoredNST makeFromNST(NST nst)

projectDistinct

public NST projectDistinct(java.lang.String colList)
Description copied from class: NST
Selects a set of columns, using the filter command, and then applies a unique.

Overrides:
projectDistinct in class NST