Skip to content

Commit

Permalink
Bug Fixes Glue Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzin1 committed Jan 16, 2024
1 parent 01d7997 commit cc02fa4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ public static Map<String, String> getGlueConnection()
String glueConnectionName = envConfig.get(DEFAULT_GLUE_CONNECTION);
if (glueConnectionName != null) {
HashMap<String, String> cachedConfig = connectionNameCache.get(glueConnectionName);
if (cachedConfig != null) {
if (cachedConfig == null) {
try {
HashMap<String, HashMap<String, String>> athenaDriverPropertiesToMap = new HashMap<String, HashMap<String, String>>();

AWSGlue awsGlue = AWSGlueClientBuilder.standard().withClientConfiguration(new ClientConfiguration().withConnectionTimeout(CONNECT_TIMEOUT)).build();
GetConnectionResult glueConnection = awsGlue.getConnection(new GetConnectionRequest().withName(glueConnectionName));
Connection connection = glueConnection.getConnection();
Expand All @@ -74,6 +75,8 @@ public static Map<String, String> getGlueConnection()
catch (Exception err) {
logger.error("Error thrown during fetching of {} connection properties. {}", glueConnectionName, err.toString());
}
}else{
return cachedConfig;
}
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public List<DatabaseConnectionConfig> build()
List<DatabaseConnectionConfig> databaseConnectionConfigs = new ArrayList<>();

int numberOfCatalogs = 0;
if (StringUtils.isBlank(properties.get(DEFAULT_GLUE_CONNECTION))) {
if (!StringUtils.isBlank(properties.get(DEFAULT_GLUE_CONNECTION))) {
databaseConnectionConfigs.add(extractDatabaseGlueConnectionConfig(DEFAULT_CONNECTION_STRING_PROPERTY));
numberOfCatalogs++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ public static DatabaseConnectionConfig getSingleDatabaseConfigFromEnv(String dat
List<DatabaseConnectionConfig> databaseConnectionConfigs = DatabaseConnectionConfigBuilder.buildFromSystemEnv(databaseEngine, configOptions);

for (DatabaseConnectionConfig databaseConnectionConfig : databaseConnectionConfigs) {
if (DatabaseConnectionConfigBuilder.DEFAULT_CONNECTION_STRING_PROPERTY.equals(databaseConnectionConfig.getCatalog())
&& databaseEngine.equals(databaseConnectionConfig.getEngine())) {
if (DatabaseConnectionConfigBuilder.DEFAULT_CONNECTION_STRING_PROPERTY.equals(databaseConnectionConfig.getCatalog())) {
return databaseConnectionConfig;
}
}

throw new RuntimeException(String.format("Must provide default connection string parameter %s for database type %s",
DatabaseConnectionConfigBuilder.DEFAULT_CONNECTION_STRING_PROPERTY, databaseEngine));
}
Expand Down

0 comments on commit cc02fa4

Please sign in to comment.