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

[Vectorized][Feature] Support min_by/max_by function. #8623

Merged
merged 8 commits into from
Apr 20, 2022

Conversation

zhannngchen
Copy link
Contributor

@zhannngchen zhannngchen commented Mar 24, 2022

Proposed changes

Issue Number: open #7678

Problem Summary:

Support min_by/max_by on vectorized engine.

Checklist(Required)

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

Further comments

  1. This is an initial patch, I will add the document later.
  2. For now, aggregate functions only supports 1 intermediate type, but min_by/max_by needs 2 type information, I've did a tricky work-around in this initial patch, but we need to discuss that do we really need to change the intermediate type to an intermediate type list? @morningman @HappenLee @dataroaring. Another solution is to serialize the type information in the intermediate data.
  3. To support these 2 functions in the non-vectorized code needs to pay much more efforts, we may need to do some refactor. Do we need to support this?

@morningman morningman added kind/feature Categorizes issue or PR as related to a new feature. dev/backlog waiting to be merged in future dev branch labels Mar 24, 2022
Expr aggExprParam =
new SlotRef(inputDesc.getSlots().get(i + getGroupingExprs().size()));
List<Expr> paramExprs = new ArrayList<>();
if (inputExpr.fn.functionName().equals("max_by")) {
Copy link
Contributor Author

@zhannngchen zhannngchen Mar 24, 2022

Choose a reason for hiding this comment

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

It's a tricky workaround, won't merge to trunk code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed with @HappenLee and @yiguolei , we should change the intermediateType to a list, in another PR, in current PR, we just keep the hard code way.

@zbtzbtzbt
Copy link
Contributor

we can add docs for these new functions @zhannngchen

@zhannngchen
Copy link
Contributor Author

we can add docs for these new functions @zhannngchen

Yes, I'll update the patch later today

@zhannngchen zhannngchen changed the title [Vectorized][New Feature] Support min_by/max_by function. [Vectorized][Feature] Support min_by/max_by function. Mar 24, 2022
@github-actions github-actions bot added area/planner Issues or PRs related to the query planner area/vectorization kind/docs Categorizes issue or PR as related to documentation. labels Apr 13, 2022
@hf200012 hf200012 requested a review from HappenLee April 16, 2022 03:15
::testing::ValuesIn(std::vector<std::string> {"min_by", "max_by"}));
} // namespace doris::vectorized

int main(int argc, char** argv) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We changed unit test running mechanism, not every unit test has a main function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cleared

if (StringRef(Data::name()) == StringRef("min_by") ||
StringRef(Data::name()) == StringRef("max_by")) {
if (!key_type_->is_comparable()) {
LOG(FATAL) << fmt::format(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be an assertion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

yiguolei
yiguolei previously approved these changes Apr 16, 2022
Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

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

LGTM

@yiguolei yiguolei added the approved Indicates a PR has been approved by one committer. label Apr 16, 2022
@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Apr 16, 2022
Copy link
Contributor

@morningman morningman 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 github-actions bot added the approved Indicates a PR has been approved by one committer. label Apr 18, 2022
@github-actions
Copy link
Contributor

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

@morningman morningman merged commit 1b4cd76 into apache:master Apr 20, 2022
@morningman morningman added dev/1.0.1-deprecated should be merged into dev-1.0.1 branch and removed dev/backlog waiting to be merged in future dev branch labels Apr 20, 2022
morningman pushed a commit that referenced this pull request Apr 20, 2022
@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 20, 2022
weizhengte pushed a commit to weizhengte/incubator-doris that referenced this pull request Apr 22, 2022
zhengshiJ pushed a commit to zhengshiJ/incubator-doris that referenced this pull request Apr 27, 2022
starocean999 pushed a commit to starocean999/incubator-doris that referenced this pull request May 19, 2022
englefly pushed a commit to englefly/incubator-doris that referenced this pull request May 23, 2022
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. area/planner Issues or PRs related to the query planner area/vectorization dev/merged-1.0.1-deprecated PR has been merged into dev-1.0.1 kind/docs Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants