7 #if defined(_WIN32) && defined(_MSC_VER)
15 #pragma warning(disable:4786) // some identifier longer than 256 characters
37 virtual void print(std::ostream& out)
const;
38 virtual void serialSizes(uint64_t&, uint64_t&, uint64_t&)
const;
42 virtual int write(
const char* dt)
const;
43 virtual int read(
const char* idxfile);
45 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
114 virtual const char*
name()
const {
return "basic";}
117 virtual void binWeights(std::vector<uint32_t>& b)
const;
120 std::vector<uint32_t>& cts)
const;
122 std::vector<uint32_t>& cts)
const;
123 virtual double getMin()
const {
return (vals.empty()?DBL_MAX:vals[0]);}
124 virtual double getMax()
const {
return (vals.empty()?-DBL_MAX:vals.back());}
125 virtual double getSum()
const;
127 virtual void speedTest(std::ostream& out)
const;
133 template <
typename T>
148 :
val(v),
ind(b.firstIndexSet()),
j(0) {
192 template <
typename E>
196 uint32_t& hit0, uint32_t& hit1)
const;
205 uint32_t
locate(
const double& val)
const;
210 virtual void clear();
215 template <typename T> static
long
229 const
ibis::math::term& delta,
232 int64_t equiJoin(const
ibis::
relic& idx2,
235 const
double& delta) const;
237 const
ibis::math::term& delta) const;
252 const
ibis::math::term& delta,
254 return compJoin(idx2, mask, delta, hits);
264 const double& delta)
const;
271 return compJoin(idx2, mask, delta);
290 virtual int write(
const char* dt)
const;
291 virtual void print(std::ostream& out)
const;
292 virtual int read(
const char* idxfile);
295 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
315 virtual const char*
name()
const {
return "binary-encoded";}
317 virtual void binWeights(std::vector<uint32_t>& b)
const;
318 virtual double getSum()
const;
320 virtual void speedTest(std::ostream& out)
const;
343 virtual void clear();
355 skive& operator=(const skive&);
358 void construct1(const
char* f = 0);
359 void construct2(const
char* f = 0);
360 void setBit(const uint32_t i, const
double val);
372 virtual const char*
name()
const {
return "bit-slice";}
374 virtual int write(
const char* dt)
const;
375 virtual void print(std::ostream& out)
const;
377 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
379 static bool isSuitable(
const column&,
const char*);
387 template <
typename T>
int constructT(
const char*);
396 const uint32_t nbase = 2);
400 virtual int write(
const char* dt)
const;
401 virtual void print(std::ostream& out)
const;
402 virtual int read(
const char* idxfile);
405 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
422 virtual const char*
name()
const {
return "multi-level range";}
424 virtual void speedTest(std::ostream& out)
const;
426 virtual void binWeights(std::vector<uint32_t>& b)
const;
427 virtual double getSum()
const;
439 virtual void clear();
444 void setBit(const uint32_t i, const
double val);
445 void construct1(const
char* f = 0, const uint32_t nbase = 2);
446 void construct2(const
char* f = 0, const uint32_t nbase = 2);
450 void evalLL(
ibis::
bitvector& res, uint32_t b0, uint32_t b1) const;
453 fade& operator=(const fade&);
462 const uint32_t nbase = 2);
466 virtual int write(
const char* dt)
const;
467 virtual void print(std::ostream& out)
const;
468 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
476 virtual const char*
name()
const {
return "multi-level interval";}
478 virtual void speedTest(std::ostream& out)
const;
484 void setBit(
const uint32_t i,
const double val);
485 void construct1(
const char* f = 0,
const uint32_t nbase = 2);
486 void construct2(
const char* f = 0,
const uint32_t nbase = 2);
501 const uint32_t nbase = 2);
505 virtual int write(
const char* dt)
const;
506 virtual void print(std::ostream& out)
const;
507 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
515 virtual const char*
name()
const {
return "multi-level equality";}
517 virtual void speedTest(std::ostream& out)
const;
523 void setBit(
const uint32_t i,
const double val);
524 void construct1(
const char* f = 0,
const uint32_t nbase = 2);
525 void construct2(
const char* f = 0,
const uint32_t nbase = 2);
547 virtual int write(
const char* dt)
const;
548 virtual void print(std::ostream& out)
const;
549 virtual int read(
const char* idxfile);
552 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
563 virtual const char*
name()
const {
return "interval-equality";}
566 virtual void clear();
575 mutable
array_t<int32_t> coffset32;
576 mutable
array_t<int64_t> coffset64;
579 void activateCoarse() const;
580 void activateCoarse(uint32_t i) const;
581 void activateCoarse(uint32_t i, uint32_t j) const;
583 int writeCoarse32(
int fdes) const;
584 int writeCoarse64(
int fdes) const;
585 int readCoarse(const
char *fn);
589 long coarseEstimate(uint32_t lo, uint32_t hi) const;
591 long coarseEvaluate(uint32_t lo, uint32_t hi,
ibis::
bitvector& res) const;
594 fuzz& operator=(const fuzz&);
608 virtual int write(
const char* dt)
const;
609 virtual void print(std::ostream& out)
const;
610 virtual int read(
const char* idxfile);
613 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
624 virtual const char*
name()
const {
return "range-equality";}
627 virtual void clear();
636 mutable
array_t<int32_t> coffset32;
637 mutable
array_t<int64_t> coffset64;
640 void activateCoarse() const;
641 void activateCoarse(uint32_t i) const;
642 void activateCoarse(uint32_t i, uint32_t j) const;
644 int writeCoarse32(
int fdes) const;
645 int writeCoarse64(
int fdes) const;
646 int readCoarse(const
char *fn);
649 bylt& operator=(const bylt&);
663 virtual int write(
const char* dt)
const;
664 virtual void print(std::ostream& out)
const;
665 virtual int read(
const char* idxfile);
668 virtual long append(
const char* dt,
const char* df, uint32_t nnew);
679 virtual const char*
name()
const {
return "equality-equality";}
682 virtual void clear();
691 mutable
array_t<int32_t> coffset32;
692 mutable
array_t<int64_t> coffset64;
695 void activateCoarse() const;
696 void activateCoarse(uint32_t i) const;
697 void activateCoarse(uint32_t i, uint32_t j) const;
699 int writeCoarse32(
int fdes) const;
700 int writeCoarse64(
int fdes) const;
701 int readCoarse(const
char *fn);
704 zona& operator=(const zona&);
709 template <typename T>
710 struct
ibis::relic::mappedValues {
712 #endif // IBIS_IRELIC_H
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:371
ibis::bylt, unbinned range-equality encoding.
Definition: index.h:140
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:515
virtual double getSum() const
Compute the sum of all values of the column indexed.
Definition: iskive.cpp:1466
The multicomponent equality encoded index.
Definition: irelic.h:497
A class to represent simple range conditions.
Definition: qExpr.h:207
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:679
A single value with known positions.
Definition: irelic.h:134
virtual long select(const ibis::qContinuousRange &, void *) const
Evaluate the range condition and select values.
Definition: irelic.h:407
word_t nIndices() const
Number of indices.
Definition: bitvector.h:508
virtual void binWeights(std::vector< uint32_t > &b) const
Return the exact count for each distinct value.
Definition: iskive.cpp:1446
virtual long select(const ibis::qContinuousRange &, void *) const
Evaluate the range condition and select values.
Definition: irelic.cpp:1811
virtual int read(const char *idxfile)
Read the index contained from the speficied location.
Definition: irelic.cpp:690
virtual double estimateCost(const ibis::qContinuousRange &) const
Estimate the cost of resolving the continuous range expression.
Definition: irelic.h:321
virtual index * dup() const
Duplicate the content of an index object.
Definition: irelic.cpp:348
size_t size() const
Definition: array_t.h:69
Definition of the common functions of an index.
int write32(int fdes) const
Write the content to a file already opened.
Definition: irelic.cpp:459
The basic bitmap index.
Definition: irelic.h:21
Simple range condition.
Definition: qExpr.h:252
The storage class treats all memory as char*.
Definition: fileManager.h:237
array_t< ibis::bitvector * > bits
A list of bitvectors.
Definition: index.h:414
virtual double computeSum() const
Compute the sum of all values of the column indexed.
Definition: irelic.cpp:2007
The comparator used to build a min-heap based on positions.
Definition: irelic.h:185
virtual long append(const char *dt, const char *df, uint32_t nnew)
Create an index based on data in df and append the result to the index in dt.
Definition: irelic.cpp:1193
double coarsen(const double in, unsigned prec=2)
Reduce the decimal precision of the incoming floating-point value to specified precision.
Definition: util.h:1633
virtual long getCumulativeDistribution(std::vector< double > &bds, std::vector< uint32_t > &cts) const
Compute a cumulative distribition.
Definition: irelic.cpp:2017
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:372
virtual void estimate(const ibis::qContinuousRange &, ibis::bitvector &lower, ibis::bitvector &upper) const
Computes an approximation of hits as a pair of lower and upper bounds.
Definition: index.h:191
The class to represent a column of a data partition.
Definition: column.h:65
const word_t * indices() const
Pointer to the indices.
Definition: bitvector.h:506
The precise version of two-level interval-equality index.
Definition: irelic.h:540
A data structure to represent a sequence of bits.
Definition: bitvector64.h:54
virtual void speedTest(std::ostream &out) const
Time some logical operations and print out their speed.
Definition: irelic.cpp:940
virtual void print(std::ostream &out) const
The printing function.
Definition: irelic.cpp:1050
virtual double getMax() const
The maximum value recorded in the index.
Definition: irelic.h:124
ibis::sapid, multicomponent equality encoding (unbinned).
Definition: index.h:115
int write32(int fdes) const
Write the content to a file opened by the caller.
Definition: iskive.cpp:195
bitvector::word_t position() const
Current position (RID).
Definition: irelic.h:154
ibis::slice, bit-sliced index.
Definition: index.h:148
virtual void serialSizes(uint64_t &, uint64_t &, uint64_t &) const
Compute the size of arrays that would be generated by the serializatioin function (write)...
Definition: irelic.cpp:669
The binary encoded index with recoding of keyvalues.
Definition: irelic.h:283
virtual long evaluate(const ibis::qContinuousRange &expr, ibis::bitvector &hits) const
Compute the hits as a bitvector.
Definition: irelic.cpp:1827
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:113
array_t< uint32_t > * keys(const ibis::bitvector &mask) const
Convert the bitvector mask into bin numbers.
Definition: irelic.cpp:1106
virtual void clear()
Free the memory hold by this object.
Definition: iskive.cpp:525
A struct to hold a set of values and their positions.
Definition: irelic.h:220
virtual float undecidable(const ibis::qContinuousRange &, ibis::bitvector &iffy) const
This class and its derived classes should produce exact answers, therefore no undecidable rows...
Definition: irelic.h:67
virtual void estimate(const ibis::qContinuousRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const
Computes an approximation of hits as a pair of lower and upper bounds.
Definition: irelic.h:58
ibis::zona, unbinned equality-equality encoding.
Definition: index.h:144
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:314
The base index class.
Definition: index.h:82
void evalEQ(ibis::bitvector &res, uint32_t b) const
Compute the bitvector that is the answer for the query x = b.
Definition: iskive.cpp:1337
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:624
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:476
void locate(const ibis::qContinuousRange &expr, uint32_t &hit0, uint32_t &hit1) const
Locate the bitmaps covered by the range expression.
Definition: irelic.cpp:1416
virtual long select(const ibis::qContinuousRange &, void *, ibis::bitvector &) const
Evaluate the range condition, select values, and record the positions.
Definition: irelic.h:409
void next()
Move to the next row.
Definition: irelic.h:162
INDEX_TYPE
The integer values of this enum type are used in the index files to differentiate the indexes...
Definition: index.h:86
virtual long select(const ibis::qContinuousRange &, void *, ibis::bitvector &) const
Evaluate the range condition, select values, and record the positions.
Definition: irelic.h:299
virtual double estimateCost(const ibis::qContinuousRange &expr) const
Estimate the cost of resolving the continuous range expression.
Definition: irelic.cpp:1858
virtual double estimateCost(const ibis::qContinuousRange &) const
Estimate the cost of evaluating a range condition.
Definition: index.h:263
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:114
virtual double getSum() const
Compute the sum of all values of the column indexed.
Definition: irelic.cpp:1985
virtual void binBoundaries(std::vector< double > &b) const
Return all distinct values as the bin boundaries.
Definition: irelic.cpp:1970
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:562
virtual double getMin() const
The minimum value recorded in the index.
Definition: irelic.h:123
The precise version of the two-level range-equality index.
Definition: irelic.h:601
The multicomponent range-encoded index.
Definition: irelic.h:392
skive(const ibis::column *c=0, const char *f=0)
Construct a bitmap index from current data.
Definition: iskive.cpp:23
virtual void clear()
Clear the existing content.
Definition: irelic.cpp:819
The multicomponent interval encoded index.
Definition: irelic.h:458
array_t< int64_t > offset64
Starting positions of the bitvectors.
Definition: index.h:412
virtual size_t getSerialSize() const
Estimate the size of the index in a file.
Definition: iskive.cpp:1484
T val
The value.
Definition: irelic.h:136
virtual size_t getSerialSize() const
Compute the size of the index in a file.
Definition: irelic.cpp:3158
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:563
virtual int read(const char *idxfile)
Read the index contained in the file f.
Definition: iskive.cpp:413
void evalGE(ibis::bitvector &res, uint32_t b) const
Compute the bitvector that is the answer for the query x >= b.
Definition: iskive.cpp:1296
static long mergeValuesT(const array_t< T > &vs, const array_t< const bitvector * > &ps, array_t< T > &res)
A template function to merge list of values and a list of positions.
Definition: irelic.cpp:3249
bitvector::indexSet ind
The index set representing the positions with the given value.
Definition: irelic.h:138
The indexSet stores positions of bits that are one.
Definition: bitvector.h:421
bool isRange() const
Is the index set a consecutive range?
Definition: bitvector.h:504
The bit-sliced index.
Definition: irelic.h:365
virtual void estimate(const ibis::qDiscreteRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const
Estimate the hits for discrete ranges, i.e., those translated from 'a IN (x, y, ..)'.
Definition: irelic.h:72
ibis::skive, binary encoding with recoding of key values.
Definition: index.h:109
int write64(int fdes) const
Write the content to a file already opened.
Definition: irelic.cpp:552
long mergeValues(uint32_t, uint32_t, void *) const
Merge the values in different bitmaps into a single list.
Definition: irelic.cpp:3170
virtual long evaluate(const ibis::qContinuousRange &expr, ibis::bitvector &hits) const
Compute the hits as a bitvector.
Definition: iskive.cpp:1359
The abstract base class for arithmetic terms.
Definition: qExpr.h:728
virtual void speedTest(std::ostream &out) const
Time some logical operations and print out their speed.
Definition: iskive.cpp:1232
array_t< int32_t > offset32
Starting positions of the bitvectors.
Definition: index.h:408
ibis::sbiad, multicomponent interval encoding (unbinned).
Definition: index.h:113
ibis::fade, multicomponent range encoding (unbinned).
Definition: index.h:111
ibis::relic, the basic bitmap index.
Definition: index.h:105
virtual void binWeights(std::vector< uint32_t > &b) const
Return the exact count for each distinct value.
Definition: irelic.cpp:1977
A data structure to represent a sequence of bits.
Definition: bitvector.h:62
virtual int write(ibis::array_t< double > &, ibis::array_t< int64_t > &, ibis::array_t< uint32_t > &) const
Save index to three arrays. Serialize the index in memory.
Definition: irelic.cpp:644
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:421
virtual void estimate(const ibis::qContinuousRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const
Computes an approximation of hits as a pair of lower and upper bounds.
Definition: iskive.cpp:1411
The precise version of the two-level equality-equality index.
Definition: irelic.h:656
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:623
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:315
int(* FastBitReadBitmaps)(void *context, uint64_t start, uint64_t count, uint32_t *data)
A function prototype for delayed index reconstruction.
Definition: const.h:341
int write64(int fdes) const
Write the content to a file opened by the caller.
Definition: iskive.cpp:304
virtual int write(const char *dt) const
Write the content of the index to the specified location.
Definition: iskive.cpp:109
virtual void print(std::ostream &out) const
The printing function.
Definition: iskive.cpp:1263
void clear()
Remove the existing content of a bitvector.
Definition: bitvector.cpp:243
A discrete range expression.
Definition: qExpr.h:337
bitvector::word_t j
The current index value inside the index set.
Definition: irelic.h:142
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:678
virtual long getDistribution(std::vector< double > &bds, std::vector< uint32_t > &cts) const
Compute a histogram.
Definition: irelic.cpp:2075
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:475
ibis::fuzz, unbinned interval-equality encoding.
Definition: index.h:142
virtual long append(const char *dt, const char *df, uint32_t nnew)
Create index based data in dt. Have to start from data directly.
Definition: iskive.cpp:1288
virtual INDEX_TYPE type() const
Returns an index type identifier.
Definition: irelic.h:514
virtual double estimateCost(const ibis::qDiscreteRange &expr) const
Estimate the cost of resolving the discrete range expression.
Definition: irelic.h:331
virtual long select(const ibis::qContinuousRange &, void *) const
Evaluate the range condition and select values.
Definition: irelic.h:297
void construct(const char *f=0)
Construct a new index in memory.
Definition: irelic.cpp:831
A join is defined by two names and a numerical expression.
Definition: qExpr.h:1240
virtual const char * name() const
Returns the name of the index, similar to the function type, but returns a string instead...
Definition: irelic.h:422