Class DynamoDBTableResolver
- java.lang.Object
-
- com.amazonaws.athena.connectors.dynamodb.resolver.DynamoDBTableResolver
-
public class DynamoDBTableResolver extends Object
This class helps with resolving the differences in casing between DynamoDB and Presto. Presto expects all databases, tables, and columns to be lower case. This class allows us to resolve DynamoDB tables which may have captial letters in them without issue. It does so by fetching all table names and doing a case insensitive search over them. It will first try to do a targeted get to reduce the penalty for tables which don't have capitalization. TODO add caching
-
-
Constructor Summary
Constructors Constructor Description DynamoDBTableResolver(ThrottlingInvoker invoker, software.amazon.awssdk.services.dynamodb.DynamoDbClient ddbClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DynamoDBTable
getTableMetadata(String tableName)
Fetches table metadata by first doing a DescribeTable on the given table table, falling back to case insensitive resolution if the table isn't found.org.apache.arrow.vector.types.pojo.Schema
getTableSchema(String tableName)
Fetches table schema by first doing a Scan on the given table name, falling back to case insensitive resolution if the table isn't found.DynamoDBPaginatedTables
listTables(String token, int pageSize)
Fetches the list of tables from DynamoDB via paginated ListTables calls
-
-
-
Constructor Detail
-
DynamoDBTableResolver
public DynamoDBTableResolver(ThrottlingInvoker invoker, software.amazon.awssdk.services.dynamodb.DynamoDbClient ddbClient)
-
-
Method Detail
-
listTables
public DynamoDBPaginatedTables listTables(String token, int pageSize) throws TimeoutException
Fetches the list of tables from DynamoDB via paginated ListTables calls- Returns:
- the list of tables in DynamoDB
- Throws:
TimeoutException
-
getTableSchema
public org.apache.arrow.vector.types.pojo.Schema getTableSchema(String tableName) throws TimeoutException
Fetches table schema by first doing a Scan on the given table name, falling back to case insensitive resolution if the table isn't found. Delegates actual schema derivation toDDBTableUtils.peekTableForSchema(java.lang.String, com.amazonaws.athena.connector.lambda.ThrottlingInvoker, software.amazon.awssdk.services.dynamodb.DynamoDbClient)
.- Parameters:
tableName
- the case insensitive table name- Returns:
- the table's schema
- Throws:
TimeoutException
-
getTableMetadata
public DynamoDBTable getTableMetadata(String tableName) throws TimeoutException
Fetches table metadata by first doing a DescribeTable on the given table table, falling back to case insensitive resolution if the table isn't found.- Parameters:
tableName
- the case insensitive table name- Returns:
- the table's metadata
- Throws:
TimeoutException
-
-