返回首页

gbase数据、南大通用产品文档:GBase8scdr list trustedhost 参数:罗列可信任主机

更新日期:2024年09月11日

(SQL 管理 API)
随同 admin() 或 task() 函数,使用 cdr list trustedhost 参数来罗列来自于数据库服
务器的 REMOTE_SERVER_CFG 配置参数指定文件的可信任主机信息。
语法

用法
您必须是“数据库服务器管理员”(DBSA)才能运行这个函数。
示例
下列命令罗列来自于数据库服务器的可信任主机文件的可信任主机条目:
EXECUTE FUNCTION task("cdr list trustedhost");
下列示例输出显示使用 cdr list trustedhost 参数可能的结果。
myhost1 user_1
myhost1.example.com user_1
myhost2 user_2
myhost2.example.com user_2

);

查看训练结果。
gbase> SELECT * FROM patients_logregr\G
*************************** 1. row ***************************
coef: -5.828, -0.888858, 0.108851
log_likelihood: -9.70259
std_err: 2.70859, 1.08267, 0.0461127
z_stats: -2.15168, -0.820985, 2.36054
num_rows_processed: 20
num_missing_rows_skipped: 0
num_iterations: 17
1 row in set (Elapsed: 00:00:00.00)
gbase> select * from test.patients_logregr_summary\G
*************************** 1. row ***************************

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1434
method: logregr
source_table: test.patients
out_table: test.patients_logregr
dependent_varname: second_attack
independent_varname: array double[1, treatment, trait_anxiety]
optimizer_params: optimizer=cg, max_iter=20, tolerance=0.0001
num_all_groups: 1
num_failed_groups: 0
num_rows_processed: 20
num_missing_rows_skipped: 0
grouping_col: NULL
1 row in set (Elapsed: 00:00:00.00)

用模型进行预测。
gbase>
SELECT p.id,
mllib.logregr_predict(
coef,
array double[1, treatment, trait_anxiety]
) as predict,
p.second_attack
FROM patients p, patients_logregr m
ORDER BY p.id;
+----+---------+---------------+
| id | predict | second_attack |
+----+---------+---------------+
|
1 | 1
|
1 |
|
2 | 1
|
1 |
|
3 | 0
|
1 |
|
4 | 1
|
1 |
|
5 | 0
|
1 |
|
6 | 1
|
1 |
|
7 | 1
|
1 |
|
8 | 1
|
1 |
|
9 | 1
|
1 |
| 10 | 1
|
1 |
| 11 | 1
|
0 |

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1435
| 12 | 0
|
0 |
| 13 | 0
|
0 |
| 14 | 0
|
0 |
| 15 | 0
|
0 |
| 16 | 0
|
0 |
| 17 | 1
|
0 |
| 18 | 0
|
0 |
| 19 | 0
|
0 |
| 20 | 1
|
0 |
+----+---------+---------------+
20 rows in set (Elapsed: 00:00:00.00)
预测语句输出的id 列代表不同的患者,
predict 列的值代表对患者是否会复发
的预测值(0 代表不复发,1 代表复发),second_attach 列的值是患者是否复发
的真实值,比较两个值可以知道使用Logistic 回归模型进行分析是比较恰当
的。

要检索 GBase 8s 不透明类型,必须使用 ResultSet.getObject()。GBase 8s JDBC Driver 根据
您提供的自定义类型将数据转换为 Java™ 对象。使用前面示例的 charattrUDT 类型,可以
获取此不透明数据,如下所示:
String s = "select int_col, charattr_col from charattr_tab order by 1";
System.out.println(s);

Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(s);
System.out.println("execute...ok");

System.out.println("Fetching data ...");
int curRow = 0;
while (rs.next())
{
curRow++;
System.out.println("currentrow=" + curRow + " : ");

int intret = rs.getInt("int_col");
System.out.println(" int_col " + intret);

charattrUDT charattrret = (charattrUDT)rs.getObject("charattr_col");
System.out.print(" charattr_col ");
if (curRow == 2 || curRow == 6)
{
if (rs.wasNull())
System.out.println("");
else
System.out.println("***ERROR: " + charattrret);
}
else
System.out.println(charattrret+"");
} //while

System.out.println("total rows expected: " + curRow);
stmt.close();

GBase 8s JDBC Driver 程序员指南
南大通用数据技术股份有限公司
- 194
-