Andrei/text columns prefix#92
Merged
AndreiBozantan merged 3 commits intomasterfrom Apr 1, 2020
Merged
Conversation
improved the method that performs summing of counts from the results of a query; added computation for suppressed rows and total rows, which are useful for the prefix explorer
added exploration of column prefixes
dandanlen
approved these changes
Mar 31, 2020
Contributor
dandanlen
left a comment
There was a problem hiding this comment.
Looks good. Just check out my comment below and let me know what you think.
I've approved the PR anyway, so feel free to merge.
| acc.Item1 + next.Count, | ||
| acc.Item2 + (next.IsSuppressed ? next.Count : 0L))); | ||
| default(CountResultType), | ||
| (acc, row) => new CountResultType(acc, row.Count, row.IsSuppressed)); |
Contributor
There was a problem hiding this comment.
A constructor that exists merely to increment the count isn't very intuitive. And it seems wasteful to create a new value at every iteration of the loop? (maybe it doesn't matter since it's a value type?)
Would it be better / more idiomatic here to have a member function that updates the counter in-place? Something like:
public CountResultType Accumulate<T>(T row)
where T : ICountAggregate, ISuppressible
=> new CountResultType
{
TotalCount = TotalCount + row.Count,
TotalRows = TotalRows + 1,
SuppressedCount = SuppressedCount + (row.IsSuppressed ? row.Count : 0),
SuppressedRows = SuppressedRows + (row.IsSuppressed ? 1 : 0),
};Then we could write
(acc, row) => acc.Accumulate(row)Or otherwise make the member function static:
(acc, row) => CountResultType.Accumulate(acc, row)What do you think?
Contributor
Author
There was a problem hiding this comment.
OK, I will try to fix it in a separate PR.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added exploration for prefixes of text columns.