2010/5/3 K. John Wu <[email protected]>

> Hi, Valeria,
>
> Thanks for the feedback.
>
> On the command line, ibis.cpp should accept both forms of the limit
> clause and "limit 10" is equivalent to "limit 0,10".  Some of the
> function in ibis.cpp always take two arguments related to the limit
> clause, but the caller sets one of them to 0 as the default value.
>

Hi John,
in that case something goes wrong. I tried with only one argument, but did
not work as expected:

1) Two values: OK
ibis -d database -q "SELECT PORT WHERE PORT>0 LIMIT 0,3"
PORT (with counts)
1,    19
2,    2
3,    2

2) Only one value: something wrong
ibis -d database -q "SELECT PORT WHERE PORT>0 LIMIT 3"
PORT (with counts)
1,    19
2,    2
3,    2
4,    1
5,    2
.. and so on (print all values, no limit applied).

Is my syntax wrong?
Let me know,
Valeria



> The function ibis::table::dump has a new variation that takes an
> offset in addition to the argument nr.  If you find any of these does
> not work as advertised, please feel free to let us know.
>
> John
>
>
> On 5/3/2010 11:29 AM, Valeria Lorenzetti wrote:
> > Hi John,
> >
> > I tried the new feature using ibis and it seems to work perfectly!
> >
> > I tried to execute some special queries where the values used with LIMIT
> > exceed the number of records extracted from database and other queries
> > where the values used are critical (like 0 or 1).
> >
> > The result is that expected!
> >
> > In ibis however seems to be required to specify both values with the
> > LIMIT clause (start and limit). This could be simplified so that if you
> > specify a single value (eg. "LIMIT 10"), it is transparently transformed
> > into "LIMIT 0,<single_value>" (eg. "LIMIT 0,10").
> >
> > I am very glad I could contribute to your project, although in minimal
> part!
> >
> > Thanks,
> > Valeria
> >
> >
> >
> > 2010/4/29 K. John Wu <[email protected] <mailto:[email protected]>>
> >
> >     Hi, Valeria,
> >
> >     A update that implements your suggestion has been checked into the
> >     SVN repository.  Please give it a try when you get the chance.
> >
> >     You have two options to try:
> >
> >     -- use the new version function ibis::table::dump that take two
> >     integer parameters.  When you get a table as a result of a query,
> >     you will be invoking the concrete version from ibis::bord when you
> >     call this function.  This option follows closely what you have
> >     suggested.
> >
> >     -- use the command line tool ibis.cpp, you can now use two integers
> >     after the keyword limit, e.g.,
> >
> >     select a, b, where ... limit 3, 5
> >
> >     If you do get a chance to try it, please let us know if you
> >     encounter any problems.  Thanks for the suggestion.
> >
> >
> >     John
> >
> >
> >
> >     On 4/28/2010 1:17 PM, Valeria Lorenzetti wrote:
> >
> >         Hi John,
> >
> >         I wanted to share with you a functionality that I added to my
> >         code and I
> >         think could be very useful to other users of FastBit if
> >         introduced in
> >         the library.
> >
> >         Given my needs, I had to write my own function to print the rows
> >         that
> >         matching the query conditions. Following the example of
> >         ibis::bord::part::dump(), I rewrite my own function dump().
> >         Instead of
> >         use the LIMIT like in the original function, I added the ability
> >         to use
> >         the LIMIT with the syntax similar to MySQL.
> >
> >         In MySQL (http://dev.mysql.com/doc/refman/5.1/en/select.html),
> LIMIT
> >         takes one or two numeric arguments. With two arguments, the first
> >         argument specifies the index of the first row to return, and the
> >         second
> >         specifies the maximum number of rows to return. The index of the
> >         initial
> >         row is 0 (not 1):
> >
> >         E.g. SELECT * FROM tbl LIMIT 5,10;  # Retrieve rows 6-15
> >
> >         With one argument, the value specifies the number of rows to
> >         return from
> >         the beginning of the result set:
> >
> >         E.g: SELECT * FROM tbl LIMIT 5; # Retrieve first 5 rows
> >
> >
> >         This feature becomes very useful for displaying large amounts of
> >         data.
> >         In fact you can extract them in groups of <n> rows at once. It
> >         can be
> >         very useful also if you use HTML pages to display the results:
> >         you can
> >         spread the rows across pages using different LIMIT for each page:
> >
> >         LIMIT 0,20 (first page)
> >         LIMIT 20,20 (second page)
> >         LIMIT 40,20 (third page)
> >         and so on..
> >
> >         This could also be useful to examine the trend of results in the
> >         middle
> >         of dataset, and not only for the first rows.
> >
> >
> >         The change to be applied to the library to add this functionality
> I
> >         think it could be very simple and could be something like this:
> >
> >         ORIGINAL
> >         int ibis::bord::part::dump(std::ostream& out, uint32_t nr, const
> >         char* del)
> >
> >         NEW
> >         int ibis::bord::part::dump(std::ostream& out, uint32_t start,
> >         uint32_t
> >         offset, const char* del)
> >         ..
> >
> >         ORIGINAL
> >         for (uint32_t i = 1; i < nr; ++ i) {
> >              (void) clist[0]->dump(out, i);
> >                ...
> >
> >         NEW
> >         /* No limit specified, all lines are printed */
> >         if (offset < 0) offset = nr_tot_rows;
> >
> >         for (uint32_t i = start; i < start+offset && i < nr_tot_rows; ++
> >         i) {
> >             (void) clist[0]->dump(out, i);
> >             ...
> >
> >
> >         Let me know if you think it's a good idea and sorry for this
> >         endless email!
> >
> >         Best regards,
> >         Valeria Lorenzetti
> >
> >
> >
> >         _______________________________________________
> >         FastBit-users mailing list
> >         [email protected] <mailto:
> [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
>
_______________________________________________
FastBit-users mailing list
[email protected]
https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users

Reply via email to