dolphindb 2.0.1024 → 2.0.1026

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs.en.json CHANGED
@@ -27864,7 +27864,7 @@
27864
27864
  "value": [
27865
27865
  "This command enables a shared stream table to be persisted to disk. ",
27866
27866
  "",
27867
- "For this command to work, we need to specify the configuration parameter `persistenceDir`. The persistence location of the table is <PERSISTENCE_DIR>/<TABLE_NAME>. The directory contains 2 types of files: data files (named like `data0.log`, `data1.log`...) and an index file index.log. The data that has been persisted to disk will be loaded into memory after the system is restarted.",
27867
+ "For this command to work, we need to specify the configuration parameter `persistenceDir` in the configuration file (*dolohindb.cfg* in standalone mode and *cluster.cfg* in cluster mode). For details of this configuration parameter, see :doc:`/DatabaseandDistributedComputing/Configuration/StandaloneMode`. The persistence location of the table is <PERSISTENCE_DIR>/<TABLE_NAME>. The directory contains 2 types of files: data files (named like `data0.log`, `data1.log`...) and an index file index.log. The data that has been persisted to disk will be loaded into memory after the system is restarted.",
27868
27868
  "",
27869
27869
  "The parameter `asynWrite` informs the system whether table persistence is in asynchronous mode. With asynchronous mode, new data are pushed to a queue and persistence workers (threads) will write the data to disk later. With synchronous mode, the table append operation keeps running until new data are persisted to the disk. The default value is true (asynchronous mode). In general, asynchronous mode achieves higher throughput.",
27870
27870
  "",
@@ -28001,7 +28001,7 @@
28001
28001
  {
28002
28002
  "type": "text",
28003
28003
  "value": [
28004
- "Share a stream table, and enable it to be persisted to disk. For this command to work, we need to specify the configuration parameter persistenceDir. The persistence location of the table is <PERSISTENCE_DIR>/<TABLE_NAME>. The directory contains 2 types of files: data files (named like `data0.log`, `data1.log`...) and an index file index.log. The data that has been persisted to disk will be loaded into memory after the system is restarted.",
28004
+ "Share a stream table, and enable it to be persisted to disk. For this command to work, we need to specify the configuration parameter `persistenceDir` in the configuration file (*dolohindb.cfg* in standalone mode and *cluster.cfg* in cluster mode). For details of this configuration parameter, see :doc:`/DatabaseandDistributedComputing/Configuration/StandaloneMode`. The persistence location of the table is <PERSISTENCE_DIR>/<TABLE_NAME>. The directory contains 2 types of files: data files (named like `data0.log`, `data1.log`...) and an index file index.log. The data that has been persisted to disk will be loaded into memory after the system is restarted.",
28005
28005
  "",
28006
28006
  "The parameter `asynWrite` informs the system whether table persistence is in asynchronous mode. With asynchronous mode, new data are pushed to a queue and persistence workers (threads) will write the data to disk later. With synchronous mode, the table append operation keeps running until new data are persisted to the disk. The default value is true (asynchronous mode). In general, asynchronous mode achieves higher throughput.",
28007
28007
  "",
@@ -72448,8 +72448,7 @@
72448
72448
  {
72449
72449
  "type": "text",
72450
72450
  "value": [
72451
- "`X` is a vector or a matrix.",
72452
- ""
72451
+ "`X` is a vector or a matrix."
72453
72452
  ]
72454
72453
  }
72455
72454
  ]
@@ -72461,7 +72460,7 @@
72461
72460
  {
72462
72461
  "type": "text",
72463
72462
  "value": [
72464
- "If X is a vector, return X(n)\\X(n-1) by scanning X. The first element of the result is always NULL. ",
72463
+ "If X is a vector, return X(n)\\\\X(n-1) by scanning X. The first element of the result is always NULL. ",
72465
72464
  "",
72466
72465
  "If X is a matrix, conduct the aforementioned calculation within each column of X. The result is a matrix with the same shape as X. "
72467
72466
  ]
@@ -72518,15 +72517,23 @@
72518
72517
  {
72519
72518
  "type": "text",
72520
72519
  "value": [
72521
- "================== ============",
72522
- "#0 #1",
72523
- "================== ============",
72524
- "1.05 1.06",
72525
- "1.038095238095238 0.981132075471698",
72526
- "1.027522935779817 0.956730769230769",
72527
- "0.964285714285714 1.035175879396985",
72528
- "1.074074074074074 1.019417475728155",
72529
- "================== ============",
72520
+ "+-------------------------+-------------------------+",
72521
+ "| #0 | #1 |",
72522
+ "+=========================+=========================+",
72523
+ "| | |",
72524
+ "+-------------------------+-------------------------+",
72525
+ "| 1.05 | 1.06 |",
72526
+ "+-------------------------+-------------------------+",
72527
+ "| 1.038095238095238 | 0.981132075471698 |",
72528
+ "+-------------------------+-------------------------+",
72529
+ "| 1.027522935779817 | 0.956730769230769 |",
72530
+ "+-------------------------+-------------------------+",
72531
+ "| 0.964285714285714 | 1.035175879396985 |",
72532
+ "+-------------------------+-------------------------+",
72533
+ "| 1.074074074074074 | 1.019417475728155 |",
72534
+ "+-------------------------+-------------------------+",
72535
+ "",
72536
+ "",
72530
72537
  "",
72531
72538
  " "
72532
72539
  ]
package/docs.zh.json CHANGED
@@ -30312,9 +30312,15 @@
30312
30312
  "",
30313
30313
  "`compress` 是一个布尔值。它是可选参数,表示是否以压缩模式模式保存至磁盘。默认值为 true。",
30314
30314
  "",
30315
- "`cacheSize` 是长整型数据类型(long)的整数。它是一个可选参数,表示流数据表在内存中最多保留多少行。默认值为-1。如果它为0或者没有指定(默认值为-1),所有记录行都会保存在内存中。如果 *cacheSize* 是小于100,000的正整数,它会被自动调整为100,000。",
30315
+ "`cacheSize` 是长整型数据类型(long)的整数。它是一个可选参数,表示流数据表在内存中最多保留多少行。默认值为-1。如果它为0或者没有指定(默认值为-1),所有记录行都会保存在内存中。请注意:",
30316
30316
  "",
30317
- "`retentionMinutes` 是一个整数,表示 log 文件的保留时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。",
30317
+ " * 如果 *cacheSize* 设置为小于1000的正整数,它会被自动调整为1000。",
30318
+ " * 如果 *cacheSize* 大于1000:",
30319
+ "",
30320
+ " * 每次 append 的数据都不超过 *cacheSize* 时,内存中的数据量不会大于 *cacheSize* 的1.5倍。",
30321
+ " * 出现 append 的数据超过 *cacheSize* 时,内存中的数据量不会超过最大追加行数的2倍。",
30322
+ "",
30323
+ "`retentionMinutes` 是一个整数,表示保留大小超过 1GB 的 log 文件的时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。",
30318
30324
  "",
30319
30325
  "`flushMode` 是一个整数,表示是否开启同步刷盘,取值只能为0或1。默认值是0,表示异步刷盘,内存中的流数据写入操作系统缓存即为写入成功,并进行下一批数据的写入。 若为1,则表示同步刷盘,当前批次的流数据必须落盘完成,才会进行下一批数据的写入。"
30320
30326
  ]
@@ -30434,7 +30440,7 @@
30434
30440
  "value": [
30435
30441
  "`table` 是一个空的流数据表。",
30436
30442
  "",
30437
- "`tableName` 是一个字符串,表示 table d共享后的名称。",
30443
+ "`tableName` 是一个字符串,表示 table 共享后的名称。",
30438
30444
  "",
30439
30445
  "`asynWrite` 是一个布尔值,表示是否异步持久化数据到磁盘。默认值为 true,流数据写入内存即为写入成功,持久化到磁盘的操作将会由另一个线程执行。",
30440
30446
  "",
@@ -30442,9 +30448,15 @@
30442
30448
  "",
30443
30449
  "`compress` 是一个布尔值。它是可选参数,表示是否以压缩模式模式保存至磁盘。默认值为 true。",
30444
30450
  "",
30445
- "`cacheSize` 是长整型数据类型(long)的整数。它是一个可选参数,表示流数据表在内存中最多保留多少行。如果它为0或者没有指定,所有记录行都会保存在内存中。默认值为-1。如果 *cacheSize* 是小于100,000的正整数,它会被自动调整为100,000.",
30451
+ "`cacheSize` 是长整型数据类型(long)的整数。它是一个可选参数,表示流数据表在内存中最多保留多少行。如果它为0或者没有指定,所有记录行都会保存在内存中。默认值为-1。请注意:",
30452
+ " ",
30453
+ " * 如果 *cacheSize* 设置为小于1000的正整数,它会被自动调整为1000。",
30454
+ " * 如果 *cacheSize* 大于1000:",
30455
+ "",
30456
+ " * 每次 append 的数据都不超过 *cacheSize* 时,内存中的数据量不会大于 *cacheSize* 的1.5倍。",
30457
+ " * 出现 append 的数据超过 *cacheSize* 时,内存中的数据量不会超过最大追加行数的2倍。",
30446
30458
  "",
30447
- "`retentionMinutes` 是一个整数,表示 log 文件的保留时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。",
30459
+ "`retentionMinutes` 是一个整数,表示保留大小超过 1GB 的 log 文件的时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。",
30448
30460
  "",
30449
30461
  "`flushMode` 是一个整数,表示是否开启同步刷盘,取值只能为0或1。默认值是0,表示异步刷盘,内存中的流数据写入操作系统缓存即为写入成功,并进行下一批数据的写入。 若为1,则表示同步刷盘,当前批次的流数据必须落盘完成,才会进行下一批数据的写入。",
30450
30462
  "",
@@ -36237,7 +36249,7 @@
36237
36249
  "value": [
36238
36250
  "+---------------+---------------------------------------------+---------------+-----------+-----------------+---------------------+-----------------+---------------------------+-------------+",
36239
36251
  "| userName type | startTime | dbName | tableName | totalPartitions | completedPartitions | percentComplete | endTime | completed |",
36240
- "+===============+=============================================+===============+===========+=================+=====================+=================+=========================================+",
36252
+ "+===============+=============================================+===============+===========+=================+=====================+=================+===========================+=============+",
36241
36253
  "| u1 | BACKUP_BY_COPY_FILE 2022.09.21T17:18:04.264 | dfs://valuedb | pt | 1 | 1 | 100 | 2022.09.21T17:18:04.269 | 1 |",
36242
36254
  "+---------------+---------------------------------------------+---------------+-----------+-----------------+---------------------+-----------------+---------------------------+-------------+",
36243
36255
  "| u1 | BACKUP 2022.09.21T17:13:04.344 | dfs://valuedb | pt | 4 | 4 | 100 | 2022.09.21T17:13:04.413 | 1 |",
@@ -36625,7 +36637,9 @@
36625
36637
  "2.00.9 版本起,",
36626
36638
  "",
36627
36639
  "* 该函数由管理员或拥有 DB_MANAGE 权限的用户执行时,返回集群中所有的分布式表;",
36628
- "* 否则,仅返回该用户有访问权限的分布式表。其中,访问权限包含 DB_OWNER, TABLE_READ, TABLE_WRITE, TABLE_INSERT, TABLE_UPDATE, TABLE_DELETE, DB_READ, DB_WRITE, DB_INSERT, DB_UPDATE, DB_DELETE。 "
36640
+ "* 否则,仅返回该用户有访问权限的分布式表。其中,访问权限包含 DB_OWNER, TABLE_READ, TABLE_WRITE, TABLE_INSERT, TABLE_UPDATE, TABLE_DELETE, DB_READ, DB_WRITE, DB_INSERT, DB_UPDATE, DB_DELETE。 ",
36641
+ "",
36642
+ "2.00.10.2 版本起,该函数由拥有 DBOBJ_CREATE 权限的用户执行时,还会返回其创建的分布式表。"
36629
36643
  ]
36630
36644
  }
36631
36645
  ]
@@ -43806,7 +43820,7 @@
43806
43820
  "",
43807
43821
  "`keyColumn` 是一个字符串标量或向量,表示主键。它是一个可选参数。",
43808
43822
  "",
43809
- "`retentionMinutes` 是一个整数,表示log文件的保留时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。"
43823
+ "`retentionMinutes` 是一个整数,表示保留大小超过 1GB 的 log 文件的时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。"
43810
43824
  ]
43811
43825
  }
43812
43826
  ]
@@ -52880,7 +52894,7 @@
52880
52894
  {
52881
52895
  "type": "text",
52882
52896
  "value": [
52883
- "`fileName` 可选参数。需要指定的license文件的路径。",
52897
+ "`fileName` 可选参数。需要指定的 license 文件的路径。",
52884
52898
  "",
52885
52899
  "`pubKeyFile` 可选参数。需要指定的公钥文件的路径。"
52886
52900
  ]
@@ -52894,7 +52908,7 @@
52894
52908
  {
52895
52909
  "type": "text",
52896
52910
  "value": [
52897
- "显示 DolphinDB 的许可证信息。",
52911
+ "显示 DolphinDB 的许可证信息。若不指定 fileName,则默认读取保存在内存中的 license 信息。",
52898
52912
  "",
52899
52913
  "返回值说明:",
52900
52914
  "",
@@ -80908,7 +80922,10 @@
80908
80922
  {
80909
80923
  "type": "text",
80910
80924
  "value": [
80911
- "rmdir(directory, [recursive=false])"
80925
+ ".. versionadded:: 2.00.10.2",
80926
+ " 参数 *keepRootDir*",
80927
+ "",
80928
+ "rmdir(directory, [recursive=false], [keepRootDir=false])"
80912
80929
  ]
80913
80930
  }
80914
80931
  ]
@@ -80922,7 +80939,11 @@
80922
80939
  "value": [
80923
80940
  "`directory` 是要删除的文件夹名称。",
80924
80941
  "",
80925
- "如果该目录不为空,则通过设定 `recursive` 的值为true可以删除所有子目录和文件。"
80942
+ "`recursive` 布尔值,可选参数,设置是否删除所有指定文件夹所有子目录及其中文件如果该目录不为空,默认值为 false。",
80943
+ "",
80944
+ "`keepRootDir` 布尔值,用于指定是否保留根目录。默认值为 false。当设置为 true 时,仅删除子目录和文件,而不会删除根目录。",
80945
+ "",
80946
+ "注意:若设置 *keepRootDir* = true,则必须设置 *recursive* = true。"
80926
80947
  ]
80927
80948
  }
80928
80949
  ]
@@ -80934,7 +80955,7 @@
80934
80955
  {
80935
80956
  "type": "text",
80936
80957
  "value": [
80937
- "删除目录。默认情况下,要删除的目录必须为空。如果目录不为空仍然要删除它时,请设置 *recursive* 的值为true。",
80958
+ "删除目录。默认情况下,要删除的目录必须为空。如果目录不为空仍然要删除它时,请设置 *recursive* 的值为 true。",
80938
80959
  "",
80939
80960
  "该命令必须要用户登录后才能执行。"
80940
80961
  ]
@@ -100738,7 +100759,7 @@
100738
100759
  "========== ===== =========",
100739
100760
  "t x tmfirst_t",
100740
100761
  "========== ===== =========",
100741
- "2021.01.02 3 ",
100762
+ "2021.01.02 3 3 ",
100742
100763
  "2021.01.02 4 3 ",
100743
100764
  "2021.01.04 3 ",
100744
100765
  "2021.01.05 -1 ",
@@ -100763,7 +100784,7 @@
100763
100784
  "========== ===== =========",
100764
100785
  "t x tmfirst_t",
100765
100786
  "========== ===== =========",
100766
- "2021.01.02 3 ",
100787
+ "2021.01.02 3 3 ",
100767
100788
  "2021.01.02 4 3 ",
100768
100789
  "2021.01.04 3 ",
100769
100790
  "2021.01.05 -1 3 ",
package/index.d.ts CHANGED
@@ -158,6 +158,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
158
158
  static to_ddbobj(value: DdbObj | string | boolean): DdbObj;
159
159
  /** 转换 js 数组为 DdbObj[] */
160
160
  static to_ddbobjs(values: (DdbObj | string | boolean)[]): DdbObj<DdbValue>[];
161
+ /** 将 table 转换为 rows,空值转换为 null */
161
162
  to_rows<T extends Record<string, any> = Record<string, any>>(): T[];
162
163
  /** 将 dict<string, any> 自动转换为 js object (Record<string, any>) Automatically convert dict<string, any> to js object (Record<string, any>)
163
164
  - options?:
package/index.js CHANGED
@@ -1023,6 +1023,7 @@ export class DdbObj {
1023
1023
  // av
1024
1024
  const type_ = this.type - 64;
1025
1025
  const limit = 10;
1026
+ const nullstr = inspect(null, options);
1026
1027
  let array_items = new Array(Math.min(limit, this.rows));
1027
1028
  let i_items = 0;
1028
1029
  for (const { lengths, data } of this.value) {
@@ -1035,14 +1036,14 @@ export class DdbObj {
1035
1036
  case DdbType.decimal64:
1036
1037
  case DdbType.decimal128:
1037
1038
  const x = data[acc_len + i];
1038
- if (is_decimal_null_value(type_, x)) {
1039
- items[i] = '';
1040
- break;
1039
+ if (is_decimal_null_value(type_, x))
1040
+ items[i] = nullstr;
1041
+ else {
1042
+ const { scale } = this.value;
1043
+ const s = String(x < 0 ? -x : x).padStart(scale, '0');
1044
+ const str = (x < 0 ? '-' : '') + (scale ? `${s.slice(0, -scale) || '0'}.${s.slice(-scale)}` : s);
1045
+ items[i] = options.colors ? str.green : str;
1041
1046
  }
1042
- const { scale } = this.value;
1043
- const s = String(x < 0 ? -x : x).padStart(scale, '0');
1044
- const str = (x < 0 ? '-' : '') + (scale ? `${s.slice(0, -scale) || '0'}.${s.slice(-scale)}` : s);
1045
- items[i] = options.colors ? str.green : str;
1046
1047
  break;
1047
1048
  case DdbType.complex:
1048
1049
  case DdbType.point: {
@@ -1176,6 +1177,7 @@ export class DdbObj {
1176
1177
  static to_ddbobjs(values) {
1177
1178
  return values.map(value => this.to_ddbobj(value));
1178
1179
  }
1180
+ /** 将 table 转换为 rows,空值转换为 null */
1179
1181
  to_rows() {
1180
1182
  assert(this.form === DdbForm.table, t('form 必须是 DdbForm.table, 否则不能 to_rows'));
1181
1183
  let rows = new Array(this.rows);
@@ -1192,6 +1194,42 @@ export class DdbObj {
1192
1194
  Boolean(value);
1193
1195
  break;
1194
1196
  }
1197
+ case DdbType.char:
1198
+ row[name] = values[i] === nulls.int8 ? null : values[i];
1199
+ break;
1200
+ case DdbType.short:
1201
+ row[name] = values[i] === nulls.int16 ? null : values[i];
1202
+ break;
1203
+ case DdbType.int:
1204
+ case DdbType.date:
1205
+ case DdbType.month:
1206
+ case DdbType.time:
1207
+ case DdbType.minute:
1208
+ case DdbType.second:
1209
+ case DdbType.datetime:
1210
+ case DdbType.datehour:
1211
+ row[name] = values[i] === nulls.int32 ? null : values[i];
1212
+ break;
1213
+ case DdbType.long:
1214
+ case DdbType.timestamp:
1215
+ case DdbType.nanotime:
1216
+ case DdbType.nanotimestamp:
1217
+ row[name] = values[i] === nulls.int64 ? null : values[i];
1218
+ break;
1219
+ case DdbType.int128:
1220
+ row[name] = values[i] === nulls.int128 ? null : values[i];
1221
+ break;
1222
+ case DdbType.float:
1223
+ row[name] = values[i] === nulls.float32 ? null : values[i];
1224
+ break;
1225
+ case DdbType.double:
1226
+ row[name] = values[i] === nulls.double ? null : values[i];
1227
+ break;
1228
+ case DdbType.decimal32:
1229
+ case DdbType.decimal64:
1230
+ case DdbType.decimal128:
1231
+ row[name] = is_decimal_null_value(type, values[i]) ? null : values[i];
1232
+ break;
1195
1233
  case DdbType.ipaddr:
1196
1234
  row[name] = values.subarray(16 * i, 16 * (i + 1));
1197
1235
  break;
@@ -1452,6 +1490,7 @@ export function formati(obj, index, options = {}) {
1452
1490
  // av
1453
1491
  const type_ = obj.type - 64;
1454
1492
  let offset = 0;
1493
+ const nullstr = inspect(null, options);
1455
1494
  for (const { lengths, data, rows } of obj.value) {
1456
1495
  let acc_len = 0;
1457
1496
  if (offset + rows <= index) {
@@ -1472,14 +1511,14 @@ export function formati(obj, index, options = {}) {
1472
1511
  case DdbType.decimal64:
1473
1512
  case DdbType.decimal128:
1474
1513
  const x = data[acc_len + i];
1475
- if (is_decimal_null_value(type_, x)) {
1476
- items[i] = '';
1477
- break;
1514
+ if (is_decimal_null_value(type_, x))
1515
+ items[i] = nullstr;
1516
+ else {
1517
+ const { scale } = obj.value;
1518
+ const s = String(x < 0 ? -x : x).padStart(scale, '0');
1519
+ const str = (x < 0 ? '-' : '') + (scale ? `${s.slice(0, -scale) || '0'}.${s.slice(-scale)}` : s);
1520
+ items[i] = options.colors ? str.green : str;
1478
1521
  }
1479
- const { scale } = obj.value;
1480
- const s = String(x < 0 ? -x : x).padStart(scale, '0');
1481
- const str = (x < 0 ? '-' : '') + (scale ? `${s.slice(0, -scale) || '0'}.${s.slice(-scale)}` : s);
1482
- items[i] = options.colors ? str.green : str;
1483
1522
  break;
1484
1523
  case DdbType.complex:
1485
1524
  case DdbType.point: {