Class RecordHandler

    • Constructor Detail

      • RecordHandler

        public RecordHandler​(String sourceType,
                             Map<String,​String> configOptions)
        Parameters:
        sourceType - Used to aid in logging diagnostic info when raising a support case.
      • RecordHandler

        public RecordHandler​(software.amazon.awssdk.services.s3.S3Client amazonS3,
                             software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsManager,
                             software.amazon.awssdk.services.athena.AthenaClient athena,
                             String sourceType,
                             Map<String,​String> configOptions)
        Parameters:
        sourceType - Used to aid in logging diagnostic info when raising a support case.
    • Method Detail

      • getCachableSecretsManager

        public CachableSecretsManager getCachableSecretsManager()
        Gets the CachableSecretsManager instance used by this handler. This is used by credential providers to reuse the same secrets manager instance.
        Specified by:
        getCachableSecretsManager in interface FederationRequestHandler
        Returns:
        The CachableSecretsManager instance
      • handleRequest

        public final void handleRequest​(InputStream inputStream,
                                        OutputStream outputStream,
                                        com.amazonaws.services.lambda.runtime.Context context)
                                 throws IOException
        Specified by:
        handleRequest in interface com.amazonaws.services.lambda.runtime.RequestStreamHandler
        Throws:
        IOException
      • doReadRecords

        public RecordResponse doReadRecords​(BlockAllocator allocator,
                                            ReadRecordsRequest request)
                                     throws Exception
        Used to read the row data associated with the provided Split.
        Parameters:
        allocator - Tool for creating and managing Apache Arrow Blocks.
        request - 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.
        Returns:
        A RecordResponse which either a ReadRecordsResponse or a RemoteReadRecordsResponse containing the row data for the requested Split.
        Throws:
        Exception
      • readWithConstraint

        protected abstract void readWithConstraint​(BlockSpiller spiller,
                                                   ReadRecordsRequest recordsRequest,
                                                   QueryStatusChecker queryStatusChecker)
                                            throws Exception
        A more stream lined option for reading the row data associated with the provided Split. This method differs from doReadRecords(...) in that the SDK handles more of the request lifecycle, leaving you to focus more closely on the task of actually reading from your source.
        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:
        Exception
      • onPing

        protected void onPing​(PingRequest request)