dssg / collate

Aggregation SQL Query Builder
Other
1 stars 3 forks source link

Add first value and last value aggregations #97

Closed shaycrk closed 6 years ago

shaycrk commented 7 years ago

In some cases, we may want to build features that reflect the earliest known or most recent information about a characteristic such as charges at first arrest, current employment status, outcome of last inspection, etc.

The built-in postgres aggregate function (e.g., min, max, avg, etc) don't make this possible but first and last aggregates are available through a postgres extension, which can be invoked with an ORDER BY clause in the aggregate call (e.g., LAST(employment_status ORDER BY knowledge_date ASC).

I don't think it would be difficult to implement this here and would be useful, but how do we feel about providing options that rely on postgres extensions rather than built-in functionality?

jesteria commented 6 years ago

This issue was moved to dssg/triage#308