#2273 closed defect (worksforme)
rasql - error with > operator in switch case
Reported by: | Bang Pham Huu | Owned by: | apercov |
---|---|---|---|
Priority: | major | Milestone: | 10.0 |
Component: | server | Version: | 9.8 |
Keywords: | Cc: | Dimitar Misev, Vlad Merticariu | |
Complexity: | Medium |
Description
This query below works with 25 = ...
on rgb
collection
rasql -q 'SELECT ENCODE( ( Scale( ( ( case when 25 = ( extend(shift(project(c0, "6.92725,51.92725,7.838375,52.83837499999999", "EPSG:4326", "6.92725,51.92725,7.838375,52.838375", "EPSG:4326", 0.002, 0.002), [0,0]), [0:455,0:455]) )[53:402,53:402] then {255c, 255c, 255c} when 18 > ( extend(shift(project(c0, "6.92725,51.92725,7.838375,52.83837499999999", "EPSG:4326", "6.92725,51.92725,7.838375,52.838375", "EPSG:4326", 0.002, 0.002), [0,0]), [0:455,0:455]) )[53:402,53:402].1 then {0c, 0c, 255c} when 23 > ( extend(shift(project(c0, "6.92725,51.92725,7.838375,52.83837499999999", "EPSG:4326", "6.92725,51.92725,7.838375,52.838375", "EPSG:4326", 0.002, 0.002), [0,0]), [0:455,0:455]) )[53:402,53:402].2 then {255c, 255c, 0c} when 30 > ( extend(shift(project(c0, "6.92725,51.92725,7.838375,52.83837499999999", "EPSG:4326", "6.92725,51.92725,7.838375,52.838375", "EPSG:4326", 0.002, 0.002), [0,0]), [0:455,0:455]) )[53:402,53:402].0 then {255c, 140c, 0c} else {255c, 0c, 0c} end ) ), [0:255, 0:255] ) ) , "png", "{ \"nodata\" : [ 0 ] }") FROM test_rgb AS c0'
But this one with 25 > ...
does not work
asql -q 'SELECT ENCODE( ( Scale( ( ( case when 25 > ( extend(shift(project(c0, "6.92725,51.92725,7.838375,52.83837499999999", "EPSG:4326", "6.92725,51.92725,7.838375,52.838375", "EPSG:4326", 0.002, 0.002), [0,0]), [0:455,0:455]) )[53:402,53:402] then {255c, 255c, 255c} when 18 > ( extend(shift(project(c0, "6.92725,51.92725,7.838375,52.83837499999999", "EPSG:4326", "6.92725,51.92725,7.838375,52.838375", "EPSG:4326", 0.002, 0.002), [0,0]), [0:455,0:455]) )[53:402,53:402].1 then {0c, 0c, 255c} when 23 > ( extend(shift(project(c0, "6.92725,51.92725,7.838375,52.83837499999999", "EPSG:4326", "6.92725,51.92725,7.838375,52.838375", "EPSG:4326", 0.002, 0.002), [0,0]), [0:455,0:455]) )[53:402,53:402].2 then {255c, 255c, 0c} when 30 > ( extend(shift(project(c0, "6.92725,51.92725,7.838375,52.83837499999999", "EPSG:4326", "6.92725,51.92725,7.838375,52.838375", "EPSG:4326", 0.002, 0.002), [0,0]), [0:455,0:455]) )[53:402,53:402].0 then {255c, 140c, 0c} else {255c, 0c, 0c} end ) ), [0:255, 0:255] ) ) , "png", "{ \"nodata\" : [ 0 ] }") FROM test_rgb AS c0'
with error
Executing retrieval query... rasdaman error 455: Execution error 455 in line 1, column 42, near token >: Operation not supported on operand of complex type.
Change History (5)
comment:1 by , 5 years ago
Status: | assigned → accepted |
---|
comment:2 by , 5 years ago
comment:3 by , 5 years ago
Resolution: | → worksforme |
---|---|
Status: | accepted → closed |
Indeed, this is not supported in rasql. According to the documentation https://doc.rasdaman.org/04_ql-guide.html#induction-all-operations
On composite cells, only = and != are supported; both operands must have a compatible cell structure. In this case, the comparison result is the conjunction (“and” connection) of the pairwise comparison of all cell components.
So the implementation currently supports even more than what the documentation says. Comparison of two struct values should work, so you can try for example
{25,25,25} > rgbcoll
comment:4 by , 5 years ago
why " when 18 > MDD" in the description work?
the query is "case 25 = MDD then … when 18 > MDD then…"
This is the expected behavior. Only OP_EQUAL is defined for operations between struct and non-structs. If it shouldn't be like that, what would be the definition for the comparison?
EQUAL only gives true if the scalar value is equal to every element of the struct.