SNAP Library 6.0, Developer Reference
2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Table class: Relational table with columnar data storage. More...
#include <table.h>
Classes | |
class | TLoadVecInit |
Public Member Functions | |
void | AddIntCol (const TStr &ColName) |
Adds an integer column with name ColName . More... | |
void | AddFltCol (const TStr &ColName) |
Adds a float column with name ColName . More... | |
void | AddStrCol (const TStr &ColName) |
Adds a string column with name ColName . More... | |
void | GroupByIntColMP (const TStr &GroupBy, THashMP< TInt, TIntV > &Grouping, TBool UsePhysicalIds=true) const |
Groups/hashes by a single column with integer values, using OpenMP multi-threading. More... | |
TTable () | |
TTable (TTableContext *Context) | |
TTable (const Schema &S, TTableContext *Context) | |
TTable (TSIn &SIn, TTableContext *Context) | |
TTable (const THash< TInt, TInt > &H, const TStr &Col1, const TStr &Col2, TTableContext *Context, const TBool IsStrKeys=false) | |
Constructor to build table out of a hash table of int->int. More... | |
TTable (const THash< TInt, TFlt > &H, const TStr &Col1, const TStr &Col2, TTableContext *Context, const TBool IsStrKeys=false) | |
Constructor to build table out of a hash table of int->float. More... | |
TTable (const TTable &Table) | |
Copy constructor. More... | |
TTable (const TTable &Table, const TIntV &RowIds) | |
void | SaveSS (const TStr &OutFNm) |
Saves table schema and content to a TSV file. More... | |
void | SaveBin (const TStr &OutFNm) |
Saves table schema and content to a binary file. More... | |
void | Save (TSOut &SOut) |
Saves table schema and content to a binary format. More... | |
void | Dump (FILE *OutF=stdout) const |
Prints table contents to a text file. More... | |
void | AddRow (const TTableRow &Row) |
Adds row with values taken from given TTableRow. More... | |
TTableContext * | GetContext () |
Returns the context. More... | |
TTableContext * | ChangeContext (TTableContext *Context) |
Changes the current context. Moves all object items to the new context. More... | |
TInt | GetColIdx (const TStr &ColName) const |
Gets index of column ColName among columns of the same type in the schema. More... | |
TInt | GetIntVal (const TStr &ColName, const TInt &RowIdx) |
Gets the value of integer attribute ColName at row RowIdx . More... | |
TFlt | GetFltVal (const TStr &ColName, const TInt &RowIdx) |
Gets the value of float attribute ColName at row RowIdx . More... | |
TStr | GetStrVal (const TStr &ColName, const TInt &RowIdx) const |
Gets the value of string attribute ColName at row RowIdx . More... | |
TInt | GetStrMapById (TInt ColIdx, TInt RowIdx) const |
Gets the integer mapping of the string at column ColIdx at row RowIdx . More... | |
TInt | GetStrMapByName (const TStr &ColName, TInt RowIdx) const |
Gets the integer mapping of the string at column ColName at row RowIdx . More... | |
TStr | GetStrValById (TInt ColIdx, TInt RowIdx) const |
Gets the value of the string attribute at column ColIdx at row RowIdx . More... | |
TStr | GetStrValByName (const TStr &ColName, const TInt &RowIdx) const |
Gets the value of the string attribute at column ColName at row RowIdx . More... | |
TIntV | GetIntRowIdxByVal (const TStr &ColName, const TInt &Val) const |
Gets the rows containing Val in int column ColName . More... | |
TIntV | GetStrRowIdxByMap (const TStr &ColName, const TInt &Map) const |
Gets the rows containing int mapping Map in str column ColName . More... | |
TIntV | GetFltRowIdxByVal (const TStr &ColName, const TFlt &Val) const |
Gets the rows containing Val in flt column ColName . More... | |
TInt | RequestIndexInt (const TStr &ColName) |
Creates Index for Int Column ColName . More... | |
TInt | RequestIndexFlt (const TStr &ColName) |
Creates Index for Flt Column ColName . More... | |
TInt | RequestIndexStrMap (const TStr &ColName) |
Creates Index for Str Column ColName . More... | |
TStr | GetStr (const TInt &KeyId) const |
Gets the string with KeyId . More... | |
TInt | GetIntValAtRowIdx (const TInt &ColIdx, const TInt &RowIdx) |
Get the integer value at column ColIdx and row RowIdx . More... | |
TFlt | GetFltValAtRowIdx (const TInt &ColIdx, const TInt &RowIdx) |
Get the float value at column ColIdx and row RowIdx . More... | |
Schema | GetSchema () |
Gets the schema of this table. More... | |
TVec< PNEANet > | ToGraphSequence (TStr SplitAttr, TAttrAggr AggrPolicy, TInt WindowSize, TInt JumpSize, TInt StartVal=TInt::Mn, TInt EndVal=TInt::Mx) |
Creates a sequence of graphs based on values of column SplitAttr and windows specified by JumpSize and WindowSize. More... | |
TVec< PNEANet > | ToVarGraphSequence (TStr SplitAttr, TAttrAggr AggrPolicy, TIntPrV SplitIntervals) |
Creates a sequence of graphs based on values of column SplitAttr and intervals specified by SplitIntervals. More... | |
TVec< PNEANet > | ToGraphPerGroup (TStr GroupAttr, TAttrAggr AggrPolicy) |
Creates a sequence of graphs based on grouping specified by GroupAttr. More... | |
PNEANet | ToGraphSequenceIterator (TStr SplitAttr, TAttrAggr AggrPolicy, TInt WindowSize, TInt JumpSize, TInt StartVal=TInt::Mn, TInt EndVal=TInt::Mx) |
Creates the graph sequence one at a time. More... | |
PNEANet | ToVarGraphSequenceIterator (TStr SplitAttr, TAttrAggr AggrPolicy, TIntPrV SplitIntervals) |
Creates the graph sequence one at a time. More... | |
PNEANet | ToGraphPerGroupIterator (TStr GroupAttr, TAttrAggr AggrPolicy) |
Creates the graph sequence one at a time. More... | |
PNEANet | NextGraphIterator () |
Calls to this must be preceded by a call to one of the above ToGraph*Iterator functions. More... | |
TBool | IsLastGraphOfSequence () |
Checks if the end of the graph sequence is reached. More... | |
TStr | GetSrcCol () const |
Gets the name of the column to be used as src nodes in the graph. More... | |
void | SetSrcCol (const TStr &Src) |
Sets the name of the column to be used as src nodes in the graph. More... | |
TStr | GetDstCol () const |
Gets the name of the column to be used as dst nodes in the graph. More... | |
void | SetDstCol (const TStr &Dst) |
Sets the name of the column to be used as dst nodes in the graph. More... | |
void | AddEdgeAttr (const TStr &Attr) |
Adds column to be used as graph edge attribute. More... | |
void | AddEdgeAttr (TStrV &Attrs) |
Adds columns to be used as graph edge attributes. More... | |
void | AddSrcNodeAttr (const TStr &Attr) |
Adds column to be used as src node atribute of the graph. More... | |
void | AddSrcNodeAttr (TStrV &Attrs) |
Adds columns to be used as src node attributes of the graph. More... | |
void | AddDstNodeAttr (const TStr &Attr) |
Adds column to be used as dst node atribute of the graph. More... | |
void | AddDstNodeAttr (TStrV &Attrs) |
Adds columns to be used as dst node attributes of the graph. More... | |
void | AddNodeAttr (const TStr &Attr) |
Handles the common case where src and dst both belong to the same "universe" of entities. More... | |
void | AddNodeAttr (TStrV &Attrs) |
Handles the common case where src and dst both belong to the same "universe" of entities. More... | |
void | SetCommonNodeAttrs (const TStr &SrcAttr, const TStr &DstAttr, const TStr &CommonAttrName) |
Sets the columns to be used as both src and dst node attributes. More... | |
TStrV | GetSrcNodeIntAttrV () const |
Gets src node int attribute name vector. More... | |
TStrV | GetDstNodeIntAttrV () const |
Gets dst node int attribute name vector. More... | |
TStrV | GetEdgeIntAttrV () const |
Gets edge int attribute name vector. More... | |
TStrV | GetSrcNodeFltAttrV () const |
Gets src node float attribute name vector. More... | |
TStrV | GetDstNodeFltAttrV () const |
Gets dst node float attribute name vector. More... | |
TStrV | GetEdgeFltAttrV () const |
Gets edge float attribute name vector. More... | |
TStrV | GetSrcNodeStrAttrV () const |
Gets src node str attribute name vector. More... | |
TStrV | GetDstNodeStrAttrV () const |
Gets dst node str attribute name vector. More... | |
TStrV | GetEdgeStrAttrV () const |
Gets edge str attribute name vector. More... | |
TAttrType | GetColType (const TStr &ColName) const |
Gets type of column ColName . More... | |
TInt | GetNumRows () const |
Gets total number of rows in this table. More... | |
TInt | GetNumValidRows () const |
Gets number of valid, i.e. not deleted, rows in this table. More... | |
THash< TInt, TInt > | GetRowIdMap () const |
Gets a map of logical to physical row ids. More... | |
TRowIterator | BegRI () const |
Gets iterator to the first valid row of the table. More... | |
TRowIterator | EndRI () const |
Gets iterator to the last valid row of the table. More... | |
TRowIteratorWithRemove | BegRIWR () |
Gets iterator with reomve to the first valid row. More... | |
TRowIteratorWithRemove | EndRIWR () |
Gets iterator with reomve to the last valid row. More... | |
void | GetPartitionRanges (TIntPrV &Partitions, TInt NumPartitions) const |
Partitions the table into NumPartitions and populate Partitions with the ranges. More... | |
void | Rename (const TStr &Column, const TStr &NewLabel) |
Renames a column. More... | |
void | Unique (const TStr &Col) |
Removes rows with duplicate values in given column. More... | |
void | Unique (const TStrV &Cols, TBool Ordered=true) |
Removes rows with duplicate values in given columns. More... | |
void | Select (TPredicate &Predicate, TIntV &SelectedRows, TBool Remove=true) |
Selects rows that satisfy given Predicate . More... | |
void | Select (TPredicate &Predicate) |
void | Classify (TPredicate &Predicate, const TStr &LabelName, const TInt &PositiveLabel=1, const TInt &NegativeLabel=0) |
void | SelectAtomic (const TStr &Col1, const TStr &Col2, TPredComp Cmp, TIntV &SelectedRows, TBool Remove=true) |
Selects rows using atomic compare operation. More... | |
void | SelectAtomic (const TStr &Col1, const TStr &Col2, TPredComp Cmp) |
void | ClassifyAtomic (const TStr &Col1, const TStr &Col2, TPredComp Cmp, const TStr &LabelName, const TInt &PositiveLabel=1, const TInt &NegativeLabel=0) |
void | SelectAtomicConst (const TStr &Col, const TPrimitive &Val, TPredComp Cmp, TIntV &SelectedRows, PTable &SelectedTable, TBool Remove=true, TBool Table=true) |
Selects rows where the value of Col matches given primitive Val . More... | |
template<class T > | |
void | SelectAtomicConst (const TStr &Col, const T &Val, TPredComp Cmp) |
template<class T > | |
void | SelectAtomicConst (const TStr &Col, const T &Val, TPredComp Cmp, PTable &SelectedTable) |
template<class T > | |
void | ClassifyAtomicConst (const TStr &Col, const T &Val, TPredComp Cmp, const TStr &LabelName, const TInt &PositiveLabel=1, const TInt &NegativeLabel=0) |
void | SelectAtomicIntConst (const TStr &Col, const TInt &Val, TPredComp Cmp) |
void | SelectAtomicIntConst (const TStr &Col, const TInt &Val, TPredComp Cmp, PTable &SelectedTable) |
void | SelectAtomicStrConst (const TStr &Col, const TStr &Val, TPredComp Cmp) |
void | SelectAtomicStrConst (const TStr &Col, const TStr &Val, TPredComp Cmp, PTable &SelectedTable) |
void | SelectAtomicFltConst (const TStr &Col, const TFlt &Val, TPredComp Cmp) |
void | SelectAtomicFltConst (const TStr &Col, const TFlt &Val, TPredComp Cmp, PTable &SelectedTable) |
void | Group (const TStrV &GroupBy, const TStr &GroupColName, TBool Ordered=true, TBool UsePhysicalIds=true) |
Groups rows depending on values of GroupBy columns. More... | |
void | Count (const TStr &CountColName, const TStr &Col) |
Counts number of unique elements. More... | |
void | Order (const TStrV &OrderBy, TStr OrderColName="", TBool ResetRankByMSC=false, TBool Asc=true) |
Orders the rows according to the values in columns of OrderBy (in descending lexicographic order). More... | |
void | Aggregate (const TStrV &GroupByAttrs, TAttrAggr AggOp, const TStr &ValAttr, const TStr &ResAttr, TBool Ordered=true) |
Aggregates values of ValAttr after grouping with respect to GroupByAttrs. Result are stored as new attribute ResAttr. More... | |
void | AggregateCols (const TStrV &AggrAttrs, TAttrAggr AggOp, const TStr &ResAttr) |
Aggregates attributes in AggrAttrs across columns. More... | |
TVec< PTable > | SpliceByGroup (const TStrV &GroupByAttrs, TBool Ordered=true) |
Splices table into subtables according to a grouping statement. More... | |
PTable | Join (const TStr &Col1, const TTable &Table, const TStr &Col2) |
Performs equijoin. More... | |
PTable | Join (const TStr &Col1, const PTable &Table, const TStr &Col2) |
PTable | ThresholdJoin (const TStr &KeyCol1, const TStr &JoinCol1, const TTable &Table, const TStr &KeyCol2, const TStr &JoinCol2, TInt Threshold, TBool PerJoinKey=false) |
PTable | SelfJoin (const TStr &Col) |
Joins table with itself, on values of Col . More... | |
PTable | SelfSimJoin (const TStrV &Cols, const TStr &DistanceColName, const TSimType &SimType, const TFlt &Threshold) |
PTable | SelfSimJoinPerGroup (const TStr &GroupAttr, const TStr &SimCol, const TStr &DistanceColName, const TSimType &SimType, const TFlt &Threshold) |
Performs join if the distance between two rows is less than the specified threshold. More... | |
PTable | SelfSimJoinPerGroup (const TStrV &GroupBy, const TStr &SimCol, const TStr &DistanceColName, const TSimType &SimType, const TFlt &Threshold) |
Performs join if the distance between two rows is less than the specified threshold. More... | |
PTable | SimJoin (const TStrV &Cols1, const TTable &Table, const TStrV &Cols2, const TStr &DistanceColName, const TSimType &SimType, const TFlt &Threshold) |
Performs join if the distance between two rows is less than the specified threshold. More... | |
void | SelectFirstNRows (const TInt &N) |
Selects first N rows from the table. More... | |
void | Defrag () |
Releases memory of deleted rows, and defrags. More... | |
void | StoreIntCol (const TStr &ColName, const TIntV &ColVals) |
Adds entire int column to table. More... | |
void | StoreFltCol (const TStr &ColName, const TFltV &ColVals) |
Adds entire flt column to table. More... | |
void | StoreStrCol (const TStr &ColName, const TStrV &ColVals) |
Adds entire str column to table. More... | |
void | UpdateFltFromTable (const TStr &KeyAttr, const TStr &UpdateAttr, const TTable &Table, const TStr &FKeyAttr, const TStr &ReadAttr, TFlt DefaultFltVal=0.0) |
void | UpdateFltFromTableMP (const TStr &KeyAttr, const TStr &UpdateAttr, const TTable &Table, const TStr &FKeyAttr, const TStr &ReadAttr, TFlt DefaultFltVal=0.0) |
void | SetFltColToConstMP (TInt UpdateColIdx, TFlt DefaultFltVal) |
PTable | Union (const TTable &Table) |
Returns union of this table with given Table . More... | |
PTable | Union (const PTable &Table) |
PTable | UnionAll (const TTable &Table) |
Returns union of this table with given Table , preserving duplicates. More... | |
PTable | UnionAll (const PTable &Table) |
void | UnionAllInPlace (const TTable &Table) |
Same as TTable::ConcatTable. More... | |
void | UnionAllInPlace (const PTable &Table) |
PTable | Intersection (const TTable &Table) |
Returns intersection of this table with given Table . More... | |
PTable | Intersection (const PTable &Table) |
PTable | Minus (TTable &Table) |
Returns table with rows that are present in this table but not in given Table . More... | |
PTable | Minus (const PTable &Table) |
PTable | Project (const TStrV &ProjectCols) |
Returns table with only the columns in ProjectCols . More... | |
void | ProjectInPlace (const TStrV &ProjectCols) |
Keeps only the columns specified in ProjectCols . More... | |
void | ColGenericOp (const TStr &Attr1, const TStr &Attr2, const TStr &ResAttr, TArithOp op) |
Performs columnwise arithmetic operation. More... | |
void | ColGenericOpMP (TInt ArgColIdx1, TInt ArgColIdx2, TAttrType ArgType1, TAttrType ArgType2, TInt ResColIdx, TArithOp op) |
void | ColAdd (const TStr &Attr1, const TStr &Attr2, const TStr &ResultAttrName="") |
Performs columnwise addition. See TTable::ColGenericOp. More... | |
void | ColSub (const TStr &Attr1, const TStr &Attr2, const TStr &ResultAttrName="") |
Performs columnwise subtraction. See TTable::ColGenericOp. More... | |
void | ColMul (const TStr &Attr1, const TStr &Attr2, const TStr &ResultAttrName="") |
Performs columnwise multiplication. See TTable::ColGenericOp. More... | |
void | ColDiv (const TStr &Attr1, const TStr &Attr2, const TStr &ResultAttrName="") |
Performs columnwise division. See TTable::ColGenericOp. More... | |
void | ColMod (const TStr &Attr1, const TStr &Attr2, const TStr &ResultAttrName="") |
Performs columnwise modulus. See TTable::ColGenericOp. More... | |
void | ColMin (const TStr &Attr1, const TStr &Attr2, const TStr &ResultAttrName="") |
Performs min of two columns. See TTable::ColGenericOp. More... | |
void | ColMax (const TStr &Attr1, const TStr &Attr2, const TStr &ResultAttrName="") |
Performs max of two columns. See TTable::ColGenericOp. More... | |
void | ColGenericOp (const TStr &Attr1, TTable &Table, const TStr &Attr2, const TStr &ResAttr, TArithOp op, TBool AddToFirstTable) |
Performs columnwise arithmetic operation with column of given table. More... | |
void | ColAdd (const TStr &Attr1, TTable &Table, const TStr &Attr2, const TStr &ResAttr="", TBool AddToFirstTable=true) |
Performs columnwise addition with column of given table. More... | |
void | ColSub (const TStr &Attr1, TTable &Table, const TStr &Attr2, const TStr &ResAttr="", TBool AddToFirstTable=true) |
Performs columnwise subtraction with column of given table. More... | |
void | ColMul (const TStr &Attr1, TTable &Table, const TStr &Attr2, const TStr &ResAttr="", TBool AddToFirstTable=true) |
Performs columnwise multiplication with column of given table. More... | |
void | ColDiv (const TStr &Attr1, TTable &Table, const TStr &Attr2, const TStr &ResAttr="", TBool AddToFirstTable=true) |
Performs columnwise division with column of given table. More... | |
void | ColMod (const TStr &Attr1, TTable &Table, const TStr &Attr2, const TStr &ResAttr="", TBool AddToFirstTable=true) |
Performs columnwise modulus with column of given table. More... | |
void | ColGenericOp (const TStr &Attr1, const TFlt &Num, const TStr &ResAttr, TArithOp op, const TBool floatCast) |
Performs arithmetic op of column values and given Num . More... | |
void | ColGenericOpMP (const TInt &ColIdx1, const TInt &ColIdx2, TAttrType ArgType, const TFlt &Num, TArithOp op, TBool ShouldCast) |
void | ColAdd (const TStr &Attr1, const TFlt &Num, const TStr &ResultAttrName="", const TBool floatCast=false) |
Performs addition of column values and given Num . More... | |
void | ColSub (const TStr &Attr1, const TFlt &Num, const TStr &ResultAttrName="", const TBool floatCast=false) |
Performs subtraction of column values and given Num . More... | |
void | ColMul (const TStr &Attr1, const TFlt &Num, const TStr &ResultAttrName="", const TBool floatCast=false) |
Performs multiplication of column values and given Num . More... | |
void | ColDiv (const TStr &Attr1, const TFlt &Num, const TStr &ResultAttrName="", const TBool floatCast=false) |
Performs division of column values and given Num . More... | |
void | ColMod (const TStr &Attr1, const TFlt &Num, const TStr &ResultAttrName="", const TBool floatCast=false) |
Performs modulus of column values and given Num . More... | |
void | ColConcat (const TStr &Attr1, const TStr &Attr2, const TStr &Sep="", const TStr &ResAttr="") |
Concatenates two string columns. More... | |
void | ColConcat (const TStr &Attr1, TTable &Table, const TStr &Attr2, const TStr &Sep="", const TStr &ResAttr="", TBool AddToFirstTable=true) |
Concatenates string column with column of given table. More... | |
void | ColConcatConst (const TStr &Attr1, const TStr &Val, const TStr &Sep="", const TStr &ResAttr="") |
Concatenates column values with given string value. More... | |
void | ReadIntCol (const TStr &ColName, TIntV &Result) const |
Reads values of entire int column into Result . More... | |
void | ReadFltCol (const TStr &ColName, TFltV &Result) const |
Reads values of entire float column into Result . More... | |
void | ReadStrCol (const TStr &ColName, TStrV &Result) const |
Reads values of entire string column into Result . More... | |
void | InitIds () |
Adds explicit row ids, initialize hash set mapping ids to physical rows. More... | |
PTable | IsNextK (const TStr &OrderCol, TInt K, const TStr &GroupBy, const TStr &RankColName="") |
Distance based filter. More... | |
void | PrintSize () |
void | PrintContextSize () |
TSize | GetMemUsedKB () |
Returns approximate memory used by table in [KB]. More... | |
TSize | GetContextMemUsedKB () |
Returns approximate memory used by table context in [KB]. More... | |
Static Public Member Functions | |
static void | SetMP (TInt Value) |
static TInt | GetMP () |
static TStr | NormalizeColName (const TStr &ColName) |
Adds suffix to column name if it doesn't exist. More... | |
static TStrV | NormalizeColNameV (const TStrV &Cols) |
Adds suffix to column name if it doesn't exist. More... | |
static PTable | New () |
static PTable | New (TTableContext *Context) |
static PTable | New (const Schema &S, TTableContext *Context) |
static PTable | New (const THash< TInt, TInt > &H, const TStr &Col1, const TStr &Col2, TTableContext *Context, const TBool IsStrKeys=false) |
Returns pointer to a table constructed from given int->int hash. More... | |
static PTable | New (const THash< TInt, TFlt > &H, const TStr &Col1, const TStr &Col2, TTableContext *Context, const TBool IsStrKeys=false) |
Returns pointer to a table constructed from given int->float hash. More... | |
static PTable | New (const PTable Table) |
Returns pointer to a new table created from given Table . More... | |
static void | GetSchema (const TStr &InFNm, Schema &S, const char &Separator= '\t') |
Returns pointer to a new table created from given Table , with name set to TableName . More... | |
static PTable | LoadSS (const Schema &S, const TStr &InFNm, TTableContext *Context, const char &Separator= '\t', TBool HasTitleLine=false) |
Loads table from spread sheet (TSV, CSV, etc). Note: HasTitleLine = true is not supported. Please comment title lines instead. More... | |
static PTable | LoadSS (const Schema &S, const TStr &InFNm, TTableContext *Context, const TIntV &RelevantCols, const char &Separator= '\t', TBool HasTitleLine=false) |
Loads table from spread sheet - but only load the columns specified by RelevantCols. Note: HasTitleLine = true is not supported. Please comment title lines instead. More... | |
static PTable | Load (TSIn &SIn, TTableContext *Context) |
Loads table from a binary format. More... | |
static PTable | LoadShM (TShMIn &ShMIn, TTableContext *Context) |
Static constructor to load table from memory. More... | |
static PTable | TableFromHashMap (const THash< TInt, TInt > &H, const TStr &Col1, const TStr &Col2, TTableContext *Context, const TBool IsStrKeys=false) |
Builds table from hash table of int->int. More... | |
static PTable | TableFromHashMap (const THash< TInt, TFlt > &H, const TStr &Col1, const TStr &Col2, TTableContext *Context, const TBool IsStrKeys=false) |
Builds table from hash table of int->float. More... | |
static PTable | GetNodeTable (const PNEANet &Network, TTableContext *Context) |
Extracts node TTable from PNEANet. More... | |
static PTable | GetEdgeTable (const PNEANet &Network, TTableContext *Context) |
Extracts edge TTable from PNEANet. More... | |
static PTable | GetEdgeTablePN (const PNGraphMP &Network, TTableContext *Context) |
Extracts edge TTable from parallel graph PNGraphMP. More... | |
static PTable | GetFltNodePropertyTable (const PNEANet &Network, const TIntFltH &Property, const TStr &NodeAttrName, const TAttrType &NodeAttrType, const TStr &PropertyAttrName, TTableContext *Context) |
Extracts node and edge property TTables from THash. More... | |
Protected Member Functions | |
void | InvalidatePhysicalGroupings () |
void | InvalidateAffectedGroupings (const TStr &Attr) |
void | IncrementNext () |
Increments the next vector and set last, NumRows and NumValidRows. More... | |
void | ClassifyAux (const TIntV &SelectedRows, const TStr &LabelName, const TInt &PositiveLabel=1, const TInt &NegativeLabel=0) |
Adds a label attribute with positive labels on selected rows and negative labels on the rest. More... | |
const char * | GetContextKey (TInt Val) const |
Gets the Key of the Context StringVals pool. Used by ToGraph method in conv.cpp. More... | |
TStr | GetStrValIdx (TInt ColIdx, TInt RowIdx) const |
Gets the value in column with id ColIdx at row RowIdx . More... | |
void | AddStrVal (const TInt &ColIdx, const TStr &Val) |
Adds Val in column with id ColIdx . More... | |
void | AddStrVal (const TStr &Col, const TStr &Val) |
Adds Val in column with name Col . More... | |
TStr | GetIdColName () const |
Gets name of the id column of this table. More... | |
TStr | GetSchemaColName (TInt Idx) const |
Gets name of the column with index Idx in the schema. More... | |
TAttrType | GetSchemaColType (TInt Idx) const |
Gets type of the column with index Idx in the schema. More... | |
void | AddSchemaCol (const TStr &ColName, TAttrType ColType) |
Adds column with name ColName and type ColType to the schema. More... | |
TBool | IsColName (const TStr &ColName) const |
void | AddColType (const TStr &ColName, TPair< TAttrType, TInt > ColType) |
Adds column with name ColName and type ColType to the ColTypeMap. More... | |
void | AddColType (const TStr &ColName, TAttrType ColType, TInt Index) |
Adds column with name ColName and type ColType to the ColTypeMap. More... | |
void | DelColType (const TStr &ColName) |
Adds column with name ColName and type ColType to the ColTypeMap. More... | |
TPair< TAttrType, TInt > | GetColTypeMap (const TStr &ColName) const |
Gets column type and index of ColName . More... | |
TStr | RenumberColName (const TStr &ColName) const |
Returns a re-numbered column name based on number of existing columns with conflicting names. More... | |
TStr | DenormalizeColName (const TStr &ColName) const |
Removes suffix to column name if exists. More... | |
Schema | DenormalizeSchema () const |
Removes suffix to column names in the Schema. More... | |
TBool | IsAttr (const TStr &Attr) |
Checks if Attr is an attribute of this table schema. More... | |
void | AddTable (const TTable &T) |
Adds all the rows of the input table. Allows duplicate rows (not a union). More... | |
void | ConcatTable (const PTable &T) |
Appends all rows of T to this table, and recalculate indices. More... | |
void | AddRowI (const TRowIterator &RI) |
Adds row corresponding to RI . More... | |
void | AddRowV (const TIntV &IntVals, const TFltV &FltVals, const TStrV &StrVals) |
Adds row with values corresponding to the given vectors by type. More... | |
void | AddGraphAttribute (const TStr &Attr, TBool IsEdge, TBool IsSrc, TBool IsDst) |
Adds names of columns to be used as graph attributes. More... | |
void | AddGraphAttributeV (TStrV &Attrs, TBool IsEdge, TBool IsSrc, TBool IsDst) |
Adds vector of names of columns to be used as graph attributes. More... | |
void | CheckAndAddIntNode (PNEANet Graph, THashSet< TInt > &NodeVals, TInt NodeId) |
Checks if given NodeId is seen earlier; if not, add it to Graph and hashmap NodeVals . More... | |
template<class T > | |
TInt | CheckAndAddFltNode (T Graph, THash< TFlt, TInt > &NodeVals, TFlt FNodeVal) |
Checks if given NodeVal is seen earlier; if not, add it to Graph and hashmap NodeVals . More... | |
void | AddEdgeAttributes (PNEANet &Graph, int RowId) |
Adds attributes of edge corresponding to RowId to the Graph . More... | |
void | AddNodeAttributes (TInt NId, TStrV NodeAttrV, TInt RowId, THash< TInt, TStrIntVH > &NodeIntAttrs, THash< TInt, TStrFltVH > &NodeFltAttrs, THash< TInt, TStrStrVH > &NodeStrAttrs) |
Takes as parameters, and updates, maps NodeXAttrs: Node Id –> (attribute name –> Vector of attribute values). More... | |
PNEANet | BuildGraph (const TIntV &RowIds, TAttrAggr AggrPolicy) |
Makes a single pass over the rows in the given row id set, and creates nodes, edges, assigns node and edge attributes. More... | |
void | InitRowIdBuckets (int NumBuckets) |
Initializes the RowIdBuckets vector which will be used for the graph sequence creation. More... | |
void | FillBucketsByWindow (TStr SplitAttr, TInt JumpSize, TInt WindowSize, TInt StartVal, TInt EndVal) |
Fills RowIdBuckets with sets of row ids. More... | |
void | FillBucketsByInterval (TStr SplitAttr, TIntPrV SplitIntervals) |
Fills RowIdBuckets with sets of row ids. More... | |
TVec< PNEANet > | GetGraphsFromSequence (TAttrAggr AggrPolicy) |
Returns a sequence of graphs. More... | |
PNEANet | GetFirstGraphFromSequence (TAttrAggr AggrPolicy) |
Returns the first graph of the sequence. More... | |
PNEANet | GetNextGraphFromSequence () |
Returns the next graph in sequence corresponding to RowIdBuckets. More... | |
template<class T > | |
T | AggregateVector (TVec< T > &V, TAttrAggr Policy) |
Aggregates vector into a single scalar value according to a policy. More... | |
void | GroupingSanityCheck (const TStr &GroupBy, const TAttrType &AttrType) const |
Checks if grouping key exists and matches given attr type. More... | |
template<class T > | |
void | GroupByIntCol (const TStr &GroupBy, T &Grouping, const TIntV &IndexSet, TBool All, TBool UsePhysicalIds=true) const |
Groups/hashes by a single column with integer values. More... | |
template<class T > | |
void | GroupByFltCol (const TStr &GroupBy, T &Grouping, const TIntV &IndexSet, TBool All, TBool UsePhysicalIds=true) const |
Groups/hashes by a single column with float values. Returns hash table with grouping. More... | |
template<class T > | |
void | GroupByStrCol (const TStr &GroupBy, T &Grouping, const TIntV &IndexSet, TBool All, TBool UsePhysicalIds=true) const |
Groups/hashes by a single column with string values. Returns hash table with grouping. More... | |
template<class T > | |
void | UpdateGrouping (THash< T, TIntV > &Grouping, T Key, TInt Val) const |
Template for utility function to update a grouping hash map. More... | |
template<class T > | |
void | UpdateGrouping (THashMP< T, TIntV > &Grouping, T Key, TInt Val) const |
Template for utility function to update a parallel grouping hash map. More... | |
void | PrintGrouping (const THash< TGroupKey, TIntV > &Grouping) const |
TInt | CompareRows (TInt R1, TInt R2, const TAttrType &CompareByType, const TInt &CompareByIndex, TBool Asc=true) |
Returns positive value if R1 is bigger, negative value if R2 is bigger, and 0 if they are equal (strcmp semantics). More... | |
TInt | CompareRows (TInt R1, TInt R2, const TVec< TAttrType > &CompareByTypes, const TIntV &CompareByIndices, TBool Asc=true) |
Returns positive value if R1 is bigger, negative value if R2 is bigger, and 0 if they are equal (strcmp semantics). More... | |
TInt | GetPivot (TIntV &V, TInt StartIdx, TInt EndIdx, const TVec< TAttrType > &SortByTypes, const TIntV &SortByIndices, TBool Asc) |
Gets pivot element for QSort. More... | |
TInt | Partition (TIntV &V, TInt StartIdx, TInt EndIdx, const TVec< TAttrType > &SortByTypes, const TIntV &SortByIndices, TBool Asc) |
Partitions vector for QSort. More... | |
void | ISort (TIntV &V, TInt StartIdx, TInt EndIdx, const TVec< TAttrType > &SortByTypes, const TIntV &SortByIndices, TBool Asc=true) |
Performs insertion sort on given vector V . More... | |
void | QSort (TIntV &V, TInt StartIdx, TInt EndIdx, const TVec< TAttrType > &SortByTypes, const TIntV &SortByIndices, TBool Asc=true) |
Performs QSort on given vector V . More... | |
void | Merge (TIntV &V, TInt Idx1, TInt Idx2, TInt Idx3, const TVec< TAttrType > &SortByTypes, const TIntV &SortByIndices, TBool Asc=true) |
Helper function for parallel QSort. More... | |
void | QSortPar (TIntV &V, const TVec< TAttrType > &SortByTypes, const TIntV &SortByIndices, TBool Asc=true) |
Performs QSort in parallel on given vector V . More... | |
bool | IsRowValid (TInt RowIdx) const |
Checks if RowIdx corresponds to a valid (i.e. not deleted) row. More... | |
TInt | GetLastValidRowIdx () |
Gets the id of the last valid row of the table. More... | |
void | RemoveFirstRow () |
Removes first valid row of the table. More... | |
void | RemoveRow (TInt RowIdx, TInt PrevRowIdx) |
Removes row with id RowIdx . More... | |
void | KeepSortedRows (const TIntV &KeepV) |
Removes all rows that are not mentioned in the SORTED vector KeepV . More... | |
void | SetFirstValidRow () |
Sets the first valid row of the TTable. More... | |
PTable | InitializeJointTable (const TTable &Table) |
Initializes an empty table for the join of this table with the given table. More... | |
void | AddJointRow (const TTable &T1, const TTable &T2, TInt RowIdx1, TInt RowIdx2) |
Adds joint row T1[RowIdx1]<=>T2[RowIdx2]. More... | |
void | ThresholdJoinInputCorrectness (const TStr &KeyCol1, const TStr &JoinCol1, const TTable &Table, const TStr &KeyCol2, const TStr &JoinCol2) |
void | ThresholdJoinCountCollisions (const TTable &TB, const TTable &TS, const TIntIntVH &T, TInt JoinColIdxB, TInt KeyColIdxB, TInt KeyColIdxS, THash< TIntPr, TIntTr > &Counters, TBool ThisIsSmaller, TAttrType JoinColType, TAttrType KeyType) |
PTable | ThresholdJoinOutputTable (const THash< TIntPr, TIntTr > &Counters, TInt Threshold, const TTable &Table) |
void | ThresholdJoinCountPerJoinKeyCollisions (const TTable &TB, const TTable &TS, const TIntIntVH &T, TInt JoinColIdxB, TInt KeyColIdxB, TInt KeyColIdxS, THash< TIntTr, TIntTr > &Counters, TBool ThisIsSmaller, TAttrType JoinColType, TAttrType KeyType) |
PTable | ThresholdJoinPerJoinKeyOutputTable (const THash< TIntTr, TIntTr > &Counters, TInt Threshold, const TTable &Table) |
void | ResizeTable (int RowCount) |
Resizes the table to hold RowCount rows. More... | |
int | GetEmptyRowsStart (int NewRows) |
Gets the start index to a chunk of empty rows of size NewRows . More... | |
void | AddSelectedRows (const TTable &Table, const TIntV &RowIDs) |
Adds rows from Table that correspond to ids in RowIDs . More... | |
void | AddNRows (int NewRows, const TVec< TIntV > &IntColsP, const TVec< TFltV > &FltColsP, const TVec< TIntV > &StrColMapsP) |
Adds NewRows rows from the given vectors for each column type. More... | |
void | AddNJointRowsMP (const TTable &T1, const TTable &T2, const TVec< TIntPrV > &JointRowIDSet) |
Adds rows from T1 and T2 to this table in a parallel manner. Used by Join. More... | |
void | UpdateTableForNewRow () |
Updates table state after adding one or more rows. More... | |
void | GroupAux (const TStrV &GroupBy, THash< TGroupKey, TPair< TInt, TIntV > > &Grouping, TBool Ordered, const TStr &GroupColName, TBool KeepUnique, TIntV &UniqueVec, TBool UsePhysicalIds=true) |
Helper function for grouping. More... | |
void | StoreGroupCol (const TStr &GroupColName, const TVec< TPair< TInt, TInt > > &GroupAndRowIds) |
Parallel helper function for grouping. - we currently don't support such parallel grouping by complex keys. More... | |
void | Reindex () |
Reinitializes row ids. More... | |
void | AddIdColumn (const TStr &IdColName) |
Adds a column of explicit integer identifiers to the rows. More... | |
void | GetCollidingRows (const TTable &T, THashSet< TInt > &Collisions) |
Gets set of row ids of rows common with table T . More... | |
Static Protected Member Functions | |
static void | LoadSSPar (PTable &NewTable, const Schema &S, const TStr &InFNm, const TIntV &RelevantCols, const char &Separator, TBool HasTitleLine) |
Parallelly loads data from input file at InFNm into NewTable. Only work when NewTable has no string columns. More... | |
static void | LoadSSSeq (PTable &NewTable, const Schema &S, const TStr &InFNm, const TIntV &RelevantCols, const char &Separator, TBool HasTitleLine) |
Sequentially loads data from input file at InFNm into NewTable. More... | |
static TInt | CompareKeyVal (const TInt &K1, const TInt &V1, const TInt &K2, const TInt &V2) |
static TInt | CheckSortedKeyVal (TIntV &Key, TIntV &Val, TInt Start, TInt End) |
static void | ISortKeyVal (TIntV &Key, TIntV &Val, TInt Start, TInt End) |
static TInt | GetPivotKeyVal (TIntV &Key, TIntV &Val, TInt Start, TInt End) |
static TInt | PartitionKeyVal (TIntV &Key, TIntV &Val, TInt Start, TInt End) |
static void | QSortKeyVal (TIntV &Key, TIntV &Val, TInt Start, TInt End) |
Protected Attributes | |
TTableContext * | Context |
Execution Context. More... | |
Schema | Sch |
Table Schema. More... | |
TCRef | CRef |
TInt | NumRows |
Number of rows in the table (valid and invalid). More... | |
TInt | NumValidRows |
Number of valid rows in the table (i.e. rows that were not logically removed). More... | |
TInt | FirstValidRow |
Physical index of first valid row. More... | |
TInt | LastValidRow |
Physical index of last valid row. More... | |
TIntV | Next |
A vector describing the logical order of the rows. More... | |
TVec< TIntV > | IntCols |
Next [i] is the successor of row i . Table iterators follow the order dictated by Next More... | |
TVec< TFltV > | FltCols |
Data columns of floating point attributes. More... | |
TVec< TIntV > | StrColMaps |
Data columns of integer mappings of string attributes. More... | |
THash< TStr, TPair< TAttrType, TInt > > | ColTypeMap |
TStr | IdColName |
A mapping from column name to column type and column index among columns of the same type. More... | |
TIntIntH | RowIdMap |
Mapping of permanent row ids to physical id. More... | |
THash< TStr, THash< TInt, TIntV > > | IntColIndexes |
Indexes for Int Columns. More... | |
THash< TStr, THash< TInt, TIntV > > | StrMapColIndexes |
Indexes for String Columns. More... | |
THash< TStr, THash< TFlt, TIntV > > | FltColIndexes |
Indexes for Float Columns. More... | |
THash< TStr, GroupStmt > | GroupStmtNames |
Maps user-given grouping statement names to their group-by attributes. More... | |
THash< GroupStmt, THash< TInt, TGroupKey > > | GroupIDMapping |
Maps grouping statements to their (group id –> group-by key) mapping. More... | |
THash< GroupStmt, THash< TGroupKey, TIntV > > | GroupMapping |
Maps grouping statements to their (group-by key –> group id) mapping. More... | |
TStr | SrcCol |
Column (attribute) to serve as src nodes when constructing the graph. More... | |
TStr | DstCol |
Column (attribute) to serve as dst nodes when constructing the graph. More... | |
TStrV | EdgeAttrV |
List of columns (attributes) to serve as edge attributes. More... | |
TStrV | SrcNodeAttrV |
List of columns (attributes) to serve as source node attributes. More... | |
TStrV | DstNodeAttrV |
List of columns (attributes) to serve as destination node attributes. More... | |
TStrTrV | CommonNodeAttrs |
List of attribute pairs with values common to source and destination and their common given name. More... | |
TVec< TIntV > | RowIdBuckets |
Partitioning of row ids into buckets corresponding to different graph objects when generating a sequence of graphs. More... | |
TInt | CurrBucket |
Current row id bucket - used when generating a sequence of graphs using an iterator. More... | |
TAttrAggr | AggrPolicy |
Aggregation policy used for solving conflicts between different values of an attribute of the same node. More... | |
TInt | IsNextDirty |
Flag to signify whether the rows are stored in logical sequence or reordered. Used for optimizing GetPartitionRanges. More... | |
Static Protected Attributes | |
static const TInt | Last = -1 |
Special value for Next vector entry - last row in table. More... | |
static const TInt | Invalid = -2 |
Special value for Next vector entry - logically removed row. More... | |
static TInt | UseMP = 1 |
Global switch for choosing multi-threaded versions of TTable functions. More... | |
Private Member Functions | |
void | GenerateColTypeMap (THash< TStr, TPair< TInt, TInt > > &ColTypeIntMap) |
void | LoadTableShM (TShMIn &ShMIn, TTableContext *ContextTable) |
Friends | |
class | TPt< TTable > |
class | TRowIterator |
class | TRowIteratorWithRemove |
template<class PGraph > | |
PGraph | TSnap::ToGraph (PTable Table, const TStr &SrcCol, const TStr &DstCol, TAttrAggr AggrPolicy) |
template<class PGraph > | |
PGraph | TSnap::ToNetwork (PTable Table, const TStr &SrcCol, const TStr &DstCol, TStrV &SrcAttrs, TStrV &DstAttrs, TStrV &EdgeAttrs, TAttrAggr AggrPolicy) |
template<class PGraph > | |
PGraph | TSnap::ToNetwork (PTable Table, const TStr &SrcCol, const TStr &DstCol, TAttrAggr AggrPolicy) |
template<class PGraph > | |
PGraph | TSnap::ToNetwork (PTable Table, const TStr &SrcCol, const TStr &DstCol, TStrV &EdgeAttrV, TAttrAggr AggrPolicy) |
template<class PGraph > | |
PGraph | TSnap::ToNetwork (PTable Table, const TStr &SrcCol, const TStr &DstCol, TStrV &EdgeAttrV, PTable NodeTable, const TStr &NodeCol, TStrV &NodeAttrV, TAttrAggr AggrPolicy) |
int | TSnap::LoadCrossNet (TCrossNet &Graph, PTable Table, const TStr &SrcCol, const TStr &DstCol, TStrV &EdgeAttrV) |
int | TSnap::LoadMode (TModeNet &Graph, PTable Table, const TStr &NCol, TStrV &NodeAttrV) |
template<class PGraphMP > | |
PGraphMP | TSnap::ToGraphMP (PTable Table, const TStr &SrcCol, const TStr &DstCol) |
template<class PGraphMP > | |
PGraphMP | TSnap::ToGraphMP3 (PTable Table, const TStr &SrcCol, const TStr &DstCol) |
template<class PGraphMP > | |
PGraphMP | TSnap::ToNetworkMP (PTable Table, const TStr &SrcCol, const TStr &DstCol, TStrV &SrcAttrs, TStrV &DstAttrs, TStrV &EdgeAttrs, TAttrAggr AggrPolicy) |
template<class PGraphMP > | |
PGraphMP | TSnap::ToNetworkMP2 (PTable Table, const TStr &SrcCol, const TStr &DstCol, TStrV &SrcAttrs, TStrV &DstAttrs, TStrV &EdgeAttrs, TAttrAggr AggrPolicy) |
template<class PGraphMP > | |
PGraphMP | TSnap::ToNetworkMP (PTable Table, const TStr &SrcCol, const TStr &DstCol, TStrV &EdgeAttrV, TAttrAggr AggrPolicy) |
template<class PGraphMP > | |
PGraphMP | TSnap::ToNetworkMP (PTable Table, const TStr &SrcCol, const TStr &DstCol, TAttrAggr AggrPolicy) |
template<class PGraphMP > | |
PGraphMP | TSnap::ToNetworkMP (PTable Table, const TStr &SrcCol, const TStr &DstCol, TStrV &EdgeAttrV, PTable NodeTable, const TStr &NodeCol, TStrV &NodeAttrV, TAttrAggr AggrPolicy) |
TTable::TTable | ( | ) |
TTable::TTable | ( | TTableContext * | Context | ) |
Definition at line 305 of file table.cpp.
TTable::TTable | ( | const Schema & | S, |
TTableContext * | Context | ||
) |
Definition at line 308 of file table.cpp.
References AddColType(), AddSchemaCol(), atFlt, atInt, atStr, FltCols, IntCols, TVec< TVal, TSizeTy >::Len(), and StrColMaps.
TTable::TTable | ( | TSIn & | SIn, |
TTableContext * | Context | ||
) |
Definition at line 378 of file table.cpp.
References GenerateColTypeMap().
TTable::TTable | ( | const THash< TInt, TInt > & | H, |
const TStr & | Col1, | ||
const TStr & | Col2, | ||
TTableContext * | Context, | ||
const TBool | IsStrKeys = false |
||
) |
Constructor to build table out of a hash table of int->int.
Definition at line 385 of file table.cpp.
References AddColType(), AddSchemaCol(), atInt, atStr, THash< TKey, TDat, THashFunc >::GetDatV(), THash< TKey, TDat, THashFunc >::GetKeyV(), InitIds(), IntCols, IsNextDirty, Last, Next, NumRows, and StrColMaps.
TTable::TTable | ( | const THash< TInt, TFlt > & | H, |
const TStr & | Col1, | ||
const TStr & | Col2, | ||
TTableContext * | Context, | ||
const TBool | IsStrKeys = false |
||
) |
Constructor to build table out of a hash table of int->float.
Definition at line 412 of file table.cpp.
References AddColType(), AddSchemaCol(), atFlt, atInt, atStr, FltCols, THash< TKey, TDat, THashFunc >::GetDatV(), THash< TKey, TDat, THashFunc >::GetKeyV(), InitIds(), IntCols, IsNextDirty, Last, Next, NumRows, and StrColMaps.
|
inline |
Copy constructor.
Definition at line 919 of file table.h.
Definition at line 438 of file table.cpp.
References AddSelectedRows(), ColTypeMap, FirstValidRow, FltCols, InitIds(), IntCols, IsNextDirty, LastValidRow, TVec< TVal, TSizeTy >::Len(), NumRows, NumValidRows, and StrColMaps.
Adds column with name ColName
and type ColType
to the ColTypeMap.
Definition at line 651 of file table.h.
References THash< TKey, TDat, THashFunc >::AddDat(), and NormalizeColName().
Referenced by AddColType(), AddFltCol(), AddIdColumn(), AddIntCol(), AddStrCol(), ClassifyAux(), GenerateColTypeMap(), Order(), ProjectInPlace(), Rename(), StoreFltCol(), StoreGroupCol(), StoreIntCol(), StoreStrCol(), and TTable().
Adds column with name ColName
and type ColType
to the ColTypeMap.
Definition at line 656 of file table.h.
References AddColType(), and NormalizeColName().
|
inline |
Adds column to be used as dst node atribute of the graph.
Definition at line 1180 of file table.h.
References AddGraphAttribute().
Referenced by AddNodeAttr().
|
inline |
Adds columns to be used as dst node attributes of the graph.
Definition at line 1182 of file table.h.
References AddGraphAttributeV().
|
inline |
Adds column to be used as graph edge attribute.
Definition at line 1172 of file table.h.
References AddGraphAttribute().
|
inline |
Adds columns to be used as graph edge attributes.
Definition at line 1174 of file table.h.
References AddGraphAttributeV().
|
inlineprotected |
Adds attributes of edge corresponding to RowId
to the Graph
.
Definition at line 3395 of file table.cpp.
References atFlt, atInt, atStr, EdgeAttrV, FltCols, GetColIdx(), GetColType(), GetStrValIdx(), IntCols, and TVec< TVal, TSizeTy >::Len().
Referenced by BuildGraph().
void TTable::AddFltCol | ( | const TStr & | ColName | ) |
Adds a float column with name ColName
.
Definition at line 4680 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), AddColType(), AddSchemaCol(), atFlt, FltCols, TVec< TVal, TSizeTy >::Len(), and NumRows.
Referenced by Aggregate(), AggregateCols(), and ColGenericOp().
|
protected |
Adds names of columns to be used as graph attributes.
Definition at line 985 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), DstNodeAttrV, EdgeAttrV, IsColName(), NormalizeColName(), SrcNodeAttrV, and TExcept::Throw().
Referenced by AddDstNodeAttr(), AddEdgeAttr(), and AddSrcNodeAttr().
Adds vector of names of columns to be used as graph attributes.
Definition at line 992 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), DstNodeAttrV, EdgeAttrV, IsColName(), TVec< TVal, TSizeTy >::Len(), NormalizeColName(), SrcNodeAttrV, and TExcept::Throw().
Referenced by AddDstNodeAttr(), AddEdgeAttr(), and AddSrcNodeAttr().
|
protected |
Adds a column of explicit integer identifiers to the rows.
Definition at line 1900 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), AddColType(), THash< TKey, TDat, THashFunc >::AddDat(), AddSchemaCol(), atInt, BegRI(), THash< TKey, TDat, THashFunc >::Clr(), EndRI(), IntCols, TVec< TVal, TSizeTy >::Len(), NumRows, TVec< TVal, TSizeTy >::Reserve(), and RowIdMap.
Referenced by InitIds().
void TTable::AddIntCol | ( | const TStr & | ColName | ) |
Adds an integer column with name ColName
.
Definition at line 4673 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), AddColType(), AddSchemaCol(), atInt, IntCols, TVec< TVal, TSizeTy >::Len(), and NumRows.
Referenced by Aggregate(), AggregateCols(), and ColGenericOp().
|
protected |
Adds joint row T1[RowIdx1]<=>T2[RowIdx2].
Definition at line 1957 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Empty(), FltCols, IntCols, Last, LastValidRow, TVec< TVal, TSizeTy >::Len(), Next, NumRows, NumValidRows, RowIdMap, and StrColMaps.
|
protected |
Adds rows from T1 and T2 to this table in a parallel manner. Used by Join.
Definition at line 4442 of file table.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), Assert, THash< TKey, TDat, THashFunc >::Clr(), FltCols, TPair< TVal1, TVal2 >::GetVal1(), TPair< TVal1, TVal2 >::GetVal2(), IntCols, Last, LastValidRow, TVec< TVal, TSizeTy >::Len(), Next, NumRows, NumValidRows, ResizeTable(), RowIdMap, StrColMaps, and TExcept::Throw().
|
inline |
Handles the common case where src and dst both belong to the same "universe" of entities.
Definition at line 1184 of file table.h.
References AddDstNodeAttr(), and AddSrcNodeAttr().
|
inline |
Handles the common case where src and dst both belong to the same "universe" of entities.
Definition at line 1186 of file table.h.
References AddDstNodeAttr(), and AddSrcNodeAttr().
|
inlineprotected |
Takes as parameters, and updates, maps NodeXAttrs: Node Id –> (attribute name –> Vector of attribute values).
Definition at line 3414 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddKey(), atFlt, atInt, CommonNodeAttrs, FltCols, GetColIdx(), GetColType(), THash< TKey, TDat, THashFunc >::GetDat(), GetStrValIdx(), IntCols, THash< TKey, TDat, THashFunc >::IsKey(), and TVec< TVal, TSizeTy >::Len().
Referenced by BuildGraph().
|
protected |
Adds NewRows
rows from the given vectors for each column type.
Definition at line 4421 of file table.cpp.
References FltCols, GetEmptyRowsStart(), IntCols, TVec< TVal, TSizeTy >::Len(), Next, and StrColMaps.
|
inline |
Adds row with values taken from given TTableRow.
Definition at line 1002 of file table.h.
References AddRowV(), TTableRow::GetFltVals(), TTableRow::GetIntVals(), and TTableRow::GetStrVals().
|
protected |
Adds row corresponding to RI
.
Definition at line 4295 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), atFlt, atInt, atStr, FltCols, GetColIdx(), GetColType(), TRowIterator::GetFltAttr(), TRowIterator::GetIntAttr(), GetSchemaColName(), TRowIterator::GetStrMapByName(), IdColName, IntCols, TVec< TVal, TSizeTy >::Len(), Sch, StrColMaps, and UpdateTableForNewRow().
|
protected |
Adds row with values corresponding to the given vectors by type.
Definition at line 4317 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), AddStrVal(), FltCols, IntCols, TVec< TVal, TSizeTy >::Len(), and UpdateTableForNewRow().
Referenced by AddRow().
Adds column with name ColName
and type ColType
to the schema.
Definition at line 642 of file table.h.
References TVec< TVal, TSizeTy >::Add(), and NormalizeColName().
Referenced by AddFltCol(), AddIdColumn(), AddIntCol(), AddStrCol(), ClassifyAux(), GenerateColTypeMap(), GroupAux(), Order(), StoreFltCol(), StoreIntCol(), StoreStrCol(), and TTable().
Adds rows from Table
that correspond to ids in RowIDs
.
Definition at line 4399 of file table.cpp.
References FltCols, GetEmptyRowsStart(), IntCols, TVec< TVal, TSizeTy >::Len(), Next, and StrColMaps.
Referenced by TTable().
|
inline |
Adds column to be used as src node atribute of the graph.
Definition at line 1176 of file table.h.
References AddGraphAttribute().
Referenced by AddNodeAttr().
|
inline |
Adds columns to be used as src node attributes of the graph.
Definition at line 1178 of file table.h.
References AddGraphAttributeV().
void TTable::AddStrCol | ( | const TStr & | ColName | ) |
Adds a string column with name ColName
.
Definition at line 4687 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), AddColType(), AddSchemaCol(), atStr, TVec< TVal, TSizeTy >::Len(), NumRows, and StrColMaps.
Referenced by ColConcat(), and ColConcatConst().
Adds Val
in column with id ColIdx
.
Definition at line 971 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), TStrHash< TDat, TStringPool, THashFunc >::AddKey(), Context, StrColMaps, and TTableContext::StringVals.
Referenced by AddRowV(), and AddStrVal().
Adds Val
in column with name Col
.
Definition at line 977 of file table.cpp.
References AddStrVal(), atStr, GetColIdx(), GetColType(), and TExcept::Throw().
|
protected |
Adds all the rows of the input table. Allows duplicate rows (not a union).
Definition at line 3975 of file table.cpp.
References TVec< TVal, TSizeTy >::AddV(), atFlt, atInt, atStr, FirstValidRow, FltCols, GetColIdx(), GetColType(), GetSchemaColName(), IdColName, IntCols, Invalid, Last, LastValidRow, TVec< TVal, TSizeTy >::Len(), Next, NumRows, NumValidRows, Sch, StrColMaps, and TExcept::Throw().
Referenced by ConcatTable(), and UnionAllInPlace().
void TTable::Aggregate | ( | const TStrV & | GroupByAttrs, |
TAttrAggr | AggOp, | ||
const TStr & | ValAttr, | ||
const TStr & | ResAttr, | ||
TBool | Ordered = true |
||
) |
Aggregates values of ValAttr after grouping with respect to GroupByAttrs. Result are stored as new attribute ResAttr.
Definition at line 1585 of file table.cpp.
References aaCount, aaMean, TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), AddFltCol(), AddIntCol(), atFlt, atInt, atStr, THashMP< TKey, TDat, THashFunc >::BegI(), THash< TKey, TDat, THashFunc >::BegI(), THashMP< TKey, TDat, THashFunc >::EndI(), THash< TKey, TDat, THashFunc >::EndI(), FltCols, GetColIdx(), GetColType(), THashMP< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKey(), GetMP(), GroupAux(), GroupByFltCol(), GroupByIntCol(), GroupByIntColMP(), GroupByStrCol(), GroupMapping, IdColName, IntCols, IsColName(), THash< TKey, TDat, THashFunc >::Len(), TVec< TVal, TSizeTy >::Len(), NormalizeColNameV(), NumValidRows, and TExcept::Throw().
Referenced by Count().
Aggregates attributes in AggrAttrs across columns.
Definition at line 1750 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), AddFltCol(), AddIntCol(), atFlt, atInt, BegRI(), EndRI(), FltCols, GetColIdx(), GetColTypeMap(), IntCols, TVec< TVal, TSizeTy >::Len(), and TExcept::Throw().
Aggregates vector into a single scalar value according to a policy.
Aggregate vector into a single scalar value according to a policy. Used for choosing an attribute value for a node when this node appears in several records and has conflicting attribute values
Definition at line 1544 of file table.h.
References aaCount, aaFirst, aaLast, aaMax, aaMean, aaMedian, aaMin, aaSum, TVec< TVal, TSizeTy >::Len(), and TVec< TVal, TSizeTy >::Sort().
|
inline |
Gets iterator to the first valid row of the table.
Definition at line 1241 of file table.h.
References TRowIterator.
Referenced by AddIdColumn(), AggregateCols(), ChangeContext(), ColConcat(), ColConcatConst(), ColGenericOp(), Dump(), GetCollidingRows(), GetFltRowIdxByVal(), GetIntRowIdxByVal(), GetStrRowIdxByMap(), GroupAux(), GroupByFltCol(), GroupByIntCol(), GroupByStrCol(), Intersection(), IsNextK(), Join(), Minus(), Order(), ReadFltCol(), ReadIntCol(), ReadStrCol(), Reindex(), RequestIndexFlt(), RequestIndexInt(), RequestIndexStrMap(), SaveSS(), Select(), SelectAtomic(), SelectAtomicConst(), SelectFirstNRows(), SelfSimJoinPerGroup(), SimJoin(), StoreFltCol(), StoreIntCol(), StoreStrCol(), ThresholdJoinCountCollisions(), ThresholdJoinCountPerJoinKeyCollisions(), Union(), and UpdateFltFromTable().
|
inline |
Gets iterator with reomve to the first valid row.
Definition at line 1245 of file table.h.
References TRowIteratorWithRemove.
Referenced by KeepSortedRows(), Select(), SelectAtomic(), and SelectAtomicConst().
Makes a single pass over the rows in the given row id set, and creates nodes, edges, assigns node and edge attributes.
Definition at line 3445 of file table.cpp.
References AddEdgeAttributes(), AddNodeAttributes(), AggrPolicy, Assert, atFlt, atInt, atStr, THash< TKey, TDat, THashFunc >::BegI(), TVec< TVal, TSizeTy >::BegI(), CheckAndAddFltNode(), Context, DstCol, DstNodeAttrV, EdgeAttrV, THash< TKey, TDat, THashFunc >::EndI(), TVec< TVal, TSizeTy >::EndI(), FltCols, GetColIdx(), GetColType(), THash< TKey, TDat, THashFunc >::GetDat(), TStrHash< TDat, TStringPool, THashFunc >::GetKey(), IntCols, THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Len(), TNEANet::New(), SrcCol, SrcNodeAttrV, StrColMaps, and TTableContext::StringVals.
Referenced by GetGraphsFromSequence(), and GetNextGraphFromSequence().
TTableContext * TTable::ChangeContext | ( | TTableContext * | Context | ) |
Changes the current context. Moves all object items to the new context.
Definition at line 921 of file table.cpp.
References TStrHash< TDat, TStringPool, THashFunc >::AddKey(), atStr, BegRI(), Context, EndRI(), GetColIdx(), GetSchemaColName(), GetSchemaColType(), GetStrVal(), GetStrValIdx(), TVec< TVal, TSizeTy >::Len(), Sch, StrColMaps, TTableContext::StringVals, and TInt::Val.
|
protected |
Checks if given NodeVal
is seen earlier; if not, add it to Graph
and hashmap NodeVals
.
Definition at line 1533 of file table.h.
References THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::AddKey(), THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), and THash< TKey, TDat, THashFunc >::Len().
Referenced by BuildGraph().
|
inlineprotected |
Checks if given NodeId
is seen earlier; if not, add it to Graph
and hashmap NodeVals
.
Definition at line 3388 of file table.cpp.
References THashSet< TKey, THashFunc >::AddKey(), and THashSet< TKey, THashFunc >::IsKey().
Definition at line 5310 of file table.cpp.
References CompareKeyVal().
Referenced by QSortKeyVal().
void TTable::Classify | ( | TPredicate & | Predicate, |
const TStr & | LabelName, | ||
const TInt & | PositiveLabel = 1 , |
||
const TInt & | NegativeLabel = 0 |
||
) |
Definition at line 2805 of file table.cpp.
References ClassifyAux(), and Select().
void TTable::ClassifyAtomic | ( | const TStr & | Col1, |
const TStr & | Col2, | ||
TPredComp | Cmp, | ||
const TStr & | LabelName, | ||
const TInt & | PositiveLabel = 1 , |
||
const TInt & | NegativeLabel = 0 |
||
) |
Definition at line 2866 of file table.cpp.
References ClassifyAux(), and SelectAtomic().
|
inline |
Definition at line 1301 of file table.h.
References ClassifyAux(), and SelectAtomicConst().
|
protected |
Adds a label attribute with positive labels on selected rows and negative labels on the rest.
Definition at line 4694 of file table.cpp.
References TVec< TVal, TSizeTy >::Add(), AddColType(), AddSchemaCol(), atInt, IntCols, TVec< TVal, TSizeTy >::Len(), and NumRows.
Referenced by Classify(), ClassifyAtomic(), and ClassifyAtomicConst().
Performs columnwise addition. See TTable::ColGenericOp.
Definition at line 4816 of file table.cpp.
References aoAdd, and ColGenericOp().
void TTable::ColAdd | ( | const TStr & | Attr1, |
TTable & | Table, | ||
const TStr & | Attr2, | ||
const TStr & | ResAttr = "" , |
||
TBool | AddToFirstTable = true |
||
) |
Performs columnwise addition with column of given table.
Definition at line 4949 of file table.cpp.
References aoAdd, and ColGenericOp().
void TTable::ColAdd | ( | const TStr & | Attr1, |
const TFlt & | Num, | ||
const TStr & | ResultAttrName = "" , |
||
const TBool | floatCast = false |
||
) |
Performs addition of column values and given Num
.
Definition at line 5063 of file table.cpp.
References aoAdd, and ColGenericOp().