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

Sum_bucket aggregation #156

Merged
merged 4 commits into from
May 22, 2024
Merged

Sum_bucket aggregation #156

merged 4 commits into from
May 22, 2024

Conversation

trzysiek
Copy link
Member

@trzysiek trzysiek commented May 20, 2024

Tests to this PR showed 2 issues in all pipeline aggregations:

  • we should stop log warnings when numeric values are null
  • so far all pipeline aggregation's "parent" was at the same level of nesting. But it doesn't have to be the case, I'll need to fix this, it shouldn't be very hard. I comment out the test for this so far.
    But especially as those are issues in all types of pipeline aggr, I'd fix those in separate PR.

Some screens:
Screenshot 2024-05-20 at 12 07 50
Screenshot 2024-05-20 at 12 08 29

@trzysiek trzysiek force-pushed the sum_bucket-aggregation branch 2 times, most recently from 3ab8fe8 to e188067 Compare May 20, 2024 10:09
@trzysiek trzysiek marked this pull request as ready for review May 20, 2024 10:13
@trzysiek trzysiek requested a review from a team as a code owner May 20, 2024 10:13
func (cw *ClickhouseQueryTranslator) parseSumBucket(queryMap QueryMap) (aggregationType model.QueryType, success bool) {
sumBucketRaw, exists := queryMap["sum_bucket"]
if !exists {
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Should not we explicitly return result?

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't know, seems shorter and easier to read for me this way

}
if returnMap, ok := rows[0].LastColValue().(model.JsonMap); ok {
return []model.JsonMap{returnMap}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems that this else is redundant

return resultRows // maybe null?
}
qp := queryprocessor.NewQueryProcessor(query.ctx)
parentFieldsCnt := len(parentRows[0].Cols) - 2 // -2, because row is [parent_cols..., current_key, current_value]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be negative value?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should never be. Added a warn, though.

@trzysiek trzysiek marked this pull request as draft May 20, 2024 11:03
@trzysiek
Copy link
Member Author

One second, I didn't change 1 thing after rebase.

@trzysiek trzysiek force-pushed the sum_bucket-aggregation branch 2 times, most recently from c0ae484 to 4d5017f Compare May 20, 2024 11:18
@trzysiek trzysiek marked this pull request as ready for review May 20, 2024 11:18
@trzysiek trzysiek force-pushed the sum_bucket-aggregation branch 3 times, most recently from f13b7a0 to 60e6356 Compare May 21, 2024 22:59
@trzysiek trzysiek force-pushed the sum_bucket-aggregation branch from 02f7650 to 6676224 Compare May 22, 2024 12:14
@trzysiek trzysiek merged commit 28e911b into main May 22, 2024
4 checks passed
@trzysiek trzysiek deleted the sum_bucket-aggregation branch May 22, 2024 12:23
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