I was trying to do a quite simple query combining Conditional (
case when) with Collection (
some|any in) operations but it is failing with a
Internal error error, which I assume that the N1QL is valid and passes compilation but fails in the execution.
Here you can see an example query using the
select 100 * (multiple_address / total) as m_adrr_pct FROM ( SELECT count(*) as total, sum(case when ARRAY_COUNT(address) > 1 then 1 else 0 end) as multiple_address --,sum(case when (SOME a IN address SATISFIES a LIKE '%Street%') then 1 else 0 end) as addr_str from breweries) as brew_summaries;
Uncomment the line and you will get the error. The CB version I tested is:
Enterprise Edition 6.0.1 build 2037, the latest from docker at the time of this writing.
With that I have two questions:
- Is it a known issue? If so is there a way to track it? If not how can it be reported?
- Does anyone know how to achieve the same as the query above without using it in a similar fashion? The example above I’m basically trying to count how documents have any of the elements in an array satisfying a condition.