colValues.h
Go to the documentation of this file.
1 // File: $Id$
2 // Author: John Wu <John.Wu at nersc.gov> Lawrence Berkeley National Laboratory
3 // Copyright (c) 2000-2016 the Regents of the University of California
4 #ifndef IBIS_COLVALUES_H
5 #define IBIS_COLVALUES_H
6 #include "column.h"
7 #include "utilidor.h" // ibis::util::reorder
8 
11 
14 class FASTBIT_CXX_DLLSPEC ibis::colValues {
15 public:
16  virtual ~colValues() {}
17 
18  static colValues* create(const ibis::column* c);
19  static colValues* create(const ibis::column* c,
20  const ibis::bitvector& hits);
21  static colValues* create(const ibis::column* c,
23  const uint32_t start, const uint32_t end);
24 
26  const ibis::column* operator->() const {return col;}
27  const ibis::column* columnPointer() const {return col;}
29  const char* name() const {return(col!=0?col->name():0);}
30 
31  virtual bool empty() const = 0;
32  virtual void reduce(const array_t<uint32_t>& starts) = 0;
33  virtual void reduce(const array_t<uint32_t>& starts,
35  virtual void erase(uint32_t i, uint32_t j) = 0;
36  virtual void swap(uint32_t i, uint32_t j) = 0;
37  virtual uint32_t size() const = 0;
38  virtual uint32_t elementSize() const = 0;
40  virtual ibis::TYPE_T getType() const =0;
42  virtual void* getArray() const =0;
44  virtual void nosharing() =0;
45 
46  bool canSort() const
47  {return (col ? col->type() != ibis::TEXT : false);}
48 
49  void swap(colValues& rhs) { // swap two colValues
50  const ibis::column* c = rhs.col;
51  rhs.col = col;
52  col = c;
53  }
54 
56  virtual long write(FILE* fptr) const = 0;
58  virtual void write(std::ostream& out, uint32_t i) const = 0;
59 
61  virtual void sort(uint32_t i, uint32_t j, bundle* bdl) = 0;
64  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
65  colList::iterator head, colList::iterator tail) = 0;
68  virtual void sort(uint32_t i, uint32_t j,
69  array_t<uint32_t>& neworder) const = 0;
72  virtual void reorder(const array_t<uint32_t>& ind) = 0;
75  virtual array_t<uint32_t>*
76  segment(const array_t<uint32_t>* old=0) const = 0;
78  virtual long truncate(uint32_t keep) = 0;
80  virtual long truncate(uint32_t keep, uint32_t start) = 0;
82  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const = 0;
84  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const = 0;
85 
86  virtual double getMin() const = 0;
87  virtual double getMax() const = 0;
88  virtual double getSum() const = 0;
89  virtual int32_t getInt(uint32_t) const = 0;
90  virtual uint32_t getUInt(uint32_t) const = 0;
91  virtual int64_t getLong(uint32_t) const = 0;
92  virtual uint64_t getULong(uint32_t) const = 0;
93  virtual float getFloat(uint32_t) const = 0;
94  virtual double getDouble(uint32_t) const = 0;
95 
96  void setTimeFormat(const char*, const char* =0);
97 
98 protected:
99  const ibis::column* col;
101 
102  colValues() : col(0), utform(0) {}
103  colValues(const ibis::column* c) : col(c), utform(0) {};
104 
105 private:
106  colValues& operator=(const colValues&);
107 }; // ibis::colValues
108 
110 class FASTBIT_CXX_DLLSPEC ibis::colInts : public ibis::colValues {
111 public:
112  colInts() : colValues(), array(0) {};
113  colInts(const ibis::column* c, const ibis::bitvector& hits)
114  : colValues(c), array(c->selectInts(hits)) {}
116  const uint32_t start, const uint32_t nelm)
117  : colValues(c), array(new array_t<int32_t>(store, start, nelm)) {}
118  colInts(const ibis::column* c);
119  virtual ~colInts() {delete array;}
120 
121  virtual bool empty() const {return (col==0 || array==0);}
122  virtual uint32_t size() const {return (array ? array->size() : 0);}
123  virtual uint32_t elementSize() const {return sizeof(int32_t);}
124  virtual ibis::TYPE_T getType() const {return ibis::INT;}
125  virtual void* getArray() const {return array;}
126  virtual void nosharing() {array->nosharing();}
127 
128  virtual void reduce(const array_t<uint32_t>& starts);
129  virtual void reduce(const array_t<uint32_t>& starts,
131  virtual void erase(uint32_t i, uint32_t j) {
132  array->erase(array->begin()+i, array->begin()+j);}
133  virtual void swap(uint32_t i, uint32_t j) {
134  int32_t tmp = (*array)[i];
135  (*array)[i] = (*array)[j];
136  (*array)[j] = tmp;}
137 
138  void swap(colInts& rhs) { // swap two colInts
139  const ibis::column* c = rhs.col; rhs.col = col; col = c;
140  array_t<int32_t>* a = rhs.array; rhs.array = array; array = a;}
141 
142  virtual long write(FILE* fptr) const;
143  virtual void write(std::ostream& out, uint32_t i) const;
144 
145  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
146  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
147  colList::iterator head, colList::iterator tail);
148  virtual void sort(uint32_t i, uint32_t j,
149  array_t<uint32_t>& neworder) const;
150  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
151  virtual void reorder(const array_t<uint32_t>& ind)
152  {ibis::util::reorder(*array, ind);}
153  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
154  {array->topk(k, ind);}
155  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
156  {array->bottomk(k, ind);}
157  virtual long truncate(uint32_t keep);
158  virtual long truncate(uint32_t keep, uint32_t start);
159 
160  virtual double getMin() const;
161  virtual double getMax() const;
162  virtual double getSum() const;
163  virtual int32_t getInt(uint32_t i) const {return (*array)[i];}
164  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
165  virtual int64_t getLong(uint32_t i) const {return (int64_t)(*array)[i];}
166  virtual uint64_t getULong(uint32_t i) const {return (uint64_t)(*array)[i];}
167  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
168  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
169 
170 private:
171  array_t<int32_t>* array;
172 
173  colInts(const colInts&);
174  colInts& operator=(const colInts&);
175 }; // ibis::colInts
176 
178 class FASTBIT_CXX_DLLSPEC ibis::colUInts : public ibis::colValues {
179 public:
180  colUInts() : colValues(), array(0), dic(0) {};
181  colUInts(const ibis::column* c, const ibis::bitvector& hits);
183  const uint32_t start, const uint32_t nelm);
184  colUInts(const ibis::column* c);
185  virtual ~colUInts() {delete array;}
186 
187  virtual bool empty() const {return (col==0 || array==0);}
188  virtual uint32_t size() const {return (array ? array->size() : 0);}
189  virtual uint32_t elementSize() const {return sizeof(uint32_t);}
190  virtual ibis::TYPE_T getType() const {return ibis::UINT;}
191  virtual void* getArray() const {return array;}
192  virtual void nosharing() {array->nosharing();}
193 
194  virtual void erase(uint32_t i, uint32_t j) {
195  array->erase(array->begin()+i, array->begin()+j);}
196  virtual void swap(uint32_t i, uint32_t j) {
197  uint32_t tmp = (*array)[i];
198  (*array)[i] = (*array)[j];
199  (*array)[j] = tmp;}
200 
201  virtual void reduce(const array_t<uint32_t>& starts);
202  virtual void reduce(const array_t<uint32_t>& starts,
204  void swap(colUInts& rhs) { // swap two colUInts
205  const ibis::column* c = rhs.col; rhs.col = col; col = c;
206  array_t<uint32_t>* a = rhs.array; rhs.array = array; array = a;}
207 
208  virtual long write(FILE* fptr) const;
209  virtual void write(std::ostream& out, uint32_t i) const;
210 
211  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
212  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
213  colList::iterator head, colList::iterator tail);
214  virtual void sort(uint32_t i, uint32_t j,
215  array_t<uint32_t>& neworder) const;
216  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
217  virtual void reorder(const array_t<uint32_t>& ind)
218  {ibis::util::reorder(*array, ind);}
219  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
220  {array->topk(k, ind);}
221  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
222  {array->bottomk(k, ind);}
223  virtual long truncate(uint32_t keep);
224  virtual long truncate(uint32_t keep, uint32_t start);
225 
226  virtual double getMin() const;
227  virtual double getMax() const;
228  virtual double getSum() const;
229  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
230  virtual uint32_t getUInt(uint32_t i) const {return (*array)[i];}
231  virtual int64_t getLong(uint32_t i) const {return (int64_t)(*array)[i];}
232  virtual uint64_t getULong(uint32_t i) const {return (uint64_t)(*array)[i];}
233  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
234  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
235 
236 private:
237  array_t<uint32_t>* array;
238  const dictionary* dic;
239 
240  colUInts(const colUInts&);
241  colUInts& operator=(const colUInts&);
242 }; // ibis::colUInts
243 
245 class FASTBIT_CXX_DLLSPEC ibis::colLongs : public ibis::colValues {
246 public:
247  colLongs() : colValues(), array(0) {};
248  colLongs(const ibis::column* c, const ibis::bitvector& hits)
249  : colValues(c), array(c->selectLongs(hits)) {}
251  const uint32_t start, const uint32_t nelm)
252  : colValues(c), array(new array_t<int64_t>(store, start, nelm)) {}
253  colLongs(const ibis::column* c);
254  virtual ~colLongs() {delete array;}
255 
256  virtual bool empty() const {return (col==0 || array==0);}
257  virtual uint32_t size() const {return (array ? array->size() : 0);}
258  virtual uint32_t elementSize() const {return sizeof(int64_t);}
259  virtual ibis::TYPE_T getType() const {return ibis::LONG;}
260  virtual void* getArray() const {return array;}
261  virtual void nosharing() {array->nosharing();}
262 
263  virtual void reduce(const array_t<uint32_t>& starts);
264  virtual void reduce(const array_t<uint32_t>& starts,
266  virtual void erase(uint32_t i, uint32_t j) {
267  array->erase(array->begin()+i, array->begin()+j);}
268  virtual void swap(uint32_t i, uint32_t j) {
269  int64_t tmp = (*array)[i];
270  (*array)[i] = (*array)[j];
271  (*array)[j] = tmp;}
272 
273  void swap(colLongs& rhs) { // swap two colLongs
274  const ibis::column* c = rhs.col; rhs.col = col; col = c;
275  array_t<int64_t>* a = rhs.array; rhs.array = array; array = a;}
276 
277  virtual long write(FILE* fptr) const;
278  virtual void write(std::ostream& out, uint32_t i) const;
279 
280  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
281  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
282  colList::iterator head, colList::iterator tail);
283  virtual void sort(uint32_t i, uint32_t j,
284  array_t<uint32_t>& neworder) const;
285  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
286  virtual void reorder(const array_t<uint32_t>& ind)
287  {ibis::util::reorder(*array, ind);}
288  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
289  {array->topk(k, ind);}
290  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
291  {array->bottomk(k, ind);}
292  virtual long truncate(uint32_t keep);
293  virtual long truncate(uint32_t keep, uint32_t start);
294 
295  virtual double getMin() const;
296  virtual double getMax() const;
297  virtual double getSum() const;
298  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
299  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
300  virtual int64_t getLong(uint32_t i) const {return (*array)[i];}
301  virtual uint64_t getULong(uint32_t i) const {return (uint64_t)(*array)[i];}
302  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
303  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
304 
305 private:
306  array_t<int64_t>* array;
307 
308  colLongs(const colLongs&);
309  colLongs& operator=(const colLongs&);
310 }; // ibis::colLongs
311 
313 class FASTBIT_CXX_DLLSPEC ibis::colULongs : public ibis::colValues {
314 public:
315  colULongs() : colValues(), array(0) {};
316  colULongs(const ibis::column* c, const ibis::bitvector& hits)
317  : colValues(c), array(c->selectULongs(hits)) {}
319  const uint32_t start, const uint32_t nelm)
320  : colValues(c), array(new array_t<uint64_t>(store, start, nelm)) {}
321  colULongs(const ibis::column* c);
322  virtual ~colULongs() {delete array;}
323 
324  virtual bool empty() const {return (col==0 || array==0);}
325  virtual uint32_t size() const {return (array ? array->size() : 0);}
326  virtual uint32_t elementSize() const {return sizeof(uint64_t);}
327  virtual ibis::TYPE_T getType() const {return ibis::ULONG;}
328  virtual void* getArray() const {return array;}
329  virtual void nosharing() {array->nosharing();}
330 
331  virtual void erase(uint32_t i, uint32_t j) {
332  array->erase(array->begin()+i, array->begin()+j);}
333  virtual void swap(uint32_t i, uint32_t j) {
334  uint64_t tmp = (*array)[i];
335  (*array)[i] = (*array)[j];
336  (*array)[j] = tmp;}
337 
338  virtual void reduce(const array_t<uint32_t>& starts);
339  virtual void reduce(const array_t<uint32_t>& starts,
341  void swap(colULongs& rhs) { // swap two colULongs
342  const ibis::column* c = rhs.col; rhs.col = col; col = c;
343  array_t<uint64_t>* a = rhs.array; rhs.array = array; array = a;}
344 
345  virtual long write(FILE* fptr) const;
346  virtual void write(std::ostream& out, uint32_t i) const;
347 
348  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
349  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
350  colList::iterator head, colList::iterator tail);
351  virtual void sort(uint32_t i, uint32_t j,
352  array_t<uint32_t>& neworder) const;
353  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
354  virtual void reorder(const array_t<uint32_t>& ind)
355  {ibis::util::reorder(*array, ind);}
356  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
357  {array->topk(k, ind);}
358  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
359  {array->bottomk(k, ind);}
360  virtual long truncate(uint32_t keep);
361  virtual long truncate(uint32_t keep, uint32_t start);
362 
363  virtual double getMin() const;
364  virtual double getMax() const;
365  virtual double getSum() const;
366  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
367  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
368  virtual int64_t getLong(uint32_t i) const {return (int64_t)(*array)[i];}
369  virtual uint64_t getULong(uint32_t i) const {return (*array)[i];}
370  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
371  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
372 
373 private:
374  array_t<uint64_t>* array;
375 
376  colULongs(const colULongs&);
377  colULongs& operator=(const colULongs&);
378 }; // ibis::colULongs
379 
381 class FASTBIT_CXX_DLLSPEC ibis::colShorts : public ibis::colValues {
382 public:
383  colShorts() : colValues(), array(0) {};
384  colShorts(const ibis::column* c, const ibis::bitvector& hits)
385  : colValues(c), array(c->selectShorts(hits)) {}
387  const uint32_t start, const uint32_t nelm)
388  : colValues(c), array(new array_t<int16_t>(store, start, nelm)) {}
389  colShorts(const ibis::column* c);
390  virtual ~colShorts() {delete array;}
391 
392  virtual bool empty() const {return (col==0 || array==0);}
393  virtual uint32_t size() const {return (array ? array->size() : 0);}
394  virtual uint32_t elementSize() const {return sizeof(int16_t);}
395  virtual ibis::TYPE_T getType() const {return ibis::SHORT;}
396  virtual void* getArray() const {return array;}
397  virtual void nosharing() {array->nosharing();}
398 
399  virtual void reduce(const array_t<uint32_t>& starts);
400  virtual void reduce(const array_t<uint32_t>& starts,
402  virtual void erase(uint32_t i, uint32_t j) {
403  array->erase(array->begin()+i, array->begin()+j);}
404  virtual void swap(uint32_t i, uint32_t j) {
405  int16_t tmp = (*array)[i];
406  (*array)[i] = (*array)[j];
407  (*array)[j] = tmp;}
408 
409  void swap(colShorts& rhs) { // swap two colShorts
410  const ibis::column* c = rhs.col; rhs.col = col; col = c;
411  array_t<int16_t>* a = rhs.array; rhs.array = array; array = a;}
412 
413  virtual long write(FILE* fptr) const;
414  virtual void write(std::ostream& out, uint32_t i) const;
415 
416  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
417  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
418  colList::iterator head, colList::iterator tail);
419  virtual void sort(uint32_t i, uint32_t j,
420  array_t<uint32_t>& neworder) const;
421  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
422  virtual void reorder(const array_t<uint32_t>& ind)
423  {ibis::util::reorder(*array, ind);}
424  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
425  {array->topk(k, ind);}
426  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
427  {array->bottomk(k, ind);}
428  virtual long truncate(uint32_t keep);
429  virtual long truncate(uint32_t keep, uint32_t start);
430 
431  virtual double getMin() const;
432  virtual double getMax() const;
433  virtual double getSum() const;
434  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
435  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
436  virtual int64_t getLong(uint32_t i) const {return (*array)[i];}
437  virtual uint64_t getULong(uint32_t i) const {return (uint64_t)(*array)[i];}
438  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
439  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
440 
441 private:
442  array_t<int16_t>* array;
443 
444  colShorts(const colShorts&);
445  colShorts& operator=(const colShorts&);
446 }; // ibis::colShorts
447 
449 class FASTBIT_CXX_DLLSPEC ibis::colUShorts : public ibis::colValues {
450 public:
451  colUShorts() : colValues(), array(0) {};
452  colUShorts(const ibis::column* c, const ibis::bitvector& hits)
453  : colValues(c), array(c->selectUShorts(hits)) {}
455  const uint32_t start, const uint32_t nelm)
456  : colValues(c), array(new array_t<uint16_t>(store, start, nelm)) {}
457  colUShorts(const ibis::column* c);
458  virtual ~colUShorts() {delete array;}
459 
460  virtual bool empty() const {return (col==0 || array==0);}
461  virtual uint32_t size() const {return (array ? array->size() : 0);}
462  virtual uint32_t elementSize() const {return sizeof(uint16_t);}
463  virtual ibis::TYPE_T getType() const {return ibis::USHORT;}
464  virtual void* getArray() const {return array;}
465  virtual void nosharing() {array->nosharing();}
466 
467  virtual void erase(uint32_t i, uint32_t j) {
468  array->erase(array->begin()+i, array->begin()+j);}
469  virtual void swap(uint32_t i, uint32_t j) {
470  uint16_t tmp = (*array)[i];
471  (*array)[i] = (*array)[j];
472  (*array)[j] = tmp;}
473 
474  virtual void reduce(const array_t<uint32_t>& starts);
475  virtual void reduce(const array_t<uint32_t>& starts,
477  void swap(colUShorts& rhs) { // swap two colUShorts
478  const ibis::column* c = rhs.col; rhs.col = col; col = c;
479  array_t<uint16_t>* a = rhs.array; rhs.array = array; array = a;}
480 
481  virtual long write(FILE* fptr) const;
482  virtual void write(std::ostream& out, uint32_t i) const;
483 
484  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
485  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
486  colList::iterator head, colList::iterator tail);
487  virtual void sort(uint32_t i, uint32_t j,
488  array_t<uint32_t>& neworder) const;
489  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
490  virtual void reorder(const array_t<uint32_t>& ind)
491  {ibis::util::reorder(*array, ind);}
492  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
493  {array->topk(k, ind);}
494  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
495  {array->bottomk(k, ind);}
496  virtual long truncate(uint32_t keep);
497  virtual long truncate(uint32_t keep, uint32_t start);
498 
499  virtual double getMin() const;
500  virtual double getMax() const;
501  virtual double getSum() const;
502  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
503  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
504  virtual int64_t getLong(uint32_t i) const {return (int64_t)(*array)[i];}
505  virtual uint64_t getULong(uint32_t i) const {return (*array)[i];}
506  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
507  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
508 
509 private:
510  array_t<uint16_t>* array;
511 
512  colUShorts(const colUShorts&);
513  colUShorts& operator=(const colUShorts&);
514 }; // ibis::colUShorts
515 
517 class FASTBIT_CXX_DLLSPEC ibis::colBytes : public ibis::colValues {
518 public:
519  colBytes() : colValues(), array(0) {};
520  colBytes(const ibis::column* c, const ibis::bitvector& hits)
521  : colValues(c), array(c->selectBytes(hits)) {}
523  const uint32_t start, const uint32_t nelm)
524  : colValues(c), array(new array_t<signed char>(store, start, nelm)) {}
525  colBytes(const ibis::column* c);
526  virtual ~colBytes() {delete array;}
527 
528  virtual bool empty() const {return (col==0 || array==0);}
529  virtual uint32_t size() const {return (array ? array->size() : 0);}
530  virtual uint32_t elementSize() const {return sizeof(char);}
531  virtual ibis::TYPE_T getType() const {return ibis::BYTE;}
532  virtual void* getArray() const {return array;}
533  virtual void nosharing() {array->nosharing();}
534 
535  virtual void reduce(const array_t<uint32_t>& starts);
536  virtual void reduce(const array_t<uint32_t>& starts,
538  virtual void erase(uint32_t i, uint32_t j) {
539  array->erase(array->begin()+i, array->begin()+j);}
540  virtual void swap(uint32_t i, uint32_t j) {
541  signed char tmp = (*array)[i];
542  (*array)[i] = (*array)[j];
543  (*array)[j] = tmp;}
544 
545  void swap(colBytes& rhs) { // swap two colBytes
546  const ibis::column* c = rhs.col; rhs.col = col; col = c;
547  array_t<signed char>* a = rhs.array; rhs.array = array; array = a;}
548 
549  virtual long write(FILE* fptr) const;
550  virtual void write(std::ostream& out, uint32_t i) const;
551 
552  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
553  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
554  colList::iterator head, colList::iterator tail);
555  virtual void sort(uint32_t i, uint32_t j,
556  array_t<uint32_t>& neworder) const;
557  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
558  virtual void reorder(const array_t<uint32_t>& ind)
559  {ibis::util::reorder(*array, ind);}
560  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
561  {array->topk(k, ind);}
562  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
563  {array->bottomk(k, ind);}
564  virtual long truncate(uint32_t keep);
565  virtual long truncate(uint32_t keep, uint32_t start);
566 
567  virtual double getMin() const;
568  virtual double getMax() const;
569  virtual double getSum() const;
570  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
571  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
572  virtual int64_t getLong(uint32_t i) const {return (*array)[i];}
573  virtual uint64_t getULong(uint32_t i) const {return (uint64_t)(*array)[i];}
574  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
575  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
576 
577 private:
578  array_t<signed char>* array;
579 
580  colBytes(const colBytes&);
581  colBytes& operator=(const colBytes&);
582 }; // ibis::colBytes
583 
585 class FASTBIT_CXX_DLLSPEC ibis::colUBytes : public ibis::colValues {
586 public:
587  colUBytes() : colValues(), array(0) {};
588  colUBytes(const ibis::column* c, const ibis::bitvector& hits)
589  : colValues(c), array(c->selectUBytes(hits)) {}
591  const uint32_t start, const uint32_t nelm)
592  : colValues(c), array(new array_t<unsigned char>(store, start, nelm)) {}
593  colUBytes(const ibis::column* c);
594  virtual ~colUBytes() {delete array;}
595 
596  virtual bool empty() const {return (col==0 || array==0);}
597  virtual uint32_t size() const {return (array ? array->size() : 0);}
598  virtual uint32_t elementSize() const {return sizeof(char);}
599  virtual ibis::TYPE_T getType() const {return ibis::UBYTE;}
600  virtual void* getArray() const {return array;}
601  virtual void nosharing() {array->nosharing();}
602 
603  virtual void erase(uint32_t i, uint32_t j) {
604  array->erase(array->begin()+i, array->begin()+j);}
605  virtual void swap(uint32_t i, uint32_t j) {
606  unsigned char tmp = (*array)[i];
607  (*array)[i] = (*array)[j];
608  (*array)[j] = tmp;}
609 
610  virtual void reduce(const array_t<uint32_t>& starts);
611  virtual void reduce(const array_t<uint32_t>& starts,
613  void swap(colUBytes& rhs) { // swap two colUBytes
614  const ibis::column* c = rhs.col; rhs.col = col; col = c;
615  array_t<unsigned char>* a = rhs.array; rhs.array = array; array = a;}
616 
617  virtual long write(FILE* fptr) const;
618  virtual void write(std::ostream& out, uint32_t i) const;
619 
620  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
621  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
622  colList::iterator head, colList::iterator tail);
623  virtual void sort(uint32_t i, uint32_t j,
624  array_t<uint32_t>& neworder) const;
625  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
626  virtual void reorder(const array_t<uint32_t>& ind)
627  {ibis::util::reorder(*array, ind);}
628  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
629  {array->topk(k, ind);}
630  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
631  {array->bottomk(k, ind);}
632  virtual long truncate(uint32_t keep);
633  virtual long truncate(uint32_t keep, uint32_t start);
634 
635  virtual double getMin() const;
636  virtual double getMax() const;
637  virtual double getSum() const;
638  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
639  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
640  virtual int64_t getLong(uint32_t i) const {return (int64_t)(*array)[i];}
641  virtual uint64_t getULong(uint32_t i) const {return (*array)[i];}
642  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
643  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
644 
645 private:
646  array_t<unsigned char>* array;
647 
648  colUBytes(const colUBytes&);
649  colUBytes& operator=(const colUBytes&);
650 }; // ibis::colUBytes
651 
653 class FASTBIT_CXX_DLLSPEC ibis::colFloats : public ibis::colValues {
654 public:
655  colFloats() : colValues(), array(0) {};
656  colFloats(const ibis::column* c, const ibis::bitvector& hits)
657  : colValues(c), array(c->selectFloats(hits)) {}
659  const uint32_t start, const uint32_t nelm)
660  : colValues(c), array(new array_t<float>(store, start, nelm)) {}
661  colFloats(const ibis::column* c);
662  virtual ~colFloats() {delete array;}
663 
664  virtual bool empty() const {return (col==0 || array==0);}
665  virtual uint32_t size() const {return (array ? array->size() : 0);}
666  virtual uint32_t elementSize() const {return sizeof(float);}
667  virtual ibis::TYPE_T getType() const {return ibis::FLOAT;}
668  virtual void* getArray() const {return array;}
669  virtual void nosharing() {array->nosharing();}
670 
671  virtual void erase(uint32_t i, uint32_t j) {
672  array->erase(array->begin()+i, array->begin()+j);}
673  virtual void swap(uint32_t i, uint32_t j) {
674  float tmp = (*array)[i];
675  (*array)[i] = (*array)[j];
676  (*array)[j] = tmp;}
677 
678  void swap(colFloats& rhs) { // swap two colFloats
679  const ibis::column* c = rhs.col; rhs.col = col; col = c;
680  array_t<float>* a = rhs.array; rhs.array = array; array = a;}
681  virtual void reduce(const array_t<uint32_t>& starts);
682  virtual void reduce(const array_t<uint32_t>& starts,
684 
685  virtual long write(FILE* fptr) const;
686  virtual void write(std::ostream& out, uint32_t i) const;
687 
688  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
689  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
690  colList::iterator head, colList::iterator tail);
691  virtual void sort(uint32_t i, uint32_t j,
692  array_t<uint32_t>& neworder) const;
693  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
694  virtual void reorder(const array_t<uint32_t>& ind)
695  {ibis::util::reorder(*array, ind);}
696  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
697  {array->topk(k, ind);}
698  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
699  {array->bottomk(k, ind);}
700  virtual long truncate(uint32_t keep);
701  virtual long truncate(uint32_t keep, uint32_t start);
702 
703  virtual double getMin() const;
704  virtual double getMax() const;
705  virtual double getSum() const;
706  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
707  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
708  virtual int64_t getLong(uint32_t i) const {return (int64_t)(*array)[i];}
709  virtual uint64_t getULong(uint32_t i) const {return (uint64_t)(*array)[i];}
710  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
711  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
712 
713 private:
714  array_t<float>* array;
715 
716  colFloats(const colFloats&);
717  colFloats& operator=(const colFloats&);
718 }; // ibis::colFloats
719 
721 class FASTBIT_CXX_DLLSPEC ibis::colDoubles : public ibis::colValues {
722 public:
723  colDoubles() : colValues(), array(0) {};
724  colDoubles(const ibis::column* c, const ibis::bitvector& hits)
725  : colValues(c), array(c->selectDoubles(hits)) {}
727  const uint32_t start, const uint32_t end)
728  : colValues(c), array(new array_t<double>(store, start, end)) {}
729  colDoubles(const ibis::column* c);
730  colDoubles(size_t n, double v) : array(new array_t<double>(n, v)) {}
731  virtual ~colDoubles() {delete array;}
732 
733  virtual bool empty() const {return (col==0 || array==0);}
734  virtual uint32_t size() const {return (array ? array->size() : 0);}
735  virtual uint32_t elementSize() const {return sizeof(double);}
736  virtual ibis::TYPE_T getType() const {return ibis::DOUBLE;}
737  virtual void* getArray() const {return array;}
738  virtual void nosharing() {array->nosharing();}
739 
740  virtual void erase(uint32_t i, uint32_t j) {
741  array->erase(array->begin()+i, array->begin()+j);}
742  virtual void swap(uint32_t i, uint32_t j) {
743  double tmp = (*array)[i];
744  (*array)[i] = (*array)[j];
745  (*array)[j] = tmp;}
746 
747  void swap(colDoubles& rhs) { // swap two colDoubles
748  const ibis::column* c = rhs.col; rhs.col = col; col = c;
749  array_t<double>* a = rhs.array; rhs.array = array; array = a;}
750  virtual void reduce(const array_t<uint32_t>& starts);
751  virtual void reduce(const array_t<uint32_t>& starts,
753 
754  virtual long write(FILE* fptr) const;
755  virtual void write(std::ostream& out, uint32_t i) const;
756 
757  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
758  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
759  colList::iterator head, colList::iterator tail);
760  virtual void sort(uint32_t i, uint32_t j,
761  array_t<uint32_t>& neworder) const;
762  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
763  virtual void reorder(const array_t<uint32_t>& ind)
764  {ibis::util::reorder(*array, ind);}
765  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const
766  {array->topk(k, ind);}
767  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const
768  {array->bottomk(k, ind);}
769  virtual long truncate(uint32_t keep);
770  virtual long truncate(uint32_t keep, uint32_t start);
771 
772  virtual double getMin() const;
773  virtual double getMax() const;
774  virtual double getSum() const;
775  virtual int32_t getInt(uint32_t i) const {return (int32_t)(*array)[i];}
776  virtual uint32_t getUInt(uint32_t i) const {return (uint32_t)(*array)[i];}
777  virtual int64_t getLong(uint32_t i) const {return (int64_t)(*array)[i];}
778  virtual uint64_t getULong(uint32_t i) const {return (uint64_t)(*array)[i];}
779  virtual float getFloat(uint32_t i) const {return (float)(*array)[i];};
780  virtual double getDouble(uint32_t i) const {return (double)(*array)[i];};
781 
782 private:
783  array_t<double>* array;
784 
785  colDoubles(const colDoubles&);
786  colDoubles& operator=(const colDoubles&);
787 }; // ibis::colDoubles
788 
790 class FASTBIT_CXX_DLLSPEC ibis::colStrings : public ibis::colValues {
791 public:
792  colStrings() : colValues(), array(0) {};
793  colStrings(const ibis::column* c, const ibis::bitvector& hits)
794  : colValues(c), array(c->selectStrings(hits)) {}
795  colStrings(const ibis::column* c);
796  colStrings(size_t n, const std::string& v)
797  : array(new std::vector<std::string>(n, v)) {}
798  virtual ~colStrings() {delete array;}
799 
800  virtual bool empty() const {return (col==0 || array==0);}
801  virtual uint32_t size() const {return (array ? array->size() : 0);}
802  virtual uint32_t elementSize() const {return 0;}
803  virtual ibis::TYPE_T getType() const {
804  return (col->type()==ibis::CATEGORY?ibis::CATEGORY:ibis::TEXT);}
805  virtual void* getArray() const {return array;}
806  virtual void nosharing() {/* neve shared */}
807 
808  virtual void erase(uint32_t i, uint32_t j) {
809  array->erase(array->begin()+i, array->begin()+j);}
810  virtual void swap(uint32_t i, uint32_t j) {(*array)[i].swap((*array)[j]);}
811 
812  void swap(colStrings& rhs) { // swap two colStrings
813  const ibis::column* c = rhs.col; rhs.col = col; col = c;
814  std::vector<std::string>* a = rhs.array; rhs.array = array; array = a;}
815  virtual void reduce(const array_t<uint32_t>& starts);
816  virtual void reduce(const array_t<uint32_t>& starts,
818 
819  virtual long write(FILE* fptr) const;
820  virtual void write(std::ostream& out, uint32_t i) const;
821 
822  virtual void sort(uint32_t i, uint32_t j, bundle* bdl);
823  virtual void sort(uint32_t i, uint32_t j, bundle* bdl,
824  colList::iterator head, colList::iterator tail);
825  virtual void sort(uint32_t i, uint32_t j,
826  array_t<uint32_t>& neworder) const;
827  virtual array_t<uint32_t>* segment(const array_t<uint32_t>* old=0) const;
828  virtual void reorder(const array_t<uint32_t>& ind);
829  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const;
830  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const;
831  virtual long truncate(uint32_t keep);
832  virtual long truncate(uint32_t keep, uint32_t start);
833 
835  virtual double getMin() const {return FASTBIT_DOUBLE_NULL;}
837  virtual double getMax() const {return FASTBIT_DOUBLE_NULL;}
839  virtual double getSum() const {return FASTBIT_DOUBLE_NULL;}
841  virtual int32_t getInt(uint32_t) const {return 0;}
843  virtual uint32_t getUInt(uint32_t) const {return 0;}
845  virtual int64_t getLong(uint32_t) const {return 0;}
847  virtual uint64_t getULong(uint32_t) const {return 0;}
849  virtual float getFloat(uint32_t) const {return FASTBIT_FLOAT_NULL;}
851  virtual double getDouble(uint32_t) const {return FASTBIT_DOUBLE_NULL;}
852 
853 private:
855  std::vector<std::string>* array;
856 
857  colStrings(const colStrings&);
858  colStrings& operator=(const colStrings&);
859 
860  void sortsub(uint32_t i, uint32_t j, array_t<uint32_t>& ind) const;
861  uint32_t partitionsub(uint32_t, uint32_t, array_t<uint32_t>&) const;
862 }; // ibis::colStrings
863 
866 class FASTBIT_CXX_DLLSPEC ibis::colBlobs : public ibis::colValues {
867 public:
868  colBlobs() : colValues(), array(0) {};
869  colBlobs(const ibis::column* c, const ibis::bitvector& hits)
870  : colValues(c), array(c->selectOpaques(hits)) {}
871  colBlobs(const ibis::column* c);
872  colBlobs(size_t n, const ibis::opaque& v)
873  : array(new std::vector<ibis::opaque>(n, v)) {}
874  virtual ~colBlobs() {delete array;}
875 
876  virtual bool empty() const {return (col==0 || array==0);}
877  virtual uint32_t size() const {return (array ? array->size() : 0);}
878  virtual uint32_t elementSize() const {return 0;}
879  virtual ibis::TYPE_T getType() const {return col->type();}
880  virtual void* getArray() const {return array;}
881  virtual void nosharing() {/* neve shared */}
882 
883  virtual void erase(uint32_t i, uint32_t j) {
884  array->erase(array->begin()+i, array->begin()+j);}
885  virtual void swap(uint32_t i, uint32_t j) {(*array)[i].swap((*array)[j]);}
886 
887  void swap(colBlobs& rhs) { // swap two colBlobs
888  const ibis::column* c = rhs.col; rhs.col = col; col = c;
889  std::vector<ibis::opaque>* a = rhs.array; rhs.array = array; array = a;}
890  virtual void reduce(const array_t<uint32_t>&);
891  virtual void reduce(const array_t<uint32_t>&,
893 
894  virtual long write(FILE* fptr) const;
895  virtual void write(std::ostream& out, uint32_t i) const;
896 
897  virtual void sort(uint32_t, uint32_t, bundle*);
898  virtual void sort(uint32_t, uint32_t, bundle*,
899  colList::iterator, colList::iterator);
900  virtual void sort(uint32_t, uint32_t,
901  array_t<uint32_t>&) const;
902  virtual array_t<uint32_t>* segment(const array_t<uint32_t>*) const;
903  virtual void reorder(const array_t<uint32_t>& ind);
904  virtual void topk(uint32_t k, array_t<uint32_t> &ind) const;
905  virtual void bottomk(uint32_t k, array_t<uint32_t> &ind) const;
906  virtual long truncate(uint32_t keep);
907  virtual long truncate(uint32_t keep, uint32_t start);
908 
910  virtual double getMin() const {return FASTBIT_DOUBLE_NULL;}
912  virtual double getMax() const {return FASTBIT_DOUBLE_NULL;}
914  virtual double getSum() const {return FASTBIT_DOUBLE_NULL;}
916  virtual int32_t getInt(uint32_t) const {return 0;}
918  virtual uint32_t getUInt(uint32_t) const {return 0;}
920  virtual int64_t getLong(uint32_t) const {return 0;}
922  virtual uint64_t getULong(uint32_t) const {return 0;}
924  virtual float getFloat(uint32_t) const {return FASTBIT_FLOAT_NULL;}
926  virtual double getDouble(uint32_t) const {return FASTBIT_DOUBLE_NULL;}
927 
928 private:
930  std::vector<ibis::opaque>* array;
931 
932  colBlobs(const colBlobs&);
933  colBlobs& operator=(const colBlobs&);
934 }; // ibis::colBlobs
935 #endif
A class to store string values.
Definition: colValues.h:790
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:560
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:492
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:1535
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:3717
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.cpp:7070
!< One bit per record, represented by a bit vector.
Definition: table.h:44
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:763
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:4370
const char * name() const
Name.
Definition: colValues.h:29
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6860
virtual int32_t getInt(uint32_t) const
Return the ith value as int. NOT implemented.
Definition: colValues.h:916
virtual double getMax() const
Compute the maximum. NOT implemented.
Definition: colValues.h:837
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:600
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7199
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7295
virtual array_t< float > * selectFloats(const bitvector &mask) const
Put selected values of a float column into an array.
Definition: column.cpp:3452
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:3789
virtual double getMax() const
Compute the maximum. NOT implemented.
Definition: colValues.h:912
virtual uint32_t getUInt(uint32_t) const
Return the ith value as unsigned int. NOT implemented.
Definition: colValues.h:843
ibis::column::unixTimeScribe * utform
!< The column where the value is from.
Definition: colValues.h:100
virtual array_t< signed char > * selectBytes(const bitvector &mask) const
Retrieve selected 1-byte integer values.
Definition: column.cpp:1118
virtual long truncate(uint32_t keep)=0
Truncate the number element to no more than keep.
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:286
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:151
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7318
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:2605
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6952
virtual long write(FILE *fptr) const =0
Write out whole array as binary.
virtual array_t< uint16_t > * selectUShorts(const bitvector &mask) const
Return selected rows of the column in an array_t object.
Definition: column.cpp:1593
The storage class treats all memory as char*.
Definition: fileManager.h:237
virtual int32_t getInt(uint32_t) const
Return the ith value as int. NOT implemented.
Definition: colValues.h:841
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Find positions of the k smallest strings.
Definition: colValues.cpp:7134
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:628
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const =0
Return the positions of the k largest elements.
virtual double getMin() const
Compute the minimum. NOT implemented.
Definition: colValues.h:910
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:879
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6997
virtual double getDouble(uint32_t) const
Return the ith value as double. NOT implemented.
Definition: colValues.h:926
!< Four-byte signed integers, internally int32_t.
Definition: table.h:35
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7211
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:558
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:3213
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4433
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:327
FastBit sorting functions and other utilities.
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:155
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:669
virtual int64_t getLong(uint32_t) const
Return the ith value as long. NOT implemented.
Definition: colValues.h:920
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6820
virtual int64_t getLong(uint32_t) const
Return the ith value as long. NOT implemented.
Definition: colValues.h:845
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6976
virtual array_t< double > * selectDoubles(const bitvector &mask) const
Put the selected values into an array as doubles.
Definition: column.cpp:3823
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6883
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:260
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:803
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:464
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
!< Eight-byte unsigned integers, internally uint64_t.
Definition: table.h:38
The class to represent a column of a data partition.
Definition: column.h:65
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:698
virtual void * getArray() const =0
Return the pointer to the pointer to underlying array_t object.
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:1321
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Fill the array ind with positions of the k largest elements.
Definition: colValues.cpp:7086
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:3572
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:1749
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:422
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:736
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4447
virtual array_t< uint64_t > * selectULongs(const bitvector &mask) const
Return selected rows of the column in an array_t object.
Definition: column.cpp:3077
A class to store unsigned 64-bit integer values.
Definition: colValues.h:313
!< Two-byte unsigned integers, internally uint16_t.
Definition: table.h:34
virtual double getSum() const
Compute the sum. NOT implemented.
Definition: colValues.h:914
virtual array_t< unsigned char > * selectUBytes(const bitvector &mask) const
Return selected rows of the column in an array_t object.
Definition: column.cpp:1234
virtual double getSum() const
Compute the sum. NOT implemented.
Definition: colValues.h:839
A class to store signed 64-bit integer values.
Definition: colValues.h:245
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:3934
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:4079
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:599
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: am.cpp:50
Arbitrary null-terminated strings.
Definition: table.h:51
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:765
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:395
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:221
A functor for formatting unix time using the user supplied format.
Definition: column.h:358
const ibis::column * operator->() const
Provide a pointer to the column containing the selected values.
Definition: colValues.h:26
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:396
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4419
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:328
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:4007
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:288
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:424
!< Two-byte signed integers, internally int16_t.
Definition: table.h:33
!< Eight-byte signed integers, internally int64_t.
Definition: table.h:37
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.cpp:7060
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:397
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)=0
Sort rows in the range [i, j).
A class to store integer values.
Definition: colValues.h:110
!< One-byte unsigned integers, internally unsigned char.
Definition: table.h:32
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:217
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:805
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:2391
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6906
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7271
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6929
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:696
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:562
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:191
A class to store unsigned short integer values.
Definition: colValues.h:449
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7307
virtual void reduce(const array_t< uint32_t > &)
remove the duplicate elements according to the array starts
Definition: colValues.cpp:4526
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:531
!< Four-byte IEEE floating-point numbers, internally float.
Definition: table.h:39
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:126
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:601
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:806
virtual void sort(uint32_t, uint32_t, bundle *)
Sort rows in the range [i, j).
Definition: colValues.cpp:3553
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:219
TYPE_T
Supported data types.
Definition: table.h:25
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:630
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7187
void reorder(array_t< T > &arr, const array_t< uint32_t > &ind)
Reorder the array arr according to the indices given in ind.
Definition: utilidor.cpp:224
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:125
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7223
A class to store unsigned 64-bit integer values.
Definition: colValues.h:585
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:190
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Find positions of the k smallest strings.
Definition: colValues.cpp:7182
virtual array_t< int64_t > * selectLongs(const bitvector &mask) const
Return selected rows of the column in an array_t object.
Definition: column.cpp:2483
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:490
virtual double getMin() const
Compute the minimum. NOT implemented.
Definition: colValues.h:835
virtual array_t< int32_t > * selectInts(const bitvector &mask) const
Return selected rows of the column in an array_t object.
Definition: column.cpp:1833
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:767
virtual long write(FILE *fptr) const
Write out the whole array as binary.
Definition: colValues.cpp:6760
virtual uint64_t getULong(uint32_t) const
Return the ith value as unsigned long. NOT implemented.
Definition: colValues.h:847
virtual std::vector< std::string > * selectStrings(const bitvector &mask) const
Return the selected rows as strings.
Definition: column.cpp:5276
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:259
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:494
A class to store double precision floating-point values.
Definition: colValues.h:721
A class to store signed 8-bit integer values.
Definition: colValues.h:517
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4475
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:4225
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6843
virtual ibis::TYPE_T getType() const =0
Return the type of the data stored.
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Mark the start positions of the segments with identical values.
Definition: am.cpp:2
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4405
virtual void reorder(const array_t< uint32_t > &ind)=0
Reorder the values according to the specified indices.
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4377
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7247
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7259
AGREGADO
Functions related to internal aggregation operations.
Definition: selectClause.h:164
A data structure to represent a sequence of bits.
Definition: bitvector.h:62
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:463
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const =0
Produce an array of the starting positions of values that are the same.
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:354
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:329
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:667
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6734
A class to store raw binary values.
Definition: colValues.h:866
virtual uint32_t getUInt(uint32_t) const
Return the ith value as unsigned int. NOT implemented.
Definition: colValues.h:918
!< One-byte signed integers, internally char.
Definition: table.h:31
virtual void reduce(const array_t< uint32_t > &starts)
remove the duplicate elements according to the array starts
Definition: colValues.cpp:4503
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:881
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:2819
virtual double getDouble(uint32_t) const
Return the ith value as double. NOT implemented.
Definition: colValues.h:851
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:356
A class to store unsigned integer values.
Definition: colValues.h:178
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:4298
virtual float getFloat(uint32_t) const
Return the ith value as float. NOT implemented.
Definition: colValues.h:924
virtual ibis::TYPE_T getType() const
Return the type of the data stored.
Definition: colValues.h:124
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7283
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:358
A pure virtual base class for storing selected values in memory.
Definition: colValues.h:14
virtual uint64_t getULong(uint32_t) const
Return the ith value as unsigned long. NOT implemented.
Definition: colValues.h:922
virtual void reduce(const array_t< uint32_t > &starts)
remove the duplicate elements according to the array starts
Definition: colValues.cpp:4517
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:1107
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:668
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const =0
Return the positions of the k smallest elements.
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:532
virtual long write(FILE *fptr) const
Write out whole array as binary.
Definition: colValues.cpp:6797
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:3016
void setTimeFormat(const char *, const char *=0)
Add a custom format for the column to be interpretted as unix time stamps.
Definition: colValues.cpp:137
!< Four-byte unsigned integers, internally uint32_t.
Definition: table.h:36
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:192
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:261
virtual long truncate(uint32_t keep)
Truncate the number element to no more than keep.
Definition: colValues.cpp:7235
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.cpp:7176
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:1963
static colValues * create(const ibis::column *c)
Implementation of the colValues class hierarchy.
Definition: colValues.cpp:25
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:694
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:465
virtual void sort(uint32_t i, uint32_t j, bundle *bdl)
Sort rows in the range [i, j).
Definition: colValues.cpp:2177
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:737
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:738
virtual void reorder(const array_t< uint32_t > &ind)
Reorder the values according to the specified indices.
Definition: colValues.h:626
virtual array_t< int16_t > * selectShorts(const bitvector &mask) const
Return selected rows of the column in an array_t object.
Definition: column.cpp:1353
virtual float getFloat(uint32_t) const
Return the ith value as float. NOT implemented.
Definition: colValues.h:849
Define the class ibis::column.
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4461
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:426
virtual void bottomk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k smallest elements.
Definition: colValues.h:290
virtual void * getArray() const
Return the pointer to the pointer to underlying array_t object.
Definition: colValues.h:880
A class to store short integer values.
Definition: colValues.h:381
virtual void nosharing()
Make sure the content of the underlying storage is not shared.
Definition: colValues.h:533
virtual void topk(uint32_t k, array_t< uint32_t > &ind) const
Return the positions of the k largest elements.
Definition: colValues.h:153
virtual array_t< uint32_t > * segment(const array_t< uint32_t > *old=0) const
Produce an array of the starting positions of values that are the same.
Definition: colValues.cpp:3862
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4391
virtual void reduce(const array_t< uint32_t > &starts)
Remove the duplicate elements according to the array starts.
Definition: colValues.cpp:4489
virtual void nosharing()=0
Make sure the content of the underlying storage is not shared.
A class to store single precision float-point values.
Definition: colValues.h:653

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