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

[Feature] Add width_bucket function #22787

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

TBCCC
Copy link
Contributor

@TBCCC TBCCC commented May 2, 2023

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Which issues of this PR fixes:

Fixes #12990

Problem Summary(Required):

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto backported to target branch
    • 3.0
    • 2.5
    • 2.4
    • 2.3

@github-actions github-actions bot added the documentation Improvements or additions to documentation label May 2, 2023
@mergify mergify bot assigned TBCCC May 2, 2023
@liuyehcf
Copy link
Contributor

run all

@liuyehcf
Copy link
Contributor

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Jul 12, 2023

rebase

✅ Branch has been successfully rebased

@liuyehcf liuyehcf force-pushed the feature/add_width_bucket branch from 95088ac to c90ab51 Compare July 12, 2023 03:13
@liuyehcf liuyehcf requested a review from a team as a code owner July 12, 2023 03:13
liuyehcf
liuyehcf previously approved these changes Jul 12, 2023
@liuyehcf
Copy link
Contributor

liuyehcf commented Jul 12, 2023

Please fix the problems based on the ci reports. At least those marked required.

@wanpengfei-git
Copy link
Collaborator

[FE PR Coverage Check]

😍 pass : 0 / 0 (0%)

@TBCCC TBCCC requested a review from liuyehcf July 12, 2023 08:36
@TBCCC
Copy link
Contributor Author

TBCCC commented Jul 12, 2023

Please fix the problems based on the ci reports. At least those marked required.

done

liuyehcf
liuyehcf previously approved these changes Aug 3, 2023
@liuyehcf liuyehcf enabled auto-merge (squash) August 3, 2023 00:04
@liuyehcf
Copy link
Contributor

liuyehcf commented Aug 3, 2023

LGTM

@silverbullet233 silverbullet233 self-requested a review August 3, 2023 01:01
silverbullet233
silverbullet233 previously approved these changes Aug 3, 2023
Comment on lines 189 to 199
[10324, "width_bucket", "BIGINT", ["TINYINT", "TINYINT", "TINYINT", "BIGINT"], "MathFunctions::width_bucket<TYPE_TINYINT>"],
[103241, "width_bucket", "BIGINT", ["SMALLINT", "SMALLINT", "SMALLINT", "BIGINT"], "MathFunctions::width_bucket<TYPE_SMALLINT>"],
[103242, "width_bucket", "BIGINT", ["INT", "INT", "INT", "BIGINT"], "MathFunctions::width_bucket<TYPE_INT>"],
[103243, "width_bucket", "BIGINT", ["BIGINT", "BIGINT", "BIGINT", "BIGINT"], "MathFunctions::width_bucket<TYPE_BIGINT>"],
[103244, "width_bucket", "BIGINT", ["FLOAT", "FLOAT", "FLOAT", "BIGINT"], "MathFunctions::width_bucket<TYPE_FLOAT>"],
[103245, "width_bucket", "BIGINT", ["DOUBLE", "DOUBLE", "DOUBLE", "BIGINT"], "MathFunctions::width_bucket<TYPE_DOUBLE>"],

Copy link
Contributor

Choose a reason for hiding this comment

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

what about decimal type?

Comment on lines +2 to +13
select width_bucket(5.35, 0.024, 10.06, 5);
-- result:
3
-- !result
select width_bucket(0, 0.024, 10.06, 5);
-- result:
0
-- !result
select width_bucket(11, 0.024, 10.06, 5);
-- result:
6
-- !result
Copy link
Contributor

Choose a reason for hiding this comment

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

please some cases for null input

Comment on lines 522 to 524
auto range_size = max_value - min_value;
auto dist_from_min = input_value - min_value;
int64_t ret = dist_from_min / (range_size / bucket_num);
Copy link
Contributor

Choose a reason for hiding this comment

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

shoud / return double ? otherwise range_size/bucket_num would return 0.
what if max_value <= min_value?

@liuyehcf liuyehcf self-requested a review August 3, 2023 02:54
@TBCCC TBCCC dismissed stale reviews from silverbullet233 and liuyehcf via 4250da8 November 15, 2023 14:11
@TBCCC TBCCC force-pushed the feature/add_width_bucket branch from a4234b5 to 4250da8 Compare November 15, 2023 14:11
@TBCCC TBCCC force-pushed the feature/add_width_bucket branch 3 times, most recently from 8154ca7 to 81fe5b3 Compare November 16, 2023 05:29
@TBCCC
Copy link
Contributor Author

TBCCC commented Nov 16, 2023

@liuyehcf PTAL, I have fixed all issues above. And the CI failures seems not relevant to my pr.

Signed-off-by: TBCCC <tbccc55555@outlook.com>
Signed-off-by: TBCCC <tbccc55555@outlook.com>
Signed-off-by: TBCCC <tbccc55555@outlook.com>
Signed-off-by: TBCCC <tbccc55555@outlook.com>
Signed-off-by: TBCCC <tbccc55555@outlook.com>
Signed-off-by: TBCCC <tbccc55555@outlook.com>
@TBCCC TBCCC force-pushed the feature/add_width_bucket branch from 2772bbb to 83877d7 Compare November 29, 2023 08:55
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

warning The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

Copy link

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

fail : 0 / 40 (00.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 src/exprs/math_functions.h 0 40 00.00% [505, 506, 507, 508, 509, 510, 511, 513, 514, 515, 516, 517, 519, 520, 521, 522, 524, 525, 527, 528, 529, 530, 531, 532, 533, 535, 536, 537, 538, 541, 542, 543, 544, 545, 546, 548, 549, 550, 551, 556]

@DanRoscigno DanRoscigno removed the documentation Improvements or additions to documentation label Oct 25, 2024
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.

WIDTH_BUCKET function support
6 participants