Class ElasticsearchRecordHandler

  • All Implemented Interfaces:
    com.amazonaws.services.lambda.runtime.RequestStreamHandler

    public class ElasticsearchRecordHandler
    extends RecordHandler
    This class is responsible for providing Athena with actual rows level data from your Elasticsearch instance. Athena will call readWithConstraint(...) on this class for each 'Split' you generated in ElasticsearchMetadataHandler.
    • Constructor Detail

      • ElasticsearchRecordHandler

        public ElasticsearchRecordHandler​(Map<String,​String> configOptions)
      • ElasticsearchRecordHandler

        protected ElasticsearchRecordHandler​(software.amazon.awssdk.services.s3.S3Client amazonS3,
                                             software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsManager,
                                             software.amazon.awssdk.services.athena.AthenaClient amazonAthena,
                                             AwsRestHighLevelClientFactory clientFactory,
                                             long queryTimeout,
                                             long scrollTimeout,
                                             Map<String,​String> configOptions)
    • Method Detail

      • readWithConstraint

        protected void readWithConstraint​(BlockSpiller spiller,
                                          ReadRecordsRequest recordsRequest,
                                          QueryStatusChecker queryStatusChecker)
                                   throws RuntimeException
        Used to read the row data associated with the provided Split.
        Specified by:
        readWithConstraint in class RecordHandler
        Parameters:
        spiller - A BlockSpiller that should be used to write the row data associated with this Split. The BlockSpiller automatically handles chunking the response, encrypting, and spilling to S3.
        recordsRequest - Details of the read request, including: 1. The Split 2. The Catalog, Database, and Table the read request is for. 3. The filtering predicate (if any) 4. The columns required for projection.
        queryStatusChecker - A QueryStatusChecker that you can use to stop doing work for a query that has already terminated
        Throws:
        RuntimeException - when an error occurs while attempting to send the query, or the query timed out.
      • getQueryBatchSize

        protected int getQueryBatchSize()
        Returns:
        value used for pagination batch size.