Search in sources :

Example 11 with UserDefinedFunctionRequest

use of com.amazonaws.athena.connector.lambda.udf.UserDefinedFunctionRequest in project aws-athena-query-federation by awslabs.

the class UserDefinedFunctionRequestSerDeTest method beforeTest.

@Before
public void beforeTest() throws IOException {
    Schema inputSchema = SchemaBuilder.newBuilder().addField("factor1", Types.MinorType.INT.getType()).addField("factor2", Types.MinorType.INT.getType()).build();
    Schema outputSchema = SchemaBuilder.newBuilder().addField("product", Types.MinorType.INT.getType()).build();
    Block inputRecords = allocator.createBlock(inputSchema);
    inputRecords.setRowCount(1);
    IntVector inputVector1 = (IntVector) inputRecords.getFieldVector("factor1");
    IntVector inputVector2 = (IntVector) inputRecords.getFieldVector("factor2");
    inputVector1.setSafe(0, 2);
    inputVector2.setSafe(0, 3);
    expected = new UserDefinedFunctionRequest(federatedIdentity, inputRecords, outputSchema, "test-method", UserDefinedFunctionType.SCALAR);
    String expectedSerDeFile = utils.getResourceOrFail("serde/v2", "UserDefinedFunctionRequest.json");
    expectedSerDeText = utils.readAllAsString(expectedSerDeFile).trim();
}
Also used : UserDefinedFunctionRequest(com.amazonaws.athena.connector.lambda.udf.UserDefinedFunctionRequest) IntVector(org.apache.arrow.vector.IntVector) Schema(org.apache.arrow.vector.types.pojo.Schema) Block(com.amazonaws.athena.connector.lambda.data.Block) Before(org.junit.Before)

Aggregations

UserDefinedFunctionRequest (com.amazonaws.athena.connector.lambda.udf.UserDefinedFunctionRequest)11 Block (com.amazonaws.athena.connector.lambda.data.Block)6 UserDefinedFunctionResponse (com.amazonaws.athena.connector.lambda.udf.UserDefinedFunctionResponse)6 Test (org.junit.Test)6 FieldReader (org.apache.arrow.vector.complex.reader.FieldReader)4 FederationRequest (com.amazonaws.athena.connector.lambda.request.FederationRequest)2 PingRequest (com.amazonaws.athena.connector.lambda.request.PingRequest)2 PingResponse (com.amazonaws.athena.connector.lambda.request.PingResponse)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Schema (org.apache.arrow.vector.types.pojo.Schema)2 BlockAllocator (com.amazonaws.athena.connector.lambda.data.BlockAllocator)1 BlockAllocatorImpl (com.amazonaws.athena.connector.lambda.data.BlockAllocatorImpl)1 MetadataRequest (com.amazonaws.athena.connector.lambda.metadata.MetadataRequest)1 RecordRequest (com.amazonaws.athena.connector.lambda.records.RecordRequest)1 FederationResponse (com.amazonaws.athena.connector.lambda.request.FederationResponse)1 TypedSerDeTest (com.amazonaws.athena.connector.lambda.serde.TypedSerDeTest)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1