asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Riyafa Abdul Hameed <riy...@apache.org>
Subject How to write SQL 92 aggregate function?
Date Fri, 04 Aug 2017 06:40:38 GMT
Dear all,

With Preston's help I managed to implement an aggregate function that works
on arrays:
st_union([st_make_point(1.0,1.0),st_make_point(1.0,2.0)]);
But this does not work when used in an sqlpp expression:
SELECT st_union(gbu) FROM [st_make_point(1.0,1.0),st_make_point(1.0,2.0)]
as gbu;

The error thrown is:

ASX0002: Type mismatch: function scan-collection expects its 1st input
parameter to be type array or multiset, but the actual input type is
geometry [TypeMismatchException]

I think it's because the function has not been implemented as an SQL 92
function. I would like to know how to do this?

This error is thrown when count is used in the following manner:
SELECT array_count(gbu) FROM [1,2,3] as gbu;

It is not thrown when used in the following manner:
SELECT count(gbu) FROM [1,2,3] as gbu;

When count is used in the following manner:

count([1,2,3]);

the following error is thrown:

count is a SQL-92 aggregate function. The SQL++ core aggregate function
array_count could potentially express the intent. [CompilationException]

I would like to know how I could have st_union also as a SQL-92 function.
My changes are in the following branch:
https://github.com/riyafa/asterixdb/tree/geometry

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message