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

Implement PROVIDED_BLOCKBUILDER return place convention for scalar function #329

Conversation

findepi
Copy link
Member

@findepi findepi commented Feb 26, 2019

Currently the only return place convention for scalar function is STACK, and the callee will append the results value on stack into the result BlockBuilder (for out-most function call) or use it to invoke other functions (for inner/nested function call like f(g(x))).

For functions returns Slice and Block, this return place convention usually result in copying the data twice -- once generate the data, once copy the data into the output BlockBuilder.

This commit implements PROVIDED_BLOCK return place convention to allow scalar function implementation choice to directly write to the desired place. Similar to the BLOCK_POSITION null convention, a implementation choice used default STACK return place convention must be implemented. Besides STACK return place convention, the developer of the scalar function can choose to provide an additional implementation choice with PROVIDED_BLOCK return place convention.

In the future, an invocation adapter should be able to automatically adapt between different calling conventions (null convention and return place convention) when feasible.

Approved by @haozhun at prestodb/presto#12166

@findepi findepi requested a review from dain February 26, 2019 15:17
Currently the only return place convention for scalar function
is STACK, and the callee will append the value on stack into the
result BlockBuilder (for outermost function call) or use it to invoke
other functions (for inner function call like `f(g(x))`).

For functions returns Slice and Block, this return place convention
usually result in copying the data twice -- once generate the data,
once copy the data into the output BlockBuilder.

This commit implements PROVIDED_BLOCKBUILDER return place convention to
allow scalar function implementation choice to directly write to
the provided block builder. Similar to the BLOCK_POSITION
null convention, a implementation choice used default STACK
return place convention must be implemented. Besides STACK
return place convention, the developer of the scalar function can
choose to provide an additional implementation choice with
PROVIDED_BLOCK return place convention.

In the future, an invocation adapter should be able to automatically
adapt between different calling conventions (null convention and
return place convention) when feasible.

Extracted-From: https://github.com/prestodb/presto
@trinodb trinodb deleted a comment from cla-bot bot Feb 26, 2019
@findepi findepi force-pushed the findepi/implement-provided-blockbuilder-return-convention branch from 5b4d8ff to 2f80370 Compare February 26, 2019 15:17
@cla-bot
Copy link

cla-bot bot commented Feb 26, 2019

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@prestosql.io. If you are contributing on behalf of someone else (e.g., your employer), the individual CLA may not be sufficient and your employer may need the Corporate CLA signed.

@findepi
Copy link
Member Author

findepi commented Feb 26, 2019

there are no plans to merge this.

cc @martint @dain

@findepi findepi closed this Feb 26, 2019
@findepi findepi deleted the findepi/implement-provided-blockbuilder-return-convention branch February 26, 2019 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants