Hi, Teryl, If you want, you could pass a long string to the query object. If you pass the string through a shell (command line or exec), then you may have a problem with how long a command line can be. I don't believe there is a limitation on the string length from Bison/flex generated parser. That being said, you are probably looking for something that can directly construct an ibis::qExpr object to be passed to a query (or countQuery object).
For the long list of ips, there are a couple of constructors of ibis::qDiscreteRange that takes a std::vector as arguments, e.g., <http://su.pr/7x6Cq3>. The string version of this expression is "ip in (ip1, ip2, ..., ipN)." In C++, you put all ip1, ip2, ..., ipN into a std::vector<uint32_t> object and then create a ibis::qDiscreteRange as follows, ibis::qExpr* qexpr = new ibis::qDiscreteRange("ip", array_of_ips); (Assuming the array of ips is named array_of_ips). Let me know if you would like to see a more complete example. John PS: If you have another set of condition to be ANDed together with this list of ips, and don't want to create each term directly in your coe, you can pass that string version of it to the constructor ibis::whereClause, create another expression for the operator AND, and then assign the AND operator to a query as the where clause. Here is a bit more information. ibis::whereClause wc("whatever-other-conditions"); ibis::qExpr* and_op = new ibis::qExpr(ibis::qExpr::OP_AND); and_op->setLeft(wc.getExpr()->dup()); and_op->setRight(qexpr); ibis::query q; int ierr = q->setWhereClause(and_op); delete and_op; PPS: The last statement also deletes qexpr created earlier. This is because the destructor of ibis::qExpr recursively deletes all objects it points to. This is also why we have to make a copy of the query expression in the where clause wc (through a call to dup). On 3/4/2010 3:17 PM, Teryl Taylor wrote: > Hi everyone, > > > I'm currently using fastbit to store IP Netflow data and had a quick > question. Often times when analyzing netflow data, you'll want to > filter or query data based on a set of IP addresses. So for instance: > > select Bytes, Flows from part where sip = ip or sip = ip2 or sip = ip3 > or ...........or sip = ipN. > > where N could be in the hundreds or thousands. > > Just wondering, what would be the best way to do this? Is a where > clause a practical way? Would fastbit even be able to handle that? Or > is there some custom way I could do this? > > An optimal way would be to somehow pass in a file representing the ip set... > > select Bytes, Flows from part where sip = ipset.set > > > Any thoughts? > > Cheers, > > Teryl > > > > _______________________________________________ > FastBit-users mailing list > [email protected] > https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users _______________________________________________ FastBit-users mailing list [email protected] https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
