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:08:42 GMT
Here you go:

st_union([st_make_point(1.0,1.0),st_make_point(1.0,2.0)]);

or

st_union(SELECT VALUE gbu FROM [st_make_point(1.0,1.0),st_
make_point(1.0,2.0)]
as gbu);


On Fri, Aug 4, 2017 at 3:58 AM, Riyafa Abdul Hameed <riyafa.12@cse.mrt.ac.lk
> wrote:

> Hi,
>
> After learning about sql92 and sql++, I thinks that should be the expected
> behavior. But I would like to evaluate the same behavior using sql++, can
> someone help me with a query because I lack full knowledge of sql++.
>
> Thanks.
> Riyafa
>
> On 4 August 2017 at 12:10, 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
> >
> >
> >
> >
>
>
> --
> Riyafa Abdul Hameed
> Undergraduate, University of Moratuwa
>
> Email: riyafa.12@cse.mrt.ac.lk
> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
> <http://twitter.com/Riyafa1>
>

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