Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

The SELECT statement to have aggregation functions #1

Open
javadch opened this issue Jun 19, 2014 · 2 comments
Open

The SELECT statement to have aggregation functions #1

javadch opened this issue Jun 19, 2014 · 2 comments
Labels
Milestone

Comments

@javadch
Copy link
Owner

javadch commented Jun 19, 2014

The select statement should have a phrase in the projection segment to allow defining aggregation functions over the attributes of the bound perspective.
the aggregation function are: COUNT, SUM, AVG, MIN, MAX, STDEV, VAR

aggregate functions ignore null values

@javadch javadch added this to the 2014-Q3 milestone Jun 19, 2014
@javadch
Copy link
Owner Author

javadch commented Aug 9, 2014

The grammar supports inline perspectives, which means defining aggregation and explicit projection attributes as well as any combinations.
Projection attributes can be fields, static usage of defined perspectives, or function calls.
SELECT PROJ math.Max(observation.Temperature), Min(Elevation*2), ID, t.Name, location.Elevation FROM b1.0 INTO var1 WHERE (Temperature > 0)

In the semantic check and process model creation:

  • create an inline perspective from the projection declaration. use the package name of the identifiers (if exists) as the pointer to a previously declared perspective.
  • consider the identifier segment as the pointer to its respective attribute and use in the MapTo of the newly created inline perspective.
  • use the adapter in order to determine the data types.
  • create the entity class
  • if there is any aggregation function declared, apply it on the data reader class
  • if a combination of agg./ scalar declarations are available, then check for proper GROUP BY clause
  • mark the result set as a collection containing aggregates.

Note that functions accept arguments of simple and packaged identifiers. Function calls from the projection clause can map the package id to the perspective name, so that a call like _math.Max(observation.Temperature)_ is possible. The process modeler should translate these kinds of calls by cross checking with the existing perspectives, and using the forward mappings of the declared attributes.

@javadch
Copy link
Owner Author

javadch commented Feb 1, 2015

generally saying (from postgre sql) the aggregation functions should have a reduction function and a return function. the first function operates of the rows and creates intermediate results (like moving mean) and at the end, the return function prepares the final result.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant