Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
ibis::bundle Class Reference

The public interface of bundles. More...

#include <bundle.h>

Inheritance diagram for ibis::bundle:
ibis::bundle0 ibis::bundle1 ibis::bundles

List of all members.

Public Member Functions

virtual void * columnArray (uint32_t) const
 Return the pointer to the underlying array used to store the jth column of the bundle.
virtual ibis::TYPE_T columnType (uint32_t) const
 Return the type used to store the values of the jth column of the bundle.
const ibis::RIDSetgetRIDs (uint32_t ind) const
 Return the RIDs of the indth bundle.
const ibis::RIDSetgetRIDs () const
 Return the pointer to all RIDs.
const ibis::array_t< uint32_t > * getStarts () const
 Return the pointer to array starts.
uint32_t numRowsInBundle (uint32_t ind) const
 Compute the number of rows in bundle ind.
virtual void print (std::ostream &out) const =0
 Print the bundle values to the specified output stream.
virtual void printAll (std::ostream &out) const =0
 Print the bundle values along with the RIDs.
virtual void reorder (const char *, int)=0
 Re-order the bundles according to the new keys.
uint32_t rowCounts (array_t< uint32_t > &cnt) const
 Compute the number of rows in each group(bundle).
virtual uint32_t size () const
 Return the number of bundles.
void sortRIDs (uint32_t i, uint32_t j)
 Sort RIDs in the range of [i, j)
void swapRIDs (uint32_t i, uint32_t j)
virtual long truncate (uint32_t keep, uint32_t start)=0
 Truncate the list of bundles.
virtual long truncate (uint32_t keep)=0
 Truncate the list of bundles.
virtual long truncate (const char *names, int direction, uint32_t keep)=0
 Truncate the list of bundle based on specified keys.
virtual uint32_t width () const
 Return the width of the bundles.
virtual void write (const ibis::query &q) const =0
 Write the bundle to the directory for the query q.
virtual int32_t getInt (uint32_t, uint32_t) const
 Retrieve a single value.
virtual uint32_t getUInt (uint32_t, uint32_t) const
 Return the maximal unsigned int value.
virtual int64_t getLong (uint32_t, uint32_t) const
 Return the maximal int value.
virtual uint64_t getULong (uint32_t, uint32_t) const
 Return the maximal unsigned int value.
virtual float getFloat (uint32_t, uint32_t) const
 Return the maximal float value.
virtual double getDouble (uint32_t, uint32_t) const
 Return the maximum double value.
virtual std::string getString (uint32_t, uint32_t) const
 Retrieve a string value.

Static Public Member Functions

static bundlecreate (const ibis::query &q)
 Create new bundle from a hit vector. Write info to q.dir().
static bundlecreate (const ibis::query &q, const ibis::bitvector &hits)
 Create a new bundle from previously stored information.
static bundlecreate (const ibis::part &p, const ibis::selectClause &sel)
 Create a bundle using the all values of the partition.
static const ibis::RIDSetreadRIDs (const char *dir, const uint32_t i)
 Return the RIDs related to the ith bundle.

Protected Member Functions

 bundle (const ibis::selectClause &c)
 bundle (const ibis::query &q, const ibis::bitvector &hits)
 bundle (const ibis::query &q)

Protected Attributes

const ibis::selectClausecomps
const char * id
bool infile
ibis::RIDSetrids
array_t< uint32_t > * starts

Detailed Description

The public interface of bundles.

This is an incore implementation, that is, it stores all relevant values in memory. It is intended to be used only to sort the selected values and immediately write out the content to files.

Given a select clause, its terms are logically re-ordered so that the plain column names are placed before all the functions, such as, "SELECT variable1, variable2, ..., aggregation1, aggregation2, ..." where the relative order of the plain column names are preserved as they appeared on input. The rows/records of the query results are ordered according to the values of the plain columns.

Note:
This implementation only works with select clauses containing plain column names and aggregations on plain columns, no arithmetic expressions, no aliases.
The sorting on string-valued columns does NOT produce alphabetical ordering. For categorical values, the sorting is done on the integer version of the data, not on the string values. Therefore, the string will not appear in alphabetically order! However, aggregation functions should still produce correct results. The text values will appear in the order they are in the data files, i.e., the same order as they are inputed. Furthermore, all text values are treated as different because the actual string values are not examined during sorting. DO NOT use text columns with aggregation functions!
When multiple components are selected, a generic version of the sorting algorithm is used. It may be faster to handle special versions separately. For example, if all the selected components are of the same type, it is possible to use a more compact array structure for comparisons. It might be also useful to separate out the cases where there are only two components.

Member Function Documentation

virtual void* ibis::bundle::columnArray ( uint32_t  ) const [inline, virtual]

Return the pointer to the underlying array used to store the jth column of the bundle.

Reimplemented in ibis::bundle1, and ibis::bundles.

virtual ibis::TYPE_T ibis::bundle::columnType ( uint32_t  ) const [inline, virtual]

Return the type used to store the values of the jth column of the bundle.

Reimplemented in ibis::bundle1, and ibis::bundles.

References ibis::UNKNOWN_TYPE.

int32_t ibis::bundle::getInt ( uint32_t  ,
uint32_t   
) const [virtual]

Retrieve a single value.

Return the maximal int value.

Numerical values will be casted into the return type.

Note:
Most compilers will emit numerous complains about the potential data loss due to type conversions. User should employ the correct types to avoid actual loss of precision.

Reimplemented in ibis::bundle1, and ibis::bundles.

std::string ibis::bundle::getString ( uint32_t  ,
uint32_t   
) const [virtual]

Retrieve a string value.

Return an empty string.

It converts all data types to its string representation through the string stream library.

Note:
This is generic, but slow!

Could have thrown an exception, but that seemed to be a little too heavy handed.

Reimplemented in ibis::bundle1, and ibis::bundles.

const ibis::RIDSet * ibis::bundle::readRIDs ( const char *  dir,
const uint32_t  i 
) [static]
uint32_t ibis::bundle::rowCounts ( array_t< uint32_t > &  cnt) const

Compute the number of rows in each group(bundle).

Return the number of bundles.

References ibis::array_t< T >::clear(), and ibis::array_t< T >::resize().


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

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive