Skip to content

Commit

Permalink
Add transform function const
Browse files Browse the repository at this point in the history
Dith3r authored and sopel39 committed Jun 20, 2024
1 parent 5d84faf commit 2add0e8
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -84,10 +84,11 @@ public final class ArrayTransformFunction
}

public static final ArrayTransformFunction ARRAY_TRANSFORM_FUNCTION = new ArrayTransformFunction();
public static final String ARRAY_TRANSFORM_NAME = "transform";

private ArrayTransformFunction()
{
super(FunctionMetadata.scalarBuilder("transform")
super(FunctionMetadata.scalarBuilder(ARRAY_TRANSFORM_NAME)
.signature(Signature.builder()
.typeVariable("T")
.typeVariable("U")
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@

import static com.google.common.base.Verify.verify;
import static io.trino.memory.context.AggregatedMemoryContext.newSimpleAggregatedMemoryContext;
import static io.trino.operator.scalar.ArrayTransformFunction.ARRAY_TRANSFORM_NAME;
import static io.trino.spi.function.OperatorType.LESS_THAN;
import static io.trino.spi.type.BigintType.BIGINT;
import static io.trino.spi.type.BooleanType.BOOLEAN;
@@ -108,7 +109,7 @@ public void setup()
Type elementType = TYPES.get(i);
ArrayType arrayType = new ArrayType(elementType);
projectionsBuilder.add(new CallExpression(
functionResolution.resolveFunction("transform", fromTypes(arrayType, new FunctionType(ImmutableList.of(BIGINT), BOOLEAN))),
functionResolution.resolveFunction(ARRAY_TRANSFORM_NAME, fromTypes(arrayType, new FunctionType(ImmutableList.of(BIGINT), BOOLEAN))),
ImmutableList.of(
new InputReferenceExpression(0, arrayType),
new LambdaDefinitionExpression(

0 comments on commit 2add0e8

Please sign in to comment.