Skip to content

Merging #23978#27796

Merged
kitaisreal merged 57 commits intomasterfrom
create-user-defined-lambda-function
Aug 25, 2021
Merged

Merging #23978#27796
kitaisreal merged 57 commits intomasterfrom
create-user-defined-lambda-function

Conversation

@kitaisreal
Copy link
Copy Markdown
Contributor

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Original pull request #23978.

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add feature for creating user-defined functions as lambda expressions. Syntax CREATE FUNCTION {function_name} as ({parameters}) -> {function core}. Example CREATE FUNCTION plus_one as (a) -> a + 1. Authors @Realist007.

ANDREI STAROVEROV and others added 30 commits May 9, 2021 12:47
@robot-clickhouse robot-clickhouse added doc-alert pr-feature Pull request with new product feature labels Aug 17, 2021
@qoega
Copy link
Copy Markdown
Member

qoega commented Aug 18, 2021

We should add a test what happens when we call functions and delete function in parallel.

@kitaisreal kitaisreal force-pushed the create-user-defined-lambda-function branch from 958f65c to 6b2c249 Compare August 18, 2021 19:07
return true;
}

ASTPtr UserDefinedFunctionsMatcher::tryToReplaceFunction(const ASTFunction & function)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So it's still an AST-based solution. I think we can build a real function using ActionsDAG for lambdas.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@amosbird it will be weaker solution, because for example client created function.

CREATE FUNCTION test_func (a, b) -> a + b;

It is used like

SELECT test_func(a, b) + c;

In our solution it will be substituted and whole expression can be optimised later for example JIT compiled. There are much more cases when we get benefits from substitution, this one is the simples.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great. I'm also a fan of AST based solutions.

@kitaisreal kitaisreal merged commit dc85256 into master Aug 25, 2021
@kitaisreal kitaisreal deleted the create-user-defined-lambda-function branch August 25, 2021 07:08
@kitaisreal kitaisreal mentioned this pull request Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants