dolphindb 2.0.950 → 2.0.952

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs.en.json CHANGED
@@ -4455,7 +4455,7 @@
4455
4455
  "",
4456
4456
  "`interval` is an integral/DURATION type scalar greater than 0 or a vector of the same length as X.",
4457
4457
  "",
4458
- "When *interval* is of type DURATION, the following time units are supported: w, d, H, m, s, ms, us, ns.",
4458
+ "When *interval* is of type DURATION, the following time units are supported (case-sensitive): w, d, H, m, s, ms, us, ns.",
4459
4459
  "",
4460
4460
  "Note: As time units *y* and *M* are not supported in interval, to group X by year or month, convert the data format of X with function :doc:`/FunctionsandCommands/FunctionReferences/m/month` or :doc:`/FunctionsandCommands/FunctionReferences/y/year`. Specify the interval as an integer for calculation. You can refer to Example 2.",
4461
4461
  "",
@@ -9806,18 +9806,41 @@
9806
9806
  "value": [
9807
9807
  "",
9808
9808
  " $ getSessionMemoryStat();",
9809
+ "",
9809
9810
  ""
9810
9811
  ]
9811
9812
  },
9812
9813
  {
9813
9814
  "type": "text",
9814
9815
  "value": [
9815
- "====== ========== ======== ========= ========== ======================= ==========================",
9816
- "userId sessionId memSize remoteIP remotePort createTime lastActiveTime",
9817
- "====== ========== ======== ========= ========== ======================= ==========================",
9818
- "admin 1441295757 16 127.0.0.1 55030 2020.08.16T03:07:45.161 2020.08.16T03:07:45.162",
9819
- "guest 1166953221 75796984 127.0.0.1 57489 2020.08.14T13:20:01.902 2020.08.16T19:33:34.690",
9820
- "====== ========== ======== ========= ========== ======================= ==========================",
9816
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9817
+ "| userId | sessionId | memSize | remoteIP | remotePort createTime | lastActiveTime |",
9818
+ "+=========================+===============+==============+==========+=========================+=========================+",
9819
+ "| __DimensionalTable__ | 0 | 0.0.0.0 | | | |",
9820
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9821
+ "| __SharedTable__ | 0 | 0.0.0.0 | | | |",
9822
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9823
+ "| __OLAPTablet__ | 0 | 0.0.0.0 | | | |",
9824
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9825
+ "| __OLAPCacheEngine__ | 0 | 0.0.0.0 | | | |",
9826
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9827
+ "| __OLAPCachedSymbolBa... | 0 | 0.0.0.0 | | | |",
9828
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9829
+ "| __DFSMetadata__ | 2769 | 0.0.0.0 | | | |",
9830
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9831
+ "| __TSDBCacheEngine__ | 0 | 0.0.0.0 | | | |",
9832
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9833
+ "| __TSDBLevelFileIndex__ | 0 | 0.0.0.0 | | | |",
9834
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9835
+ "| __TSDBCachedSymbolBa... | 0 | 0.0.0.0 | | | |",
9836
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9837
+ "| __StreamingPubQueue__ | 0 | 0.0.0.0 | | | |",
9838
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9839
+ "| __StreamingSubQueue__ | 0 | 0.0.0.0 | | | |",
9840
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9841
+ "| admin | 1823289176 32 | 60.176.105.0 | 20882 | 2023.02.15T02:36:14.906 | 2023.02.15T02:36:22.314 |",
9842
+ "+-------------------------+---------------+--------------+----------+-------------------------+-------------------------+",
9843
+ "",
9821
9844
  ""
9822
9845
  ]
9823
9846
  },
@@ -9826,7 +9849,15 @@
9826
9849
  "language": "console",
9827
9850
  "value": [
9828
9851
  "",
9829
- " $ closeSessions(getSessionMemoryStat().sessionId[1]);"
9852
+ " $ closeSessions(getSessionMemoryStat().sessionId[11]);",
9853
+ ""
9854
+ ]
9855
+ },
9856
+ {
9857
+ "type": "text",
9858
+ "value": [
9859
+ ".. meta::",
9860
+ " :keywords: close"
9830
9861
  ]
9831
9862
  }
9832
9863
  ]
@@ -12629,60 +12660,99 @@
12629
12660
  ]
12630
12661
  },
12631
12662
  {
12632
- "title": "Arguments",
12633
- "type": "parameters",
12663
+ "title": "Details",
12664
+ "type": "detail",
12634
12665
  "children": [
12635
12666
  {
12636
12667
  "type": "text",
12637
12668
  "value": [
12638
- "`name` is a string indicating the name of the asof join engine.",
12639
- "",
12640
- "`leftTable` and `rightTable` are table objects whose schema must be the same as the subscribed stream table.",
12641
- "",
12642
- "`outputTable` is a table object indicating the output table for the results. We need to set the output table as an empty table and specify the names and data types of the columns before using function createAsofJoinEngine. By default, the first two columns are the `timeColumn` and `matchingColumn` of the leftTable which do not need to be specified in metrics.",
12643
- "",
12644
- "`metrics` is metacode specifying the calculation formulas. It can use one or more expressions, built-in or user-defined functions, but not aggregate functions. You can specify functions that return multiple values for metrics, such as <func(price) as \\`col1\\`col2>. For more information about metacode please refer to :doc:`/Objects/Metaprogramming`.",
12645
- "",
12646
- "`matchingColumn` is a STRING scaler/vector/tuple indicating the column(s) on which the tables are joined. It supports integral, temporal or literal (except UUID) types.",
12669
+ "Create an asof join streaming engine. Streams are ingested into the left table and the right table and joined on :ref:`matchingColumn <mc_aj>` and :ref:`timeColumn <tc_aj>` (or system time). For each record in the left table, join it with the right table record (1) with matching matchingColumn value and (2) whose timestamp is the last of the timestamps that are less than or equal to the timestamp of the left table record. This function returns a table object holding the asof join results. ",
12647
12670
  "",
12648
- "\\1. When there is only 1 matching column - If the names of the matching column are the same in both tables, *matchingColumn* should be specified as a STRING scalar; otherwise it's a tuple of two elements. For example, if the matching column is named “sym“ in the left table and “sym1“ in the right table, then matchingColumn = [[\\`sym],[\\`sym1]]. ",
12671
+ "Asof join engine joins records that have no exact match on time columns. For each timestamp in one table, the engine obtains the latest (i.e., current as of the timestamp) value from another table.",
12649
12672
  "",
12650
- "\\2. When there are multiple matching columns - If the names of the matching columns are all the same in both tables, specify *matchingColumn* as a STRING vector; otherwise it's a tuple of two elements. For example, if the matching columns are named “timestamp“ and “sym“ in the left table and “timestamp“ and “sym1“ in the right table, then matchingColumn = [[\\`timestamp, \\`sym], [\\`timestamp,\\`sym1]].",
12651
- "",
12652
- "`timeColumn` is an optional parameter indicating the name of the time column in the two input tables when `useSystemTime` = false. If the time column of the left table is the same as that of the right table, `timeColumn` can be a string scalar. Otherwise, specify a string vector of length 2 (the time column names in the two tables).",
12673
+ "Note: ",
12653
12674
  "",
12654
- "`useSystemTime` is an optional parameter indicating whether the first column of outputTable is system time ( `useSystemTime` = true) or `timeColumn` in the stream table ( `useSystemTime` = false).",
12675
+ "* The records in the left table and the right table must be sequenced by time.",
12655
12676
  "",
12656
- " * `useSystemTime` = true, to calculate according to the timestamp when each record is ingested into the streaming engine (with millisecond precision) instead of `timeColumn`.",
12657
- " * `useSystemTime` = false (default), to calculate according to `timeColumn` instead of the timestamp when each record is ingested into the engine. Please note that the the data which triggers the calculation doesn't participate in this calculation.",
12677
+ "* If *delayedTime* is not specified, a join operation is only triggered when the right table receives a record whose timestamp is greater than the timestamp of the latest record in the left table.",
12658
12678
  "",
12659
- "`useSessionStartTime` is a Boolean scalar. It is optional and indicates whether the time in the output table is the start time of data window. The default value is false, which means that the time in the output table is the end time of the data window, that is, the timestamp of the last data in each window + sessionGap. It must be set to true if parameter `updateTime` is specified.",
12679
+ "* If *delayedTime* is specified, a join operation is triggered when either of the following conditions is met:",
12660
12680
  "",
12661
- "`delayedTime` is a positive integer. We need to set parameter `useSystemTime` to false before specifying `delayedTime`.",
12681
+ " * In the left table, the difference between the timestamp of the latest record and the timestamp of the previous unjoined record is greater than *delayedTime*.",
12662
12682
  "",
12663
- "When delayedTime is specified, if the time difference between the timestamp of the latest record t2 in the left table and the timestamp of uncalculated records is greater than the delayedTime, a calculation will be triggered by the record t2. If max(2*updateTime, 2 seconds) after a record of leftTable arrives at the aggregator, the arriving record still has not participated in a calculation, a calculation will be triggered too.",
12683
+ " * The record is still not joined after 2 * *delayedTime* or 2 seconds, whichever is larger, since its ingestion into the left table.",
12664
12684
  "",
12665
- "`garbageSize` is a positive integer. It is optional and the default value is 5,000. As the subscribed data is ingested into the streaming engine, it occupies an increasing amount of memory. When the number of rows in memory exceeds *garbageSize*, the system will clear the data that is not needed for the current calculation."
12685
+ "For more application scenarios, see :doc:`../../Themes/streamingEngine`."
12666
12686
  ]
12667
12687
  }
12668
12688
  ]
12669
12689
  },
12670
12690
  {
12671
- "title": "Details",
12672
- "type": "detail",
12691
+ "title": "Arguments",
12692
+ "type": "parameters",
12673
12693
  "children": [
12674
12694
  {
12675
12695
  "type": "text",
12676
12696
  "value": [
12677
- "Create asof join engine for streaming data. Return a table that is the asof join result of a left table and a right table. Generally it is used in conjunction with subscribeTable.",
12697
+ ".. _name_aj:",
12698
+ "",
12699
+ "`name` is a string indicating the name of the asof join engine. It is the unique identifier of the engine on a data/compute node. It can contain letters, numbers and underscores and must start with a letter.",
12700
+ "",
12701
+ ".. _table_aj:",
12702
+ "",
12703
+ "`leftTable` and `rightTable` are table objects whose schema must be the same as the stream table to which the engine subscribes.",
12704
+ "",
12705
+ ".. _outputTable_aj:",
12706
+ "",
12707
+ "`outputTable` is a table to which the engine inserts calculation result. It can be an in-memory table or a DFS table. Before calling a function, an empty table with specified column names must be created.",
12708
+ "",
12709
+ "The columns of *outputTable* are in the following order:",
12710
+ "",
12711
+ "(1) The first column must be a temporal column. ",
12712
+ "",
12713
+ " * if *useSystemTime* = true, the data type must be TIMESTAMP; ",
12714
+ " * if *useSystemTime* = false, it has the same data type as *timeColumn*.",
12715
+ "",
12716
+ "(2) Then followed by one or more columns on which the tables are joined, arranged in the same order as specified in *matchingColumn*.",
12717
+ "",
12718
+ "(3) Further followed by one or more columns which are the calculation results of *metrics*.",
12719
+ "",
12720
+ ".. _metrics_aj:",
12721
+ "",
12722
+ "`metrics` is metacode (can be a tuple) specifying the calculation formulas. For more information about metacode, refer to :doc:`/Objects/Metaprogramming`.",
12723
+ "",
12724
+ "- *metrics* can use one or more expressions, built-in or user-defined functions, but not aggregate functions. ",
12725
+ "- *metrics* can be functions with multiple returns and the columns in the output table to hold the return values must be specified. For example, <func(price) as \\`col1\\`col2>. ",
12726
+ "",
12727
+ "To specify a column that exists in both the left and the right tables, use the format `tableName.colName`.",
12728
+ "",
12729
+ ".. _mc_aj:",
12730
+ "",
12731
+ "`matchingColumn` is a STRING scaler/vector/tuple indicating the column(s) on which the tables are joined. It supports integral, temporal or literal (except UUID) types.",
12732
+ "",
12733
+ "\\1. When there is only 1 column to match - If the names of the columns to match are the same in both tables, *matchingColumn* should be specified as a STRING scalar; otherwise it's a tuple of two elements. For example, if the column is named \"sym\" in the left table and \"sym1\" in the right table, then *matchingColumn* = [[\\`sym],[\\`sym1]].",
12734
+ "",
12735
+ "\\2. When there are multiple columns to match - If both tables share the names of all columns to match, *matchingColumn* is a STRING vector; otherwise it's a tuple of two elements. For example, if the columns are named \"timestamp\" and \"sym\" in the left table, whereas in the right table they're named \"timestamp\" and \"sym1\", then *matchingColumn* = [[\\`timestamp, \\`sym], [\\`timestamp,\\`sym1]].",
12736
+ "",
12737
+ ".. _tc_aj:",
12738
+ "",
12739
+ "`timeColumn` is an optional parameter. When *useSystemTime* = false, it must be specified to indicate the name of the time column in the left table and the right table. The time columns must have the same data type. If the names of the time column in the left table and the right table are the same, *timeColumn* is a string. Otherwise, it is a vector of 2 strings indicating the time column in each table.",
12740
+ "",
12741
+ ".. _useSystemTime_aj:",
12742
+ "",
12743
+ "`useSystemTime` is an optional parameter indicating whether the left table and the right table are joined on the system time, instead of on *timeColumn*.",
12744
+ "",
12745
+ " * *useSystemTime* = true: join records based on the system time (timestamp with millisecond precision) when they are ingested into the engine.",
12746
+ " * *useSystemTime* = false (default): join records based on the specified *timeColumn* from the left table and the right table.",
12678
12747
  "",
12679
- "* If *delayedTime* is not specified, then a calculation is triggered when the timestamp of the latest record in the right table is later than the timestamp of the latest record in the left table.",
12680
- "* If *delayedTime* is specified, then a calculation is trigger when either of the following 2 conditions is met:",
12748
+ ".. _delayedTime_aj:",
12681
12749
  "",
12682
- " * the time difference between the latest time in left table and the time of uncalculated data is greater than the delayedTime.",
12683
- " * max(2*updateTime, 2 seconds) after a record is ingested into the left table, it still has not been used in a calculation.",
12750
+ "`delayedTime` is an optional parameter. It is a positive integer with the same precision as *timeColumn*, indicating the maximum time to wait before the engine joins an uncalculated record in the left table with a right table record. To specify *delayedTime*, *timeColumn* must be specified. For more information, see Details.",
12684
12751
  "",
12685
- "Starting from version 1.30.17, 2.00.5, DolphinDB supports other stream engines to ingest data into streaming join engines to realize cascade between engines through :doc:`/FunctionsandCommands/FunctionReferences/g/getLeftStream` and :doc:`/FunctionsandCommands/FunctionReferences/g/getRightStream`."
12752
+ ".. _garbageSize_aj:",
12753
+ "",
12754
+ "`garbageSize` is an optional parameter. It is a positive integer with the default value of 5,000 (rows). As the subscribed data is ingested into the engine, it continues to take up the memory. Within the left/right table, the records are grouped by *matchingColumn* values; When the number of records in a group exceeds *garbageSize*, the system will remove those already been calculated from memory.",
12755
+ ""
12686
12756
  ]
12687
12757
  }
12688
12758
  ]
@@ -12704,6 +12774,7 @@
12704
12774
  " $ tmp2=table(2020.08.27T09:30:00.000+1 5 6 11 19 as time, take(`A, 5) as sym, 20 20.02 20.03 20.05 20.06 as bid, 20.01 20.03 20.04 20.06 20.07 as ask)",
12705
12775
  " $ tmp1.sortBy!(`time)",
12706
12776
  " $ tmp2.sortBy!(`time)",
12777
+ " //can only use appendForJoin to append data",
12707
12778
  " $ subscribeTable(tableName=\"trades\", actionName=\"joinLeft\", offset=0, handler=appendForJoin{ajEngine, true}, msgAsTable=true)",
12708
12779
  " $ subscribeTable(tableName=\"quotes\", actionName=\"joinRight\", offset=0, handler=appendForJoin{ajEngine, false}, msgAsTable=true)",
12709
12780
  "",
@@ -12714,7 +12785,7 @@
12714
12785
  "",
12715
12786
  " $ sleep(1000)",
12716
12787
  "",
12717
- " $ select time, sym, price from prevailingQuotes order by time, sym",
12788
+ " $ select time, sym, bid from prevailingQuotes order by time, sym",
12718
12789
  ""
12719
12790
  ]
12720
12791
  },
@@ -12722,12 +12793,12 @@
12722
12793
  "type": "text",
12723
12794
  "value": [
12724
12795
  "======================= ======== ========",
12725
- "time sym price ",
12796
+ "time sym bid",
12726
12797
  "======================= ======== ========",
12727
- "2020.08.27T09:30:00.002 A 20.01",
12728
- "2020.08.27T09:30:00.008 A 20.04",
12729
- "2020.08.27T09:30:00.020 A 20.07",
12730
- "2020.08.27T09:30:00.022 A 20.08",
12798
+ "2020.08.27T09:30:00.002 A ",
12799
+ "2020.08.27T09:30:00.008 A ",
12800
+ "2020.08.27T09:30:00.020 A ",
12801
+ "2020.08.27T09:30:00.022 A 20.06",
12731
12802
  "======================= ======== ========"
12732
12803
  ]
12733
12804
  }
@@ -13569,45 +13640,62 @@
13569
13640
  {
13570
13641
  "type": "text",
13571
13642
  "value": [
13572
- "createEquiJoinEngine(name, leftTable, rightTable, outputTable, metrics, matchingColumn, timeColumn, [garbageSize=5000], [maxDelayedTime])"
13643
+ "createEquiJoinEngine(name, leftTable, rightTable, outputTable, metrics, matchingColumn, timeColumn, [garbageSize=5000], [maxDelayedTime])",
13644
+ "",
13645
+ "Alias: createEqualJoinEngine"
13573
13646
  ]
13574
13647
  }
13575
13648
  ]
13576
13649
  },
13577
13650
  {
13578
- "title": "Arguments",
13579
- "type": "parameters",
13651
+ "title": "Details",
13652
+ "type": "detail",
13580
13653
  "children": [
13581
13654
  {
13582
13655
  "type": "text",
13583
13656
  "value": [
13584
- "Some parameters of the equal join engine are the same as those of the asof join engine, please refer to the function createAsofJoinEngine for detailed information. The different parameters are described as below:",
13585
- "",
13586
- "`name` is a required parameter. It is a string indicating the name of the equal join stream engine.",
13587
- "",
13588
- "`garbageSize` is a positive integer. It is optional and the default value is 5000. When the row number of historical records in memory exceeds the *garbageSize*, the system will clear the historical data that is not needed for the current calculation.",
13589
- "",
13590
- "`maxDelayedTime` is a positive integer. It is optional and the default value is 3s. The maximum delay time for the data to be injected into the equal join engine and be calculated. Data arriving after the *maxDelayedTime* delay time will be discarded. It is not recommended to set the *maxDelayedTime* too small.",
13591
- "",
13592
- "When the number of rows of historical data in memory exceeds garbageSize, the data will be cleaned up according to the following rules:",
13593
- "",
13594
- "\\1. Historical data that has been consumed by the equal join engine.",
13657
+ "Create an equi join streaming engine. Streams are ingested into the engine through left and right tables and joined on :ref:`matchingColumn <mc_aj>` and :ref:`timeColumn <tc_ej>`. Return a table object that is the equi join result of a left table and a right table. The result holds all records with matching values.",
13595
13658
  "",
13596
- "\\2. If the Timestamp difference between the historical data and the new arriving data in left/right table has exceeded the *maxDelayedTime*, the historical data will be discard."
13659
+ "For more application scenarios, see :doc:`../../Themes/streamingEngine`."
13597
13660
  ]
13598
13661
  }
13599
13662
  ]
13600
13663
  },
13601
13664
  {
13602
- "title": "Details",
13603
- "type": "detail",
13665
+ "title": "Calculation Rules",
13604
13666
  "children": [
13605
13667
  {
13606
13668
  "type": "text",
13607
13669
  "value": [
13608
- "Create an equal join engine and return a table object after :doc:`/SQLStatements/TableJoiners/equijoin` of the left and right table. Generally it is used in conjunction with :doc:`../s/subscribeTable`.",
13670
+ "When data is ingested into one table, the equi join streaming engine searches for records with matching values in the other table. If matches are found, the engine outputs the combined records with additional columns holding the calculation results of :ref:`metrics <metrics_aj>`."
13671
+ ]
13672
+ }
13673
+ ]
13674
+ },
13675
+ {
13676
+ "title": "Arguments",
13677
+ "type": "parameters",
13678
+ "children": [
13679
+ {
13680
+ "type": "text",
13681
+ "value": [
13682
+ "Some parameters of the equi join engine are the same as those of the asof join engine, please refer to the function :doc:`createAsofJoinEngine` for detailed information. The different parameters are described as below:",
13683
+ "",
13684
+ ".. _name_ej:",
13685
+ "",
13686
+ "`name` is a string indicating the name of the equal join streaming engine. It is the unique identifier of the engine on a data/compute node. It can contain letters, numbers and underscores and must start with a letter.",
13687
+ "",
13688
+ ".. _tc_ej:",
13689
+ "",
13690
+ "`timeColumn` is a string or a vector of strings indicating the time columns in the left table and the right table. The time columns in the left and right tables must have the same data type. When the two time columns have the same column name, *timeColumn* is a string scalar; otherwise, *timeColumn* is vector of two strings.",
13691
+ "",
13692
+ "`garbageSize` (optional) is a positive integer with the default value of 5,000 (in unit of rows). When the number of rows of historical data in memory exceeds the *garbageSize*, the system will remove the historical data that is not needed for the current calculation on the following conditions:",
13609
13693
  "",
13610
- "* Both the left table and the right table are sorted in chronological order according to timeColumn, and the key value of the combination of the timeColumn and the matchingColumn returns a unique result."
13694
+ "* The historical data has already been joined and returned.",
13695
+ "",
13696
+ "* For historical data that has not been joined, if the timestamp difference between the historical data and the new arriving data in left/right table has exceeded the *maxDelayedTime*, it will also be discarded.",
13697
+ "",
13698
+ "`maxDelayedTime` is an optional parameter. It is a positive integer with the default value of 3 (seconds), indicating the maximum time to keep cached data in the engine. This parameter only takes effect when the conditions described in *garbageSize* are met. It is not recommended to set the *maxDelayedTime* too small in case data got removed before it is joined."
13611
13699
  ]
13612
13700
  }
13613
13701
  ]
@@ -13628,27 +13716,27 @@
13628
13716
  "language": "console",
13629
13717
  "value": [
13630
13718
  " ",
13631
- " $ leftTable=keyedTable(`time`sym, 1:0, `time`sym`price, [SECOND, SYMBOL, DOUBLE])",
13632
- " $ rightTable=keyedTable(`time`sym, 1:0, `time`sym`val, [SECOND, SYMBOL, DOUBLE])",
13633
- " $ output=table(100:0, `time`sym`total, [SECOND, SYMBOL, DOUBLE])",
13634
- " $ ejEngine=createEquiJoinEngine(\"test1\", leftTable, rightTable, output, <price+val>, `sym, `time)",
13635
- " $ tmp1=table(take(13:30:10, 20) as time, take(`AAPL, 10) join take(`IBM, 10) as sym, double(1..20) as price)",
13636
- " $ appendForJoin(ejEngine, true, tmp1)",
13719
+ " $ share streamTable(1:0, `time`sym`price, [SECOND, SYMBOL, DOUBLE]) as leftTable",
13720
+ " $ share streamTable(1:0, `time`sym`val, [SECOND, SYMBOL, DOUBLE]) as rightTable",
13721
+ " $ output=table(100:0, `time`sym`price`val`total, [SECOND, SYMBOL, DOUBLE, DOUBLE, DOUBLE])",
13722
+ " $ ejEngine=createEquiJoinEngine(\"test1\", leftTable, rightTable, output, [<price>, <val>, <price*val>], `sym, `time)",
13723
+ " $ subscribeTable(tableName=\"leftTable\", actionName=\"joinLeft\", offset=0, handler=appendForJoin{ejEngine, true}, msgAsTable=true)",
13724
+ " $ subscribeTable(tableName=\"rightTable\", actionName=\"joinRight\", offset=0, handler=appendForJoin{ejEngine, false}, msgAsTable=true)",
13725
+ "",
13726
+ " $ tmp1=table(13:30:10+1..20 as time, take(`AAPL, 10) join take(`IBM, 10) as sym, double(1..20) as price)",
13637
13727
  " $ leftTable.append!(tmp1)",
13638
- " $ tmp2=table(take(13:30:10, 20) as time, take(`AAPL, 10) join take(`IBM, 10) as sym, double(50..31) as val)",
13639
- " $ appendForJoin(ejEngine, false, tmp2)",
13728
+ " $ tmp2=table(13:30:10+1..20 as time, take(`AAPL, 10) join take(`IBM, 10) as sym, double(50..31) as val)",
13640
13729
  " $ rightTable.append!(tmp2)",
13641
13730
  "",
13642
- " $ re = select * from output order by time, sym",
13643
- " $ expected = select time, sym, price+val from ej(leftTable, tmp2, `sym`time) order by time, sym",
13644
- " $ each(eqObj, re.values(), expected.values())",
13731
+ " $ select count(*) from output",
13732
+ " 20",
13645
13733
  ""
13646
13734
  ]
13647
13735
  },
13648
13736
  {
13649
13737
  "type": "text",
13650
13738
  "value": [
13651
- "Example 2. The type of the timeColumn is timestamp. The default value of maxDelayedTime is 3000ms (3s).",
13739
+ "Example 2. The type of the *timeColumn* is timestamp. The default value of *maxDelayedTime* is 3000ms (3s).",
13652
13740
  ""
13653
13741
  ]
13654
13742
  },
@@ -13860,6 +13948,151 @@
13860
13948
  }
13861
13949
  ]
13862
13950
  },
13951
+ "createLeftSemiJoinEngine": {
13952
+ "title": "createLeftSemiJoinEngine",
13953
+ "type": "function",
13954
+ "children": [
13955
+ {
13956
+ "title": "Syntax",
13957
+ "type": "grammer",
13958
+ "children": [
13959
+ {
13960
+ "type": "text",
13961
+ "value": [
13962
+ "createLeftSemiJoinEngine(name, leftTable, rightTable, outputTable, metrics, matchingColumn, [garbageSize=5000], [updateRightTable=false])"
13963
+ ]
13964
+ }
13965
+ ]
13966
+ },
13967
+ {
13968
+ "title": "Details",
13969
+ "type": "detail",
13970
+ "children": [
13971
+ {
13972
+ "type": "text",
13973
+ "value": [
13974
+ "Create a left semi join engine. For each record from the left table, the left semi join engine finds the matching records from the right table, and returns a table of its joining result. Unmatched records will not be returned. ",
13975
+ "",
13976
+ "If an incoming record has the identical :ref:`matchingColumn <matchingColumnLSJ>` of an existing record in the right table, only the first/latest record (determined by parameter :ref:`updateRightTable <updateRightTableLSJ>`) is kept. ",
13977
+ "",
13978
+ "Note:",
13979
+ "",
13980
+ "Only one record with the indentical *matchingColumn* is kept by the engine in the right table, and data in the right table will not be removed from memory. Therefore, a large number of distinct values of *matchingColumn* should be avoided, otherwise an OOM problem may occur.",
13981
+ "",
13982
+ "For more details of streaming engines, refer to :doc:`../../Themes/streamingEngine`。"
13983
+ ]
13984
+ }
13985
+ ]
13986
+ },
13987
+ {
13988
+ "title": "Arguments",
13989
+ "type": "parameters",
13990
+ "children": [
13991
+ {
13992
+ "type": "text",
13993
+ "value": [
13994
+ "`name` is a string indicating the name of the left semi join engine. It is the unique identifier of the engine on a data/compute node. It can contain letters, numbers and underscores and must start with a letter.",
13995
+ "",
13996
+ "`leftTable` is a table object whose schema must be the same as the stream table to which the engine subscribes. It does not matter whether the table contains data or not.",
13997
+ "",
13998
+ "`rightTable` is a table object whose schema must be the same as the stream table to which the engine subscribes. It does not matter whether the table contains data or not.",
13999
+ "",
14000
+ "`outputTable` is a table object to hold the calculation results. Create an empty table and specify the column names and types before calling the function.",
14001
+ "",
14002
+ "The columns of *outputTable* are in the following order:",
14003
+ "",
14004
+ "\\(1) The first column(s) are the column(s) on which the tables are joined, arranged in the same order as specified in *matchingColumn*.",
14005
+ "",
14006
+ "\\(2) Then followed by the calculation results of *metrics*. There can be one or multiple columns.",
14007
+ "",
14008
+ "`metrics` is metacode (which can be a tuple) specifying the calculation formulas. For more information about metacode, please refer to :doc:`/Objects/Metaprogramming`.",
14009
+ "",
14010
+ "- *metrics* can use one or more expressions, built-in or user-defined functions, but not aggregate functions.",
14011
+ "- *metrics* can be functions that return multiple values and the columns in the output table to hold the return values must be specified. For example, \\<func(price) as \\`col1\\`col2\\>.",
14012
+ "- To specify a column that exists in both the left and the right tables, use the format `tableName.colName`. By default, the column from the left table is used.",
14013
+ "",
14014
+ ".. _matchingColumnLSJ:",
14015
+ "",
14016
+ "`matchingColumn` is a STRING scaler/vector/tuple indicating the column(s) on which the tables are joined. It supports integral, temporal or literal (except UUID) types.",
14017
+ "",
14018
+ "\\1. When there is only 1 column to match - If the names of the columns to match are the same in both tables, *matchingColumn* should be specified as a STRING scalar; otherwise it's a tuple of two elements. For example, if the column is named \"sym\" in the left table and \"sym1\" in the right table, then *matchingColumn* = [[\\`sym],[\\`sym1]].",
14019
+ "",
14020
+ "\\2. When there are multiple columns to match - If both tables share the names of all columns to match, *matchingColumn* is a STRING vector; otherwise it's a tuple of two elements. For example, if the columns are named \"timestamp\" and \"sym\" in the left table, whereas in the right table they're named \"timestamp\" and \"sym1\", then *matchingColumn* = [[\\`timestamp, \\`sym], [\\`timestamp,\\`sym1]].",
14021
+ "",
14022
+ "",
14023
+ ".. _garbageSizeLSJ:",
14024
+ "",
14025
+ "`garbageSize` (optional) is a positive integer. The default value is 5,000. Unlike other join engines, the *garbageSize* parameter for left semi join engine is only used to remove the historical data from the left table. The system will clear the data from the left table when the number of joined records exceeds *garbageSize*.",
14026
+ "",
14027
+ ".. _updateRightTableLSJ:",
14028
+ "",
14029
+ "`updateRightTable` (optional) is a BOOLEAN value indicating whether to output the first record (*updateRightTable* = true) or the latest record (*updateRightTable* = false) when there are more than one matching records in the right table. The default value is false."
14030
+ ]
14031
+ }
14032
+ ]
14033
+ },
14034
+ {
14035
+ "title": "Examples",
14036
+ "type": "example",
14037
+ "children": [
14038
+ {
14039
+ "type": "code",
14040
+ "language": "console",
14041
+ "value": [
14042
+ "",
14043
+ " $ share streamTable(1:0, `time`sym`price, [TIMESTAMP, SYMBOL, DOUBLE]) as leftTable ",
14044
+ " $ share streamTable(1:0, `time`sym1`vol, [TIMESTAMP, SYMBOL, INT]) as rightTable",
14045
+ "",
14046
+ " $ output=table(100:0, `time`sym`price`vol`total, [TIMESTAMP, SYMBOL, DOUBLE, INT, DOUBLE])",
14047
+ " $ lsjEngine=createLeftSemiJoinEngine(name=\"test1\", leftTable=leftTable, rightTable=rightTable, outputTable=output, metrics=<[price, vol,price*vol]>, matchingColumn=[[`time,`sym], [`time,`sym1]], updateRightTable=true)",
14048
+ "",
14049
+ " $ subscribeTable(tableName=\"leftTable\", actionName=\"joinLeft\", offset=0, handler=appendForJoin{lsjEngine, true}, msgAsTable=true)",
14050
+ " $ subscribeTable(tableName=\"rightTable\", actionName=\"joinRight\", offset=0, handler=appendForJoin{lsjEngine, false}, msgAsTable=true)",
14051
+ "",
14052
+ " $ v = [1, 5, 10, 15]",
14053
+ " $ tp1=table(2012.01.01T00:00:00.000+v as time, take(`AAPL, 4) as sym, rand(100,4) as price)",
14054
+ " $ leftTable.append!(tp1)",
14055
+ "",
14056
+ " $ v = [1, 1, 3, 4, 5, 5, 5, 15]",
14057
+ " $ tp2=table(2012.01.01T00:00:00.000+v as time, take(`AAPL, 8) as sym, rand(100,8) as vol)",
14058
+ " $ rightTable.append!(tp2)",
14059
+ "",
14060
+ " $ select * from output ",
14061
+ ""
14062
+ ]
14063
+ },
14064
+ {
14065
+ "type": "text",
14066
+ "value": [
14067
+ "+-------------------------+------+-------+-----+-------+",
14068
+ "| time | sym | price | vol | total |",
14069
+ "+=========================+======+=======+=====+=======+",
14070
+ "| 2012.01.01T00:00:00.001 | AAPL | 44 | 76 | 3344 |",
14071
+ "+-------------------------+------+-------+-----+-------+",
14072
+ "| 2012.01.01T00:00:00.005 | AAPL | 15 | 64 | 960 |",
14073
+ "+-------------------------+------+-------+-----+-------+",
14074
+ "| 2012.01.01T00:00:00.015 | AAPL | 24 | 75 | 1800 |",
14075
+ "+-------------------------+------+-------+-----+-------+",
14076
+ "",
14077
+ "To execute the above script again, delete the engine and unsubscribe:",
14078
+ ""
14079
+ ]
14080
+ },
14081
+ {
14082
+ "type": "code",
14083
+ "language": "console",
14084
+ "value": [
14085
+ "",
14086
+ " $ dropStreamEngine(\"test1\")",
14087
+ " $ lsjEngine=NULL",
14088
+ " $ unsubscribeTable(tableName=\"leftTable\", actionName=\"joinLeft\")",
14089
+ " $ unsubscribeTable(tableName=\"rightTable\", actionName=\"joinRight\")"
14090
+ ]
14091
+ }
14092
+ ]
14093
+ }
14094
+ ]
14095
+ },
13863
14096
  "createLookupJoinEngine": {
13864
14097
  "title": "createLookupJoinEngine",
13865
14098
  "type": "function",
@@ -13883,19 +14116,31 @@
13883
14116
  {
13884
14117
  "type": "text",
13885
14118
  "value": [
13886
- "Create a lookup join streaming engine to perform left join on stream tables. It conducts a real-time left join on two stream tables, or on a stream table and a non-stream table (where the non-stream table needs to be refreshed regularly).",
14119
+ "Create a lookup join streaming engine. The engine left joins two stream tables, or a stream table and a non-stream table (refreshed regularly), on *matchingColumn*. Use this engine when the right table has infrequent updates (e.g., a dimension table with intraday indicators).",
13887
14120
  "",
13888
14121
  "Note:",
13889
14122
  "",
13890
14123
  "\\1. A left join is triggered only when new data is ingested to the left table.",
13891
14124
  "",
13892
- "\\2. Data in the right table is grouped based on *matchingColumn* and only the latest record in each group is kept. ",
14125
+ "\\2. Data in the right table is grouped by *matchingColumn*. Only the latest record in each group is kept by the engine.",
13893
14126
  "",
13894
- "- If the right table is a subscribed stream table, the records will be updated when new data is ingested to the right table. ",
14127
+ " - If the right table is a stream table, the data in each group will be updated as new data is ingested into the right table.",
13895
14128
  "",
13896
- "- If the right table is an in-memory table or a DFS table (currently only dimension table is supported), the system refreshes the right table at specified *checkTimes* intervals.",
14129
+ " - If the right table is an in-memory table or a DFS table (currently only dimension tables are supported), the system refreshes the right table at regular intervals as specified by *checkTimes*.",
13897
14130
  "",
13898
- "Starting from version 1.30.17, 2.00.5, DolphinDB supports using streaming engines to ingest data into streaming join engines to realize cascade of engines with :doc:`/FunctionsandCommands/FunctionReferences/g/getLeftStream` and :doc:`/FunctionsandCommands/FunctionReferences/g/getRightStream`."
14131
+ "Although the lookup join engine performs left join on the left table and the right table, its output is different from that of a standard left join operation:",
14132
+ "",
14133
+ "- Left join - for each record in the left table, if it has multiple matching records in the right table, all these records will be returned.",
14134
+ "- Lookup join engine - returns only the latest matching record in the right table for each record in the left table.",
14135
+ "",
14136
+ "The lookup join engine and the asof join engine are different in the following aspects:",
14137
+ "",
14138
+ "- For the asof join engine, the first column of its output table is always the time column. There is no such restriction with the lookup join engine.",
14139
+ "- With the lookup join engine, a join is triggered as soon as a new record is ingested into the left table. With the asof join engine, when the *timeColumn* is specified, there can be a delay before a record in the left table is joined.",
14140
+ "",
14141
+ "Note the difference between the lookup join engine and the left-semi join engine: with the left semi join engine, there will be no return until a match in the right table is found.",
14142
+ "",
14143
+ "For more application scenarios, see :doc:`../../Themes/streamingEngine`."
13899
14144
  ]
13900
14145
  }
13901
14146
  ]
@@ -13907,38 +14152,37 @@
13907
14152
  {
13908
14153
  "type": "text",
13909
14154
  "value": [
13910
- "`name` is a STRING indicating the name of the lookup join streaming engine.",
13911
- "",
13912
- "`leftTable` is a table object. Its schema must be the same as the subscribed stream table.",
14155
+ "`name` is a string indicating the name of the lookup join engine. It is the unique identifier of the engine on a data/compute node. It can contain letters, numbers and underscores and must start with a letter.",
13913
14156
  "",
13914
- "`rightTable` is a table object. It is an empty in-memory table, stream table or dimension table. Note that if the *rightTable* is not subscribed, *checkTimes* must be specified for timed data refreshing.",
14157
+ "`leftTable` is a table object whose schema must be the same as the stream table to which the engine subscribes.",
13915
14158
  "",
13916
- "`outputTable` is a required table object to hold the calculation results. Before using function ``createLookupJoinEngine``, set up an empty table as the *outputTable*, and specify the column names and data types.",
14159
+ "`rightTable` is a table object. It can be an in-memory table, stream table or dimension table. Note that if the *rightTable* is not subscribed to, *checkTimes* must be specified for timed data refreshing.",
13917
14160
  "",
13918
- "The columns of the *outputTable* are in the following order: the matching columns, the result columns. Specifically:",
14161
+ "`outputTable` is a table object to hold the calculation results. Create an empty table and specify the column names and types before calling the function.",
13919
14162
  "",
13920
- "\\(1) The first few columns must be arranged in the same order as specified in *matchingColumn*.",
14163
+ "The columns of *outputTable* are in the following order:",
13921
14164
  "",
13922
- "\\(2) The last few columns are the results of the *metrics*.",
14165
+ "\\(1) The first column(s) are the column(s) on which the tables are joined, arranged in the same order as specified in *matchingColumn*.",
13923
14166
  "",
13924
- "`metrics` is metacode or a tuple specifying the calculation formulas. For more information about metacode, please refer to :doc:`/Objects/Metaprogramming`.",
14167
+ "\\(2) Then followed by the calculation results of *metrics*.",
13925
14168
  "",
13926
- "- It can use one or more expressions, built-in or user-defined functions, but not aggregate functions.",
13927
- "- You can specify functions that return multiple values for metrics, such as \\<func(price) as \\`col1\\`col2\\> (the column names must be specified).",
14169
+ "`metrics` is metacode (which can be a tuple) specifying the calculation formulas. For more information about metacode, please refer to :doc:`/Objects/Metaprogramming`.",
13928
14170
  "",
13929
- "`matchingColumn` is a STRING scalar/vector, or a tuple of STRING vectors indicating the matching column(s). It can be integral, temporal or literal (excluding UUID) types.",
14171
+ "- *metrics* can use one or more expressions, built-in or user-defined functions, but not aggregate functions.",
14172
+ "- *metrics* can be functions that return multiple values and the columns in the output table to hold the return values must be specified. For example, \\<func(price) as \\`col1\\`col2\\>.",
14173
+ "- To specify a column that exists in both the left and the right tables, use the format `tableName.colName`. By default, the column from the left table is used.",
13930
14174
  "",
13931
- "Specify *matchingColumn* following the rules below:",
14175
+ "`matchingColumn` is a STRING scaler/vector/tuple indicating the column(s) on which the tables are joined. It supports integral, temporal or literal (except UUID) types.",
13932
14176
  "",
13933
- "\\1. When there is only 1 matching column - If the names of the matching column are the same in both tables, *matchingColumn* should be specified as a STRING scalar; otherwise it's a tuple of two elements. For example, if the matching column is named \"sym\" in the left table and \"sym1\" in the right table, then *matchingColumn* = [[\\`sym],[\\`sym1]].",
14177
+ "\\1. When there is only 1 column to match - If the names of the columns to match are the same in both tables, *matchingColumn* should be specified as a STRING scalar; otherwise it's a tuple of two elements. For example, if the column is named \"sym\" in the left table and \"sym1\" in the right table, then *matchingColumn* = [[\\`sym],[\\`sym1]].",
13934
14178
  "",
13935
- "\\2. When there are multiple matching columns - If the names of the matching columns are all the same in both tables, specify *matchingColumn* as a STRING vector; otherwise it's a tuple of two elements. For example, if the matching columns are named \"timestamp\" and \"sym\" in the left table, whereas in the right table they're named \"timestamp\" and \"sym1\", then *matchingColumn* = [[\\`timestamp, \\`sym], [\\`timestamp,\\`sym1]].",
14179
+ "\\2. When there are multiple columns to match - If both tables share the names of all columns to match, *matchingColumn* is a STRING vector; otherwise it's a tuple of two elements. For example, if the columns are named \"timestamp\" and \"sym\" in the left table, whereas in the right table they're named \"timestamp\" and \"sym1\", then *matchingColumn* = [[\\`timestamp, \\`sym], [\\`timestamp,\\`sym1]].",
13936
14180
  "",
13937
- "`rightTimeColumn` is a STRING scalar, indicating the time column in the right table. If the parameter is specified, the right table will keep the record with the latest timestamp. If there are multiple records with identical timestamp, only the latest is retained. If the parameter is not specified, the latest ingested record based on the system time will be kept.",
14181
+ "`rightTimeColumn` is a STRING scalar indicating the time column in the right table. If the parameter is specified, the right table will keep the record with the latest timestamp. If there are multiple records with identical timestamps, only the latest record is retained. If the parameter is not specified, the latest ingested record (based) on the system time will be kept.",
13938
14182
  "",
13939
- "`checkTimes` is a temporal vector or DURATION scalar. If it is specified, the system will regularly update the data set in the right table (with only the latest record kept).",
14183
+ "`checkTimes` is a vector of temporal values or a DURATION scalar. If it is specified, the system will regularly update the right table (keeping only the latest data) and ingests the latest data to the lookup join engine. If the right table does not need to be updated regularly, you can leave *checkTimes* empty, but make sure to manually ingest the table data to the engine after it has been created. ",
13940
14184
  "",
13941
- "- If *checkTimes* is a temporal vector, it is of SECOND, TIME or NANOTIME type. The lookup join engine updates the right table on a daily basis according to the time specified by each element in the vector.",
14185
+ "- If *checkTimes* is a vector of temporal values, it must be of SECOND, TIME or NANOTIME type. The lookup join engine updates the right table according to the time specified by each element in the vector on a daily basis.",
13942
14186
  "",
13943
14187
  "- If *checkTimes* is a DURATION scalar, it indicates the interval to update the right table."
13944
14188
  ]
@@ -14104,7 +14348,7 @@
14104
14348
  "=== ======= ======= =======",
14105
14349
  "",
14106
14350
  "Ex 4:",
14107
- "Join the left table \"trades\" (a real-time stream table) and the right table \"prices\" (a dimension table with relatively infrequent updates) to look up the matched records in column \"id\" from the right table.",
14351
+ "Join the left table \"trades\" (a real-time stream table) and the right table \"prices\" (a dimension table with infrequent updates) to look up the matched records in column \"id\" from the right table.",
14108
14352
  ""
14109
14353
  ]
14110
14354
  },
@@ -14197,18 +14441,18 @@
14197
14441
  "",
14198
14442
  "`compressMethods` a dictionary indicating which compression methods are used for specified columns. The keys are columns name and the values are compression methods (\"lz4\" or \"delta\"). If unspecified, use LZ4 compression method. Please note that the delta compression method can only be used for SHORT, INT, LONG or temporal data types. ",
14199
14443
  "",
14200
- "`sortColumns` is a string scalar/vector to specify the sort columns. Data with the same key are stored together in order in each partition.",
14444
+ "`sortColumns` is a STRING scalar/vector that specifies the columns to sort the ingested data within each partition. The sort columns must be of integral, temporal, string, or symbol type. Note that *sortColumns* is not necessarily consistent with the partitioning column.",
14201
14445
  "",
14202
- "* It is more suitable to specify columns that are frequently queried or contain massive data such as stock tickers or device names for sortColumns. When querying, elements of sortColumns can be used as the indices to locate the data storage files.",
14203
- "* If more than one columns are specified for sortColumns, it is recommended to specify a temporal column as the last sort column.",
14204
- "* sortColumns must be integer, date/time, string or symbol type.",
14205
- "* sortColumns is used to arrange the data within each partition. It is not necessarily consistent with the partitioning column.",
14446
+ "- If multiple columns are specified for *sortColumns*, the last column must be a time column. The preceding columns are used as the sort keys and they cannot be of TIME, TIMESTAMP, NANOTIME, or NANOTIMESTAMP type.",
14447
+ "- If only one column is specified for *sortColumns*, the column is used as the sort key, and it can be a time column or not. If the sort column is a time column and *sortKeyMappingFunction* is specified, the sort column specified in a SQL where condition can only be compared with temporal values of the same data type.",
14448
+ "- It is recommended to specify frequently-queried columns for *sortColumns* and sort them in the descending order of query frequency, which ensures that frequently-used data is readily available during query processing.",
14449
+ "- The number of sort key entries (which are unique combinations of the values of the sort keys) within each partition may not exceed 1000 for optimal performance. This limitation prevents excessive memory usage and ensures efficient query processing.",
14206
14450
  "",
14207
- "`keepDuplicates` specifies how to deal with records with duplicate sortColumns values. It can have the following values:",
14451
+ "`keepDuplicates` specifies how to deal with records with duplicate *sortColumns* values. It can have the following values:",
14208
14452
  "",
14209
- "* ALL: keep all records",
14210
- "* LAST: only keep the last record",
14211
- "* FIRST: only keep the first record",
14453
+ "- ALL: keep all records;",
14454
+ "- LAST: only keep the last record;",
14455
+ "- FIRST: only keep the first record.",
14212
14456
  "",
14213
14457
  "It is recommended to specify the *sortKeyMappingFunction* parameter if there are many sort keys in a partition of a TSDB database and a small number of records with the same sort key. After dimensionality reduction, the blocks in a TSDB level file can store more data, which not only reduces the frequency of reading data blocks and disk I/O during query, but also improves the data compression ratio.",
14214
14458
  "",
@@ -14537,6 +14781,7 @@
14537
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",
14538
14782
  "* order-sensitive function: deltas, ratios, ffill, move, prev, iterate, ewmMean, ewmVar, ewmStd, ewmCov, ewmCorr",
14539
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",
14540
14785
  "* other: talibNull, talibNull, fixedLengthArrayVector, dynamicGroupCumsum, dynamicGroupCumcount",
14541
14786
  "",
14542
14787
  "Note:",
@@ -14827,7 +15072,7 @@
14827
15072
  {
14828
15073
  "type": "text",
14829
15074
  "value": [
14830
- "createTable(dbHandle, table, tableName, [compressMethods])"
15075
+ "createTable(dbHandle, table, tableName, [compressMethods], [sortColumns], [keepDuplicates=ALL])"
14831
15076
  ]
14832
15077
  }
14833
15078
  ]
@@ -14845,7 +15090,20 @@
14845
15090
  "",
14846
15091
  "`tableName` is a string indicating the name of the dimension table to be created.",
14847
15092
  "",
14848
- "`compressMethods` a dictionary indicating which compression methods are used for specified columns. The keys are columns name and the values are compression methods (\"lz4\" or \"delta\"). If unspecified, use LZ4 compression method. Please note that the delta compression method can only be used for SHORT, INT, LONG or temporal data types."
15093
+ "`compressMethods` a dictionary indicating which compression methods are used for specified columns. The keys are columns name and the values are compression methods (\"lz4\" or \"delta\"). If unspecified, use LZ4 compression method. Please note that the delta compression method can only be used for SHORT, INT, LONG or temporal data types.",
15094
+ "",
15095
+ "`sortColumns` is a STRING scalar/vector that specifies the columns to sort the ingested data within each partition. The sort columns must be of integral, temporal, string, or symbol type. Note that *sortColumns* is not necessarily consistent with the partitioning column.",
15096
+ "",
15097
+ "- If multiple columns are specified for *sortColumns*, the last column must be a time column. The preceding columns are used as the sort keys and they cannot be of TIME, TIMESTAMP, NANOTIME, or NANOTIMESTAMP type.",
15098
+ "- If only one column is specified for *sortColumns*, the column is used as the sort key, and it can be a time column or not.",
15099
+ "- It is recommended to specify frequently-queried columns for *sortColumns* and sort them in the descending order of query frequency, which ensures that frequently-used data is readily available during query processing.",
15100
+ "- The number of sort key entries (which are unique combinations of the values of the sort keys) within each partition may not exceed 1000 for optimal performance. This limitation prevents excessive memory usage and ensures efficient query processing.",
15101
+ "",
15102
+ "`keepDuplicates` specifies how to deal with records with duplicate *sortColumns* values. It can have the following values:",
15103
+ "",
15104
+ "- ALL: keep all records;",
15105
+ "- LAST: only keep the last record;",
15106
+ "- FIRST: only keep the first record."
14849
15107
  ]
14850
15108
  }
14851
15109
  ]
@@ -15608,7 +15866,45 @@
15608
15866
  {
15609
15867
  "type": "text",
15610
15868
  "value": [
15611
- "createWindowJoinEngine(name, leftTable, rightTable, outputTable, window, metrics, matchingColumn, [timeColumn], [useSystemTime=false], [garbageSize = 5000], [maxDelayedTime])"
15869
+ "createWindowJoinEngine(name, leftTable, rightTable, outputTable, window, metrics, matchingColumn, [timeColumn], [useSystemTime=false], [garbageSize = 5000], [maxDelayedTime], [nullFill])"
15870
+ ]
15871
+ }
15872
+ ]
15873
+ },
15874
+ {
15875
+ "title": "Details",
15876
+ "type": "detail",
15877
+ "children": [
15878
+ {
15879
+ "type": "text",
15880
+ "value": [
15881
+ "Create a window join streaming engine. Return a table object that is the real-time :doc:`/SQLStatements/TableJoiners/windowjoin` result of a left table and a right table. While the SQL window join only accepts aggregate functions as metrics, the window join streaming engine also supports non-aggregate functions.",
15882
+ "",
15883
+ "Data ingested into the engine is grouped by :ref:`matchingColumn <matchingColumnWJ>`. Within a group, for each record in the left table, calculate the :ref:`metrics <metricsWJ>` over the specified window in the right table and return the metrics in additional columns.",
15884
+ "",
15885
+ "* Standard windows (i.e., *window* = `a:b`):",
15886
+ "",
15887
+ "The windows over the right table are determined by the current timestamp in the left table and the specified parameter *window*. Suppose the current timestamp in the left table is `t`, and window is set to `a:b`, then the corresponding window in the right table consists of records with timestamps in [`t+a`, `t+b`]. The engine returns the join result containing the results of the metrics calculated using the windowed data.",
15888
+ "",
15889
+ " Window triggering rules:",
15890
+ "",
15891
+ " \\1. A window is triggered when a timestamp (with the same *matchingColumn* value) past the end of that window arrives in the right table. The record itself does not participate in the calculation of that window. ",
15892
+ "",
15893
+ " \\2. If *maxDelayedTime* is specified - a new timestamp `t` (regardless of its *matchingColumn* value) in the right table triggers an uncalculated window when `t > b + maxDelayedTime`)",
15894
+ "",
15895
+ "* Special windows (i.e., *window* = `0:0`, *maxDelayedTime* is not supported) ",
15896
+ "",
15897
+ "The windows over the right table are determined by the current timestamp in the left table and its previous timestamp. Suppose the current timestamp in the left table is `t` and the previous timestamp is `t0`, then the corresponding window in the right table consists of records with timestamps in [`t0`, `t`). ",
15898
+ "",
15899
+ " Window triggering rules:",
15900
+ "",
15901
+ " - When *useSystemTime* = false, a window is triggered when a timestamp past the end of that window arrives in the right table.",
15902
+ "",
15903
+ " - When *useSystemTime* = true, a window is triggered at the ingestion of each record in the left table.",
15904
+ "",
15905
+ "Note: When *window* = `0:0`, if *metrics* contains a non-aggregate function which applies to a right table column, the corresponding output column must be specified as an array vector of the appropriate data type.",
15906
+ "",
15907
+ "For more application scenarios of streaming engines, see :doc:`../../Themes/streamingEngine`."
15612
15908
  ]
15613
15909
  }
15614
15910
  ]
@@ -15620,72 +15916,66 @@
15620
15916
  {
15621
15917
  "type": "text",
15622
15918
  "value": [
15623
- "`name` is a required STRING indicating the name of the window join engine.",
15919
+ "`name` is a string indicating the name of the window join streaming engine. It is the unique identifier of the engine on a data/compute node. It can contain letters, numbers and underscores and must start with a letter.",
15624
15920
  "",
15625
- "`leftTable` and `rightTable` are tables whose sole purpose is to provide the engine with schemas of the subscribed stream tables. It doesn't matter if the tables contain data or not.",
15921
+ "`leftTable` and `rightTable` are table objects whose schema must be the same as the stream table to which the engine subscribes.",
15626
15922
  "",
15627
- "`outputTable` is a table to hold the calculation results. Before calling ``createWindowJoinEngine``, set up an empty table as the *outputTable* and specify the column names and data types. The window join engine will write the calculation results into this table.",
15923
+ "`outputTable` is a table to which the engine inserts calculation result. ",
15628
15924
  "",
15629
- "The columns of the *outputTable* are in the following order: the temporal column, the matching column, the columns corresponding to the calculation results. Specifically:",
15925
+ "The columns of outputTable are in the following order:",
15630
15926
  "",
15631
15927
  "\\(1) The first column must be of temporal type.",
15632
15928
  "",
15633
15929
  "- If *useSystemTime* = true, the column must be of TIMESTAMP type.",
15634
15930
  "- If *useSystemTime* = false, the column must be of the same type as the *timeColumn*.",
15635
15931
  "",
15636
- "\\(2) The subsequent column(s) are the matching column(s), arranged in the same order as specified in *matchingColumn*.",
15932
+ "\\(2) Then followed by the the column(s) on which the tables are joined, arranged in the same order as specified in *matchingColumn*.",
15637
15933
  "",
15638
- "\\(3) The last columns are calculation results. There can be more than 1 result column.",
15934
+ "\\(3) Further followed by the columns holding the calculation results. There can be more than 1 result column.",
15639
15935
  "",
15640
- "`window` is a pair of integers or duration values, indicating the range of the sliding window, including both left and right bounds.",
15936
+ "`window` is a pair of integers or duration values, indicating the range of a sliding window, including both left and right bounds.",
15641
15937
  "",
15642
- "`metrics` is a required parameter indicating calculation metrics in the form of metacode. It can use one or more expressions, and built-in or user-defined functions. You can specify functions that return multiple values for metrics, such as <func(price) as \\`col1\\`col2>. For details about metacode, see :doc:`/Objects/Metaprogramming`。",
15938
+ ".. _metricsWJ:",
15643
15939
  "",
15644
- "When only the columns in the *rightTable* are involved in calculation, the window join engine optimizes the performance of the following functions: sum, sum2, avg, std, var, corr, covar, wavg, wsum, beta, max, min, last, first, med, percentile。",
15940
+ "`metrics` is metacode (which can be a tuple) specifying the calculation formulas. For more information about metacode, please refer to :doc:`/Objects/Metaprogramming`。",
15645
15941
  "",
15646
- "`matchingColumn` indicates one or more columns based on which the tables are joined. It can be a scalar, vector or tuple of integral, temporal or literal (excluding UUID) types.",
15942
+ "- *metrics* can use one or more expressions, built-in or user-defined functions (both aggregate functions and non-aggregate functions are accepted).",
15943
+ "- *metrics* can be functions that return multiple values and the columns in the output table to hold the return values must be specified. For example, <func(price) as \\`col1\\`col2>.",
15647
15944
  "",
15648
- "Specify *matchingColumn* following the rules below:",
15945
+ "If you want to specify a column that exists in both the left and the right tables, use the format `tableName.colName` to indicate which. By default, the column from the left table is used.",
15649
15946
  "",
15650
- "\\1. When there is only 1 matching column - If the names of the matching column are the same in both tables, *matchingColumn* should be specified as a STRING scalar; otherwise it's a tuple of two elements. For example, if the matching column is named \"sym\" in the left table and \"sym1\" in the right table, then *matchingColumn* = [[\\`sym],[\\`sym1]].",
15947
+ "Performance will be optimized when the following functions are applied to and only to columns from the right table. ``sum``, ``sum2``, ``avg``, ``std``, ``var``, ``corr``, ``covar``, ``wavg``, ``wsum``, ``beta``, ``max``, ``min``, ``last``, ``first``, ``med``, ``percentile``.",
15651
15948
  "",
15652
- "\\2. When there are multiple matching columns - If the names of the matching columns are all the same in both tables, specify *matchingColumn* as a STRING vector; otherwise it's a tuple of two elements. For example, if the matching columns are named \"timestamp\" and \"sym\" in the left table, whereas in the right table they're named \"timestamp\" and \"sym1\", then matchingColumn = [[\\`timestamp, \\`sym], [\\`timestamp,\\`sym1]]. ",
15949
+ ".. _matchingColumnWJ:",
15653
15950
  "",
15654
- "`timeColumn` is an optional parameter. When *useSystemTime* = false, specify this parameter to indicate the name of the temporal columns in the tables to be joined. The name of temporal columns in the *leftTable* and *rightTable* can be different, but the data type must be the same, in which case *timeColumn* is a STRING vector of 2 elements.",
15951
+ "`matchingColumn` is a STRING scaler/vector/tuple indicating the column(s) on which the tables are joined. It supports integral, temporal or literal (except UUID) types.",
15655
15952
  "",
15656
- "`useSystemTime` indicates whether the first column (i.e., the temporal column) of the *outputTable* uses the system time (*useSystemTime* = true) or the temporal column from the left table (*useSystemTime* = false). This parameter is optional.",
15953
+ "\\1. When there is only 1 column to match - If the names of the matching column are the same in both tables, *matchingColumn* should be specified as a STRING scalar; otherwise it's a tuple of two elements. For example, if the column is named \"sym\" in the left table and \"sym1\" in the right table, then *matchingColumn* = [[\\`sym],[\\`sym1]].",
15657
15954
  "",
15658
- "* *useSystemTime* = true, to calculate according to the timestamp when each record is ingested into the streaming engine (with millisecond precision) instead of *timeColumn*.",
15955
+ "\\2. When there are multiple columns to match - If the names of all the columns to match are the same in both tables, *matchingColumn* is a STRING vector; otherwise it's a tuple of two elements. For example, if the columns are named \"timestamp\" and \"sym\" in the left table, whereas in the right table they're named \"timestamp\" and \"sym1\", then matchingColumn = [[\\`timestamp, \\`sym], [\\`timestamp,\\`sym1]]. ",
15659
15956
  "",
15660
- "* *useSystemTime* = false (default), to calculate according to timeColumn instead of the timestamp when each record is ingested into the engine.",
15957
+ "`timeColumn` is an optional parameter. When *useSystemTime* = false, it must be specified to indicate the name(s) of the time column in the left table and the right table. The time columns must have the same data type. If the names of the time column in the left table and the right table are the same, timeColumn is a string. Otherwise, it is a vector of 2 strings indicating the time column in each table.",
15661
15958
  "",
15662
- "`garbageSize` is an optional integer greater than 0. The default value is 5,000 (in units of bytes). As the subscribed data is ingested into the streaming engine, it occupies an increasing amount of memory. When the number of rows in memory exceeds *garbageSize*, the system will clear the data that is not needed for the current calculation.",
15959
+ "`useSystemTime` is an optional parameter indicating whether the left table and the right table are joined on the system time, instead of on the *timeColumn*.",
15663
15960
  "",
15664
- "`maxDelayedTime` is an optional integer greater than 0. Use this parameter to specify the waiting time before triggering a calculation for the grouped data in the engine that has not been output for a long time. The default value is 3 (in units of seconds). To specify *maxDelayedTime*, *useSystemTime* must be specifed as false.",
15961
+ "* *useSystemTime* = true: join records based on the system time (timestamp with millisecond precision) when they are ingested into the engine.",
15665
15962
  "",
15666
- "`nullFill` is a tuple of the same size as the number of output columns. It is used to fill in the NULL values in the output table. The data type of each element corresponds to each output column."
15667
- ]
15668
- }
15669
- ]
15670
- },
15671
- {
15672
- "title": "Details",
15673
- "type": "detail",
15674
- "children": [
15675
- {
15676
- "type": "text",
15677
- "value": [
15678
- "Create the window join streaming engine. Return a table that is the :doc:`/SQLStatements/TableJoiners/windowjoin` result of a left table and a right table. This function is usually used in conjunction with :doc:`../s/subscribeTable`.",
15963
+ "* *useSystemTime* = false (default): join records based on the specified timeColumn from the left table and the right table.",
15679
15964
  "",
15680
- "Note: Only function :doc:`../a/appendForJoin`、:doc:`/FunctionsandCommands/FunctionReferences/g/getLeftStream` or :doc:`/FunctionsandCommands/FunctionReferences/g/getRightStream` can be used to ingest data into the window join engine.",
15965
+ "`garbageSize` is an optional parameter. It is a positive integer with the default value of 5,000 (rows). As the subscribed data is ingested into the engine, it continues to take up the memory. Within the left/right table, the records are grouped by *matchingColumn* values; When the number of records in a group exceeds *garbageSize*, the system will remove those already been calculated from memory.",
15681
15966
  "",
15682
- "Calculation rules of the engine:",
15967
+ ".. _maxDelayedTimeWJ:",
15683
15968
  "",
15684
- "\\1. With data grouped based on the *matchingColumn*, the timestamp of each record from the left table determines a time window in the right table. The calculation of each window is triggered by the arrival of the first record after the current window ends.",
15969
+ "`maxDelayedTime` is an optional parameter. It is a positive integer with the default value of 3 (seconds). Use *maxDelayedTime* to trigger windows which remain uncalculated long past its end. *maxDelayedTime* only takes effect when *timeColumn* is specified and the two arguments must have the same time precision. For more information about this parameter, see \"Window triggering rules\" in the Details section.",
15685
15970
  "",
15686
- "\\2. If the current window is the last one in a group, then its calculation is triggered when the latest timestamp t1 in the right table satisfies (t1> t+right bound of the window + maxDelayedTime). ",
15971
+ "`nullFill` is a tuple of the same size as the number of output columns. The data type of each element corresponds to each output column. It is used to fill in the NULL values and missing values in the output table. except",
15687
15972
  "",
15688
- "Note: Only the :doc:`../a/appendForJoin` function can be used to insert data into the window join engine."
15973
+ "Note that the following values are not filled:",
15974
+ "",
15975
+ "- existing NULL values from right table columns",
15976
+ "",
15977
+ "- results of non-aggregate calculation",
15978
+ ""
15689
15979
  ]
15690
15980
  }
15691
15981
  ]
@@ -15702,54 +15992,104 @@
15702
15992
  " $ share streamTable(1:0, `time`sym`price, [TIMESTAMP, SYMBOL, DOUBLE]) as leftTable",
15703
15993
  " $ share streamTable(1:0, `time`sym`val, [TIMESTAMP, SYMBOL, DOUBLE]) as rightTable",
15704
15994
  " $ output=table(100:0, `time`sym`factor1`factor2`factor3, [TIMESTAMP, SYMBOL, DOUBLE, DOUBLE, DOUBLE])",
15705
- " $ wjEngine=createWindowJoinEngine(name=\"test1\", leftTable=leftTable, rightTable=rightTable, outputTable=output, window=-2:2, metrics=<[price,val,sum(val)]>, matchingColumn=`sym, timeColumn=`time, useSystemTime=false,maxDelayedTime=4)",
15995
+ "",
15996
+ " $ nullFill= [2012.01.01T00:00:00.000, `NONE, 0.0, 0.0, 0.0]",
15997
+ " $ wjEngine=createWindowJoinEngine(name=\"test1\", leftTable=leftTable, rightTable=rightTable, outputTable=output, window=-2:2, metrics=<[price,val,sum(val)]>, matchingColumn=`sym, timeColumn=`time, useSystemTime=false,nullFill=nullFill)",
15706
15998
  "",
15707
15999
  " $ subscribeTable(tableName=\"leftTable\", actionName=\"joinLeft\", offset=0, handler=appendForJoin{wjEngine, true}, msgAsTable=true)",
15708
16000
  " $ subscribeTable(tableName=\"rightTable\", actionName=\"joinRight\", offset=0, handler=appendForJoin{wjEngine, false}, msgAsTable=true)",
15709
16001
  "",
15710
- " $ def writeData(begin, end, tablename, wjEngine){",
15711
- " $ n = end - begin",
15712
- " $ if(tablename == \"leftTable\"){",
15713
- " $ tp1=table(take(2012.01.01T00:00:00.000+begin..end, 2*n) as time, take(`AAPL, n) join take(`IBM, n) as sym, take(double(1..n),2*n) as price)",
15714
- " $ tp1.sortBy!(`time)",
15715
- " $ objByName(tablename).append!(tp1)",
15716
- " $ appendForJoin(wjEngine, true, tp1)\t\t",
15717
- " $ }else{",
15718
- " $ tp2=table(take(2012.01.01T00:00:00.000+begin..end, 2*n) as time, take(`AAPL, n) join take(`IBM, n) as sym, take(double(1..n),2*n) as val)",
15719
- " $ tp2.sortBy!(`time)",
15720
- " $ objByName(tablename).append!(tp2)",
15721
- " $ appendForJoin(wjEngine, false, tp2)",
15722
- " $ }\t",
15723
- " $ }",
16002
+ " $ n=10",
16003
+ " $ tp1=table(take(2012.01.01T00:00:00.000+0..10, 2*n) as time, take(`AAPL, n) join take(`IBM, n) as sym, take(NULL join rand(10.0, n-1),2*n) as price)",
16004
+ " $ tp1.sortBy!(`time)",
16005
+ " $ leftTable.append!(tp1)",
15724
16006
  "",
15725
- " $ writeData(0, 10, \"leftTable\", wjEngine)",
15726
- " $ writeData(0, 10, \"rightTable\", wjEngine)",
16007
+ " $ tp2=table(take(2012.01.01T00:00:00.000+0..10, 2*n) as time, take(`AAPL, n) join take(`IBM, n) as sym, take(double(1..n),2*n) as val)",
16008
+ " $ tp2.sortBy!(`time)",
16009
+ " $ rightTable.append!(tp2)",
15727
16010
  "",
15728
- " $ select * from output where time between 2012.01.01T00:00:00.006:2012.01.01T00:00:00.010",
16011
+ " $ select * from output where time between 2012.01.01T00:00:00.000:2012.01.01T00:00:00.001",
15729
16012
  ""
15730
16013
  ]
15731
16014
  },
15732
16015
  {
15733
16016
  "type": "text",
15734
16017
  "value": [
15735
- "======================= ==== ======= ======= =======",
15736
- "time sym factor1 factor2 factor3",
15737
- "======================= ==== ======= ======= =======",
15738
- "2012.01.01T00:00:00.006 AAPL 7 5 35",
15739
- "2012.01.01T00:00:00.006 AAPL 7 6 35",
15740
- "2012.01.01T00:00:00.006 AAPL 7 7 35",
15741
- "2012.01.01T00:00:00.006 AAPL 7 8 35",
15742
- "2012.01.01T00:00:00.006 AAPL 7 9 35",
15743
- "2012.01.01T00:00:00.006 IBM 8 6 40",
15744
- "2012.01.01T00:00:00.006 IBM 8 7 40",
15745
- "2012.01.01T00:00:00.006 IBM 8 8 40",
15746
- "2012.01.01T00:00:00.006 IBM 8 9 40",
15747
- "2012.01.01T00:00:00.006 IBM 8 10 40",
15748
- "2012.01.01T00:00:00.007 IBM 9 7 34",
15749
- "2012.01.01T00:00:00.007 IBM 9 8 34",
15750
- "2012.01.01T00:00:00.007 IBM 9 9 34",
15751
- "2012.01.01T00:00:00.007 IBM 9 10 34",
15752
- "======================= ==== ======= ======= ======="
16018
+ "+-------------------------+------+---------+---------+---------+",
16019
+ "| time | sym | factor1 | factor2 | factor3 |",
16020
+ "+=========================+======+=========+=========+=========+",
16021
+ "| 2012.01.01T00:00:00.000 | AAPL | 0 | 1 | 6 |",
16022
+ "+-------------------------+------+---------+---------+---------+",
16023
+ "| 2012.01.01T00:00:00.000 | AAPL | 0 | 2 | 6 |",
16024
+ "+-------------------------+------+---------+---------+---------+",
16025
+ "| 2012.01.01T00:00:00.000 | AAPL | 0 | 3 | 6 |",
16026
+ "+-------------------------+------+---------+---------+---------+",
16027
+ "| 2012.01.01T00:00:00.001 | AAPL | 5.2705 | 1 | 10 |",
16028
+ "+-------------------------+------+---------+---------+---------+",
16029
+ "| 2012.01.01T00:00:00.001 | AAPL | 5.2705 | 2 | 10 |",
16030
+ "+-------------------------+------+---------+---------+---------+",
16031
+ "| 2012.01.01T00:00:00.001 | AAPL | 5.2705 | 3 | 10 |",
16032
+ "+-------------------------+------+---------+---------+---------+",
16033
+ "| 2012.01.01T00:00:00.001 | AAPL | 5.2705 | 4 | 10 |",
16034
+ "+-------------------------+------+---------+---------+---------+",
16035
+ "| 2012.01.01T00:00:00.000 | IBM | 5.2705 | 2 | 9 |",
16036
+ "+-------------------------+------+---------+---------+---------+",
16037
+ "| 2012.01.01T00:00:00.000 | IBM | 5.2705 | 3 | 9 |",
16038
+ "+-------------------------+------+---------+---------+---------+",
16039
+ "| 2012.01.01T00:00:00.000 | IBM | 5.2705 | 4 | 9 |",
16040
+ "+-------------------------+------+---------+---------+---------+",
16041
+ "| 2012.01.01T00:00:00.001 | IBM | 1.0179 | 2 | 14 |",
16042
+ "+-------------------------+------+---------+---------+---------+",
16043
+ "| 2012.01.01T00:00:00.001 | IBM | 1.0179 | 3 | 14 |",
16044
+ "+-------------------------+------+---------+---------+---------+",
16045
+ "| 2012.01.01T00:00:00.001 | IBM | 1.0179 | 4 | 14 |",
16046
+ "+-------------------------+------+---------+---------+---------+",
16047
+ "| 2012.01.01T00:00:00.001 | IBM | 1.0179 | 5 | 14 |",
16048
+ "+-------------------------+------+---------+---------+---------+",
16049
+ "",
16050
+ "Example for *window* = 0:0:",
16051
+ ""
16052
+ ]
16053
+ },
16054
+ {
16055
+ "type": "code",
16056
+ "language": "console",
16057
+ "value": [
16058
+ " ",
16059
+ " $ share streamTable(1:0, `time`sym`price, [TIMESTAMP, SYMBOL, DOUBLE]) as leftTable",
16060
+ " $ share streamTable(1:0, `time`sym`val, [TIMESTAMP, SYMBOL, DOUBLE]) as rightTable",
16061
+ "",
16062
+ " $ v = [1, 5, 10, 15]",
16063
+ " $ tp1=table(2012.01.01T00:00:00.000+v as time, take(`AAPL, 4) as sym, rand(10.0,4) as price)",
16064
+ "",
16065
+ " $ v = [1, 2, 3, 4, 5, 6, 9, 15]",
16066
+ " $ tp2=table(2012.01.01T00:00:00.000+v as time, take(`AAPL, 8) as sym, rand(10.0,8) as val)",
16067
+ "",
16068
+ " $ output=table(100:0, `time`sym`price`val`sum_val, [TIMESTAMP, SYMBOL, DOUBLE, DOUBLE[], DOUBLE])",
16069
+ " $ wjEngine=createWindowJoinEngine(name=\"test1\", leftTable=leftTable, rightTable=rightTable, outputTable=output, window=0:0, metrics=<[price, val, sum(val)]>, matchingColumn=`sym, timeColumn=`time, useSystemTime=false)",
16070
+ "",
16071
+ " $ subscribeTable(tableName=\"leftTable\", actionName=\"joinLeft\", offset=0, handler=appendForJoin{wjEngine, true}, msgAsTable=true)",
16072
+ " $ subscribeTable(tableName=\"rightTable\", actionName=\"joinRight\", offset=0, handler=appendForJoin{wjEngine, false}, msgAsTable=true)",
16073
+ "",
16074
+ " $ leftTable.append!(tp1)",
16075
+ " $ rightTable.append!(tp2)",
16076
+ ""
16077
+ ]
16078
+ },
16079
+ {
16080
+ "type": "text",
16081
+ "value": [
16082
+ "+-------------------------+------+--------+----------------------------------+---------+",
16083
+ "| time | sym | price | val | sum_val |",
16084
+ "+=========================+======+========+==================================+=========+",
16085
+ "| 2012.01.01T00:00:00.001 | AAPL | 8.8252 | [] | |",
16086
+ "+-------------------------+------+--------+----------------------------------+---------+",
16087
+ "| 2012.01.01T00:00:00.005 | AAPL | 7.1195 | [7.495792,9.417891,1.419681,...] | 21.3741 |",
16088
+ "+-------------------------+------+--------+----------------------------------+---------+",
16089
+ "| 2012.01.01T00:00:00.010 | AAPL | 5.2217 | [4.840462,8.086567,3.495306] | 16.4223 |",
16090
+ "+-------------------------+------+--------+----------------------------------+---------+",
16091
+ "| 2012.01.01T00:00:00.015 | AAPL | 9.2517 | [] | |",
16092
+ "+-------------------------+------+--------+----------------------------------+---------+"
15753
16093
  ]
15754
16094
  }
15755
16095
  ]
@@ -20910,7 +21250,7 @@
20910
21250
  "",
20911
21251
  "\\5. VIEW_EXEC: execute view functions",
20912
21252
  "",
20913
- "\\6. DB_MANAGE: create and delete databases",
21253
+ "\\6. DB_MANAGE: delete databases",
20914
21254
  "",
20915
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. ",
20916
21256
  "",
@@ -21358,11 +21698,11 @@
21358
21698
  {
21359
21699
  "type": "text",
21360
21700
  "value": [
21361
- "dict(keyObj, valueObj) ",
21701
+ "dict(keyObj, valueObj, [ordered=false]) ",
21362
21702
  "",
21363
21703
  "or",
21364
21704
  "",
21365
- "dict(keyType, valueType)"
21705
+ "dict(keyType, valueType, [ordered=false])"
21366
21706
  ]
21367
21707
  }
21368
21708
  ]
@@ -21378,9 +21718,11 @@
21378
21718
  "",
21379
21719
  "`valueObj` a vector indicating dictionary values.",
21380
21720
  "",
21381
- "`keyType` the data type of dictionary keys.",
21721
+ "`keyType` the data type of dictionary keys. The following data categories are supported: Integral (excluding COMPRESS), Temporal, Floating and Literal. ",
21382
21722
  "",
21383
- "`valueType` the data type of dictionary values."
21723
+ "`valueType` the data type of dictionary values. Note that COMPLEX, POINT and the Decimal category are not supported.",
21724
+ "",
21725
+ "`ordered` a Boolean value. The default value is false, which indicates to create a regular dictionary. True means to create an ordered dictionary. The regular dictionaries do not track the insertion order of the key-value pairs whereas the ordered dictionaries preserve the insertion order of key-value pairs. "
21384
21726
  ]
21385
21727
  }
21386
21728
  ]
@@ -21392,7 +21734,7 @@
21392
21734
  {
21393
21735
  "type": "text",
21394
21736
  "value": [
21395
- "Return a dictionary object. The system supports the following data categories for keys: Logical, Integral, Floating and Temporal. There are no restrictions regarding the data type of the values of a dictionary."
21737
+ "Return a dictionary object."
21396
21738
  ]
21397
21739
  }
21398
21740
  ]
@@ -21427,6 +21769,13 @@
21427
21769
  " $ dt=dict([`test], [1]);",
21428
21770
  " $ dt;",
21429
21771
  " test->1",
21772
+ "",
21773
+ " //create an ordered dictionary",
21774
+ " $z=dict(x,y,true)",
21775
+ " $z;",
21776
+ " 1->4.5",
21777
+ " 2->7.8",
21778
+ " 3->4.3",
21430
21779
  ""
21431
21780
  ]
21432
21781
  },
@@ -21457,7 +21806,7 @@
21457
21806
  {
21458
21807
  "type": "text",
21459
21808
  "value": [
21460
- "related system functions: :doc:`../a/array`, :doc:`../m/matrix`"
21809
+ "related system functions: :doc:`../a/array`, :doc:`../m/matrix`, :doc:`../d/dictUpdate!`, :doc:`../s/syncDict`"
21461
21810
  ]
21462
21811
  }
21463
21812
  ]
@@ -24010,9 +24359,9 @@
24010
24359
  "",
24011
24360
  "Note:",
24012
24361
  "",
24013
- "* The unit of the grouping time interval cannot be more granular than the unit of the temporal column.",
24014
- "* Please note that the unit “M” means month and the unit “m” means minute.",
24015
- "* DURATION type data cannot participate in calculations except when used in functions :doc:`../b/bar`, :doc:`wj </SQLStatements/TableJoiners/windowjoin>`, :doc:`pwj </SQLStatements/TableJoiners/windowjoin>`, :doc:`/SQLStatements/interval`, :doc:`../t/temporalAdd`, :doc:`../d/dailyAlignedBar`."
24362
+ "* The unit of the time interval used for grouping cannot be more granular than the unit of the temporal column.",
24363
+ "* Time units are case sensitive, for example, “M” means month and “m” means minute. If the unit of the time interval is M, use function :doc:`../m/month` to convert the time column values to months.",
24364
+ "* Data of DURATION type cannot participate in calculations."
24016
24365
  ]
24017
24366
  }
24018
24367
  ]
@@ -29700,164 +30049,6 @@
29700
30049
  }
29701
30050
  ]
29702
30051
  },
29703
- "getAsyncReplicationStatus": {
29704
- "title": "getAsyncReplicationStatus",
29705
- "type": "function",
29706
- "children": [
29707
- {
29708
- "title": "Syntax",
29709
- "type": "grammer",
29710
- "children": [
29711
- {
29712
- "type": "text",
29713
- "value": [
29714
- "getAsyncReplicationStatus()"
29715
- ]
29716
- }
29717
- ]
29718
- },
29719
- {
29720
- "title": "Arguments",
29721
- "type": "parameters",
29722
- "children": [
29723
- {
29724
- "type": "text",
29725
- "value": [
29726
- "None"
29727
- ]
29728
- }
29729
- ]
29730
- },
29731
- {
29732
- "title": "Details",
29733
- "type": "detail",
29734
- "children": [
29735
- {
29736
- "type": "text",
29737
- "value": [
29738
- "Check the status of asynchronous replication between clusters. This function is executed on the data nodes of the master cluster and returns only the status of the current node. The result contains the following columns:",
29739
- "",
29740
- "* Status: The status of async replication. It can be either \"running\" or \"stop\".",
29741
- "",
29742
- "* Tasks: The number of remaining tasks",
29743
- "",
29744
- "* Last_Failed_Cid: The cid of the last failed task",
29745
- "",
29746
- "* Last_Failed_Time: The timestamp of the last failed task",
29747
- "",
29748
- "* Reason: The reason for the replication failure",
29749
- "",
29750
- "When a task fails, the system will keep trying to resend the task until it still fails to send it after ten minutes. You can stop the process by calling :doc:`/FunctionsandCommands/CommandsReferences/s/stopAsyncReplication`."
29751
- ]
29752
- }
29753
- ]
29754
- },
29755
- {
29756
- "title": "Examples",
29757
- "type": "example",
29758
- "children": [
29759
- {
29760
- "type": "code",
29761
- "language": "console",
29762
- "value": [
29763
- " ",
29764
- " $ getAsyncReplicationStatus();",
29765
- "",
29766
- ""
29767
- ]
29768
- },
29769
- {
29770
- "type": "text",
29771
- "value": [
29772
- "========= ======= ================= ================== ========",
29773
- "Status Tasks Last_Failed_Cid Last_Failed_Time Reason ",
29774
- "========= ======= ================= ================== ========",
29775
- "running 0 -1 ",
29776
- "========= ======= ================= ================== ========"
29777
- ]
29778
- }
29779
- ]
29780
- }
29781
- ]
29782
- },
29783
- "getAsyncReplicationTasks": {
29784
- "title": "getAsyncReplicationTasks",
29785
- "type": "function",
29786
- "children": [
29787
- {
29788
- "title": "Syntax",
29789
- "type": "grammer",
29790
- "children": [
29791
- {
29792
- "type": "text",
29793
- "value": [
29794
- "getAsyncReplicationTasks([n])"
29795
- ]
29796
- }
29797
- ]
29798
- },
29799
- {
29800
- "title": "Arguments",
29801
- "type": "parameters",
29802
- "children": [
29803
- {
29804
- "type": "text",
29805
- "value": [
29806
- "`n` is an optional parameter indicating the number of tasks to be retrieved from the path specified by *asyncReplicationWorkDir*. If *n* is not specified, retrieve all tasks. "
29807
- ]
29808
- }
29809
- ]
29810
- },
29811
- {
29812
- "title": "Details",
29813
- "type": "detail",
29814
- "children": [
29815
- {
29816
- "type": "text",
29817
- "value": [
29818
- "After enabling the cross-cluster asynchronous replication mode, execute this function on a data node of the master cluster to retrieve tasks pending sending from the path specified by *asyncReplicationWorkDir*. Before you call this function, please make sure the asynchronous replication mode is in “stop” status.",
29819
- "",
29820
- "Return a table with the following columns:",
29821
- "",
29822
- "* Skip: A BOOLEAN value indicating whether this task is has a “skip“ flag. True means to skip.",
29823
- "",
29824
- "* Cid: The commit ID of the associated transaction.",
29825
- "",
29826
- "* Function: The associated function or command of the task.",
29827
- "",
29828
- "* Args: The number of parameters in the associated function or command."
29829
- ]
29830
- }
29831
- ]
29832
- },
29833
- {
29834
- "title": "Examples",
29835
- "type": "example",
29836
- "children": [
29837
- {
29838
- "type": "code",
29839
- "language": "console",
29840
- "value": [
29841
- " ",
29842
- " $ getAsyncReplicationTasks();",
29843
- ""
29844
- ]
29845
- },
29846
- {
29847
- "type": "text",
29848
- "value": [
29849
- "======= ===== ============================================== ======",
29850
- "Skip Cid Function Args ",
29851
- "======= ===== ============================================== ======",
29852
- "false 5 dropTable(database('dfs://test_copy'),'pt1') 0 ",
29853
- "true 6 append!{database('dfs://test_copy'),'pt2')} 1 ",
29854
- "======= ===== ============================================== ======"
29855
- ]
29856
- }
29857
- ]
29858
- }
29859
- ]
29860
- },
29861
30052
  "getAuthenticatedUsers": {
29862
30053
  "title": "getAuthenticatedUsers",
29863
30054
  "type": "function",
@@ -30370,95 +30561,6 @@
30370
30561
  }
30371
30562
  ]
30372
30563
  },
30373
- "getClusterChunksStatus": {
30374
- "title": "getClusterChunksStatus",
30375
- "type": "function",
30376
- "children": [
30377
- {
30378
- "title": "Syntax",
30379
- "type": "grammer",
30380
- "children": [
30381
- {
30382
- "type": "text",
30383
- "value": [
30384
- "getClusterChunksStatus()",
30385
- ""
30386
- ]
30387
- }
30388
- ]
30389
- },
30390
- {
30391
- "title": "Details",
30392
- "type": "detail",
30393
- "children": [
30394
- {
30395
- "type": "text",
30396
- "value": [
30397
- "Return the metadata about all database chunks (file chunks and tablet chunks) on the data nodes in a cluster. It can be executed only on a controller. ",
30398
- "",
30399
- "Return a table containing the following columns:",
30400
- "",
30401
- "- chunkId: the chunk ID",
30402
- "- file: the chunk path",
30403
- "- size: The disk space occupied by the file chunk (in Bytes). Return 0 for a tablet chunk. Use ``getTabletsMeta`` to check the disk usage of a tablet chunk.",
30404
- "- version: version number",
30405
- "- vcLength: length of the version chain",
30406
- "- versionChain: the version chain",
30407
- "- state: the status of the chunk. It can be ",
30408
- "",
30409
- " - CONSTRUCTING: in transaction;",
30410
- " - RECOVERING: recovering;",
30411
- " - COMPLETE: transaction completed",
30412
- "",
30413
- "- replicas: distribution of replicas",
30414
- "- replicaCount: the number of replicas",
30415
- "- lastUpdated: lastUpdated: the timestamp of the latest update. Please note that lastUpdated column is supported since version 2.00.1. For a chunk created before version 2.00.1, it returns a NULL value.",
30416
- "- permission: the chunk permission. It can be READ_ONLY and READ_WRITE (default). Chunks that are being transferred or stored in S3 are READ_ONLY.",
30417
- "",
30418
- "For READ_ONLY chunks:",
30419
- "",
30420
- "\\(1) Data cannot be appended or updated. Only drop operations can be performed to delete records. Transaction is supported in the READ_ONLY chunks (except for those stored in S3).",
30421
- "",
30422
- "\\(2) Operations such as recovery, rebalance and TSDB level file compaction cannot be performed."
30423
- ]
30424
- }
30425
- ]
30426
- },
30427
- {
30428
- "title": "Examples",
30429
- "type": "example",
30430
- "children": [
30431
- {
30432
- "type": "code",
30433
- "language": "console",
30434
- "value": [
30435
- "",
30436
- " $ rpc(getControllerAlias(), getClusterChunksStatus);",
30437
- ""
30438
- ]
30439
- },
30440
- {
30441
- "type": "text",
30442
- "value": [
30443
- "=================== =============== ==== ======= ======== =================== ======== ==================== ============== ======================== ===========",
30444
- "chunkId file size version vcLength versionChain state replicas replicaCount lastUpdated permission",
30445
- "=================== =============== ==== ======= ======== =================== ======== ==================== ============== ======================== ===========",
30446
- "092d5e12-e595-6f... /testDB/pt2.tbl 49 1 1 2052:49:1 -> COMPLETE P1-node1:1:0,P2-... 2 2022.03.31T18:09:41.138 READ_WRITE",
30447
- "42936e31-8be0-fa... /testDB/9/i 0 2 2 2053:0:2 -> 2051... COMPLETE P3-node1:2:0,P1-... 2 2022.03.31T18:09:41.138 READ_WRITE",
30448
- "d31e6b47-18f0-37... /testDB/7/i 0 2 2 2053:0:2 -> 2051... COMPLETE P1-node1:2:0,P2-... 2 2022.03.31T18:09:41.138 READ_WRITE",
30449
- "647a5fd6-cd85-3b... /testDB/6/i 0 2 2 2053:0:2 -> 2051... COMPLETE P1-node1:2:0,P3-... 2 2022.03.31T18:09:41.138 READ_WRITE",
30450
- "8bec6445-bc6d-36... /testDB/5/i 0 2 2 2053:0:2 -> 2051... COMPLETE P2-node1:2:0,P3-... 2 2022.03.31T18:09:41.138 READ_WRITE",
30451
- "ca690ba5-be73-a6... /testDB/4/i 0 2 2 2053:0:2 -> 2051... COMPLETE P3-node1:2:0,P1-... 2 2022.03.31T18:09:41.138 READ_WRITE",
30452
- "=================== =============== ==== ======= ======== =================== ======== ==================== ============== ======================== ===========",
30453
- "",
30454
- ".. meta:: ",
30455
- " :keywords: get"
30456
- ]
30457
- }
30458
- ]
30459
- }
30460
- ]
30461
- },
30462
30564
  "getClusterDFSDatabases": {
30463
30565
  "title": "getClusterDFSDatabases",
30464
30566
  "type": "function",
@@ -33952,19 +34054,41 @@
33952
34054
  "language": "console",
33953
34055
  "value": [
33954
34056
  " ",
33955
- " $ getSessionMemoryStat();",
34057
+ " $ t = getSessionMemoryStat();",
34058
+ " $ t;",
33956
34059
  ""
33957
34060
  ]
33958
34061
  },
33959
34062
  {
33960
34063
  "type": "text",
33961
34064
  "value": [
33962
- "====== ========== ======== ========= ========== ======================= ======================= ",
33963
- "userId sessionId memSize remoteIP remotePort createTime lastActiveTime ",
33964
- "====== ========== ======== ========= ========== ======================= ======================= ",
33965
- "admin 1441295757 16 127.0.0.1 55030 2020.08.15T23:07:45.161 2020.08.15T23:07:45.161",
33966
- "admin 1166953221 77878188 127.0.0.1 57489 2020.08.14T09:20:01.902 2020.08.16T22:25:31.649",
33967
- "====== ========== ======== ========= ========== ======================= ======================= ",
34065
+ "=========================== ============ ======== ============== ========== =========================== ========================= ",
34066
+ "userId sessionId memSize remoteIP remotePort createTime lastActiveTime ",
34067
+ "=========================== ============ ======== ============== ========== =========================== ========================= ",
34068
+ "__DimensionalTable__ 0 0.0.0.0 ",
34069
+ "",
34070
+ "__SharedTable__ 0 0.0.0.0 ",
34071
+ "",
34072
+ "__OLAPTablet__ 0 0.0.0.0 ",
34073
+ "",
34074
+ "__OLAPCacheEngine__ 0 0.0.0.0 ",
34075
+ "",
34076
+ "__OLAPCachedSymbolBa... 0 0.0.0.0 ",
34077
+ "",
34078
+ "__DFSMetadata__ 2769 0.0.0.0 ",
34079
+ "",
34080
+ "__TSDBCacheEngine__ 0 0.0.0.0 ",
34081
+ "",
34082
+ "__TSDBLevelFileIndex__ 0 0.0.0.0 ",
34083
+ "",
34084
+ "__TSDBCachedSymbolBa... 0 0.0.0.0 ",
34085
+ "",
34086
+ "__StreamingPubQueue__ 0 0.0.0.0 ",
34087
+ "",
34088
+ "__StreamingSubQueue__ 0 0.0.0.0 ",
34089
+ "",
34090
+ "admin 2882591513 1416 60.176.105.0 20861 2023.02.15T02:15:22.384 2023.02.15T02:24:16.307",
34091
+ "=========================== ============ ======== ============== ========== =========================== ========================= ",
33968
34092
  ""
33969
34093
  ]
33970
34094
  },
@@ -33973,20 +34097,40 @@
33973
34097
  "language": "console",
33974
34098
  "value": [
33975
34099
  "",
33976
- " $ update t set createTime=localtime(createTime), lastActiveTime=localtime(lastActiveTime);",
33977
- " $ t;",
34100
+ " $ update t set createTime=localtime(createTime), lastActiveTime=localtime(lastActiveTime) where not userId like \"__%__\"",
33978
34101
  ""
33979
34102
  ]
33980
34103
  },
33981
34104
  {
33982
34105
  "type": "text",
33983
34106
  "value": [
33984
- "====== ========== ======== ========= ========== ======================= ======================= ",
33985
- "userId sessionId memSize remoteIP remotePort createTime lastActiveTime ",
33986
- "====== ========== ======== ========= ========== ======================= ======================= ",
33987
- "admin 1441295757 16 127.0.0.1 55030 2020.08.15T23:07:45.161 2020.08.15T23:07:45.161",
33988
- "admin 1166953221 77878188 127.0.0.1 57489 2020.08.14T09:20:01.902 2020.08.16T22:25:31.649",
33989
- "====== ========== ======== ========= ========== ======================= =======================",
34107
+ "================================= ============ ======== ============== ========== ======================= ========================= ",
34108
+ "userId sessionId memSize remoteIP remotePort createTime lastActiveTime ",
34109
+ "================================= ============ ======== ============== ========== ======================= =========================",
34110
+ "__DimensionalTable__ 0 0.0.0.0 ",
34111
+ "",
34112
+ "__SharedTable__ 0 0.0.0.0 ",
34113
+ "",
34114
+ "__OLAPTablet__ 0 0.0.0.0 ",
34115
+ "",
34116
+ "__OLAPCacheEngine__ 0 0.0.0.0 ",
34117
+ "",
34118
+ "__OLAPCachedSymbolBa... 0 0.0.0.0 ",
34119
+ "",
34120
+ "__DFSMetadata__ 2769 0.0.0.0 ",
34121
+ "",
34122
+ "__TSDBCacheEngine__ 0 0.0.0.0 ",
34123
+ "",
34124
+ "__TSDBLevelFileIndex__ 0 0.0.0.0 ",
34125
+ "",
34126
+ "__TSDBCachedSymbolBa... 0 0.0.0.0 ",
34127
+ "",
34128
+ "__StreamingPubQueue__ 0 0.0.0.0 ",
34129
+ "",
34130
+ "__StreamingSubQueue__ 0 0.0.0.0 ",
34131
+ "",
34132
+ "admin 1195587396 1416 60.176.105.0 20874 2023.02.14T21:26:14.004 2023.02.14T21:27:27.463",
34133
+ "================================= ============ ======== ============== ========== ======================= ========================= ",
33990
34134
  "",
33991
34135
  ".. meta:: ",
33992
34136
  " :keywords: get"
@@ -36604,7 +36748,7 @@
36604
36748
  "",
36605
36749
  "\\5. VIEW_EXEC: execute view functions",
36606
36750
  "",
36607
- "\\6. DB_MANAGE: create and delete databases",
36751
+ "\\6. DB_MANAGE: delete databases",
36608
36752
  "",
36609
36753
  "\\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.",
36610
36754
  "",
@@ -70862,7 +71006,7 @@
70862
71006
  " $ if(existsDatabase(\"dfs://test_stock\")){",
70863
71007
  " $ dropDatabase(\"dfs://test_stock\")",
70864
71008
  " $ }",
70865
- " $ db1=database(\"\",RANGE, 2021.01.04..2021.01.06)",
71009
+ " $ db1=database(\"\",RANGE, 2021.01.04..2021.01.07)",
70866
71010
  " $ db2=database(\"\",VALUE,`IBM`GS)",
70867
71011
  " $ db=database(\"dfs://test_stock\",COMPO,[db1, db2])",
70868
71012
  " $ trades=db.createPartitionedTable(t,`trades,`date`sym)",
@@ -72313,7 +72457,7 @@
72313
72457
  "",
72314
72458
  "\\5. VIEW_EXEC: execute view functions",
72315
72459
  "",
72316
- "\\6. DB_MANAGE: create and delete databases",
72460
+ "\\6. DB_MANAGE: delete databases",
72317
72461
  "",
72318
72462
  "\\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.",
72319
72463
  "",
@@ -83462,70 +83606,6 @@
83462
83606
  }
83463
83607
  ]
83464
83608
  },
83465
- "startAsyncReplication": {
83466
- "title": "startAsyncReplication",
83467
- "type": "command",
83468
- "children": [
83469
- {
83470
- "title": "Syntax",
83471
- "type": "grammer",
83472
- "children": [
83473
- {
83474
- "type": "text",
83475
- "value": [
83476
- "startAsyncReplication()"
83477
- ]
83478
- }
83479
- ]
83480
- },
83481
- {
83482
- "title": "Arguments",
83483
- "type": "parameters",
83484
- "children": [
83485
- {
83486
- "type": "text",
83487
- "value": [
83488
- "None"
83489
- ]
83490
- }
83491
- ]
83492
- },
83493
- {
83494
- "title": "Details",
83495
- "type": "detail",
83496
- "children": [
83497
- {
83498
- "type": "text",
83499
- "value": [
83500
- "After enabling the cross-cluster asynchronous replication mode, execute this command on any data node in the master cluster to start sending data to slave cluster(s)."
83501
- ]
83502
- }
83503
- ]
83504
- },
83505
- {
83506
- "title": "Examples",
83507
- "type": "example",
83508
- "children": [
83509
- {
83510
- "type": "code",
83511
- "language": "console",
83512
- "value": [
83513
- " ",
83514
- " $ startAsyncReplication();",
83515
- "",
83516
- ""
83517
- ]
83518
- },
83519
- {
83520
- "type": "text",
83521
- "value": [
83522
- "Related command :doc:`stopAsyncReplication`"
83523
- ]
83524
- }
83525
- ]
83526
- }
83527
- ]
83528
- },
83529
83609
  "startDataNode": {
83530
83610
  "title": "startDataNode",
83531
83611
  "type": "command",
@@ -84191,69 +84271,6 @@
84191
84271
  }
84192
84272
  ]
84193
84273
  },
84194
- "stopAsyncReplication": {
84195
- "title": "stopAsyncReplication",
84196
- "type": "command",
84197
- "children": [
84198
- {
84199
- "title": "Syntax",
84200
- "type": "grammer",
84201
- "children": [
84202
- {
84203
- "type": "text",
84204
- "value": [
84205
- "stopAsyncReplication()"
84206
- ]
84207
- }
84208
- ]
84209
- },
84210
- {
84211
- "title": "Arguments",
84212
- "type": "parameters",
84213
- "children": [
84214
- {
84215
- "type": "text",
84216
- "value": [
84217
- "None"
84218
- ]
84219
- }
84220
- ]
84221
- },
84222
- {
84223
- "title": "Details",
84224
- "type": "detail",
84225
- "children": [
84226
- {
84227
- "type": "text",
84228
- "value": [
84229
- "After enabling the cross-cluster asynchronous replication mode, execute this command on any data node in the master cluster to stop sending data to slave cluster(s)."
84230
- ]
84231
- }
84232
- ]
84233
- },
84234
- {
84235
- "title": "Examples",
84236
- "type": "example",
84237
- "children": [
84238
- {
84239
- "type": "code",
84240
- "language": "console",
84241
- "value": [
84242
- " ",
84243
- " $ stopAsyncReplication();",
84244
- ""
84245
- ]
84246
- },
84247
- {
84248
- "type": "text",
84249
- "value": [
84250
- "Related command :doc:`startAsyncReplication`"
84251
- ]
84252
- }
84253
- ]
84254
- }
84255
- ]
84256
- },
84257
84274
  "stopDataNode": {
84258
84275
  "title": "stopDataNode",
84259
84276
  "type": "command",
@@ -87380,11 +87397,11 @@
87380
87397
  {
87381
87398
  "type": "text",
87382
87399
  "value": [
87383
- "syncDict(keyObj, valueObj, [sharedName])",
87400
+ "syncDict(keyObj, valueObj, [sharedName], [ordered=false])",
87384
87401
  "",
87385
87402
  "or",
87386
87403
  "",
87387
- "syncDict(keyType, valueType, [sharedName])"
87404
+ "syncDict(keyType, valueType, [sharedName], [ordered=false])"
87388
87405
  ]
87389
87406
  }
87390
87407
  ]
@@ -87400,11 +87417,13 @@
87400
87417
  "",
87401
87418
  "`valueObj` a vector indicating dictionary values.",
87402
87419
  "",
87403
- "`keyType` the data type of dictionary keys.",
87420
+ "`keyType` the data type of dictionary keys. The following data categories are supported: Integral (excluding COMPRESS), Temporal, Floating and Literal. ",
87404
87421
  "",
87405
- "`valueType` the data type of dictionary values.",
87422
+ "`valueType` the data type of dictionary values. Note that COMPLEX, POINT and the Decimal category are not supported.",
87406
87423
  "",
87407
- "`sharedName` a string. If it is specified, the dictionary is shared across sessions."
87424
+ "`sharedName` a string. If it is specified, the dictionary is shared across sessions.",
87425
+ "",
87426
+ "`ordered` a Boolean value. The default value is false, which indicates to create a regular dictionary. True means to create an ordered dictionary. The regular dictionaries do not track the insertion order of the key-value pairs whereas the ordered dictionaries preserve the insertion order of key-value pairs."
87408
87427
  ]
87409
87428
  }
87410
87429
  ]
@@ -87416,7 +87435,7 @@
87416
87435
  {
87417
87436
  "type": "text",
87418
87437
  "value": [
87419
- "Return a thread-safe dictionary that allows concurrent read and write by multiple threads. The system supports the following data categories for keys: Logical, Integral, Floating and Temporal. There are no restrictions regarding the data type of the values of a dictionary."
87438
+ "Return a thread-safe dictionary that allows concurrent read and write by multiple threads."
87420
87439
  ]
87421
87440
  }
87422
87441
  ]
@@ -87497,7 +87516,14 @@
87497
87516
  " $ jobId4=submitJob(\"task2\",,task2,z2,n)",
87498
87517
  " $ getJobReturn(jobId3, true)",
87499
87518
  " $ getJobReturn(jobId4, true)",
87500
- " $ z2;"
87519
+ " $ z2;",
87520
+ ""
87521
+ ]
87522
+ },
87523
+ {
87524
+ "type": "text",
87525
+ "value": [
87526
+ "Related: :doc:`../a/array`, :doc:`../m/matrix`, :doc:`../d/dictUpdate!`, :doc:`../d/dict`"
87501
87527
  ]
87502
87528
  }
87503
87529
  ]
@@ -93504,7 +93530,7 @@
93504
93530
  "",
93505
93531
  "If `X` is a matrix: return the transpose of `X`.",
93506
93532
  "",
93507
- "If `X` is a table: convert `X` into a dictionary. The dictionary keys are column names. Each dictionary value is a vector of the corresponding column. ",
93533
+ "If `X` is a table: convert `X` into an ordered dictionary. The dictionary keys are column names. Each dictionary value is a vector of the corresponding column. ",
93508
93534
  "",
93509
93535
  "If `X` is a dictionary: convert `X` into a table. The dictionary keys must be of STRING type, and dictionary values must be vectors of the same length. The columns names of the table are the dictionary keys, and each column is the corresponding dictionary value."
93510
93536
  ]
@@ -93625,10 +93651,11 @@
93625
93651
  "value": [
93626
93652
  "",
93627
93653
  " $ transpose(t);",
93628
- " price->[49.6,29.46,29.52,30.02,174.97,175.23,50.76,50.32,51.29]",
93654
+ " timestamp->[09:34:07,09:36:42,09:36:51,09:36:59,09:32:47,09:35:26,09:34:16,09:34:26,09:38:12]",
93629
93655
  " sym->[C,MS,MS,MS,IBM,IBM,C,C,C]",
93630
93656
  " qty->[2200,1900,2100,3200,6800,5400,1300,2500,8800]",
93631
- " timestamp->[09:34:07,09:36:42,09:36:51,09:36:59,09:32:47,09:35:26,09:34:16,09:34:26,09:38:12]",
93657
+ " price->[49.6,29.46,29.52,30.02,174.97,175.23,50.76,50.32,51.29]",
93658
+ "",
93632
93659
  ""
93633
93660
  ]
93634
93661
  },
@@ -98750,6 +98777,76 @@
98750
98777
  }
98751
98778
  ]
98752
98779
  },
98780
+ "wsum2": {
98781
+ "title": "wsum2",
98782
+ "type": "function",
98783
+ "children": [
98784
+ {
98785
+ "title": "Syntax",
98786
+ "type": "grammer",
98787
+ "children": [
98788
+ {
98789
+ "type": "text",
98790
+ "value": [
98791
+ "wsum2(X, Y)"
98792
+ ]
98793
+ }
98794
+ ]
98795
+ },
98796
+ {
98797
+ "title": "Arguments",
98798
+ "type": "parameters",
98799
+ "children": [
98800
+ {
98801
+ "type": "text",
98802
+ "value": [
98803
+ "`X` and `Y` are scalar/vector/matrix/table."
98804
+ ]
98805
+ }
98806
+ ]
98807
+ },
98808
+ {
98809
+ "title": "Details",
98810
+ "type": "detail",
98811
+ "children": [
98812
+ {
98813
+ "type": "text",
98814
+ "value": [
98815
+ "``wsum2`` returns the weighted sum of squares of *X* and *Y*.",
98816
+ "",
98817
+ "Please note that the data type of the result is DOUBLE, even if both *X* and *Y* are integers."
98818
+ ]
98819
+ }
98820
+ ]
98821
+ },
98822
+ {
98823
+ "title": "Examples",
98824
+ "type": "example",
98825
+ "children": [
98826
+ {
98827
+ "type": "code",
98828
+ "language": "console",
98829
+ "value": [
98830
+ "",
98831
+ " $ wsum2(3 4 1, 1 2 3);",
98832
+ " 44",
98833
+ " // 9*1 + 16*2 + 1*3 = 44",
98834
+ ""
98835
+ ]
98836
+ },
98837
+ {
98838
+ "type": "text",
98839
+ "value": [
98840
+ "Related: :doc:`wsum`",
98841
+ "",
98842
+ ".. meta:: ",
98843
+ " :keywords: sum2"
98844
+ ]
98845
+ }
98846
+ ]
98847
+ }
98848
+ ]
98849
+ },
98753
98850
  "xdb": {
98754
98851
  "title": "xdb",
98755
98852
  "type": "function",