Class Db2MetadataHandler

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

    public class Db2MetadataHandler
    extends JdbcMetadataHandler
    • Constructor Detail

      • Db2MetadataHandler

        public Db2MetadataHandler​(Map<String,​String> configOptions)
        Instantiates handler to be used by Lambda function directly.

        Recommend using Db2MuxCompositeHandler instead.

      • Db2MetadataHandler

        public Db2MetadataHandler​(DatabaseConnectionConfig databaseConnectionConfig,
                                  Map<String,​String> configOptions)
        TO be used by Mux.
        Parameters:
        databaseConnectionConfig -
      • Db2MetadataHandler

        protected Db2MetadataHandler​(DatabaseConnectionConfig databaseConnectionConfig,
                                     software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsManager,
                                     software.amazon.awssdk.services.athena.AthenaClient athena,
                                     JdbcConnectionFactory jdbcConnectionFactory,
                                     Map<String,​String> configOptions)
    • Method Detail

      • getPartitionSchema

        public org.apache.arrow.vector.types.pojo.Schema getPartitionSchema​(String catalogName)
        Creates Schema object with arrow compatible filed to frame the partition.
        Specified by:
        getPartitionSchema in class JdbcMetadataHandler
        Parameters:
        catalogName - Athena provided catalog name.
        Returns:
      • getPartitions

        public void getPartitions​(BlockWriter blockWriter,
                                  GetTableLayoutRequest getTableLayoutRequest,
                                  QueryStatusChecker queryStatusChecker)
                           throws Exception
        A partition is represented by a partition column(s) of type varchar. In case of Db2 connector, partitions are created using below organization schemes. - Distribute by Hash - Partition by range - Organize by dimensions The partition details such as no. of partitions, column name are fetched from the Db2 metadata table(s). A custom query is then used to get the partition. Based upon the number of distinct partitions received, the splits are being created.
        Specified by:
        getPartitions in class JdbcMetadataHandler
        Parameters:
        blockWriter -
        getTableLayoutRequest -
        queryStatusChecker -
        Throws:
        Exception
      • doGetSplits

        public GetSplitsResponse doGetSplits​(BlockAllocator blockAllocator,
                                             GetSplitsRequest getSplitsRequest)
        Split(s) will be created based on table partition. We are taking ContinuationToken from GetSplitsRequest object and loop upto row count of the partitions, and inside loop we are creating Split objects. In each Split object we are adding properties to be used in partition framing.
        Specified by:
        doGetSplits in class JdbcMetadataHandler
        Parameters:
        blockAllocator -
        getSplitsRequest -
        Returns: