[feature](sql-dialect) support convert sql use sql convertor service (#27581)

Add a new FE Config `sql_convertor_service`.
If this config is set, and the session variable `sql_dialect` is set,
Doris will try to use a standalone sql converter service to convert user input sql to
specified sql dialect. eg:

```
mysql> set sql_dialect="presto";
Query OK, 0 rows affected (0.02 sec)

Database changed
mysql> select * from db1.tbl1 where "k1" = 1;  # will be converted to select * from db1.tbl1 where `k1` = 1;
+------+------+
| k1   | k2   |
+------+------+
|    1 |    2 |
+------+------+
1 row in set (0.08 sec)
```

The sql converter service should be a http service.
The request and response body can be found in `SQLDialectUtils.java`
This commit is contained in:
Mingyu Chen
2023-12-18 10:32:52 +08:00
committed by GitHub
parent d11365da9c
commit 6e855dd198
8 changed files with 406 additions and 12 deletions

View File

@ -2331,4 +2331,8 @@ public class Config extends ConfigBase {
@ConfField(description = {"是否开启通过http接口获取log文件的功能",
"Whether to enable the function of getting log files through http interface"})
public static boolean enable_get_log_file_api = false;
@ConfField(description = {"用于SQL方言转换的服务地址。",
"The service address for SQL dialect conversion."})
public static String sql_convertor_service = "";
}