30 UNKNOWN_STATE=0, STABLE_STATE, RECEIVING_STATE,
31 PRETRANSITION_STATE, TRANSITION_STATE, POSTTRANSITION_STATE
43 explicit part(
const char* name=0,
bool ro=
false);
45 part(
const char* adir,
const char* bdir,
bool ro=
false);
47 part(
const std::vector<const char*> &mtags,
bool ro=
false);
49 part(
const ibis::resource::vList &mtags,
bool ro=
false);
59 void loadIndexes(
const char* iopt=0,
int ropt=0)
const;
64 const char*
name()
const {
return (m_name?m_name:
"?");}
84 uint32_t
nColumns()
const {
return columns.size();}
89 void print(std::ostream &out)
const;
90 void logWarning(
const char* event,
const char* fmt, ...)
const;
91 void logMessage(
const char* event,
const char* fmt, ...)
const;
97 bool matchMetaTags(
const std::vector<const char*> &mtags)
const;
101 inline const char*
getMetaTag(
const char*)
const;
104 virtual long selfTest(
int nth=1,
const char* pref=0)
const;
121 return (rids!=0) ? (rids->size()==
nEvents) :
false;}
214 template <
typename E>
static long
219 template <
typename E>
static long
224 template <
typename E>
static long
229 template <
typename E>
static long
273 const char* pairfile)
const;
279 int64_t
evaluateJoin(
const std::vector<const ibis::deprecatedJoin*> &cmp,
282 int64_t
evaluateJoin(
const std::vector<const ibis::deprecatedJoin*> &cmp,
291 int64_t
evaluateJoin(
const std::vector<const ibis::deprecatedJoin*> &cmp,
327 std::vector<std::string>*
336 std::vector<std::string>&)
const;
354 double begin,
double end,
double stride,
355 std::vector<uint32_t> &counts)
const;
358 double begin1,
double end1,
double stride1,
360 double begin2,
double end2,
double stride2,
361 std::vector<uint32_t> &counts)
const;
364 double begin1,
double end1,
double stride1,
366 double begin2,
double end2,
double stride2,
368 double begin3,
double end3,
double stride3,
369 std::vector<uint32_t> &counts)
const;
372 double begin,
double end,
double stride,
374 std::vector<double> &weights)
const;
377 double begin1,
double end1,
double stride1,
379 double begin2,
double end2,
double stride2,
381 std::vector<double> &weights)
const;
384 double begin1,
double end1,
double stride1,
386 double begin2,
double end2,
double stride2,
388 double begin3,
double end3,
double stride3,
390 std::vector<double> &weights)
const;
393 std::vector<double> &bounds,
394 std::vector<uint32_t> &counts)
const;
397 const char *cname, uint32_t nbin,
398 std::vector<double> &bounds,
399 std::vector<uint32_t> &counts)
const;
402 uint32_t nb1, uint32_t nb2,
403 std::vector<double> &bounds1,
404 std::vector<double> &bounds2,
405 std::vector<uint32_t> &counts,
406 const char*
const option=0)
const;
409 const char *name1,
const char *name2,
410 uint32_t nb1, uint32_t nb2,
411 std::vector<double> &bounds1,
412 std::vector<double> &bounds2,
413 std::vector<uint32_t> &counts)
const;
417 uint32_t nb1, uint32_t nb2, uint32_t nb3,
418 std::vector<double> &bounds1,
419 std::vector<double> &bounds2,
420 std::vector<double> &bounds3,
421 std::vector<uint32_t> &counts,
422 const char*
const option=0)
const;
425 const char *cname1,
const char *cname2,
427 uint32_t nb1, uint32_t nb2, uint32_t nb3,
428 std::vector<double> &bounds1,
429 std::vector<double> &bounds2,
430 std::vector<double> &bounds3,
431 std::vector<uint32_t> &counts)
const;
433 long get1DBins(
const char *constraints,
const char *cname,
434 double begin,
double end,
double stride,
435 std::vector<ibis::bitvector> &bins)
const;
437 long get1DBins(
const char *constraints,
const char *cname,
438 double begin,
double end,
double stride,
439 std::vector<ibis::bitvector*> &bins)
const;
441 long get1DBins(
const char *constraints,
const char *cname,
442 double begin,
double end,
double stride,
444 std::vector<double> &weights,
445 std::vector<ibis::bitvector*> &bins)
const;
447 long get2DBins(
const char *constraints,
const char *cname1,
448 double begin1,
double end1,
double stride1,
450 double begin2,
double end2,
double stride2,
451 std::vector<ibis::bitvector> &bins)
const;
453 long get2DBins(
const char *constraints,
const char *cname1,
454 double begin1,
double end1,
double stride1,
456 double begin2,
double end2,
double stride2,
457 std::vector<ibis::bitvector*> &bins)
const;
459 long get2DBins(
const char *constraints,
const char *cname1,
460 double begin1,
double end1,
double stride1,
462 double begin2,
double end2,
double stride2,
464 std::vector<double> &weights,
465 std::vector<ibis::bitvector*> &bins)
const;
467 long get3DBins(
const char *constraints,
const char *cname1,
468 double begin1,
double end1,
double stride1,
470 double begin2,
double end2,
double stride2,
472 double begin3,
double end3,
double stride3,
473 std::vector<ibis::bitvector> &bins)
const;
475 long get3DBins(
const char *constraints,
const char *cname1,
476 double begin1,
double end1,
double stride1,
478 double begin2,
double end2,
double stride2,
480 double begin3,
double end3,
double stride3,
481 std::vector<ibis::bitvector*> &bins)
const;
483 long get3DBins(
const char *constraints,
const char *cname1,
484 double begin1,
double end1,
double stride1,
486 double begin2,
double end2,
double stride2,
488 double begin3,
double end3,
double stride3,
490 std::vector<double> &weights,
491 std::vector<ibis::bitvector*> &bins)
const;
494 long get1DBins(
const char *constraints,
const char *cname1, uint32_t nb1,
495 std::vector<double> &bounds1,
496 std::vector<ibis::bitvector> &bins)
const;
499 const char *cname1,
const char *cname2,
500 uint32_t nb1, uint32_t nb2,
501 std::vector<double> &bounds1,
502 std::vector<double> &bounds2,
503 std::vector<ibis::bitvector> &bins)
const;
506 const char *cname1,
const char *cname2,
const char *cname3,
507 uint32_t nb1, uint32_t nb2, uint32_t nb3,
508 std::vector<double> &bounds1,
509 std::vector<double> &bounds2,
510 std::vector<double> &bounds3,
511 std::vector<ibis::bitvector> &bins)
const;
519 std::vector<double> &bounds,
520 std::vector<uint32_t> &counts)
const;
524 std::vector<double> &bounds,
525 std::vector<uint32_t> &counts)
const;
529 double *bounds, uint32_t *counts)
const;
533 uint32_t nbc,
double *bounds,
534 uint32_t *counts)
const;
538 const char *name1,
const char *name2,
539 std::vector<double> &bounds1,
540 std::vector<double> &bounds2,
541 std::vector<uint32_t> &counts)
const;
545 std::vector<double> &bounds,
546 std::vector<uint32_t> &counts)
const;
551 std::vector<double> &bounds,
552 std::vector<uint32_t> &counts)
const;
556 double *bounds, uint32_t *counts)
const;
560 uint32_t nbc,
double *bounds,
561 uint32_t *counts)
const;
591 long append(
const char* dir);
596 long commit(
const char* dir);
600 long addColumn(
const char* aexpr,
const char* cname,
609 const std::vector<bool> &directions);
611 long deactivate(
const std::vector<uint32_t> &rows);
613 long reactivate(
const std::vector<uint32_t> &rows);
626 static void genName(
const std::vector<const char*> &mtags,
629 static void genName(
const ibis::resource::vList &mtags,
636 unsigned elemsize=4);
647 std::vector<std::string> conds;
662 void queryTest(
const char* pref,
long* nerrors)
const;
664 void quickTest(
const char* pref,
long* nerrors)
const;
668 long* nerrors)
const;
675 template <
typename T>
static int
676 writeColumn(
int fdes, ibis::bitvector::word_t nold,
677 ibis::bitvector::word_t nnew,
678 ibis::bitvector::word_t voffset,
682 static int writeStrings(
const char *fnm, ibis::bitvector::word_t nold,
683 ibis::bitvector::word_t nnew,
684 ibis::bitvector::word_t voffset,
685 const std::vector<std::string>& vals,
688 static int writeRaw(
int bdes,
int sdes, ibis::bitvector::word_t nold,
689 ibis::bitvector::word_t nnew,
690 ibis::bitvector::word_t voffset,
696 ibis::bitvector::word_t nold,
697 ibis::bitvector::word_t nnew,
698 ibis::bitvector::word_t voffset,
699 const std::vector<ibis::opaque>& opq,
751 int readMetaData(uint32_t &nrows, columnList &plist,
const char* dir);
753 void writeMetaData(
const uint32_t nrows,
const columnList &plist,
754 const char* dir)
const;
762 void setMetaTags(
const ibis::resource::vList &mts);
763 void setMetaTags(
const std::vector<const char*> &mts);
771 void logError(
const char* event,
const char* fmt, ...)
const;
774 long verifyBackupDir();
775 void deriveBackupDirName();
779 template <
typename T>
782 template <
typename T>
800 template <
typename T>
static long
805 template <
typename T>
static long
811 template <
typename T>
static long
816 template <
typename T>
static long
822 template <
typename T>
static long
827 template <
typename T>
static long
833 template <
typename T>
static long
838 template <
typename T>
static long
839 negativeCompare(
const char *file,
844 template <
typename T>
static long
849 template <
typename T>
static long
854 template <
typename T>
static long
859 template <
typename T>
static long
860 negativeCompare(
const char *file,
865 template <
typename T>
static long
870 template <
typename T>
static long
875 template <
typename T>
static long
880 template <
typename T>
static long
881 negativeCompare(
const char *file,
886 template <
typename T,
typename F>
static long
891 template <
typename T,
typename F>
static long
896 template <
typename T,
typename F>
static long
901 template <
typename T,
typename F1,
typename F2>
static long
906 template <
typename T,
typename F1,
typename F2>
static long
911 template <
typename T,
typename F1,
typename F2>
static long
916 template <
typename T,
typename F>
static long
921 template <
typename T,
typename F1,
typename F2>
static long
926 template <
typename T>
931 template <
typename T>
937 template <
typename T>
943 template <
typename T>
948 template <
typename T,
typename F>
953 template <
typename T,
typename F1,
typename F2>
960 const std::vector<uint32_t> &counts,
962 double *bptr, uint32_t *cptr)
const;
965 const std::vector<uint32_t> &counts,
966 uint32_t nbc,
double *bptr, uint32_t *cptr)
const;
969 template <
typename T1,
typename T2>
971 const double &begin1,
const double &end1,
972 const double &stride1,
974 const double &begin2,
const double &end2,
975 const double &stride2,
976 std::vector<uint32_t> &counts)
const;
978 template <
typename T1,
typename T2,
typename T3>
980 const double &begin1,
const double &end1,
981 const double &stride1,
983 const double &begin2,
const double &end2,
984 const double &stride2,
986 const double &begin3,
const double &end3,
987 const double &stride3,
988 std::vector<uint32_t> &counts)
const;
990 template <
typename T1,
typename T2>
992 const double &begin1,
const double &end1,
993 const double &stride1,
995 const double &begin2,
const double &end2,
996 const double &stride2,
998 std::vector<double> &weights)
const;
1000 template <
typename T1,
typename T2,
typename T3>
1002 const double &begin1,
const double &end1,
1003 const double &stride1,
1005 const double &begin2,
const double &end2,
1006 const double &stride2,
1008 const double &begin3,
const double &end3,
1009 const double &stride3,
1011 std::vector<double> &weights)
const;
1014 template <
typename T1>
1016 const double &begin1,
const double &end1,
1017 const double &stride1,
1018 std::vector<ibis::bitvector> &bins)
const;
1020 template <
typename T1>
1022 const double &begin1,
const double &end1,
1023 const double &stride1,
1024 std::vector<ibis::bitvector*> &bins)
const;
1026 template <
typename T1>
1029 const double &begin1,
const double &end1,
1030 const double &stride1,
1032 std::vector<double> &weights,
1033 std::vector<ibis::bitvector*> &bins)
const;
1035 template <
typename T1,
typename T2>
1037 const double &begin1,
const double &end1,
1038 const double &stride1,
1040 const double &begin2,
const double &end2,
1041 const double &stride2,
1042 std::vector<ibis::bitvector> &bins)
const;
1043 template <
typename T1>
1045 const double &begin1,
const double &end1,
1046 const double &stride1,
1048 const double &begin2,
const double &end2,
1049 const double &stride2,
1050 std::vector<ibis::bitvector> &bins)
const;
1052 template <
typename T1,
typename T2>
1054 const double &begin1,
const double &end1,
1055 const double &stride1,
1057 const double &begin2,
const double &end2,
1058 const double &stride2,
1059 std::vector<ibis::bitvector*> &bins)
const;
1060 template <
typename T1>
1062 const double &begin1,
const double &end1,
1063 const double &stride1,
1065 const double &begin2,
const double &end2,
1066 const double &stride2,
1067 std::vector<ibis::bitvector*> &bins)
const;
1069 template <
typename T1,
typename T2>
1072 const double &begin1,
const double &end1,
1073 const double &stride1,
1075 const double &begin2,
const double &end2,
1076 const double &stride2,
1078 std::vector<double> &weights,
1079 std::vector<ibis::bitvector*> &bins)
const;
1080 template <
typename T1>
1083 const double &begin1,
const double &end1,
1084 const double &stride1,
1086 const double &begin2,
const double &end2,
1087 const double &stride2,
1089 std::vector<double> &weights,
1090 std::vector<ibis::bitvector*> &bins)
const;
1092 template <
typename T1,
typename T2,
typename T3>
1094 const double &begin1,
const double &end1,
1095 const double &stride1,
1097 const double &begin2,
const double &end2,
1098 const double &stride2,
1100 const double &begin3,
const double &end3,
1101 const double &stride3,
1102 std::vector<ibis::bitvector> &bins)
const;
1103 template <
typename T1>
1105 const double &begin1,
const double &end1,
1106 const double &stride1,
1108 const double &begin2,
const double &end2,
1109 const double &stride2,
1111 const double &begin3,
const double &end3,
1112 const double &stride3,
1113 std::vector<bitvector> &bins)
const;
1114 template <
typename T1,
typename T2>
1116 const double &begin1,
const double &end1,
1117 const double &stride1,
1119 const double &begin2,
const double &end2,
1120 const double &stride2,
1122 const double &begin3,
const double &end3,
1123 const double &stride3,
1124 std::vector<bitvector> &bins)
const;
1125 template <
typename T1,
typename T2,
typename T3>
1127 const double &begin1,
const double &end1,
1128 const double &stride1,
1130 const double &begin2,
const double &end2,
1131 const double &stride2,
1133 const double &begin3,
const double &end3,
1134 const double &stride3,
1135 std::vector<bitvector*> &bins)
const;
1136 template <
typename T1>
1138 const double &begin1,
const double &end1,
1139 const double &stride1,
1141 const double &begin2,
const double &end2,
1142 const double &stride2,
1144 const double &begin3,
const double &end3,
1145 const double &stride3,
1146 std::vector<ibis::bitvector*> &bins)
const;
1147 template <
typename T1,
typename T2>
1149 const double &begin1,
const double &end1,
1150 const double &stride1,
1152 const double &begin2,
const double &end2,
1153 const double &stride2,
1155 const double &begin3,
const double &end3,
1156 const double &stride3,
1157 std::vector<ibis::bitvector*> &bins)
const;
1158 template <
typename T1,
typename T2,
typename T3>
1161 const double &begin1,
const double &end1,
1162 const double &stride1,
1164 const double &begin2,
const double &end2,
1165 const double &stride2,
1167 const double &begin3,
const double &end3,
1168 const double &stride3,
1170 std::vector<double> &weights,
1171 std::vector<bitvector*> &bins)
const;
1172 template <
typename T1>
1175 const double &begin1,
const double &end1,
1176 const double &stride1,
1178 const double &begin2,
const double &end2,
1179 const double &stride2,
1181 const double &begin3,
const double &end3,
1182 const double &stride3,
1184 std::vector<double> &weights,
1185 std::vector<ibis::bitvector*> &bins)
const;
1186 template <
typename T1,
typename T2>
1189 const double &begin1,
const double &end1,
1190 const double &stride1,
1192 const double &begin2,
const double &end2,
1193 const double &stride2,
1195 const double &begin3,
const double &end3,
1196 const double &stride3,
1198 std::vector<double> &weights,
1199 std::vector<ibis::bitvector*> &bins)
const;
1203 uint32_t nbin, std::vector<double> &bounds,
1204 std::vector<ibis::bitvector> &bins,
const char *mesg)
const;
1208 std::vector<double> &bounds,
1209 std::vector<uint32_t> &counts)
const;
1213 uint32_t nb1, uint32_t nb2,
1214 std::vector<double> &bounds1,
1215 std::vector<double> &bounds2,
1216 std::vector<uint32_t> &counts)
const;
1220 uint32_t nb1, uint32_t nb2,
1221 std::vector<double> &bounds1,
1222 std::vector<double> &bounds2,
1223 std::vector<uint32_t> &counts)
const;
1227 uint32_t nb1, uint32_t nb2,
1228 std::vector<double> &bounds1,
1229 std::vector<double> &bounds2,
1230 std::vector<uint32_t> &counts)
const;
1232 const char *name1,
const char *name2,
1233 uint32_t nb1, uint32_t nb2,
1234 std::vector<double> &bounds1,
1235 std::vector<double> &bounds2,
1236 std::vector<uint32_t> &counts)
const;
1239 std::vector<double> &bnds,
1240 std::vector<ibis::bitvector*> &btmp)
const;
1246 uint32_t nb1, uint32_t nb2, uint32_t nb3,
1247 std::vector<double> &bounds1,
1248 std::vector<double> &bounds2,
1249 std::vector<double> &bounds3,
1250 std::vector<uint32_t> &counts)
const;
1251 template <
typename E1>
1256 uint32_t nb1, uint32_t nb2, uint32_t nb3,
1257 std::vector<double> &bounds1,
1258 std::vector<double> &bounds2,
1259 std::vector<double> &bounds3,
1260 std::vector<uint32_t> &counts)
const;
1261 template <
typename E1,
typename E2>
1266 uint32_t nb1, uint32_t nb2, uint32_t nb3,
1267 std::vector<double> &bounds1,
1268 std::vector<double> &bounds2,
1269 std::vector<double> &bounds3,
1270 std::vector<uint32_t> &counts)
const;
1272 template <
typename E1,
typename E2>
1274 uint32_t nb1, uint32_t nb2,
1276 std::vector<uint32_t> &cnts);
1278 template <
typename T>
1280 std::map<T, uint32_t> &hist);
1282 template <
typename T>
1283 static void equalWeightBins(
const array_t<T> &vals,
1286 template <
typename T>
1288 const T vmax, uint32_t nbins,
1289 std::vector<double> &bounds,
1290 std::vector<uint32_t> &counts);
1292 template <
typename T>
1294 const T vmax, uint32_t nbins,
1295 std::vector<double> &bounds,
1296 std::vector<uint32_t> &counts);
1298 template <
typename T1,
typename T2>
1301 uint32_t nb1, uint32_t nb2,
1302 std::vector<double> &bounds1,
1303 std::vector<double> &bounds2,
1304 std::vector<uint32_t> &counts);
1306 template <
typename T1,
typename T2,
typename T3>
1310 uint32_t nb1, uint32_t nb2, uint32_t nb3,
1311 std::vector<double> &bounds1,
1312 std::vector<double> &bounds2,
1313 std::vector<double> &bounds3,
1314 std::vector<uint32_t> &counts);
1316 template <
typename T>
static long
1319 const T vmin,
const T vmax, uint32_t nbins,
1320 std::vector<double> &bounds,
1321 std::vector<ibis::bitvector> &detail);
1323 template <
typename T>
static long
1326 const T vmin,
const T vmax, uint32_t nbins,
1327 std::vector<double> &bounds,
1328 std::vector<ibis::bitvector> &detail);
1335 void composeQueryString(std::string &str,
1337 const double &lower1,
const double &upper1,
1338 const double &lower2,
const double &upper2)
const;
1340 unsigned nc,
unsigned nq)
const;
1343 double low,
double high,
long* nerr)
const;
1349 mutable pthread_mutex_t mutex;
1355 void init(
const char* prefix);
1357 void fillRIDs(
const char* fn)
const;
1359 uint32_t searchSortedRIDs(
const ibis::rid_t &rid)
const;
1360 uint32_t searchRIDs(
const ibis::rid_t &rid)
const;
1375 int64_t loopJoin(
const std::vector<const ibis::deprecatedJoin*> &cmp,
1378 int64_t loopJoin(
const std::vector<const ibis::deprecatedJoin*> &cmp,
1395 template <
class type1,
class type2>
1402 template <
class type1,
class type2>
1407 const double delta)
const;
1420 const part &operator=(
const part&);
1428 unsigned int FASTBIT_CXX_DLLSPEC
1430 const char *adir,
const char *bdir,
bool ro=
false);
1432 unsigned int FASTBIT_CXX_DLLSPEC
1433 gatherParts(ibis::partList &parts,
const char *adir,
bool ro=
false);
1436 unsigned int FASTBIT_CXX_DLLSPEC
1450 std::vector<ibis::column::info*>
cols;
1453 info(
const char* na,
const char* de,
const uint64_t &nr,
1471 const part* thePart;
1480 readLock(
const part* tbl,
const char* m) : thePart(tbl), mesg(m) {
1483 LOGGER(ibis::gVerbose > 0)
1484 <<
"Warning -- part[" << thePart->
name()
1485 <<
"]::gainReadAccess -- pthread_rwlock_rdlock for " << mesg
1486 <<
" returned " << ierr <<
" (" << strerror(ierr) <<
')';
1489 LOGGER(ibis::gVerbose > 9)
1490 <<
"part[" << thePart->
name()
1491 <<
"]::gainReadAccess for " << mesg;
1497 LOGGER(ibis::gVerbose > 0)
1498 <<
"Warning -- part[" << thePart->
name()
1499 <<
"]::releaseAccess -- pthread_rwlock_unlock for " << mesg
1500 <<
" returned " << ierr <<
" (" << strerror(ierr) <<
')';
1503 LOGGER(ibis::gVerbose > 9)
1504 <<
"part[" << thePart->
name()
1505 <<
"]::releaseAccess for " << mesg;
1510 const part* thePart;
1521 writeLock(
const part* tbl,
const char* m) : thePart(tbl), mesg(m) {
1524 LOGGER(ibis::gVerbose >= 0)
1525 <<
"Warning -- part[" << thePart->
name()
1526 <<
"]::gainWriteAccess -- pthread_rwlock_wrlock for " << mesg
1527 <<
" returned " << ierr <<
" (" << strerror(ierr) <<
')';
1530 LOGGER(ibis::gVerbose > 9)
1531 <<
"part[" << thePart->
name()
1532 <<
"]::gainWriteAccess for " << mesg;
1538 LOGGER(ibis::gVerbose > 0)
1539 <<
"Warning -- part[" << thePart->
name()
1540 <<
"]::releaseAccess -- pthread_rwlock_unlock for " << mesg
1541 <<
" returned " << ierr <<
" (" << strerror(ierr) <<
')';
1544 LOGGER(ibis::gVerbose > 9)
1545 <<
"part[" << thePart->
name()
1546 <<
"]::releaseAccess for " << mesg;
1551 const part* thePart;
1573 const part* thePart;
1578 softWriteLock(
const softWriteLock &rhs)
1579 : thePart(rhs.thePart), mesg(rhs.mesg), lckd(0) {};
1580 const softWriteLock &operator=(
const softWriteLock&);
1587 mutexLock(
const part* tbl,
const char* m) : thePart(tbl), mesg(m) {
1588 if (ibis::gVerbose > 9)
1589 tbl->logMessage(
"gainExclusiveAccess",
1590 "pthread_mutex_lock for %s", m);
1591 int ierr = pthread_mutex_lock(&(tbl->mutex));
1593 tbl->logWarning(
"gainExclusiveAccess",
"pthread_mutex_lock for %s "
1594 "returned %d (%s)", m, ierr, strerror(ierr));
1597 if (ibis::gVerbose > 9)
1598 thePart->logMessage(
"releaseExclusiveAccess",
1599 "pthread_mutex_unlock for %s", mesg);
1600 int ierr = pthread_mutex_unlock(&(thePart->mutex));
1602 thePart->logWarning(
"releaseExclusiveAccess",
1603 "pthread_mutex_unlock for %s returned %d (%s)",
1604 mesg, ierr, strerror(ierr));
1608 const part* thePart;
1625 virtual long close();
1626 virtual long read();
1627 virtual long seek(uint32_t pos);
1630 uint32_t tell()
const {
return position;}
1633 const ibis::column* getColumn(uint32_t i)
const {
return cols[i];}
1638 std::vector<const ibis::column*> cols;
1639 std::vector<ibis::fileManager::storage*> stores;
1640 std::vector<int> fdes;
1651 virtual long read();
1652 virtual long seek(uint32_t pos);
1653 long seek(
double val);
1663 uint32_t seekValue(
int fd,
const T &val)
const;
1665 uint32_t seekValue(
const array_t<T>&arr,
const T &val)
const;
1770 return new info(*
this);
1778 if (ind < columns.size()) {
1779 if (colorder.size() == columns.size()) {
1783 ibis::part::columnList::const_iterator it = columns.begin();
1784 for (; ind > 0; -- ind) ++ it;
1785 return (*it).second;
1794 ibis::resource::vList::const_iterator it = metaList.find(name);
1795 if (it != metaList.end())
1796 return (*it).second;
1798 return static_cast<const char*>(0);
1804 return loopJoin(cmp, mask, pairs);
1809 const char *)
const {
1810 logWarning(
"evaluate",
"not implemented yet");
1816 return loopJoin(cmp, mask);
1820 (
const std::vector<const ibis::deprecatedJoin*> &cmp,
1822 return loopJoin(cmp, mask, pairs);
1829 return pthread_rwlock_unlock(&rwlock);
1836 return pthread_rwlock_rdlock(&rwlock);
1843 return pthread_rwlock_wrlock(&rwlock);
1850 return pthread_rwlock_trywrlock(&rwlock);
1852 #endif // IBIS_PART_H
The class qKeyword encapsulates a search for a single keyword in a text field.
Definition: qExpr.h:621
void buildSorted(const char *colname) const
Build a sorted version of the specified column.
Definition: part.cpp:6474
ibis::table::typeArray columnTypes() const
Return column types in a list.
Definition: part.cpp:2094
array_t< int32_t > * selectInts(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 32-bit integers.
Definition: part.cpp:2929
const char * indexSpec() const
Return the current index specification.
Definition: part.h:68
A class to represent simple range conditions.
Definition: qExpr.h:207
virtual long negativeScan(const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits) const
Compute the records (marked 1 in the mask) that does not satisfy the range condition.
Definition: part.cpp:5592
const char * description() const
Return a text description of the partition.
Definition: part.h:66
array_t< double > * selectDoubles(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 64-bit floating-point values.
Definition: part.cpp:3159
bool isLocked() const
Have we acquired the desired lock? Returns true if yes, otherwise false.
Definition: part.h:1570
A user specifies this type of query expression with the following syntax,.
Definition: qExpr.h:1285
char * backupDir
!< The active data directory.
Definition: part.h:733
ibis::fileManager::ACCESS_PREFERENCE accessHint(const ibis::bitvector &mask, unsigned elemsize=4) const
Evaluate the strategy for accessing a data file.
Definition: part.cpp:2681
const char * getMetaTag(const char *) const
Return the value of the meta tag with the specified name.
Definition: part.h:1793
std::map< const char *, part *, lessi > partAssoc
An associative array for data partitions.
Definition: util.h:438
part(const char *name=0, bool ro=false)
Initialize a data partition object.
Definition: part.cpp:274
ibis::resource::vList metaList
!< Free form description of the partition.
Definition: part.h:728
const std::vector< std::string > & getMeshDimensions() const
Return the name of the dimensions corresponding to the vector returned from getMeshShape.
Definition: part.h:578
int readMetaData(uint32_t &nrows, columnList &plist, const char *dir)
!< Don't change the data.
Definition: part.cpp:1312
long addColumn(const char *aexpr, const char *cname, ibis::TYPE_T ctype=ibis::DOUBLE)
Add a column computed with the given arithmetic expression.
Definition: parti.cpp:1634
void doBackup()
The routine to perform the actual copying for making a backup copy.
Definition: part.cpp:19022
void makeBackupCopy()
Spawn another thread to copy the content of activeDir to backupDir.
Definition: part.cpp:19090
long reactivate(const std::vector< uint32_t > &rows)
Make sure the specified rows are active.
Definition: parti.cpp:1449
const char * name() const
Return the name of the partition.
Definition: part.h:64
int gainReadAccess() const
Attempt to gain a read access to this part object.
Definition: part.h:1835
static void genName(const std::vector< const char * > &mtags, std::string &name)
Generate name for a partition based on the meta tags.
Definition: part.cpp:638
void getNullMask(ibis::bitvector &m) const
Copy the mask of active rows.
Definition: part.h:618
long count3DBins(const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, std::vector< uint32_t > &counts) const
Count the number of values in 3D bins.
Definition: parth3d.cpp:22
const char * currentDataDir() const
Return the name of the active data directory.
Definition: part.h:82
TABLE_STATE state
!< Time of last switch operation.
Definition: part.h:735
A barrel to hold a list of variables.
Definition: qExpr.h:760
A container for name-value pairs.
Definition: resource.h:38
long get3DDistribution(const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *cname3, double begin3, double end3, double stride3, std::vector< uint32_t > &counts) const
Compute conditional 3D histogram with regularly spaced bins.
Definition: parth3d.cpp:91
void checkQueryList(const ibis::part::thrArg &lst) const
Sum up the hits from sub-divisions to verify the hits computing from the whole range.
Definition: part.cpp:8242
void numbersToBitvector(const std::vector< uint32_t > &, ibis::bitvector &) const
Turn a list of numbers into a bitvector.
Definition: part.cpp:4240
uint32_t nColumns() const
Return the number of attributes in the partition.
Definition: part.h:84
const char * description
!< Partition name.
Definition: part.h:1447
Simple range condition.
Definition: qExpr.h:252
int updateData()
Check the time stamp on the metadata files to decide if the in-memory metadata information requires u...
Definition: parti.cpp:1750
double getActualMin(const char *name) const
The actual minimum value in the named column.
Definition: part.cpp:19149
The class qAllWords encapsulates a search for many keywords.
Definition: qExpr.h:659
A struct to pack the arguments to function startTests.
Definition: part.h:642
void stringToBitvector(const char *, ibis::bitvector &) const
Convert a set of range conditions to an ibis::bitvector.
Definition: part.cpp:4258
virtual long seek(uint32_t pos)
!< Read one value for each variable.
Definition: part.cpp:20063
std::map< const char *, ibis::TYPE_T, ibis::lessi > namesTypes
An associative array of names and types.
Definition: table.h:123
long fill2DBinsWeighted(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
Fill the bitvectors representing the 2D bins.
Definition: parth2d.cpp:2225
long get2DDistributionI(const ibis::column &col1, const ibis::column &col2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
Compute 2D histogram from indexes.
Definition: parth2d.cpp:4180
long deactivate(const std::vector< uint32_t > &rows)
Mark the specified rows as inactive.
Definition: parti.cpp:1410
virtual int buildIndexes(const char *iopt, int nthr)
Make sure indexes for all columns are available.
Definition: part.cpp:6500
array_t< int16_t > * selectShorts(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 16-bit integers.
Definition: part.cpp:2837
A simple class to describe an ibis::part object.
Definition: part.h:1445
FastBit sorting functions and other utilities.
long fill3DBinsWeighted3(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
Resolve the 3rd column involved in the 3D bins.
Definition: parth3dw.cpp:175
bool readonly
!< The cleaner for the file manager.
Definition: part.h:744
This query expression has similar meaning as ibis::qDiscreteRange, however, it stores the values as s...
Definition: qExpr.h:392
The column contains one of the values in a list.
Definition: qExpr.h:560
unsigned int gatherParts(ibis::partList &parts, const char *adir, const char *bdir, bool ro=false)
Look for data partitions in the given pair of directories.
Definition: part.cpp:20692
long commit(const char *dir)
Commit the append operation involving data from dir.
Definition: parti.cpp:1082
static const char * skipPrefix(const char *)
Skip pass all the dots in the given string.
Definition: part.cpp:6950
time_t switchTime
!< The backup data directory.
Definition: part.h:734
virtual long estimateRange(const ibis::qContinuousRange &cmp) const
Return an upper bound on the number of hits.
Definition: part.cpp:3664
void readMeshShape(const char *const dir)
Read shape of the mesh from the metadata file.
Definition: part.cpp:1229
const char * metaTags
!< A free-form description of the partition.
Definition: part.h:1448
A roster is a list of values in ascending order plus their original positions.
Definition: iroster.h:19
long rollback()
Rollback the append operation.
Definition: parti.cpp:984
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
static int writeOpaques(int bdes, int sdes, ibis::bitvector::word_t nold, ibis::bitvector::word_t nnew, ibis::bitvector::word_t voffset, const std::vector< ibis::opaque > &opq, ibis::bitvector &totmask, const ibis::bitvector &newmask)
Write raw bytes to an open file.
Definition: part.cpp:19499
virtual double estimateCost(const ibis::qContinuousRange &cmp) const
Estimate the cost of evaluate the query expression.
Definition: part.cpp:3694
static long adaptive2DBins(const array_t< T1 > &vals1, const array_t< T2 > &vals2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts)
Adaptive binning through regularly spaced bins.
Definition: parth2d.cpp:2889
The class to represent a column of a data partition.
Definition: column.h:65
static long adaptiveInts(const array_t< T > &vals, const T vmin, const T vmax, uint32_t nbins, std::vector< double > &bounds, std::vector< uint32_t > &counts)
The adaptive binning function for integer values.
Definition: parth.cpp:2036
static long adaptiveFloats(const array_t< T > &vals, const T vmin, const T vmax, uint32_t nbins, std::vector< double > &bounds, std::vector< uint32_t > &counts)
The adaptive binning function for floats and integers in wide ranges.
Definition: parth.cpp:2134
char * activeDir
!< Number of events (rows) in the partition.
Definition: part.h:732
void freeRIDs() const
!< Read RIDs from file 'rids'.
Definition: part.cpp:2200
void setMeshShape(const ibis::array_t< uint64_t > &)
copy the incoming as the mesh shape of the data partition.
Definition: part.cpp:1874
A data structure to represent a sequence of bits.
Definition: bitvector64.h:54
virtual ~part()
Destuctor.
Definition: part.cpp:600
double getColumnSum(const char *name) const
Sum of all value in the named column.
Definition: part.cpp:19165
int releaseAccess() const
Attempt to release a read or write access to this part object.
Definition: part.h:1828
long evaluateRIDSet(const ibis::RIDSet &, ibis::bitvector &) const
Convert a list of RIDs into a bitvector.
Definition: part.cpp:3287
void push_back(const T &elm)
Add one element from the back.
Definition: array_t.h:204
To read variables in certain order.
Definition: part.h:1645
long get3DDistributionA2(const ibis::bitvector &mask, const array_t< E1 > &vals1, const array_t< E2 > &vals2, const ibis::column &col3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts) const
Read the values of the third column.
Definition: parth3d.cpp:5749
time_t timestamp() const
Return the time stamp on the partition.
Definition: part.h:72
bitvector & copy(const bitvector &bv)
Make a copy. Performs a deep copy.
Definition: bitvector.h:680
static long adaptive3DBins(const array_t< T1 > &vals1, const array_t< T2 > &vals2, const array_t< T3 > &vals3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts)
Adaptive binning through regularly spaced bins.
Definition: parth3d.cpp:5002
array_t< float > * selectFloats(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 32-bit floating-point values.
Definition: part.cpp:3113
virtual long selfTest(int nth=1, const char *pref=0) const
Perform predefined set of tests and return the number of failures.
Definition: part.cpp:6963
void buildQueryList(ibis::part::thrArg &lst, unsigned nc, unsigned nq) const
Generate a list of random query conditions.
Definition: part.cpp:8039
long packCumulativeDistribution(const std::vector< double > &bounds, const std::vector< uint32_t > &counts, uint32_t nbc, double *bptr, uint32_t *cptr) const
Pack a cumulative distribution stored in two std::vectors into two arrays provided by the caller...
Definition: parth.cpp:4228
The class qString encapsulates information for comparing string values.
Definition: qExpr.h:504
long stringSearch(const ibis::qString &cmp, ibis::bitvector &low) const
Find all records that has the exact string value.
Definition: part.cpp:3323
array_t< unsigned char > * selectUBytes(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 8-bit unsigned integers.
Definition: part.cpp:2791
long getJointDistribution(const char *constraints, const char *name1, const char *name2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
Compute the joint distribution of two variables.
Definition: parth2d.cpp:5933
static int reorderBitmap(ibis::bitvector &, const ibis::bitvector &, const ibis::array_t< uint32_t > &)
Produce a reordered bit vector through the inverse order array.
Definition: parti.cpp:672
virtual long doScan(const ibis::qRange &cmp, ibis::bitvector &hits) const
Evaluate the range condition.
Definition: part.cpp:4273
long writeValues(const char *fname, const array_t< uint32_t > &ind)
Write the named data file with values in the given order.
Definition: parti.cpp:456
Provide a read lock on an ibis::part.
Definition: part.h:1478
Provide a write lock on an ibis::part.
Definition: part.h:1519
int64_t evaluateJoin(const ibis::deprecatedJoin &cmp, const ibis::bitvector &mask, ibis::bitvector64 &pairs) const
Evaluate a self-join.
Definition: part.h:1801
virtual float getUndecidable(const ibis::qContinuousRange &cmp, ibis::bitvector &iffy) const
Discover the records that can not be decided using the index.
Definition: part.cpp:5880
long fill3DBins(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, std::vector< ibis::bitvector > &bins) const
Fill the bitvectors representing the 3D bins.
Definition: parth3db.cpp:26
column * getColumn(const char *name) const
Given a name, return the associated column.
Definition: part.cpp:6876
std::vector< const column * > colorder
!< Active rows are maked 1.
Definition: part.h:739
long purgeInactive()
Purge all inactive rows from the partition.
Definition: parti.cpp:1485
virtual void operator()() const
Unload the indexes to free up some resources.
Definition: part.cpp:19669
long doCount(const ibis::qRange &cmp) const
Count the number rows satisfying the range expression.
Definition: part.cpp:17475
long fill2DBins(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, std::vector< ibis::bitvector > &bins) const
Fill the bitvectors representing the 2D bins.
Definition: parth2d.cpp:1038
long patternSearch(const ibis::qLike &cmp, ibis::bitvector &low) const
Look for string like the given pattern.
Definition: part.cpp:3447
const std::vector< uint32_t > & getMeshShape() const
In many scientific applications, data are defined on meshes.
Definition: part.h:575
long append2(const char *dir)
Perform append operation with two data directories.
Definition: parti.cpp:854
long getCumulativeDistribution(const char *name, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
Compute a cumulative distribution (a cumulative histogram).
Definition: parth.cpp:3908
void extendMetaTags()
!< Remove the rids list from memory.
uint32_t recursiveQuery(const char *pref, const column *att, double low, double high, long *nerr) const
Issues a query and then subdivided the range into three to check the total hits of the three sub quer...
Definition: part.cpp:7826
~softWriteLock()
Destructor.
Definition: parti.cpp:1882
long count2DWeights(array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, array_t< double > &wts, std::vector< double > &weights) const
Count the weights in 2D bins.
Definition: parth2d.cpp:516
int gainWriteAccess() const
Attempt to gain a write access to this part object.
Definition: part.h:1842
void logMessage(const char *event, const char *fmt,...)
Print a message to standard output.
Definition: util.cpp:1902
std::map< const char *, column *, lessi > columnList
!< A function to start backing up the active dir.
Definition: part.h:673
long count3DWeights(const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, const array_t< double > &wts, std::vector< double > &weights) const
Count the weights in 3D bins.
Definition: parth3d.cpp:2437
virtual long open(const ibis::part *t=0)
The function valut::open different from barrel::open in that it opens the .srt file for the first var...
Definition: part.cpp:20098
std::vector< unsigned > super
!< List of query conditions.
Definition: part.h:648
bool matchNameValuePair(const char *name, const char *value) const
Match a name-value pair in the meta tags.
Definition: part.cpp:1924
void testRangeOperators(const ibis::column *col, long *nerrors) const
Try a set of range conditions with different combinations of operators.
Definition: part.cpp:7747
array_t< uint64_t > * selectULongs(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 64-bit unsigned integers.
Definition: part.cpp:3067
virtual long read()
!< Open all data files.
Definition: part.cpp:20251
array_t< uint16_t > * selectUShorts(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 16-bit unsigned integers.
Definition: part.cpp:2883
ACCESS_PREFERENCE
Hint passed to the function getFile.
Definition: fileManager.h:29
void init(const char *rcfile=0, const char *mesgfile=0)
Initializes the memory manager of FastBit.
Definition: ibis.h:378
void purgeIndexFiles() const
Remove existing index files! The indexes will be rebuilt next time they are needed.
Definition: part.cpp:6845
long get3DBins(const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *cname3, double begin3, double end3, double stride3, std::vector< ibis::bitvector > &bins) const
Partition values of named variables into regularly spaced 3D bins.
Definition: parth3db.cpp:644
Defines a class to hold name-value pairs.
!< Four-byte IEEE floating-point numbers, internally float.
Definition: table.h:39
TABLE_STATE getState() const
Retrieve the current state of data partition.
Definition: part.cpp:6868
A cleaner to be used by the function fileManager::unload.
Definition: part.h:1464
long packDistribution(const std::vector< double > &bounds, const std::vector< uint32_t > &counts, uint32_t nbc, double *bptr, uint32_t *cptr) const
Pack a binned distribution.
Definition: parth.cpp:4146
The class ibis::part represents a partition of a relational table.
Definition: part.h:27
TYPE_T
Supported data types.
Definition: table.h:25
This query expression has similar meaning as ibis::qDiscreteRange, however, it stores the values as u...
Definition: qExpr.h:447
static long adaptiveIntsDetailed(const ibis::bitvector &mask, const array_t< T > &vals, const T vmin, const T vmax, uint32_t nbins, std::vector< double > &bounds, std::vector< ibis::bitvector > &detail)
Bins the given values so that each each bin is nearly equal weight.
Definition: parth.cpp:2207
void print(std::ostream &out) const
Output a description of every column in the data partition.
Definition: part.cpp:2129
A simple shared counter.
Definition: util.h:869
void gatherSortKeys(ibis::table::stringArray &names)
Collect a list of column names that might be used as keys for sorting the rows.
Definition: parti.cpp:55
An non-blocking version of writeLock.
Definition: part.h:1562
static void mapValues(array_t< E1 > &val1, array_t< E2 > &val2, uint32_t nb1, uint32_t nb2, array_t< E1 > &bnd1, array_t< E2 > &bnd2, std::vector< uint32_t > &cnts)
The templated function to decide the bin boundaries and count the number of values fall in each bin...
Definition: parth2d.cpp:5733
TABLE_STATE getStateNoLocking() const
Return the current state of data partition.
Definition: part.h:54
int coarsenBins(const ibis::column &col, uint32_t nbin, std::vector< double > &bnds, std::vector< ibis::bitvector * > &btmp) const
Produce a set of bitmaps corresponding to a set of coarse bins.
Definition: parth.cpp:2482
virtual long estimateMatchAny(const ibis::qAnyAny &cmp, ibis::bitvector &low, ibis::bitvector &high) const
Estimate a lower bound and an upper bound on the records that are hits.
Definition: part.cpp:4169
long get1DBins_(const ibis::bitvector &mask, const ibis::column &col, uint32_t nbin, std::vector< double > &bounds, std::vector< ibis::bitvector > &bins, const char *mesg) const
Compute 1D histogram from raw data.
Definition: parth.cpp:2607
long append(const char *dir)
Append data from dir.
Definition: parti.cpp:711
long fill3DBinsWeighted2(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
Resolve the 2nd column of the 3D bins.
Definition: parth3dw.cpp:424
long get3DDistributionA1(const ibis::bitvector &mask, const array_t< E1 > &vals1, const ibis::column &col2, const ibis::column &col3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts) const
Read the value of the second column.
Definition: parth3d.cpp:5581
uint32_t getRowNumber(const rid_t &rid) const
Return the row number of the row with specified RID.
Definition: part.cpp:2323
void writeMetaData(const uint32_t nrows, const columnList &plist, const char *dir) const
Write metadata file -part.txt.
Definition: part.cpp:1722
One-argument string functions.
Definition: qExpr.h:1110
std::string m_desc
!< Name of the data partition.
Definition: part.h:727
void updateMetaData() const
Write the metadata file to record the changes to the partition.
Definition: part.cpp:1837
long keywordSearch(const ibis::qKeyword &cmp, ibis::bitvector &low) const
Identify all rows containing the specified keyword.
Definition: part.cpp:3475
long get3DDistributionA(const ibis::bitvector &mask, const ibis::column &col1, const ibis::column &col2, const ibis::column &col3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts) const
Compute 3D histogram with adaptive bins from base data.
Definition: parth3d.cpp:5413
long get2DDistributionA(const ibis::column &col1, const ibis::column &col2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
Compute 2D histogram with adaptive bins from base data.
Definition: parth2d.cpp:3159
void computeMinMax()
Compute the min and max for each column.
Definition: part.cpp:6453
virtual long seek(uint32_t pos)
!< Read the values at the current position.
Definition: part.cpp:20406
static long doComp0(const array_t< T > &vals, F cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
Evaluate the range condition.
Definition: part.cpp:16891
long get1DDistribution(const char *constraints, const char *cname, double begin, double end, double stride, std::vector< uint32_t > &counts) const
Histogram functions.
Definition: parth.cpp:57
void sortRIDs(ibis::RIDSet &)
Sort RID lists.
Definition: utilidor.cpp:117
long fill2DBins2(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, std::vector< ibis::bitvector > &bins) const
A template function to resolve the second variable involved in the 2D bins.
Definition: parth2d.cpp:1121
long get2DBins(const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, std::vector< ibis::bitvector > &bins) const
Partition values of named variables into regularly spaced 2D bins.
Definition: parth2d.cpp:1356
const ibis::bitvector & getMaskRef() const
Return a reference to the mask of active rows.
Definition: part.h:620
double getActualMax(const char *name) const
The actual maximum value in the named column.
Definition: part.cpp:19157
array_t< uint32_t > * selectUInts(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 32-bit unsigned integers.
Definition: part.cpp:2975
void logError(const char *event, const char *fmt,...) const
Write out a message with indication of severe error.
Definition: part.cpp:8268
virtual long evaluateRange(const ibis::qContinuousRange &cmp, const ibis::bitvector &mask, ibis::bitvector &res) const
Evaluate a continue range expression accurately.
Definition: part.cpp:3568
virtual long read()
!< Close all open files.
Definition: part.cpp:19910
array_t< signed char > * selectBytes(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 8-bit integers.
Definition: part.cpp:2745
long old2DDistribution(const char *constraints, const char *name1, const char *name2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
The old implementation that uses binary lookup.
Definition: parth2d.cpp:5170
static int writeRaw(int bdes, int sdes, ibis::bitvector::word_t nold, ibis::bitvector::word_t nnew, ibis::bitvector::word_t voffset, const ibis::array_t< unsigned char > &bytes, const ibis::array_t< int64_t > &starts, ibis::bitvector &totmask, const ibis::bitvector &newmask)
Write raw bytes to an open file.
Definition: part.cpp:19327
void readRIDs() const
A function to retrieve RIDs stored in file.
Definition: part.cpp:2171
void loadIndexes(const char *iopt=0, int ropt=0) const
Load indexes of all columns.
Definition: part.cpp:6743
long calculate(const ibis::math::term &, const ibis::bitvector &, array_t< double > &) const
Calculate the values of an arithmetic expression as doubles.
Definition: part.cpp:6120
int tryWriteAccess() const
A soft attempt to gain a write access to this part object.
Definition: part.h:1849
std::vector< std::string > * selectStrings(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as strings.
Definition: part.cpp:3205
static char * readMetaTags(const char *const dir)
A class function to read the meta tags in the tdc file.
Definition: part.cpp:1154
static long doCompare(const array_t< T > &array, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::array_t< T > &res, ibis::bitvector &hits)
The function that performs the actual comparison for range queries.
Definition: part.cpp:9319
static uint32_t countPages(const ibis::bitvector &mask, unsigned elemsize=4)
Estimate the number of pages to be accessed.
Definition: part.cpp:2616
ibis::table::stringArray columnNames() const
Return column names in a list.
Definition: part.cpp:2060
The abstract base class for arithmetic terms.
Definition: qExpr.h:728
long fill1DBinsWeighted(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
Fill the bitvectors representing the 1D bins.
Definition: parth.cpp:1118
long selectValues(const char *cname, const ibis::bitvector &mask, void *vals) const
Select values of a column based on the given mask.
Definition: part.cpp:3248
void combineNames(ibis::table::namesTypes &metalist) const
Update the list of columns with information in this data partition.
Definition: part.cpp:2037
int clear()
A group of functions to manipulate the data partition.
Definition: parti.cpp:1814
bool matchMetaTags(const std::vector< const char * > &mtags) const
Match multiple name-value pairs against the internally stored meta tags.
Definition: part.cpp:1949
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
Provide a mutual exclusion lock on an ibis::part object.
Definition: part.h:1585
A data structure to represent a sequence of bits.
Definition: bitvector.h:62
uint32_t tellReal() const
Tell the physical record number.
Definition: part.cpp:20557
virtual ~barrel()
Destructor. Member variables clean themselves.
Definition: part.h:1622
const uint64_t nrows
!< A string of name-value pairs.
Definition: part.h:1449
void queryTest(const char *pref, long *nerrors) const
Generate and run random queries for slefTest.
Definition: part.cpp:7225
long fill3DBins3(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, std::vector< bitvector > &bins) const
Resolve the 3rd column involved in the 3D bins.
Definition: parth3db.cpp:159
long fill2DBinsWeighted2(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
This version returns a vector of pointers to bitmaps.
Definition: parth2d.cpp:2329
array_t< rid_t > * rids
!< Meta tags as name-value pairs.
Definition: part.h:729
ibis::part::cleaner * myCleaner
!< Sizes of the dimensions.
Definition: part.h:743
static int writeColumn(int fdes, ibis::bitvector::word_t nold, ibis::bitvector::word_t nnew, ibis::bitvector::word_t voffset, const array_t< T > &vals, const T &fill, ibis::bitvector &totmask, const ibis::bitvector &newmask)
Write the content of vals to an open file.
Definition: part.cpp:19181
static long doComp(const array_t< T > &vals, F cmp, const ibis::bitvector &mask, array_t< T > &res, ibis::bitvector &hits)
Evaluate the range condition.
Definition: part.cpp:17175
long fill3DBins2(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, std::vector< bitvector > &bins) const
Resolve the 2nd column of the 3D bins.
Definition: parth3db.cpp:396
ibis::bitvector amask
!< Index specification.
Definition: part.h:738
long countHits(const ibis::qRange &cmp) const
Count the number of hits for a single range condition.
Definition: part.cpp:17408
info * getInfo() const
Return an ibis::part::info object that describes the current partition.
Definition: part.h:1769
long append1(const char *dir)
Perform append operation using only only one data directory.
Definition: parti.cpp:768
long fill1DBins(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, std::vector< ibis::bitvector > &bins) const
Fill the bitvectors representing the 1D bins.
Definition: parth.cpp:401
array_t< int64_t > * selectLongs(const char *name, const ibis::bitvector &mask) const
Retrieve values of the named column as 64-bit integers.
Definition: part.cpp:3021
long getDistribution(const char *name, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
Obsolete histogram functions.
Definition: parth.cpp:3553
A discrete range expression.
Definition: qExpr.h:337
void quickTest(const char *pref, long *nerrors) const
Generate and run random queries for slefTest.
Definition: part.cpp:7320
std::vector< uint32_t > shapeSize
!< Names of the dimensions.
Definition: part.h:741
std::vector< std::string > shapeName
!< An ordering of columns.
Definition: part.h:740
std::vector< unsigned > hits
!< The condition encompassing this one.
Definition: part.h:649
A struct to pack arguments to the function ibis_part_build_index.
Definition: part.h:652
static int writeStrings(const char *fnm, ibis::bitvector::word_t nold, ibis::bitvector::word_t nnew, ibis::bitvector::word_t voffset, const std::vector< std::string > &vals, ibis::bitvector &totmask, const ibis::bitvector &newmask)
Write strings to an open file.
Definition: part.cpp:19246
static long adaptiveFloatsDetailed(const ibis::bitvector &mask, const array_t< T > &vals, const T vmin, const T vmax, uint32_t nbins, std::vector< double > &bounds, std::vector< ibis::bitvector > &detail)
Bins the given values so that each each bin is nearly equal weight.
Definition: parth.cpp:2356
void rename(const ibis::partAssoc &known)
Rename the partition to avoid conflicts with an existing list of data partitions. ...
Definition: part.cpp:686
A function object to be used to register external cleaners.
Definition: fileManager.h:66
virtual long close()
!< Open all data files.
Definition: part.cpp:19894
uint32_t nRows() const
Return the number of rows.
Definition: part.h:86
void digestMeshShape(const char *shape)
Convert the string describing the shape into internal storage format.
Definition: part.cpp:1978
long fill3DBinsWeighted(const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, const array_t< double > &wts, std::vector< double > &weights, std::vector< bitvector * > &bins) const
The three triplets, (begin1, end1, stride1), (begin2, end2, stride2), and (begin3, end3, stride3), defines (1 + floor((end1 - begin1) / stride1)) (1 + floor((end2 - begin2) / stride2)) (1 + floor((end3 - begin3) / stride3)) 3D bins.
Definition: parth3dw.cpp:27
long appendToBackup(const char *dir)
Append data in dir to the partition in the backup directory.
Definition: parti.cpp:1154
uint32_t nEvents
!< List of the columns.
Definition: part.h:731
bool explicitRIDs() const
Does this partition have an explicit RID column? Returns true for yes, false for no.
Definition: part.h:120
Representing the operator 'LIKE'.
Definition: qExpr.h:585
void emptyCache() const
Empty all unused resources in cache.
Definition: parti.cpp:1619
virtual long reorder()
Sort rows with the lowest cardinality column first.
Definition: parti.cpp:31
std::string metaTags() const
Return the list of meta tags as a single string.
Definition: part.cpp:1907
ibis::util::counter cnt
!< Number of errors encountered.
Definition: part.h:646
void getNullMask(ibis::bitvector &mask) const
Collect the null masks together.
Definition: part.cpp:19709
Define the class ibis::column.
long count2DBins(array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, std::vector< uint32_t > &counts) const
Count the number of values in 2D bins.
Definition: parth2d.cpp:22
long get2DDistribution(const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, std::vector< uint32_t > &counts) const
Compute conditional 2D histogram with regularly spaced bins.
Definition: parth2d.cpp:54
std::vector< ibis::column::info * > cols
!< The number of rows in the partition.
Definition: part.h:1451
To read a list of variables at the same time.
Definition: part.h:1619
columnList columns
!< The object IDs (row id).
Definition: part.h:730
long get2DDistributionU(const ibis::column &col1, const ibis::column &col2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
Compute 2D histogram with uniform bins from base data.
Definition: parth2d.cpp:3643
barrel()
Constructor.
Definition: qExpr.h:763
The class compRange stores computed ranges.
Definition: qExpr.h:1167
long get1DBins(const char *constraints, const char *cname, double begin, double end, double stride, std::vector< ibis::bitvector > &bins) const
Partition values of the named variable into regularly spaced bins.
Definition: parth.cpp:478
A join is defined by two names and a numerical expression.
Definition: qExpr.h:1240
virtual long open(const ibis::part *t=0)
!< Destructor closes the open files.
Definition: part.cpp:19749
void setMetaTags(const ibis::resource::vList &mts)
Make a deep copy of the incoming name-value pairs.
Definition: part.cpp:1881
void unloadIndexes() const
Unload indexes of all columns.
Definition: part.cpp:6832