Skip to content

Add BLOCK_POSITION_NOT_NULL argument convention #18035

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

Merged
merged 4 commits into from
Jun 29, 2023

Conversation

dain
Copy link
Member

@dain dain commented Jun 25, 2023

Description

When function are declared with the @BlockPosition argument convention the argument is not nullable unless the @SqlNullable is also present, but when calling a function with the BLOCK_POSITION the system checks if the position is null. This check is not needed in most cases, because the caller already handles nulls explicitly. The PR adds a new calling convention BLOCK_POSITION_NOT_NULL which tells the function system that the caller will not call the function with a null position, which allows for more efficient function calls.

Additionally, the internal @NullablePosition annotation has been replaced with the existing @SqlNullable SPI annotation.

Release notes

(X) Release notes are required, with the following suggested text:

# Section
* Add `BLOCK_AND_POSITION_NOT_NULL` argument convention. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Jun 25, 2023
@github-actions github-actions bot added delta-lake Delta Lake connector hive Hive connector tests:hive labels Jun 25, 2023
@dain dain force-pushed the not-null-block-position branch 3 times, most recently from 45fdc84 to b5e7378 Compare June 25, 2023 05:57
@dain dain changed the title [WIP] Add BLOCK_POSITION_NOT_NULL argument convention Add BLOCK_POSITION_NOT_NULL argument convention Jun 25, 2023
@dain dain requested a review from electrum June 25, 2023 21:27
@dain dain force-pushed the not-null-block-position branch 2 times, most recently from 398e404 to 0f625a3 Compare June 27, 2023 01:14
@@ -166,6 +166,7 @@ synchronized void buildHashTableStrict(Block keyBlock, int keyOffset, int keyCou
int hashTableSize = keyCount * HASH_MULTIPLIER;

for (int i = 0; i < keyCount; i++) {
// this throws if the position is null
Copy link
Member

Choose a reason for hiding this comment

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

Maybe split out the map and row type changes, since they're more substantial

Copy link
Member Author

Choose a reason for hiding this comment

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

I split out the map change, but the row changes are pretty simple

@dain dain force-pushed the not-null-block-position branch from 0f625a3 to 810b6f8 Compare June 29, 2023 00:52
@dain dain merged commit 11b092b into trinodb:master Jun 29, 2023
@dain dain deleted the not-null-block-position branch June 29, 2023 06:09
@github-actions github-actions bot added this to the 421 milestone Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed delta-lake Delta Lake connector hive Hive connector
Development

Successfully merging this pull request may close these issues.

2 participants