On Monday 11 January 2010 18:22:16 you wrote:
> Hi, Andreas,

Hi,
 
> I have just checked in a fix to exclude the null values from the
> results.  In the example
> 
> select avg(c) from null_test where 1=1;
> 
> the output would look something like the following
> 
> tableSelect -- the result table (1 x 2) for "SELECT avg(c) FROM
> T-null_test WHERE 1=1"
> 2, 3

This is exactly the result i would expect here.

> The results only include three rows; the row where c is null is
> excluded.  If you are fine with this way of handling null values,
> please give it a try and let us know if you encounter any problems.
> If you would rather see null values handle properly,  i.e., like to
> see the result having 4 rows, have 'select avg(c), count(*)' print out
> something like the following
> 
> 2, 3
> , 1

No that's not needed and i don't see a usecase for this.

I made a quick tests against MySQL and the way you just implemented it seems 
to be perfectly fine (i assume MySQL is doing SQL compatible stuff when doing 
basic SQL ;) ):

CREATE TABLE test (a int,b int);
INSERT INTO test SET a=NULL,b=4;
INSERT INTO test SET a=2,b=3;

SELECT AVG(a),COUNT(a) FROM test;
+--------+----------+
| AVG(a) | COUNT(a) |
+--------+----------+
| 2.0000 |        1 |
+--------+----------+

This is more or less the same you just did in fastbit.

SELECT AVG(a),COUNT(a) FROM test;
+--------+----------+
| AVG(a) | COUNT(a) |
+--------+----------+
| 2.0000 |        1 |
+--------+----------+

This is of course a bit different as COUNT on a specific column doesn't count 
the NULLs of this column.



> (note the null value printed on the second row)
> let us know, we will put this feature request on the list of things to do.
> 
> John

Kind regards,

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

Reply via email to