Skip to content

Commit

Permalink
新增支持 Apache/IoTDB - 一体化收集、存储、管理与分析物联网时序数据的软件系统;完善 AI 向量数据库 Milvus 的 S…
Browse files Browse the repository at this point in the history
…QL 函数注册;升级版本支 7.2.0
  • Loading branch information
TommyLemon committed Dec 22, 2024
1 parent 70f65fe commit 1f2d304
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion APIJSONORM/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.Tencent</groupId>
<artifactId>APIJSON</artifactId>
<version>7.1.0</version>
<version>7.2.0</version>
<packaging>jar</packaging>

<name>APIJSONORM</name>
Expand Down
2 changes: 1 addition & 1 deletion APIJSONORM/src/main/java/apijson/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Log {

public static boolean DEBUG = true;

public static final String VERSION = "7.1.0";
public static final String VERSION = "7.2.0";
public static final String KEY_SYSTEM_INFO_DIVIDER = "\n---|-----APIJSON SYSTEM INFO-----|---\n";

public static final String OS_NAME;
Expand Down
29 changes: 26 additions & 3 deletions APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public abstract class AbstractSQLConfig<T extends Object> implements SQLConfig<T
DATABASE_LIST.add(DATABASE_MILVUS);
DATABASE_LIST.add(DATABASE_INFLUXDB);
DATABASE_LIST.add(DATABASE_TDENGINE);
DATABASE_LIST.add(DATABASE_IOTDB);
DATABASE_LIST.add(DATABASE_SNOWFLAKE);
DATABASE_LIST.add(DATABASE_DATABRICKS);
DATABASE_LIST.add(DATABASE_REDIS);
Expand All @@ -224,6 +225,7 @@ public abstract class AbstractSQLConfig<T extends Object> implements SQLConfig<T
DATABASE_LIST.add(DATABASE_KAFKA);
DATABASE_LIST.add(DATABASE_MQ);


RAW_MAP = new LinkedHashMap<>(); // 保证顺序,避免配置冲突等意外情况

RAW_MAP.put("+", "");
Expand Down Expand Up @@ -820,6 +822,18 @@ public abstract class AbstractSQLConfig<T extends Object> implements SQLConfig<T
SQL_FUNCTION_MAP.put("len", "");
SQL_FUNCTION_MAP.put("datalength", "");

// Milvus 相关 SQL 函数
SQL_FUNCTION_MAP.put("vMatch", "");
SQL_FUNCTION_MAP.put("consistencyLevel", "");
SQL_FUNCTION_MAP.put("partitionBy", "");
SQL_FUNCTION_MAP.put("gracefulTime", "");
SQL_FUNCTION_MAP.put("guaranteeTimestamp", "");
SQL_FUNCTION_MAP.put("roundDecimal", "");
SQL_FUNCTION_MAP.put("travelTimestamp", "");
SQL_FUNCTION_MAP.put("nProbe", "");
SQL_FUNCTION_MAP.put("ef", "");
SQL_FUNCTION_MAP.put("searchK", "");

}

private Parser<T> parser;
Expand Down Expand Up @@ -1011,7 +1025,7 @@ public AbstractSQLConfig setMethod(RequestMethod method) {
}
@Override
public boolean isPrepared() {
return prepared;
return prepared && ! isMongoDB(); // MongoDB JDBC 还不支持预编译;
}
@Override
public AbstractSQLConfig setPrepared(boolean prepared) {
Expand Down Expand Up @@ -1269,6 +1283,15 @@ public static boolean isTDengine(String db) {
return DATABASE_TDENGINE.equals(db);
}


public boolean isIoTDB() {
return isIoTDB(getDatabase());
}
public static boolean isIoTDB(String db) {
return DATABASE_IOTDB.equals(db);
}


@Override
public boolean isRedis() {
return isRedis(getSQLDatabase());
Expand Down Expand Up @@ -1310,8 +1333,8 @@ public static boolean isSQLite(String db) {
}

@Override
public String getQuote() {
if(isElasticsearch()) {
public String getQuote() { // MongoDB 同时支持 `tbl` 反引号 和 "col" 双引号
if(isElasticsearch() || isIoTDB()) {
return "";
}
return isMySQL() || isMariaDB() || isTiDB() || isClickHouse() || isTDengine() || isMilvus() ? "`" : "\"";
Expand Down
6 changes: 5 additions & 1 deletion APIJSONORM/src/main/java/apijson/orm/SQLConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ public interface SQLConfig<T extends Object> {
String DATABASE_MILVUS = "MILVUS"; // https://milvus.io
String DATABASE_INFLUXDB = "INFLUXDB"; // https://www.influxdata.com/products/influxdb-overview
String DATABASE_TDENGINE = "TDENGINE"; // https://tdengine.com
String DATABASE_IOTDB = "IOTDB"; // https://iotdb.apache.org/zh/UserGuide/latest/API/Programming-JDBC.html

String DATABASE_REDIS = "REDIS"; // https://redisql.com
String DATABASE_MONGODB = "MONGODB"; // https://www.mongodb.com/docs/atlas/data-federation/query/query-with-sql
String DATABASE_KAFKA = "KAFKA"; // https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONDemo-MultiDataSource-Kafka
String DATABASE_MQ = "MQ"; //
String DATABASE_SQLITE = "SQLITE"; // https://www.sqlite.org

String DATABASE_MQ = "MQ"; //

String SCHEMA_INFORMATION = "information_schema"; //MySQL, PostgreSQL, SQL Server 都有的系统模式
String SCHEMA_SYS = "sys"; //SQL Server 系统模式
String TABLE_SCHEMA = "table_schema";
Expand Down Expand Up @@ -88,6 +91,7 @@ public interface SQLConfig<T extends Object> {
boolean isMilvus();
boolean isInfluxDB();
boolean isTDengine();
boolean isIoTDB();
boolean isRedis();
boolean isMongoDB();
boolean isKafka();
Expand Down

0 comments on commit 1f2d304

Please sign in to comment.