class xf::database::gqe::Table

#include "gqe_table.hpp"

Overview

handling column-related works (name, section, pointer, etc.)


Methods

Table

Table (std::string _name)

construct of Table .

Parameters:

_name name of the table.

addCol

addCol overload (1)

void addCol (
    std::string _name,
    TypeEnum type_size,
    void* _ptr,
    int row_num
    )

add one column into the Table with user-provided buffer pointer.

usage: tab.addCol(“o_orderkey”, TypeEnum::TypeInt32 , tab_o_col0, 10000);

Parameters:

_name column name
type_size size of the column element data type in bytes
_ptr user-provided column buffer pointer
row_num number of rows

addCol overload (2)

void addCol (
    std::string _name,
    TypeEnum type_size,
    int row_num
    )

allocate buffer for one column and add it into the Table .

usage: tab.addCol(“o_orderkey”, TypeEnum::TypeInt32 , 10000);

Parameters:

_name column name
type_size size of the column element data type in bytes
row_num number of rows

addCol overload (3)

void addCol (
    std::string _name,
    TypeEnum type_size,
    std::vector <std::string> dat_list
    )

create one column with several sections by loading rows from data file.

usage: tab.addCol(“o_orderkey”, TypeEnum::TypeInt32 , {file1.dat,file2.dat});

Parameters:

_name column name
type_size size of the column element data type in bytes
dat_list data file list

addCol overload (4)

void addCol (
    std::string _name,
    TypeEnum type_size,
    std::vector <struct ColPtr> ptr_pairs
    )

create one column with several sections by user-provided pointer list

usage: tab.addCol(“o_orderkey”, TypeEnum::TypeInt32 , {{ptr1,10000},{ptr2,20000}});

Parameters:

_name column name
type_size size of the column element data type in bytes
ptr_pairs vector of (ptr,row_num) pairs

genRowIDWithValidation

genRowIDWithValidation overload (1)

void genRowIDWithValidation (
    std::string _rowid_name,
    std::string _valid_name,
    bool _rowid_en,
    bool _valid_en,
    std::vector <char*> validationPtrVector
    )

add validation column with user-provided validation pointer list

Caution This is an experimental-only API, will be deprecated in the next release.

Parameters:

_rowid_name name of row-id column
_valid_name name of validation bits column
_rowid_en enable flag of row-id
_valid_en enable flag of validation bits
validationPtrVector validation bits pointer list

genRowIDWithValidation overload (2)

void genRowIDWithValidation (
    std::string _rowid_name,
    std::string _valid_name,
    bool _rowid_en,
    bool _valid_en,
    void* ptr,
    int row_num
    )

add validation column with user-provided pointer

Caution This is an experimental-only API, will be deprecated in the next release.

Parameters:

_rowid_name name of row-id column
_valid_name name of validation bits column
_rowid_en enable flag of row-id
_valid_en enable flag of validation bits
ptr validation bits column pointer
row_num number of rows

genRowIDWithValidation overload (3)

void genRowIDWithValidation (
    std::string _rowid_name,
    std::string _valid_name,
    bool _rowid_en,
    bool _valid_en,
    std::vector <std::string> dat_list
    )

add validation column with user-provided data file list

Caution This is an experimental-only API, will be deprecated in the next release.

Parameters:

_rowid_name name of row-id column
_valid_name name of validation bits column
_rowid_en enable flag of row-id
_valid_en enable flag of validation bits
dat_list data file list

setRowNum

void setRowNum (int _num)

set number of rows for the entire table.

Parameters:

_num number of rows of the entire table

getRowNum

size_t getRowNum () const

get number of rows of the entire table.

Returns:

number of rows of the entire table

getSecRowNum

size_t getSecRowNum (int sid) const

get number of rows for the specified section.

Parameters:

sid section ID

Returns:

number of rows of the specified section

getColNum

size_t getColNum () const

get number of columns.

Returns:

number of columns of the table.

getSecNum

size_t getSecNum () const

get number of sections.

Returns:

number of sections of the table.

checkSecNum

void checkSecNum (int sec_l)

divide the columns evenly if section number is greater than 0.

Parameters:

sec_l number of sections, if 0, do nothing since everything is done by addCol with json input.

getColTypeSize

size_t getColTypeSize (int cid) const

get column data type size.

Parameters:

cid column ID

Returns:

date type size of input column id.

getColPointer

char* getColPointer (
    int i,
    int _slice_num,
    int j = 0
    ) const

get buffer pointer.

when getColPointer(2,4,1), it means the 2nd column was divied into 4 sections, return the pointer of the 2nd section

Parameters:

i column id
_slice_num divide column i into _slice_num parts
j get the j’th part pointer after dividing

Returns:

column buffer pointer

getValColPointer

getValColPointer overload (1)

char* getValColPointer (
    int _slice_num,
    int j
    ) const

get the validation buffer pointer

Parameters:

_slice_num number of sections of the validation column
j the index of the section

Returns:

the pointer of the specified section

getColPointer

char* getColPointer (int i) const

get column pointer.

Parameters:

i column id

Returns:

column pointer

setColNames

void setColNames (std::vector <std::string> col_names)

set col_names

Parameters:

col_name column name list

getColNames

std::vector <std::string> getColNames ()

get col_names

Returns:

list of column names

getRowIDColName

std::string getRowIDColName ()

get the name of the row-id column

getValidColName

std::string getValidColName ()

get the name of the validation bits column

getRowIDEnableFlag

bool getRowIDEnableFlag ()

get row-id enable flag

getValidEnableFlag

bool getValidEnableFlag ()

get validation bits enable flag

~Table

~Table ()

deconstructor of Table .

info

void info ()

print information of the table