tab.h
Go to the documentation of this file.
1 // File: $Id$
2 // Author: John Wu <John.Wu at ACM.org>
3 // Copyright (c) 2007-2016 the Regents of the University of California
4 #ifndef IBIS_TAB_H
5 #define IBIS_TAB_H
6 
20 #include "table.h" // ibis::table
21 #include "array_t.h" // ibis::array_t
22 #include <iostream>
23 
24 namespace ibis {
25  class tabula;
26  class tabele;
27 } // namespace ibis
28 
32 class ibis::tabula : public ibis::table {
33 public:
34  tabula(const char* na, const char* de, uint64_t nr) :
35  table(na, de), nrows(nr) {};
36  explicit tabula(uint64_t nr=0) : nrows(nr) {};
37  virtual ~tabula() {};
38  virtual uint64_t nRows() const {return nrows;}
39  virtual uint32_t nColumns() const {return 0;}
40 
41  virtual stringArray columnNames() const;
42  virtual typeArray columnTypes() const;
43 
44  virtual void describe(std::ostream&) const;
45  virtual void dumpNames(std::ostream&, const char*) const {}
46  virtual int dump(std::ostream&, const char*) const {return 0;}
47  virtual int dump(std::ostream&, uint64_t, const char*) const {return 0;}
48  virtual int dump(std::ostream&, uint64_t, uint64_t, const char*) const {
49  return 0;}
51  virtual int backup(const char*, const char* =0,
52  const char* =0) const {return 0;}
53 
54  virtual int64_t
55  getColumnAsBytes(const char*, char*, uint64_t =0,
56  uint64_t =0) const {return -1;}
57  virtual int64_t
58  getColumnAsUBytes(const char*, unsigned char*, uint64_t =0,
59  uint64_t =0) const {return -1;}
60  virtual int64_t
61  getColumnAsShorts(const char*, int16_t*, uint64_t =0,
62  uint64_t =0) const {return -1;}
63  virtual int64_t
64  getColumnAsUShorts(const char*, uint16_t*, uint64_t =0,
65  uint64_t =0) const {return -1;}
66  virtual int64_t
67  getColumnAsInts(const char*, int32_t*, uint64_t =0,
68  uint64_t =0) const {return -1;}
69  virtual int64_t
70  getColumnAsUInts(const char*, uint32_t*, uint64_t =0,
71  uint64_t =0) const {return -1;}
72  virtual int64_t
73  getColumnAsLongs(const char*, int64_t*, uint64_t =0,
74  uint64_t =0) const {return -1;}
75  virtual int64_t
76  getColumnAsULongs(const char*, uint64_t*, uint64_t =0,
77  uint64_t =0) const {return -1;}
78  virtual int64_t
79  getColumnAsFloats(const char*, float*, uint64_t =0,
80  uint64_t =0) const {return -1;}
81  virtual int64_t
82  getColumnAsDoubles(const char*, double*, uint64_t =0,
83  uint64_t =0) const {return -1;}
84  virtual int64_t
85  getColumnAsDoubles(const char*, std::vector<double>&, uint64_t =0,
86  uint64_t =0) const {return -1;}
87  virtual int64_t
88  getColumnAsStrings(const char*, std::vector<std::string>&, uint64_t =0,
89  uint64_t =0) const {return -1;}
90  virtual int64_t
91  getColumnAsOpaques(const char*, std::vector<ibis::opaque>&, uint64_t =0,
92  uint64_t =0) const {return -1;}
93  virtual double getColumnMin(const char*) const {
94  return DBL_MAX;}
95  virtual double getColumnMax(const char*) const {
96  return -DBL_MAX;}
97 
98  virtual long getHistogram(const char*, const char*,
99  double, double, double,
100  std::vector<uint32_t>&) const {return -1;}
101  virtual long getHistogram2D(const char*, const char*,
102  double, double, double,
103  const char*,
104  double, double, double,
105  std::vector<uint32_t>&) const {return -1;}
106  virtual long getHistogram3D(const char*, const char*,
107  double, double, double,
108  const char*,
109  double, double, double,
110  const char*,
111  double, double, double,
112  std::vector<uint32_t>&) const {return -1;}
113 
114  virtual void estimate(const char* cond,
115  uint64_t& nmin, uint64_t& nmax) const;
116  virtual void estimate(const ibis::qExpr* cond,
117  uint64_t& nmin, uint64_t& nmax) const;
118  using ibis::table::select;
119  virtual table* select(const char*, const char*) const {return 0;}
120 
121  virtual table* groupby(const stringArray&) const {return 0;}
122  virtual table* groupby(const char*) const {return 0;}
123  virtual void orderby(const stringArray&, const std::vector<bool>&) {};
124  virtual void orderby(const stringArray&) {};
125  virtual void orderby(const char*) {};
126  virtual void reverseRows() {};
127 
128  virtual int buildIndex(const char*, const char*) {return -1;}
129  virtual int buildIndexes(const char*) {return -1;}
130  virtual int buildIndexes(const ibis::table::stringArray&) {return -1;}
131  virtual const char* indexSpec(const char*) const {return 0;}
132  virtual void indexSpec(const char*, const char*) {return;}
133 
134  // Cursor class for row-wise data accesses.
135  class cursor;
137  virtual ibis::table::cursor* createCursor() const;
138 
139 private:
141  uint64_t nrows;
142 
143  tabula(const tabula&);
144  tabula& operator=(const tabula&);
145 }; // ibis::tabula
146 
152 class ibis::tabele : public ibis::table {
153 public:
156  tabele(const char* na, const char* de, uint64_t nr, const char* nm=0) :
157  table(na, de), nrows(nr), col(nm && *nm ? nm : "nrows") {};
161  explicit tabele(uint64_t nr=0, const char* nm=0) :
162  nrows(nr), col(nm && *nm ? nm : "nrows") {};
163  virtual ~tabele() {};
164  virtual uint64_t nRows() const {return 1U;}
165  virtual uint32_t nColumns() const {return 1U;}
166 
167  virtual stringArray columnNames() const;
168  virtual typeArray columnTypes() const;
169 
170  virtual void describe(std::ostream&) const;
171  virtual void dumpNames(std::ostream&, const char*) const;
172  virtual int dump(std::ostream&, const char*) const;
173  virtual int dump(std::ostream& out, uint64_t nr, const char* sep) const {
174  if (nr > 0) return dump(out, sep); else return 0;}
175  virtual int dump(std::ostream& out, uint64_t off, uint64_t nr,
176  const char* sep) const {
177  if (off==0 && nr > 0) return dump(out, sep); else return 0;}
179  virtual int backup(const char*, const char* =0,
180  const char* =0) const {return 0;}
181 
182  virtual int64_t getColumnAsBytes(const char*, char*, uint64_t =0,
183  uint64_t =0) const {return -1;}
184  virtual int64_t getColumnAsUBytes(const char*,
185  unsigned char*, uint64_t =0,
186  uint64_t =0) const {return -1;}
187  virtual int64_t getColumnAsShorts(const char*,
188  int16_t*, uint64_t =0,
189  uint64_t =0) const {return -1;}
190  virtual int64_t getColumnAsUShorts(const char*,
191  uint16_t*, uint64_t =0,
192  uint64_t =0) const {return -1;}
193  virtual int64_t getColumnAsInts(const char*, int32_t*, uint64_t =0,
194  uint64_t =0) const {return -1;}
195  virtual int64_t getColumnAsUInts(const char* cn, uint32_t* vals,
196  uint64_t begin =0, uint64_t =0) const {
197  if (stricmp(col.c_str(), cn) == 0) {
198  if (begin == 0) {
199  *vals = static_cast<uint32_t>(nrows);
200  return 1;
201  }
202  else {
203  return 0;
204  }
205  }
206  else {
207  return -1;
208  }
209  }
210  virtual int64_t getColumnAsLongs(const char* cn, int64_t* vals,
211  uint64_t begin =0, uint64_t =0) const {
212  if (stricmp(col.c_str(), cn) == 0) {
213  if (begin == 0) {
214  *vals = nrows;
215  return 1;
216  }
217  else {
218  return 0;
219  }
220  }
221  else {
222  return -1;
223  }
224  }
225  virtual int64_t getColumnAsULongs(const char* cn, uint64_t* vals,
226  uint64_t begin =0, uint64_t =0) const {
227  if (stricmp(col.c_str(), cn) == 0) {
228  if (begin == 0) {
229  *vals = nrows;
230  return 1;
231  }
232  else {
233  return 0;
234  }
235  }
236  else {
237  return -1;
238  }
239  }
240  virtual int64_t getColumnAsFloats(const char*, float*, uint64_t =0,
241  uint64_t =0) const {return -1;}
242  virtual int64_t getColumnAsDoubles(const char*, double*, uint64_t =0,
243  uint64_t =0) const {return -1;}
244  virtual int64_t
245  getColumnAsDoubles(const char*, std::vector<double>&, uint64_t =0,
246  uint64_t =0) const {return -1;}
247  virtual int64_t
248  getColumnAsStrings(const char*, std::vector<std::string>&, uint64_t =0,
249  uint64_t =0) const {return -1;}
250  virtual int64_t
251  getColumnAsOpaques(const char*, std::vector<ibis::opaque>&, uint64_t =0,
252  uint64_t =0) const {return -1;}
253  virtual double getColumnMin(const char* cn) const {
254  if (stricmp(cn, col.c_str()) == 0)
255  return nrows;
256  else
257  return DBL_MAX;
258  }
259  virtual double getColumnMax(const char* cn) const {
260  if (stricmp(cn, col.c_str()) == 0)
261  return nrows;
262  else
263  return -DBL_MAX;
264  }
265 
266  virtual long getHistogram(const char*, const char*,
267  double, double, double,
268  std::vector<uint32_t>&) const {return -1;}
269  virtual long getHistogram2D(const char*, const char*,
270  double, double, double,
271  const char*,
272  double, double, double,
273  std::vector<uint32_t>&) const {return -1;}
274  virtual long getHistogram3D(const char*, const char*,
275  double, double, double,
276  const char*,
277  double, double, double,
278  const char*,
279  double, double, double,
280  std::vector<uint32_t>&) const {return -1;}
281 
282  virtual void estimate(const char* cond,
283  uint64_t& nmin, uint64_t& nmax) const;
284  virtual void estimate(const ibis::qExpr* cond,
285  uint64_t& nmin, uint64_t& nmax) const;
286  using ibis::table::select;
287  virtual table* select(const char*, const char*) const {return 0;}
288 
289  virtual table* groupby(const stringArray&) const {return 0;}
290  virtual table* groupby(const char*) const {return 0;}
291  virtual void orderby(const stringArray&, const std::vector<bool>&) {};
292  virtual void orderby(const stringArray&) {};
293  virtual void orderby(const char*) {};
294  virtual void reverseRows() {};
295 
296  virtual int buildIndex(const char*, const char*) {return -1;}
297  virtual int buildIndexes(const char*) {return -1;}
298  virtual int buildIndexes(const ibis::table::stringArray&) {return -1;}
299  virtual const char* indexSpec(const char*) const {return 0;}
300  virtual void indexSpec(const char*, const char*) {return;}
301 
302  // Cursor class for row-wise data accesses.
303  class cursor;
305  virtual ibis::table::cursor* createCursor() const;
306 
307  const char* colName() const {return col.c_str();}
308 
309 private:
310  // the number of rows selected
311  uint64_t nrows;
312  // the name of the column
313  std::string col;
314 
315  tabele(const tabele&);
316  tabele& operator=(const tabele&);
317 
318  friend class cursor;
319 }; // ibis::tabele
320 
321 // Inline functions
322 inline ibis::table::stringArray ibis::tabula::columnNames() const {
324  return tmp;
325 }
326 
329  return tmp;
330 }
331 
332 inline void ibis::tabula::describe(std::ostream& out) const {
333  out << "Table " << name_ << " (" << desc_ << ") contains "
334  << nrows << " row" << (nrows > 1 ? "s" : "")
335  << (nrows>0?" but":" and") << " no column" << std::endl;
336 }
337 
338 inline void
339 ibis::tabula::estimate(const char*, uint64_t& nmin, uint64_t& nmax) const {
340  nmin = 0;
341  nmax = nrows;
342 }
343 
344 inline void
346  uint64_t& nmin, uint64_t& nmax) const {
347  nmin = 0;
348  nmax = nrows;
349 }
350 
352 public:
353  cursor(const ibis::tabula& t) : tab(t) {}
354  virtual ~cursor() {};
355 
356  virtual uint64_t nRows() const {return tab.nRows();}
357  virtual uint32_t nColumns() const {return tab.nColumns();}
358  virtual ibis::table::stringArray columnNames() const {
359  return tab.columnNames();}
360  virtual ibis::table::typeArray columnTypes() const {
361  return tab.columnTypes();}
362  virtual int fetch() {return -1;}
363  virtual int fetch(uint64_t) {return -1;}
364  virtual int fetch(ibis::table::row&) {return -1;}
365  virtual int fetch(uint64_t, ibis::table::row&) {return -1;}
366  virtual uint64_t getCurrentRowNumber() const {return tab.nRows();}
367  virtual int dump(std::ostream&, const char* del) const {return 0;}
368 
369  virtual int getColumnAsByte(const char*, char&) const {return -1;}
370  virtual int getColumnAsUByte(const char*, unsigned char&) const
371  {return -1;}
372  virtual int getColumnAsShort(const char*, int16_t&) const {return -1;}
373  virtual int getColumnAsUShort(const char*, uint16_t&) const {return -1;}
374  virtual int getColumnAsInt(const char*, int32_t&) const {return -1;}
375  virtual int getColumnAsUInt(const char*, uint32_t&) const {return -1;}
376  virtual int getColumnAsLong(const char*, int64_t&) const {return -1;}
377  virtual int getColumnAsULong(const char*, uint64_t&) const {return -1;}
378  virtual int getColumnAsFloat(const char*, float&) const {return -1;}
379  virtual int getColumnAsDouble(const char*, double&) const {return -1;}
380  virtual int getColumnAsString(const char*, std::string&) const {return -1;}
381  virtual int getColumnAsOpaque(const char*, ibis::opaque&) const {return -1;}
382 
383  virtual int getColumnAsByte(uint32_t, char&) const {return -1;}
384  virtual int getColumnAsUByte(uint32_t, unsigned char&) const {return -1;}
385  virtual int getColumnAsShort(uint32_t, int16_t&) const {return -1;}
386  virtual int getColumnAsUShort(uint32_t, uint16_t&) const {return -1;}
387  virtual int getColumnAsInt(uint32_t, int32_t&) const {return -1;}
388  virtual int getColumnAsUInt(uint32_t, uint32_t&) const {return -1;}
389  virtual int getColumnAsLong(uint32_t, int64_t&) const {return -1;}
390  virtual int getColumnAsULong(uint32_t, uint64_t&) const {return -1;}
391  virtual int getColumnAsFloat(uint32_t, float&) const {return -1;}
392  virtual int getColumnAsDouble(uint32_t, double&) const {return -1;}
393  virtual int getColumnAsString(uint32_t, std::string&) const {return -1;}
394  virtual int getColumnAsOpaque(uint32_t, ibis::opaque&) const {return -1;}
395 
396 private:
397  const ibis::tabula& tab;
398 
399  cursor();
400  cursor(const cursor&);
401  cursor& operator=(const cursor&);
402 }; // ibis::tabula::cursor
403 
405  return new ibis::tabula::cursor(*this);
406 } // ibis::tabula::createCursor
407 
408 inline ibis::table::stringArray ibis::tabele::columnNames() const {
410  tmp[0] = col.c_str();
411  return tmp;
412 }
413 
415  ibis::table::typeArray tmp(1);
416  tmp[0] = ibis::ULONG;
417  return tmp;
418 }
419 
420 inline void ibis::tabele::describe(std::ostream& out) const {
421  out << "Table " << name_ << " (" << desc_
422  << ") contains 1 column and 1 row\n"
423  << col << "\t" << ibis::TYPESTRING[(int)ibis::ULONG] << "\n"
424  << std::endl;
425 }
426 
427 inline void ibis::tabele::dumpNames(std::ostream& out, const char*) const {
428  out << col << std::endl;
429 }
430 
431 inline int ibis::tabele::dump(std::ostream& out, const char *) const {
432  out << nrows << std::endl;
433  return 0;
434 }
435 
436 inline void
437 ibis::tabele::estimate(const char*, uint64_t& nmin, uint64_t& nmax) const {
438  nmin = 0;
439  nmax = 1;
440 }
441 
442 inline void
444  uint64_t& nmin, uint64_t& nmax) const {
445  nmin = 0;
446  nmax = 1;
447 }
448 
450 public:
451  cursor(const ibis::tabele& t) : tab(t), current(-1) {}
452  virtual ~cursor() {};
453 
454  virtual uint64_t nRows() const {return tab.nRows();}
455  virtual uint32_t nColumns() const {return tab.nColumns();}
456  virtual ibis::table::stringArray columnNames() const {
457  return tab.columnNames();}
458  virtual ibis::table::typeArray columnTypes() const {
459  return tab.columnTypes();}
460  virtual int fetch() {
461  ++ current;
462  return (static_cast<uint64_t>(current) < tab.nRows() ? 0 : -1);}
463  virtual int fetch(uint64_t irow) {
464  if (irow < tab.nRows()) {
465  current = irow;
466  return 0;
467  }
468  else {
469  return -1;
470  }}
471  virtual int fetch(ibis::table::row& res) {
472  ++ current;
473  res.clear();
474  if (current == 0) {
475  res.ulongsnames.push_back(tab.col);
476  res.ulongsvalues.push_back(tab.nrows);
477  return 0;
478  }
479  else {
480  return -1;
481  }
482  }
483  virtual int fetch(uint64_t irow, ibis::table::row& res) {
484  res.clear();
485  if (irow < 1U) {
486  current = 0U;
487  res.ulongsnames.push_back(tab.col);
488  res.ulongsvalues.push_back(tab.nrows);
489  return 0;
490  }
491  else {
492  return -1;
493  }
494  }
495  virtual uint64_t getCurrentRowNumber() const {return current;}
496  virtual int dump(std::ostream& out, const char* del) const {
497  if (current == 0) {
498  out << tab.nrows << "\n";
499  return 0;
500  }
501  else {
502  return -1;
503  }
504  }
505 
506  virtual int getColumnAsByte(const char*, char&) const {return -1;}
507  virtual int getColumnAsUByte(const char*, unsigned char&) const {
508  return -1;}
509  virtual int getColumnAsShort(const char*, int16_t&) const {return -1;}
510  virtual int getColumnAsUShort(const char*, uint16_t&) const {return -1;}
511  virtual int getColumnAsInt(const char*, int32_t&) const {return -1;}
512  virtual int getColumnAsUInt(const char* cn, uint32_t&) const {
513  return -1;}
514  virtual int getColumnAsLong(const char* cn, int64_t& val) const {
515  if (current == 0 && stricmp(tab.colName(), cn) == 0) {
516  val = tab.nrows;
517  return 1;}
518  else {
519  return -1;
520  }
521  }
522  virtual int getColumnAsULong(const char* cn, uint64_t& val) const {
523  if (current == 0 && stricmp(tab.colName(), cn) == 0) {
524  val = tab.nrows;
525  return 1;}
526  else {
527  return -1;
528  }
529  }
530  virtual int getColumnAsFloat(const char*, float&) const {return -1;}
531  virtual int getColumnAsDouble(const char*, double&) const {return -1;}
532  virtual int getColumnAsString(const char*, std::string&) const {return -1;}
533  virtual int getColumnAsOpaque(const char*, ibis::opaque&) const {return -1;}
534 
535  virtual int getColumnAsByte(uint32_t, char&) const {return -1;}
536  virtual int getColumnAsUByte(uint32_t, unsigned char&) const {return -1;}
537  virtual int getColumnAsShort(uint32_t, int16_t&) const {return -1;}
538  virtual int getColumnAsUShort(uint32_t, uint16_t&) const {return -1;}
539  virtual int getColumnAsInt(uint32_t, int32_t&) const {return -1;}
540  virtual int getColumnAsUInt(uint32_t cn, uint32_t&) const {
541  return -1;}
542  virtual int getColumnAsLong(uint32_t cn, int64_t& val) const {
543  if (current == 0 && cn == 0) {
544  val = tab.nrows;
545  return 1;}
546  else {
547  return -1;
548  }}
549  virtual int getColumnAsULong(uint32_t cn, uint64_t& val) const {
550  if (current == 0 && cn == 0) {
551  val = tab.nrows;
552  return 1;}
553  else {
554  return -1;
555  }}
556  virtual int getColumnAsFloat(uint32_t, float&) const {return -1;}
557  virtual int getColumnAsDouble(uint32_t, double&) const {return -1;}
558  virtual int getColumnAsString(uint32_t, std::string&) const {return -1;}
559  virtual int getColumnAsOpaque(uint32_t, ibis::opaque&) const {return -1;}
560 
561 private:
562  const ibis::tabele& tab;
563  int64_t current;
564 
565  cursor();
566  cursor(const cursor&);
567  cursor& operator=(const cursor&);
568 }; // ibis::tabele::cursor
569 
571  return new ibis::tabele::cursor(*this);
572 } // ibis::tabele::createCursor
573 #endif // IBIS_TAB_H
virtual int fetch(uint64_t irow, ibis::table::row &res)
Fetch the content of the specified row and make that row the current row as well. ...
Definition: tab.h:483
virtual int64_t getColumnAsStrings(const char *, std::vector< std::string > &, uint64_t=0, uint64_t=0) const
Retrieve the null-terminated strings as a vector of std::string objects.
Definition: tab.h:88
virtual int getColumnAsULong(const char *cn, uint64_t &val) const
Definition: tab.h:522
virtual int getColumnAsFloat(uint32_t, float &) const
Definition: tab.h:556
virtual int fetch()
Make the next row of the data set available for retrieval.
Definition: tab.h:460
virtual int backup(const char *, const char *=0, const char *=0) const
The backup function. It does nothing.
Definition: tab.h:51
virtual int getColumnAsUByte(uint32_t, unsigned char &) const
Definition: tab.h:536
A trivial class for a table with no columns.
Definition: tab.h:32
virtual int dump(std::ostream &, const char *) const
Print the values in ASCII form to the specified output stream.
Definition: tab.h:431
virtual int getColumnAsLong(uint32_t, int64_t &) const
Definition: tab.h:389
virtual int getColumnAsInt(uint32_t, int32_t &) const
Definition: tab.h:539
virtual int getColumnAsShort(uint32_t, int16_t &) const
Definition: tab.h:537
virtual int fetch(uint64_t)
Make the specified row in the data set available for retrieval.
Definition: tab.h:363
virtual int getColumnAsString(uint32_t, std::string &) const
Definition: tab.h:393
virtual void estimate(const char *cond, uint64_t &nmin, uint64_t &nmax) const
Estimate the number of rows satisfying the selection conditions.
Definition: tab.h:339
virtual const char * indexSpec(const char *) const
Retrieve the current indexing option.
Definition: tab.h:131
virtual table * select(const char *, const char *) const
Given a set of column names and a set of selection conditions, compute another table that represents ...
Definition: tab.h:287
virtual int getColumnAsDouble(uint32_t, double &) const
Definition: tab.h:392
virtual long getHistogram3D(const char *, const char *, double, double, double, const char *, double, double, double, const char *, double, double, double, std::vector< uint32_t > &) const
Compute a three-dimensional histogram on the named columns.
Definition: tab.h:274
virtual int getColumnAsUByte(const char *, unsigned char &) const
Definition: tab.h:370
virtual void describe(std::ostream &) const
!< Return data types.
Definition: tab.h:332
virtual typeArray columnTypes() const
!< Return column names.
Definition: tab.h:327
virtual table * groupby(const char *) const
Perform a group-by operation.
Definition: tab.h:122
virtual int getColumnAsOpaque(const char *, ibis::opaque &) const
Definition: tab.h:381
virtual int getColumnAsULong(uint32_t cn, uint64_t &val) const
Definition: tab.h:549
virtual int dump(std::ostream &out, uint64_t off, uint64_t nr, const char *sep) const
Print nr rows starting with row offset.
Definition: tab.h:175
virtual int getColumnAsInt(uint32_t, int32_t &) const
Definition: tab.h:387
virtual int getColumnAsOpaque(uint32_t, ibis::opaque &) const
Definition: tab.h:394
virtual int fetch()
Make the next row of the data set available for retrieval.
Definition: tab.h:362
virtual int getColumnAsString(const char *, std::string &) const
Definition: tab.h:532
virtual int getColumnAsByte(uint32_t, char &) const
Definition: tab.h:383
virtual int buildIndex(const char *, const char *)
The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.
Definition: tab.h:296
The top level query expression object.
Definition: qExpr.h:36
virtual int getColumnAsFloat(const char *, float &) const
Definition: tab.h:378
virtual int64_t getColumnAsOpaques(const char *, std::vector< ibis::opaque > &, uint64_t=0, uint64_t=0) const
Retrieve the blobs as ibis::opaque objects.
Definition: tab.h:91
virtual void orderby(const stringArray &)
Reorder the rows.
Definition: tab.h:124
virtual int getColumnAsUInt(const char *, uint32_t &) const
Definition: tab.h:375
A simple struct for storing a row of a table.
Definition: table.h:395
virtual long getHistogram2D(const char *, const char *, double, double, double, const char *, double, double, double, std::vector< uint32_t > &) const
Compute a two-dimension histogram on columns cname1 and cname2.
Definition: tab.h:101
virtual uint64_t nRows() const
The number of rows in this table.
Definition: tab.h:164
virtual ibis::table::cursor * createCursor() const
Create a cursor object to perform row-wise data access.
Definition: tab.h:570
virtual table * groupby(const stringArray &) const
Perform aggregate functions on the current table.
Definition: tab.h:121
virtual int getColumnAsDouble(const char *, double &) const
Definition: tab.h:379
Definition: tab.h:351
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
std::vector< uint64_t > ulongsvalues
!< For ibis::ULONG.
Definition: table.h:411
Cursor class for row-wise data accesses.
Definition: table.h:835
virtual int64_t getColumnAsDoubles(const char *, std::vector< double > &, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:245
virtual table * groupby(const char *) const
Perform a group-by operation.
Definition: tab.h:290
virtual uint32_t nColumns() const
The number of columns in this table.
Definition: tab.h:165
virtual uint64_t getCurrentRowNumber() const
Return the current row number.
Definition: tab.h:495
virtual int64_t getColumnAsDoubles(const char *, double *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:82
virtual void reverseRows()
Reverse the order of the rows.
Definition: tab.h:294
virtual int getColumnAsULong(const char *, uint64_t &) const
Definition: tab.h:377
virtual int dump(std::ostream &out, uint64_t nr, const char *sep) const
Print the first nr rows.
Definition: tab.h:173
virtual int getColumnAsLong(const char *, int64_t &) const
Definition: tab.h:376
virtual int getColumnAsString(uint32_t, std::string &) const
Definition: tab.h:558
virtual double getColumnMin(const char *) const
Compute the minimum of all valid values in the name column.
Definition: tab.h:93
virtual int getColumnAsShort(uint32_t, int16_t &) const
Definition: tab.h:385
virtual int getColumnAsLong(const char *cn, int64_t &val) const
Definition: tab.h:514
virtual void orderby(const char *)
Reorder the rows. The column names are separated by commas.
Definition: tab.h:293
virtual int64_t getColumnAsLongs(const char *cn, int64_t *vals, uint64_t begin=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:210
virtual int64_t getColumnAsUBytes(const char *, unsigned char *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:184
virtual uint64_t getCurrentRowNumber() const
Return the current row number.
Definition: tab.h:366
virtual int backup(const char *, const char *=0, const char *=0) const
The backup operation. It does nothing.
Definition: tab.h:179
virtual int64_t getColumnAsOpaques(const char *, std::vector< ibis::opaque > &, uint64_t=0, uint64_t=0) const
Retrieve the blobs as ibis::opaque objects.
Definition: tab.h:251
virtual void orderby(const stringArray &)
Reorder the rows.
Definition: tab.h:292
virtual int dump(std::ostream &, uint64_t, const char *) const
Print the first nr rows.
Definition: tab.h:47
virtual int dump(std::ostream &, uint64_t, uint64_t, const char *) const
Print nr rows starting with row offset.
Definition: tab.h:48
virtual int getColumnAsFloat(const char *, float &) const
Definition: tab.h:530
!< Eight-byte signed integers, internally int64_t.
Definition: table.h:37
virtual int buildIndexes(const char *)
Create indexes for every column of the table.
Definition: tab.h:129
virtual int buildIndexes(const char *)
Create indexes for every column of the table.
Definition: tab.h:297
virtual int getColumnAsUShort(const char *, uint16_t &) const
Definition: tab.h:373
virtual int64_t getColumnAsDoubles(const char *, std::vector< double > &, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:85
virtual void orderby(const char *)
Reorder the rows. The column names are separated by commas.
Definition: tab.h:125
virtual int dump(std::ostream &, const char *) const
Print the values in ASCII form to the specified output stream.
Definition: tab.h:46
virtual int getColumnAsOpaque(const char *, ibis::opaque &) const
Definition: tab.h:533
virtual int buildIndex(const char *, const char *)
The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.
Definition: tab.h:128
The abstract table class.
Definition: table.h:77
ibis::array_t< ibis::TYPE_T > typeArray
A list of data types.
Definition: table.h:117
virtual double getColumnMax(const char *cn) const
Compute the maximum of all valid values in the name column.
Definition: tab.h:259
virtual int64_t getColumnAsFloats(const char *, float *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:240
void clear()
Clear all names and values.
Definition: table.h:919
virtual int64_t getColumnAsInts(const char *, int32_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:67
virtual int getColumnAsUShort(const char *, uint16_t &) const
Definition: tab.h:510
virtual int fetch(ibis::table::row &res)
Fetch the content of the next row and make the next row as the current row as well.
Definition: tab.h:471
virtual void dumpNames(std::ostream &, const char *) const
Print all column names on one line.
Definition: tab.h:427
virtual int getColumnAsOpaque(uint32_t, ibis::opaque &) const
Definition: tab.h:559
virtual int getColumnAsLong(uint32_t cn, int64_t &val) const
Definition: tab.h:542
virtual typeArray columnTypes() const
!< Return column names.
Definition: tab.h:414
virtual int dump(std::ostream &out, const char *del) const
Print out the values of the current row.
Definition: tab.h:496
virtual int64_t getColumnAsShorts(const char *, int16_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:187
virtual int getColumnAsUShort(uint32_t, uint16_t &) const
Definition: tab.h:538
virtual int getColumnAsUByte(uint32_t, unsigned char &) const
Definition: tab.h:384
virtual int64_t getColumnAsUShorts(const char *, uint16_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:64
virtual table * groupby(const stringArray &) const
Perform aggregate functions on the current table.
Definition: tab.h:289
virtual long getHistogram3D(const char *, const char *, double, double, double, const char *, double, double, double, const char *, double, double, double, std::vector< uint32_t > &) const
Compute a three-dimensional histogram on the named columns.
Definition: tab.h:106
virtual int64_t getColumnAsShorts(const char *, int16_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:61
virtual int getColumnAsShort(const char *, int16_t &) const
Definition: tab.h:372
virtual int getColumnAsUByte(const char *, unsigned char &) const
Definition: tab.h:507
table()
!< Description of the table.
Definition: table.h:460
A trivial class for a table with exactly one row, one column and one integer value.
Definition: tab.h:152
ibis::array_t< const char * > stringArray
A list of strings.
Definition: table.h:114
virtual double getColumnMax(const char *) const
Compute the maximum of all valid values in the name column.
Definition: tab.h:95
virtual void reverseRows()
Reverse the order of the rows.
Definition: tab.h:126
virtual void estimate(const char *cond, uint64_t &nmin, uint64_t &nmax) const
Estimate the number of rows satisfying the selection conditions.
Definition: tab.h:437
virtual double getColumnMin(const char *cn) const
Compute the minimum of all valid values in the name column.
Definition: tab.h:253
virtual int getColumnAsUInt(uint32_t cn, uint32_t &) const
Definition: tab.h:540
virtual int getColumnAsInt(const char *, int32_t &) const
Definition: tab.h:374
virtual int getColumnAsUInt(const char *cn, uint32_t &) const
Definition: tab.h:512
virtual int64_t getColumnAsULongs(const char *, uint64_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:76
virtual uint64_t nRows() const
The number of rows in this table.
Definition: tab.h:38
virtual int64_t getColumnAsDoubles(const char *, double *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:242
virtual void describe(std::ostream &) const
!< Return data types.
Definition: tab.h:420
virtual int64_t getColumnAsLongs(const char *, int64_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:73
virtual int64_t getColumnAsStrings(const char *, std::vector< std::string > &, uint64_t=0, uint64_t=0) const
Retrieve the null-terminated strings as a vector of std::string objects.
Definition: tab.h:248
virtual int getColumnAsByte(const char *, char &) const
Definition: tab.h:369
virtual int64_t getColumnAsBytes(const char *, char *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:182
virtual int getColumnAsUInt(uint32_t, uint32_t &) const
Definition: tab.h:388
virtual int64_t getColumnAsULongs(const char *cn, uint64_t *vals, uint64_t begin=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:225
virtual int getColumnAsULong(uint32_t, uint64_t &) const
Definition: tab.h:390
virtual int getColumnAsByte(const char *, char &) const
Definition: tab.h:506
virtual int64_t getColumnAsBytes(const char *, char *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:55
virtual int fetch(ibis::table::row &)
Fetch the content of the next row and make the next row as the current row as well.
Definition: tab.h:364
virtual table * select(const char *sel, const char *cond) const =0
Given a set of column names and a set of selection conditions, compute another table that represents ...
virtual int getColumnAsUShort(uint32_t, uint16_t &) const
Definition: tab.h:386
virtual int64_t getColumnAsUBytes(const char *, unsigned char *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:58
FastBit Table Interface.
virtual int getColumnAsByte(uint32_t, char &) const
Definition: tab.h:535
virtual int64_t getColumnAsUInts(const char *cn, uint32_t *vals, uint64_t begin=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:195
virtual const char * indexSpec(const char *) const
Retrieve the current indexing option.
Definition: tab.h:299
virtual void indexSpec(const char *, const char *)
Replace the current indexing option.
Definition: tab.h:132
virtual int buildIndexes(const ibis::table::stringArray &)
The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.
Definition: tab.h:130
virtual long getHistogram(const char *, const char *, double, double, double, std::vector< uint32_t > &) const
Definition: tab.h:98
virtual int dump(std::ostream &, const char *del) const
Print out the values of the current row.
Definition: tab.h:367
virtual int64_t getColumnAsUInts(const char *, uint32_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:70
virtual int buildIndexes(const ibis::table::stringArray &)
The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.
Definition: tab.h:298
virtual void indexSpec(const char *, const char *)
Replace the current indexing option.
Definition: tab.h:300
tabele(uint64_t nr=0, const char *nm=0)
Constructor.
Definition: tab.h:161
const char ** TYPESTRING
Human readable version of the enumeration types.
Definition: column.cpp:39
virtual long getHistogram2D(const char *, const char *, double, double, double, const char *, double, double, double, std::vector< uint32_t > &) const
Compute a two-dimension histogram on columns cname1 and cname2.
Definition: tab.h:269
virtual uint32_t nColumns() const
The number of columns in this table.
Definition: tab.h:39
virtual int64_t getColumnAsUShorts(const char *, uint16_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:190
virtual int getColumnAsFloat(uint32_t, float &) const
Definition: tab.h:391
virtual int fetch(uint64_t, ibis::table::row &)
Fetch the content of the specified row and make that row the current row as well. ...
Definition: tab.h:365
virtual long getHistogram(const char *, const char *, double, double, double, std::vector< uint32_t > &) const
Definition: tab.h:266
virtual ibis::table::cursor * createCursor() const
Create a cursor object to perform row-wise data access.
Definition: tab.h:404
virtual int getColumnAsDouble(const char *, double &) const
Definition: tab.h:531
virtual int getColumnAsShort(const char *, int16_t &) const
Definition: tab.h:509
Definition: tab.h:449
virtual void dumpNames(std::ostream &, const char *) const
Print all column names on one line.
Definition: tab.h:45
virtual table * select(const char *, const char *) const
Given a set of column names and a set of selection conditions, compute another table that represents ...
Definition: tab.h:119
virtual int getColumnAsString(const char *, std::string &) const
Definition: tab.h:380
virtual int64_t getColumnAsInts(const char *, int32_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:193
tabele(const char *na, const char *de, uint64_t nr, const char *nm=0)
Constructor.
Definition: tab.h:156
virtual int getColumnAsDouble(uint32_t, double &) const
Definition: tab.h:557
virtual int getColumnAsInt(const char *, int32_t &) const
Definition: tab.h:511
virtual int fetch(uint64_t irow)
Make the specified row in the data set available for retrieval.
Definition: tab.h:463
virtual int64_t getColumnAsFloats(const char *, float *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: tab.h:79

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