Opened 8 years ago

Closed 8 years ago

#1532 closed defect (worksforme)

Rasql_Null values are not counted

Reported by: Bang Pham Huu Owned by: bbell
Priority: major Milestone: 9.4
Component: rasql Version: development
Keywords: Cc: Dimitar Misev, Vlad Merticariu
Complexity: Medium

Description

rasdaman has a problem now with operation with null values (in this case is: -9999 of a test coverage), for example:

rasql -q ' SELECT encode( count_cells(c[0,0:100,0:231] > -9999) , "csv" ) FROM test_eobstest AS c' --out string
Result object 1: 0
rasql done.

rasql -q ' SELECT encode( count_cells(c[0,0:100,0:231] > -9998) , "csv" ) FROM test_eobstest AS c' --out string
Result object 1: 6774
rasql done.

Here is the generated rasql from WCPS:

for c in (test_eobstest) return encode(
count(c[t("1950-01-01")] >= -9999)
,"csv")

SELECT encode( count_cells(c[0,0:100,0:231] >= -9999) , "csv" ) FROM test_eobstest AS c 

which also returns 0.

Change History (5)

comment:1 by bbell, 8 years ago

The problem is not with count_cells; the problem seems to have something to do with the way that null values are being handled by QtCondense.

For example, if you alter the query (c/o Bang):

rasql -q ' SELECT encode((c[0,0:100,0:231] > -9999) , "csv" ) FROM test_eobstest AS c' --out string

then you will also receive something different from

rasql -q ' SELECT encode((c[0,0:100,0:231] > -9998) , "csv" ) FROM test_eobstest AS c' --out string

It is worth remarking that -9999 is the null value for this data set.

comment:2 by bbell, 8 years ago

Even more weirdness — if you replace > by - or +, suddenly every entry becomes the null value of -9999, but if you do it with - -9998 or + -9998, the non-null entries remain non-null.

How should Rasdaman treat null values in expressions?

comment:3 by Dimitar Misev, 8 years ago

check the QL guide please.

comment:4 by bbell, 8 years ago

Query guide, page 85:

Generally, if somewhere in the input to an individual cell value computat-
ion a null value is encountered then the overall result will be null – in other
words: if at least one of the operands of a cell operation is null then the
overall result of this cell operation is null.
Exceptions:

Comparison operators (that is: ==, !=, >, ≥, <, ⇐) encountering a null
value will always return a Boolean value; for example, both n == n and
n != n (for any null value n ) will evaluate to false.

In a cast operation, nulls are treated like regular values.

In a scale() operation, null values are treated like regular values (this will be changed in the future).

Format conversion of an MDD object ignores null values. Conversion
from some data format into an MDD likewise imports the actual cell
values; however, during any eventual further processing of the target
MDD as part of an update or insert statement, cell values listed in
the null value set of the pertaining MDD definition will be interpreted as
null.

Last edited 8 years ago by bbell (previous) (diff)

comment:5 by bbell, 8 years ago

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.