Select-class for flex/bison scanner/parser for TableParse. More...
#include <TableParse.h>
Public Types | |
enum | CommandType { PSELECT, PUPDATE, PINSERT, PDELETE, PCOUNT, PCALC, PCRETAB, PALTTAB } |
enum | GroupAggrType { GROUPBY, AGGR_FUNCS, ONLY_COUNTALL } |
Public Member Functions | |
TableParseSelect (CommandType type) | |
Construct. | |
~TableParseSelect () | |
Destructor. | |
CommandType | commandType () const |
Return the command type. | |
TableExprNode | getNode () const |
Return the expression node. | |
void | makeTableNoFrom (const vector< TableParseSelect * > &stack) |
Create a temporary table in no tables are given in FROM. | |
void | execute (Bool showTimings, Bool setInGiving, Bool mustSelect, uInt maxRow, Bool doTracing=False) |
Execute the select command (select/sort/projection/groupby/having/giving). | |
Table | doFromQuery (Bool showTimings) |
Execute a query in a from clause resulting in a Table. | |
TableExprNode | doSubQuery (Bool showTimings) |
Execute a subquery and create an appropriate node for the result. | |
TableExprNode | doExists (Bool noexists, Bool showTimings) |
Test if a subquery has sufficient elements. | |
void | show (ostream &os) const |
Show the expression tree. | |
void | handleWhere (const TableExprNode &) |
Keep the selection expression. | |
void | handleGroupby (const vector< TableExprNode > &, Bool rollup) |
Keep the groupby expressions. | |
void | handleHaving (const TableExprNode &) |
Keep the having expression. | |
void | handleCalcComm (const TableExprNode &) |
Keep the expression of a calculate command. | |
void | handleCreTab (const Record &dmInfo) |
Keep the create table command. | |
void | handleColSpec (const String &columnName, const String &dataType, const Record &spec, Bool isCOrder=False) |
Keep the column specification in a create table command. | |
void | handleAltTab () |
Reopen the table (for update) used in the ALTER TABLE command. | |
void | handleAddCol (const Record &dmInfo) |
Add columns to the table of ALTER TABLE. | |
ValueHolder | getRecFld (const String &name) |
Add a keyword or replace a keyword with the value of another keyword. | |
void | handleSetKey (const String &name, const String &dtype, const ValueHolder &value) |
Add a keyword or replace a keyword with a value. | |
void | handleRenameKey (const String &oldName, const String &newName) |
Rename a table or column keyword. | |
void | handleRemoveKey (const String &name) |
Remove a table or column keyword. | |
TableRecord & | findKeyword (const String &name, String &keyName) |
Split the given name into optional shorthand, column and fields. | |
void | addUpdate (TableParseUpdate *upd) |
Add an update object. | |
void | setInsertExprs (const std::vector< TableExprNode > exprs) |
Set the insert expressions for all rows. | |
void | handleUpdate () |
Keep the update expressions. | |
void | handleInsert () |
Make ready for the insert expression. | |
void | handleInsert (TableParseSelect *sel) |
void | handleCount () |
Make ready for a COUNT command. | |
void | handleSort (const std::vector< TableParseSort > &sortList, Bool noDuplicates, Sort::Order defaultSortOrder) |
Keep the sort expressions. | |
void | handleLimit (const TableExprNodeSetElem &expr) |
Evaluate and keep limit/offset/stride given as start:end:incr. | |
void | handleLimit (const TableExprNode &expr) |
Evaluate and keep the limit value. | |
void | handleOffset (const TableExprNode &expr) |
Evaluate and keep the offset value. | |
void | handleAddRow (const TableExprNode &expr) |
Evaluate and add the rows. | |
void | addTable (Int tabnr, const String &name, const Table &table, const String &shorthand, const vector< const Table * > tempTables, const vector< TableParseSelect * > &stack) |
Add a table nr, name, or object to the container. | |
Table | makeTable (Int tabnr, const String &name, const Table &ftab, const String &shorthand, const vector< const Table * > tempTables, const vector< TableParseSelect * > &stack, Bool alwaysOpen=True) |
Make a Table object for given name, seqnr or so. | |
void | replaceTable (const Table &table) |
Replace the first table (used by CALC command). | |
TableExprNode | handleKeyCol (const String &name, Bool tryProj) |
Find the keyword or column name and create a TableExprNode from it. | |
TableExprNode | handleFunc (const String &name, const TableExprNodeSet &arguments, const TaQLStyle &) |
Handle a function. | |
void | handleColumn (Int type, const String &name, const TableExprNode &expr, const String &newName, const String &nameMask, const String &newDtype) |
Add a column to the list of column names. | |
void | handleColumnFinish (Bool distinct) |
Finish the addition of columns to the list of column names. | |
void | setDMInfo (const Record &dminfo) |
Set the DataManager info for a new table. | |
void | handleGiving (const String &name, const Record &type) |
Handle the name and type given in a GIVING clause. | |
void | handleGiving (const TableExprNodeSet &) |
Handle the set given in a GIVING clause. | |
const Block< String > & | getColumnNames () const |
Get the projected column names. | |
const Table & | getTable () const |
Get the resulting table. | |
Static Public Member Functions | |
static void | setRecFld (RecordInterface &rec, const String &name, const String &dtype, const ValueHolder &vh) |
Define a field with the given data type in the Record. | |
static String | getTypeString (const String &typeStr, DataType type) |
Get the type string. | |
static TableExprNode | handleSlice (const TableExprNode &array, const TableExprNodeSet &indices, const TaQLStyle &) |
Handle a slice operator. | |
static TableExprNode | makeFuncNode (TableParseSelect *, const String &name, const TableExprNodeSet &arguments, const Vector< int > &ignoreFuncs, const Table &table, const TaQLStyle &) |
Make a function object node for the given function name and arguments. | |
static void | checkAggrFuncs (const TableExprNode &node) |
An exception is thrown if the node uses an aggregate function. | |
static Bool | splitName (String &shorthand, String &columnName, Vector< String > &fieldNames, const String &name, Bool checkError, Bool isKeyword, Bool allowNoKey) |
Split a name into its parts (shorthand, column and field names). | |
Private Member Functions | |
Int | testGroupAggr (vector< TableExprNodeRep * > &aggr) const |
Test if groupby or aggregate functions are given. | |
vector< TableExprNodeRep * > | getAggrNodes () const |
Get the aggregate functions used in SELECT and HAVING. | |
void | doUpdate (Bool showTimings, const Table &origTable, Table &updTable, const Vector< uInt > &rownrs, const CountedPtr< TableExprGroupResult > &groups=CountedPtr< TableExprGroupResult >()) |
Do the update step. | |
Table | doInsert (Bool showTimings, Table &table) |
Do the insert step and return a selection containing the new rows. | |
void | doDelete (Bool showTimings, Table &table) |
Do the delete step. | |
Table | doCount (Bool showTimings, const Table &) |
Do the count step returning a memory table containing the unique column values and the counts of the column values. | |
Table | doProject (Bool showTimings, const Table &, const CountedPtr< TableExprGroupResult > &groups=CountedPtr< TableExprGroupResult >()) |
Do the projection step returning a table containing the projection. | |
Table | doProjectExpr (Bool useSel, const CountedPtr< TableExprGroupResult > &groups) |
Do the projection containing column expressions. | |
Table | createTable (const TableDesc &td, Int64 nrow, const Record &dmInfo) |
Create a table using the given parameters. | |
void | makeProjectExprTable () |
Make the (empty) table for the epxression in the SELECT clause. | |
void | makeProjectExprSel () |
Fill projectExprSelColumn_p telling the columns to be projected at the first stage. | |
void | addApplySelNode (const TableExprNode &node) |
Add a column node to applySelNodes_p. | |
Table | adjustApplySelNodes (const Table &) |
Set the selected rows for the column objects in applySelNodes_p. | |
CountedPtr< TableExprGroupResult > | doGroupby (bool showTimings, vector< TableExprNodeRep * > aggrNodes, Int groupAggrUsed) |
Do the groupby/aggregate step and return its result. | |
void | doHaving (Bool showTimings, const CountedPtr< TableExprGroupResult > &groups) |
Do the HAVING step. | |
CountedPtr< TableExprGroupResult > | doOnlyCountAll (TableExprNodeRep *aggrNode) |
Do a groupby/aggregate step that only does a 'select count(*)'. | |
CountedPtr< TableExprGroupResult > | doGroupByAggr (const vector< TableExprNodeRep * > &aggrNodes) |
Do a full groupby/aggregate step. | |
void | doSort (Bool showTimings) |
Do the sort step. | |
void | doLimOff (Bool showTimings) |
Do the limit/offset step. | |
Table | doLimOff (Bool showTimings, const Table &table) |
Table | doDistinct (Bool showTimings, const Table &table) |
Do the 'select distinct' step. | |
Table | doFinish (Bool showTimings, Table &table) |
Finish the table (rename, copy, and/or flush). | |
template<typename TCOL , typename TNODE > | |
void | updateValue (uInt row, const TableExprId &rowid, Bool isScalarCol, const TableExprNode &node, const Array< Bool > &mask, Bool maskFirst, TableColumn &col, const Slicer *slicerPtr, ArrayColumn< Bool > &maskCol) |
Update the values in the columns (helpers of doUpdate). | |
template<typename TCOL , typename TNODE > | |
void | updateScalar (uInt row, const TableExprId &rowid, const TableExprNode &node, TableColumn &col) |
template<typename TCOL , typename TNODE > | |
void | updateArray (uInt row, const TableExprId &rowid, const TableExprNode &node, const Array< TNODE > &res, ArrayColumn< TCOL > &col) |
template<typename TCOL , typename TNODE > | |
void | updateSlice (uInt row, const TableExprId &rowid, const TableExprNode &node, const Array< TNODE > &res, const Slicer &slice, ArrayColumn< TCOL > &col) |
template<typename TCOL , typename TNODE > | |
void | copyMaskedValue (uInt row, ArrayColumn< TCOL > &acol, const Slicer *slicerPtr, const TNODE *val, uInt incr, const Array< Bool > &mask) |
Array< Bool > | makeMaskSlice (const Array< Bool > &mask, Bool maskFirst, const IPosition &shapeCol, const Slicer *slicerPtr) |
void | checkMaskColumn (Bool hasMask, const ArrayColumn< Bool > &maskCol, const TableColumn &col) |
DataType | makeDataType (DataType dtype, const String &dtstr, const String &colName) |
Make a data type from the string. | |
Sort::Order | getOrder (const TableParseSort &key) const |
Get the order for this key. | |
TableExprNode | getColSet () |
Make an array from the contents of a column in a subquery. | |
TableExprNode | makeSubSet () const |
Make a set from the results of the subquery. | |
Int64 | evalIntScaExpr (const TableExprNode &expr) const |
Evaluate an int scalar expression. | |
Table | findTable (const String &shorthand) const |
Find a table for the given shorthand. | |
void | handleWildColumn (Int stringType, const String &name) |
Handle the selection of a wildcarded column name. | |
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 String &unitName) |
Add the description of a column to the table description. | |
Block< String > | getStoredColumns (const Table &tab) const |
Find the names of all stored columns in a table. | |
void | checkTableProjSizes () const |
Check if the tables used in selection columns have the same size as the first table given in FROM. | |
template<typename T > | |
vector< CountedPtr < TableExprGroupFuncSet > > | doGroupByAggrSingleKey (const vector< TableExprNodeRep * > &aggrNodes) |
Create the set of aggregate functions and groupby keys in case a single groupby key is given. | |
vector< CountedPtr < TableExprGroupFuncSet > > | doGroupByAggrMultipleKeys (const vector< TableExprNodeRep * > &aggrNodes) |
Create the set of aggregate functions and groupby keys in case multiple keys are given. | |
Static Private Member Functions | |
static TableExprNode | makeUDFNode (TableParseSelect *, const String &name, const TableExprNodeSet &arguments, const Table &table, const TaQLStyle &) |
Try to make a UDF function node for the given function name and arguments. | |
static TableExprFuncNode::FunctionType | findFunc (const String &name, uInt narguments, const Vector< Int > &ignoreFuncs) |
Find the function code belonging to a function name. | |
static Table | tableKey (const String &fullName, const String &shorthand, const String &columnName, const Vector< String > &fieldNames, const vector< TableParseSelect * > &stack) |
Try to find the keyword representing a table in one of the tables in any select block (from inner to outer). | |
static Table | findTableKey (const Table &table, const String &columnName, const Vector< String > &keyNames) |
Try to find the keyword representing a table in the given table. | |
Private Attributes | |
CommandType | commandType_p |
TableDesc | tableDesc_p |
vector< TableParse > | fromTables_p |
Block< String > | columnNames_p |
Block< String > | columnNameMasks_p |
Block< TableExprNode > | columnExpr_p |
Block< String > | columnOldNames_p |
Block< String > | columnDtypes_p |
Block< TableRecord > | columnKeywords_p |
uInt | nrSelExprUsed_p |
Bool | distinct_p |
String | resultName_p |
uInt | resultType_p |
Bool | resultCreated_p |
StorageOption | storageOption_p |
Table::EndianFormat | endianFormat_p |
Bool | overwrite_p |
Record | dminfo_p |
TableExprNodeSet * | resultSet_p |
TableExprNode | node_p |
vector< TableExprNode > | groupbyNodes_p |
Bool | groupbyRollup_p |
TableExprNode | havingNode_p |
Int64 | limit_p |
Int64 | endrow_p |
Int64 | offset_p |
Int64 | stride_p |
std::vector< TableParseUpdate * > | update_p |
std::vector< TableExprNode > | insertExprs_p |
TableParseSelect * | insSel_p |
std::vector< TableParseSort > | sort_p |
Bool | noDupl_p |
Sort::Order | order_p |
vector< TableExprNode > | applySelNodes_p |
Table | table_p |
Table | firstColTable_p |
String | firstColName_p |
Table | projectExprTable_p |
Block< uInt > | projectExprSubset_p |
Block< Bool > | projectExprSelColumn_p |
Vector< uInt > | rownrs_p |
Select-class for flex/bison scanner/parser for TableParse.
Internal
This class is needed for the the actions in the flex scanner and bison parser. This stores the information by constructing TableParse objects as needed and storing them in a vector.
It is necessary to be able to give a table select command in ASCII. This can be used in a CLI or in the table browser to get a subset of a table or to sort a table.
Definition at line 380 of file TableParse.h.
Definition at line 383 of file TableParse.h.
Definition at line 394 of file TableParse.h.
casacore::TableParseSelect::TableParseSelect | ( | CommandType | type | ) |
Construct.
casacore::TableParseSelect::~TableParseSelect | ( | ) |
Destructor.
void casacore::TableParseSelect::addApplySelNode | ( | const TableExprNode & | node | ) | [inline, private] |
Add a column node to applySelNodes_p.
Definition at line 689 of file TableParse.h.
References applySelNodes_p.
void casacore::TableParseSelect::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 String & | unitName | |||
) | [private] |
Add the description of a column to the table description.
ndim < 0 means a scalar column.
void casacore::TableParseSelect::addTable | ( | Int | tabnr, | |
const String & | name, | |||
const Table & | table, | |||
const String & | shorthand, | |||
const vector< const Table * > | tempTables, | |||
const vector< TableParseSelect * > & | stack | |||
) |
Add a table nr, name, or object to the container.
void casacore::TableParseSelect::addUpdate | ( | TableParseUpdate * | upd | ) | [inline] |
static void casacore::TableParseSelect::checkAggrFuncs | ( | const TableExprNode & | node | ) | [static] |
An exception is thrown if the node uses an aggregate function.
void casacore::TableParseSelect::checkMaskColumn | ( | Bool | hasMask, | |
const ArrayColumn< Bool > & | maskCol, | |||
const TableColumn & | col | |||
) | [private] |
void casacore::TableParseSelect::checkTableProjSizes | ( | ) | const [private] |
Check if the tables used in selection columns have the same size as the first table given in FROM.
CommandType casacore::TableParseSelect::commandType | ( | ) | const [inline] |
void casacore::TableParseSelect::copyMaskedValue | ( | uInt | row, | |
ArrayColumn< TCOL > & | acol, | |||
const Slicer * | slicerPtr, | |||
const TNODE * | val, | |||
uInt | incr, | |||
const Array< Bool > & | mask | |||
) | [inline, private] |
Table casacore::TableParseSelect::createTable | ( | const TableDesc & | td, | |
Int64 | nrow, | |||
const Record & | dmInfo | |||
) | [private] |
Create a table using the given parameters.
The variables set by handleGiven are used for name and type.
Do the count step returning a memory table containing the unique column values and the counts of the column values.
Do the delete step.
Do the 'select distinct' step.
TableExprNode casacore::TableParseSelect::doExists | ( | Bool | noexists, | |
Bool | showTimings | |||
) |
Test if a subquery has sufficient elements.
It uses default LIMIT=1, but that can be overidden in the subquery. The flag tells if NOT EXISTS or EXISTS was given.
Finish the table (rename, copy, and/or flush).
Execute a query in a from clause resulting in a Table.
CountedPtr<TableExprGroupResult> casacore::TableParseSelect::doGroupby | ( | bool | showTimings, | |
vector< TableExprNodeRep * > | aggrNodes, | |||
Int | groupAggrUsed | |||
) | [private] |
Do the groupby/aggregate step and return its result.
CountedPtr<TableExprGroupResult> casacore::TableParseSelect::doGroupByAggr | ( | const vector< TableExprNodeRep * > & | aggrNodes | ) | [private] |
Do a full groupby/aggregate step.
vector<CountedPtr<TableExprGroupFuncSet> > casacore::TableParseSelect::doGroupByAggrMultipleKeys | ( | const vector< TableExprNodeRep * > & | aggrNodes | ) | [private] |
Create the set of aggregate functions and groupby keys in case multiple keys are given.
vector<CountedPtr<TableExprGroupFuncSet> > casacore::TableParseSelect::doGroupByAggrSingleKey | ( | const vector< TableExprNodeRep * > & | aggrNodes | ) | [inline, private] |
Create the set of aggregate functions and groupby keys in case a single groupby key is given.
This offers much faster map access then doGroupByAggrMultiple.
We have to group the data according to the (possibly empty) groupby. We step through the table in the normal order which may not be the groupby order. A map<key,int> is used to keep track of the results where the int is the index in a vector of a set of aggregate function objects.
Loop through all rows. For each row generate the key to get the right entry.
Definition at line 827 of file TableParse.h.
References groupbyNodes_p, casacore::max(), rownrs_p, casacore::TableExprId::setRownr(), and casacore::ArrayBase::size().
void casacore::TableParseSelect::doHaving | ( | Bool | showTimings, | |
const CountedPtr< TableExprGroupResult > & | groups | |||
) | [private] |
Do the HAVING step.
Do the insert step and return a selection containing the new rows.
void casacore::TableParseSelect::doLimOff | ( | Bool | showTimings | ) | [private] |
Do the limit/offset step.
CountedPtr<TableExprGroupResult> casacore::TableParseSelect::doOnlyCountAll | ( | TableExprNodeRep * | aggrNode | ) | [private] |
Do a groupby/aggregate step that only does a 'select count(*)'.
Table casacore::TableParseSelect::doProject | ( | Bool | showTimings, | |
const Table & | , | |||
const CountedPtr< TableExprGroupResult > & | groups = CountedPtr< TableExprGroupResult >() | |||
) | [private] |
Do the projection step returning a table containing the projection.
Table casacore::TableParseSelect::doProjectExpr | ( | Bool | useSel, | |
const CountedPtr< TableExprGroupResult > & | groups | |||
) | [private] |
Do the projection containing column expressions.
Use the selected or unselected columns depending on useSel
.
void casacore::TableParseSelect::doSort | ( | Bool | showTimings | ) | [private] |
Do the sort step.
TableExprNode casacore::TableParseSelect::doSubQuery | ( | Bool | showTimings | ) |
Execute a subquery and create an appropriate node for the result.
void casacore::TableParseSelect::doUpdate | ( | Bool | showTimings, | |
const Table & | origTable, | |||
Table & | updTable, | |||
const Vector< uInt > & | rownrs, | |||
const CountedPtr< TableExprGroupResult > & | groups = CountedPtr< TableExprGroupResult >() | |||
) | [private] |
Do the update step.
Rows 0,1,2,.. in UpdTable are updated from the expression result for the rows in the given rownrs vector.
Int64 casacore::TableParseSelect::evalIntScaExpr | ( | const TableExprNode & | expr | ) | const [private] |
Evaluate an int scalar expression.
void casacore::TableParseSelect::execute | ( | Bool | showTimings, | |
Bool | setInGiving, | |||
Bool | mustSelect, | |||
uInt | maxRow, | |||
Bool | doTracing = False | |||
) |
Execute the select command (select/sort/projection/groupby/having/giving).
The setInGiving flag tells if a set in the GIVING part is allowed. The mustSelect flag tells if a SELECT command must do something. Usually that is required, but not for a SELECT in an INSERT command. Optionally the maximum nr of rows to be selected can be given. It will be used as the default value for the LIMIT clause. 0 = no maximum.
static TableExprFuncNode::FunctionType casacore::TableParseSelect::findFunc | ( | const String & | name, | |
uInt | narguments, | |||
const Vector< Int > & | ignoreFuncs | |||
) | [static, private] |
Find the function code belonging to a function name.
Functions to be ignored can be given (as function type values). If the function name is unknown, NRFUNC is returned.
TableRecord& casacore::TableParseSelect::findKeyword | ( | const String & | name, | |
String & | keyName | |||
) |
Split the given name into optional shorthand, column and fields.
Find the keywordset for it and fill in the final keyword name. It is a helper function for handleSetKey, etc.
Find a table for the given shorthand.
If no shorthand is given, the first table is returned (if there). If not found, a null Table object is returned.
static Table casacore::TableParseSelect::findTableKey | ( | const Table & | table, | |
const String & | columnName, | |||
const Vector< String > & | keyNames | |||
) | [static, private] |
Try to find the keyword representing a table in the given table.
If the columnName is empty, the keyword is a table keyword. If not found, a null Table object is returned.
vector<TableExprNodeRep*> casacore::TableParseSelect::getAggrNodes | ( | ) | const [private] |
Get the aggregate functions used in SELECT and HAVING.
TableExprNode casacore::TableParseSelect::getColSet | ( | ) | [private] |
Make an array from the contents of a column in a subquery.
Get the projected column names.
Definition at line 987 of file TableParse.h.
References columnNames_p.
TableExprNode casacore::TableParseSelect::getNode | ( | ) | const [inline] |
Sort::Order casacore::TableParseSelect::getOrder | ( | const TableParseSort & | key | ) | const [inline, private] |
Get the order for this key.
Use the default order_p if not explicitly given with the key.
Definition at line 996 of file TableParse.h.
References casacore::TableParseSort::order(), order_p, and casacore::TableParseSort::orderGiven().
ValueHolder casacore::TableParseSelect::getRecFld | ( | const String & | name | ) |
Add a keyword or replace a keyword with the value of another keyword.
The keywords can be table or column keywords (col::key).
Find the names of all stored columns in a table.
const Table & casacore::TableParseSelect::getTable | ( | ) | const [inline] |
static String casacore::TableParseSelect::getTypeString | ( | const String & | typeStr, | |
DataType | type | |||
) | [static] |
Get the type string.
If empty, it is made from the given data type.
void casacore::TableParseSelect::handleAddCol | ( | const Record & | dmInfo | ) |
Add columns to the table of ALTER TABLE.
The column descriptions have already been added to tableDesc_p.
void casacore::TableParseSelect::handleAddRow | ( | const TableExprNode & | expr | ) |
Evaluate and add the rows.
void casacore::TableParseSelect::handleAltTab | ( | ) |
Reopen the table (for update) used in the ALTER TABLE command.
void casacore::TableParseSelect::handleCalcComm | ( | const TableExprNode & | ) |
Keep the expression of a calculate command.
void casacore::TableParseSelect::handleColSpec | ( | const String & | columnName, | |
const String & | dataType, | |||
const Record & | spec, | |||
Bool | isCOrder = False | |||
) |
Keep the column specification in a create table command.
void casacore::TableParseSelect::handleColumn | ( | Int | type, | |
const String & | name, | |||
const TableExprNode & | expr, | |||
const String & | newName, | |||
const String & | nameMask, | |||
const String & | newDtype | |||
) |
Add a column to the list of column names.
void casacore::TableParseSelect::handleColumnFinish | ( | Bool | distinct | ) |
Finish the addition of columns to the list of column names.
void casacore::TableParseSelect::handleCount | ( | ) |
Make ready for a COUNT command.
It checks if all column expressions are scalar.
void casacore::TableParseSelect::handleCreTab | ( | const Record & | dmInfo | ) |
Keep the create table command.
TableExprNode casacore::TableParseSelect::handleFunc | ( | const String & | name, | |
const TableExprNodeSet & | arguments, | |||
const TaQLStyle & | ||||
) |
Handle a function.
void casacore::TableParseSelect::handleGiving | ( | const TableExprNodeSet & | ) |
Handle the set given in a GIVING clause.
Handle the name and type given in a GIVING clause.
void casacore::TableParseSelect::handleGroupby | ( | const vector< TableExprNode > & | , | |
Bool | rollup | |||
) |
Keep the groupby expressions.
It checks if they are all scalar expressions.
void casacore::TableParseSelect::handleHaving | ( | const TableExprNode & | ) |
Keep the having expression.
void casacore::TableParseSelect::handleInsert | ( | TableParseSelect * | sel | ) |
void casacore::TableParseSelect::handleInsert | ( | ) |
Make ready for the insert expression.
The first one uses values (added via addUpdate), the second one a subquery.
TableExprNode casacore::TableParseSelect::handleKeyCol | ( | const String & | name, | |
Bool | tryProj | |||
) |
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).
void casacore::TableParseSelect::handleLimit | ( | const TableExprNode & | expr | ) |
Evaluate and keep the limit value.
void casacore::TableParseSelect::handleLimit | ( | const TableExprNodeSetElem & | expr | ) |
Evaluate and keep limit/offset/stride given as start:end:incr.
void casacore::TableParseSelect::handleOffset | ( | const TableExprNode & | expr | ) |
Evaluate and keep the offset value.
void casacore::TableParseSelect::handleRemoveKey | ( | const String & | name | ) |
Remove a table or column keyword.
Rename a table or column keyword.
void casacore::TableParseSelect::handleSetKey | ( | const String & | name, | |
const String & | dtype, | |||
const ValueHolder & | value | |||
) |
Add a keyword or replace a keyword with a value.
The keyword can be a table or column keyword (col::key). The data type string can be empty leaving the data type unchanged.
static TableExprNode casacore::TableParseSelect::handleSlice | ( | const TableExprNode & | array, | |
const TableExprNodeSet & | indices, | |||
const TaQLStyle & | ||||
) | [static] |
Handle a slice operator.
void casacore::TableParseSelect::handleSort | ( | const std::vector< TableParseSort > & | sortList, | |
Bool | noDuplicates, | |||
Sort::Order | defaultSortOrder | |||
) |
Keep the sort expressions.
void casacore::TableParseSelect::handleUpdate | ( | ) |
Keep the update expressions.
void casacore::TableParseSelect::handleWhere | ( | const TableExprNode & | ) |
Keep the selection expression.
Handle the selection of a wildcarded column name.
DataType casacore::TableParseSelect::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.
static TableExprNode casacore::TableParseSelect::makeFuncNode | ( | TableParseSelect * | , | |
const String & | name, | |||
const TableExprNodeSet & | arguments, | |||
const Vector< int > & | ignoreFuncs, | |||
const Table & | table, | |||
const TaQLStyle & | ||||
) | [static] |
Make a function object node for the given function name and arguments.
The ignoreFuncs vector contains invalid function codes.
Array<Bool> casacore::TableParseSelect::makeMaskSlice | ( | const Array< Bool > & | mask, | |
Bool | maskFirst, | |||
const IPosition & | shapeCol, | |||
const Slicer * | slicerPtr | |||
) | [private] |
void casacore::TableParseSelect::makeProjectExprSel | ( | ) | [private] |
Fill projectExprSelColumn_p telling the columns to be projected at the first stage.
void casacore::TableParseSelect::makeProjectExprTable | ( | ) | [private] |
Make the (empty) table for the epxression in the SELECT clause.
TableExprNode casacore::TableParseSelect::makeSubSet | ( | ) | const [private] |
Make a set from the results of the subquery.
Table casacore::TableParseSelect::makeTable | ( | Int | tabnr, | |
const String & | name, | |||
const Table & | ftab, | |||
const String & | shorthand, | |||
const vector< const Table * > | tempTables, | |||
const vector< TableParseSelect * > & | stack, | |||
Bool | alwaysOpen = True | |||
) |
Make a Table object for given name, seqnr or so.
If alwaysOpen=False
the table will only be looked up, but not opened if not found. This is meant for concatenated tables in TaQLNodeHandler.
void casacore::TableParseSelect::makeTableNoFrom | ( | const vector< TableParseSelect * > & | stack | ) |
Create a temporary table in no tables are given in FROM.
static TableExprNode casacore::TableParseSelect::makeUDFNode | ( | TableParseSelect * | , | |
const String & | name, | |||
const TableExprNodeSet & | arguments, | |||
const Table & | table, | |||
const TaQLStyle & | ||||
) | [static, private] |
Try to make a UDF function node for the given function name and arguments.
void casacore::TableParseSelect::replaceTable | ( | const Table & | table | ) |
Replace the first table (used by CALC command).
void casacore::TableParseSelect::setDMInfo | ( | const Record & | dminfo | ) | [inline] |
Set the DataManager info for a new table.
Definition at line 591 of file TableParse.h.
References dminfo_p.
void casacore::TableParseSelect::setInsertExprs | ( | const std::vector< TableExprNode > | exprs | ) | [inline] |
Set the insert expressions for all rows.
Definition at line 503 of file TableParse.h.
References insertExprs_p.
static void casacore::TableParseSelect::setRecFld | ( | RecordInterface & | rec, | |
const String & | name, | |||
const String & | dtype, | |||
const ValueHolder & | vh | |||
) | [static] |
Define a field with the given data type in the Record.
void casacore::TableParseSelect::show | ( | ostream & | os | ) | const |
Show the expression tree.
static Bool casacore::TableParseSelect::splitName | ( | String & | shorthand, | |
String & | columnName, | |||
Vector< String > & | fieldNames, | |||
const String & | name, | |||
Bool | checkError, | |||
Bool | isKeyword, | |||
Bool | allowNoKey | |||
) | [static] |
Split a name into its parts (shorthand, column and field names).
True is returned if the name contained a keyword part. In that case fieldNames contains the keyword name and the possible subfields. The possible shorthand and the column name are filled in if it is a column keyword. If the name represents a column, fieldNames contains the subfields of the column (for the case where the column contains records). If the name is invalid, an exception is thrown if checkError=True. Otherwise the name is treated as a normal name without keyword. If allowEmtpy is True, :: is allowed, otherwise an error is thrown.
static Table casacore::TableParseSelect::tableKey | ( | const String & | fullName, | |
const String & | shorthand, | |||
const String & | columnName, | |||
const Vector< String > & | fieldNames, | |||
const vector< TableParseSelect * > & | stack | |||
) | [static, private] |
Try to find the keyword representing a table in one of the tables in any select block (from inner to outer).
If not found, an exception is thrown.
Int casacore::TableParseSelect::testGroupAggr | ( | vector< TableExprNodeRep * > & | aggr | ) | const [private] |
Test if groupby or aggregate functions are given.
bit 0: on = groupby is given
bit 1: on = aggregate functions are given
bit 2: on = only select count(*) aggregate function is given
void casacore::TableParseSelect::updateArray | ( | uInt | row, | |
const TableExprId & | rowid, | |||
const TableExprNode & | node, | |||
const Array< TNODE > & | res, | |||
ArrayColumn< TCOL > & | col | |||
) | [inline, private] |
void casacore::TableParseSelect::updateScalar | ( | uInt | row, | |
const TableExprId & | rowid, | |||
const TableExprNode & | node, | |||
TableColumn & | col | |||
) | [inline, private] |
void casacore::TableParseSelect::updateSlice | ( | uInt | row, | |
const TableExprId & | rowid, | |||
const TableExprNode & | node, | |||
const Array< TNODE > & | res, | |||
const Slicer & | slice, | |||
ArrayColumn< TCOL > & | col | |||
) | [inline, private] |
void casacore::TableParseSelect::updateValue | ( | uInt | row, | |
const TableExprId & | rowid, | |||
Bool | isScalarCol, | |||
const TableExprNode & | node, | |||
const Array< Bool > & | mask, | |||
Bool | maskFirst, | |||
TableColumn & | col, | |||
const Slicer * | slicerPtr, | |||
ArrayColumn< Bool > & | maskCol | |||
) | [inline, private] |
Update the values in the columns (helpers of doUpdate).
vector<TableExprNode> casacore::TableParseSelect::applySelNodes_p [private] |
Definition at line 931 of file TableParse.h.
Referenced by addApplySelNode().
Definition at line 883 of file TableParse.h.
Definition at line 879 of file TableParse.h.
Definition at line 885 of file TableParse.h.
Definition at line 877 of file TableParse.h.
Block<String> casacore::TableParseSelect::columnNames_p [private] |
Definition at line 875 of file TableParse.h.
Referenced by getColumnNames().
Definition at line 881 of file TableParse.h.
Definition at line 867 of file TableParse.h.
Referenced by commandType().
Bool casacore::TableParseSelect::distinct_p [private] |
Definition at line 889 of file TableParse.h.
Record casacore::TableParseSelect::dminfo_p [private] |
Definition at line 897 of file TableParse.h.
Referenced by setDMInfo().
Definition at line 895 of file TableParse.h.
Int64 casacore::TableParseSelect::endrow_p [private] |
Definition at line 911 of file TableParse.h.
Definition at line 937 of file TableParse.h.
Definition at line 936 of file TableParse.h.
vector<TableParse> casacore::TableParseSelect::fromTables_p [private] |
Definition at line 873 of file TableParse.h.
vector<TableExprNode> casacore::TableParseSelect::groupbyNodes_p [private] |
Definition at line 903 of file TableParse.h.
Referenced by doGroupByAggrSingleKey().
Definition at line 904 of file TableParse.h.
Definition at line 906 of file TableParse.h.
std::vector<TableExprNode> casacore::TableParseSelect::insertExprs_p [private] |
Definition at line 919 of file TableParse.h.
Referenced by setInsertExprs().
Definition at line 921 of file TableParse.h.
Int64 casacore::TableParseSelect::limit_p [private] |
Definition at line 908 of file TableParse.h.
Definition at line 901 of file TableParse.h.
Referenced by getNode().
Bool casacore::TableParseSelect::noDupl_p [private] |
Definition at line 925 of file TableParse.h.
Definition at line 887 of file TableParse.h.
Int64 casacore::TableParseSelect::offset_p [private] |
Definition at line 913 of file TableParse.h.
Definition at line 927 of file TableParse.h.
Referenced by getOrder().
Bool casacore::TableParseSelect::overwrite_p [private] |
Definition at line 896 of file TableParse.h.
Definition at line 942 of file TableParse.h.
Definition at line 941 of file TableParse.h.
Definition at line 939 of file TableParse.h.
Definition at line 893 of file TableParse.h.
Definition at line 891 of file TableParse.h.
Definition at line 899 of file TableParse.h.
uInt casacore::TableParseSelect::resultType_p [private] |
Definition at line 892 of file TableParse.h.
Vector<uInt> casacore::TableParseSelect::rownrs_p [private] |
Definition at line 944 of file TableParse.h.
Referenced by doGroupByAggrSingleKey().
std::vector<TableParseSort> casacore::TableParseSelect::sort_p [private] |
Definition at line 923 of file TableParse.h.
Definition at line 894 of file TableParse.h.
Int64 casacore::TableParseSelect::stride_p [private] |
Definition at line 915 of file TableParse.h.
Table casacore::TableParseSelect::table_p [private] |
Definition at line 933 of file TableParse.h.
Referenced by getTable().
Definition at line 869 of file TableParse.h.
std::vector<TableParseUpdate*> casacore::TableParseSelect::update_p [private] |
Definition at line 917 of file TableParse.h.
Referenced by addUpdate().