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

Relax the type of the Unpackspec for makeAggrExplicit #581

Merged

Conversation

shane-circuithub
Copy link
Contributor

No description provided.

Comment on lines +198 to +200
A.makeAggrExplicit
(U.unpackspecField <* lmap (const delimiter) U.unpackspecField)
HPQ.AggrStringAggr
Copy link
Owner

Choose a reason for hiding this comment

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

This is just a refactoring, right? I think I actually prefer the other way, since shouldn't we morally be able to have

stringAgg' :: Aggregator (F.Field T.SqlText) F.Field T.SqlText) (F.Field T.SqlText)
stringAgg' = A.makeAggrExplicit def HPQ.AggrStringAgg

and then

stringAgg :: F.Field T.SqlText
          -> Aggregator (F.Field T.SqlText) (F.Field T.SqlText)
stringAgg delimiter = lmap (\a -> (a, delimiter)) stringAdd'

I don't think there's anything stopping the delimiter being dynamic (i.e. a value depending on the execution of the query -- although I haven't checked that).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change to stringAgg is just a refactoring, yes. And you're right that the delimiter can be dynamic, I just didn't want to break the API of the existing stringAgg.

But I do need to relax the type of the Unpackspec for makeAggrExplicit (which I'm using in Rel8 for ordered set aggregation functions). Maybe Unpackspec is the wrong thing to use here, but basically I'm using it to select the PrimExprs that will be passed as the argument list to the aggregation function. I'm open to other suggestions

Copy link
Owner

Choose a reason for hiding this comment

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

OK, let's merge this to unblock you and we can attend to other considerations later if we want.

@tomjaguarpaw tomjaguarpaw merged commit bb30cb0 into tomjaguarpaw:master Oct 12, 2023
6 checks passed
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