28 hyperslab(
unsigned,
const uint64_t*,
const uint64_t*,
29 const uint64_t*,
const uint64_t*);
53 bord(
const char *tn,
const char *td, uint64_t nr,
58 const std::vector<const ibis::dictionary*> *dct=0);
59 bord(
const char *tn,
const char *td,
61 bord(
const char *tn,
const char *td,
71 virtual void describe(std::ostream&)
const;
72 virtual void dumpNames(std::ostream&,
const char*)
const;
73 virtual int dump(std::ostream&,
const char*)
const;
74 virtual int dump(std::ostream&, uint64_t,
const char*)
const;
75 virtual int dumpJSON(std::ostream&, uint64_t)
const;
76 virtual int dump(std::ostream&, uint64_t, uint64_t,
const char*)
const;
77 virtual int backup(
const char* dir,
const char* tname=0,
78 const char* tdesc=0)
const;
81 uint64_t =0, uint64_t =0)
const;
83 uint64_t =0, uint64_t =0)
const;
85 uint64_t =0, uint64_t =0)
const;
87 uint64_t =0, uint64_t =0)
const;
89 uint64_t =0, uint64_t =0)
const;
91 uint64_t =0, uint64_t =0)
const;
93 uint64_t =0, uint64_t =0)
const;
95 uint64_t =0, uint64_t =0)
const;
97 uint64_t =0, uint64_t =0)
const;
99 uint64_t =0, uint64_t =0)
const;
101 uint64_t =0, uint64_t =0)
const;
103 uint64_t =0, uint64_t =0)
const;
105 uint64_t =0, uint64_t =0)
const;
110 double,
double,
double,
111 std::vector<uint32_t>&)
const;
113 double,
double,
double,
115 double,
double,
double,
116 std::vector<uint32_t>&)
const;
118 double,
double,
double,
120 double,
double,
double,
122 double,
double,
double,
123 std::vector<uint32_t>&)
const;
125 virtual void estimate(
const char* cond,
126 uint64_t &nmin, uint64_t &nmax)
const;
128 uint64_t &nmin, uint64_t &nmax)
const;
130 virtual table*
select(
const char* sel,
const char* cond)
const;
136 const std::vector<bool>&);
140 virtual int buildIndex(
const char*,
const char*) {
return -1;}
144 virtual void indexSpec(
const char*,
const char*) {
return;}
145 virtual const char*
indexSpec(
const char*)
const {
return 0;}
162 const std::vector<bool>&);
171 template <
typename T>
176 bool ascending)
const;
177 template <
typename T>
184 bool ascending)
const;
192 void* outbuf,
size_t outpos,
193 const void* inbuf,
size_t inpos);
202 bord(
const std::vector<ibis::bord::column*> &cols, uint32_t nr=0);
210 static int merger(std::vector<ibis::bord::column*>&,
211 std::vector<ibis::bord::column*>&,
212 const std::vector<ibis::bord::column*>&,
213 const std::vector<ibis::bord::column*>&,
214 const std::vector<ibis::selectClause::AGREGADO>&);
216 static int merge0(std::vector<ibis::bord::column*>&,
217 const std::vector<ibis::bord::column*>&,
218 const std::vector<ibis::selectClause::AGREGADO>&);
219 template <
typename T>
static int
224 std::vector<ibis::bord::column*>&,
226 const std::vector<ibis::bord::column*>&,
227 const std::vector<ibis::selectClause::AGREGADO>&);
228 template <
typename Tk>
static int
230 std::vector<ibis::bord::column*> &vout,
232 const std::vector<ibis::bord::column*> &vin1,
234 const std::vector<ibis::bord::column*> &vin2,
235 const std::vector<ibis::selectClause::AGREGADO> &agg);
237 merge10S(std::vector<std::string> &kout,
238 std::vector<ibis::bord::column*> &vout,
239 const std::vector<std::string> &kin1,
240 const std::vector<ibis::bord::column*> &vin1,
241 const std::vector<std::string> &kin2,
242 const std::vector<ibis::bord::column*> &vin2,
243 const std::vector<ibis::selectClause::AGREGADO> &agg);
250 template <
typename Tk,
typename Tv>
static int
258 template <
typename Tv>
static int
259 merge11S(std::vector<std::string> &kout,
261 const std::vector<std::string> &kin1,
263 const std::vector<std::string> &kin2,
275 template <
typename Tk>
static int
285 template <
typename Tk,
typename Tu,
typename Tv>
static int
298 merge12S1(std::vector<std::string> &kout,
299 const std::vector<std::string> &kin1,
300 const std::vector<std::string> &kin2,
307 template <
typename Tu,
typename Tv>
static int
308 merge12S(std::vector<std::string> &kout,
311 const std::vector<std::string> &kin1,
314 const std::vector<std::string> &kin2,
322 std::vector<ibis::bord::column*> &v1,
325 const std::vector<ibis::bord::column*> &v2,
326 const std::vector<ibis::selectClause::AGREGADO> &agg);
327 template <
typename Tk1>
static int
332 std::vector<ibis::bord::column*> &vin1,
334 const std::vector<ibis::bord::column*> &vin2,
335 const std::vector<ibis::selectClause::AGREGADO> &agg);
336 template <
typename Tk1,
typename Tk2>
static int
339 std::vector<ibis::bord::column*> &vout,
342 const std::vector<ibis::bord::column*> &vin1,
345 const std::vector<ibis::bord::column*> &vin2,
346 const std::vector<ibis::selectClause::AGREGADO> &agg);
348 merge20S0(std::vector<std::string> &k1out,
349 std::vector<std::string> &k2out,
350 std::vector<ibis::bord::column*> &vout,
351 const std::vector<std::string> &k1in1,
352 const std::vector<std::string> &k2in1,
353 const std::vector<ibis::bord::column*> &vin1,
354 const std::vector<std::string> &k1in2,
355 const std::vector<std::string> &k2in2,
356 const std::vector<ibis::bord::column*> &vin2,
357 const std::vector<ibis::selectClause::AGREGADO> &agg);
359 merge20S1(std::vector<std::string> &k1out,
360 const std::vector<std::string> &k1in1,
361 const std::vector<std::string> &k1in2,
363 std::vector<ibis::bord::column*> &vin1,
365 const std::vector<ibis::bord::column*> &vin2,
366 const std::vector<ibis::selectClause::AGREGADO> &agg);
367 template <
typename Tk2>
static int
368 merge20S2(std::vector<std::string> &k1out,
370 std::vector<ibis::bord::column*> &vout,
371 const std::vector<std::string> &k1in1,
373 const std::vector<ibis::bord::column*> &vin1,
374 const std::vector<std::string> &k1in2,
376 const std::vector<ibis::bord::column*> &vin2,
377 const std::vector<ibis::selectClause::AGREGADO> &agg);
378 template <
typename Tk1>
static int
380 std::vector<std::string> &k2out,
381 std::vector<ibis::bord::column*> &vout,
383 const std::vector<std::string> &k2in1,
384 const std::vector<ibis::bord::column*> &vin1,
386 const std::vector<std::string> &k2in2,
387 const std::vector<ibis::bord::column*> &vin2,
388 const std::vector<ibis::selectClause::AGREGADO> &agg);
397 template <
typename Tk1>
static int
406 template <
typename Tk1,
typename Tk2>
static int
416 template <
typename Tk1,
typename Tk2,
typename Tv>
static int
428 merge21S1(std::vector<std::string> &k1out,
429 const std::vector<std::string> &k1in1,
430 const std::vector<std::string> &k1in2,
436 template <
typename Tk2>
static int
437 merge21S2(std::vector<std::string> &k1out,
439 const std::vector<std::string> &k1in1,
441 const std::vector<std::string> &k1in2,
446 template <
typename Tk2,
typename Tv>
static int
447 merge21S3(std::vector<std::string> &k1out,
450 const std::vector<std::string> &k1in1,
453 const std::vector<std::string> &k1in2,
458 merge21S4(std::vector<std::string> &k1out,
459 std::vector<std::string> &k2out,
460 const std::vector<std::string> &k1in1,
461 const std::vector<std::string> &k2in1,
462 const std::vector<std::string> &k1in2,
463 const std::vector<std::string> &k2in2,
467 template <
typename Tv>
static int
468 merge21S5(std::vector<std::string> &k1out,
469 std::vector<std::string> &k2out,
471 const std::vector<std::string> &k1in1,
472 const std::vector<std::string> &k2in1,
474 const std::vector<std::string> &k1in2,
475 const std::vector<std::string> &k2in2,
478 template <
typename Tk1>
static int
480 std::vector<std::string> &k2out,
482 const std::vector<std::string> &k2in1,
484 const std::vector<std::string> &k2in2,
488 template <
typename Tk1,
typename Tv>
static int
490 std::vector<std::string> &k2out,
493 const std::vector<std::string> &k2in1,
496 const std::vector<std::string> &k2in2,
520 void *buf=0,
const char* desc=
"",
double low=DBL_MAX,
521 double high=-DBL_MAX);
523 uint64_t *dim, uint64_t nd);
526 double lo=DBL_MAX,
double hi=-DBL_MAX);
542 virtual long stringSearch(
const std::vector<std::string>&,
545 virtual long stringSearch(
const std::vector<std::string>&)
const;
550 virtual long keywordSearch(
const std::vector<std::string>&)
const;
564 virtual std::vector<std::string>*
566 virtual std::vector<ibis::opaque>*
567 selectOpaques(
const bitvector &mask)
const;
569 virtual long append(
const char* dt,
const char* df,
const uint32_t nold,
570 const uint32_t nnew, uint32_t nbuf,
char* buf);
578 virtual void computeMinMax(
const char *,
double &,
double &,
bool &)
const;
581 int limit(uint32_t nr);
583 virtual int getString(uint32_t, std::string &)
const;
586 void*& getArray() {
return buffer;}
587 void* getArray()
const {
return buffer;}
588 int dump(std::ostream &out, uint32_t i)
const;
593 inline void append(
const void*, uint32_t);
594 inline void append(
const void*, uint32_t,
const void*, uint32_t,
601 template <
typename T>
static int
604 static int addStrings(std::vector<std::string>*&, uint32_t,
605 const std::vector<std::string>&);
606 static int addBlobs(std::vector<ibis::opaque>*&, uint32_t,
607 const std::vector<ibis::opaque>&);
647 virtual uint64_t nRows()
const {
return tab.nRows();}
648 virtual uint32_t nColumns()
const {
return tab.nColumns();}
650 return tab.columnNames();}
652 return tab.columnTypes();}
654 virtual int fetch(uint64_t);
658 virtual int dump(std::ostream &out,
const char* del)
const;
696 typedef std::map<const char*, uint32_t, ibis::lessi> bufferMap;
697 std::vector<bufferElement> buffer;
703 int dumpIJ(std::ostream&, uint32_t, uint32_t)
const;
716 const void* inbuf,
size_t inpos) {
719 LOGGER(ibis::gVerbose > 0)
720 <<
"Warning -- bord::copyValue can not copy a value of type "
764 (*
static_cast<std::vector<ibis::opaque>*
>(outbuf))[outpos]
765 = (*
static_cast<const std::vector<ibis::opaque>*
>(inbuf))[inpos];
769 (*
static_cast<std::vector<std::string>*
>(outbuf))[outpos]
770 = (*
static_cast<const std::vector<std::string>*
>(inbuf))[inpos];
778 uint32_t i, uint32_t j)
const {
779 if (m_type != other.
m_type)
return false;
780 if (buffer == 0 || other.
buffer == 0)
return false;
781 if (buffer == other.
buffer && i == j)
return true;
785 LOGGER(ibis::gVerbose > 0)
786 <<
"Warning -- bord::column[" << (thePart ? thePart->name() :
"")
787 <<
'.' << m_name <<
"]::equal_to can not compare values of type "
795 return (v0[i] == v1[j]);}
801 return (v0[i] == v1[j]);}
807 return (v0[i] == v1[j]);}
813 return (v0[i] == v1[j]);}
819 return (v0[i] == v1[j]);}
825 return (v0[i] == v1[j]);}
831 return (v0[i] == v1[j]);}
838 return (v0[i] == v1[j]);}
844 return (v0[i] == v1[j]);}
850 return (v0[i] == v1[j]);}
852 const ibis::opaque &v0 =
853 (*
static_cast<const std::vector<ibis::opaque>*
>(buffer))[i];
854 const ibis::opaque &v1 =
855 (*
static_cast<const std::vector<ibis::opaque>*
>(other.
buffer))[j];
856 bool match = (v0.size() == v1.size());
857 for (
size_t j = 0; match && j < v0.size(); ++ j)
858 match = (v0.address()[j] == v1.address()[j]);
862 const std::string &v0 =
863 (*
static_cast<const std::vector<std::string>*
>(buffer))[i];
864 const std::string &v1 =
865 (*
static_cast<const std::vector<std::string>*
>(other.
buffer))[j];
873 uint32_t i, uint32_t j)
const {
874 if (m_type != other.
m_type)
return false;
875 if (buffer == 0 || other.
buffer == 0)
return false;
876 if (buffer == other.
buffer && i == j)
return true;
880 LOGGER(ibis::gVerbose > 0)
881 <<
"Warning -- bord::column[" << (thePart ? thePart->name() :
"")
882 <<
'.' << m_name <<
"]::less_than can not compare values of type "
890 return (v0[i] < v1[j]);}
896 return (v0[i] < v1[j]);}
902 return (v0[i] < v1[j]);}
908 return (v0[i] < v1[j]);}
914 return (v0[i] < v1[j]);}
920 return (v0[i] < v1[j]);}
926 return (v0[i] < v1[j]);}
933 return (v0[i] < v1[j]);}
939 return (v0[i] < v1[j]);}
945 return (v0[i] < v1[j]);}
947 const ibis::opaque &v0 =
948 (*
static_cast<const std::vector<ibis::opaque>*
>(buffer))[i];
949 const ibis::opaque &v1 =
950 (*
static_cast<const std::vector<ibis::opaque>*
>(other.
buffer))[j];
951 const size_t minlen = (v0.size() <= v1.size() ? v0.size() : v1.size());
953 for (
size_t j = 0; cmp == 0 && j < v0.size(); ++ j)
954 cmp = ((
int)(v0.address()[j]) - (
int)(v1.address()[j]));
955 if (cmp == 0 && v1.size() > minlen)
960 const std::string &v0 =
961 (*
static_cast<const std::vector<std::string>*
>(buffer))[i];
962 const std::string &v1 =
963 (*
static_cast<const std::vector<std::string>*
>(other.
buffer))[j];
976 LOGGER(ibis::gVerbose > 0)
977 <<
"Warning -- bord::column[" << (thePart ? thePart->name() :
"")
978 <<
'.' << m_name <<
"]::append can not handle data type "
1053 std::vector<std::string> &v0 =
1054 *(
static_cast<std::vector<std::string>*
>(buffer));
1055 const std::vector<std::string> &v1 =
1056 *(
static_cast<const std::vector<std::string>*
>(c1));
1057 v0.push_back(v1[i1]);
1060 std::vector<ibis::opaque> &v0 =
1061 *(
static_cast<std::vector<ibis::opaque>*
>(buffer));
1062 const std::vector<ibis::opaque> &v1 =
1063 *(
static_cast<const std::vector<ibis::opaque>*
>(c1));
1064 v0.push_back(v1[i1]);
1076 const void* c2, uint32_t i2,
1080 LOGGER(ibis::gVerbose > 0)
1081 <<
"Warning -- bord::column[" << (thePart ? thePart->name() :
"")
1082 <<
'.' << m_name <<
"]::append can not handle data type "
1092 signed char tmp = 0;
1096 case ibis::selectClause::CNT:
1097 case ibis::selectClause::SUM:
1098 tmp = v1[i1] + v2[i2];
1100 case ibis::selectClause::MIN:
1101 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1103 case ibis::selectClause::MAX:
1104 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1116 unsigned char tmp = 0;
1120 case ibis::selectClause::CNT:
1121 case ibis::selectClause::SUM:
1122 tmp = v1[i1] + v2[i2];
1124 case ibis::selectClause::MIN:
1125 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1127 case ibis::selectClause::MAX:
1128 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1144 case ibis::selectClause::CNT:
1145 case ibis::selectClause::SUM:
1146 tmp = v1[i1] + v2[i2];
1148 case ibis::selectClause::MIN:
1149 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1151 case ibis::selectClause::MAX:
1152 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1168 case ibis::selectClause::CNT:
1169 case ibis::selectClause::SUM:
1170 tmp = v1[i1] + v2[i2];
1172 case ibis::selectClause::MIN:
1173 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1175 case ibis::selectClause::MAX:
1176 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1192 case ibis::selectClause::CNT:
1193 case ibis::selectClause::SUM:
1194 tmp = v1[i1] + v2[i2];
1196 case ibis::selectClause::MIN:
1197 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1199 case ibis::selectClause::MAX:
1200 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1216 case ibis::selectClause::CNT:
1217 case ibis::selectClause::SUM:
1218 tmp = v1[i1] + v2[i2];
1220 case ibis::selectClause::MIN:
1221 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1223 case ibis::selectClause::MAX:
1224 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1240 case ibis::selectClause::CNT:
1241 case ibis::selectClause::SUM:
1242 tmp = v1[i1] + v2[i2];
1244 case ibis::selectClause::MIN:
1245 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1247 case ibis::selectClause::MAX:
1248 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1264 case ibis::selectClause::CNT:
1265 case ibis::selectClause::SUM:
1266 tmp = v1[i1] + v2[i2];
1268 case ibis::selectClause::MIN:
1269 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1271 case ibis::selectClause::MAX:
1272 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1288 case ibis::selectClause::CNT:
1289 case ibis::selectClause::SUM:
1290 tmp = v1[i1] + v2[i2];
1292 case ibis::selectClause::MIN:
1293 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1295 case ibis::selectClause::MAX:
1296 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1312 case ibis::selectClause::CNT:
1313 case ibis::selectClause::SUM:
1314 tmp = v1[i1] + v2[i2];
1316 case ibis::selectClause::MIN:
1317 tmp = (v1[i1] <= v2[i2] ? v1[i1] : v2[i2]);
1319 case ibis::selectClause::MAX:
1320 tmp = (v1[i1] >= v2[i2] ? v1[i1] : v2[i2]);
1330 return (0 - (curRow >= (int64_t) tab.nRows()));
1334 if (irow < tab.nRows()) {
1335 curRow =
static_cast<int64_t
>(irow);
1345 if ((uint64_t) curRow < tab.nRows()) {
1355 if (irow < tab.nRows()) {
1356 curRow =
static_cast<int64_t
>(irow);
1366 ibis::bord::cursor::dumpIJ(std::ostream &out, uint32_t i,
1368 if (buffer[j].cval == 0)
return -1;
1370 switch (buffer[j].ctype) {
1374 out << (int) ((*vals)[i]);
1379 out << (
unsigned int) ((*vals)[i]);
1382 const array_t<const int16_t>* vals =
1383 static_cast<const array_t<const int16_t>*
>(buffer[j].cval);
1387 const array_t<const uint16_t>* vals =
1388 static_cast<const array_t<const uint16_t>*
>(buffer[j].cval);
1392 const array_t<const int32_t>* vals =
1393 static_cast<const array_t<const int32_t>*
>(buffer[j].cval);
1397 const array_t<const uint32_t>* vals =
1398 static_cast<const array_t<const uint32_t>*
>(buffer[j].cval);
1399 if (buffer[j].dic == 0) {
1402 else if (buffer[j].dic->size() >= (*vals)[i]) {
1403 out << buffer[j].dic->operator[]((*vals)[i]);
1410 const array_t<const int64_t>* vals =
1411 static_cast<const array_t<const int64_t>*
>(buffer[j].cval);
1415 const array_t<const uint64_t>* vals =
1416 static_cast<const array_t<const uint64_t>*
>(buffer[j].cval);
1420 const array_t<const float>* vals =
1421 static_cast<const array_t<const float>*
>(buffer[j].cval);
1425 const array_t<const double>* vals =
1426 static_cast<const array_t<const double>*
>(buffer[j].cval);
1431 const std::vector<std::string>* vals =
1432 static_cast<const std::vector<std::string>*
>(buffer[j].cval);
1433 out <<
'"' << (*vals)[i] <<
'"';
1443 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1445 bufferMap::const_iterator it = bufmap.find(cn);
1446 if (it != bufmap.end())
1447 return getColumnAsByte((*it).second, val);
1454 unsigned char &val)
const {
1455 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1457 bufferMap::const_iterator it = bufmap.find(cn);
1458 if (it != bufmap.end())
1459 return getColumnAsUByte((*it).second, val);
1466 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1468 bufferMap::const_iterator it = bufmap.find(cn);
1469 if (it != bufmap.end())
1470 return getColumnAsShort((*it).second, val);
1477 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1479 bufferMap::const_iterator it = bufmap.find(cn);
1480 if (it != bufmap.end())
1481 return getColumnAsUShort((*it).second, val);
1488 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1490 bufferMap::const_iterator it = bufmap.find(cn);
1491 if (it != bufmap.end())
1492 return getColumnAsInt((*it).second, val);
1499 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1501 bufferMap::const_iterator it = bufmap.find(cn);
1502 if (it != bufmap.end())
1503 return getColumnAsUInt((*it).second, val);
1510 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1512 bufferMap::const_iterator it = bufmap.find(cn);
1513 if (it != bufmap.end())
1514 return getColumnAsLong((*it).second, val);
1521 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1523 bufferMap::const_iterator it = bufmap.find(cn);
1524 if (it != bufmap.end())
1525 return getColumnAsULong((*it).second, val);
1532 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1534 bufferMap::const_iterator it = bufmap.find(cn);
1535 if (it != bufmap.end())
1536 return getColumnAsFloat((*it).second, val);
1543 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1545 bufferMap::const_iterator it = bufmap.find(cn);
1546 if (it != bufmap.end())
1547 return getColumnAsDouble((*it).second, val);
1554 std::string &val)
const {
1555 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1557 bufferMap::const_iterator it = bufmap.find(cn);
1558 if (it != bufmap.end())
1559 return getColumnAsString((*it).second, val);
1566 ibis::opaque &val)
const {
1567 if (curRow < 0 || curRow >= (int64_t) tab.nRows() || cn == 0 || *cn == 0)
1569 bufferMap::const_iterator it = bufmap.find(cn);
1570 if (it != bufmap.end())
1571 return getColumnAsOpaque((*it).second, val);
1575 #endif // IBIS_BORD_H
static int merge21T2(ibis::array_t< Tk1 > &k1out, ibis::array_t< Tk2 > &k2out, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk2 > &k2in1, const ibis::array_t< Tk1 > &k1in2, const ibis::array_t< Tk2 > &k2in2, ibis::bord::column &v1, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
Merge two key columns with one value column.
Definition: bordm.cpp:5643
static int merge12(ibis::bord::column &, ibis::bord::column &, ibis::bord::column &, const ibis::bord::column &, const ibis::bord::column &, const ibis::bord::column &, ibis::selectClause::AGREGADO, ibis::selectClause::AGREGADO)
Merge two aggregations sharing the same key.
Definition: bordm.cpp:1987
virtual int64_t getColumnAsShorts(const char *, int16_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:622
virtual int getColumnAsOpaque(const char *, ibis::opaque &) const
Definition: bord.h:1565
int(* FastBitReadExtArray)(void *context, uint64_t nd, uint64_t *starts, uint64_t *counts, void *data)
A function prototype for reading a portion of an external array.
Definition: const.h:365
!< One bit per record, represented by a bit vector.
Definition: table.h:44
virtual int64_t getColumnAsDoubles(const char *, double *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:1143
virtual int64_t getColumnAsULongs(const char *, uint64_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:982
ibis::bord * evaluateTerms(const ibis::selectClause &, const char *) const
Evaluate the arithmetic expressions in the select clause to derive an in-memory data table...
Definition: bord.cpp:4289
virtual void dumpNames(std::ostream &, const char *) const
Print all column names on one line.
Definition: bord.cpp:2085
virtual int getColumnAsUInt(const char *, uint32_t &) const
Definition: bord.h:1498
long sortStrings(std::vector< std::string > &vals, array_t< uint32_t > &starts, array_t< uint32_t > &idxout, const array_t< uint32_t > &idxin, bool ascending) const
Sort the string values.
Definition: bord.cpp:4072
bool equal_to(const column &) const
Does this column have the same values as the other.
Definition: bord.cpp:12036
virtual int64_t getColumnAsUInts(const char *, uint32_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:808
static ibis::bord * groupbya(const ibis::bord &, const ibis::selectClause &)
Perform the aggregation operations specified in the select clause.
Definition: bord.cpp:3342
virtual array_t< uint16_t > * selectUShorts(const ibis::bitvector &) const
Return selected rows of the column in an array_t object.
Definition: bord.cpp:7111
virtual array_t< int32_t > * selectInts(const ibis::bitvector &) const
Return selected rows of the column in an array_t object.
Definition: bord.cpp:7248
int restoreCategoriesAsStrings(const ibis::category &)
Convert the integer representation back to the string representation.
Definition: bord.cpp:11525
virtual long append(const char *dt, const char *df, const uint32_t nold, const uint32_t nnew, uint32_t nbuf, char *buf)
Append new data in directory df to the end of existing data in dt.
Definition: bord.cpp:11549
FastBitReadExtArray xreader
Reader for externally managed data.
Definition: bord.h:625
virtual int buildIndexes(const ibis::table::stringArray &)
The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.
Definition: bord.h:141
static int merge0(std::vector< ibis::bord::column * > &, const std::vector< ibis::bord::column * > &, const std::vector< ibis::selectClause::AGREGADO > &)
Merge values according to the given operators.
Definition: bordm.cpp:275
uint32_t nColumns() const
Return the number of attributes in the partition.
Definition: part.h:84
void copyColumn(const char *, ibis::TYPE_T &, void *&, const ibis::dictionary *&) const
Copy the type and values of the named column.
Definition: bord.cpp:4590
virtual int64_t getColumnAsBytes(const char *, char *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:571
static int merge21(ibis::bord::column &k11, ibis::bord::column &k21, ibis::bord::column &v1, const ibis::bord::column &k12, const ibis::bord::column &k22, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
Merge two key columns with one value column.
Definition: bordm.cpp:5394
Simple range condition.
Definition: qExpr.h:252
The storage class treats all memory as char*.
Definition: fileManager.h:237
!< Four-byte signed integers, internally int32_t.
Definition: table.h:35
virtual table * groupby(const ibis::table::stringArray &) const
Perform aggregate functions on the current table.
Definition: bord.cpp:2998
void addCounts(uint32_t)
Extend the buffer to have nr elements.
Definition: bord.cpp:11967
virtual ~column()
Destructor.
Definition: bord.cpp:5624
The top level query expression object.
Definition: qExpr.h:36
virtual int buildIndexes(const char *iopt, int nthr)
Make sure indexes for all columns are available.
Definition: part.cpp:6500
A simple struct for storing a row of a table.
Definition: table.h:395
virtual array_t< uint32_t > * selectUInts(const ibis::bitvector &) const
Can be called on columns of unsigned integral types, UINT, CATEGORY, USHORT, and UBYTE.
Definition: bord.cpp:7573
ibis::array_t< uint64_t > vals
An array of size 4*ndim with ndim quadruples of (start, stride, count, block).
Definition: bord.h:38
int64_t computeHits(const char *cond) const
Compute the number of hits.
Definition: bord.cpp:2003
A class to represent the select clause.
Definition: selectClause.h:112
int merge(const ibis::bord &, const ibis::selectClause &)
Merge the incoming data partition with this one.
Definition: bordm.cpp:20
virtual table * select(const char *sel, const char *cond) const
Given a set of column names and a set of selection conditions, compute another table that represents ...
Definition: bord.cpp:1996
virtual int fetch()
Make the next row of the data set available for retrieval.
Definition: bord.h:1328
long reorderStrings(std::vector< std::string > &vals, const array_t< uint32_t > &ind) const
Reorder the vector of strings.
Definition: bord.cpp:4241
Byte array.
Definition: table.h:56
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
Cursor class for row-wise data accesses.
Definition: table.h:835
!< 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 int getColumnAsUShort(const char *, uint16_t &) const
Definition: bord.h:1476
static int merge21T1(ibis::array_t< Tk1 > &k1out, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk1 > &k1in2, ibis::bord::column &k21, ibis::bord::column &v1, const ibis::bord::column &k22, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
Merge two key columns with one value column.
Definition: bordm.cpp:5518
virtual void indexSpec(const char *, const char *)
Replace the current indexing option.
Definition: bord.h:144
static int merge20T2(ibis::array_t< Tk1 > &k1out, ibis::array_t< Tk2 > &k2out, std::vector< ibis::bord::column * > &vout, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk2 > &k2in1, const std::vector< ibis::bord::column * > &vin1, const ibis::array_t< Tk1 > &k1in2, const ibis::array_t< Tk2 > &k2in2, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
Merge in-memory table with two keys and more than one value columns.
Definition: bordm.cpp:4919
virtual ibis::table::cursor * createCursor() const
Create a cursor object to perform row-wise data access.
Definition: bord.cpp:4995
static int merge21T3(ibis::array_t< Tk1 > &k1out, ibis::array_t< Tk2 > &k2out, ibis::array_t< Tv > &vout, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk2 > &k2in1, const ibis::array_t< Tv > &vin1, const ibis::array_t< Tk1 > &k1in2, const ibis::array_t< Tk2 > &k2in2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO av)
Merge two key columns with one value column.
Definition: bordm.cpp:5780
virtual array_t< unsigned char > * selectUBytes(const ibis::bitvector &) const
Return selected rows of the column in an array_t object.
Definition: bord.cpp:6842
void push_back(const T &elm)
Add one element from the back.
Definition: array_t.h:204
int restoreCategoriesAsStrings(const ibis::part &)
Convert the integer representation of categorical columns back to the string representation.
Definition: bord.cpp:4570
static int merger(std::vector< ibis::bord::column * > &, std::vector< ibis::bord::column * > &, const std::vector< ibis::bord::column * > &, const std::vector< ibis::bord::column * > &, const std::vector< ibis::selectClause::AGREGADO > &)
Merge values from two partial results and place the final resules in the first argument.
Definition: bordm.cpp:172
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: bord.cpp:1659
virtual void orderby(const stringArray &)=0
Reorder the rows.
void * buffer
The in-memory storage.
Definition: bord.h:623
!< Two-byte unsigned integers, internally uint16_t.
Definition: table.h:34
virtual int getColumnAsUByte(const char *, unsigned char &) const
Definition: bord.h:1453
virtual int getColumnAsDouble(const char *, double &) const
Definition: bord.h:1542
virtual void computeMinMax()
Compute the actual min/max values.
Definition: bord.cpp:5710
refHolder< T > ref(T &r)
A function template to produce refHolder.
Definition: util.h:1258
virtual int64_t getColumnAsUShorts(const char *, uint16_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:679
virtual const ibis::dictionary * getDictionary() const
Return the dictionary associated with the column.
Definition: bord.h:612
virtual int dumpJSON(std::ostream &, uint64_t) const
Dump out the first nr rows in JSON format.
Definition: bord.cpp:2146
virtual ibis::table::typeArray columnTypes() const
!< Return column names.
Definition: bord.cpp:567
virtual int getValuesArray(void *) const
Makes a copy of the in-memory data.
Definition: bord.cpp:11127
virtual int64_t getColumnAsLongs(const char *, int64_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:865
virtual long stringSearch(const char *, ibis::bitvector &) const
Locate the strings that match the given string.
Definition: bord.cpp:6273
static int merge11T(ibis::array_t< Tk > &kout, ibis::array_t< Tv > &vout, const ibis::array_t< Tk > &kin1, const ibis::array_t< Tv > &vin1, const ibis::array_t< Tk > &kin2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO agg)
Template to perform merge operation with one column as key and one column as value.
Definition: bordm.cpp:1841
Arbitrary null-terminated strings.
Definition: table.h:51
hyperslab()
Default constructor.
Definition: bord.h:27
void setDictionary(const ibis::dictionary *d)
Assign the dictionary to use.
Definition: bord.h:614
virtual int dump(std::ostream &out, const char *del) const
Print the content of the current row.
Definition: bord.cpp:12173
int setMeshShape(uint64_t *, uint64_t)
Specify the shape of the array.
Definition: bord.cpp:12128
!< Two-byte signed integers, internally int16_t.
Definition: table.h:33
!< Eight-byte signed integers, internally int64_t.
Definition: table.h:37
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: bord.cpp:1420
virtual array_t< uint64_t > * selectULongs(const ibis::bitvector &) const
Return selected rows of the column in an array_t object.
Definition: bord.cpp:8283
int limit(uint32_t nr)
Reduce the number of rows stored in this column object to nr.
Definition: bord.cpp:11424
!< One-byte unsigned integers, internally unsigned char.
Definition: table.h:32
int limit(uint32_t)
Reset the number of rows in the data partition to be nr.
Definition: bord.cpp:4272
virtual array_t< int16_t > * selectShorts(const ibis::bitvector &) const
Return selected rows of the column in an array_t object.
Definition: bord.cpp:6925
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: bord.cpp:1931
The abstract table class.
Definition: table.h:77
!< Four-byte IEEE floating-point numbers, internally float.
Definition: table.h:39
virtual long patternSearch(const char *) const
Compute an estimate of the maximum number of possible matches.
Definition: bord.cpp:6621
virtual int64_t getColumnAsUBytes(const char *, unsigned char *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:597
Defines minor utility functions and common classes used by FastBit.
ibis::table * xgroupby(const ibis::selectClause &) const
The actual function to perform the group by operation.
Definition: bord.cpp:3009
virtual array_t< int64_t > * selectLongs(const ibis::bitvector &) const
Can be called on all integral types.
Definition: bord.cpp:7783
The class ibis::part represents a partition of a relational table.
Definition: part.h:27
virtual double getColumnMin(const char *) const
Compute the minimum of all valid values in the name column.
Definition: bord.cpp:1877
TYPE_T
Supported data types.
Definition: table.h:25
virtual array_t< double > * selectDoubles(const ibis::bitvector &) const
Put the selected values into an array as doubles.
Definition: bord.cpp:9088
An in-memory version of ibis::column.
Definition: bord.h:517
virtual array_t< signed char > * selectBytes(const ibis::bitvector &) const
Retrieve selected 1-byte integer values.
Definition: bord.cpp:6710
virtual int buildIndex(const char *, const char *)
The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.
Definition: bord.h:140
static int addIncoreData(array_t< T > *&to, uint32_t nold, const array_t< T > &from, const T special)
Append new data (in from) to a larger array (pointed to by to).
Definition: bord.cpp:11981
virtual long evaluateRange(const ibis::qContinuousRange &cmp, const ibis::bitvector &mask, ibis::bitvector &res) const
Compute the exact answer.
Definition: column.cpp:6029
virtual int getColumnAsULong(const char *, uint64_t &) const
Definition: bord.h:1520
virtual bool hasRawData() const
Does the raw data file exist?
Definition: bord.cpp:12146
Declares ibis::selectClause class.
virtual int getColumnAsInt(const char *, int32_t &) const
Definition: bord.h:1487
static void copyValue(ibis::TYPE_T type, void *outbuf, size_t outpos, const void *inbuf, size_t inpos)
Copy a single value from inbuf to outbuf.
Definition: bord.h:715
static ibis::bord * groupbyc(const ibis::bord &, const ibis::selectClause &)
The function to perform the final computations specified by the select clause.
Definition: bord.cpp:3519
Class ibis::bord stores all its data in memory.
Definition: bord.h:51
virtual int getColumnAsFloat(const char *, float &) const
Definition: bord.h:1531
const ibis::dictionary * dic
A dictionary.
Definition: bord.h:630
virtual const char * indexSpec(const char *) const
Retrieve the current indexing option.
Definition: bord.h:145
static int merge20T1(ibis::array_t< Tk1 > &k1out, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk1 > &k1in2, ibis::bord::column &k21, std::vector< ibis::bord::column * > &vin1, const ibis::bord::column &k22, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
Merge with two key columns and arbitrary number of value columns.
Definition: bordm.cpp:4778
A specialized low-cardinality text field.
Definition: category.h:120
virtual ibis::table::stringArray columnNames() const
Definition: bord.cpp:563
A special eight-byte ID type for internal use.
Definition: table.h:29
virtual int dump(std::ostream &, const char *) const
Print the values in ASCII form to the specified output stream.
Definition: bord.cpp:2138
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: bord.cpp:1906
virtual array_t< float > * selectFloats(const ibis::bitvector &) const
Put selected values of a float column into an array.
Definition: bord.cpp:8784
virtual void orderby(const ibis::table::stringArray &)
Reorder the rows.
Definition: bord.cpp:3605
virtual long reorder()
Sort rows with the lowest cardinality column first.
Definition: bord.cpp:3615
virtual int64_t getColumnAsInts(const char *, int32_t *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:721
static int merge10(ibis::bord::column &, std::vector< ibis::bord::column * > &, const ibis::bord::column &, const std::vector< ibis::bord::column * > &, const std::vector< ibis::selectClause::AGREGADO > &)
Merge with one key column and an arbitrary number of value columns.
Definition: bordm.cpp:402
ibis::TYPE_T m_type
!< The entries marked 1 are valid.
Definition: column.h:413
virtual int getColumnAsShort(const char *, int16_t &) const
Definition: bord.h:1465
long reorderValues(const char *fname, array_t< uint32_t > &starts, array_t< uint32_t > &indout, const array_t< uint32_t > &indin, bool ascending)
Write the named data file in a segmented sorted order.
Definition: parti.cpp:529
virtual void estimate(const char *cond, uint64_t &nmin, uint64_t &nmax) const
Estimate the number of rows satisfying the selection conditions.
Definition: bord.cpp:1960
long sortValues(array_t< T > &vals, array_t< uint32_t > &starts, array_t< uint32_t > &indout, const array_t< uint32_t > &indin, bool ascending) const
A simple sorting procedure.
Definition: bord.cpp:3927
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 int getColumnAsString(const char *, std::string &) const
Definition: bord.h:1553
virtual long getHistogram(const char *, const char *, double, double, double, std::vector< uint32_t > &) const
Definition: bord.cpp:1885
Class ibis::hyperslab for recording a HDF5 style hyperslab.
Definition: bord.h:23
virtual int backup(const char *dir, const char *tname=0, const char *tdesc=0) const
Write the content of partition into the specified directory dir.
Definition: bord.cpp:2586
virtual double getColumnMax(const char *) const
Compute the maximum of all valid values in the name column.
Definition: bord.cpp:1881
Unknown type, a place holder. Can not process data of this type!
Definition: table.h:27
static int merge11(ibis::bord::column &, ibis::bord::column &, const ibis::bord::column &, const ibis::bord::column &, ibis::selectClause::AGREGADO)
Function to merge one column as key and one column as value.
Definition: bordm.cpp:648
virtual ibis::fileManager::storage * getRawData() const
Retrieve the raw data buffer as an ibis::fileManager::storage.
Definition: bord.cpp:5643
virtual int64_t getColumnAsFloats(const char *, float *, uint64_t=0, uint64_t=0) const
Retrieve all values of the named column.
Definition: bord.cpp:1054
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 void describe(std::ostream &) const
!< Return data types.
Definition: bord.cpp:2019
virtual void reverseRows()
Reverse the order of the rows.
Definition: bord.cpp:4259
virtual int getColumnAsLong(const char *, int64_t &) const
Definition: bord.h:1509
const char * name() const
Name of the column.
Definition: column.h:78
int append(const ibis::selectClause &, const ibis::part &, const ibis::bitvector &)
Append the values marked 1 to this data partition.
Definition: bord.cpp:4715
!< One-byte signed integers, internally char.
Definition: table.h:31
virtual int getColumnAsByte(const char *, char &) const
Definition: bord.h:1442
virtual uint64_t getCurrentRowNumber() const
Return the current row number.
Definition: bord.h:657
unsigned ndim
The number of dimensions of the mesh.
Definition: bord.h:34
virtual long keywordSearch(const char *, ibis::bitvector &) const
Find the given keyword and return the rows.
Definition: bord.cpp:6458
virtual int getPartitions(ibis::constPartList &) const
Retrieve the list of partitions.
Definition: table.h:225
const char ** TYPESTRING
Human readable version of the enumeration types.
Definition: column.cpp:39
A discrete range expression.
Definition: qExpr.h:337
virtual uint64_t nRows() const
The number of rows in this table.
Definition: bord.h:65
!< Four-byte unsigned integers, internally uint32_t.
Definition: table.h:36
virtual std::vector< std::string > * selectStrings(const bitvector &mask) const
Output the selected values as strings.
Definition: bord.cpp:9734
Provide a dual-directional mapping between strings and integers.
Definition: dict-0.h:19
virtual int buildIndexes(const char *)
Create indexes for every column of the table.
Definition: bord.h:142
uint32_t nEvents
!< List of the columns.
Definition: part.h:731
static int merge0T(ibis::array_t< T > &, const ibis::array_t< T > &, ibis::selectClause::AGREGADO)
Template function to perform the merger operations on arrays with matching keys.
Definition: bordm.cpp:376
column(const ibis::bord *tbl, ibis::TYPE_T t, const char *name, void *buf=0, const char *desc="", double low=DBL_MAX, double high=-DBL_MAX)
Constructor.
Definition: bord.cpp:5222
void clear()
Clear the existing content.
Definition: bord.cpp:556
ibis::array_t< uint64_t > shape
Shape of the mesh for the data.
Definition: bord.h:637
bool less_than(const column &, uint32_t, uint32_t) const
Is the ith value of this column less than the jth value of other?
Definition: bord.h:872
Define a dictionary data structure used by ibis::category.
void * xmeta
Context to be passed back to reader.
Definition: bord.h:627
Define the class ibis::part.
bord()
Default constructor. Creates a empty unnamed data partition.
Definition: bord.h:206
virtual long evaluateRange(const ibis::qContinuousRange &cmp, const ibis::bitvector &mask, ibis::bitvector &res) const
Compute the exact answer.
Definition: bord.cpp:5801
static int merge10T(ibis::array_t< Tk > &kout, std::vector< ibis::bord::column * > &vout, const ibis::array_t< Tk > &kin1, const std::vector< ibis::bord::column * > &vin1, const ibis::array_t< Tk > &kin2, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
Perform merge operation with one key column and an arbitrary number of value columns.
Definition: bordm.cpp:532
virtual int getString(uint32_t, std::string &) const
Return the string at the ith row.
Definition: bord.cpp:10665
void tobitvector(uint32_t, const uint64_t *, ibis::bitvector &) const
Convert to a bitvector.
Definition: bord.cpp:13024
static int merge20(ibis::bord::column &k11, ibis::bord::column &k21, std::vector< ibis::bord::column * > &v1, const ibis::bord::column &k12, const ibis::bord::column &k22, const std::vector< ibis::bord::column * > &v2, const std::vector< ibis::selectClause::AGREGADO > &agg)
Merge with two key columns and arbitrary number of value columns.
Definition: bordm.cpp:4655
virtual uint32_t nColumns() const
The number of columns in this table.
Definition: bord.h:66