asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yingyi Bu <buyin...@gmail.com>
Subject Re: How to write SQL 92 aggregate function?
Date Fri, 04 Aug 2017 17:06:53 GMT
Hi Riyafa,


     >> 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?
     You're right. Please check the code that triggers SQL-92 rewrites here
and you need to implement the SQL version for st_union:

https://github.com/apache/asterixdb/blob/master/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/FunctionMapUtil.java#L61


     Let us know if you have more questions.

Best,
Yingyi


On Thu, Aug 3, 2017 at 11:40 PM, Riyafa Abdul Hameed <riyafa@apache.org>
wrote:

> 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