sunkai-cai commented on code in PR #19352:
URL: https://github.com/apache/shardingsphere/pull/19352#discussion_r924349900
##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java:
##########
@@ -670,6 +672,22 @@ public Map<String, String>
getLogicAndActualTablesFromBindingTable(final String
.orElseGet(Collections::emptyMap);
}
+ /**
+ * Get logic table and actual table.
+ *
+ * @param routeUnit Route unit
+ * @param availableLogicBindingTables available logic binding table names
+ * @return key is logicTable name, values is actualTable belong to this
data source
+ */
+ public Map<String, String> getLogicAndActualTablesFromRouteUnit(final
RouteUnit routeUnit, final Collection<String> availableLogicBindingTables) {
+ Map<String, String> result = new
HashMap<>(availableLogicBindingTables.size(), 1);
+ for (RouteMapper each : routeUnit.getTableMappers()) {
+ result.put(each.getLogicName().toLowerCase(),
each.getActualName());
+
result.putAll(this.getLogicAndActualTablesFromBindingTable(routeUnit.getDataSourceMapper().getLogicName(),
each.getLogicName(), each.getActualName(), availableLogicBindingTables));
Review Comment:
I don't know why is do that. Get last actualTableName from bindingTable ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]