77 virtual uint32_t
size()
const {
78 return (starts != 0 && starts->size()>0 ? starts->size()-1 : 0);}
80 virtual uint32_t
width()
const {
return 0;}
82 virtual void print(std::ostream& out)
const = 0;
84 virtual void printAll(std::ostream& out)
const = 0;
93 virtual int32_t
getInt(uint32_t, uint32_t)
const;
94 virtual uint32_t
getUInt(uint32_t, uint32_t)
const;
95 virtual int64_t
getLong(uint32_t, uint32_t)
const;
96 virtual uint64_t
getULong(uint32_t, uint32_t)
const;
97 virtual float getFloat(uint32_t, uint32_t)
const;
98 virtual double getDouble(uint32_t, uint32_t)
const;
102 virtual std::string
getString(uint32_t, uint32_t)
const;
116 virtual void reorder(
const char *) = 0;
118 virtual long truncate(uint32_t keep) = 0;
120 virtual long truncate(uint32_t keep, uint32_t start) = 0;
122 virtual long truncate(
const char *names, uint32_t keep) = 0;
129 void sortRIDs(uint32_t i, uint32_t j);
130 void swapRIDs(uint32_t i, uint32_t j) {
132 ibis::rid_t tmp = (*rids)[i];
133 (*rids)[i] = (*rids)[j];
139 if (starts != 0 && ind+1 < starts->size()) {
140 return (*starts)[ind+1]-(*starts)[ind];
152 if (rids != 0 && starts != 0 && ind+1 < starts->size()) {
153 return new ibis::RIDSet(*rids, (*starts)[ind], (*starts)[ind+1]);
173 : comps(c), starts(0), rids(0), id(
""), infile(false) {};
177 : comps(q.components()), starts(0),
178 rids(q.getRIDs(*(q.getHitVector()))), id(q.id()),
180 if (rids != 0 && static_cast<long>(rids->
size()) != q.
getNumHits()) {
186 : comps(q.components()), starts(0), rids(q.getRIDs(hits)),
187 id(q.id()), infile(false) {};
189 : comps(s), starts(new array_t<uint32_t>), rids(t.getRIDs()),
190 id(t.name()), infile(false) {
193 (*starts)[1] = t.
nRows();
198 bundle(
const bundle&);
199 bundle& operator=(
const bundle&);
209 virtual void print(std::ostream& out)
const;
210 virtual void printAll(std::ostream& out)
const;
218 virtual long truncate(uint32_t, uint32_t) {
return 1;}
219 virtual long truncate(
const char *, uint32_t) {
return 1;}
222 if (rids != 0 && infile ==
false) {
237 virtual uint32_t
size()
const {
return (col ? col->size() : 0);}
238 virtual uint32_t
width()
const {
return 1;}
241 virtual void print(std::ostream& out)
const;
242 virtual void printAll(std::ostream& out)
const;
245 virtual int32_t
getInt(uint32_t, uint32_t)
const;
246 virtual uint32_t
getUInt(uint32_t, uint32_t)
const;
247 virtual int64_t
getLong(uint32_t, uint32_t)
const;
248 virtual uint64_t
getULong(uint32_t, uint32_t)
const;
249 virtual float getFloat(uint32_t, uint32_t)
const;
250 virtual double getDouble(uint32_t, uint32_t)
const;
251 virtual std::string
getString(uint32_t, uint32_t)
const;
254 return (j == 0 ? col->columnPointer() :
259 return (j == 0 ? col->getArray() : 0);}
273 virtual long truncate(uint32_t, uint32_t);
274 virtual long truncate(
const char *, uint32_t keep);
298 virtual uint32_t
size()
const {
299 return (cols.empty() ? 0 : cols.back()->size());}
300 virtual uint32_t
width()
const {
return cols.size();}
302 virtual void print(std::ostream& out)
const;
303 virtual void printAll(std::ostream& out)
const;
307 virtual int32_t
getInt(uint32_t, uint32_t)
const;
308 virtual uint32_t
getUInt(uint32_t, uint32_t)
const;
309 virtual int64_t
getLong(uint32_t, uint32_t)
const;
310 virtual uint64_t
getULong(uint32_t, uint32_t)
const;
311 virtual float getFloat(uint32_t, uint32_t)
const;
312 virtual double getDouble(uint32_t, uint32_t)
const;
313 virtual std::string
getString(uint32_t, uint32_t)
const;
316 return (j < cols.size() ? cols[j]->columnPointer() :
321 return (j < cols.size() ? cols[j]->getArray() : 0);}
323 virtual void reorder(
const char *);
324 virtual long truncate(uint32_t keep);
325 virtual long truncate(uint32_t keep, uint32_t start);
326 virtual long truncate(
const char *names, uint32_t keep);
330 std::vector<ibis::selectClause::AGREGADO> aggr;
357 uint32_t width()
const {
return(bdl_!=0 ? bdl_->width() : 0U);}
370 int32_t
getInt(
const char *cname)
const;
372 uint32_t
getUInt(
const char *cname)
const;
374 int64_t
getLong(
const char *cname)
const;
376 uint64_t
getULong(
const char *cname)
const;
379 float getFloat(
const char *cname)
const;
382 double getDouble(
const char *cname)
const;
383 std::string
getString(
const char *cname)
const;
390 return bdl_->getInt(bid_-1, selind);
395 return bdl_->getUInt(bid_-1, selind);
399 return bdl_->getLong(bid_-1, selind);
404 return bdl_->getULong(bid_-1, selind);
409 return bdl_->getFloat(bid_-1, selind);
414 return bdl_->getDouble(bid_-1, selind);
420 return bdl_->getString(bid_-1, selind);
422 inline uint32_t colPosition(
const char *cname)
const
423 {
return sel.find(cname);}
425 void printColumnNames(std::ostream& out)
const {
427 bdl_->printColumnNames(out);
439 result(
const result&);
440 result& operator=(
const result&);
442 #endif // IBIS_BUNDLE_H
virtual uint64_t getULong(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 64-bit unsigned integer.
Definition: bundle-140522.cpp:1120
virtual ibis::TYPE_T columnType(uint32_t) const
Return the type used to store the values of the jth column of the bundle.
Definition: bundle.h:107
virtual uint32_t size() const
Return the number of bundles.
Definition: bundle.h:237
int64_t getLong(const char *cname) const
Retrieve the value as a 64-bit integer.
Definition: bundle-140522.cpp:2682
virtual void reorder(const char *)=0
Re-order the bundles according to the new keys.
virtual void reorder(const char *)
Re-order the bundles according to the new keys.
Definition: bundle.h:215
const ibis::array_t< uint32_t > * getStarts() const
Return the pointer to array starts.
Definition: bundle.h:162
The bundle with multiple components.
Definition: bundle.h:291
virtual void print(std::ostream &out) const
Print the bundle values to the specified output stream.
Definition: bundle-140522.cpp:353
virtual long truncate(uint32_t keep)
This single-arugment version of the function truncate keeps the first few rows.
Definition: bundle-140522.cpp:2115
size_t size() const
Definition: array_t.h:69
virtual double getDouble(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 64-bit floating-point number.
Definition: bundle-140522.cpp:2566
The bundle with only one component.
Definition: bundle.h:230
long getNumHits() const
Compute the number of records in the exact solution.
Definition: query.cpp:1249
virtual const ibis::column * columnPointer(uint32_t j) const
Column pointer.
Definition: bundle.h:253
void writeRIDs(const RIDSet *rids) const
Write the list of RIDs to a file named "-rids".
Definition: query.cpp:4716
virtual void printColumnNames(std::ostream &out) const
Print column names.
Definition: bundle-140522.cpp:823
virtual uint32_t width() const
Return the width of the bundles.
Definition: bundle.h:80
virtual void write(const ibis::query &) const
Write the bundle to the directory for the query q.
Definition: bundle-140522.cpp:2443
virtual void print(std::ostream &out) const
Print the bundle values to the specified output stream.
Definition: bundle-140522.cpp:767
virtual float getFloat(uint32_t, uint32_t) const
Return the maximal float value.
Definition: bundle-140522.cpp:298
virtual void printAll(std::ostream &out) const
Print the bundle values along with the RIDs.
Definition: bundle-140522.cpp:358
virtual void printAll(std::ostream &out) const
Print the bundle values along with the RIDs.
Definition: bundle-140522.cpp:796
The public interface of bundles.
Definition: bundle.h:67
uint32_t rowCounts(array_t< uint32_t > &cnt) const
Compute the number of rows in each group(bundle).
Definition: bundle-140522.cpp:314
A class to represent the select clause.
Definition: selectClause.h:112
virtual void printColumnNames(std::ostream &out) const
Print column names.
Definition: bundle-140522.cpp:1620
virtual long truncate(const char *, uint32_t)
Truncate the list of bundle based on specified keys.
Definition: bundle.h:219
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
virtual uint32_t size() const
Return the number of bundles.
Definition: bundle.h:298
The class to represent a column of a data partition.
Definition: column.h:65
virtual void printAll(std::ostream &out) const =0
Print the bundle values along with the RIDs.
virtual uint32_t getUInt(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 32-bit unsigned integer.
Definition: bundle-140522.cpp:1098
virtual uint32_t getUInt(uint32_t, uint32_t) const
Return the maximal unsigned int value.
Definition: bundle-140522.cpp:283
The header file defining the individual query objects.
virtual ibis::TYPE_T columnType(uint32_t j) const
Return the type used to store the values of the jth column of the bundle.
Definition: bundle.h:256
virtual std::string getString(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a string.
Definition: bundle-140522.cpp:1154
uint32_t numRowsInBundle(uint32_t ind) const
Compute the number of rows in bundle ind.
Definition: bundle.h:138
float getFloat(const char *cname) const
Retrieve the value of the named column as a single-precision floating-point number.
Definition: bundle-140522.cpp:2692
virtual void write(const ibis::query &q) const =0
Write the bundle to the directory for the query q.
bool next()
Move to the next row/record of results.
Definition: bundle-140522.cpp:2623
virtual void write(const ibis::query &q) const
Write the bundle to the directory for the query q.
Definition: bundle.h:221
int64_t getLong(uint32_t selind) const
Retrieve the value as a 64-bit integer.
Definition: bundle.h:398
char * getString(const char *buf)
Extract a string from the given buf.
Definition: util.cpp:166
virtual const ibis::column * columnPointer(uint32_t) const
Column pointer.
Definition: bundle.h:113
A data structure for representing user queries.
Definition: query.h:48
double getDouble(const char *cname) const
Retrieve the value of the named column as a double-precision floating-point number.
Definition: bundle-140522.cpp:2697
virtual std::string getString(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a string.
Definition: bundle-140522.cpp:2577
void sortRIDs(uint32_t i, uint32_t j)
Sort RIDs in the range of [i, j)
Definition: bundle-140522.cpp:118
The class ibis::query::result allows user to retrieve query result one row at a time.
Definition: bundle.h:352
virtual void printAll(std::ostream &out) const
Print out the bundles with RIDs.
Definition: bundle-140522.cpp:1580
virtual int64_t getLong(uint32_t, uint32_t) const
Return the maximal int value.
Definition: bundle-140522.cpp:288
virtual long truncate(uint32_t, uint32_t)
Truncate the list of bundles.
Definition: bundle.h:218
virtual uint32_t width() const
Return the width of the bundles.
Definition: bundle.h:238
virtual int32_t getInt(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 32-bit integer.
Definition: bundle-140522.cpp:1087
uint32_t getUInt(uint32_t selind) const
Retrieve the value of column selind in the select clause as an unsigned integer.
Definition: bundle.h:394
virtual uint64_t getULong(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 64-bit unsigned integer.
Definition: bundle-140522.cpp:2542
The class ibis::part represents a partition of a relational table.
Definition: part.h:27
virtual int64_t getLong(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 64-bit integer.
Definition: bundle-140522.cpp:2531
TYPE_T
Supported data types.
Definition: table.h:25
virtual int32_t getInt(uint32_t, uint32_t) const
Retrieve a single value.
Definition: bundle-140522.cpp:278
virtual double getDouble(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 64-bit floating-point value.
Definition: bundle-140522.cpp:1142
float getFloat(uint32_t selind) const
Retrieve the value of column selind in the select clause as a single-precision floating-point number...
Definition: bundle.h:408
bundle0(const ibis::query &q)
Constructor.
Definition: bundle-140522.cpp:334
std::string getString(uint32_t selind) const
Retrieve the string value.
Definition: bundle.h:419
virtual void print(std::ostream &out) const
Print out the bundles without RIDs.
Definition: bundle-140522.cpp:1531
virtual long truncate(uint32_t)
This single-argument version keep the first few records.
Definition: bundle-140522.cpp:973
A set of utility classes for storing the selected values.
virtual double getDouble(uint32_t, uint32_t) const
Return the maximum double value.
Definition: bundle-140522.cpp:303
void resize(size_t n)
Change the size of the array to have elements.
Definition: array_t.cpp:1469
const ibis::RIDSet * getRIDs() const
Return the pointer to all RIDs.
Definition: bundle.h:160
uint64_t getULong(const char *cname) const
Retrieve the value as a 64-bit unsigned integer.
Definition: bundle-140522.cpp:2687
virtual uint32_t width() const
Return the width of the bundles.
Definition: bundle.h:300
static const ibis::RIDSet * readRIDs(const char *dir, const uint32_t i)
Return the RIDs related to the ith bundle.
Definition: bundle-140522.cpp:178
void reset()
Move the internal pointer back to the beginning.
Definition: bundle-140522.cpp:2667
virtual float getFloat(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 32-bit floating-point number.
Definition: bundle-140522.cpp:2554
virtual int32_t getInt(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 32-bit integer.
Definition: bundle-140522.cpp:2509
virtual void reorder(const char *)
Reorder the values.
Definition: bundle.h:266
bool nextBundle()
Jump to the next bundle of results.
Definition: bundle-140522.cpp:2650
void clear(ibis::array_t< ibis::bitvector * > &bv)
Clear an array of bit vectors.
Definition: bitvector.cpp:4662
virtual int64_t getLong(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 64-bit integer.
Definition: bundle-140522.cpp:1109
virtual float getFloat(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 32-bit floating-point value.
Definition: bundle-140522.cpp:1131
virtual void printColumnNames(std::ostream &) const
Print column names. No column name to print in this case.
Definition: bundle.h:212
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 const ibis::column * columnPointer(uint32_t j) const
Column pointer.
Definition: bundle.h:315
virtual uint64_t getULong(uint32_t, uint32_t) const
Return the maximal unsigned int value.
Definition: bundle-140522.cpp:293
virtual void * columnArray(uint32_t) const
Return the pointer to the underlying array used to store the jth column of the bundle.
Definition: bundle.h:111
Unknown type, a place holder. Can not process data of this type!
Definition: table.h:27
uint32_t getUInt(const char *cname) const
Retrieve the value of the named column as an unsigned integer.
Definition: bundle-140522.cpp:2677
virtual void * columnArray(uint32_t j) const
Return the pointer to the underlying array used to store the jth column of the bundle.
Definition: bundle.h:320
virtual ~bundle1()
Destructor.
Definition: bundle-140522.cpp:758
static bundle * create(const ibis::query &, int=0)
Create new bundle from a query object.
Definition: bundle-140522.cpp:26
virtual long truncate(uint32_t)
Truncate the list of bundles.
Definition: bundle.h:217
double getDouble(uint32_t selind) const
Retrieve the value of column selind in the select clause as a double-precision floating-point number...
Definition: bundle.h:413
virtual void reorder(const char *)
Reorder the bundles according to the keys (names) given.
Definition: bundle-140522.cpp:1834
virtual void * columnArray(uint32_t j) const
Return the pointer to the underlying array used to store the jth column of the bundle.
Definition: bundle.h:258
A pure virtual base class for storing selected values in memory.
Definition: colValues.h:14
uint64_t getULong(uint32_t selind) const
Retrieve the value of column selind in the select clause as a 64-bit unsigned integer.
Definition: bundle.h:403
virtual uint32_t getUInt(uint32_t, uint32_t) const
Retrieve the value of i-th row j-th column as a 32-bit unsigned integer.
Definition: bundle-140522.cpp:2520
const ibis::RIDSet * getRIDs(uint32_t ind) const
Return the RIDs of the indth bundle.
Definition: bundle.h:151
virtual std::string getString(uint32_t, uint32_t) const
Retrieve a string value.
Definition: bundle-140522.cpp:309
The null bundle. It contains only a list of RIDs.
Definition: bundle.h:203
uint32_t nRows() const
Return the number of rows.
Definition: part.h:86
virtual uint32_t size() const
Return the number of bundles.
Definition: bundle.h:77
virtual long truncate(uint32_t keep)=0
Truncate the list of bundles.
virtual ibis::TYPE_T columnType(uint32_t j) const
Return the type used to store the values of the jth column of the bundle.
Definition: bundle.h:318
int32_t getInt(const char *cname) const
Retrieve the value of the named column as a signed integer.
Definition: bundle-140522.cpp:2672
virtual void printColumnNames(std::ostream &out) const =0
Print column names.
virtual void write(const ibis::query &) const
Write the bundle to the directory for the query q.
Definition: bundle-140522.cpp:1032
int32_t getInt(uint32_t selind) const
Retrieve the value of column selind in the select clause as a signed integer.
Definition: bundle.h:389
virtual void print(std::ostream &out) const =0
Print the bundle values to the specified output stream.