Opened 11 years ago
Closed 8 years ago
#601 closed defect (invalid)
Escaping logical ANDs chains when collections are involved
Reported by: | Piero Campalani | Owned by: | Dimitar Misev |
---|---|---|---|
Priority: | minor | Milestone: | Future |
Component: | qlparser | Version: | development |
Keywords: | and chain collection escape | Cc: | |
Complexity: | Hard |
Description
When creating a logical chain and ANDs, RasQL evaluates 2nd (and further) logical conditions also if the first is false.
While with scalars it properly escapes the chain at the first false condition:
# [0 == 9999] && [ln(-1) == 0] : $ rasql -q "select (((0)=(9999))and(((ln(-1))=(0)))) from eobstest AS c" --out hex Result element 1: f
… it does not with marrays:
# WCPS for c in (eobscov) return encode ( count( c[t("1950-01-04")] = -9999 and ln(3932 + c[t("1950-01-04")]) = 1 ) , "csv") # -> RASQL $ rasql -q "select csv(count_cells((((((c) [3,*:*,*:*])=(-9999)))and(((ln(((3932)+((c) [3,*:*,*:*]))))=(1)))))) from eobstest AS c" --out hex Executing retrieval query...rasdaman error 510: Execution error 510 in line 1, column 60, near token ln: The argument is outside the function domain.
Over cells which do satisfy the first condition, the argument of the logarithm in the second logical condition becomes >0, whereas the reported RasQL error is thrown because the condition is evaluated also for cells which do not satisfy the first condition (i.e. == -9999), and hence push down the argument of the logarithm below zero, so "outside the function domain".
Change History (4)
comment:1 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 11 years ago
Owner: | changed from | to
---|
comment:3 by , 11 years ago
Component: | undecided → qlparser |
---|---|
Priority: | major → minor |
comment:4 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
Closing as invalid, as the request doesn't fit with how rasql works. AND, OR, etc. are induced on arrays, and we cannot make them in certain contexts to act as non-induced.
So let's consider this query:
mr > 300 produces a boolean array, where all cells greater than 300 are 1, and the rest are 0. In this case all cells are 0 in the result array.
The order of evaluation is
Piero is suggesting that c. should be embeded into the evaluation of b. This is an optimization issue which will be non-trivial to implement, and since it can be fixed with the switch statement I'll put it on low priority.