Skip to content

Commit 9e18800

Browse files
guojn1ketor
authored andcommitted
[fix][dingo-driver] Remove RelNodeCache because it is not stable enough
1 parent ccba930 commit 9e18800

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

dingo-calcite/src/main/java/io/dingodb/calcite/DingoDdlExecutor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,6 @@ private void dropTableByName(SqlDropTable drop, Connection context, DingoSchema
733733
schema.dropTable(tableName);
734734
userService.dropTablePrivilege(schema.name(), tableName);
735735
StatsOperator.delStats(schema.name(), tableName);
736-
RelNodeCache.clearRelNode(tableName);
737736
} catch (TimeoutException e) {
738737
future.cancel(true);
739738
throw new RuntimeException("Lock wait timeout exceeded.");
@@ -779,7 +778,6 @@ public void execute(@NonNull SqlTruncate truncate, CalcitePrepare.Context contex
779778
LogUtils.info(log, "DDL execute truncate lock end lock: {}", lock);
780779
schema.getMetaService().truncateTable(tableName);
781780
StatsOperator.delStats(schema.name(), tableName);
782-
RelNodeCache.clearRelNode(tableName);
783781
} catch (TimeoutException e) {
784782
future.cancel(true);
785783
throw new RuntimeException("Lock wait timeout exceeded.");

dingo-calcite/src/main/java/io/dingodb/calcite/utils/RelNodeCache.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public static void setRelNode(String schema, String sql, RelNode relNode, boolea
7878
}
7979

8080
public static void clearRelNode(String tableName) {
81-
Collection<Map<String, RelNode>> collection = relNodeCache.asMap().values();
82-
collection.forEach(map -> {
83-
map.keySet().removeIf(key -> key.contains(tableName)
84-
|| key.contains(tableName.toUpperCase()) || key.contains(tableName.toLowerCase()));
85-
});
81+
//Collection<Map<String, RelNode>> collection = relNodeCache.asMap().values();
82+
//collection.forEach(map -> {
83+
// map.keySet().removeIf(key -> key.contains(tableName)
84+
// || key.contains(tableName.toUpperCase()) || key.contains(tableName.toLowerCase()));
85+
//});
8686
}
8787
}

dingo-driver/host/src/main/java/io/dingodb/driver/DingoDriverParser.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,8 @@ public Meta.Signature parseQuery(
343343
List<List<String>> originList = validator.getFieldOrigins(sqlNode);
344344
final List<ColumnMetaData> columns = getColumnMetaDataList(typeFactory, jdbcType, originList);
345345

346-
RelNode relNode = RelNodeCache.getRelNode(connection.getSchema(), sql, prepare);
347-
if (relNode == null) {
348-
final RelRoot relRoot = convert(sqlNode, false);
349-
relNode = optimize(relRoot.rel);
350-
RelNodeCache.setRelNode(connection.getSchema(), sql, relNode, prepare);
351-
}
346+
final RelRoot relRoot = convert(sqlNode, false);
347+
RelNode relNode = optimize(relRoot.rel);
352348
planProfile.endOptimize();
353349
markAutoIncForDml(relNode);
354350
Location currentLocation = MetaService.root().currentLocation();

0 commit comments

Comments
 (0)