Skip to content

Commit

Permalink
Refactor ShadowDMLStatementDataSourceMappingsRetriever (#33556)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Nov 5, 2024
1 parent 121584e commit 0f6e2ef
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ private ShadowColumnDataSourceMappingsRetriever createShadowDataSourceMappingsRe
if (queryContext.getSqlStatementContext() instanceof SelectStatementContext) {
return new ShadowSelectStatementDataSourceMappingsRetriever((SelectStatementContext) queryContext.getSqlStatementContext(), queryContext.getParameters(), tableAliasAndNameMappings);
}
throw new UnsupportedOperationException(String.format("unsupported SQL statement context `%s`", queryContext.getSqlStatementContext().getClass().getName()));
return null;
}

@Override
public Map<String, String> retrieve(final ShadowRule rule) {
Collection<String> shadowTables = rule.filterShadowTables(tableAliasAndNameMappings.values());
Map<String, String> result = tableHintDataSourceMappingsRetriever.retrieve(rule, shadowTables);
return result.isEmpty() ? shadowColumnDataSourceMappingsRetriever.retrieve(rule, shadowTables) : result;
return result.isEmpty() && null != shadowColumnDataSourceMappingsRetriever ? shadowColumnDataSourceMappingsRetriever.retrieve(rule, shadowTables) : result;
}
}

0 comments on commit 0f6e2ef

Please sign in to comment.