dolphindb 2.0.959 → 2.0.960
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/browser.js +2 -0
- package/browser.js.map +1 -1
- package/docs.en.json +524 -827
- package/docs.zh.json +77 -114
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
package/docs.en.json
CHANGED
|
@@ -3059,8 +3059,8 @@
|
|
|
3059
3059
|
}
|
|
3060
3060
|
]
|
|
3061
3061
|
},
|
|
3062
|
-
"
|
|
3063
|
-
"title": "
|
|
3062
|
+
"asFreq": {
|
|
3063
|
+
"title": "asFreq",
|
|
3064
3064
|
"type": "function",
|
|
3065
3065
|
"children": [
|
|
3066
3066
|
{
|
|
@@ -3118,9 +3118,9 @@
|
|
|
3118
3118
|
"\"N\" nanosecond",
|
|
3119
3119
|
"=========================== =================================",
|
|
3120
3120
|
"",
|
|
3121
|
-
"The strings above can also be used with integers for parameter \"rule\". For example, \"2M\" means
|
|
3121
|
+
"The strings above can also be used with integers for parameter \"rule\". For example, \"2M\" means the end of every two months. In addition, *rule* can also be set as the identifier of the trading calendar, e.g., the Market Identifier Code of an exchange, or a user-defined calendar name.",
|
|
3122
3122
|
"",
|
|
3123
|
-
"rule can also be a vector of temporal type. ",
|
|
3123
|
+
"*rule* can also be a vector of temporal type. ",
|
|
3124
3124
|
"",
|
|
3125
3125
|
"`closed` is a string indicating which boundary of the interval is closed.",
|
|
3126
3126
|
"",
|
|
@@ -3397,6 +3397,11 @@
|
|
|
3397
3397
|
}
|
|
3398
3398
|
]
|
|
3399
3399
|
},
|
|
3400
|
+
"asfreq": {
|
|
3401
|
+
"title": "asfreq",
|
|
3402
|
+
"type": "function",
|
|
3403
|
+
"children": []
|
|
3404
|
+
},
|
|
3400
3405
|
"asin": {
|
|
3401
3406
|
"title": "asin",
|
|
3402
3407
|
"type": "function",
|
|
@@ -12814,331 +12819,7 @@
|
|
|
12814
12819
|
"createCrossSectionalEngine": {
|
|
12815
12820
|
"title": "createCrossSectionalEngine",
|
|
12816
12821
|
"type": "function",
|
|
12817
|
-
"children": [
|
|
12818
|
-
{
|
|
12819
|
-
"title": "Syntax",
|
|
12820
|
-
"type": "grammer",
|
|
12821
|
-
"children": [
|
|
12822
|
-
{
|
|
12823
|
-
"type": "text",
|
|
12824
|
-
"value": [
|
|
12825
|
-
"createCrossSectionalEngine(name, [metrics], dummyTable, [outputTable], keyColumn, [triggeringPattern='perBatch'], [triggeringInterval=1000], [useSystemTime=true], [timeColumn], [lastBatchOnly=false], [contextByColumn], [snapshotDir], [snapshotIntervalInMsgCount], [raftGroup=-1])",
|
|
12826
|
-
"",
|
|
12827
|
-
"Alias: createCrossSectionalAggregator"
|
|
12828
|
-
]
|
|
12829
|
-
}
|
|
12830
|
-
]
|
|
12831
|
-
},
|
|
12832
|
-
{
|
|
12833
|
-
"title": "Arguments",
|
|
12834
|
-
"type": "parameters",
|
|
12835
|
-
"children": [
|
|
12836
|
-
{
|
|
12837
|
-
"type": "text",
|
|
12838
|
-
"value": [
|
|
12839
|
-
"`name` is a string indicating the name of the engine. It is the only identifier of an engine. It can have letter, number and \"_\". It must start with a letter.",
|
|
12840
|
-
"",
|
|
12841
|
-
"`metrics` is a piece of metacode or a tuple specifying the formula for calculation. It can use built-in or user-defined aggregate functions or expressions such as <[sum(qty), avg(price)]>, <[avg(price1)-avg(price2)]> or <[std(price1-price2)]>. You can specify functions that return multiple values for metrics, such as <func(price) as \\`col1\\`col2> (it's not necessary to specify the column names). For more information about metacode please refer to :doc:`/Objects/Metaprogramming`. ",
|
|
12842
|
-
"",
|
|
12843
|
-
"`dummyTable` is a TABLE indicating the schema of the subscribed stream table. It doesn't matter whether *dummyTable* contains data or not. ",
|
|
12844
|
-
"",
|
|
12845
|
-
"`outputTable` is a TABLE containing calculation results. It can be an in-memory table or a distributed table. ",
|
|
12846
|
-
"",
|
|
12847
|
-
"* If *contextByColumn* is not specified, the number of columns in the output table should be the number of metrics + 1. The first column is of TIMESTAMP type indicating the starting time of each calculation in system time (If *timeColumn* is specified, the values in *timeColumn* will be used instead). The remaining columns are calculation results - make sure to keep the data types of columns consistent with the results.",
|
|
12848
|
-
"* If *contextByColumn* is specified, the number of columns in the output table should be the number of metrics + 2. The first column is of TIMESTAMP type indicating the starting time of each calculation in system time (If *timeColumn* is specified, the values in *timeColumn* will be used instead). The second column is the column specified by *contextByColumn*. The remaining columns are calculation results - make sure to keep the data types of columns consistent with the results.",
|
|
12849
|
-
"",
|
|
12850
|
-
"`keyColumn` is a string scalar or vector that specifies one or more columns in the stream table as the key columns of the cross-sectional streaming engine. For each unique value in the *keyColumn*, only the lastest row is used in the calculation.",
|
|
12851
|
-
"",
|
|
12852
|
-
"`triggeringPattern` is a STRING indicating how calculation is triggered. Each calculation adds 1 record to the output table. This parameter can take the following values:",
|
|
12853
|
-
"",
|
|
12854
|
-
"* 'perBatch': Default value. Calculation is triggered by each batch of data that is inserted.",
|
|
12855
|
-
"* 'perRow': Calculation is triggered by each row of data that is inserted.",
|
|
12856
|
-
"* 'interval': Calculation is triggered at predetermined intervals (using system time).",
|
|
12857
|
-
"* 'keyCount': If data with the same timestamp arrive in batches, calculation is triggered if either a) the number of keys with the latest timestamp reaches *triggeringInterval*, or b) data that is to be calculated contains 2 different timestamps (i.e., data with newer timestamp arrives before some data with old timestamp is used for calculation). To set *triggeringPattern* to 'keyCount', *timeColumn* must be specified and *useSystemTime* must be set to false.",
|
|
12858
|
-
"",
|
|
12859
|
-
"Note: If *triggeringPattern* is specified as keyCount, out-of-order data will not participate in the calculation. ",
|
|
12860
|
-
"",
|
|
12861
|
-
"`triggeringInterval` is an INTEGER or a tuple. Below explains its available values and triggering rules: ",
|
|
12862
|
-
"",
|
|
12863
|
-
"*If *triggeringPattern*='interval': *triggeringInterval* indicates the duration in milliseconds between 2 adjacent calculations. The default value is 1000.",
|
|
12864
|
-
"*If *triggeringPattern*='keyCount': *triggeringInterval* indicates the threshold of the number of keys in the unused data to trigger a calculation. It can also be a tuple of 2 elements, with the first being an integer indicating the threshold of the number of keys in the unused data to trigger a calculation, and the second being an INTEGER or DURATION value. In this example, the value of *triggeringPattern* is a tuple.",
|
|
12865
|
-
"",
|
|
12866
|
-
" Suppose *triggeringPattern* =(c1, c2):",
|
|
12867
|
-
"",
|
|
12868
|
-
" * When c2 is an integer, if the number of keys with the latest timestamp t1 doesn't reach c1, calculation will not be triggered and the system will go on to save data with newer timestamp t2 (t2>t1). Data with t1 will be calculated when either of the events happens: the number of keys with timestamp t2 reaches c2, or data with newer timestamp t3 (t3>t2) starts to come in. Note that c2 must be smaller than c1.",
|
|
12869
|
-
" * When c2 is a duration, if the number of keys with the latest timestamp t1 doesn't reach c1, calculation will not be triggered and the system will go on to save data with newer timestamp t2 (t2>t1) . Once data with t2 starts to come in, data with t1 will not be calculated until any of the events happens: the number of keys with timestamp t1 reaches c1, or data with newer timestamp t3 (t3>t2) starts to come in, or the duration c2 comes to an end.",
|
|
12870
|
-
"",
|
|
12871
|
-
"`useSystemTime` is a Boolean value indicating whether the first column of outputTable is system time (`useSystemTime`\\=true) or `timeColumn` in the stream table (`useSystemTime`\\=false). ",
|
|
12872
|
-
"",
|
|
12873
|
-
"`timeColumn` is a string. If `useSystemTime`\\=false, timeColumn is the name of the temporal column in the stream table. The column only supports TIMESTAMP type. ",
|
|
12874
|
-
"",
|
|
12875
|
-
"`lastBatchOnly` is an optional BOOLEAN indicating whether to keep the latest data only in the cross-sectional engine. When *lastBatchOnly* = true, *triggeringPattern* must take the value 'keyCount' and the the cross-sectional engine only saves the unique value with the latest timestamp for calculation. When *lastBatchOnly* = false, the engine updates and retains all unique values for calculation.",
|
|
12876
|
-
"",
|
|
12877
|
-
"`contextByColumn` is an optional STRING scalar indicating the grouping column, based on which data will be calculated in groups.",
|
|
12878
|
-
"",
|
|
12879
|
-
"* To specify this parameter, *metrics* and *outputTable* must be specified accordingly.",
|
|
12880
|
-
"* If *metrics* only contains aggregate functions, the calculation results would be the same as using function ``groupby`` to conduct calculation in groups. Otherwise, the results would be the same as using function ``contextby``.",
|
|
12881
|
-
"",
|
|
12882
|
-
"To enable snapshot, *snapshotDir* and *snapshotIntervalInMsgCount* must be specified.",
|
|
12883
|
-
"",
|
|
12884
|
-
"With snapshot enabled, if an exception occurs, the stream engine can be recovered to the latest snapshot.",
|
|
12885
|
-
"",
|
|
12886
|
-
"`snapshotDir` is an optional STRING indicating the directory where the snapshot of the engine is stored.",
|
|
12887
|
-
"",
|
|
12888
|
-
"* Make sure the specified directory actually exists. Otherwise the system reports an error.",
|
|
12889
|
-
"* If *snapshotDir* is specified when creating the engine, the system will check if a snapshot exists in this directory. If it exists, the system will load the snapshot and restore the state of the engine (intermediate calculation results).",
|
|
12890
|
-
"* Multiple engines may share a single directory, using the name of the engine to distinguish the snapshot files.",
|
|
12891
|
-
"* A snapshot file of an engine may take 3 file extensions over different stages:",
|
|
12892
|
-
"",
|
|
12893
|
-
" * <engineName>.*tmp* for temporary stroage of snapshot data",
|
|
12894
|
-
" * <engineName>.*snapshot* for a generated snapshot file synced to disk",
|
|
12895
|
-
" * If a new snapshot file is created, the existing snapshot with the same name will be renamed to <engineName>.*old*",
|
|
12896
|
-
"",
|
|
12897
|
-
"`snapshotIntervalInMsgCount` is an optional INTEGER indicating how many messages are processed before a new snapshot is generated.",
|
|
12898
|
-
"",
|
|
12899
|
-
"`raftGroup` is the ID of the raft group on the high-availability streaming subscriber specified by the configuration parameter *streamingRaftGroups*. It is an integer greater than 1. Specify *raftGroup* to enable high availability on the streaming engine. When a streaming engine is created on the leader, it is also created on each follower. Once a snapshot is generated, it will also be synced to all followers. When a leader is down, the raft group automatically switches to a new leader to resubscribe to the stream table. Note that *SnapShotDir* must also be specified when specifying a raft group."
|
|
12900
|
-
]
|
|
12901
|
-
}
|
|
12902
|
-
]
|
|
12903
|
-
},
|
|
12904
|
-
{
|
|
12905
|
-
"title": "Details",
|
|
12906
|
-
"type": "detail",
|
|
12907
|
-
"children": [
|
|
12908
|
-
{
|
|
12909
|
-
"type": "text",
|
|
12910
|
-
"value": [
|
|
12911
|
-
"Create a cross-sectional engine. Return a keyed table with *keyColumn* values as the keys.",
|
|
12912
|
-
"",
|
|
12913
|
-
"If *metrics* or *outputTable* is not specified, the engine only updates table records but will not calculate or output any data.",
|
|
12914
|
-
"",
|
|
12915
|
-
"If *metrics* and *outputTable* are specified, the engine will update table records, conduct calculation using the latest records, and output results to the *outputTable*. "
|
|
12916
|
-
]
|
|
12917
|
-
}
|
|
12918
|
-
]
|
|
12919
|
-
},
|
|
12920
|
-
{
|
|
12921
|
-
"title": "Examples",
|
|
12922
|
-
"type": "example",
|
|
12923
|
-
"children": [
|
|
12924
|
-
{
|
|
12925
|
-
"type": "text",
|
|
12926
|
-
"value": [
|
|
12927
|
-
"Use function ``createCrossSectionalEngine`` to create a table `csEngine1` that subscribes to the stream table `trades1`.",
|
|
12928
|
-
"",
|
|
12929
|
-
"In this example, `triggeringPattern`\\=\"perRow\". Therefore each row that is inserted into table `csEngine1` triggers a computation. ",
|
|
12930
|
-
""
|
|
12931
|
-
]
|
|
12932
|
-
},
|
|
12933
|
-
{
|
|
12934
|
-
"type": "code",
|
|
12935
|
-
"language": "console",
|
|
12936
|
-
"value": [
|
|
12937
|
-
" ",
|
|
12938
|
-
" $ share streamTable(10:0,`time`sym`price`volume,[TIMESTAMP,SYMBOL,DOUBLE,INT]) as trades1",
|
|
12939
|
-
" $ outputTable = table(1:0, `time`avgPrice`volume`dollarVolume`count, [TIMESTAMP,DOUBLE,INT,DOUBLE,INT])",
|
|
12940
|
-
" $ csEngine1=createCrossSectionalEngine(name=\"csEngineDemo1\", metrics=<[avg(price), sum(volume), sum(price*volume), count(price)]>, dummyTable=trades1, outputTable=outputTable, keyColumn=`sym, triggeringPattern=\"perRow\", useSystemTime=false, timeColumn=`time)",
|
|
12941
|
-
" $ subscribeTable(tableName=\"trades1\", actionName=\"tradesStats\", offset=-1, handler=append!{csEngine1}, msgAsTable=true)",
|
|
12942
|
-
" $ insert into trades1 values(2020.08.12T09:30:00.000 + 123 234 456 678 890 901, `A`B`A`B`B`A, 10 20 10.1 20.1 20.2 10.2, 20 10 20 30 40 20);",
|
|
12943
|
-
"",
|
|
12944
|
-
" $ select * from trades1;",
|
|
12945
|
-
""
|
|
12946
|
-
]
|
|
12947
|
-
},
|
|
12948
|
-
{
|
|
12949
|
-
"type": "text",
|
|
12950
|
-
"value": [
|
|
12951
|
-
"======================== ===== ======= ======",
|
|
12952
|
-
"time sym price volume",
|
|
12953
|
-
"======================== ===== ======= ======",
|
|
12954
|
-
"2020.08.12T09:30:00.123 A 10 20",
|
|
12955
|
-
"2020.08.12T09:30:00.234 B 20 10",
|
|
12956
|
-
"2020.08.12T09:30:00.456 A 10.1 20",
|
|
12957
|
-
"2020.08.12T09:30:00.678 B 20.1 30",
|
|
12958
|
-
"2020.08.12T09:30:00.890 B 20.2 40",
|
|
12959
|
-
"2020.08.12T09:30:00.901 A 10.2 20",
|
|
12960
|
-
"======================== ===== ======= ======",
|
|
12961
|
-
""
|
|
12962
|
-
]
|
|
12963
|
-
},
|
|
12964
|
-
{
|
|
12965
|
-
"type": "code",
|
|
12966
|
-
"language": "console",
|
|
12967
|
-
"value": [
|
|
12968
|
-
" ",
|
|
12969
|
-
" $ select * from outputTable;",
|
|
12970
|
-
""
|
|
12971
|
-
]
|
|
12972
|
-
},
|
|
12973
|
-
{
|
|
12974
|
-
"type": "text",
|
|
12975
|
-
"value": [
|
|
12976
|
-
"======================== ========= ======= ============= ======",
|
|
12977
|
-
"time avgPrice volume dollarVolume count",
|
|
12978
|
-
"======================== ========= ======= ============= ======",
|
|
12979
|
-
"2020.08.12T09:30:00.123 10 20 200 1",
|
|
12980
|
-
"2020.08.12T09:30:00.234 15 30 400 2",
|
|
12981
|
-
"2020.08.12T09:30:00.456 15.05 30 402 2",
|
|
12982
|
-
"2020.08.12T09:30:00.678 15.1 50 805 2",
|
|
12983
|
-
"2020.08.12T09:30:00.890 15.15 60 1010 2",
|
|
12984
|
-
"2020.08.12T09:30:00.901 15.2 60 1012 2",
|
|
12985
|
-
"======================== ========= ======= ============= ======",
|
|
12986
|
-
"",
|
|
12987
|
-
"",
|
|
12988
|
-
"In this example, `triggeringPattern`\\=\"perBatch\". Insert 2 batches of data and the result has 2 rows. ",
|
|
12989
|
-
""
|
|
12990
|
-
]
|
|
12991
|
-
},
|
|
12992
|
-
{
|
|
12993
|
-
"type": "code",
|
|
12994
|
-
"language": "console",
|
|
12995
|
-
"value": [
|
|
12996
|
-
" ",
|
|
12997
|
-
" $ share streamTable(10:0,`time`sym`price`volume,[TIMESTAMP,SYMBOL,DOUBLE,INT]) as trades2",
|
|
12998
|
-
" $ outputTable = table(1:0, `time`avgPrice`volume`dollarVolume`count, [TIMESTAMP,DOUBLE,INT,DOUBLE,INT])",
|
|
12999
|
-
" $ csEngine2=createCrossSectionalEngine(name=\"csEngineDemo2\", metrics=<[avg(price), sum(volume), sum(price*volume), count(price)]>, dummyTable=trades2, outputTable=outputTable, keyColumn=`sym, triggeringPattern=\"perBatch\", useSystemTime=false, timeColumn=`time)",
|
|
13000
|
-
" $ subscribeTable(tableName=\"trades2\", actionName=\"tradesStats\", offset=-1, handler=append!{csEngine2}, msgAsTable=true)",
|
|
13001
|
-
" $ insert into trades2 values(2020.08.12T09:30:00.000 + 123 234 456, `A`B`A, 10 20 10.1, 20 10 20);",
|
|
13002
|
-
" $ sleep(1)",
|
|
13003
|
-
" $ insert into trades2 values(2020.08.12T09:30:00.000 + 678 890 901, `B`B`A, 20.1 20.2 10.2, 30 40 20);",
|
|
13004
|
-
"",
|
|
13005
|
-
" $ select * from outputTable;",
|
|
13006
|
-
""
|
|
13007
|
-
]
|
|
13008
|
-
},
|
|
13009
|
-
{
|
|
13010
|
-
"type": "text",
|
|
13011
|
-
"value": [
|
|
13012
|
-
"======================== ========= ======= ============= ======",
|
|
13013
|
-
"time avgPrice volume dollarVolume count",
|
|
13014
|
-
"======================== ========= ======= ============= ======",
|
|
13015
|
-
"2020.08.12T09:30:00.456 15.05 30 402 2",
|
|
13016
|
-
"2020.08.12T09:30:00.901 15.2 60 1012 2",
|
|
13017
|
-
"======================== ========= ======= ============= ======",
|
|
13018
|
-
"",
|
|
13019
|
-
"In this example, `triggeringPattern` = \"keyCount\" and `lastBatchOnly` = true. Only the data with the latest timestamp will participate in calculation. Because there are both aggregator and non-aggregator functions set in metrics, the number of rows in the result table will be the same as that in the input table.",
|
|
13020
|
-
""
|
|
13021
|
-
]
|
|
13022
|
-
},
|
|
13023
|
-
{
|
|
13024
|
-
"type": "code",
|
|
13025
|
-
"language": "console",
|
|
13026
|
-
"value": [
|
|
13027
|
-
" ",
|
|
13028
|
-
" $ share streamTable(10:0,`time`sym`price`volume,[TIMESTAMP,SYMBOL,DOUBLE,INT]) as trades1",
|
|
13029
|
-
" $ outputTable = table(1:0, `time`factor1`factor2, [TIMESTAMP, DOUBLE,INT])",
|
|
13030
|
-
" $ agg=createCrossSectionalAggregator(name=\"csEngineDemo4\", metrics=<[price+ 0.1, sum(volume)]>, dummyTable=trades1, outputTable=outputTable, keyColumn=`sym, triggeringPattern=\"keyCount\", triggeringInterval=5, useSystemTime=false, timeColumn=`time,lastBatchOnly=true)",
|
|
13031
|
-
" $ subscribeTable(tableName=`trades1, actionName=\"csEngineDemo4\", msgAsTable=true, handler=append!{agg})",
|
|
13032
|
-
" $ num=10",
|
|
13033
|
-
" $ time = array(timestamp)",
|
|
13034
|
-
" $ time=take(2018.01.01T09:30:00.000,num)",
|
|
13035
|
-
" $ sym=take(\"A\"+string(1..10),num)",
|
|
13036
|
-
" $ price=1..num",
|
|
13037
|
-
" $ volume=1..num",
|
|
13038
|
-
" $ tmp=table(time, sym, price, volume)",
|
|
13039
|
-
" $ trades1.append!(tmp)",
|
|
13040
|
-
"",
|
|
13041
|
-
" // Only the latest 5 records will participate in calculation.",
|
|
13042
|
-
" $ num=5",
|
|
13043
|
-
" $ time = array(timestamp)",
|
|
13044
|
-
" $ time=take(2018.01.01T09:30:01.000,num)",
|
|
13045
|
-
" $ sym=take(\"A\"+string(1..10),num)",
|
|
13046
|
-
" $ price=6..10",
|
|
13047
|
-
" $ volume=6..10",
|
|
13048
|
-
" $ tmp=table(time, sym, price, volume)",
|
|
13049
|
-
" $ trades1.append!(tmp)",
|
|
13050
|
-
""
|
|
13051
|
-
]
|
|
13052
|
-
},
|
|
13053
|
-
{
|
|
13054
|
-
"type": "text",
|
|
13055
|
-
"value": [
|
|
13056
|
-
"======================= ======== ======== ",
|
|
13057
|
-
"time factor1 factor2",
|
|
13058
|
-
"======================= ======== ======== ",
|
|
13059
|
-
"2018.01.01T09:30:00.000 1.1 55",
|
|
13060
|
-
"2018.01.01T09:30:00.000 2.1 55",
|
|
13061
|
-
"2018.01.01T09:30:00.000 3.1 55",
|
|
13062
|
-
"2018.01.01T09:30:00.000 4.1 55",
|
|
13063
|
-
"2018.01.01T09:30:00.000 5.1 55",
|
|
13064
|
-
"2018.01.01T09:30:00.000 6.1 55",
|
|
13065
|
-
"2018.01.01T09:30:00.000 7.1 55",
|
|
13066
|
-
"2018.01.01T09:30:00.000 8.1 55",
|
|
13067
|
-
"2018.01.01T09:30:00.000 9.1 55",
|
|
13068
|
-
"2018.01.01T09:30:00.000 10.1 55",
|
|
13069
|
-
"2018.01.01T09:30:01.000 6.1 40",
|
|
13070
|
-
"2018.01.01T09:30:01.000 7.1 40",
|
|
13071
|
-
"2018.01.01T09:30:01.000 8.1 40",
|
|
13072
|
-
"2018.01.01T09:30:01.000 9.1 40",
|
|
13073
|
-
"2018.01.01T09:30:01.000 10.1 40",
|
|
13074
|
-
"======================= ======== ======== ",
|
|
13075
|
-
"",
|
|
13076
|
-
"In this example, `triggeringPattern`\\=\"interval\" and triggeringInterval=500 (milliseconds). ",
|
|
13077
|
-
""
|
|
13078
|
-
]
|
|
13079
|
-
},
|
|
13080
|
-
{
|
|
13081
|
-
"type": "code",
|
|
13082
|
-
"language": "console",
|
|
13083
|
-
"value": [
|
|
13084
|
-
" ",
|
|
13085
|
-
" $ share streamTable(10:0,`time`sym`price`volume,[TIMESTAMP,SYMBOL,DOUBLE,INT]) as trades3",
|
|
13086
|
-
" $ outputTable = table(1:0, `time`avgPrice`volume`dollarVolume`count, [TIMESTAMP,DOUBLE,INT,DOUBLE,INT])",
|
|
13087
|
-
" $ csEngine3=createCrossSectionalEngine(name=\"csEngineDemo3\", metrics=<[avg(price), sum(volume), sum(price*volume), count(price)]>, dummyTable=trades3, outputTable=outputTable, keyColumn=`sym, triggeringPattern=\"interval\", triggeringInterval=500)",
|
|
13088
|
-
" $ subscribeTable(tableName=\"trades3\", actionName=\"tradesStats\", offset=-1, handler=append!{csEngine3}, msgAsTable=true);",
|
|
13089
|
-
"",
|
|
13090
|
-
" $ insert into trades3 values(2020.08.12T09:30:00.000, `A, 10, 20)",
|
|
13091
|
-
" $ sleep(500)",
|
|
13092
|
-
" $ insert into trades3 values(2020.08.12T09:30:00.000 + 500, `B, 20, 10)",
|
|
13093
|
-
" $ sleep(500)",
|
|
13094
|
-
" $ insert into trades3 values(2020.08.12T09:30:00.000 + 1000, `A, 10.1, 20)",
|
|
13095
|
-
" $ sleep(1000)",
|
|
13096
|
-
" $ insert into trades3 values(2020.08.12T09:30:00.000 + 2000, `B, 20.1, 30)",
|
|
13097
|
-
" $ sleep(500)",
|
|
13098
|
-
" $ insert into trades3 values(2020.08.12T09:30:00.000 + 2500, `B, 20.2, 40)",
|
|
13099
|
-
" $ sleep(500)",
|
|
13100
|
-
" $ insert into trades3 values(2020.08.12T09:30:00.000 + 3000, `A, 10.2, 20);",
|
|
13101
|
-
"",
|
|
13102
|
-
" $ select * from outputTable;",
|
|
13103
|
-
""
|
|
13104
|
-
]
|
|
13105
|
-
},
|
|
13106
|
-
{
|
|
13107
|
-
"type": "text",
|
|
13108
|
-
"value": [
|
|
13109
|
-
"======================== ========= ======= ============= ======",
|
|
13110
|
-
"time avgPrice volume dollarVolume count",
|
|
13111
|
-
"======================== ========= ======= ============= ======",
|
|
13112
|
-
"2020.09.13T19:04:45.015 10 20 200 1",
|
|
13113
|
-
"2020.09.13T19:04:45.529 15 30 400 2",
|
|
13114
|
-
"2020.09.13T19:04:46.030 15.05 30 402 2",
|
|
13115
|
-
"2020.09.13T19:04:46.531 15.05 30 402 2",
|
|
13116
|
-
"2020.09.13T19:04:47.036 15.1 50 805 2",
|
|
13117
|
-
"2020.09.13T19:04:47.551 15.15 60 1010 2",
|
|
13118
|
-
"2020.09.13T19:04:48.065 15.2 60 1012 2",
|
|
13119
|
-
"2020.09.13T19:04:48.567 15.2 60 1012 2",
|
|
13120
|
-
"... ... ... ... ...",
|
|
13121
|
-
"======================== ========= ======= ============= ======",
|
|
13122
|
-
"",
|
|
13123
|
-
".. 输出表的记录数会不断增长。这是因为triggeringPattern=\"interval\"时,计算是按照系统时间定时触发,与是否有新数据进入无关。",
|
|
13124
|
-
"",
|
|
13125
|
-
".. 在以上的例子中,createCrossSectionalEngine的返回结果(以下成为横截面表)是为计算提供的一个中间结果,但横截面表亦可为最终结果。例如若需要定时刷新某只股票的最新交易价格,按照常规思路是从实时交易表中按代码筛选股票并取出最后一条记录,而交易表的数据量是随着时间快速增长的,如果频繁做这样的查询,无论从系统的资源消耗还是从查询的效能来看都不是最优的做法。而横截面表永远只保存所有股票的最近一次交易数据,数据量是稳定的,对于这种定时轮询的场景非常合适。",
|
|
13126
|
-
"",
|
|
13127
|
-
".. 要将横截面表作为最终结果,需要在对createCrossSectionalEngine中的metrics与outputTable这两个参数置空。",
|
|
13128
|
-
"",
|
|
13129
|
-
"",
|
|
13130
|
-
"For `triggeringPattern` = \"interval\", the calculation is triggered regularly by the system time instead of the arriving data. Thus the size of the output table will keep growing. ",
|
|
13131
|
-
"",
|
|
13132
|
-
"In the above example, the table returned by cross sectional engine is usually an intermediate result for the calculation. But it can also be a final result. ",
|
|
13133
|
-
"",
|
|
13134
|
-
"For example, if you need to regularly refresh the latest trading price of a certain stock, the basic way is to filter the stocks by code from the real-time trading table and retrieve the last record. However, the amount of data in the trading table is growing rapidly over time. For frequent query, it is not the best practice in terms of system resource consumption or query performance. The cross sectional table only saves the latest transaction data of all stocks, the data amount is stable. So it is very suitable for the timing polling scenario.",
|
|
13135
|
-
"",
|
|
13136
|
-
"To use a cross sectional table as a final result, set `metrics` and `outputTable` to be empty."
|
|
13137
|
-
]
|
|
13138
|
-
}
|
|
13139
|
-
]
|
|
13140
|
-
}
|
|
13141
|
-
]
|
|
12822
|
+
"children": []
|
|
13142
12823
|
},
|
|
13143
12824
|
"createDailyTimeSeriesEngine": {
|
|
13144
12825
|
"title": "createDailyTimeSeriesEngine",
|
|
@@ -14464,7 +14145,7 @@
|
|
|
14464
14145
|
"",
|
|
14465
14146
|
"- Note that dimensionality reduction is performed when writing to disk, so specifying this parameter may affect write performance.",
|
|
14466
14147
|
"- The functions specified in ``sortKeyMappingFunction`` correspond to each and every sort key. If a sort key does not require dimensionality reduction, leave the corresponding element empty in the vector of ``sortKeyMappingFunction``.",
|
|
14467
|
-
"- If a mapping function is ``hashBucket`` AND the sort key to which it applies is a HASH partitioning column, make sure the number of Hash partitions is not divisible by ``hashBucket().buckets
|
|
14148
|
+
"- If a mapping function is ``hashBucket`` AND the sort key to which it applies is a HASH partitioning column, make sure the number of Hash partitions is not divisible by ``hashBucket().buckets`` (or vice versa), otherwise the column values from the same HASH partition would be mapped to the same hash bucket after dimensionality reduction."
|
|
14468
14149
|
]
|
|
14469
14150
|
}
|
|
14470
14151
|
]
|
|
@@ -14737,6 +14418,11 @@
|
|
|
14737
14418
|
"createReactiveStateEngine": {
|
|
14738
14419
|
"title": "createReactiveStateEngine",
|
|
14739
14420
|
"type": "function",
|
|
14421
|
+
"children": []
|
|
14422
|
+
},
|
|
14423
|
+
"createSessionWindowEngine": {
|
|
14424
|
+
"title": "createSessionWindowEngine",
|
|
14425
|
+
"type": "function",
|
|
14740
14426
|
"children": [
|
|
14741
14427
|
{
|
|
14742
14428
|
"title": "Syntax",
|
|
@@ -14745,78 +14431,8 @@
|
|
|
14745
14431
|
{
|
|
14746
14432
|
"type": "text",
|
|
14747
14433
|
"value": [
|
|
14748
|
-
"
|
|
14749
|
-
|
|
14750
|
-
}
|
|
14751
|
-
]
|
|
14752
|
-
},
|
|
14753
|
-
{
|
|
14754
|
-
"title": "Arguments",
|
|
14755
|
-
"type": "parameters",
|
|
14756
|
-
"children": [
|
|
14757
|
-
{
|
|
14758
|
-
"type": "text",
|
|
14759
|
-
"value": [
|
|
14760
|
-
"`name` is a string indicating the name of the reactive state engine. It is the only identifier of the reactive state engine. It can have letter, number and \"_\". It must start with a letter.",
|
|
14761
|
-
"",
|
|
14762
|
-
"`metrics` is metacode specifying the formulas for calculation. The formulas should use vector functions instead of aggregate functions. For more information about metacode please refer to :doc:`/Objects/Metaprogramming`. To use a user-defined function in the reactive state engine, please note:",
|
|
14763
|
-
"",
|
|
14764
|
-
"1. Add \"@state\" to declare the function before the definition. For state functions, only assignment statements and return statements are supported.",
|
|
14765
|
-
"",
|
|
14766
|
-
"2. If the rvalue of an assignment statement is a function that returns multiple values, the values must be assigned to variables at the same time. In the following example, the user-defined state function references linearTimeTrend, which returns two values:",
|
|
14767
|
-
"",
|
|
14768
|
-
".. code-block:: console",
|
|
14769
|
-
"",
|
|
14770
|
-
" $ @state",
|
|
14771
|
-
" $ def forcast2(S, N){",
|
|
14772
|
-
" $ linearregIntercept, linearregSlope = linearTimeTrend(S, N)",
|
|
14773
|
-
" $ return (N - 1) * linearregSlope + linearregIntercept",
|
|
14774
|
-
" $ }",
|
|
14775
|
-
"",
|
|
14776
|
-
".. _dummyTable_rs:",
|
|
14777
|
-
"",
|
|
14778
|
-
"The following state functions in DolphinDB's reactive state engine has been optimized. Currently, unoptimized state functions are not supported by this engine, and aggregate functions should be avoid.",
|
|
14779
|
-
"",
|
|
14780
|
-
"* cumulative function: cumavg, cumsum, cumprod, cumcount, cummin, cummax, cumvar, cumvarp, cumstd, cumstdp, cumcorr, cumcovar, cumbeta, cumwsum, cumwavg, cumfirstNot, cumlastNot, cummed, cumpercentile ",
|
|
14781
|
-
"* moving function: ema, mavg, msum, mcount, mprod, mvar, mvarp, mstd, mstdp, mskew, mkurtosis, mmin, mmax, mimin, mimax, mmed, mpercentile, mrank, mcorr, mcovar, mbeta, mwsum, mwavg, mmad, mfirst, mlast, mslr, tmove, tmfirst, tmlast, tmsum, tmavg, tmcount, tmvar, tmvarp, tmstd, tmstdp, tmprod, tmskew, tmkurtosis, tmmin, tmmax, tmmed, tmpercentile, tmrank, tmcovar, tmbeta, tmcorr, tmwavg, tmwsum, tmoving, moving, sma,wma, dema, tema, trima, linearTimeTrend, talib, t3, ma",
|
|
14782
|
-
"* order-sensitive function: deltas, ratios, ffill, move, prev, iterate, ewmMean, ewmVar, ewmStd, ewmCov, ewmCorr",
|
|
14783
|
-
"* topN function: msumTopN, mavgTopN, mstdpTopN, mstdTopN, mvarpTopN, mvarTopN, mcorrTopN, mbetaTopN, mcovarTopN, mwsumTopN",
|
|
14784
|
-
"* Higher-order functions: segmentby (currently parameter func supports cumsum, cummax, cummin, cumcount, cumavg, cumstd, cumvar, cumstdp, cumvarp), moving, byColumn, accumulate, window",
|
|
14785
|
-
"* other: talibNull, talibNull, fixedLengthArrayVector, dynamicGroupCumsum, dynamicGroupCumcount",
|
|
14786
|
-
"",
|
|
14787
|
-
"Note:",
|
|
14788
|
-
"",
|
|
14789
|
-
"- The parameter *func* in the state function ``talib`` can only be a state function supported by the reactive state engine.",
|
|
14790
|
-
"",
|
|
14791
|
-
"- If the data form of a column specified in *metrics* is an array vector, each row of the vector must be of the same length.",
|
|
14792
|
-
"",
|
|
14793
|
-
"`dummyTable` is a table object whose schema must be the same as the subscribed stream table. The system uses the schema of dummyTable to determine the data type of each column in the messages. Whether dummyTable contains data does not matter.",
|
|
14794
|
-
"",
|
|
14795
|
-
"`outputTable` is the output table for the results. It can be an in-memory table or a DFS table. We need to set the output table as an empty table and specify the names and data types of the columns before using function ``createReactiveStateEngine``.",
|
|
14796
|
-
"",
|
|
14797
|
-
"`keyColumn` is a string scalar indicating a column name. The calculation is conducted within each group of keyColumn.",
|
|
14798
|
-
"",
|
|
14799
|
-
"`filter` is metacode indicating filtering conditions. Only the results that satisfy the filtering conditions are output to outputTable. It must be an expression. Connect them with logical operators (and, or) to set multiple conditions.",
|
|
14800
|
-
"",
|
|
14801
|
-
"`snapshotDir` is a string indicating the directory where the streaming engine snapshot is saved. The snapshot is used to restore the streaming engine after system interruption.",
|
|
14802
|
-
"",
|
|
14803
|
-
"* The directory must already exist, otherwise an exception is thrown.",
|
|
14804
|
-
"",
|
|
14805
|
-
"* When creating a streaming engine, if snapshotDir is specified, the system will check whether there is a snapshot in the directory already. If it exists, the snapshot will be loaded to restore the state of the engine.",
|
|
14806
|
-
"",
|
|
14807
|
-
"* Multiple streaming engines can share a directory.",
|
|
14808
|
-
"",
|
|
14809
|
-
"* A snapshot may use 3 names. When the snapshot is being generated, the file name is <engineName>.tmp; after the snapshot is generated and flushed to the disk, it is renamed to <engineName>.snapshot; if a snapshot with the same name already exists, the previous snapshot is renamed to <engineName>.old.",
|
|
14810
|
-
"",
|
|
14811
|
-
"`snapshotIntervalInMsgCount` is a positive integer indicating the number of messages between 2 streaming engine snapshots.",
|
|
14812
|
-
"",
|
|
14813
|
-
"To enable snapshots in streaming engines, snapshotDir and snapshotIntervalInMsgCount must be specified.",
|
|
14814
|
-
"",
|
|
14815
|
-
".. `keepOrder` 可选参数,表示输出表数据是否按照输入时的顺序排序。设置 *keyColumn*=true, 表示输出表按照输入时的顺序排序。当 *keyColumn* 包含有时间列时,*keyColumn* 默认值为true, 否则默认值为false. ",
|
|
14816
|
-
"",
|
|
14817
|
-
"`keepOrder` is an optional parameter indicating whether to sort the output table in order as input. If `keepOrder` = true, sort it in order as input. If *keyColumn* contains a time column, the default value is true. Otherwise, the default value is false.",
|
|
14818
|
-
"",
|
|
14819
|
-
"`raftGroup` is the ID of the raft group on the high-availability streaming subscriber specified by the configuration parameter *streamingRaftGroups*. It is an integer greater than 1. Specify *raftGroup* to enable high availability on the streaming engine. When a streaming engine is created on the leader, it is also created on each follower. Once a snapshot is generated, it will also be synced to all followers. When a leader is down, the raft group automatically switches to a new leader to resubscribe to the stream table. Note that *SnapShotDir* must also be specified when specifying a raft group."
|
|
14434
|
+
"createSessionWindowEngine(name, sessionGap, metrics, dummyTable, outputTable, [timeColumn], [useSystemTime=false], [keyColumn], [updateTime], [useSessionStartTime=true], [snapshotDir], [snapshotIntervalInMsgCount], [raftGroup], [forceTriggerTime])",
|
|
14435
|
+
""
|
|
14820
14436
|
]
|
|
14821
14437
|
}
|
|
14822
14438
|
]
|
|
@@ -14828,112 +14444,22 @@
|
|
|
14828
14444
|
{
|
|
14829
14445
|
"type": "text",
|
|
14830
14446
|
"value": [
|
|
14831
|
-
"
|
|
14447
|
+
"This function creates a session window streaming engine. The session window engine shares most of its parameters with the time-series engine (:doc:`createTimeSeriesEngine`), but includes two unique parameters: :ref:`sessionGap <sessionGap_sw>` and :ref:`useSessionStartTime <useSessionStartTime_sw>`.",
|
|
14832
14448
|
"",
|
|
14833
|
-
"
|
|
14834
|
-
"",
|
|
14835
|
-
"Generally it is used in conjunction with subscribeTable. The engine it creates can be called across sessions.",
|
|
14836
|
-
"",
|
|
14837
|
-
"The function was released in version 1.30.2.",
|
|
14838
|
-
"",
|
|
14839
|
-
"Note: The reactive state engine doesn't support multi-threaded concurrent writes. We must specify *setExecutorPooling* = false to make the write tasks execute serially. "
|
|
14449
|
+
"For more application scenarios, see :doc:`../../Themes/streamingEngine`."
|
|
14840
14450
|
]
|
|
14841
14451
|
}
|
|
14842
14452
|
]
|
|
14843
14453
|
},
|
|
14844
14454
|
{
|
|
14845
|
-
"title": "
|
|
14846
|
-
"type": "example",
|
|
14455
|
+
"title": "Calculation Rules",
|
|
14847
14456
|
"children": [
|
|
14848
|
-
{
|
|
14849
|
-
"type": "code",
|
|
14850
|
-
"language": "console",
|
|
14851
|
-
"value": [
|
|
14852
|
-
" ",
|
|
14853
|
-
" $ def sum_diff(x, y){",
|
|
14854
|
-
" $ return (x-y)/(x+y)",
|
|
14855
|
-
" $ }",
|
|
14856
|
-
" $ factor1 = <ema(1000 * sum_diff(ema(price, 20), ema(price, 40)),10) - ema(1000 * sum_diff(ema(price, 20), ema(price, 40)), 20)>",
|
|
14857
|
-
" $ share streamTable(1:0, `sym`time`price, [STRING,DATETIME,DOUBLE]) as tickStream",
|
|
14858
|
-
" $ result = table(1000:0, `sym`time`factor1, [STRING,DATETIME,DOUBLE])",
|
|
14859
|
-
" $ rse = createReactiveStateEngine(name=\"reactiveDemo\", metrics =[<time>, factor1], dummyTable=tickStream, outputTable=result, keyColumn=\"sym\", filter=<sym in [\"000001.SH\", \"000002.SH\"]>)",
|
|
14860
|
-
" $ subscribeTable(tableName=`tickStream, actionName=\"factors\", handler=tableInsert{rse})",
|
|
14861
|
-
" ",
|
|
14862
|
-
" $ data1 = table(take(\"000001.SH\", 100) as sym, 2021.02.08T09:30:00 + 1..100 *3 as time, 10+cumsum(rand(0.1, 100)-0.05)as price)",
|
|
14863
|
-
" $ data2 = table(take(\"000002.SH\", 100) as sym, 2021.02.08T09:30:00 + 1..100 *3 as time, 20+cumsum(rand(0.2, 100)-0.1)as price)",
|
|
14864
|
-
" $ data3 = table(take(\"000003.SH\", 100) as sym, 2021.02.08T09:30:00 + 1..100 *3 as time, 30+cumsum(rand(0.3, 100)-0.15)as price)",
|
|
14865
|
-
" $ data = data1.unionAll(data2).unionAll(data3).sortBy!(`time)",
|
|
14866
|
-
" ",
|
|
14867
|
-
" $ replay(inputTables=data, outputTables=tickStream, timeColumn=`time)",
|
|
14868
|
-
""
|
|
14869
|
-
]
|
|
14870
|
-
},
|
|
14871
14457
|
{
|
|
14872
14458
|
"type": "text",
|
|
14873
14459
|
"value": [
|
|
14874
|
-
"
|
|
14460
|
+
"When records are ingested into a session window, the window remains open until a specified period of inactivity passes (specified by *sessionGap*). The window end is equal to the timestamp of the last received record + the *sessionGap* interval. The calculation of this window is triggered by the arrival of the next record after the window ends.",
|
|
14875
14461
|
"",
|
|
14876
|
-
"
|
|
14877
|
-
""
|
|
14878
|
-
]
|
|
14879
|
-
},
|
|
14880
|
-
{
|
|
14881
|
-
"type": "code",
|
|
14882
|
-
"language": "console",
|
|
14883
|
-
"value": [
|
|
14884
|
-
" ",
|
|
14885
|
-
" $ unsubscribeTable(tableName=`tickStream, actionName=\"factors\")",
|
|
14886
|
-
" $ dropStreamEngine(`reactiveDemo)",
|
|
14887
|
-
" $ undef(`tickStream, SHARED)",
|
|
14888
|
-
""
|
|
14889
|
-
]
|
|
14890
|
-
},
|
|
14891
|
-
{
|
|
14892
|
-
"type": "text",
|
|
14893
|
-
"value": [
|
|
14894
|
-
".. *keyColumn* 设置以股票和日期进行分组计算,并设置输出时间在\"2012.01.01\"和\"2012.01.03\"之间的计算结果。",
|
|
14895
|
-
"",
|
|
14896
|
-
"Calculate in groups by date and sym column. Then output the result which time is between \"2012.01.01\" and \"2012.01.03\".",
|
|
14897
|
-
""
|
|
14898
|
-
]
|
|
14899
|
-
},
|
|
14900
|
-
{
|
|
14901
|
-
"type": "code",
|
|
14902
|
-
"language": "console",
|
|
14903
|
-
"value": [
|
|
14904
|
-
"",
|
|
14905
|
-
" $ share streamTable(1:0, `date`time`sym`market`price`qty, [DATE, TIME, SYMBOL, CHAR, DOUBLE, INT]) as trades",
|
|
14906
|
-
" $ outputTable = table(100:0, `date`sym`factor1, [DATE, STRING, DOUBLE])",
|
|
14907
|
-
" $ engine = createReactiveStateEngine(name=\"test\", metrics=<mavg(price, 3)>, dummyTable=trades, outputTable=outputTable, keyColumn=[\"date\",\"sym\"], filter=<date between 2012.01.01 : 2012.01.03>, keepOrder=true)",
|
|
14908
|
-
" $ subscribeTable(tableName=`trades, actionName=\"test\", msgAsTable=true, handler=tableInsert{engine})",
|
|
14909
|
-
"",
|
|
14910
|
-
" $ n=100",
|
|
14911
|
-
" $ tmp = table(rand(2012.01.01..2012.01.10, n) as date, rand(09:00:00.000..15:59:59.999, n) as time, rand(\"A\"+string(1..10), n) as sym, rand(['B', 'S'], n) as market, rand(100.0, n) as price, rand(1000..2000, n) as qty)",
|
|
14912
|
-
" $ trades.append!(tmp) ",
|
|
14913
|
-
" $ select * from outputTable",
|
|
14914
|
-
"",
|
|
14915
|
-
" // Execute the following code before re-run the above code.",
|
|
14916
|
-
" $ unsubscribeTable(tableName=`trades, actionName=\"test\")",
|
|
14917
|
-
" $ dropStreamEngine(`test)",
|
|
14918
|
-
" $ undef(`trades, SHARED)"
|
|
14919
|
-
]
|
|
14920
|
-
}
|
|
14921
|
-
]
|
|
14922
|
-
}
|
|
14923
|
-
]
|
|
14924
|
-
},
|
|
14925
|
-
"createSessionWindowEngine": {
|
|
14926
|
-
"title": "createSessionWindowEngine",
|
|
14927
|
-
"type": "function",
|
|
14928
|
-
"children": [
|
|
14929
|
-
{
|
|
14930
|
-
"title": "Syntax",
|
|
14931
|
-
"type": "grammer",
|
|
14932
|
-
"children": [
|
|
14933
|
-
{
|
|
14934
|
-
"type": "text",
|
|
14935
|
-
"value": [
|
|
14936
|
-
"createSessionWindowEngine(name, sessionGap, metrics, dummyTable, outputTable, [timeColumn], [useSystemTime=false], [keyColumn], [updateTime], [useSessionStartTime=true], [snapshotDir], [snapshotIntervalInMsgCount], [raftGroup])"
|
|
14462
|
+
"Note: If *keyColumn* is specified to group data by the column values, the calculations described above will be performed within each group."
|
|
14937
14463
|
]
|
|
14938
14464
|
}
|
|
14939
14465
|
]
|
|
@@ -14945,32 +14471,19 @@
|
|
|
14945
14471
|
{
|
|
14946
14472
|
"type": "text",
|
|
14947
14473
|
"value": [
|
|
14948
|
-
"As most of the parameters of createSessionWindowEngine are identical with those of :doc:`createTimeSeriesEngine
|
|
14474
|
+
"As most of the parameters of ``createSessionWindowEngine`` are identical with those of :doc:`createTimeSeriesEngine`, we only explain the following parameters of ``createSessionWindowEngine`` that are different from those of ``createTimeSeriesEngine``.",
|
|
14949
14475
|
"",
|
|
14476
|
+
".. _sessionGap_sw:",
|
|
14950
14477
|
"",
|
|
14951
|
-
"`sessionGap` a positive integer indicating the gap between 2 session windows.
|
|
14478
|
+
"`sessionGap` a positive integer indicating the gap between 2 session windows. Its unit is determined by the parameter *useSystemTime*.",
|
|
14952
14479
|
"",
|
|
14953
|
-
"
|
|
14480
|
+
".. _useSessionStartTime_sw:",
|
|
14954
14481
|
"",
|
|
14955
|
-
"*
|
|
14482
|
+
"`useSessionStartTime` (optional) a Boolean value indicating whether the first column in *outputTable* is the starting time of the windows, i.e., the timestamp of the first record in each window. Setting it to false means the timestamps in the output table are the ending time of the windows, i.e., timestamp of the last record in window + *sessionGap*. If *updateTime* is specified, *useSessionStartTime* must be true.",
|
|
14956
14483
|
"",
|
|
14957
|
-
"
|
|
14484
|
+
".. _forceTriggerTime_sw:",
|
|
14958
14485
|
"",
|
|
14959
|
-
"`
|
|
14960
|
-
]
|
|
14961
|
-
}
|
|
14962
|
-
]
|
|
14963
|
-
},
|
|
14964
|
-
{
|
|
14965
|
-
"title": "Details",
|
|
14966
|
-
"type": "detail",
|
|
14967
|
-
"children": [
|
|
14968
|
-
{
|
|
14969
|
-
"type": "text",
|
|
14970
|
-
"value": [
|
|
14971
|
-
"Create a session window streaming engine.",
|
|
14972
|
-
"",
|
|
14973
|
-
"It is very similar to the time-series streaming engine. The only difference among the two streaming engines is how the calculation windows are determined. In the time-series streaming engine, fixed-length windows are generated at specified frequencies. In comparison, in the session window streaming engine, if no new message is ingested for the specified length of time after a message, then this message is the end of a window. The next message is the start of a new window."
|
|
14486
|
+
"`forceTriggerTime` (optional) a non-negative integer. Its unit is the same as the time precision of *timeColumn*. *forceTriggerTime* indicates the waiting time to force trigger calculation in uncalculated windows for each group."
|
|
14974
14487
|
]
|
|
14975
14488
|
}
|
|
14976
14489
|
]
|
|
@@ -14984,77 +14497,84 @@
|
|
|
14984
14497
|
"language": "console",
|
|
14985
14498
|
"value": [
|
|
14986
14499
|
" ",
|
|
14987
|
-
" $ share streamTable(1000:0, `time`volume, [TIMESTAMP, INT]) as trades",
|
|
14988
|
-
" $ output1 =
|
|
14989
|
-
" $ engine_sw = createSessionWindowEngine(name = \"engine_sw\", sessionGap = 5, metrics = <sum(volume)>, dummyTable = trades, outputTable = output1, timeColumn = `time)",
|
|
14500
|
+
" $ share streamTable(1000:0, `time`sym`volume, [TIMESTAMP, SYMBOL, INT]) as trades",
|
|
14501
|
+
" $ output1 = table(10000:0, `time`sym`sumVolume, [TIMESTAMP, SYMBOL, INT])",
|
|
14502
|
+
" $ engine_sw = createSessionWindowEngine(name = \"engine_sw\", sessionGap = 5, metrics = <sum(volume)>, dummyTable = trades, outputTable = output1, timeColumn = `time, keyColumn=`sym)",
|
|
14990
14503
|
" $ subscribeTable(tableName=\"trades\", actionName=\"append_engine_sw\", offset=0, handler=append!{engine_sw}, msgAsTable=true)",
|
|
14991
|
-
"
|
|
14504
|
+
"",
|
|
14992
14505
|
" $ n = 5",
|
|
14993
14506
|
" $ timev = 2018.10.12T10:01:00.000 + (1..n)",
|
|
14507
|
+
" $ symv=take(`A`B`C,n)",
|
|
14994
14508
|
" $ volumev = (1..n)%1000",
|
|
14995
|
-
" $ insert into trades values(timev, volumev)",
|
|
14509
|
+
" $ insert into trades values(timev, symv, volumev)",
|
|
14996
14510
|
" ",
|
|
14997
14511
|
" $ n = 5",
|
|
14998
14512
|
" $ timev = 2018.10.12T10:01:00.010 + (1..n)",
|
|
14999
14513
|
" $ volumev = (1..n)%1000",
|
|
15000
|
-
" $
|
|
14514
|
+
" $ symv=take(`A`B`C,n)",
|
|
14515
|
+
" $ insert into trades values(timev, symv, volumev)",
|
|
15001
14516
|
" ",
|
|
15002
|
-
" $ n =
|
|
15003
|
-
" $ timev = 2018.10.12T10:01:00.020 +
|
|
14517
|
+
" $ n = 6",
|
|
14518
|
+
" $ timev = 2018.10.12T10:01:00.020 + 1 2 3 8 14 20",
|
|
15004
14519
|
" $ volumev = (1..n)%1000",
|
|
15005
|
-
" $
|
|
15006
|
-
" $ volumev
|
|
15007
|
-
" $ insert into trades values(timev, volumev)",
|
|
14520
|
+
" $ symv=take(`A`B`C,n)",
|
|
14521
|
+
" $ insert into trades values(timev, symv, volumev)",
|
|
15008
14522
|
"",
|
|
15009
|
-
" $ select * from
|
|
14523
|
+
" $ select * from output1;",
|
|
15010
14524
|
""
|
|
15011
14525
|
]
|
|
15012
14526
|
},
|
|
15013
14527
|
{
|
|
15014
14528
|
"type": "text",
|
|
15015
14529
|
"value": [
|
|
15016
|
-
"======================== ========",
|
|
15017
|
-
"time volume",
|
|
15018
|
-
"======================== ========",
|
|
15019
|
-
"2018.10.12T10:01:00.001
|
|
15020
|
-
"2018.10.12T10:01:00.002
|
|
15021
|
-
"2018.10.12T10:01:00.003
|
|
15022
|
-
"2018.10.12T10:01:00.
|
|
15023
|
-
"2018.10.12T10:01:00.
|
|
15024
|
-
"2018.10.12T10:01:00.
|
|
15025
|
-
"2018.10.12T10:01:00.
|
|
15026
|
-
"2018.10.12T10:01:00.
|
|
15027
|
-
"2018.10.12T10:01:00.
|
|
15028
|
-
"
|
|
15029
|
-
"
|
|
15030
|
-
"
|
|
15031
|
-
"2018.10.12T10:01:00.023 3",
|
|
15032
|
-
"2018.10.12T10:01:00.028 1",
|
|
15033
|
-
"2018.10.12T10:01:00.029 2",
|
|
15034
|
-
"2018.10.12T10:01:00.030 3",
|
|
15035
|
-
"======================== ========",
|
|
14530
|
+
"======================== ==== ========",
|
|
14531
|
+
"time sym volume",
|
|
14532
|
+
"======================== ==== ========",
|
|
14533
|
+
"2018.10.12T10:01:00.001 A 5",
|
|
14534
|
+
"2018.10.12T10:01:00.002 B 7",
|
|
14535
|
+
"2018.10.12T10:01:00.003 C 3",
|
|
14536
|
+
"2018.10.12T10:01:00.011 A 5",
|
|
14537
|
+
"2018.10.12T10:01:00.012 B 7",
|
|
14538
|
+
"2018.10.12T10:01:00.013 C 3",
|
|
14539
|
+
"2018.10.12T10:01:00.021 A 1",
|
|
14540
|
+
"2018.10.12T10:01:00.022 B 2",
|
|
14541
|
+
"2018.10.12T10:01:00.023 C 3",
|
|
14542
|
+
"======================== ==== ========",
|
|
14543
|
+
"",
|
|
14544
|
+
"Specify *forceTriggerTime* as 1000. 1000 ms after the ingestion of the last record, calculation is triggered in all groups. Replace the engine creation statement with the following code:",
|
|
15036
14545
|
""
|
|
15037
14546
|
]
|
|
15038
14547
|
},
|
|
15039
14548
|
{
|
|
15040
14549
|
"type": "code",
|
|
15041
|
-
"language": "
|
|
14550
|
+
"language": "console",
|
|
15042
14551
|
"value": [
|
|
15043
|
-
"
|
|
15044
|
-
"
|
|
14552
|
+
"",
|
|
14553
|
+
" $ engine_sw = createSessionWindowEngine(name = \"engine_sw\", sessionGap = 5, metrics = <sum(volume)>, dummyTable = trades, outputTable = output1, timeColumn = `time, keyColumn=`sym, forceTriggerTime=1000)",
|
|
15045
14554
|
""
|
|
15046
14555
|
]
|
|
15047
14556
|
},
|
|
15048
14557
|
{
|
|
15049
14558
|
"type": "text",
|
|
15050
14559
|
"value": [
|
|
15051
|
-
"
|
|
15052
|
-
"
|
|
15053
|
-
"========================
|
|
15054
|
-
"
|
|
15055
|
-
"
|
|
15056
|
-
"2018.10.12T10:01:00.
|
|
15057
|
-
"
|
|
14560
|
+
"Print the output table again. The result is as follows:",
|
|
14561
|
+
"",
|
|
14562
|
+
"======================== ==== ========",
|
|
14563
|
+
"time sym volume",
|
|
14564
|
+
"======================== ==== ========",
|
|
14565
|
+
"2018.10.12T10:01:00.001 A 5",
|
|
14566
|
+
"2018.10.12T10:01:00.002 B 7",
|
|
14567
|
+
"2018.10.12T10:01:00.003 C 3",
|
|
14568
|
+
"2018.10.12T10:01:00.011 A 5",
|
|
14569
|
+
"2018.10.12T10:01:00.012 B 7",
|
|
14570
|
+
"2018.10.12T10:01:00.013 C 3",
|
|
14571
|
+
"2018.10.12T10:01:00.021 A 1",
|
|
14572
|
+
"2018.10.12T10:01:00.022 B 2",
|
|
14573
|
+
"2018.10.12T10:01:00.023 C 3",
|
|
14574
|
+
"2018.10.12T10:01:00.028 A 4",
|
|
14575
|
+
"2018.10.12T10:01:00.034 B 5",
|
|
14576
|
+
"2018.10.12T10:01:00.040 C 6",
|
|
14577
|
+
"======================== ==== ========"
|
|
15058
14578
|
]
|
|
15059
14579
|
}
|
|
15060
14580
|
]
|
|
@@ -15866,7 +15386,7 @@
|
|
|
15866
15386
|
{
|
|
15867
15387
|
"type": "text",
|
|
15868
15388
|
"value": [
|
|
15869
|
-
"createWindowJoinEngine(name, leftTable, rightTable, outputTable, window, metrics, matchingColumn, [timeColumn], [useSystemTime=false], [garbageSize = 5000], [maxDelayedTime], [nullFill])"
|
|
15389
|
+
"createWindowJoinEngine(name, leftTable, rightTable, outputTable, window, metrics, matchingColumn, [timeColumn], [useSystemTime=false], [garbageSize = 5000], [maxDelayedTime], [nullFill], [outputElapsedMicroseconds=false])"
|
|
15870
15390
|
]
|
|
15871
15391
|
}
|
|
15872
15392
|
]
|
|
@@ -15933,6 +15453,8 @@
|
|
|
15933
15453
|
"",
|
|
15934
15454
|
"\\(3) Further followed by the columns holding the calculation results. There can be more than 1 result column.",
|
|
15935
15455
|
"",
|
|
15456
|
+
"\\(4) If *outputElapsedMicroseconds* is set to true, the last two columns are a LONG column and an INT column, indicating the time elapsed (in microseconds) to calculate each batch of data internally and the number of records in each batch, respectively.",
|
|
15457
|
+
"",
|
|
15936
15458
|
"`window` is a pair of integers or duration values, indicating the range of a sliding window, including both left and right bounds.",
|
|
15937
15459
|
"",
|
|
15938
15460
|
".. _metricsWJ:",
|
|
@@ -15975,11 +15497,17 @@
|
|
|
15975
15497
|
"- existing NULL values from right table columns",
|
|
15976
15498
|
"",
|
|
15977
15499
|
"- results of non-aggregate calculation",
|
|
15978
|
-
""
|
|
15500
|
+
"",
|
|
15501
|
+
"When multiple records are ingested into the engine at the same time, the engine divides the data into batches for calculation. The number of records in each batch is determined by the system internally."
|
|
15979
15502
|
]
|
|
15980
15503
|
}
|
|
15981
15504
|
]
|
|
15982
15505
|
},
|
|
15506
|
+
{
|
|
15507
|
+
"title": "Arguments",
|
|
15508
|
+
"type": "parameters",
|
|
15509
|
+
"children": []
|
|
15510
|
+
},
|
|
15983
15511
|
{
|
|
15984
15512
|
"title": "Examples",
|
|
15985
15513
|
"type": "example",
|
|
@@ -18488,11 +18016,11 @@
|
|
|
18488
18016
|
{
|
|
18489
18017
|
"type": "text",
|
|
18490
18018
|
"value": [
|
|
18491
|
-
"`X` is a scalar/vector.",
|
|
18019
|
+
"`X` is a scalar/vector/matrix/table.",
|
|
18492
18020
|
"",
|
|
18493
18021
|
"`size` is a positive integer that must be no greater than the size of *X*.",
|
|
18494
18022
|
"",
|
|
18495
|
-
"`cutPositions` is a vector
|
|
18023
|
+
"`cutPositions` is a vector with increasing elements, which is used to specify the starting position of each vector in the result."
|
|
18496
18024
|
]
|
|
18497
18025
|
}
|
|
18498
18026
|
]
|
|
@@ -18504,10 +18032,19 @@
|
|
|
18504
18032
|
{
|
|
18505
18033
|
"type": "text",
|
|
18506
18034
|
"value": [
|
|
18507
|
-
"This function divides *X* based on the specified size or *cutPositions*, and returns a tuple:",
|
|
18035
|
+
"This function divides *X* based on the specified *size* or *cutPositions*, and returns a tuple:",
|
|
18036
|
+
"",
|
|
18037
|
+
"* When *X* is a scalar, *size* can only be specified as 1. ",
|
|
18038
|
+
"",
|
|
18039
|
+
"* When *X* is a vector:",
|
|
18508
18040
|
"",
|
|
18509
|
-
"*
|
|
18510
|
-
"*
|
|
18041
|
+
" * if *size* is specified, it divides *X* into a list of scalars (size=1) or vectors (size>1) of length *size*.",
|
|
18042
|
+
" * if *cutPositions* is specified, it divides *X* into a list of vectors at the specified positions.",
|
|
18043
|
+
"",
|
|
18044
|
+
"* When *X* is a matrix (table):",
|
|
18045
|
+
"",
|
|
18046
|
+
" * if *size* is specified, it divides *X* into several matrices (tables) with *size* columns (rows).",
|
|
18047
|
+
" * if *cutPositions* is specified, it divides *X* into several matrices (tables) at the specified positions.",
|
|
18511
18048
|
"",
|
|
18512
18049
|
"Refer to function :doc:`../f/flatten` for the reverse operation."
|
|
18513
18050
|
]
|
|
@@ -18546,6 +18083,34 @@
|
|
|
18546
18083
|
"",
|
|
18547
18084
|
" $ cut(a, 2 7);",
|
|
18548
18085
|
" ([3,4,5,6,7],[8,9,10])",
|
|
18086
|
+
"",
|
|
18087
|
+
" $ m=matrix(1 5 9, 12 20 23, 25 29 32)",
|
|
18088
|
+
" $ cut(m,2)",
|
|
18089
|
+
"",
|
|
18090
|
+
" (#0 #1",
|
|
18091
|
+
" -- --",
|
|
18092
|
+
" 1 12",
|
|
18093
|
+
" 5 20",
|
|
18094
|
+
" 9 23",
|
|
18095
|
+
" ,#0",
|
|
18096
|
+
" --",
|
|
18097
|
+
" 25",
|
|
18098
|
+
" 29",
|
|
18099
|
+
" 32",
|
|
18100
|
+
" )",
|
|
18101
|
+
"",
|
|
18102
|
+
" $ cut(m, 1 2)",
|
|
18103
|
+
" (#0",
|
|
18104
|
+
" --",
|
|
18105
|
+
" 12",
|
|
18106
|
+
" 20",
|
|
18107
|
+
" 23",
|
|
18108
|
+
" ,#0",
|
|
18109
|
+
" --",
|
|
18110
|
+
" 25",
|
|
18111
|
+
" 29",
|
|
18112
|
+
" 32",
|
|
18113
|
+
" )",
|
|
18549
18114
|
""
|
|
18550
18115
|
]
|
|
18551
18116
|
},
|
|
@@ -18899,6 +18464,8 @@
|
|
|
18899
18464
|
"|composite domain |COMPO |A vector. Each element of the vector is a database handle. |",
|
|
18900
18465
|
"+-----------------+---------------------+--------------------------------------------------------------------------------------------------------------------+",
|
|
18901
18466
|
"",
|
|
18467
|
+
"For a composite database, the vector can contain two or three elements and the length of the vector indicates the partition levels.",
|
|
18468
|
+
"",
|
|
18902
18469
|
"`locations` a tuple indicating the locations of each partition. The number of elements in the tuple should be the same as that of partitions determined by *partitionType* and *partitionScheme*. When saving partitions on multiple nodes, we can specify the location for each partition by using the DFS (Distributed File System) or the *locations* parameter. If the *locations* parameter is not specified, all partitions reside in the current node. We cannot specify partition locations for composite partitions.",
|
|
18903
18470
|
"",
|
|
18904
18471
|
"`engine` specifies the storage engine. It can be 'OLAP' or 'TSDB' and the default value is 'OLAP'. ",
|
|
@@ -21224,7 +20791,7 @@
|
|
|
21224
20791
|
{
|
|
21225
20792
|
"type": "text",
|
|
21226
20793
|
"value": [
|
|
21227
|
-
"deny(
|
|
20794
|
+
"deny(userId|groupId, accessType, [objs])"
|
|
21228
20795
|
]
|
|
21229
20796
|
}
|
|
21230
20797
|
]
|
|
@@ -21236,29 +20803,13 @@
|
|
|
21236
20803
|
{
|
|
21237
20804
|
"type": "text",
|
|
21238
20805
|
"value": [
|
|
21239
|
-
"`
|
|
21240
|
-
"",
|
|
21241
|
-
"`accessType` privileges of the following types:",
|
|
21242
|
-
"",
|
|
21243
|
-
"\\1. TABLE_READ: read table",
|
|
21244
|
-
"",
|
|
21245
|
-
"\\2. TABLE_WRITE: write to table",
|
|
21246
|
-
"",
|
|
21247
|
-
"\\3. DBOBJ_CREATE: create database objects (tables) in a database",
|
|
20806
|
+
"`userId` | `groupId` a string indicating a user name or a group name. ",
|
|
21248
20807
|
"",
|
|
21249
|
-
"
|
|
20808
|
+
"`accessType` is the type of privilege. ",
|
|
21250
20809
|
"",
|
|
21251
|
-
"
|
|
20810
|
+
"`objs` a string scalar/vector indicating the objects that the priviledges specified by *accessType* applies to. ",
|
|
21252
20811
|
"",
|
|
21253
|
-
"
|
|
21254
|
-
"",
|
|
21255
|
-
"\\7. DB_OWNER: create databases. For the databases she created, she can delete the databases, create or delete tables, create or delete partitions, grant/deny/revoke the following privileges of other users: TABLE_READ, TABLE_WRITE, DBOBJ_CREATE, DBOBJ_DELETE. ",
|
|
21256
|
-
"",
|
|
21257
|
-
"\\8. SCRIPT_EXEC: execute script ",
|
|
21258
|
-
"",
|
|
21259
|
-
"\\9. TEST_EXEC: execute testing script",
|
|
21260
|
-
"",
|
|
21261
|
-
"`objs` a string scalar/vector indicating the objects that the priviledges specified by accessType applies to. It is mandatory if accessType is TABLE_READ, TABLE_WRITE, DBOBJ_CREATE, DBOBJ_DELETE, or VIEW_EXEC. "
|
|
20812
|
+
"See the privilege table in :doc:`/SystemManagement/UserAccessControl` for the values that *accessType* and *objs* can take."
|
|
21262
20813
|
]
|
|
21263
20814
|
}
|
|
21264
20815
|
]
|
|
@@ -21270,7 +20821,9 @@
|
|
|
21270
20821
|
{
|
|
21271
20822
|
"type": "text",
|
|
21272
20823
|
"value": [
|
|
21273
|
-
"Deny specified access privileges to a user or a group
|
|
20824
|
+
"Deny specified access privileges to a user or a group. This command can only be executed by an administrator on the controller/data node.",
|
|
20825
|
+
"",
|
|
20826
|
+
"Note that when accessType is DB_OWNER, ``deny`` only takes effect globally."
|
|
21274
20827
|
]
|
|
21275
20828
|
}
|
|
21276
20829
|
]
|
|
@@ -23524,11 +23077,10 @@
|
|
|
23524
23077
|
"value": [
|
|
23525
23078
|
"`dbHandle` is a DolphinDB database handle. ",
|
|
23526
23079
|
"",
|
|
23527
|
-
"`partitionPaths` can be:",
|
|
23080
|
+
"`partitionPaths` can be specified in two ways:",
|
|
23528
23081
|
"",
|
|
23529
|
-
"*
|
|
23530
|
-
"",
|
|
23531
|
-
"* A filtering condition or a tuple of filtering conditions. Each filtering condition can be a scalar or a vector indicating one or multiple partitions. A tuple of filtering conditions is for composite partitions, with each level of a composite partition for an element of the tuple. If a level has no filtering conditions, the corresponding element in the tuple is empty. ",
|
|
23082
|
+
"* By path: partitionPaths is a string or a string vector indicating the path of one or multiple partitions. Each string must start with “/”. For composite partitions, the path must include all partition levels.",
|
|
23083
|
+
"* By condition: partitionPaths is a scalar or vector indicating the value(s) in the partitioning column. The system will drop all partitions containing these values. For composite partitions, *partitionPaths* is a tuple where each element is a filtering condition for each partition level (starting from the first level). If you do not want to apply filtering at a certain partition level, leave the corresponding element empty. ",
|
|
23532
23084
|
"",
|
|
23533
23085
|
"`tableName` is a string indicating a table name. It can be left empty if the database chunk granularity is at DATABASE level (i.e., :doc:`/FunctionsandCommands/FunctionReferences/d/database`: *chunkGranularity* = 'DATABASE'). Otherwise, it is a required parameter.",
|
|
23534
23086
|
"",
|
|
@@ -24903,15 +24455,15 @@
|
|
|
24903
24455
|
"value": [
|
|
24904
24456
|
"`table` is an empty shared stream table.",
|
|
24905
24457
|
"",
|
|
24906
|
-
"`asynWrite` is a Boolean value
|
|
24458
|
+
"`asynWrite` (optional) is a Boolean value indicating whether persistence is enabled in asynchronous mode. The default value is true, meaning asynchronous persistence is enabled. In this case, once data is written into memory, the write is deemed complete. The data stored in memory is then persisted to disk by another thread. ",
|
|
24907
24459
|
"",
|
|
24908
|
-
"`compress` is a Boolean value
|
|
24460
|
+
"`compress` (optional) is a Boolean value indicating whether to save a table to disk in compression mode. The default value is true.",
|
|
24909
24461
|
"",
|
|
24910
|
-
"`cacheSize`
|
|
24462
|
+
"`cacheSize` (optional) is an integer of LONG type specifying the maximum number of rows of the table to keep in memory. If it is 0 or unspecified (default -1), all rows are kept in memory. The minimum valid value for this parameter is 100,000.",
|
|
24911
24463
|
"",
|
|
24912
|
-
"`retentionMinutes` is an integer indicating for how long (in
|
|
24464
|
+
"`retentionMinutes` (optional) is an integer indicating for how long (in minutes) a log file will be kept after last update. The default value is 1440, which means the log file is kept for 1440 minutes, i.e., 1 day.",
|
|
24913
24465
|
"",
|
|
24914
|
-
"`flushMode` is an integer
|
|
24466
|
+
"`flushMode` (optional) is an integer indicating whether to enable synchronous disk flush. It can be 0 or 1. The persistence process first writes data from memory to the page cache, then flushes the cached data to disk. If flushMode is 0 (default), asynchronous disk flushing is enabled. In this case, once data is written from memory to the page cache, the flush is deemed complete and the next batch of data can be written to the table. If flushMode is set to 1, the current batch of data must be flushed to disk before the next batch can be written."
|
|
24915
24467
|
]
|
|
24916
24468
|
}
|
|
24917
24469
|
]
|
|
@@ -24923,9 +24475,11 @@
|
|
|
24923
24475
|
{
|
|
24924
24476
|
"type": "text",
|
|
24925
24477
|
"value": [
|
|
24926
|
-
"
|
|
24478
|
+
"This command enables a shared stream table to be persisted to disk. ",
|
|
24479
|
+
"",
|
|
24480
|
+
"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.",
|
|
24927
24481
|
"",
|
|
24928
|
-
"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
|
|
24482
|
+
"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.",
|
|
24929
24483
|
"",
|
|
24930
24484
|
"With asynchronous mode, table persistence is conducted by a single persistence worker (thread), and the persistence worker may handle multiple tables. If there is only one table to be persisted, an increase in the number of persistence workers doesn't improve performance.",
|
|
24931
24485
|
"",
|
|
@@ -24940,9 +24494,8 @@
|
|
|
24940
24494
|
{
|
|
24941
24495
|
"type": "text",
|
|
24942
24496
|
"value": [
|
|
24943
|
-
"
|
|
24944
|
-
""
|
|
24945
|
-
"If flushMode=0, smoe data may be lost after crash."
|
|
24497
|
+
"- It is recommended to invoke command :doc:`/FunctionsandCommands/CommandsReferences/f/fflush` to write data in the page cache to disk before you kill a DolphinDB process and restart it.",
|
|
24498
|
+
"- If asynchronous mode is enabled for data persistence or flush, data loss may occur due to server crash."
|
|
24946
24499
|
]
|
|
24947
24500
|
}
|
|
24948
24501
|
]
|
|
@@ -25039,17 +24592,17 @@
|
|
|
25039
24592
|
"",
|
|
25040
24593
|
"`tableName` is a string indicating the name of the shared table. ",
|
|
25041
24594
|
"",
|
|
25042
|
-
"`asynWrite` is a Boolean value
|
|
24595
|
+
"`asynWrite` (optional) is a Boolean value indicating whether persistence is enabled in asynchronous mode. The default value is true, meaning asynchronous persistence is enabled. In this case, once data is written into memory, the write is deemed complete. The data stored in memory is then persisted to disk by another thread. ",
|
|
25043
24596
|
"",
|
|
25044
|
-
"`compress` is a Boolean value
|
|
24597
|
+
"`compress` (optional) is a Boolean value indicating whether to save a table to disk in compression mode. The default value is true.",
|
|
25045
24598
|
"",
|
|
25046
|
-
"`cacheSize` is an integer
|
|
24599
|
+
"`cacheSize` (optional) is an integer of LONG type specifying the maximum number of rows of the table to keep in memory. If it is 0 or unspecified (default -1), all rows are kept in memory. The minimum valid value for this parameter is 100,000.",
|
|
25047
24600
|
"",
|
|
25048
|
-
"`retentionMinutes` is an integer indicating for how long (in
|
|
24601
|
+
"`retentionMinutes` (optional) is an integer indicating for how long (in minutes) a log file will be kept after last update. The default value is 1440, which means the log file is kept for 1440 minutes, i.e., 1 day.",
|
|
25049
24602
|
"",
|
|
25050
|
-
"`flushMode` is an integer
|
|
24603
|
+
"`flushMode` (optional) is an integer indicating whether to enable synchronous disk flush. It can be 0 or 1. The persistence process first writes data from memory to the page cache, then flushes the cached data to disk. If flushMode is 0 (default), asynchronous disk flushing is enabled. In this case, once data is written from memory to the page cache, the flush is deemed complete and the next batch of data can be written to the table. If flushMode is set to 1, the current batch of data must be flushed to disk before the next batch can be written.",
|
|
25051
24604
|
"",
|
|
25052
|
-
"`preCache` is an integer indicating the number of records to be loaded into memory from the persisted stream table on disk when DolphinDB restarts. If it is not specified, all records are loaded into memory when DolphinDB restarts."
|
|
24605
|
+
"`preCache` (optional) is an integer indicating the number of records to be loaded into memory from the persisted stream table on disk when DolphinDB restarts. If it is not specified, all records are loaded into memory when DolphinDB restarts."
|
|
25053
24606
|
]
|
|
25054
24607
|
}
|
|
25055
24608
|
]
|
|
@@ -25061,26 +24614,26 @@
|
|
|
25061
24614
|
{
|
|
25062
24615
|
"type": "text",
|
|
25063
24616
|
"value": [
|
|
25064
|
-
"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.
|
|
24617
|
+
"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.",
|
|
25065
24618
|
"",
|
|
25066
|
-
"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
|
|
24619
|
+
"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.",
|
|
25067
24620
|
"",
|
|
25068
24621
|
"With asynchronous mode, table persistence is conducted by a single persistence worker (thread), and the persistence worker may handle multiple tables. If there is only one table to be persisted, an increase in the number of persistence workers doesn't improve performance.",
|
|
25069
24622
|
"",
|
|
25070
|
-
"By default, a stream table keeps all data in memory. If the stream table is too large, the system may run out of memory. To avoid this problem, we can set a cache size limit. If the number of rows of the stream table reaches this limit, the first half of the table will be cleared from memory. "
|
|
24623
|
+
"By default, a stream table keeps all data in memory. If the stream table is too large, the system may run out of memory. To avoid this problem, we can set a cache size limit. If the number of rows of the stream table reaches this limit, the first half of the table will be cleared from memory. ",
|
|
24624
|
+
""
|
|
25071
24625
|
]
|
|
25072
24626
|
}
|
|
25073
24627
|
]
|
|
25074
24628
|
},
|
|
25075
24629
|
{
|
|
25076
|
-
"title": "
|
|
24630
|
+
"title": "note",
|
|
25077
24631
|
"children": [
|
|
25078
24632
|
{
|
|
25079
24633
|
"type": "text",
|
|
25080
24634
|
"value": [
|
|
25081
|
-
"
|
|
25082
|
-
""
|
|
25083
|
-
"If flushMode=0, some data may be lost after crash."
|
|
24635
|
+
"- It is recommended to invoke command :doc:`/FunctionsandCommands/CommandsReferences/f/fflush` to write data in the page cache to disk before you kill a DolphinDB process and restart it.",
|
|
24636
|
+
"- If asynchronous mode is enabled for data persistence or flush, data loss may occur due to server crash."
|
|
25084
24637
|
]
|
|
25085
24638
|
}
|
|
25086
24639
|
]
|
|
@@ -25208,6 +24761,80 @@
|
|
|
25208
24761
|
}
|
|
25209
24762
|
]
|
|
25210
24763
|
},
|
|
24764
|
+
"enlist": {
|
|
24765
|
+
"title": "enlist",
|
|
24766
|
+
"type": "function",
|
|
24767
|
+
"children": [
|
|
24768
|
+
{
|
|
24769
|
+
"title": "Syntax",
|
|
24770
|
+
"type": "grammer",
|
|
24771
|
+
"children": [
|
|
24772
|
+
{
|
|
24773
|
+
"type": "text",
|
|
24774
|
+
"value": [
|
|
24775
|
+
"enlist()"
|
|
24776
|
+
]
|
|
24777
|
+
}
|
|
24778
|
+
]
|
|
24779
|
+
},
|
|
24780
|
+
{
|
|
24781
|
+
"title": "Arguments",
|
|
24782
|
+
"type": "parameters",
|
|
24783
|
+
"children": [
|
|
24784
|
+
{
|
|
24785
|
+
"type": "text",
|
|
24786
|
+
"value": [
|
|
24787
|
+
"`X` can be of any data form."
|
|
24788
|
+
]
|
|
24789
|
+
}
|
|
24790
|
+
]
|
|
24791
|
+
},
|
|
24792
|
+
{
|
|
24793
|
+
"title": "Details",
|
|
24794
|
+
"type": "detail",
|
|
24795
|
+
"children": [
|
|
24796
|
+
{
|
|
24797
|
+
"type": "text",
|
|
24798
|
+
"value": [
|
|
24799
|
+
"Returns a vector or tuple composed of *X*.",
|
|
24800
|
+
"",
|
|
24801
|
+
"* If *X* is a scalar, returns a vector.",
|
|
24802
|
+
"",
|
|
24803
|
+
"* If *X* is a vector, tuple or of other data forms, returns a tuple."
|
|
24804
|
+
]
|
|
24805
|
+
}
|
|
24806
|
+
]
|
|
24807
|
+
},
|
|
24808
|
+
{
|
|
24809
|
+
"title": "Examples",
|
|
24810
|
+
"type": "example",
|
|
24811
|
+
"children": [
|
|
24812
|
+
{
|
|
24813
|
+
"type": "code",
|
|
24814
|
+
"language": "console",
|
|
24815
|
+
"value": [
|
|
24816
|
+
"",
|
|
24817
|
+
" $ enlist(1)",
|
|
24818
|
+
" [1]",
|
|
24819
|
+
"",
|
|
24820
|
+
" $ enlist(`aaa)",
|
|
24821
|
+
" [\"aaa\"]",
|
|
24822
|
+
"",
|
|
24823
|
+
" $ enlist([2022.01.01,2022.01.02,2022.01.03])",
|
|
24824
|
+
" ([2022.01.01,2022.01.02,2022.01.03])",
|
|
24825
|
+
"",
|
|
24826
|
+
" $ enlist([\"a\",2,3])",
|
|
24827
|
+
" ((\"a\",2,3))",
|
|
24828
|
+
"",
|
|
24829
|
+
" $ a = array(INT[], 0, 10).append!([1 2 3, 4 5,6 7 8, 9 NULL])",
|
|
24830
|
+
" $ enlist(a)",
|
|
24831
|
+
" ([[1,2,3],[4,5],[6,7,8],[9,00i]])"
|
|
24832
|
+
]
|
|
24833
|
+
}
|
|
24834
|
+
]
|
|
24835
|
+
}
|
|
24836
|
+
]
|
|
24837
|
+
},
|
|
25211
24838
|
"eq": {
|
|
25212
24839
|
"title": "eq",
|
|
25213
24840
|
"type": "function",
|
|
@@ -30014,7 +29641,12 @@
|
|
|
30014
29641
|
{
|
|
30015
29642
|
"type": "text",
|
|
30016
29643
|
"value": [
|
|
30017
|
-
"
|
|
29644
|
+
"The function returns a dictionary containing the information of DFS databases on the current node. The keys are the database names and the values are the table names, and the following numbers indicates the number of the table in this database (starting from 1), whether it has been deleted (1 means it has been deleted).",
|
|
29645
|
+
"",
|
|
29646
|
+
"From version 1.30.21/2.00.9 onwards, ",
|
|
29647
|
+
"",
|
|
29648
|
+
"- For an administrator or a non-admin user granted with DB_MANAGE privilege, the function returns all DFS databases on the current node; ",
|
|
29649
|
+
"- Otherwise, the function returns DFS databases to which the user is granted with the DB_OWNER privilege."
|
|
30018
29650
|
]
|
|
30019
29651
|
}
|
|
30020
29652
|
]
|
|
@@ -30596,8 +30228,28 @@
|
|
|
30596
30228
|
{
|
|
30597
30229
|
"type": "text",
|
|
30598
30230
|
"value": [
|
|
30599
|
-
"Return a list of the DFS databases in the cluster."
|
|
30231
|
+
"Return a list of the DFS databases in the cluster."
|
|
30232
|
+
]
|
|
30233
|
+
}
|
|
30234
|
+
]
|
|
30235
|
+
},
|
|
30236
|
+
{
|
|
30237
|
+
"title": "Examples",
|
|
30238
|
+
"type": "example",
|
|
30239
|
+
"children": [
|
|
30240
|
+
{
|
|
30241
|
+
"type": "code",
|
|
30242
|
+
"language": "console",
|
|
30243
|
+
"value": [
|
|
30600
30244
|
"",
|
|
30245
|
+
" $ getClusterDFSDatabases()",
|
|
30246
|
+
" [\"dfs://demohash\",\"dfs://myDataYesDB\",\"dfs://testDB\"]",
|
|
30247
|
+
""
|
|
30248
|
+
]
|
|
30249
|
+
},
|
|
30250
|
+
{
|
|
30251
|
+
"type": "text",
|
|
30252
|
+
"value": [
|
|
30601
30253
|
".. meta:: ",
|
|
30602
30254
|
" :keywords: get"
|
|
30603
30255
|
]
|
|
@@ -30641,8 +30293,34 @@
|
|
|
30641
30293
|
{
|
|
30642
30294
|
"type": "text",
|
|
30643
30295
|
"value": [
|
|
30644
|
-
"
|
|
30296
|
+
"The function returns a vector that lists DFS tables in the cluster.",
|
|
30297
|
+
"",
|
|
30298
|
+
"From version 1.30.21.3/2.00.9.3 onwards, ",
|
|
30645
30299
|
"",
|
|
30300
|
+
"- For an administrator, the function returns all DFS tables in the cluster; ",
|
|
30301
|
+
"- For a non-admin user, the function returns DFS tables that can be accessed by the user, i.e., the user has DB_OWNER, TABLE_READ, TABLE_WRITE, TABLE_INSERT, TABLE_UPDATE, TABLE_DELETE, DB_READ, DB_WRITE, DB_INSERT, DB_UPDATE, DB_DELETE priviliges. "
|
|
30302
|
+
]
|
|
30303
|
+
}
|
|
30304
|
+
]
|
|
30305
|
+
},
|
|
30306
|
+
{
|
|
30307
|
+
"title": "Examples",
|
|
30308
|
+
"type": "example",
|
|
30309
|
+
"children": [
|
|
30310
|
+
{
|
|
30311
|
+
"type": "code",
|
|
30312
|
+
"language": "console",
|
|
30313
|
+
"value": [
|
|
30314
|
+
"",
|
|
30315
|
+
" $ getClusterDFSTables()",
|
|
30316
|
+
" [\"dfs://demohash/pt\",\"dfs://myDataYesDB/tick\",\"dfs://testDB/pt1\",\"dfs://testDB/pt2\"]",
|
|
30317
|
+
"",
|
|
30318
|
+
""
|
|
30319
|
+
]
|
|
30320
|
+
},
|
|
30321
|
+
{
|
|
30322
|
+
"type": "text",
|
|
30323
|
+
"value": [
|
|
30646
30324
|
".. meta:: ",
|
|
30647
30325
|
" :keywords: get"
|
|
30648
30326
|
]
|
|
@@ -31152,8 +30830,7 @@
|
|
|
31152
30830
|
{
|
|
31153
30831
|
"type": "text",
|
|
31154
30832
|
"value": [
|
|
31155
|
-
"None"
|
|
31156
|
-
""
|
|
30833
|
+
"None"
|
|
31157
30834
|
]
|
|
31158
30835
|
}
|
|
31159
30836
|
]
|
|
@@ -31165,7 +30842,13 @@
|
|
|
31165
30842
|
{
|
|
31166
30843
|
"type": "text",
|
|
31167
30844
|
"value": [
|
|
31168
|
-
"
|
|
30845
|
+
"This function returns a vector that lists DFS databases on the current node.",
|
|
30846
|
+
"",
|
|
30847
|
+
"From version 1.30.21/2.00.9 onwards, ",
|
|
30848
|
+
"",
|
|
30849
|
+
"- For an administrator or a non-admin user granted with DB_MANAGE privilege, the function returns all DFS databases on the current node; ",
|
|
30850
|
+
"",
|
|
30851
|
+
"- Otherwise, the function returns DFS databases to which the user is granted with the DB_OWNER privilege."
|
|
31169
30852
|
]
|
|
31170
30853
|
}
|
|
31171
30854
|
]
|
|
@@ -31209,8 +30892,7 @@
|
|
|
31209
30892
|
{
|
|
31210
30893
|
"type": "text",
|
|
31211
30894
|
"value": [
|
|
31212
|
-
"`directory` the directory where a DFS database is located."
|
|
31213
|
-
""
|
|
30895
|
+
"`directory` the directory where a DFS database is located."
|
|
31214
30896
|
]
|
|
31215
30897
|
}
|
|
31216
30898
|
]
|
|
@@ -31222,8 +30904,33 @@
|
|
|
31222
30904
|
{
|
|
31223
30905
|
"type": "text",
|
|
31224
30906
|
"value": [
|
|
31225
|
-
"
|
|
30907
|
+
"This functions returns a vector that lists tables under the specified DFS directory.",
|
|
30908
|
+
"",
|
|
30909
|
+
"From version 1.30.21/2.00.9 onwards, ",
|
|
30910
|
+
"",
|
|
30911
|
+
"- For an administrator or a non-admin user granted with DB_MANAGE privilege, the function returns all DFS tables on the current node;",
|
|
30912
|
+
"- Otherwise, the function returns DFS tables in the databases to which the user is granted with DB_OWNER privilege."
|
|
30913
|
+
]
|
|
30914
|
+
}
|
|
30915
|
+
]
|
|
30916
|
+
},
|
|
30917
|
+
{
|
|
30918
|
+
"title": "Examples",
|
|
30919
|
+
"type": "example",
|
|
30920
|
+
"children": [
|
|
30921
|
+
{
|
|
30922
|
+
"type": "code",
|
|
30923
|
+
"language": "console",
|
|
30924
|
+
"value": [
|
|
31226
30925
|
"",
|
|
30926
|
+
" $ getDFSTablesByDatabase(\"dfs://db\")",
|
|
30927
|
+
" [\"dfs://db1/dt\", \"dfs://db1/dt1\"]",
|
|
30928
|
+
""
|
|
30929
|
+
]
|
|
30930
|
+
},
|
|
30931
|
+
{
|
|
30932
|
+
"type": "text",
|
|
30933
|
+
"value": [
|
|
31227
30934
|
".. meta:: ",
|
|
31228
30935
|
" :keywords: get"
|
|
31229
30936
|
]
|
|
@@ -33630,7 +33337,7 @@
|
|
|
33630
33337
|
"* ChunkPath: The DFS path of the chunk",
|
|
33631
33338
|
"* Source: The source node for data recovery",
|
|
33632
33339
|
"* Dest: The destination node for data recovery",
|
|
33633
|
-
"* Status: The status of the recovery task. It can be \"Waiting\", \"In-Progress\", and \"
|
|
33340
|
+
"* Status: The status of the recovery task. It can be \"Waiting\", \"In-Progress\", and \"Finished\" or \"Aborted\".",
|
|
33634
33341
|
"* AttemptCount: The number of recovery attempts that have been made",
|
|
33635
33342
|
"* DeleteSource: Whether to delete the replica on the source node. When TaskType is \"ChunkRecovery\", it is false. When TaskType is \"LoadRebalance\", it can be true or false.",
|
|
33636
33343
|
"* StartTime: The time when the recovery task is created.",
|
|
@@ -36084,118 +35791,6 @@
|
|
|
36084
35791
|
}
|
|
36085
35792
|
]
|
|
36086
35793
|
},
|
|
36087
|
-
"getUserAccess": {
|
|
36088
|
-
"title": "getUserAccess",
|
|
36089
|
-
"type": "function",
|
|
36090
|
-
"children": [
|
|
36091
|
-
{
|
|
36092
|
-
"title": "Syntax",
|
|
36093
|
-
"type": "grammer",
|
|
36094
|
-
"children": [
|
|
36095
|
-
{
|
|
36096
|
-
"type": "text",
|
|
36097
|
-
"value": [
|
|
36098
|
-
"getUserAccess([userIds])"
|
|
36099
|
-
]
|
|
36100
|
-
}
|
|
36101
|
-
]
|
|
36102
|
-
},
|
|
36103
|
-
{
|
|
36104
|
-
"title": "Arguments",
|
|
36105
|
-
"type": "parameters",
|
|
36106
|
-
"children": [
|
|
36107
|
-
{
|
|
36108
|
-
"type": "text",
|
|
36109
|
-
"value": [
|
|
36110
|
-
"`userId` a string scalar/vector indicating one or multiple user names."
|
|
36111
|
-
]
|
|
36112
|
-
}
|
|
36113
|
-
]
|
|
36114
|
-
},
|
|
36115
|
-
{
|
|
36116
|
-
"title": "Details",
|
|
36117
|
-
"type": "detail",
|
|
36118
|
-
"children": [
|
|
36119
|
-
{
|
|
36120
|
-
"type": "text",
|
|
36121
|
-
"value": [
|
|
36122
|
-
"Return a table of privileges for individual users, without taking into account the privileges for the groups the users belong to. When userId is unspecified, return the privileges for the current user. ",
|
|
36123
|
-
"",
|
|
36124
|
-
"Only administrators can use this function to get other users' privileges.",
|
|
36125
|
-
"",
|
|
36126
|
-
"The columns returned are explained below:",
|
|
36127
|
-
"",
|
|
36128
|
-
"+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
|
|
36129
|
-
"| Column | Details |",
|
|
36130
|
-
"+===================+==============================================================================================================================================================================+",
|
|
36131
|
-
"| userId | The name of the user |",
|
|
36132
|
-
"+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
|
|
36133
|
-
"| groups | The groups to which the user belong |",
|
|
36134
|
-
"+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
|
|
36135
|
-
"| isAdmin | Whether the user is an administrator |",
|
|
36136
|
-
"+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
|
|
36137
|
-
"| MAX_JOB_PRIORITY | An integer between 0 and 8 indicating the highest priority of the jobs submitted by the user. Specified by the command setMaxJobPriority. |",
|
|
36138
|
-
"+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
|
|
36139
|
-
"| MAX_PARALLELISM | An integer indicating the maximum number of subjobs that can be executed in parallel for a job submitted by the user. It is specified by the command setMaxJobParallelism. |",
|
|
36140
|
-
"+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
|
|
36141
|
-
"",
|
|
36142
|
-
"The 9 columns display the user's access privileges (“allow“, “none“ or “deny“ for each of them) together with the specific objects (tables, views or databases) that the user is granted/denied access to. ",
|
|
36143
|
-
"",
|
|
36144
|
-
"+--------------------------+",
|
|
36145
|
-
"| User's Access Privilege |",
|
|
36146
|
-
"+==========================+",
|
|
36147
|
-
"| TABLE_READ |",
|
|
36148
|
-
"+--------------------------+",
|
|
36149
|
-
"| TABLE_WRITE |",
|
|
36150
|
-
"+--------------------------+",
|
|
36151
|
-
"| VIEW_EXEC |",
|
|
36152
|
-
"+--------------------------+",
|
|
36153
|
-
"| SCRIPT_EXEC |",
|
|
36154
|
-
"+--------------------------+",
|
|
36155
|
-
"| TEST_EXEC |",
|
|
36156
|
-
"+--------------------------+",
|
|
36157
|
-
"| DBOBJ_CREATE |",
|
|
36158
|
-
"+--------------------------+",
|
|
36159
|
-
"| DBOBJ_DELETE |",
|
|
36160
|
-
"+--------------------------+",
|
|
36161
|
-
"| DB_MANAGE |",
|
|
36162
|
-
"+--------------------------+",
|
|
36163
|
-
"| DB_OWNER |",
|
|
36164
|
-
"+--------------------------+",
|
|
36165
|
-
"",
|
|
36166
|
-
"",
|
|
36167
|
-
"The rest columns display the specific objects (tables, views or databases) that the user is granted/denied access to. ",
|
|
36168
|
-
"",
|
|
36169
|
-
"+------------------------+",
|
|
36170
|
-
"| Objects |",
|
|
36171
|
-
"+========================+",
|
|
36172
|
-
"| TABLE_READ_allowed |",
|
|
36173
|
-
"+------------------------+",
|
|
36174
|
-
"| TABLE_READ_denied |",
|
|
36175
|
-
"+------------------------+",
|
|
36176
|
-
"| TABLE_WRITE_allowed |",
|
|
36177
|
-
"+------------------------+",
|
|
36178
|
-
"| TABLE_WRITE_denied |",
|
|
36179
|
-
"+------------------------+",
|
|
36180
|
-
"| VIEW_EXEC_allowed |",
|
|
36181
|
-
"+------------------------+",
|
|
36182
|
-
"| VIEW_EXEC_denied |",
|
|
36183
|
-
"+------------------------+",
|
|
36184
|
-
"| DBOBJ_CREATE_allowed |",
|
|
36185
|
-
"+------------------------+",
|
|
36186
|
-
"| DBOBJ_CREATE_denied |",
|
|
36187
|
-
"+------------------------+",
|
|
36188
|
-
"| DBOBJ_DELETE_allowed |",
|
|
36189
|
-
"+------------------------+",
|
|
36190
|
-
"| DBOBJ_DELETE_denied |",
|
|
36191
|
-
"+------------------------+",
|
|
36192
|
-
""
|
|
36193
|
-
]
|
|
36194
|
-
}
|
|
36195
|
-
]
|
|
36196
|
-
}
|
|
36197
|
-
]
|
|
36198
|
-
},
|
|
36199
35794
|
"getUserList": {
|
|
36200
35795
|
"title": "getUserList",
|
|
36201
35796
|
"type": "function",
|
|
@@ -36722,7 +36317,7 @@
|
|
|
36722
36317
|
{
|
|
36723
36318
|
"type": "text",
|
|
36724
36319
|
"value": [
|
|
36725
|
-
"grant(
|
|
36320
|
+
"grant(userId|groupId, accessType, [objs])"
|
|
36726
36321
|
]
|
|
36727
36322
|
}
|
|
36728
36323
|
]
|
|
@@ -36734,29 +36329,13 @@
|
|
|
36734
36329
|
{
|
|
36735
36330
|
"type": "text",
|
|
36736
36331
|
"value": [
|
|
36737
|
-
"`
|
|
36738
|
-
"",
|
|
36739
|
-
"`accessType` privileges of the following types:",
|
|
36740
|
-
"",
|
|
36741
|
-
"\\1. TABLE_READ: read table",
|
|
36742
|
-
"",
|
|
36743
|
-
"\\2. TABLE_WRITE: write to table",
|
|
36744
|
-
"",
|
|
36745
|
-
"\\3. DBOBJ_CREATE: create database objects (tables) in a database",
|
|
36746
|
-
"",
|
|
36747
|
-
"\\4. DBOBJ_DELETE: delete database objects (tables) in a database",
|
|
36748
|
-
"",
|
|
36749
|
-
"\\5. VIEW_EXEC: execute view functions",
|
|
36332
|
+
"`userId` | `groupId` a string indicating a user name or a group name. ",
|
|
36750
36333
|
"",
|
|
36751
|
-
"
|
|
36334
|
+
"`accessType` is the type of privilege. ",
|
|
36752
36335
|
"",
|
|
36753
|
-
"
|
|
36336
|
+
"`objs` a string scalar/vector indicating the objects that the priviledges specified by *accessType* applies to. ",
|
|
36754
36337
|
"",
|
|
36755
|
-
"
|
|
36756
|
-
"",
|
|
36757
|
-
"\\9. TEST_EXEC: execute testing script",
|
|
36758
|
-
"",
|
|
36759
|
-
"`objs` a string scalar/vector indicating the objects that the priviledges specified by `accessType` applies to. It is mandatory if `accessType` is TABLE_READ, TABLE_WRITE, DBOBJ_CREATE, DBOBJ_DELETE, or VIEW_EXEC."
|
|
36338
|
+
"See the privilege table in :doc:`/SystemManagement/UserAccessControl` for the values that *accessType* and *objs* can take."
|
|
36760
36339
|
]
|
|
36761
36340
|
}
|
|
36762
36341
|
]
|
|
@@ -36768,7 +36347,13 @@
|
|
|
36768
36347
|
{
|
|
36769
36348
|
"type": "text",
|
|
36770
36349
|
"value": [
|
|
36771
|
-
"Grant
|
|
36350
|
+
"- Grant a user or group with the specified privilege. ",
|
|
36351
|
+
"",
|
|
36352
|
+
"Note: You can grant a user DB_OWNER privilege while restricting the user to creating and managing databases with specific prefixes only. This cannot be removed by `deny` or `revoke`.",
|
|
36353
|
+
"",
|
|
36354
|
+
"- Set the memory limit of a query result (when *accessType* = QUERY_RESULT_MEM_LIMIT) or the memory limit of a task group (when *accessType* = TASK_GROUP_MEM_LIMIT) for a user. Different from commands :doc:`/FunctionsandCommands/CommandsReferences/s/setMemLimitOfQueryResult` and :doc:`/FunctionsandCommands/CommandsReferences/s/setMemLimitOfTaskGroupResult`, ``grant`` only applies to the specified user (group is not supported). You can use ``revoke`` to remove the memory limit set with ``grant``.",
|
|
36355
|
+
"",
|
|
36356
|
+
"This command can only be executed by an administrator on the controller or data node."
|
|
36772
36357
|
]
|
|
36773
36358
|
}
|
|
36774
36359
|
]
|
|
@@ -36869,7 +36454,39 @@
|
|
|
36869
36454
|
"language": "console",
|
|
36870
36455
|
"value": [
|
|
36871
36456
|
"",
|
|
36872
|
-
" $ grant(\"AlexSmith\", TEST_EXEC)"
|
|
36457
|
+
" $ grant(\"AlexSmith\", TEST_EXEC)",
|
|
36458
|
+
""
|
|
36459
|
+
]
|
|
36460
|
+
},
|
|
36461
|
+
{
|
|
36462
|
+
"type": "text",
|
|
36463
|
+
"value": [
|
|
36464
|
+
"Set the memory limit of query result to 4 GB for the user \"AlexSmith\".",
|
|
36465
|
+
""
|
|
36466
|
+
]
|
|
36467
|
+
},
|
|
36468
|
+
{
|
|
36469
|
+
"type": "code",
|
|
36470
|
+
"language": "console",
|
|
36471
|
+
"value": [
|
|
36472
|
+
" ",
|
|
36473
|
+
" $ grant(\"AlexSmith\", QUERY_RESULT_MEM_LIMIT, 4)",
|
|
36474
|
+
" "
|
|
36475
|
+
]
|
|
36476
|
+
},
|
|
36477
|
+
{
|
|
36478
|
+
"type": "text",
|
|
36479
|
+
"value": [
|
|
36480
|
+
"Grant user \"AlexSmith\" the privilege to create and manage databases with prefix \"dbxxx\" where xxx is from 000 to 099.",
|
|
36481
|
+
""
|
|
36482
|
+
]
|
|
36483
|
+
},
|
|
36484
|
+
{
|
|
36485
|
+
"type": "code",
|
|
36486
|
+
"language": "console",
|
|
36487
|
+
"value": [
|
|
36488
|
+
" ",
|
|
36489
|
+
" $ grant(\"AlexSmith\", DB_OWNER, \"dfs://db0*\")"
|
|
36873
36490
|
]
|
|
36874
36491
|
}
|
|
36875
36492
|
]
|
|
@@ -46312,7 +45929,7 @@
|
|
|
46312
45929
|
" * If `lb` or `ub` is a scalar, all elements of *x* are subject to the same lower bound or upper bound constraint. If `lb` or `ub` is NULL, there is no lower bound or upper bound constraint for *x*.",
|
|
46313
45930
|
" * If `lb` or `ub` is a vector, an element of *x* is subject to the lower bound or upper bound constraint specified by the corresponding element of `lb` or `ub`.",
|
|
46314
45931
|
"",
|
|
46315
|
-
"`method` is a string indicating the optimization algorithm. It can be either 'simplex' or 'interior-point'.
|
|
45932
|
+
"`method` is a string indicating the optimization algorithm. It can be either 'simplex' (recommended) or 'interior-point'. "
|
|
46316
45933
|
]
|
|
46317
45934
|
}
|
|
46318
45935
|
]
|
|
@@ -50707,7 +50324,7 @@
|
|
|
50707
50324
|
{
|
|
50708
50325
|
"type": "text",
|
|
50709
50326
|
"value": [
|
|
50710
|
-
"Combine the specified *args* as a BLOB scalar or vector, so it can used as the key(s) of a dictionary or a set."
|
|
50327
|
+
"Combine the specified *args* as a BLOB scalar or vector, so it can used as the key(s) of a dictionary or a set. Compared with `makeSortedKey`, `makeKey` keeps the order of the inputs in the result."
|
|
50711
50328
|
]
|
|
50712
50329
|
}
|
|
50713
50330
|
]
|
|
@@ -50748,15 +50365,15 @@
|
|
|
50748
50365
|
{
|
|
50749
50366
|
"type": "text",
|
|
50750
50367
|
"value": [
|
|
50751
|
-
"Related Function: :doc:`
|
|
50368
|
+
"Related Function: :doc:`makeSortedKey`"
|
|
50752
50369
|
]
|
|
50753
50370
|
}
|
|
50754
50371
|
]
|
|
50755
50372
|
}
|
|
50756
50373
|
]
|
|
50757
50374
|
},
|
|
50758
|
-
"
|
|
50759
|
-
"title": "
|
|
50375
|
+
"makeSortedKey": {
|
|
50376
|
+
"title": "makeSortedKey",
|
|
50760
50377
|
"type": "function",
|
|
50761
50378
|
"children": [
|
|
50762
50379
|
{
|
|
@@ -50766,7 +50383,7 @@
|
|
|
50766
50383
|
{
|
|
50767
50384
|
"type": "text",
|
|
50768
50385
|
"value": [
|
|
50769
|
-
"
|
|
50386
|
+
"makeSortedKey(args...)"
|
|
50770
50387
|
]
|
|
50771
50388
|
}
|
|
50772
50389
|
]
|
|
@@ -50790,7 +50407,7 @@
|
|
|
50790
50407
|
{
|
|
50791
50408
|
"type": "text",
|
|
50792
50409
|
"value": [
|
|
50793
|
-
"Combine the specified *args* as a BLOB scalar or vector.
|
|
50410
|
+
"Combine the specified *args* as a BLOB scalar or vector. `makeSortedKey` stores the keys in sorted order internally, while returns the same result as `makeKey`."
|
|
50794
50411
|
]
|
|
50795
50412
|
}
|
|
50796
50413
|
]
|
|
@@ -50815,12 +50432,10 @@
|
|
|
50815
50432
|
"language": "console",
|
|
50816
50433
|
"value": [
|
|
50817
50434
|
"",
|
|
50818
|
-
" $
|
|
50819
|
-
"
|
|
50820
|
-
"",
|
|
50821
|
-
" $ set(makeOrderedKey(1 2, 4 5))",
|
|
50435
|
+
" $ makeSortedKey([`b,`a,`c], [`4,`2,`1]) ",
|
|
50436
|
+
" [\"b4\",\"a2\",\"c1\"]",
|
|
50822
50437
|
"",
|
|
50823
|
-
" $
|
|
50438
|
+
" $ set(makeSortedKey(1 2, 4 5)) ",
|
|
50824
50439
|
""
|
|
50825
50440
|
]
|
|
50826
50441
|
},
|
|
@@ -51467,12 +51082,12 @@
|
|
|
51467
51082
|
"========== ====== =======",
|
|
51468
51083
|
"label col1 col2 ",
|
|
51469
51084
|
"========== ====== =======",
|
|
51470
|
-
"2020.
|
|
51471
|
-
"2020.
|
|
51472
|
-
"2020.
|
|
51473
|
-
"2020.
|
|
51474
|
-
"2020.
|
|
51475
|
-
"2020.
|
|
51085
|
+
"2020.01.06 1 9 ",
|
|
51086
|
+
"2020.01.07 1 9 ",
|
|
51087
|
+
"2020.01.09 4 ",
|
|
51088
|
+
"2020.01.11 4 10 ",
|
|
51089
|
+
"2020.01.12 8 10 ",
|
|
51090
|
+
"2020.01.15 6 2 ",
|
|
51476
51091
|
"========== ====== =======",
|
|
51477
51092
|
""
|
|
51478
51093
|
]
|
|
@@ -51492,12 +51107,12 @@
|
|
|
51492
51107
|
"========== ======= =======",
|
|
51493
51108
|
"label col1 col2 ",
|
|
51494
51109
|
"========== ======= =======",
|
|
51495
|
-
"2020.
|
|
51496
|
-
"2020.
|
|
51497
|
-
"2020.
|
|
51498
|
-
"2020.
|
|
51499
|
-
"2020.
|
|
51500
|
-
"2020.
|
|
51110
|
+
"2020.01.06 1 9 ",
|
|
51111
|
+
"2020.01.07 1 9 ",
|
|
51112
|
+
"2020.01.09 2.5 9 ",
|
|
51113
|
+
"2020.01.11 2.5 9.5 ",
|
|
51114
|
+
"2020.01.12 4.3333 9.5 ",
|
|
51115
|
+
"2020.01.15 6 6 ",
|
|
51501
51116
|
"========== ======= =======",
|
|
51502
51117
|
"",
|
|
51503
51118
|
"Related functions: :doc:`../a/avg`"
|
|
@@ -71184,7 +70799,7 @@
|
|
|
71184
70799
|
"\"N\" nanosecond",
|
|
71185
70800
|
"=========================== =================================",
|
|
71186
70801
|
"",
|
|
71187
|
-
"The strings above can also be used with integers for parameter `rule` . For example, \"2M\" means
|
|
70802
|
+
"The strings above can also be used with integers for parameter `rule` . For example, \"2M\" means the end of every two months. In addition, *rule* can also be set as the identifier of the trading calendar, e.g., the Market Identifier Code of an exchange, or a user-defined calendar name.",
|
|
71188
70803
|
"",
|
|
71189
70804
|
"`func` is an aggregate function. ",
|
|
71190
70805
|
"",
|
|
@@ -71218,9 +70833,7 @@
|
|
|
71218
70833
|
{
|
|
71219
70834
|
"type": "text",
|
|
71220
70835
|
"value": [
|
|
71221
|
-
"Apply func to X based on the frenquency as specified in rule."
|
|
71222
|
-
"",
|
|
71223
|
-
"This function was released in version 1.30.0. "
|
|
70836
|
+
"Apply func to X based on the frenquency (or the trading calendar) as specified in *rule*. Note that when *rule* is specified as the identifier of the trading calendar, data generated on a non-trading day will be calculated in the previous trading day."
|
|
71224
70837
|
]
|
|
71225
70838
|
}
|
|
71226
70839
|
]
|
|
@@ -72431,7 +72044,7 @@
|
|
|
72431
72044
|
{
|
|
72432
72045
|
"type": "text",
|
|
72433
72046
|
"value": [
|
|
72434
|
-
"revoke(
|
|
72047
|
+
"revoke(userId|groupId, accessType, [objs])"
|
|
72435
72048
|
]
|
|
72436
72049
|
}
|
|
72437
72050
|
]
|
|
@@ -72443,29 +72056,13 @@
|
|
|
72443
72056
|
{
|
|
72444
72057
|
"type": "text",
|
|
72445
72058
|
"value": [
|
|
72446
|
-
"`
|
|
72447
|
-
"",
|
|
72448
|
-
"`accessType` privileges of the following types:",
|
|
72449
|
-
"",
|
|
72450
|
-
"\\1. TABLE_READ: read table",
|
|
72451
|
-
"",
|
|
72452
|
-
"\\2. TABLE_WRITE: write to table",
|
|
72453
|
-
"",
|
|
72454
|
-
"\\3. DBOBJ_CREATE: create database objects (tables) in a database",
|
|
72455
|
-
"",
|
|
72456
|
-
"\\4. DBOBJ_DELETE: delete database objects (tables) in a database",
|
|
72457
|
-
"",
|
|
72458
|
-
"\\5. VIEW_EXEC: execute view functions",
|
|
72459
|
-
"",
|
|
72460
|
-
"\\6. DB_MANAGE: delete databases",
|
|
72059
|
+
"`userId` | `groupId` a string indicating a user name or a group name. ",
|
|
72461
72060
|
"",
|
|
72462
|
-
"
|
|
72061
|
+
"`accessType` is the type of privilege. ",
|
|
72463
72062
|
"",
|
|
72464
|
-
"
|
|
72063
|
+
"`objs` a string scalar/vector indicating the objects that the priviledges specified by *accessType* applies to. ",
|
|
72465
72064
|
"",
|
|
72466
|
-
"
|
|
72467
|
-
"",
|
|
72468
|
-
"`objs` a string scalar/vector indicating the objects that the priviledges specified by accessType applies to. It is mandatory if accessType is TABLE_READ, TABLE_WRITE, DBOBJ_CREATE, DBOBJ_DELETE, or VIEW_EXEC. "
|
|
72065
|
+
"See the privilege table in :doc:`/SystemManagement/UserAccessControl` for the values that *accessType* and *objs* can take."
|
|
72469
72066
|
]
|
|
72470
72067
|
}
|
|
72471
72068
|
]
|
|
@@ -72477,7 +72074,11 @@
|
|
|
72477
72074
|
{
|
|
72478
72075
|
"type": "text",
|
|
72479
72076
|
"value": [
|
|
72480
|
-
"
|
|
72077
|
+
"- Revokes specified access privileges to a user or a group of users that were previously granted or denied. ",
|
|
72078
|
+
"",
|
|
72079
|
+
"- Removes the memory limit that was previously set for a specific user. It includes the memory limit of a query result (when *accessType* = QUERY_RESULT_MEM_LIMIT) and the memory limit of a task group (when *accessType* = TASK_GROUP_MEM_LIMIT). The memory limit will be reverted to the default memory limit configured in the system.",
|
|
72080
|
+
"",
|
|
72081
|
+
"This command can only be executed by an administrator on the controller or data node."
|
|
72481
72082
|
]
|
|
72482
72083
|
}
|
|
72483
72084
|
]
|
|
@@ -85947,7 +85548,11 @@
|
|
|
85947
85548
|
"",
|
|
85948
85549
|
"`offset` an integer indicating the position of the first message where the subscription begins. A message is a row of the stream table. Offset is relative to the first row of the stream table when it is created. If offset is unspecified or -1, the subscription starts with the next new message. If offset=-2, the system will get the persisted offset on disk and start subscription from there. If some rows were cleared from memory due to cache size limit, they are still considered in determining where the subscription starts.",
|
|
85949
85550
|
"",
|
|
85950
|
-
"`handler` a unary function or a table
|
|
85551
|
+
"`handler` is a unary function, binary function or a table, which is used to process the subscribed data.",
|
|
85552
|
+
"",
|
|
85553
|
+
"- If *handler* is a unary function, the only parameter of the function is the subscribed data, which can be a table or a tuple of the subscribed table columns. ",
|
|
85554
|
+
"- The *handler* must be specified as a binary function when *handlerNeedMsgId* = true. The parameters of the function are *msgBody* and *msgId*. For more details, see parameter *handlerNeedMsgId*.",
|
|
85555
|
+
"- If *handler* is a table, and the subscribed data is inserted into the table directly. It supports the streaming engine, shared table (including stream table, in-memory table, keyed table, indexed table), and DFS table.",
|
|
85951
85556
|
"",
|
|
85952
85557
|
"`msgAsTable` a Boolean value indicating whether the subscribed data is ingested into handler as a table or as a tuple. If msgAsTable=true, the subscribed data is ingested into handler as a table and can be processed with SQL statements. The default value is false, which means the subscribed data is ingested into handler as a tuple of columns.",
|
|
85953
85558
|
"",
|
|
@@ -85990,7 +85595,10 @@
|
|
|
85990
85595
|
"",
|
|
85991
85596
|
"`timeTrigger` a Boolean value. If it is set to true, handler is triggered at the intervals specified by parameter throttle even if no new messages arrive. The default value is false.",
|
|
85992
85597
|
"",
|
|
85993
|
-
"`handlerNeedMsgId` a Boolean value.
|
|
85598
|
+
"`handlerNeedMsgId` is a Boolean value. The default value is false.",
|
|
85599
|
+
"",
|
|
85600
|
+
"- If it is true, the parameter *handler* must support 2 parameters: *msgBody* (the messages to be ingested into the streaming engine) and *msgId* (the ID of the last message that has been ingested into the streaming engine). You can pass the ``appendMsg`` function to the handler after fixing the engine parameter using partial application.",
|
|
85601
|
+
"- If it is false, *handler* must support just 1 parameter: *msgBody*. ",
|
|
85994
85602
|
"",
|
|
85995
85603
|
"`raftGroup` the ID of raft group used to enable high availability on the subscriber. If the leader node of a raft group is changed after setting the parameter *raftGroup*, the new leader will resubscribe to the stream table.",
|
|
85996
85604
|
"",
|
|
@@ -87892,15 +87500,17 @@
|
|
|
87892
87500
|
{
|
|
87893
87501
|
"type": "text",
|
|
87894
87502
|
"value": [
|
|
87895
|
-
"For the first scenario:
|
|
87503
|
+
"For the first scenario: ",
|
|
87504
|
+
"",
|
|
87505
|
+
"`X`, `X1`, `X2` ... can be vectors, matrices or tuples. ",
|
|
87896
87506
|
"",
|
|
87897
87507
|
"For the second scenario:",
|
|
87898
87508
|
"",
|
|
87899
|
-
"`capacity` is the amount of memory (in terms of the number of rows) allocated to the table. When the number of rows exceeds capacity, the system will first allocate memory of 1.2~2 times of capacity, copy the data to the new memory space, and release the original memory. For large tables, these steps may use significant amount of memory.",
|
|
87509
|
+
"`capacity` is a positive integer indicating the amount of memory (in terms of the number of rows) allocated to the table. When the number of rows exceeds capacity, the system will first allocate memory of 1.2~2 times of capacity, copy the data to the new memory space, and release the original memory. For large tables, these steps may use significant amount of memory.",
|
|
87900
87510
|
"",
|
|
87901
|
-
"`size` is the initial size (in terms of the number of rows) of the table. If size=0, create an empty table.",
|
|
87511
|
+
"`size` is a positive integer indicating the initial size (in terms of the number of rows) of the table. If size = 0, create an empty table. Note that if *colTypes* is specified as an array vector, *size* must be 0.",
|
|
87902
87512
|
"",
|
|
87903
|
-
"`colNames`
|
|
87513
|
+
"`colNames` is a string vector of column names.",
|
|
87904
87514
|
"",
|
|
87905
87515
|
"`colTypes` is a string vector of data types. It can use either the reserved words for data types or corresponding strings."
|
|
87906
87516
|
]
|
|
@@ -87914,7 +87524,20 @@
|
|
|
87914
87524
|
{
|
|
87915
87525
|
"type": "text",
|
|
87916
87526
|
"value": [
|
|
87917
|
-
"
|
|
87527
|
+
"* For the first scenario: ",
|
|
87528
|
+
"",
|
|
87529
|
+
"Converts vectors/matrices/tuples, or the combination of vectors and tuples into a table.",
|
|
87530
|
+
"",
|
|
87531
|
+
"Note:",
|
|
87532
|
+
"",
|
|
87533
|
+
"* If *Xk* is a regular tuple, its elements must be vectors of equal length which is the number of rows of the table. Each element of the tuple is treated as a column of the table.",
|
|
87534
|
+
"* If *Xk* is a columnar tuple, its elements can be of unequal length, but the number of its elements must be the same as the number of rows in the table. Xk is converted into a single column (of ANY type) of the table, and each element is stored as the value of each row.",
|
|
87535
|
+
"",
|
|
87536
|
+
"Regular tuples with elements of unequal length are stored as columnar tuples in DolphinDB. For tuples with elements of equal length, to store each element by row, you must convert them to columnar tuples with the ``setColumnarTuple!`` function. ",
|
|
87537
|
+
"",
|
|
87538
|
+
"* For the second scenario: ",
|
|
87539
|
+
"",
|
|
87540
|
+
"Creates an empty or initialized table of a fixed data type."
|
|
87918
87541
|
]
|
|
87919
87542
|
}
|
|
87920
87543
|
]
|
|
@@ -88957,8 +88580,17 @@
|
|
|
88957
88580
|
"",
|
|
88958
88581
|
"`duration` is an integer.",
|
|
88959
88582
|
"",
|
|
88960
|
-
"`unit` is a STRING vector
|
|
88961
|
-
"
|
|
88583
|
+
"`unit` is a STRING vector. ",
|
|
88584
|
+
"",
|
|
88585
|
+
"* When parameter *duration* is an integer, *unit* is: ",
|
|
88586
|
+
"",
|
|
88587
|
+
" * the unit of parameter *duration*. It can be “ns”(nanosecond), “us”(microsecond), “ms”( millisecond), “s”(second), “m”(minute), “H”(hour), “d”(day), “w”(week), “M”(month), “y”( year), or “B”(business day). ",
|
|
88588
|
+
"",
|
|
88589
|
+
" * the identifier of trading calendar, e.g., the Market Identifier Code of an exchange, or a user-defined calendar name. The corresponding file must be saved in *marketHolidayDir*.",
|
|
88590
|
+
"",
|
|
88591
|
+
"* When *duration* is of DURATION type, this parameter is not required.",
|
|
88592
|
+
"",
|
|
88593
|
+
"Note: When *unit* is “y” or “M”, the result is consistent with mysql. Pandas provides an offset object `Dateoffsets` to move dates forward a given number of valid dates. When the *DateOffset* parameter is specified as months or years, the result is also consistent with `temporalAdd`."
|
|
88962
88594
|
]
|
|
88963
88595
|
}
|
|
88964
88596
|
]
|
|
@@ -89025,6 +88657,24 @@
|
|
|
89025
88657
|
""
|
|
89026
88658
|
]
|
|
89027
88659
|
},
|
|
88660
|
+
{
|
|
88661
|
+
"type": "text",
|
|
88662
|
+
"value": [
|
|
88663
|
+
"Add 2 trading days for “date” according to the trading calendar CFFEX.",
|
|
88664
|
+
""
|
|
88665
|
+
]
|
|
88666
|
+
},
|
|
88667
|
+
{
|
|
88668
|
+
"type": "code",
|
|
88669
|
+
"language": "console",
|
|
88670
|
+
"value": [
|
|
88671
|
+
"",
|
|
88672
|
+
" $ date=[2023.01.01, 2023.01.02, 2023.01.03, 2023.01.04]",
|
|
88673
|
+
" $ temporalAdd(date,2,`CFFEX)",
|
|
88674
|
+
" [2023.01.04,2023.01.04,2023.01.05,2023.01.06]",
|
|
88675
|
+
""
|
|
88676
|
+
]
|
|
88677
|
+
},
|
|
89028
88678
|
{
|
|
89029
88679
|
"type": "code",
|
|
89030
88680
|
"language": "console",
|
|
@@ -93411,7 +93061,7 @@
|
|
|
93411
93061
|
"\"N\" nanosecond",
|
|
93412
93062
|
"=========================== =================================",
|
|
93413
93063
|
"",
|
|
93414
|
-
"The strings above can also be used with integers for parameter `rule`. For example, \"2M\" means
|
|
93064
|
+
"The strings above can also be used with integers for parameter `rule`. For example, \"2M\" means the end of every two months. In addition, *rule* can also be set as the identifier of the trading calendar, e.g., the Market Identifier Code of an exchange, or a user-defined calendar name.",
|
|
93415
93065
|
"",
|
|
93416
93066
|
"`closed` is a string indicating which boundary of the interval is closed.",
|
|
93417
93067
|
"",
|
|
@@ -94898,7 +94548,11 @@
|
|
|
94898
94548
|
"",
|
|
94899
94549
|
"or",
|
|
94900
94550
|
"",
|
|
94901
|
-
"unionAll(tables, [partition=true], [byColName=false])"
|
|
94551
|
+
"unionAll(tables, [partition=true], [byColName=false])",
|
|
94552
|
+
"",
|
|
94553
|
+
"or",
|
|
94554
|
+
"",
|
|
94555
|
+
"unionAll(tables, tableB)"
|
|
94902
94556
|
]
|
|
94903
94557
|
}
|
|
94904
94558
|
]
|
|
@@ -94910,11 +94564,23 @@
|
|
|
94910
94564
|
{
|
|
94911
94565
|
"type": "text",
|
|
94912
94566
|
"value": [
|
|
94913
|
-
"For the first scenario,
|
|
94567
|
+
"* For the first scenario, ",
|
|
94568
|
+
"",
|
|
94569
|
+
"`tableA` and `tableB` are 2 tables with the same number of columns.",
|
|
94570
|
+
"",
|
|
94571
|
+
"* For the second scenario, ",
|
|
94572
|
+
"",
|
|
94573
|
+
"`tables` is a list of tables with the same number of columns; ",
|
|
94574
|
+
"",
|
|
94575
|
+
"`partition` is an optional Boolean parameter with the default value of true.",
|
|
94576
|
+
"",
|
|
94577
|
+
"`byColName` is a Boolean value indicating whether the table combination is conducted along columns with the same name. If `byColName` =false, the table combination is conducted based on the order of columns regardless of column names.",
|
|
94914
94578
|
"",
|
|
94915
|
-
"For the
|
|
94579
|
+
"* For the third scenario, ",
|
|
94916
94580
|
"",
|
|
94917
|
-
"`
|
|
94581
|
+
"`tables` is a tuple where the elements represent in-memory tables with the same number of columns. tableB is also an in-memory table having the the same number of columns. This form is often used to specify the *finalFunc* parameter of the ``mr`` function.",
|
|
94582
|
+
"",
|
|
94583
|
+
"Note: The following table types are supported: ``table``, ``keyedTable``, ``indexedTable``, ``latestKeyedTable``, ``latestIndexedTable``. *tableB* of the third scenario can also be a partitioned in-memory table."
|
|
94918
94584
|
]
|
|
94919
94585
|
}
|
|
94920
94586
|
]
|
|
@@ -94944,7 +94610,7 @@
|
|
|
94944
94610
|
{
|
|
94945
94611
|
"type": "text",
|
|
94946
94612
|
"value": [
|
|
94947
|
-
"
|
|
94613
|
+
"Scenario 1. Combine two in-memory tables.",
|
|
94948
94614
|
""
|
|
94949
94615
|
]
|
|
94950
94616
|
},
|
|
@@ -94989,7 +94655,7 @@
|
|
|
94989
94655
|
" $ typestr(re);",
|
|
94990
94656
|
" IN-MEMORY TABLE",
|
|
94991
94657
|
"",
|
|
94992
|
-
"
|
|
94658
|
+
"Scenario 2. Combine multiple in-memory tables.",
|
|
94993
94659
|
""
|
|
94994
94660
|
]
|
|
94995
94661
|
},
|
|
@@ -95037,7 +94703,7 @@
|
|
|
95037
94703
|
" $ typestr(re);",
|
|
95038
94704
|
" SEGMENTED IN-MEMORY TABLE",
|
|
95039
94705
|
"",
|
|
95040
|
-
"
|
|
94706
|
+
"Specifies `byColName`",
|
|
95041
94707
|
""
|
|
95042
94708
|
]
|
|
95043
94709
|
},
|
|
@@ -95140,6 +94806,37 @@
|
|
|
95140
94806
|
"value": [
|
|
95141
94807
|
"From the examples above, if the tables to be combined have different number of columns, we must set `byColName` =true.",
|
|
95142
94808
|
"",
|
|
94809
|
+
"Scenario 3: Combine multiple in-memory tables and a partitioned in-memory table. Update the partitioned in-memory table with the combination result.",
|
|
94810
|
+
""
|
|
94811
|
+
]
|
|
94812
|
+
},
|
|
94813
|
+
{
|
|
94814
|
+
"type": "code",
|
|
94815
|
+
"language": "console",
|
|
94816
|
+
"value": [
|
|
94817
|
+
"",
|
|
94818
|
+
" $ def testFunc(data, off){",
|
|
94819
|
+
" $ return select *, price * (1-off) as `discountPrice from data",
|
|
94820
|
+
" $ }",
|
|
94821
|
+
" $ n = 100",
|
|
94822
|
+
" $ dates = 2021.01.01..2021.12.31",
|
|
94823
|
+
" $ t = table(take(dates, 365 * n).sort() as `date, `sym + take(1..n, 365 * n).sort()$STRING as `sym, round(10 + norm(0, 2, 365 * n), 2) as `price)",
|
|
94824
|
+
"",
|
|
94825
|
+
" $ db = database(\"\", VALUE, 2021.01.01..2021.12.31)",
|
|
94826
|
+
" $ trade = db.createPartitionedTable(table=t, tableName=\"trade\", partitionColumns=`date).append!(t)",
|
|
94827
|
+
" $ db = database(\"\", RANGE, date(month(dates.first()) .. (month(dates.last()) + 1)))",
|
|
94828
|
+
" $ outputT=table(1:0, `date`sym`price`discountPrice, [DATE,SYMBOL,DOUBLE,DOUBLE])",
|
|
94829
|
+
" $ ports = db.createPartitionedTable(outputT, \"ports\", `date)",
|
|
94830
|
+
" //map reduce",
|
|
94831
|
+
" $ mr(sqlDS(<select * from trade>), testFunc{,0.3},,unionAll{,ports})",
|
|
94832
|
+
"",
|
|
94833
|
+
" $ select * from ports",
|
|
94834
|
+
""
|
|
94835
|
+
]
|
|
94836
|
+
},
|
|
94837
|
+
{
|
|
94838
|
+
"type": "text",
|
|
94839
|
+
"value": [
|
|
95143
94840
|
".. meta:: ",
|
|
95144
94841
|
" :keywords: union"
|
|
95145
94842
|
]
|