Search in sources :

Example 1 with RecordRequestType

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

the class RecordHandler method doHandleRequest.

protected final void doHandleRequest(BlockAllocator allocator, ObjectMapper objectMapper, RecordRequest req, OutputStream outputStream) throws Exception {
    logger.info("doHandleRequest: request[{}]", req);
    RecordRequestType type = req.getRequestType();
    switch(type) {
        case READ_RECORDS:
            try (RecordResponse response = doReadRecords(allocator, (ReadRecordsRequest) req)) {
                logger.info("doHandleRequest: response[{}]", response);
                assertNotNull(response);
                objectMapper.writeValue(outputStream, response);
            }
            return;
        default:
            throw new IllegalArgumentException("Unknown request type " + type);
    }
}
Also used : RecordRequestType(com.amazonaws.athena.connector.lambda.records.RecordRequestType) RecordResponse(com.amazonaws.athena.connector.lambda.records.RecordResponse)

Aggregations

RecordRequestType (com.amazonaws.athena.connector.lambda.records.RecordRequestType)1 RecordResponse (com.amazonaws.athena.connector.lambda.records.RecordResponse)1