dolphindb 2.0.902 → 2.0.903
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 +442 -6
- package/docs.zh.json +49 -36
- package/package.json +3 -3
package/docs.en.json
CHANGED
|
@@ -10792,6 +10792,246 @@
|
|
|
10792
10792
|
}
|
|
10793
10793
|
]
|
|
10794
10794
|
},
|
|
10795
|
+
"conditionalIterate": {
|
|
10796
|
+
"title": "conditionalIterate",
|
|
10797
|
+
"type": "function",
|
|
10798
|
+
"children": [
|
|
10799
|
+
{
|
|
10800
|
+
"title": "Syntax",
|
|
10801
|
+
"type": "grammer",
|
|
10802
|
+
"children": [
|
|
10803
|
+
{
|
|
10804
|
+
"type": "text",
|
|
10805
|
+
"value": [
|
|
10806
|
+
"conditionalIterate(cond, trueValue, falseIterFunc)",
|
|
10807
|
+
"",
|
|
10808
|
+
"This function can only be used as a state function in the reactive state engine."
|
|
10809
|
+
]
|
|
10810
|
+
}
|
|
10811
|
+
]
|
|
10812
|
+
},
|
|
10813
|
+
{
|
|
10814
|
+
"title": "Arguments",
|
|
10815
|
+
"type": "parameters",
|
|
10816
|
+
"children": [
|
|
10817
|
+
{
|
|
10818
|
+
"type": "text",
|
|
10819
|
+
"value": [
|
|
10820
|
+
"`cond` is a conditional expression or a function with BOOLEAN return values. It must contain fields from the input table. Constants/constant expressions are not supported.",
|
|
10821
|
+
"",
|
|
10822
|
+
"`trueValue` is the calculation formula. ",
|
|
10823
|
+
"",
|
|
10824
|
+
"`falseIterFunc` is the function for iteration, whose only parameter is the column from the output table. Currently, only the following functions are supported (use partial application to specify functions with multiple parameters):",
|
|
10825
|
+
"",
|
|
10826
|
+
"* Moving functions: tmove, tmavg, tmmax, tmmin, tmsum, mavg, mmax, mmin, mcount, msum",
|
|
10827
|
+
"* Cumulative window functions: cumlastNot, cumfirstNot",
|
|
10828
|
+
"* Order-sensitive functions: ffill, move",
|
|
10829
|
+
"",
|
|
10830
|
+
"If *cond* returns true, the calculation of *trueValue* is triggered. If cond returns false, *falseIterFunc* is called for iteration."
|
|
10831
|
+
]
|
|
10832
|
+
}
|
|
10833
|
+
]
|
|
10834
|
+
},
|
|
10835
|
+
{
|
|
10836
|
+
"title": "Note:",
|
|
10837
|
+
"children": [
|
|
10838
|
+
{
|
|
10839
|
+
"type": "text",
|
|
10840
|
+
"value": [
|
|
10841
|
+
"* As the iterations are performed based on the historical data, the output for the current record is calculated based on the historical results in the output table and X.",
|
|
10842
|
+
"* When calculating with time-based moving windows, windows are determined by the current timestamp T, i.e., (T - window, T).",
|
|
10843
|
+
"* The data type of the result column is determined by the result of trueValue. Therefore, the data type of the result of trueValue and falseIterFunc must be compatible.",
|
|
10844
|
+
" Data type compatibility rules:",
|
|
10845
|
+
" - INT, SHORT, LONG and CHAR are compatible",
|
|
10846
|
+
" - FLOAT and DOUBLE are compatible",
|
|
10847
|
+
" - STRING and SYMBOL are compatible"
|
|
10848
|
+
]
|
|
10849
|
+
}
|
|
10850
|
+
]
|
|
10851
|
+
},
|
|
10852
|
+
{
|
|
10853
|
+
"title": "Details",
|
|
10854
|
+
"type": "detail",
|
|
10855
|
+
"children": [
|
|
10856
|
+
{
|
|
10857
|
+
"type": "text",
|
|
10858
|
+
"value": [
|
|
10859
|
+
"Supposing the iteration is based only on the previous result, for the k-th (k ∈ N+) record, the calculation logic is (where the column “factor” holds the results):",
|
|
10860
|
+
"",
|
|
10861
|
+
"* cond[k] == true:factor[k] = trueValue",
|
|
10862
|
+
"* cond[k] == false:factor[k] = falseIterFunc(factor)[k-1]",
|
|
10863
|
+
"",
|
|
10864
|
+
"Note: If *falseIterFunc* is a window function, the iteration is based on multiple previous results."
|
|
10865
|
+
]
|
|
10866
|
+
}
|
|
10867
|
+
]
|
|
10868
|
+
},
|
|
10869
|
+
{
|
|
10870
|
+
"title": "Examples",
|
|
10871
|
+
"type": "example",
|
|
10872
|
+
"children": [
|
|
10873
|
+
{
|
|
10874
|
+
"type": "text",
|
|
10875
|
+
"value": [
|
|
10876
|
+
"Example 1: Understand the calculation logic of ``conditionalIterate`` with the following example.",
|
|
10877
|
+
""
|
|
10878
|
+
]
|
|
10879
|
+
},
|
|
10880
|
+
{
|
|
10881
|
+
"type": "code",
|
|
10882
|
+
"language": "console",
|
|
10883
|
+
"value": [
|
|
10884
|
+
"",
|
|
10885
|
+
" $ trade = table(take(\"A\", 10) as sym, take(1 3 6, 10) as val0, take(10, 10) as val1)",
|
|
10886
|
+
" $ trade",
|
|
10887
|
+
""
|
|
10888
|
+
]
|
|
10889
|
+
},
|
|
10890
|
+
{
|
|
10891
|
+
"type": "text",
|
|
10892
|
+
"value": [
|
|
10893
|
+
"+-----+------+------+",
|
|
10894
|
+
"| sym | val0 | val1 |",
|
|
10895
|
+
"+=====+======+======+",
|
|
10896
|
+
"| A | 1 | 10 |",
|
|
10897
|
+
"+-----+------+------+",
|
|
10898
|
+
"| A | 3 | 10 |",
|
|
10899
|
+
"+-----+------+------+",
|
|
10900
|
+
"| A | 6 | 10 |",
|
|
10901
|
+
"+-----+------+------+",
|
|
10902
|
+
"| A | 1 | 10 |",
|
|
10903
|
+
"+-----+------+------+",
|
|
10904
|
+
"| A | 3 | 10 |",
|
|
10905
|
+
"+-----+------+------+",
|
|
10906
|
+
"| A | 6 | 10 |",
|
|
10907
|
+
"+-----+------+------+",
|
|
10908
|
+
"| A | 1 | 10 |",
|
|
10909
|
+
"+-----+------+------+",
|
|
10910
|
+
"| A | 3 | 10 |",
|
|
10911
|
+
"+-----+------+------+",
|
|
10912
|
+
"| A | 6 | 10 |",
|
|
10913
|
+
"+-----+------+------+",
|
|
10914
|
+
"| A | 1 | 10 |",
|
|
10915
|
+
"+-----+------+------+",
|
|
10916
|
+
"",
|
|
10917
|
+
"Define a reactive state stream engine and group the data by “sym“ for calculation.",
|
|
10918
|
+
"",
|
|
10919
|
+
"* If val0 > 5 returns true, the formula is `factor[k]=trueValue`. Output the value of val1. ",
|
|
10920
|
+
"* If val0 > 5 returns false, the corresponding formula is `factor[k]=falseIterFunc(factor)[k-1]`. When k=3, then the corresponding val0=1, val1=10, factor=[NULL, NULL, 10], the result is msum([NULL, NULL, 10], 3)[2]=10. Similarly, when k=4, the corresponding val0=3, val1=10, factor=[NULL, NULL, 10, 10], the result is msum([NULL, NULL, 10, 10], 3)[3]=20.",
|
|
10921
|
+
""
|
|
10922
|
+
]
|
|
10923
|
+
},
|
|
10924
|
+
{
|
|
10925
|
+
"type": "code",
|
|
10926
|
+
"language": "console",
|
|
10927
|
+
"value": [
|
|
10928
|
+
"",
|
|
10929
|
+
" $ inputTable = streamTable(1:0, `sym`val0`val1, [SYMBOL, INT, INT]) ",
|
|
10930
|
+
" $ outputTable = table(100:0, `sym`factor, [STRING, DOUBLE])",
|
|
10931
|
+
" $ rse = createReactiveStateEngine(name=\"rsTest\", metrics=<conditionalIterate(val0 > 5, val1, msum{, 3})>, dummyTable=inputTable, outputTable=outputTable, keyColumn=\"sym\")",
|
|
10932
|
+
" $ rse.append!(trade)",
|
|
10933
|
+
" $ select * from outputTable",
|
|
10934
|
+
""
|
|
10935
|
+
]
|
|
10936
|
+
},
|
|
10937
|
+
{
|
|
10938
|
+
"type": "text",
|
|
10939
|
+
"value": [
|
|
10940
|
+
"+-----+--------+",
|
|
10941
|
+
"| sym | factor |",
|
|
10942
|
+
"+=====+========+",
|
|
10943
|
+
"| A | |",
|
|
10944
|
+
"+-----+--------+",
|
|
10945
|
+
"| A | |",
|
|
10946
|
+
"+-----+--------+",
|
|
10947
|
+
"| A | 10 |",
|
|
10948
|
+
"+-----+--------+",
|
|
10949
|
+
"| A | 10 |",
|
|
10950
|
+
"+-----+--------+",
|
|
10951
|
+
"| A | 20 |",
|
|
10952
|
+
"+-----+--------+",
|
|
10953
|
+
"| A | 10 |",
|
|
10954
|
+
"+-----+--------+",
|
|
10955
|
+
"| A | 40 |",
|
|
10956
|
+
"+-----+--------+",
|
|
10957
|
+
"| A | 70 |",
|
|
10958
|
+
"+-----+--------+",
|
|
10959
|
+
"| A | 10 |",
|
|
10960
|
+
"+-----+--------+",
|
|
10961
|
+
"| A | 120 |",
|
|
10962
|
+
"+-----+--------+",
|
|
10963
|
+
"",
|
|
10964
|
+
"Example 2: The calculation logic of “factor”:",
|
|
10965
|
+
""
|
|
10966
|
+
]
|
|
10967
|
+
},
|
|
10968
|
+
{
|
|
10969
|
+
"type": "code",
|
|
10970
|
+
"language": "console",
|
|
10971
|
+
"value": [
|
|
10972
|
+
"",
|
|
10973
|
+
" $ def factor(TotalVolumeTrade, TotalValueTrade, HighPx, LowPx){",
|
|
10974
|
+
" $ factorValue = iif(TotalVolumeTrade < 1500000, pow(HighPx*LowPx, 0.5)-(TotalVolumeTrade/TotalValueTrade), mavg(factor(TotalVolumeTrade, TotalValueTrade, HighPx, LowPx), 3))",
|
|
10975
|
+
" $ return factorValue",
|
|
10976
|
+
" $ }",
|
|
10977
|
+
""
|
|
10978
|
+
]
|
|
10979
|
+
},
|
|
10980
|
+
{
|
|
10981
|
+
"type": "text",
|
|
10982
|
+
"value": [
|
|
10983
|
+
"The calculation of factor involves recursion. You can use function ``conditionalIterate`` to implement the factor in a reactive state engine with the following script:",
|
|
10984
|
+
""
|
|
10985
|
+
]
|
|
10986
|
+
},
|
|
10987
|
+
{
|
|
10988
|
+
"type": "code",
|
|
10989
|
+
"language": "console",
|
|
10990
|
+
"value": [
|
|
10991
|
+
"",
|
|
10992
|
+
" @state",
|
|
10993
|
+
" $ def factor1(TotalVolumeTrade, TotalValueTrade, HighPx, LowPx){",
|
|
10994
|
+
" $ factorValue = conditionalIterate(TotalVolumeTrade < 1500000, (pow(HighPx*LowPx, 0.5)-(TotalVolumeTrade/TotalValueTrade)), mavg{,3})",
|
|
10995
|
+
" $ return factorValue",
|
|
10996
|
+
" $ }",
|
|
10997
|
+
"",
|
|
10998
|
+
" $ SecurityID = [\"000001.SZ\",\"000001.SZ\",\"000001.SZ\",\"000001.SZ\",\"000001.SZ\",\"000001.SZ\",\"000001.SZ\",\"000001.SZ\",\"000001.SZ\",\"000001.SZ\"]$SYMBOL",
|
|
10999
|
+
" $ Date = [2022.04.01,2022.04.01,2022.04.01,2022.04.01,2022.04.01,2022.04.01,2022.04.01,2022.04.01,2022.04.01,2022.04.01]",
|
|
11000
|
+
" $ Time = [09:30:00.000,09:30:03.000,09:30:06.000,09:30:09.000,09:30:12.000,09:30:15.000,09:30:18.000,09:30:21.000,09:30:24.000,09:30:27.000]",
|
|
11001
|
+
" $ TotalVolumeTrade = [844800,1035700,1240100,1304500,1457800,1522400,1550900,1663800,1692100,1767100]",
|
|
11002
|
+
" $ TotalValueTrade = [12982101,15908020,19038479,20022525,22363886,23349799,23784950,25506625.75,25937850.75,27080561.75]",
|
|
11003
|
+
" $ HighPx = [15.37,15.37,15.37,15.37,15.37,15.37,15.37,15.37,15.37,15.37]",
|
|
11004
|
+
" $ LowPx = [15.3,15.3,15.29,15.28,15.24,15.24,15.24,15.22,15.22,15.22]",
|
|
11005
|
+
" $ trade = table(SecurityID, Date, Time, TotalVolumeTrade, TotalValueTrade, HighPx, LowPx)",
|
|
11006
|
+
"",
|
|
11007
|
+
" $ result = table(1:0, `SecurityID`Date`Time`Factor, `SYMBOL`DATE`TIME`DOUBLE)",
|
|
11008
|
+
"",
|
|
11009
|
+
" $ factor=[<Date>,<Time>, <factor1(TotalVolumeTrade, TotalValueTrade, HighPx, LowPx)>]",
|
|
11010
|
+
" $ rse = createReactiveStateEngine(name=\"rsTest\", metrics=factor, dummyTable=trade, outputTable=result, keyColumn=\"SecurityID\")",
|
|
11011
|
+
" $ rse.append!(trade)",
|
|
11012
|
+
"",
|
|
11013
|
+
" $ trade1 = select *, (pow(HighPx*LowPx, 0.5)-(TotalVolumeTrade/TotalValueTrade)) as Factor0 from trade",
|
|
11014
|
+
" $ select * from lj(trade1, result, `SecurityID`Date`Time)",
|
|
11015
|
+
" $ dropStreamEngine(\"rsTest\")",
|
|
11016
|
+
""
|
|
11017
|
+
]
|
|
11018
|
+
},
|
|
11019
|
+
{
|
|
11020
|
+
"type": "text",
|
|
11021
|
+
"value": [
|
|
11022
|
+
"The following is part of the result:",
|
|
11023
|
+
"",
|
|
11024
|
+
".. image:: /images/conditionalIterate_output.png",
|
|
11025
|
+
"",
|
|
11026
|
+
"For records in blue box, data in column Factor is the results of *trueValue*, which are the same as the output in Factor0. For records in red box, data in column Factor is the results of *falseIterFunc*, and each of them is the average of the previous three results.",
|
|
11027
|
+
"",
|
|
11028
|
+
"Related functions: :doc:`../s/stateIterate`"
|
|
11029
|
+
]
|
|
11030
|
+
}
|
|
11031
|
+
]
|
|
11032
|
+
}
|
|
11033
|
+
]
|
|
11034
|
+
},
|
|
10795
11035
|
"contextCount": {
|
|
10796
11036
|
"title": "contextCount",
|
|
10797
11037
|
"type": "function",
|
|
@@ -14519,7 +14759,7 @@
|
|
|
14519
14759
|
"",
|
|
14520
14760
|
".. 为了便于观察和对比计算结果,系统会对第一个数据窗口的起始时间进行规整,根据step参数、数据的时间精度,以及roundTime参数来确定整数类型的规整尺度alignmentSize。当时间序列引擎使用分组计算时,所有分组的窗口均进行统一的规整。相同时刻的数据窗口在各组均有相同的边界。",
|
|
14521
14761
|
"",
|
|
14522
|
-
"The system will do alignment for the starting time of first window. The
|
|
14762
|
+
"The system will do alignment for the starting time of first window. The alignmentSize(integer) will be decided by the step, precision and roundTime. When time series engine calculates in groups, all groups' window will be uniformly aligned. The windows at the same time have the same boundary. ",
|
|
14523
14763
|
"",
|
|
14524
14764
|
"* If the data type of `timeColumn` is DATETIME(yyyy-MM-dd HH:mm:ss) or SECOND(HH:mm:ss), the value of `alignmentSize` is as follows:",
|
|
14525
14765
|
"",
|
|
@@ -15160,7 +15400,9 @@
|
|
|
15160
15400
|
"",
|
|
15161
15401
|
"`garbageSize` is an optional integer greater than 0. The default value is 5,000 (in units of bytes). As the subscribed data is ingested into the streaming engine, it occupies an increasing amount of memory. When the number of rows in memory exceeds *garbageSize*, the system will clear the data that is not needed for the current calculation.",
|
|
15162
15402
|
"",
|
|
15163
|
-
"`maxDelayedTime` is an optional integer greater than 0. Use this parameter to specify the waiting time before triggering a calculation for the grouped data in the engine that has not been output for a long time. The default value is 3 (in units of seconds). To specify *maxDelayedTime*, *useSystemTime* must be specifed as false."
|
|
15403
|
+
"`maxDelayedTime` is an optional integer greater than 0. Use this parameter to specify the waiting time before triggering a calculation for the grouped data in the engine that has not been output for a long time. The default value is 3 (in units of seconds). To specify *maxDelayedTime*, *useSystemTime* must be specifed as false.",
|
|
15404
|
+
"",
|
|
15405
|
+
"`nullFill` is a tuple of the same size as the number of output columns. It is used to fill in the NULL values in the output table. The data type of each element corresponds to each output column."
|
|
15164
15406
|
]
|
|
15165
15407
|
}
|
|
15166
15408
|
]
|
|
@@ -21972,7 +22214,9 @@
|
|
|
21972
22214
|
{
|
|
21973
22215
|
"type": "text",
|
|
21974
22216
|
"value": [
|
|
21975
|
-
"Delete one or multiple columns from a table.
|
|
22217
|
+
"Delete one or multiple columns from a table. ",
|
|
22218
|
+
"",
|
|
22219
|
+
"Note that deleting a partitioning column from a DFS table, or deleting a column of SYMBOL type is not supported."
|
|
21976
22220
|
]
|
|
21977
22221
|
}
|
|
21978
22222
|
]
|
|
@@ -41153,7 +41397,7 @@
|
|
|
41153
41397
|
{
|
|
41154
41398
|
"type": "text",
|
|
41155
41399
|
"value": [
|
|
41156
|
-
"`X`
|
|
41400
|
+
"`X` can be of any data form."
|
|
41157
41401
|
]
|
|
41158
41402
|
}
|
|
41159
41403
|
]
|
|
@@ -49522,7 +49766,15 @@
|
|
|
49522
49766
|
"",
|
|
49523
49767
|
"* If *Y* is a scalar, compare it with each element in *X*, replace the element in *X* with the larger value.",
|
|
49524
49768
|
"",
|
|
49525
|
-
"* If *Y* and *X* are of the same type and length, compare the corresponding elements of them and return a vector containing each larger value."
|
|
49769
|
+
"* If *Y* and *X* are of the same type and length, compare the corresponding elements of them and return a vector containing each larger value.",
|
|
49770
|
+
"",
|
|
49771
|
+
"Note: Before version 1.30.20/2.00.8, the function ``max`` compares the values of temporal types by converting them into LONG values; ",
|
|
49772
|
+
"",
|
|
49773
|
+
"Since version 1.30.20/2.00.8, DolphinDB has changed the handling of temporal types:",
|
|
49774
|
+
"",
|
|
49775
|
+
"- If *X* and *Y* are temporal scalars with different levels of time granularity, the coarser-grained value is converted to the finer granularity for comparison.",
|
|
49776
|
+
"",
|
|
49777
|
+
"- If *X* and/or *Y* is a vector, matrix, or table, the compared elements must be of the same temporal type."
|
|
49526
49778
|
]
|
|
49527
49779
|
}
|
|
49528
49780
|
]
|
|
@@ -52277,7 +52529,15 @@
|
|
|
52277
52529
|
"",
|
|
52278
52530
|
"* If *Y* is a scalar, compare it with each element in *X*, replace the element in *X* with the smaller value.",
|
|
52279
52531
|
"",
|
|
52280
|
-
"* If *Y* and *X* are of the same type and length, compare the corresponding elements of them and return a vector containing each smaller value."
|
|
52532
|
+
"* If *Y* and *X* are of the same type and length, compare the corresponding elements of them and return a vector containing each smaller value.",
|
|
52533
|
+
"",
|
|
52534
|
+
"Note: Before version 1.30.20/2.00.8, the function ``min`` compares the values of temporal types by converting them into LONG values; ",
|
|
52535
|
+
"",
|
|
52536
|
+
"Since version 1.30.20/2.00.8, DolphinDB has changed the handling of temporal types:",
|
|
52537
|
+
"",
|
|
52538
|
+
"- If *X* and *Y* are temporal scalars with different levels of time granularity, the coarser-grained value is converted to the finer granularity for comparison.",
|
|
52539
|
+
"",
|
|
52540
|
+
"- If *X* and/or *Y* is a vector, matrix, or table, the compared elements must be of the same temporal type."
|
|
52281
52541
|
]
|
|
52282
52542
|
}
|
|
52283
52543
|
]
|
|
@@ -80498,6 +80758,182 @@
|
|
|
80498
80758
|
}
|
|
80499
80759
|
]
|
|
80500
80760
|
},
|
|
80761
|
+
"stateIterate": {
|
|
80762
|
+
"title": "stateIterate",
|
|
80763
|
+
"type": "function",
|
|
80764
|
+
"children": [
|
|
80765
|
+
{
|
|
80766
|
+
"title": "Syntax",
|
|
80767
|
+
"type": "grammer",
|
|
80768
|
+
"children": [
|
|
80769
|
+
{
|
|
80770
|
+
"type": "text",
|
|
80771
|
+
"value": [
|
|
80772
|
+
"stateIterate(X, initial, initialWindow, iterateFunc, combineCoeff)",
|
|
80773
|
+
"",
|
|
80774
|
+
"This function can only be used as a state function in the reactive state engine."
|
|
80775
|
+
]
|
|
80776
|
+
}
|
|
80777
|
+
]
|
|
80778
|
+
},
|
|
80779
|
+
{
|
|
80780
|
+
"title": "Arguments",
|
|
80781
|
+
"type": "parameters",
|
|
80782
|
+
"children": [
|
|
80783
|
+
{
|
|
80784
|
+
"type": "text",
|
|
80785
|
+
"value": [
|
|
80786
|
+
"`X` is a vector. It can be a column from the engine's input table, or the result of a vectorized function with the column as its input argument. ",
|
|
80787
|
+
"",
|
|
80788
|
+
"`initial` is a vector used to fill the first initialWindow values in the corresponding result column of the engine's output table. It can be a column from the engine's input table, or the result of a vectorized function with the column as its input argument. ",
|
|
80789
|
+
"",
|
|
80790
|
+
"`initialWindow` a positive integer determining the initial window size [0, initialWindow).",
|
|
80791
|
+
"",
|
|
80792
|
+
"`iterateFunc` is the function for iteration, whose only parameter is the column from the output table. Currently, only the following functions are supported (use partial application to specify functions with multiple parameters):",
|
|
80793
|
+
"",
|
|
80794
|
+
"- Moving functions: tmove, tmavg, tmmax, tmmin, tmsum, mavg, mmax, mmin, mcount, msum",
|
|
80795
|
+
"- Cumulative window functions: cumlastNot, cumfirstNot",
|
|
80796
|
+
"- Order-sensitive functions: ffill, move"
|
|
80797
|
+
]
|
|
80798
|
+
}
|
|
80799
|
+
]
|
|
80800
|
+
},
|
|
80801
|
+
{
|
|
80802
|
+
"title": "Note",
|
|
80803
|
+
"children": [
|
|
80804
|
+
{
|
|
80805
|
+
"type": "text",
|
|
80806
|
+
"value": [
|
|
80807
|
+
"- As the iterations are performed based on the historical data, the output for the current record is calculated based on the historical results in the output table and X.",
|
|
80808
|
+
"- When calculating with time-based moving windows, windows are determined by the current timestamp T, and the interval is (T - window, T).",
|
|
80809
|
+
"",
|
|
80810
|
+
"`combineCoeff` A vector of length 2. The elements indicate the correlation coefficients between the result of *interateFunc* and *X*."
|
|
80811
|
+
]
|
|
80812
|
+
}
|
|
80813
|
+
]
|
|
80814
|
+
},
|
|
80815
|
+
{
|
|
80816
|
+
"title": "Details",
|
|
80817
|
+
"type": "detail",
|
|
80818
|
+
"children": [
|
|
80819
|
+
{
|
|
80820
|
+
"type": "text",
|
|
80821
|
+
"value": [
|
|
80822
|
+
"Supposing the iteration is based only on the previous result, for the k-th (k ∈ N+) record, the calculation logic is (where the column “factor” holds the results):",
|
|
80823
|
+
"",
|
|
80824
|
+
"- k < initialWindow: factor[k] = initial[k]",
|
|
80825
|
+
"- k >= initialWindow:factor[k] = combineCoeff[0] * X[k] + combineCoeff[1] * iterateFunc(factor)[k-1]",
|
|
80826
|
+
"",
|
|
80827
|
+
"Note: If *iterateFunc* is a window function, the iteration is based on multiple previous results."
|
|
80828
|
+
]
|
|
80829
|
+
}
|
|
80830
|
+
]
|
|
80831
|
+
},
|
|
80832
|
+
{
|
|
80833
|
+
"title": "Examples",
|
|
80834
|
+
"type": "example",
|
|
80835
|
+
"children": [
|
|
80836
|
+
{
|
|
80837
|
+
"type": "code",
|
|
80838
|
+
"language": "console",
|
|
80839
|
+
"value": [
|
|
80840
|
+
"",
|
|
80841
|
+
" $ trade = table(take(\"A\", 6) join take(\"B\", 6) as sym, 1..12 as val0, take(10, 12) as val1)",
|
|
80842
|
+
" $ trade;",
|
|
80843
|
+
""
|
|
80844
|
+
]
|
|
80845
|
+
},
|
|
80846
|
+
{
|
|
80847
|
+
"type": "text",
|
|
80848
|
+
"value": [
|
|
80849
|
+
"+-----+------+------+",
|
|
80850
|
+
"| sym | val0 | val1 |",
|
|
80851
|
+
"+=====+======+======+",
|
|
80852
|
+
"| A | 1 | 10 |",
|
|
80853
|
+
"+-----+------+------+",
|
|
80854
|
+
"| A | 2 | 10 |",
|
|
80855
|
+
"+-----+------+------+",
|
|
80856
|
+
"| A | 3 | 10 |",
|
|
80857
|
+
"+-----+------+------+",
|
|
80858
|
+
"| A | 4 | 10 |",
|
|
80859
|
+
"+-----+------+------+",
|
|
80860
|
+
"| A | 5 | 10 |",
|
|
80861
|
+
"+-----+------+------+",
|
|
80862
|
+
"| A | 6 | 10 |",
|
|
80863
|
+
"+-----+------+------+",
|
|
80864
|
+
"| B | 7 | 10 |",
|
|
80865
|
+
"+-----+------+------+",
|
|
80866
|
+
"| B | 8 | 10 |",
|
|
80867
|
+
"+-----+------+------+",
|
|
80868
|
+
"| B | 9 | 10 |",
|
|
80869
|
+
"+-----+------+------+",
|
|
80870
|
+
"| B | 10 | 10 |",
|
|
80871
|
+
"+-----+------+------+",
|
|
80872
|
+
"| B | 11 | 10 |",
|
|
80873
|
+
"+-----+------+------+",
|
|
80874
|
+
"| B | 12 | 10 |",
|
|
80875
|
+
"+-----+------+------+",
|
|
80876
|
+
"",
|
|
80877
|
+
"The following example defines a reactive state streaming engine and conducts the calculation within each group of sym.",
|
|
80878
|
+
"",
|
|
80879
|
+
"- For the 1st initialWindow records, the formula is `factor[k]=initial[k]`. So the factor[0], factor[1], factor[2] records take the value of val1.",
|
|
80880
|
+
"- For the subsequent records, the formula is `factor[k]=0.5*val0[k]+0.5*msum(factor, 3)[k-1]`. ",
|
|
80881
|
+
"",
|
|
80882
|
+
"For the 4th record (sym=`A, val0=4) in the output table, there are 3 historical values in the factor column ([10,10,10]). Therefore, for the current record, the output is `0.5*4+0.5*msum([10, 10, 10], 3)[2]=17`. Similarly, for the record (sym=`A, val0=5), the output is `0.5*5+0.5*msum([10, 10, 10, 17], 3)[3]=21`.",
|
|
80883
|
+
""
|
|
80884
|
+
]
|
|
80885
|
+
},
|
|
80886
|
+
{
|
|
80887
|
+
"type": "code",
|
|
80888
|
+
"language": "console",
|
|
80889
|
+
"value": [
|
|
80890
|
+
"",
|
|
80891
|
+
" $ inputTable = streamTable(1:0, `sym`val0`val1, [SYMBOL, INT, INT]) ",
|
|
80892
|
+
" $ outputTable = table(100:0, `sym`factor, [STRING, DOUBLE])",
|
|
80893
|
+
" $ engine = createReactiveStateEngine(name=\"rsTest\", metrics=<[stateIterate(val0, val1, 3, msum{, 3}, [0.5, 0.5])]>, dummyTable=inputTable, outputTable=outputTable, keyColumn=[\"sym\"], keepOrder=true)",
|
|
80894
|
+
"",
|
|
80895
|
+
" $ engine.append!(trade)",
|
|
80896
|
+
" $ select * from outputTable",
|
|
80897
|
+
""
|
|
80898
|
+
]
|
|
80899
|
+
},
|
|
80900
|
+
{
|
|
80901
|
+
"type": "text",
|
|
80902
|
+
"value": [
|
|
80903
|
+
"+-----+--------+",
|
|
80904
|
+
"| sym | factor |",
|
|
80905
|
+
"+=====+========+",
|
|
80906
|
+
"| A | 10 |",
|
|
80907
|
+
"+-----+--------+",
|
|
80908
|
+
"| A | 10 |",
|
|
80909
|
+
"+-----+--------+",
|
|
80910
|
+
"| A | 10 |",
|
|
80911
|
+
"+-----+--------+",
|
|
80912
|
+
"| A | 17 |",
|
|
80913
|
+
"+-----+--------+",
|
|
80914
|
+
"| A | 21 |",
|
|
80915
|
+
"+-----+--------+",
|
|
80916
|
+
"| A | 27 |",
|
|
80917
|
+
"+-----+--------+",
|
|
80918
|
+
"| B | 10 |",
|
|
80919
|
+
"+-----+--------+",
|
|
80920
|
+
"| B | 10 |",
|
|
80921
|
+
"+-----+--------+",
|
|
80922
|
+
"| B | 10 |",
|
|
80923
|
+
"+-----+--------+",
|
|
80924
|
+
"| B | 20 |",
|
|
80925
|
+
"+-----+--------+",
|
|
80926
|
+
"| B | 25.5 |",
|
|
80927
|
+
"+-----+--------+",
|
|
80928
|
+
"| B | 33.75 |",
|
|
80929
|
+
"+-----+--------+",
|
|
80930
|
+
""
|
|
80931
|
+
]
|
|
80932
|
+
}
|
|
80933
|
+
]
|
|
80934
|
+
}
|
|
80935
|
+
]
|
|
80936
|
+
},
|
|
80501
80937
|
"std": {
|
|
80502
80938
|
"title": "std",
|
|
80503
80939
|
"type": "function",
|
package/docs.zh.json
CHANGED
|
@@ -11113,7 +11113,7 @@
|
|
|
11113
11113
|
{
|
|
11114
11114
|
"type": "text",
|
|
11115
11115
|
"value": [
|
|
11116
|
-
"`cond`
|
|
11116
|
+
"`cond` 布尔表达式/返回值是布尔类型的函数。需要包含输入表中的字段,不支持常量/常量表达式。",
|
|
11117
11117
|
"",
|
|
11118
11118
|
"`trueValue` 计算公式。计算结果将作为 *cond* 为 true 时的输出值。",
|
|
11119
11119
|
"",
|
|
@@ -14282,7 +14282,7 @@
|
|
|
14282
14282
|
"",
|
|
14283
14283
|
".. _updateRightTableLSJ:",
|
|
14284
14284
|
"",
|
|
14285
|
-
"`updateRightTable` 可选参数,布尔值,默认为 false,表示右表存在多条相同 matchingColumn 的记录时,是保留第一条(true
|
|
14285
|
+
"`updateRightTable` 可选参数,布尔值,默认为 false,表示右表存在多条相同 matchingColumn 的记录时,是保留第一条(false)还是最后一条记录(true)。"
|
|
14286
14286
|
]
|
|
14287
14287
|
}
|
|
14288
14288
|
]
|
|
@@ -15057,7 +15057,7 @@
|
|
|
15057
15057
|
"",
|
|
15058
15058
|
".. _keyPurgeFilter_rs:",
|
|
15059
15059
|
"",
|
|
15060
|
-
"`keyPurgeFilter`
|
|
15060
|
+
"`keyPurgeFilter` 可选参数,是一个由布尔表达式组成的元代码,表示清理条件。各表达式只能引用 *outputTable* 中的字段。",
|
|
15061
15061
|
"",
|
|
15062
15062
|
".. _keyPurgeFreqInSecond_rs:",
|
|
15063
15063
|
"",
|
|
@@ -23260,7 +23260,7 @@
|
|
|
23260
23260
|
{
|
|
23261
23261
|
"type": "text",
|
|
23262
23262
|
"value": [
|
|
23263
|
-
"
|
|
23263
|
+
"从表中删除指定的列。请注意,对于分布式表,不支持分区列和 SYMBOL 类型列的删除。"
|
|
23264
23264
|
]
|
|
23265
23265
|
}
|
|
23266
23266
|
]
|
|
@@ -25279,15 +25279,17 @@
|
|
|
25279
25279
|
"value": [
|
|
25280
25280
|
"`table` 是一个空的流数据表。",
|
|
25281
25281
|
"",
|
|
25282
|
-
"`asynWrite`
|
|
25282
|
+
"`asynWrite` 是一个布尔值,表示是否异步持久化数据到磁盘。默认值为 true,流数据写入内存即为写入成功,持久化到磁盘的操作将会由另一个线程执行。",
|
|
25283
25283
|
"",
|
|
25284
|
-
"
|
|
25284
|
+
"注意:持久化数据到磁盘包含两个步骤:(1)写内存数据到操作系统缓存;(2)写缓存数据到磁盘(是否开启同步刷盘由参数 flushMode 决定)。",
|
|
25285
25285
|
"",
|
|
25286
|
-
"`
|
|
25286
|
+
"`compress` 是一个布尔值。它是可选参数,表示是否以压缩模式模式保存至磁盘。默认值为 true。",
|
|
25287
25287
|
"",
|
|
25288
|
-
"`
|
|
25288
|
+
"`cacheSize` 是长整型数据类型(long)的整数。它是一个可选参数,表示流数据表在内存中最多保留多少行。默认值为-1。如果它为0或者没有指定(默认值为-1),所有记录行都会保存在内存中。如果 *cacheSize* 是小于100,000的正整数,它会被自动调整为100,000。",
|
|
25289
25289
|
"",
|
|
25290
|
-
"`
|
|
25290
|
+
"`retentionMinutes` 是一个整数,表示 log 文件的保留时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。",
|
|
25291
|
+
"",
|
|
25292
|
+
"`flushMode` 是一个整数,表示是否开启同步刷盘,取值只能为0或1。默认值是0,表示异步刷盘,内存中的流数据写入操作系统缓存即为写入成功,并进行下一批数据的写入。 若为1,则表示同步刷盘,当前批次的流数据必须落盘完成,才会进行下一批数据的写入。"
|
|
25291
25293
|
]
|
|
25292
25294
|
}
|
|
25293
25295
|
]
|
|
@@ -25299,18 +25301,18 @@
|
|
|
25299
25301
|
{
|
|
25300
25302
|
"type": "text",
|
|
25301
25303
|
"value": [
|
|
25302
|
-
"
|
|
25304
|
+
"该命令把共享的流计算表保存到磁盘上。",
|
|
25303
25305
|
"",
|
|
25304
|
-
"为了保证该命令能够正常执行,我们需要指定配置参数 *persistenceDir* 。流数据表在磁盘上的存储目录是<PERSISTENCE_DIR>/<TABLE_NAME>。目录包含两种类型的文件:数据文件(名称类型 *data0.log, data1.log...* )和索引文件 *index.log*
|
|
25306
|
+
"为了保证该命令能够正常执行,我们需要指定配置参数 *persistenceDir* 。流数据表在磁盘上的存储目录是<PERSISTENCE_DIR>/<TABLE_NAME>。目录包含两种类型的文件:数据文件(名称类型 *data0.log, data1.log...* )和索引文件 *index.log* 。把这些数据保存到磁盘后,如果重启系统,该命令会把磁盘中的数据加载到内存中。",
|
|
25305
25307
|
"",
|
|
25306
|
-
"参数 *
|
|
25308
|
+
"参数 *asynWrite* 会告知系统是否以异步模式保存表。在异步模式中,追加的数据会被放进队列,之后用于保存的工作线程把数据写入磁盘。在同步模式中,表的追加数据操作直到追加数据被保存到磁盘中才完成。该参数的默认值是 true,即为异步模式。通常情况下,异步模式实现更高的吞吐量,但是如果服务器崩溃,可能会丢失最后追加的行。在异步模式中,保存表的工作是由单个工作线程完成,并且一个工作线程可能处理多个表。如果只保存一个表,增加工作线程的数量并不会提升性能。",
|
|
25307
25309
|
"",
|
|
25308
|
-
"
|
|
25310
|
+
"默认情况下,流数据表把所有数据保存在内存中。如果流数据表太大,系统可能会出现内存不足的情况。为了避免内存不足的问题,可以配置 *cacheSize* 参数,以设置内存中最多保留的记录数。如果流数据表的行数达到 *cacheSize* 设置的阈值,则系统会自动清理当前内存中 50% 的旧记录行。",
|
|
25309
25311
|
"",
|
|
25310
25312
|
"注:",
|
|
25311
25313
|
"",
|
|
25312
|
-
"* 如果手动重启server
|
|
25313
|
-
"* 如果设置flushMode=0,则server发生crash时可能会丢失一部分数据。"
|
|
25314
|
+
"* 如果手动重启 server,建议调用 :doc:`/FunctionsandCommands/CommandsReferences/f/fflush` 函数先把缓存区的数据写入磁盘再 kill 进程。",
|
|
25315
|
+
"* 如果设置 flushMode=0,则 server 发生 crash 时可能会丢失一部分数据。"
|
|
25314
25316
|
]
|
|
25315
25317
|
}
|
|
25316
25318
|
]
|
|
@@ -25405,19 +25407,21 @@
|
|
|
25405
25407
|
"value": [
|
|
25406
25408
|
"`table` 是一个空的流数据表。",
|
|
25407
25409
|
"",
|
|
25408
|
-
"`tableName` 是一个字符串,表示table共享后的名称。",
|
|
25410
|
+
"`tableName` 是一个字符串,表示 table d共享后的名称。",
|
|
25411
|
+
"",
|
|
25412
|
+
"`asynWrite` 是一个布尔值,表示是否异步持久化数据到磁盘。默认值为 true,流数据写入内存即为写入成功,持久化到磁盘的操作将会由另一个线程执行。",
|
|
25409
25413
|
"",
|
|
25410
|
-
"
|
|
25414
|
+
"注意:持久化数据到磁盘包含两个步骤:(1)写内存数据到操作系统缓存;(2)写缓存数据到磁盘(是否开启同步刷盘由参数 flushMode 决定)。",
|
|
25411
25415
|
"",
|
|
25412
|
-
"`compress`
|
|
25416
|
+
"`compress` 是一个布尔值。它是可选参数,表示是否以压缩模式模式保存至磁盘。默认值为 true。",
|
|
25413
25417
|
"",
|
|
25414
|
-
"`cacheSize`
|
|
25418
|
+
"`cacheSize` 是长整型数据类型(long)的整数。它是一个可选参数,表示流数据表在内存中最多保留多少行。如果它为0或者没有指定,所有记录行都会保存在内存中。默认值为-1。如果 *cacheSize* 是小于100,000的正整数,它会被自动调整为100,000.",
|
|
25415
25419
|
"",
|
|
25416
|
-
"`retentionMinutes` 是一个整数,表示log文件的保留时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。",
|
|
25420
|
+
"`retentionMinutes` 是一个整数,表示 log 文件的保留时间(从文件的最后修改时间开始计算),单位是分钟。默认值是1440,即一天。",
|
|
25417
25421
|
"",
|
|
25418
|
-
"`flushMode`
|
|
25422
|
+
"`flushMode` 是一个整数,表示是否开启同步刷盘,取值只能为0或1。默认值是0,表示异步刷盘,内存中的流数据写入操作系统缓存即为写入成功,并进行下一批数据的写入。 若为1,则表示同步刷盘,当前批次的流数据必须落盘完成,才会进行下一批数据的写入。",
|
|
25419
25423
|
"",
|
|
25420
|
-
"`preCache`
|
|
25424
|
+
"`preCache` 是一个整数,表示从磁盘加载到内存的记录条数。如果没有指定该参数,默认会把所有记录加载到内存中。"
|
|
25421
25425
|
]
|
|
25422
25426
|
}
|
|
25423
25427
|
]
|
|
@@ -25429,18 +25433,18 @@
|
|
|
25429
25433
|
{
|
|
25430
25434
|
"type": "text",
|
|
25431
25435
|
"value": [
|
|
25432
|
-
"
|
|
25436
|
+
"该命令把流数据表共享,并把它持久化到磁盘上。",
|
|
25433
25437
|
"",
|
|
25434
|
-
"为了保证该命令能够正常执行,需要指定配置参数 *persistenceDir*。流数据表在磁盘上的存储目录是<PERSISTENCE_DIR>/<TABLE_NAME>。目录包含两种类型的文件:数据文件(名称类型 *data0.log, data1.log...* )和索引文件 *index.log
|
|
25438
|
+
"为了保证该命令能够正常执行,需要指定配置参数 *persistenceDir*。流数据表在磁盘上的存储目录是<PERSISTENCE_DIR>/<TABLE_NAME>。目录包含两种类型的文件:数据文件(名称类型 *data0.log, data1.log...* )和索引文件 *index.log*。把这些数据保存到磁盘后,如果重启系统,再次执行该命令会把磁盘中的数据加载到内存中,加载的记录条数由参数 *preCache* 指定,但是实际加载的记录条数有可能会超过 *preCache*。",
|
|
25435
25439
|
"",
|
|
25436
|
-
"参数 *
|
|
25440
|
+
"参数 *asynWrite* 会告知系统是否以异步模式保存表。在异步模式中,追加的数据会被放进队列,之后用于保存的工作线程把数据写入磁盘。在同步模式中,表的追加数据操作直到追加数据被保存到磁盘中才完成。该参数的默认值是 true,即为异步模式。通常情况下,异步模式实现更高的吞吐量,但是如果服务器崩溃,可能会丢失最后追加的行。在异步模式中,保存表的工作是由单个工作线程完成,并且一个工作线程可能处理多个表。如果只保存一个表,增加工作线程的数量并不会提升性能。",
|
|
25437
25441
|
"",
|
|
25438
|
-
"
|
|
25442
|
+
"默认情况下,流数据表把所有数据保存在内存中。如果流数据表太大,系统可能会出现内存不足的情况。为了避免内存不足的问题,可以配置 *cacheSize* 参数,以设置内存中最多保留的记录数。如果流数据表的行数达到 *cacheSize* 设置的阈值,则系统会自动清理当前内存中 50% 的旧记录行。",
|
|
25439
25443
|
"",
|
|
25440
25444
|
"注:",
|
|
25441
25445
|
"",
|
|
25442
|
-
"* 如果手动重启server
|
|
25443
|
-
"* 如果设置flushMode=0,则server发生crash时可能会丢失一部分数据。"
|
|
25446
|
+
"* 如果手动重启 server,建议调用 :doc:`/FunctionsandCommands/CommandsReferences/f/fflush` 函数先把缓存区的数据写入磁盘再 kill 进程。",
|
|
25447
|
+
"* 如果设置 flushMode=0,则 server 发生 crash 时可能会丢失一部分数据。"
|
|
25444
25448
|
]
|
|
25445
25449
|
}
|
|
25446
25450
|
]
|
|
@@ -38497,7 +38501,7 @@
|
|
|
38497
38501
|
"value": [
|
|
38498
38502
|
"`cond` 是布尔标量、向量或矩阵。可为产生布尔标量、向量或矩阵的表达式。",
|
|
38499
38503
|
"",
|
|
38500
|
-
"`trueResult` 和 `falseResult` 可以是标量、与 *cond*
|
|
38504
|
+
"`trueResult` 和 `falseResult` 可以是标量、与 *cond* 等长的向量或与 *cond* 维度相同的矩阵。",
|
|
38501
38505
|
""
|
|
38502
38506
|
]
|
|
38503
38507
|
}
|
|
@@ -38603,7 +38607,7 @@
|
|
|
38603
38607
|
"5 14",
|
|
38604
38608
|
"== ==",
|
|
38605
38609
|
"",
|
|
38606
|
-
"当配置了nullAsMinValueForComparison=true时,在比较运算中,NULL元素取相应数据类型的最小值。使用 :doc:`/Functionalprogramming/TemplateFunctions/nullCompare` 可以保持iif
|
|
38610
|
+
"当配置了nullAsMinValueForComparison=true时,在比较运算中,NULL元素取相应数据类型的最小值。使用 :doc:`/Functionalprogramming/TemplateFunctions/nullCompare` 可以保持 iif 条件语句里的 NULL 值。",
|
|
38607
38611
|
""
|
|
38608
38612
|
]
|
|
38609
38613
|
},
|
|
@@ -43394,7 +43398,7 @@
|
|
|
43394
43398
|
{
|
|
43395
43399
|
"type": "text",
|
|
43396
43400
|
"value": [
|
|
43397
|
-
"`X`
|
|
43401
|
+
"`X` 可以是系统支持的任意数据形式。"
|
|
43398
43402
|
]
|
|
43399
43403
|
}
|
|
43400
43404
|
]
|
|
@@ -43428,7 +43432,10 @@
|
|
|
43428
43432
|
"",
|
|
43429
43433
|
" // 和 isNull 相比",
|
|
43430
43434
|
" $ isNull(1 NULL 2);",
|
|
43431
|
-
" [0,1,0]"
|
|
43435
|
+
" [0,1,0]",
|
|
43436
|
+
"",
|
|
43437
|
+
" $ isVoid(matrix(NULL 2 NULL, NULL 2 1))",
|
|
43438
|
+
" 0"
|
|
43432
43439
|
]
|
|
43433
43440
|
}
|
|
43434
43441
|
]
|
|
@@ -51375,7 +51382,7 @@
|
|
|
51375
51382
|
"value": [
|
|
51376
51383
|
"`X` 是一个标量、向量或矩阵。",
|
|
51377
51384
|
"",
|
|
51378
|
-
"`Y`
|
|
51385
|
+
"`Y` 是一个布尔表达式。"
|
|
51379
51386
|
]
|
|
51380
51387
|
}
|
|
51381
51388
|
]
|
|
@@ -69709,7 +69716,7 @@
|
|
|
69709
69716
|
"* 当 *X* 是向量时,*Y* 是表示标签的字符串。",
|
|
69710
69717
|
"* 当 *X* 是矩阵时,如果 *Z* 没有指定,则 *Y* 是列标签;如果 *Z* 指定了,*Y* 是行标签,而 *Z* 是列标签。列标签和行标签的长度分别需要等于 *X* 的列数和行数。*Y* 和 *Z* 可以是任意数据类型。",
|
|
69711
69718
|
"* 当 *X* 是非共享内存表时,*Y* 和 *Z* 是字符串标量或向量。如果 *Z* 没有指定,则 *Y* 从左到右是新的列名,用户应该确保新的列名的数量小于或等于表中列的总数;如果 *Z* 指定了,则 *Y* 是旧的列名,*Z* 是对应的新的列名。",
|
|
69712
|
-
"* 当 *X*
|
|
69719
|
+
"* 当 *X* 分布式表时,必须指定 *Y* 和 *Z* 且只能是字符串标量。其中 *Y* 表示指定的旧列名,*Z* 是对应的新列名。分布式表不支持批量修改列名。"
|
|
69713
69720
|
]
|
|
69714
69721
|
}
|
|
69715
69722
|
]
|
|
@@ -70673,7 +70680,11 @@
|
|
|
70673
70680
|
"========== ============== ============== ============ ==========",
|
|
70674
70681
|
"month DATE 6 ",
|
|
70675
70682
|
"x INT 4 ",
|
|
70676
|
-
"========== ============== ============== ============ ========== "
|
|
70683
|
+
"========== ============== ============== ============ ========== ",
|
|
70684
|
+
"",
|
|
70685
|
+
"",
|
|
70686
|
+
".. meta::",
|
|
70687
|
+
" :keywords: replace, column, col"
|
|
70677
70688
|
]
|
|
70678
70689
|
}
|
|
70679
70690
|
]
|
|
@@ -79732,6 +79743,8 @@
|
|
|
79732
79743
|
"value": [
|
|
79733
79744
|
"设置数据保留策略以及 :doc:`/DatabaseandDistributedComputing/Database/TieredStorage` 策略。若用户只通过该函数配置分级存储策略,建议将参数 *retentionHours* 指定为一个尽可能大的值。",
|
|
79734
79745
|
"",
|
|
79746
|
+
"分级存储和数据保留策略都以分区为单位进行,因此 retentionHours 和 hoursToColdVolume 配置的时间必须是分区精度的倍数,如按天分区,则需要为 24 的整数倍。",
|
|
79747
|
+
"",
|
|
79735
79748
|
"数据库会根据当前系统的机器时间,保留数据时间戳为最近 *retentionHours* 小时的数据。其中最新 *hoursToColdVolume* 小时的数据将继续存储在 volumes 中。在 [当前时间 - hoursToColdVolume - 10天,当前时间 - hoursToColdVolume) 范围内的数据将被迁移到 *coldVolumes*。若 *coldVolumes* 配置了多个路径,则数据将随机分布在各个存储路径下 。",
|
|
79736
79749
|
"",
|
|
79737
79750
|
"对于保留时间外的数据,只会删除 [当前时间 - retentionHours - 10 天, 当前时间 - retentionHours) 范围的数据。若需要删除之前的数据,可以调用 :doc:`../d/dropPartition` 函数实现。",
|
|
@@ -83536,7 +83549,7 @@
|
|
|
83536
83549
|
"",
|
|
83537
83550
|
"定义一个响应式状态引擎,并按 sym 列分组进行计算。组内的计算逻辑如下:",
|
|
83538
83551
|
"",
|
|
83539
|
-
"* 前
|
|
83552
|
+
"* 前 initialWindow 行记录,计算公式为 `factor[k]=initial[k]`,因此 factor[0], factor[1], factor[2] 均将 val1 列的值直接作为 factor 列的输出。",
|
|
83540
83553
|
"* 之后的记录,对应计算公式为 `factor[k]=0.5*val0[k]+0.5*msum(factor, 3)[k-1]`。以计算 sym=`A,val0=4 这条记录为例,此时 factor 列仅有前 3 条数据的输出,即 factor=[10, 10, 10],k=3,带入计算公式即 `0.5*4+0.5*msum([10, 10, 10], 3)[2]=17`。同理 sym=`A,val0=5 这条记录带入计算公式即 `0.5*5+0.5*msum([10, 10, 10, 17], 3)[3]=21`,以此类推。",
|
|
83541
83554
|
""
|
|
83542
83555
|
]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dolphindb",
|
|
3
3
|
"description": "DolphinDB JavaScript API",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.903",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"browser": "./browser.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"JavaScript"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/node": "^18.11.
|
|
35
|
+
"@types/node": "^18.11.11",
|
|
36
36
|
"typescript": "^4.9.3"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"ipaddr.js": "^2.0.1",
|
|
41
41
|
"tslib": "^2.4.1",
|
|
42
42
|
"ws": "^8.11.0",
|
|
43
|
-
"xshell": "^0.0.
|
|
43
|
+
"xshell": "^0.0.68"
|
|
44
44
|
}
|
|
45
45
|
}
|