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

fix(frontend): show distinct in agg #3198

Merged
merged 2 commits into from
Jun 14, 2022
Merged

fix(frontend): show distinct in agg #3198

merged 2 commits into from
Jun 14, 2022

Conversation

lmatz
Copy link
Contributor

@lmatz lmatz commented Jun 14, 2022

What's changed and what's your intention?

As per the title.

Checklist

- [ ] I have written necessary docs and comments
- [ ] I have added necessary unit tests and integration tests

  • All checks passed in ./risedev check (or alias, ./risedev c)

Refer to a related PR or issue link (optional)

closes #2724

@github-actions github-actions bot added the type/fix Bug fix label Jun 14, 2022
impl fmt::Debug for PlanAggCall {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = f.debug_tuple(&format!("{}", self.agg_kind));
self.inputs.iter().for_each(|child| {
builder.field(child);
let input_ref = InputRefWithDistinct(child, self.distinct);
Copy link
Contributor Author

@lmatz lmatz Jun 14, 2022

Choose a reason for hiding this comment

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

Based on the fact that distinct is a variable independent of inputRef in PlanAggCall, we will not have the case that an AggCall has multiple inputRefs but only some of them are distinct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we do not foresee any agg call to be distinct only on part of its inputs.

However, when an agg call has multiple inputs (e.g. string_agg), it does not look well: string_agg(distinct $0, distinct $1).

Alternatively we can use string_agg-distinct($0, $1), or avoid debug_tuple and implement our own formatting to get string_agg(distinct $0, $1).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I implemented our own formatting

@codecov
Copy link

codecov bot commented Jun 14, 2022

Codecov Report

Merging #3198 (e9a9454) into main (6d98333) will increase coverage by 0.00%.
The diff coverage is 92.85%.

@@           Coverage Diff           @@
##             main    #3198   +/-   ##
=======================================
  Coverage   73.57%   73.57%           
=======================================
  Files         744      744           
  Lines      102180   102188    +8     
=======================================
+ Hits        75174    75182    +8     
  Misses      27006    27006           
Flag Coverage Δ
rust 73.57% <92.85%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rc/frontend/src/optimizer/plan_node/logical_agg.rs 97.74% <92.85%> (-0.12%) ⬇️
src/meta/src/barrier/mod.rs 69.45% <0.00%> (+0.32%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@lmatz lmatz requested review from xiangjinwu and fuyufjh June 14, 2022 05:46
@lmatz lmatz merged commit c86f7e2 into main Jun 14, 2022
@lmatz lmatz deleted the lz/distinct branch June 14, 2022 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: should mark agg functions distinct or not in explain results
2 participants