Opened 12 years ago
Closed 9 years ago
#372 closed defect (duplicate)
WCPS1.5_Returns Boolean, Binary scalar expressions without encoding
Reported by: | Piero Campalani | Owned by: | Alex Dumitru |
---|---|---|---|
Priority: | major | Milestone: | 10.0 |
Component: | petascope | Version: | development |
Keywords: | boolean scalar expression | Cc: | Vlad Merticariu, Dimitar Misev |
Complexity: | Medium |
Description
Apparently, boolean scalar expressions are not always recognized:
# OK for a in (mean_summer_airtemp) return TRUE
# ERROR for a in (mean_summer_airtemp) return (a[x:"CRS:1"(100),y:"CRS:1"(300)] = 0)
Related Petascope WCPS grammar (petascope.wcps.grammar.wcps.g
):
booleanScalarExpr returns[BooleanScalarExpr value] : e1=booleanScalarTerm { $value = $e1.value; } (op=(OR|XOR) e2=booleanScalarTerm { $value = new BooleanScalarExpr($op.text, $value, $e2.value);})* ; booleanScalarTerm returns[BooleanScalarExpr value] : e1=booleanScalarNegation { $value = $e1.value; } (op=AND e2=booleanScalarNegation { $value = new BooleanScalarExpr($op.text, $value, $e2.value); } )* ; booleanScalarNegation returns[BooleanScalarExpr value] : e1=booleanScalarAtom { $value = $e1.value; } | op=NOT e1=booleanScalarAtom { $value = new BooleanScalarExpr($op.text, $e1.value); } ; booleanScalarAtom returns[BooleanScalarExpr value] : LPAREN e1=booleanScalarExpr RPAREN { $value = $e1.value; } | s1=stringScalarExpr cop=compOp s2=stringScalarExpr { $value = new BooleanScalarExpr($cop.value, $s1.value, $s2.value); } | n1=numericScalarExpr cop=compOp n2=numericScalarExpr { $value = new BooleanScalarExpr($cop.value, $n1.value, $n2.value); } | e=BOOLEANCONSTANT { $value = new BooleanScalarExpr($e.text); } ;
WCPS standard:
booleanScalarExpr: | booleanScalarExpr and booleanScalarTerm | booleanScalarExpr or booleanScalarTerm | booleanScalarExpr xor booleanScalarTerm | booleanScalarTerm booleanScalarTerm: | booleanScalarTerm and booleanScalarFactor | booleanScalarTerm or booleanScalarFactor | booleanScalarTerm xor booleanScalarFactor | booleanScalarFactor booleanScalarFactor: | numericScalarExpr compOp numericScalarExpr | stringScalarExpr compOp stringScalarExpr | not booleanScalarExpr | booleanConstant
Change History (8)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Milestone: | 8.5 → Future |
---|---|
Priority: | major → minor |
I think the issue is that the grammar can't figure out that
a[x:"CRS:1"(100),y:"CRS:1"(300)]
is a scalar, i.e. it's considered a coverage, and equality of coverage and a scalar doesn't make sense.
This works for example, reducing explicitly the coverage to a scalar:
for c in (mr) return (max(c[x(100:100),y(100:100)]) = 1)
So there's a workaround. I'll put this on low priority, we could try to fix it at some point.
comment:3 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Reassigning to Utkrist, he's worked recently on the WCPS grammar.
comment:4 by , 10 years ago
Also remove the ':"CRS:1"' from the queries.
comment:5 by , 9 years ago
Owner: | changed from | to
---|
comment:6 by , 9 years ago
Cc: | added; removed |
---|---|
Milestone: | Future → 10.0 |
Priority: | minor → major |
Summary: | Boolean scalar expressions → WCPS1.5_Returns Boolean, Binary scalar expressions without encoding |
Version: | 8.4 → development |
I will regard to WCPS1.5, now, it does not support to returns a Boolean / Binary Operator of Scalar Expression without encoding, i.e:
for c in (mr) return c[i(0), j(0)] + 5
or
for c in (mr) return c[i(0), j(0)] = 0
An workaround is using "encode" and it will work in both cases
for c in (mr) return encode(c[i(0), j(0)] + 5, "csv")
So, I will leave for discussion, should every WCPS query without "encoding" will implicitly encode the result into "csv".
i.e: WCPS query:
for c in (mr) return c[i(0), j(0)] = 0 is equivalent to
for c in (mr) return encode(c[i(0), j(0)] = 0).
Then this ticket can be solved quickly.
comment:7 by , 9 years ago
It shouldn't return csv if there is no encode, but simply the single scalar value.
I guess if it makes your life easier you could internally encode to csv and then before returning to the user remove the '{' and '}' from the result. But that doesn't sound very elegant.
comment:8 by , 9 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
I will close this ticket and merge it with http://rasdaman.org/ticket/1270 as it has the same problem and will be fixed in WCPS 1.5.
Piero, please use the test coverages (rgb, mr, eobstest), or add the mean_summer_airtemp to the systemtest, so that everyone can easily run examples.