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

feat: add string_agg aggregate function #297

Merged
merged 3 commits into from
Sep 5, 2022

Conversation

vibhatha
Copy link
Contributor

This PR includes the addition of string_agg operator to concatenate string column data with a separator.

Comment on lines 417 to 1280
- value: "varchar<L2>"
name: "separator"
description: "Separator for concatenated strings"
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should be marked as needing to be constant (constant: true IIRC), otherwise someone could pass something that varies from record to record, which makes little sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it in the spec? I cannot find the definition for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes,

Constant: Whether this argument is required to be a constant for invocation. For example, in some system a regular expression pattern would only be accepted as a literal and not a column value reference.

https://substrait.io/expressions/scalar_functions/#value-argument-properties

That being said... it does appear to be missing from the schema. Huh. #305

extensions/functions_string.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@jvanstraten jvanstraten left a comment

Choose a reason for hiding this comment

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

Depends on #305 for constant separator argument.

- value: "string"
name: "separator"
description: "Separator for concatenated strings"
return: "string"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit, and not sure why none of the linters are complaining about this, but there should probably be a newline at the end of the file.

extensions/functions_string.yaml Show resolved Hide resolved
@jvanstraten jvanstraten changed the title feat: string_agg operator for aggregation of column data feat: add string_agg aggregate function Aug 29, 2022
@jvanstraten jvanstraten merged commit fbe5e09 into substrait-io:main Sep 5, 2022
@jacques-n
Copy link
Contributor

I think this function needs to be updated to declare that it is ordered per property here:

https://substrait.io/expressions/aggregate_functions/

@vibhatha
Copy link
Contributor Author

vibhatha commented Sep 6, 2022

I think this function needs to be updated to declare that it is ordered per property here:

https://substrait.io/expressions/aggregate_functions/

@jacques-n I am looking into this ...

@jvanstraten
Copy link
Contributor

Sorry, forgot to link here; #312

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.

3 participants