Class Db2MetadataHandler

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

    public class Db2MetadataHandler
    extends JdbcMetadataHandler
    • Method Detail

      • listTables

        protected List<TableName> listTables​(Connection connection,
                                             String schemaName)
                                      throws SQLException
        Overridden the base class method to provide DB2-specific table listing functionality.
        Overrides:
        listTables in class JdbcMetadataHandler
        Parameters:
        connection - The JDBC connection to use for querying DB2
        schemaName - The name of the schema to list tables from
        Returns:
        A list of TableName objects representing the tables and views in the specified schema
        Throws:
        SQLException - if there is an error executing the query or processing the results
      • 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:
      • getSchema

        protected org.apache.arrow.vector.types.pojo.Schema getSchema​(Connection jdbcConnection,
                                                                      TableName tableName,
                                                                      org.apache.arrow.vector.types.pojo.Schema partitionSchema)
                                                               throws Exception
        Appropriate data type to arrow type conversions will be done by fetching data types of columns. This function creates the arrow Schema pojo from jdbc database metadata of the table.
        Overrides:
        getSchema in class JdbcMetadataHandler
        Parameters:
        jdbcConnection -
        tableName -
        partitionSchema -
        Returns:
        Throws:
        Exception