Opened 11 years ago

Closed 8 years ago

#517 closed defect (fixed)

WCPS1.5_Unknown variable due to nested coverage constructors

Reported by: Dirk Daems Owned by: Dimitar Misev
Priority: major Milestone: 9.3
Component: petascope Version: development
Keywords: Cc: Piero Campalani, Alex Dumitru, Vlad Merticariu
Complexity: Medium

Description

for c in (NDVI_SPOT_VGT)
return encode
   (coverage NDVI_HIST_MAX
    over     $px x(4000:4010),
             $py y(4000:4010)
    values  
     ( ( count
        (
          coverage NDVI_COUNT
          over     $pt3 t(0:14)
          values    (c[t(28 + $pt3*36),x:"CRS:1"($px),y:"CRS:1"($py)]) > 140 ) = 15 ) * 140 )
                    + max(
                      (
                       coverage NDVI_T_SERIES
                        over     $pt t(0:14)
                        values    c[t(28 + $pt*36),x:"CRS:1"($px),y:"CRS:1"($py)]
                     )
                      *
                     (
                       coverage NDVI_T_SERIES2
                        over     $pt2 t(0:14)
                        values    (c[t(28 + $pt2*36),x:"CRS:1"($px),y:"CRS:1"($py)] < 140)
                     )
          )
      )
     ,"csv") 


When I execute this query I get the following error message in the Petascope log file. It looks like the RASQL query that was generated can’t be executed as the variable ‘i_i’ is unknown. However this variable is defined in the generated RASQL query. When omitting the max (…) statement the query evaluates normally and produces the expected result.

[28 Oct 2013 15:06:09] ERROR PetascopeInterface@443: Error stack trace:
InternalComponentError: Could not evaluate rasdaman query: 'select csv(((marray i_i in [4000:4010, 4000:4010] values (((count_cells(((marray i_j in [0:14] values (c) [(28)+((i_j[0])*(36)),i_i[0],i_i[1]])>(140))))=(15))*(140)))+(max_cells(((marray i_k in [0:14] values (c) [(28)+((i_k[0])*(36)),i_i[0],i_i[1]])*(marray i_l in [0:14] values (((c) [(28)+((i_l[0])*(36)),i_i[0],i_i[1]])<(140)))))))) from NDVI_SPOT_VGT AS c'
Cause: Error evaluating rasdaman query: 'select csv(((marray i_i in [4000:4010, 4000:4010] values (((count_cells(((marray i_j in [0:14] values (c) [(28)+((i_j[0])*(36)),i_i[0],i_i[1]])>(140))))=(15))*(140)))+(max_cells(((marray i_k in [0:14] values (c) [(28)+((i_k[0])*(36)),i_i[0],i_i[1]])*(marray i_l in [0:14] values (((c) [(28)+((i_l[0])*(36)),i_i[0],i_i[1]])<(140)))))))) from NDVI_SPOT_VGT AS c
        at petascope.PetascopeInterface.handleProcessCoverages(PetascopeInterface.java:691)
        at petascope.PetascopeInterface.doGet(PetascopeInterface.java:362)
        at petascope.PetascopeInterface.doPost(PetascopeInterface.java:214)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:679)
Caused by: ResourceError: Could not evaluate rasdaman query: 'select csv(((marray i_i in [4000:4010, 4000:4010] values (((count_cells(((marray i_j in [0:14] values (c) [(28)+((i_j[0])*(36)),i_i[0],i_i[1]])>(140))))=(15))*(140)))+(max_cells(((marray i_k in [0:14] values (c) [(28)+((i_k[0])*(36)),i_i[0],i_i[1]])*(marray i_l in [0:14] values (((c) [(28)+((i_l[0])*(36)),i_i[0],i_i[1]])<(140)))))))) from NDVI_SPOT_VGT AS c'
Cause: Error evaluating rasdaman query: 'select csv(((marray i_i in [4000:4010, 4000:4010] values (((count_cells(((marray i_j in [0:14] values (c) [(28)+((i_j[0])*(36)),i_i[0],i_i[1]])>(140))))=(15))*(140)))+(max_cells(((marray i_k in [0:14] values (c) [(28)+((i_k[0])*(36)),i_i[0],i_i[1]])*(marray i_l in [0:14] values (((c) [(28)+((i_l[0])*(36)),i_i[0],i_i[1]])<(140)))))))) from NDVI_SPOT_VGT AS c
        at petascope.wcps.server.core.ProcessCoveragesRequest.execute(ProcessCoveragesRequest.java:144)
        at petascope.PetascopeInterface.handleProcessCoverages(PetascopeInterface.java:657)
        ... 16 more
Caused by: RasdamanRequestFailed: Error evaluating rasdaman query: 'select csv(((marray i_i in [4000:4010, 4000:4010] values (((count_cells(((marray i_j in [0:14] values (c) [(28)+((i_j[0])*(36)),i_i[0],i_i[1]])>(140))))=(15))*(140)))+(max_cells(((marray i_k in [0:14] values (c) [(28)+((i_k[0])*(36)),i_i[0],i_i[1]])*(marray i_l in [0:14] values (((c) [(28)+((i_l[0])*(36)),i_i[0],i_i[1]])<(140)))))))) from NDVI_SPOT_VGT AS c
        at petascope.util.ras.RasUtil.executeRasqlQuery(RasUtil.java:124)
        at petascope.util.ras.RasUtil.executeRasqlQuery(RasUtil.java:67)
        at petascope.wcps.server.core.ProcessCoveragesRequest.execute(ProcessCoveragesRequest.java:142)
        ... 17 more
Caused by: org.odmg.QueryException: Execution error 357 in line 1, column 235, near token i_i: Variable is unknown.
        at rasj.odmg.RasOQLQuery.execute(RasOQLQuery.java:249)
        at petascope.util.ras.RasUtil.executeRasqlQuery(RasUtil.java:117)
        ... 19 more
[28 Oct 2013 15:06:09] DEBUG PetascopeInterface@494: Done marshalling Error Report.

Change History (6)

comment:1 by Dimitar Misev, 11 years ago

The problem is that the resulting rasql query has incorrect parenthesis around the outer marray which don't encompass the '+ max …' part:

select csv(((marray i_i in [4001:4010, 4001:4010] values (((count_cells(((marray i_j in [0:14] values (c) [i_i[0],i_i[1],(28)+((i_j[0])*(36))])>(140))))=(15))*(140)))+(max_cells(((marray i_k in [0:14] values (c) [i_i[0],i_i[1],(28)+((i_k[0])*(36))])*(marray i_l in [0:14] values (((c) [i_i[0],i_i[1],(28)+((i_l[0])*(36))])<(140)))))))) from NDVI_SPOT_VGT AS c

comment:2 by Dimitar Misev, 11 years ago

Workaround for now is to use explicit parenthesis around the VALUES:

for c in (NDVI_SPOT_VGT)
return encode(
   (coverage NDVI_HIST_MAX
    over     $px x(4000:4010),
             $py y(4000:4010)
    values  (
     ( ( count
        (
          coverage NDVI_COUNT
          over     $pt3 t(0:14)
          values    (c[t(28 + $pt3*36),x:"CRS:1"($px),y:"CRS:1"($py)]) > 140 ) = 15 ) * 140 )
                    + max(
                      (
                       coverage NDVI_T_SERIES
                        over     $pt t(0:14)
                        values    c[t(28 + $pt*36),x:"CRS:1"($px),y:"CRS:1"($py)]
                     )
                      *
                     (
                       coverage NDVI_T_SERIES2
                        over     $pt2 t(0:14)
                        values    (c[t(28 + $pt2*36),x:"CRS:1"($px),y:"CRS:1"($py)] < 140)
                     )
          )
      )
     )
     ,"csv")

comment:3 by Dimitar Misev, 10 years ago

Cc: Alex Dumitru Vlad Merticariu added

We should check if this is solved in WCPS 2.0

comment:4 by Bang Pham Huu, 8 years ago

Milestone: 9.0.x10.0
Summary: Unknown variable due to nested coverage constructorsWCPS1.5_Unknown variable due to nested coverage constructors

comment:5 by Bang Pham Huu, 8 years ago

Here is a reproduce example with eobstest in WCPS1.0

for c in (eobstest) return encode(
    coverage mr_HIST_MAX 
    over $px x(22:41),$py y(40:61) 
    values 
      count(
        coverage mr_COUNT 
        over $pt3 t(0:6) 
        values(
             c[t(2 + $pt3*1),Lat:"CRS:1"($px),Long:"CRS:1"($py)]
         ) > 140) * 140 
    + max(
          (coverage NDVI_T_SERIES 
           over $pt t(0:6) 
          values c[t(2 + $pt*1),Lat:"CRS:1"($px), Long:"CRS:1"($py)]
          )
        *
          (coverage NDVI_T_SERIES2 
          over $pt2 t(0:6)
          values(c[t(2 + $pt2*1),Lat:"CRS:1"($px),Long:"CRS:1"($py)] < 140)
          )
        ),"csv")

return same errors if does not add "( )" outside VALUES count (…) + max(…)

<ows:Exception exceptionCode="RasdamanRequestFailed"><ows:ExceptionText>
Error evaluating rasdaman query: 
'select csv(((marray i_i in [22:41, 40:61] values count_cells(((marray i_j in [0:6] values (c) [(2)+((i_j[0])*(1)),i_i[1],i_i[0]])>(140))))*((140)+(max_cells(((marray i_k in [0:6] values (c) [(2)+((i_k[0])*(1)),i_i[1],i_i[0]])*(marray i_l in [0:6] values (((c) [(2)+((i_l[0])*(1)),i_i[1],i_i[0]])<(140))))))))) from eobstest AS c where oid(c)=1537</ows:ExceptionText>
</ows:Exception>
<ows:Exception exceptionCode="RuntimeError">
<ows:ExceptionText>
org.odmg.QueryException : Execution error 357 in line 1, column 211, near token i_i: Variable is unknown.

it did not work for WCPS2.0, inside processAxisIterator() of CrsSubsetComputer, there is a HACK to get the axis iterator, but it works wrong in this example as try to add $px x(22:41) to axis "t" and it is outside of domain of t (0:6) then throw an exception.

I'll review this problem later when coverage iterator is developed with discussion.

comment:6 by Bang Pham Huu, 8 years ago

Milestone: 10.09.3
Resolution: fixed
Status: newclosed

The error query in http://rasdaman.org/ticket/517#comment:5 was fixed in the patch for ticket 1188 make WCPS 1.5 ready, it has no error, close ticket.

Note: See TracTickets for help on using tickets.