Class Db2As400MetadataHandler
- java.lang.Object
-
- com.amazonaws.athena.connector.lambda.handlers.MetadataHandler
-
- com.amazonaws.athena.connectors.jdbc.manager.JdbcMetadataHandler
-
- com.amazonaws.athena.connectors.db2as400.Db2As400MetadataHandler
-
- All Implemented Interfaces:
com.amazonaws.services.lambda.runtime.RequestStreamHandler
public class Db2As400MetadataHandler extends JdbcMetadataHandler
-
-
Field Summary
-
Fields inherited from class com.amazonaws.athena.connectors.jdbc.manager.JdbcMetadataHandler
jdbcQueryPassthrough, TABLES_AND_VIEWS
-
Fields inherited from class com.amazonaws.athena.connector.lambda.handlers.MetadataHandler
configOptions, DISABLE_SPILL_ENCRYPTION, KMS_KEY_ID_ENV, SPILL_BUCKET_ENV, SPILL_PREFIX_ENV
-
-
Constructor Summary
Constructors Modifier Constructor Description Db2As400MetadataHandler(DatabaseConnectionConfig databaseConnectionConfig, JdbcConnectionFactory jdbcConnectionFactory, Map<String,String> configOptions)
To be used by Mux.Db2As400MetadataHandler(DatabaseConnectionConfig databaseConnectionConfig, Map<String,String> configOptions)
TO be used by Mux.protected
Db2As400MetadataHandler(DatabaseConnectionConfig databaseConnectionConfig, software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsManager, software.amazon.awssdk.services.athena.AthenaClient athena, JdbcConnectionFactory jdbcConnectionFactory, Map<String,String> configOptions)
Db2As400MetadataHandler(Map<String,String> configOptions)
Instantiates handler to be used by Lambda function directly.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GetDataSourceCapabilitiesResponse
doGetDataSourceCapabilities(BlockAllocator allocator, GetDataSourceCapabilitiesRequest request)
Used to describe the types of capabilities supported by a data source.GetSplitsResponse
doGetSplits(BlockAllocator blockAllocator, GetSplitsRequest getSplitsRequest)
Split(s) will be created based on table partition.GetTableResponse
doGetTable(BlockAllocator blockAllocator, GetTableRequest getTableRequest)
Creating TableName object, Schema object for partition framing fields, and Schema object for table fields.ListSchemasResponse
doListSchemaNames(BlockAllocator blockAllocator, ListSchemasRequest listSchemasRequest)
Overridden this method to fetch only user defined schema(s) in Athena Data window.ListTablesResponse
doListTables(BlockAllocator blockAllocator, ListTablesRequest listTablesRequest)
Overridden this method to fetch table(s) for selected schema in Athena Data window.void
getPartitions(BlockWriter blockWriter, GetTableLayoutRequest getTableLayoutRequest, QueryStatusChecker queryStatusChecker)
A partition is represented by a partition column(s) of type varchar.org.apache.arrow.vector.types.pojo.Schema
getPartitionSchema(String catalogName)
Creates Schema object with arrow compatible filed to frame the partition.-
Methods inherited from class com.amazonaws.athena.connectors.jdbc.manager.JdbcMetadataHandler
caseInsensitiveTableSearch, convertDatasourceTypeToArrow, doGetQueryPassthroughSchema, escapeNamePattern, getArrayArrowTypeFromTypeName, getCredentialProvider, getJdbcConnectionFactory, getSplitClauses, listPaginatedTables, listTables, setupQueryPassthroughSplit
-
Methods inherited from class com.amazonaws.athena.connector.lambda.handlers.MetadataHandler
doGetTableLayout, doHandleRequest, doPing, enhancePartitionSchema, getSecret, handleRequest, makeEncryptionKey, makeSpillLocation, onPing, resolveSecrets
-
-
-
-
Constructor Detail
-
Db2As400MetadataHandler
public Db2As400MetadataHandler(Map<String,String> configOptions)
Instantiates handler to be used by Lambda function directly.Recommend using
Db2As400MuxCompositeHandler
instead.
-
Db2As400MetadataHandler
public Db2As400MetadataHandler(DatabaseConnectionConfig databaseConnectionConfig, Map<String,String> configOptions)
TO be used by Mux.- Parameters:
databaseConnectionConfig
-
-
Db2As400MetadataHandler
public Db2As400MetadataHandler(DatabaseConnectionConfig databaseConnectionConfig, JdbcConnectionFactory jdbcConnectionFactory, Map<String,String> configOptions)
To be used by Mux.- Parameters:
databaseConnectionConfig
-jdbcConnectionFactory
-
-
Db2As400MetadataHandler
protected Db2As400MetadataHandler(DatabaseConnectionConfig databaseConnectionConfig, software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsManager, software.amazon.awssdk.services.athena.AthenaClient athena, JdbcConnectionFactory jdbcConnectionFactory, Map<String,String> configOptions)
-
-
Method Detail
-
doGetDataSourceCapabilities
public GetDataSourceCapabilitiesResponse doGetDataSourceCapabilities(BlockAllocator allocator, GetDataSourceCapabilitiesRequest request)
Description copied from class:MetadataHandler
Used to describe the types of capabilities supported by a data source. An engine can use this to determine what portions of the query to push down. A connector that returns any optimization will guarantee that the associated predicate will be pushed down.- Overrides:
doGetDataSourceCapabilities
in classMetadataHandler
- Parameters:
allocator
- Tool for creating and managing Apache Arrow Blocks.request
- Provides details about the catalog being used.- Returns:
- A GetDataSourceCapabilitiesResponse object which returns a map of supported optimizations that the connector is advertising to the consumer. The connector assumes all responsibility for whatever is passed here.
-
doListSchemaNames
public ListSchemasResponse doListSchemaNames(BlockAllocator blockAllocator, ListSchemasRequest listSchemasRequest) throws Exception
Overridden this method to fetch only user defined schema(s) in Athena Data window.- Overrides:
doListSchemaNames
in classJdbcMetadataHandler
- Parameters:
blockAllocator
-listSchemasRequest
-- Returns:
- Throws:
Exception
-
doListTables
public ListTablesResponse doListTables(BlockAllocator blockAllocator, ListTablesRequest listTablesRequest) throws Exception
Overridden this method to fetch table(s) for selected schema in Athena Data window.- Overrides:
doListTables
in classJdbcMetadataHandler
- Parameters:
blockAllocator
-listTablesRequest
-- Returns:
- Throws:
Exception
-
doGetTable
public GetTableResponse doGetTable(BlockAllocator blockAllocator, GetTableRequest getTableRequest) throws Exception
Creating TableName object, Schema object for partition framing fields, and Schema object for table fields.- Overrides:
doGetTable
in classJdbcMetadataHandler
- Parameters:
blockAllocator
-getTableRequest
-- Returns:
- Throws:
Exception
-
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 classJdbcMetadataHandler
- 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 classJdbcMetadataHandler
- 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 classJdbcMetadataHandler
- Parameters:
blockAllocator
-getSplitsRequest
-- Returns:
-
-