Skip to content

[UDAF] Vectorization support remote udaf #10683 - #10685

Merged
morningman merged 13 commits into
apache:masterfrom
chenlinzhong:rpc_udaf
Jul 18, 2022
Merged

morningman merged 13 commits into
apache:masterfrom
chenlinzhong:rpc_udaf

Conversation

@chenlinzhong

@chenlinzhong chenlinzhong commented Jul 7, 2022 •

Copy link
Copy Markdown
Contributor

Proposed changes

Issue Number: close #10683

Problem Summary:

Currently, vectorized udaf can only be implemented locally based on c++ or Java. There are some problems need to be considered:

  • The cost for getting started is high
  • The requirements for the implementation quality of functions are relatively high, otherwise it will affect the stability of be, such as leading to core

To solove this problem , I think the remote udaf function is a good way it can benifits:

  • the cost for getting started is low, for it can use any language to impl udaf interface
  • decouple with doris kernel, it good for be stability

We need to consider the performance, and whether the remote call will have a lot of overhead, Here I did a test

Test the time-consuming of summation operation with different amount of data

Step1. deploy with 2 BE node, Table scheam:

CREATE TABLE `table1` (
  `event_day` date NULL,
  `siteid` int(11) NULL DEFAULT "10",
  `citycode` smallint(6) NULL,
  `username` varchar(32) NULL DEFAULT "",
  `pv` bigint(20) SUM NULL DEFAULT "0"
) ENGINE=OLAP
AGGREGATE KEY(`event_day`, `siteid`, `citycode`, `username`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`siteid`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)

Step2 create remote udaf

CREATE AGGREGATE FUNCTION  rpc_myadd(int) RETURNS int PROPERTIES (
    "TYPE"="RPC",
    "OBJECT_FILE"="127.0.0.1:9000",
    "update_fn"="rpc_sum_update",
    "merge_fn"="rpc_sum_merge",
    "finalize_fn"="rpc_sum_finalize"
);

Step3 import data with diffrent rows

Result

image

we can concluded:

  • RPC udaf performance is better than that of non vectorized aggregate function by 6% - 29%
  • The performance of RPC udaf is significantly lower than that of native vectorized aggregate functions, but when the number of data rows is 1000W, it can still return in seconds, and theoretically it can support most business scenarios

image
image
image
image

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 [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions github-actions Bot added area/planner Issues or PRs related to the query planner area/vectorization labels Jul 7, 2022
@chenlinzhong chenlinzhong changed the title [UDAF] Vectorization support remote udaf function #10683 [UDAF] Vectorization support remote udaf #10683 Jul 8, 2022
@yangzhg

yangzhg commented Jul 8, 2022

Copy link
Copy Markdown
Member

please add example to docs

@github-actions github-actions Bot added the kind/docs Categorizes issue or PR as related to documentation. label Jul 11, 2022
@chenlinzhong

Copy link
Copy Markdown
Contributor Author

please add example to docs

done

yangzhg
yangzhg previously approved these changes Jul 15, 2022

@yangzhg yangzhg left a comment

Copy link
Copy Markdown
Member

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 Jul 15, 2022
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
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 Jul 18, 2022

@yangzhg yangzhg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@morningman
morningman merged commit 6736e06 into apache:master Jul 18, 2022
miswujian pushed a commit to miswujian/doris that referenced this pull request Jul 28, 2022
whutpencil pushed a commit to whutpencil/incubator-doris that referenced this pull request Jul 29, 2022
eldenmoon pushed a commit to eldenmoon/incubator-doris that referenced this pull request Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/planner Issues or PRs related to the query planner area/vectorization kind/docs Categorizes issue or PR as related to documentation. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UDAF] Vectorization support remote udaf function

3 participants