asterixdb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malarout, Namrata (398M-Affiliate)" <>
Subject Aggregate function on collection of ordered list
Date Mon, 07 Dec 2015 11:52:13 GMT

I am trying to perform avg, sum, min and max functions on a collection of ordered lists. An
example is:
 let $l := [[1.2, 2.3, 3.4],[6,3,7,2]]

return {"avg”: avg($l)}

I have tried both avg and sql-avg. But I get the following error:
 Cannot compute AVG for values of type ORDEREDLIST [NotImplementedException].

I’ve attached the sample data that I’m working with (sample.adm). My AQL query to find
the average of analysis_error looks like:

use dataverse Test;

for $f in dataset sample

where not(is-null($f.analysis_error))

return avg($f.analysis_error);

The error seen is as follows:

Type of argument in function-call: asterix:avg, Args:[function-call: asterix:field-access-by-name,
Args:[%0->$$0, AString: {analysis_error}]] should be a collection type instead of ANY [AlgebricksException]

I would like to know what is the correct syntax to find the average. Appreciate the help.



View raw message