Opened 9 years ago

Closed 5 years ago

#1293 closed enhancement (fixed)

Induced condenser doesn't work with where clause

Reported by: Dimitar Misev Owned by: apercov
Priority: major Milestone: 10.0
Component: qlparser Version: development
Keywords: Cc:
Complexity: Medium

Description (last modified by Dimitar Misev)

A query using test_grey3d (assumes domain [0:99,0:99,0:4]):

select condense + over i in [0:4]
   using a[0:99,0:99,i]
   where avg_cells(a[0:99,0:99,i]) > 30
from test_grey3d as a

fails with:

rasdaman error 300: Parsing error 300 in line 3, column 4: Unexpected name where.

It should correctly parse the where in the condenser, and then evaluate it: only the array slices for which avg_cells(a[0:99,0:99,i]) > 30 is true should be added up in the condenser.

Change History (7)

comment:1 by Vlad Merticariu, 5 years ago

A query using test_grey3d (assumes domain [0:99,0:99,0:4]) and failing:

select condense + over i in [0:4]
    where avg_cells(a[0:99,0:99,i[0]]) > 30
    using a[0:99,0:99,i]
from test_grey3d as a
Version 2, edited 5 years ago by Vlad Merticariu (previous) (next) (diff)

comment:2 by Dimitar Misev, 5 years ago

Description: modified (diff)
Owner: changed from Vlad Merticariu to apercov
Status: newassigned
Type: defectenhancement

comment:3 by Vlad Merticariu, 5 years ago

Sorry, messed up the syntax, it should be the one updated from my comment (where is before using).

The error is:

rasdaman error 361: Execution error 361 in line 1, column 1, near token select: Multiple query targets are not supported.

comment:4 by apercov, 5 years ago

Status: assignedaccepted

comment:5 by Dimitar Misev, 5 years ago

Indeed it works correctly.

The only case in which it fails is when the where clause filters out all of the slices, e.g:

rasql -q 'select encode(condense + over i in [0:4]
                        where false
                        using a[0:4,0:4,i[0]], "csv")
          from test_grey3d as a' --out string

@vmerticariu what should be the behavior in this case? If exception is correct, then at least the error text should be fixed as "Multiple query targets are not supported." is not very appropriate.

comment:6 by Vlad Merticariu, 5 years ago

I tried as well, and it's working indeed.
The only case where it's not working is when all the where iterations evaluate to false, case in which there is no slice to condense over.

In the scalar condenser case, the result when all the where iterations evaluate to false is 0.

In the induced one, we could either throw a proper error ("No slices match the WHERE filter."), or we could mimic the scalar case and return an array of the same dimension as the one in the using clause, filled with 0s or null values.

comment:7 by apercov, 5 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.