Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Used st_collect only when it's needed #178

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dgaubert
Copy link
Contributor

Fixes #127, validates analysis for invalid inputs, uses st_collect when needed.


var TYPE = 'centroid';

var PARAMS = {
source : Node.PARAM.NODE(Node.GEOMETRY.ANY),
category_column : Node.PARAM.NULLABLE(Node.PARAM.STRING()),
aggregation: Node.PARAM.NULLABLE(Node.PARAM.STRING(), 'count'),
aggregation_column: Node.PARAM.NULLABLE(Node.PARAM.STRING())
aggregation: Node.PARAM.NULLABLE(Node.PARAM.ENUM('avg', 'count', 'max', 'min', 'sum'), null),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we change the default count?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it a real nullable; if aggregation comes with null then the ENUM replaces it with count and never is null

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's the purpose of having a default value, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we need a nullable enum, if aggregation comes with null value, we shouldn't set count as default, should we?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? I mean, it's nice to have the count by default, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😕 Well I'm not sure, when I used the Builder I have to check the checkbox to select aggregation function:

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't mean the node/analysis has to follow those defaults.

Copy link
Contributor Author

@dgaubert dgaubert Aug 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if category_column is null and st_collect is not used, we are forcing to have a count column filled entirely with 1. right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no category column the aggregation doesn't matter so you just don't do it. It will happen the same if there is no category column and the user provides an aggregation operation and an aggregation column, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, It will.

That's why we need to have the aggregation default to null to avoid to do aggregations if category column is not present.

I think, I don't get your point. 😢

@dgaubert
Copy link
Contributor Author

dgaubert commented Sep 7, 2016

CR: @rochoa

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

Successfully merging this pull request may close these issues.

2 participants