feat(数据源): calcite支持es

This commit is contained in:
junjun 2024-09-26 15:12:25 +08:00
parent 8a94c9810e
commit f8564d8368
2 changed files with 7 additions and 2 deletions

View File

@ -30,7 +30,7 @@
<mybatis-plus.version>3.5.6</mybatis-plus.version> <mybatis-plus.version>3.5.6</mybatis-plus.version>
<h2.version>2.2.220</h2.version> <h2.version>2.2.220</h2.version>
<knife4j.version>4.4.0</knife4j.version> <knife4j.version>4.4.0</knife4j.version>
<calcite-core.version>1.35.14</calcite-core.version> <calcite-core.version>1.35.15</calcite-core.version>
<commons-dbcp2.version>2.6.0</commons-dbcp2.version> <commons-dbcp2.version>2.6.0</commons-dbcp2.version>
<antlr.version>3.5.2</antlr.version> <antlr.version>3.5.2</antlr.version>
<java-jwt.version>3.12.1</java-jwt.version> <java-jwt.version>3.12.1</java-jwt.version>

View File

@ -138,7 +138,9 @@ public abstract class Provider {
// 获取数据库version // 获取数据库version
ConnectionObj connection = getConnection(value); ConnectionObj connection = getConnection(value);
value.setDsVersion(connection.getConnection().getMetaData().getDatabaseMajorVersion()); if (connection != null) {
value.setDsVersion(connection.getConnection().getMetaData().getDatabaseMajorVersion());
}
SqlParser parser = SqlParser.create(sql, SqlParser.Config.DEFAULT.withLex(Lex.JAVA)); SqlParser parser = SqlParser.create(sql, SqlParser.Config.DEFAULT.withLex(Lex.JAVA));
SqlNode sqlNode = parser.parseStmt(); SqlNode sqlNode = parser.parseStmt();
@ -227,6 +229,9 @@ public abstract class Provider {
case h2: case h2:
sqlDialect = H2SqlDialect.DEFAULT; sqlDialect = H2SqlDialect.DEFAULT;
break; break;
case es:
sqlDialect = EsSqlDialect.DEFAULT;
break;
default: default:
sqlDialect = MysqlSqlDialect.DEFAULT; sqlDialect = MysqlSqlDialect.DEFAULT;
} }