Skip to content

Conversation

@cambyzju
Copy link
Contributor

@cambyzju cambyzju commented Apr 2, 2022

Proposed changes

Issue Number: close #8814

Problem Summary:

The difference between sql1 and sql2 is is_nullable, in sql1 TExprNode:is_nullable = true, but in sql2 TExprNode:is_nullable = false.

While is_nullable is false, min/max works not correctly. Because:

  1. InitFn called by AggFnEvaluator::init, and _staging_intermediate_val is the return value;
  2. At here _staging_intermediate_val->is_null == true and val = MAX for min aggregate;
  3. next set_output_slot called, copy _staging_intermediate_val to destination Tuple;
  4. becase _staging_intermediate_val is_null == true, set_output_slot do nothing, leave destination Tuple with default zero value;
  5. Use zero value to calc min with positive number, always return zero.

Checklist(Required)

  1. Does it affect the original behavior: (Yes/No/I Don't know)
  2. Has unit tests been added: (Yes/No/No Need)
  3. Has document been added or modified: (Yes/No/No Need)
  4. Does it need to update dependencies: (Yes/No)
  5. Are there any changes that cannot be rolled back: (Yes/No)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@cambyzju cambyzju closed this Apr 2, 2022
@cambyzju
Copy link
Contributor Author

cambyzju commented Apr 2, 2022

This fix is not correctly, I close this pr temporarily and will update it later.

@cambyzju cambyzju reopened this Apr 5, 2022
Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Apr 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

PR approved by anyone and no changes requested.

@yiguolei yiguolei merged commit e53c90f into apache:master Apr 7, 2022
@morningman morningman added dev/1.0.1-deprecated should be merged into dev-1.0.1 branch kind/need-regression-test Need to add regression test for this case labels Apr 7, 2022
morningman pushed a commit that referenced this pull request Apr 8, 2022
[Fix bug] min and max window function bug fix #8822
@morningman morningman added dev/merged-1.0.1-deprecated PR has been merged into dev-1.0.1 and removed dev/1.0.1-deprecated should be merged into dev-1.0.1 branch labels Apr 8, 2022
@gj-zhang gj-zhang mentioned this pull request Apr 13, 2022
3 tasks
weizhengte pushed a commit to weizhengte/incubator-doris that referenced this pull request Apr 22, 2022
[Fix bug] min and max window function bug fix apache#8822
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/merged-1.0.1-deprecated PR has been merged into dev-1.0.1 kind/need-regression-test Need to add regression test for this case reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] min and avg window function not work well.

4 participants