Hi, Jong,

The function ibis::column::indexSize is not a reliable way to tell
whether an index has been built.  In your particular case, the index
is most likely not built.  Since you are playing with in-memory data,
the attached example might be a good starting point.

John


On 3/19/13 1:28 PM, Jong Choi wrote:
> Hi,
> 
> I am trying to verify if an index is there before querying but haven't
> found a good solution yet. So far, I tried to see
> ibis::column::indexSize() but I got "-1". Is there any good way to
> check such thing?
> 
> Just for your reference, here is part of my code:
> 
> std::auto_ptr<ibis::tablex> ta(ibis::tablex::create());
> int buf[] = {10, -21, 32, -43, 54, -65, 76, -87, 98, -127};
> 
> ta->addColumn("col1", ibis::INT);
> ta->append("col1", 0, 10, buf);
> 
> std::auto_ptr<ibis::table> tb(ta->toTable());
> tb->buildIndex("col1");
> 
> ibis::constPartList parts;
> int ierr = tb->getPartitions(parts);
> assert(ierr > 0);
> 
> for (ibis::constPartList::const_iterator it = parts.begin(); it !=
> parts.end(); ++it)
> {
>         ibis::part::info *info = (*it)->getInfo();
>         std::clog << "name :" << info->name << std::endl;
> 
>         int nColumns = (*it)->nColumns();
>         for (int i = 0; i < nColumns; i++)
>         {
>             ibis::column * col = (*it)->getColumn(i);
>             std::clog << "size :" << col->indexSize() << std::endl;
>         }
> }
> 
> // Query
> ibis::table* res = tb->select("val", "val > 0");
> ...
> 
> I will appreciate any advice or help.
> 
> Thanks,
> 
> Jong
> _______________________________________________
> FastBit-users mailing list
> [email protected]
> https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
> 

Attachment: casearch.tar.gz
Description: GNU Zip compressed data

_______________________________________________
FastBit-users mailing list
[email protected]
https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users

Reply via email to