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

Merging #23978 #27796

Merged
merged 57 commits into from Aug 25, 2021
Merged

Merging #23978 #27796

merged 57 commits into from Aug 25, 2021

Conversation

kitaisreal
Copy link
Collaborator

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
Member

qoega commented Aug 18, 2021

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

@kitaisreal kitaisreal added the force tests Force test ignoring fast test output. label Aug 18, 2021
@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
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
Collaborator 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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
force tests Force test ignoring fast test output. pr-feature Pull request with new product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants