I suspect accessing JDBC-based sources like Mysql would cause memory leak

Hi guys,

I wonder if the flowing code has a bug. Thank you all very much!

Please see the fllowing code snippet in the class JdbcConverterRule.class in the dremio-extra-plugin-jdbc-xxx.jar. In function getRuleContext: for the some pluginId, RuleContext got from the ruleContextCache is always null and ruleContextCache becomes bigger and bigger.

abstract class JdbcConverterRule extends RelOptRule {
private static final Map<WeakReference, JdbcConverterRule.RuleContext> ruleContextCache = new ConcurrentHashMap();
JdbcConverterRule(RelOptRuleOperand operand, String description) {
super(operand, description);
}
protected static DremioSqlDialect getDialect(StoragePluginId pluginId) {
JdbcConf conf = (JdbcConf)pluginId.getConnectionConf();
return conf.getDialect();
}
static JdbcConverterRule.RuleContext getRuleContext(StoragePluginId pluginId, RexBuilder builder) {
JdbcConverterRule.RuleContext context = (JdbcConverterRule.RuleContext)ruleContextCache.get(pluginId);
if (context == null) {
context = new JdbcConverterRule.RuleContext(pluginId, builder);
ruleContextCache.put(new WeakReference(pluginId), context);
}
return context;
}
}