casacore
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::TableParseProject Class Reference

More...

#include <TableParseProject.h>

Public Member Functions

 TableParseProject (const TableParseTableList &tableList)
 Constructor fills a reference to the tableList objkect.
 
Recorddminfo ()
 Get access to the datamanager info.
 
const TableDesctableDesc () const
 Get the table description.
 
const Block< String > & getColumnNames () const
 Get the projected column names.
 
const Block< TableExprNode > & getColumnExpr () const
 Get the projected column expressions.
 
Bool hasExpressions () const
 Are expressions used in the column projection?
 
uInt nColumnsPreCalc () const
 Return the number of projected columns used in other clauses such as HAVING which need to be precalculated.
 
void setColumnNames (const std::vector< std::shared_ptr< TableParseUpdate > > &)
 Set the column names to the ones to be updated.
 
void setUpdateNames (std::vector< std::shared_ptr< TableParseUpdate > > &)
 Put the column name and mask name into the update objects.
 
void setStoredColumns ()
 Set the names to the stored columns of the first table.
 
void handleColumn (Int stringType, const String &name, const TableExprNode &expr, const String &newName, const String &newNameMask, const String &newDtype, TableParseQuery &)
 Add a column to the list of column names.
 
void handleWildColumn (Int stringType, const String &name)
 Handle the selection of a wildcarded column name.
 
Table handleColumnFinish (Bool distinct, Bool hasResultSet, TableParseQuery &)
 Finish the additions to the block of column names by removing the deleted empty names and creating Expr objects as needed.
 
void handleColSpec (const String &columnName, const String &likeColName, const String &dataType, const Record &spec, Bool isCOrder)
 Keep the column specification in a create table command.
 
void handleAddCol (const Record &dmInfo, Table &)
 Add columns to the table of ALTER TABLE.
 
void initDescriptions (const TableDesc &desc, const Record &dminfo)
 Initialize the table and data manager descriptions.
 
void setDMInfo (const Record &dminfo)
 Set the DataManager info for a new table.
 
TableExprNode handleKeyCol (const String &name, Bool tryProj, TableParseQuery &)
 Find the keyword or column name and create a TableExprNode from it.
 
Table project (const Table &tab)
 Make the table projection using the selected columns.
 
void makeUpdate (Bool useSel, TableParseQuery &tpq)
 Create TableParseUpdate objects for the selected column expressions.
 
void makeProjectExprSel ()
 Fill projectExprSelColumn_p telling the columns to be projected at the first stage.
 
void checkTableProjSizes () const
 Check if the tables used in selection columns have the same size as the first table given in FROM.
 
void getAggrNodes (std::vector< TableExprNodeRep * > &aggr) const
 Add possible aggregation functions used in projection to the vector.
 
void checkCountColumns () const
 Check if the COUNT columns are given correctly.
 

Private Member Functions

Table makeProjectExprTable (TableParseQuery &)
 Make the (empty) table for the expression in the SELECT clause.
 
DataType makeDataType (DataType dtype, const String &dtstr, const String &colName)
 Make a data type from the string.
 
void addColumnDesc (TableDesc &td, DataType dtype, const String &colName, Int options, Int ndim, const IPosition &shape, const String &dmType, const String &dmGroup, const String &comment, const TableRecord &keywordSet, const Vector< String > &unitName, const Record &attributes)
 Add the description of a column to the table description.
 
std::pair< ColumnDesc, RecordfindColumnInfo (const String &colName, const String &newColName) const
 Find the ColumnDesc and data manager info of another column (a LIKE column).
 

Private Attributes

const TableParseTableListtableList_p
 
std::shared_ptr< TableDesctableDesc_p
 
Record dminfo_p
 
Block< StringcolumnNames_p
 
Block< StringcolumnNameMasks_p
 
Block< TableExprNodecolumnExpr_p
 
Block< StringcolumnOldNames_p
 
Block< StringcolumnDtypes_p
 
Block< TableRecordcolumnKeywords_p
 
uInt nrSelExprUsed_p
 
Block< uIntprojectExprSubset_p
 
Block< BoolprojectExprSelColumn_p
 
Table firstColTable_p
 
String firstColName_p
 

Detailed Description

Class holding the info of a TaQL projection command

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Synopsis

Table projection is the selection of columns in a TaQL command. This class gets the results of the parser of all columns in the projection. Those results are column name, new name, data type and expression. Furthermore, it holds info which projected columns are used in other parts of a TaQL command (HAVING and ORDERBY). Once the TaQL is fully parsed and all parameters are stored, it is executed. This class creates the table description and data manager info and finally creates the resulting table. First projected columns used in other parts are filled. After a possible HAVING clause and ORDERBY clause is executed, the remaining columns are filled.

Definition at line 68 of file TableParseProject.h.

Constructor & Destructor Documentation

◆ TableParseProject()

casacore::TableParseProject::TableParseProject ( const TableParseTableList tableList)

Constructor fills a reference to the tableList objkect.

Member Function Documentation

◆ addColumnDesc()

void casacore::TableParseProject::addColumnDesc ( TableDesc td,
DataType  dtype,
const String colName,
Int  options,
Int  ndim,
const IPosition shape,
const String dmType,
const String dmGroup,
const String comment,
const TableRecord keywordSet,
const Vector< String > &  unitName,
const Record attributes 
)
private

Add the description of a column to the table description.

ndim < 0 means a scalar column.

◆ checkCountColumns()

void casacore::TableParseProject::checkCountColumns ( ) const

Check if the COUNT columns are given correctly.

◆ checkTableProjSizes()

void casacore::TableParseProject::checkTableProjSizes ( ) const

Check if the tables used in selection columns have the same size as the first table given in FROM.

◆ dminfo()

Record & casacore::TableParseProject::dminfo ( )
inline

Get access to the datamanager info.

Definition at line 75 of file TableParseProject.h.

References dminfo_p.

Referenced by setDMInfo().

◆ findColumnInfo()

std::pair< ColumnDesc, Record > casacore::TableParseProject::findColumnInfo ( const String colName,
const String newColName 
) const
private

Find the ColumnDesc and data manager info of another column (a LIKE column).

The LIKE column name can be qualified to use another table. It sets the new column name in the data manager info. An exception is thrown if colName is invalid or unknown.

◆ getAggrNodes()

void casacore::TableParseProject::getAggrNodes ( std::vector< TableExprNodeRep * > &  aggr) const

Add possible aggregation functions used in projection to the vector.

◆ getColumnExpr()

const Block< TableExprNode > & casacore::TableParseProject::getColumnExpr ( ) const
inline

Get the projected column expressions.

Definition at line 87 of file TableParseProject.h.

References columnExpr_p.

◆ getColumnNames()

const Block< String > & casacore::TableParseProject::getColumnNames ( ) const
inline

Get the projected column names.

Definition at line 83 of file TableParseProject.h.

References columnNames_p.

Referenced by casacore::TableParseQuery::getColumnNames().

◆ handleAddCol()

void casacore::TableParseProject::handleAddCol ( const Record dmInfo,
Table  
)

Add columns to the table of ALTER TABLE.

The column descriptions have already been added to tableDesc_p.

◆ handleColSpec()

void casacore::TableParseProject::handleColSpec ( const String columnName,
const String likeColName,
const String dataType,
const Record spec,
Bool  isCOrder 
)

Keep the column specification in a create table command.

◆ handleColumn()

void casacore::TableParseProject::handleColumn ( Int  stringType,
const String name,
const TableExprNode expr,
const String newName,
const String newNameMask,
const String newDtype,
TableParseQuery  
)

Add a column to the list of column names.

◆ handleColumnFinish()

Table casacore::TableParseProject::handleColumnFinish ( Bool  distinct,
Bool  hasResultSet,
TableParseQuery  
)

Finish the additions to the block of column names by removing the deleted empty names and creating Expr objects as needed.

An exception is thrown if there is a resultset and if columns are selected.

◆ handleKeyCol()

TableExprNode casacore::TableParseProject::handleKeyCol ( const String name,
Bool  tryProj,
TableParseQuery  
)

Find the keyword or column name and create a TableExprNode from it.

If tryProj=True it is first tried if the column is a coluymn in the projected table (i.e., result from the SELECT part).

◆ handleWildColumn()

void casacore::TableParseProject::handleWildColumn ( Int  stringType,
const String name 
)

Handle the selection of a wildcarded column name.

◆ hasExpressions()

Bool casacore::TableParseProject::hasExpressions ( ) const
inline

Are expressions used in the column projection?

Definition at line 91 of file TableParseProject.h.

References nrSelExprUsed_p.

◆ initDescriptions()

void casacore::TableParseProject::initDescriptions ( const TableDesc desc,
const Record dminfo 
)

Initialize the table and data manager descriptions.

◆ makeDataType()

DataType casacore::TableParseProject::makeDataType ( DataType  dtype,
const String dtstr,
const String colName 
)
private

Make a data type from the string.

It checks if it is compatible with the given (expression) data type.

◆ makeProjectExprSel()

void casacore::TableParseProject::makeProjectExprSel ( )

Fill projectExprSelColumn_p telling the columns to be projected at the first stage.

◆ makeProjectExprTable()

Table casacore::TableParseProject::makeProjectExprTable ( TableParseQuery )
private

Make the (empty) table for the expression in the SELECT clause.

◆ makeUpdate()

void casacore::TableParseProject::makeUpdate ( Bool  useSel,
TableParseQuery tpq 
)

Create TableParseUpdate objects for the selected column expressions.

◆ nColumnsPreCalc()

uInt casacore::TableParseProject::nColumnsPreCalc ( ) const
inline

Return the number of projected columns used in other clauses such as HAVING which need to be precalculated.

Definition at line 96 of file TableParseProject.h.

References projectExprSubset_p, and casacore::Block< T >::size().

◆ project()

Table casacore::TableParseProject::project ( const Table tab)

Make the table projection using the selected columns.

The columns in the resulting table are renamed if a new name was given.

◆ setColumnNames()

void casacore::TableParseProject::setColumnNames ( const std::vector< std::shared_ptr< TableParseUpdate > > &  )

Set the column names to the ones to be updated.

◆ setDMInfo()

void casacore::TableParseProject::setDMInfo ( const Record dminfo)
inline

Set the DataManager info for a new table.

Definition at line 139 of file TableParseProject.h.

References dminfo(), and dminfo_p.

Referenced by casacore::TableParseQuery::setDMInfo().

◆ setStoredColumns()

void casacore::TableParseProject::setStoredColumns ( )

Set the names to the stored columns of the first table.

Resize columnNameMasks_p accordingly.

◆ setUpdateNames()

void casacore::TableParseProject::setUpdateNames ( std::vector< std::shared_ptr< TableParseUpdate > > &  )

Put the column name and mask name into the update objects.

◆ tableDesc()

const TableDesc & casacore::TableParseProject::tableDesc ( ) const
inline

Get the table description.

Definition at line 79 of file TableParseProject.h.

References tableDesc_p.

Member Data Documentation

◆ columnDtypes_p

Block<String> casacore::TableParseProject::columnDtypes_p
private

Definition at line 211 of file TableParseProject.h.

◆ columnExpr_p

Block<TableExprNode> casacore::TableParseProject::columnExpr_p
private

Definition at line 207 of file TableParseProject.h.

Referenced by getColumnExpr().

◆ columnKeywords_p

Block<TableRecord> casacore::TableParseProject::columnKeywords_p
private

Definition at line 213 of file TableParseProject.h.

◆ columnNameMasks_p

Block<String> casacore::TableParseProject::columnNameMasks_p
private

Definition at line 205 of file TableParseProject.h.

◆ columnNames_p

Block<String> casacore::TableParseProject::columnNames_p
private

Definition at line 203 of file TableParseProject.h.

Referenced by getColumnNames().

◆ columnOldNames_p

Block<String> casacore::TableParseProject::columnOldNames_p
private

Definition at line 209 of file TableParseProject.h.

◆ dminfo_p

Record casacore::TableParseProject::dminfo_p
private

Definition at line 201 of file TableParseProject.h.

Referenced by dminfo(), and setDMInfo().

◆ firstColName_p

String casacore::TableParseProject::firstColName_p
private

Definition at line 222 of file TableParseProject.h.

◆ firstColTable_p

Table casacore::TableParseProject::firstColTable_p
private

Definition at line 221 of file TableParseProject.h.

◆ nrSelExprUsed_p

uInt casacore::TableParseProject::nrSelExprUsed_p
private

Definition at line 215 of file TableParseProject.h.

Referenced by hasExpressions().

◆ projectExprSelColumn_p

Block<Bool> casacore::TableParseProject::projectExprSelColumn_p
private

Definition at line 218 of file TableParseProject.h.

◆ projectExprSubset_p

Block<uInt> casacore::TableParseProject::projectExprSubset_p
private

Definition at line 217 of file TableParseProject.h.

Referenced by nColumnsPreCalc().

◆ tableDesc_p

std::shared_ptr<TableDesc> casacore::TableParseProject::tableDesc_p
private

Definition at line 200 of file TableParseProject.h.

Referenced by tableDesc().

◆ tableList_p

const TableParseTableList& casacore::TableParseProject::tableList_p
private

Definition at line 197 of file TableParseProject.h.


The documentation for this class was generated from the following file: