-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Simplify array functions #18094
Simplify array functions #18094
Conversation
Typo "BlockBuild" in first commit description |
core/trino-spi/src/main/java/io/trino/spi/function/ScalarFunctionAdapter.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/function/ScalarFunctionAdapter.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/function/ScalarFunctionAdapter.java
Show resolved
Hide resolved
core/trino-spi/src/test/java/io/trino/spi/function/TestScalarFunctionAdapter.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/function/OperatorType.java
Outdated
Show resolved
Hide resolved
IS_POSITION_NULL = lookup().findVirtual(Block.class, "isNull", methodType(boolean.class, int.class)); | ||
} | ||
catch (ReflectiveOperationException e) { | ||
throw new ExceptionInInitializerError(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We normally use AssertionError
, but this seems better. We should probably switch to it for static initializers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from somewhere else, but I commonly see RuntimeException for these... we should pick one
int position = toIntExact(index - 1); | ||
if (array.isNull(position)) { | ||
return null; | ||
checkArrayIndex(index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can inline this now that there is only one usage. Also, consider converting to checkCondition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually referenced from the ExpressionInterpreter
core/trino-main/src/main/java/io/trino/operator/scalar/ArrayConcatFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/scalar/ArrayRemoveFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/scalar/ArraySortComparatorFunction.java
Outdated
Show resolved
Hide resolved
0b8c877
to
81c7b80
Compare
The BLOCK_BUILDER return convention writes the function result to a BlockBuilder which is passed as the last argument
81c7b80
to
7b6a8c3
Compare
Description
BLOCK_BUILDER
return convention that writes the result directly to aBlockBuilder
READ_VALUE
operator that can read a value from any argument convention to any return conventionPageBuilder
cache to use the simplerBufferedArrayValueBuilder
Release notes
(X) Release notes are required, with the following suggested text: