Opened 9 years ago
Closed 5 years ago
#928 closed defect (duplicate)
Incorrect result of CASE statement with MDDs in "then" clauses
Reported by: | Veranika Liaukevich | Owned by: | dkamov |
---|---|---|---|
Priority: | major | Milestone: | 10.0 |
Component: | qlparser | Version: | development |
Keywords: | Cc: | ||
Complexity: | Medium |
Description
Case statement returns wrong results if one of result expressions (then clause) is a database MDD.
Example: array test
has 4 cells:
$ rasql -q 'select csv(x) from test as x' --out string {1,2},{3,4}
Wrong case statement result:
$ rasql-q 'select csv(case when mod(x, 2) = 1 then x else 0 end) from test as x' --out string {67305985,0},{1027,0}
However, the statement produces correct results if an argument is a general expression:
$ rasql -q 'select csv(case when mod(x, 2) = 1 then 1*x else 0 end) from test as x' --out string {1,0},{3,0}
Change History (9)
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 9 years ago
Milestone: | → 9.2 |
---|
comment:3 by , 8 years ago
Milestone: | 9.2 → 9.4 |
---|
comment:4 by , 8 years ago
Milestone: | 9.4 → 9.5 |
---|
comment:5 by , 7 years ago
Milestone: | 9.5 → 9.6 |
---|
comment:6 by , 7 years ago
Milestone: | 9.6 → 9.7 |
---|---|
Owner: | changed from | to
comment:7 by , 5 years ago
Milestone: | 9.7 → 10.0 |
---|---|
Owner: | changed from | to
comment:8 by , 5 years ago
Currently running the query given gives out this error:
[ERROR] - 2019-08-13 16:02:10,180, qlparser/qtcaseop.cc:592: THEN / ELSE results in CASE statement have different base types (at operand 3). Please add casts as necessary to make sure all result expressions are of the same base type. rasdaman error 430: Execution error 430 in line 1, column 12, near token case: The results have incompatible types.
which is reasonable x
is recognized as a char
and 0
as long
.
I could produce a result instead of an error if I add in compatibleWith
the case of char
and long
, and in getResultType
the return of a char
. Should I do that?
comment:9 by , 5 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
No, your proposed fix works only for this specific query in the ticket. What if x was short?
The error is good now, so closing as duplicate (clearly this ticket was already fixed before).
Still the case:
It looks like some uninitialized data, but the output is pretty consistent and valgrind doesn't report any issue. So not sure what exactly is wrong.