diff --git a/cmake/cmake.version b/cmake/cmake.version
index 0e35fa316f..4abc854e71 100644
--- a/cmake/cmake.version
+++ b/cmake/cmake.version
@@ -2,7 +2,7 @@
IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER})
ELSE ()
- SET(TD_VER_NUMBER "3.2.3.0.alpha")
+ SET(TD_VER_NUMBER "3.2.4.0.alpha")
ENDIF ()
IF (DEFINED VERCOMPATIBLE)
diff --git a/docs/en/08-client-libraries/07-python.mdx b/docs/en/08-client-libraries/07-python.mdx
index aacfd0fe53..3110afcf10 100644
--- a/docs/en/08-client-libraries/07-python.mdx
+++ b/docs/en/08-client-libraries/07-python.mdx
@@ -842,12 +842,12 @@ consumer = Consumer({"group.id": "local", "td.connect.ip": "127.0.0.1"})
In addition to native connections, the client library also supports subscriptions via websockets.
-The syntax for creating a consumer is "consumer = consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../develop/tmq/#create-a-consumer).
+The syntax for creating a consumer is "consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../develop/tmq/#create-a-consumer).
```python
import taosws
-consumer = taosws.(conf={"group.id": "local", "td.connect.websocket.scheme": "ws"})
+consumer = taosws.Consumer(conf={"group.id": "local", "td.connect.websocket.scheme": "ws"})
```
@@ -887,13 +887,13 @@ The `poll` function is used to consume data in tmq. The parameter of the `poll`
```python
while True:
- res = consumer.poll(1)
- if not res:
+ message = consumer.poll(1)
+ if not message:
continue
- err = res.error()
+ err = message.error()
if err is not None:
raise err
- val = res.value()
+ val = message.value()
for block in val:
print(block.fetchall())
@@ -902,16 +902,14 @@ while True:
-The `poll` function is used to consume data in tmq. The parameter of the `poll` function is a value of type float representing the timeout in seconds. It returns a `Message` before timing out, or `None` on timing out. You have to handle error messages in response data.
+The `poll` function is used to consume data in tmq. The parameter of the `poll` function is a value of type float representing the timeout in seconds. It returns a `Message` before timing out, or `None` on timing out.
```python
while True:
- res = consumer.poll(timeout=1.0)
- if not res:
+ message = consumer.poll(1)
+ if not message:
continue
- err = res.error()
- if err is not None:
- raise err
+
for block in message:
for row in block:
print(row)
diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md
index a2e6bca46c..074fbfbc8d 100755
--- a/docs/en/12-taos-sql/06-select.md
+++ b/docs/en/12-taos-sql/06-select.md
@@ -24,7 +24,7 @@ SELECT [hints] [DISTINCT] [TAGS] select_list
hints: /*+ [hint([hint_param_list])] [hint([hint_param_list])] */
hint:
- BATCH_SCAN | NO_BATCH_SCAN | SORT_FOR_GROUP | PARA_TABLES_SORT
+ BATCH_SCAN | NO_BATCH_SCAN | SORT_FOR_GROUP | PARA_TABLES_SORT | PARTITION_FIRST | SMALLDATA_TS_SORT
select_list:
select_expr [, select_expr] ...
@@ -94,6 +94,7 @@ The list of currently supported Hints is as follows:
| SORT_FOR_GROUP| None | Use sort for partition, conflict with PARTITION_FIRST | With normal column in partition by list |
| PARTITION_FIRST| None | Use Partition before aggregate, conflict with SORT_FOR_GROUP | With normal column in partition by list |
| PARA_TABLES_SORT| None | When sorting the supertable rows by timestamp, No temporary disk space is used. When there are numerous tables, each with long rows, the corresponding algorithm associated with this prompt may consume a substantial amount of memory, potentially leading to an Out Of Memory (OOM) situation. | Sorting the supertable rows by timestamp |
+| SMALLDATA_TS_SORT| None | When sorting the supertable rows by timestamp, if the length of query columns >= 256, and there are relatively few rows, this hint can improve performance. | Sorting the supertable rows by timestamp |
For example:
@@ -102,6 +103,7 @@ SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0
SELECT /*+ SORT_FOR_GROUP() */ count(*), c1 FROM stable1 PARTITION BY c1;
SELECT /*+ PARTITION_FIRST() */ count(*), c1 FROM stable1 PARTITION BY c1;
SELECT /*+ PARA_TABLES_SORT() */ * from stable1 order by ts;
+SELECT /*+ SMALLDATA_TS_SORT() */ * from stable1 order by ts;
```
## Lists
diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md
index 6f2343d347..e1bf18c854 100644
--- a/docs/en/12-taos-sql/14-stream.md
+++ b/docs/en/12-taos-sql/14-stream.md
@@ -41,16 +41,28 @@ window_clause: {
SESSION(ts_col, tol_val)
| STATE_WINDOW(col)
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)]
+ | EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition
+ | COUNT_WINDOW(count_val[, sliding_val])
}
```
`SESSION` indicates a session window, and `tol_val` indicates the maximum range of the time interval. If the time interval between two continuous rows are within the time interval specified by `tol_val` they belong to the same session window; otherwise a new session window is started automatically.
+`EVENT_WINDOW` is determined according to the window start condition and the window close condition. The window is started when `start_trigger_condition` is evaluated to true, the window is closed when `end_trigger_condition` is evaluated to true. `start_trigger_condition` and `end_trigger_condition` can be any conditional expressions supported by TDengine and can include multiple columns.
+
+`COUNT_WINDOW` is a counting window that is divided by a fixed number of data rows.`count_val`: A constant, which is a positive integer and must be greater than or equal to 2. The maximum value is 2147483648. `count_val` represents the maximum number of data rows contained in each `COUNT_WINDOW`. When the total number of data rows cannot be divided by `count_val`, the number of rows in the last window will be less than `count_val`. `sliding_val`: is a constant that represents the number of window slides, similar to `SLIDING` in `INTERVAL`.
+
For example, the following SQL statement creates a stream and automatically creates a supertable named `avg_vol`. The stream has a 1 minute time window that slides forward in 30 second intervals to calculate the average voltage of the meters supertable.
```sql
CREATE STREAM avg_vol_s INTO avg_vol AS
SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname INTERVAL(1m) SLIDING(30s);
+
+CREATE STREAM streams0 INTO streamt0 AS
+SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname EVENT_WINDOW START WITH voltage < 0 END WITH voltage > 9;
+
+CREATE STREAM streams1 IGNORE EXPIRED 1 WATERMARK 100s INTO streamt1 AS
+SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname COUNT_WINDOW(10);
```
## Partitions of Stream
diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md
index f5a4789976..902e62de73 100644
--- a/docs/en/28-releases/01-tdengine.md
+++ b/docs/en/28-releases/01-tdengine.md
@@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://t
import Release from "/components/ReleaseV3";
+## 3.2.3.0
+
+
+
## 3.2.2.0
diff --git a/docs/zh/08-connector/30-python.mdx b/docs/zh/08-connector/30-python.mdx
index e7160ab094..71dc82316e 100644
--- a/docs/zh/08-connector/30-python.mdx
+++ b/docs/zh/08-connector/30-python.mdx
@@ -856,7 +856,7 @@ taosws `Consumer` API 提供了基于 Websocket 订阅 TMQ 数据的 API。创
```python
import taosws
-consumer = taosws.(conf={"group.id": "local", "td.connect.websocket.scheme": "ws"})
+consumer = taosws.Consumer(conf={"group.id": "local", "td.connect.websocket.scheme": "ws"})
```
@@ -896,13 +896,13 @@ Consumer API 的 `poll` 方法用于消费数据,`poll` 方法接收一个 flo
```python
while True:
- res = consumer.poll(1)
- if not res:
+ message = consumer.poll(1)
+ if not message:
continue
- err = res.error()
+ err = message.error()
if err is not None:
raise err
- val = res.value()
+ val = message.value()
for block in val:
print(block.fetchall())
@@ -911,16 +911,14 @@ while True:
-Consumer API 的 `poll` 方法用于消费数据,`poll` 方法接收一个 float 类型的超时时间,超时时间单位为秒(s),`poll` 方法在超时之前返回一条 Message 类型的数据或超时返回 `None`。消费者必须通过 Message 的 `error()` 方法校验返回数据的 error 信息。
+Consumer API 的 `poll` 方法用于消费数据,`poll` 方法接收一个 float 类型的超时时间,超时时间单位为秒(s),`poll` 方法在超时之前返回一条 Message 类型的数据或超时返回 `None`。
```python
while True:
- res = consumer.poll(timeout=1.0)
- if not res:
+ message = consumer.poll(1)
+ if not message:
continue
- err = res.error()
- if err is not None:
- raise err
+
for block in message:
for row in block:
print(row)
diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md
index eec947ea23..573e854864 100755
--- a/docs/zh/12-taos-sql/06-select.md
+++ b/docs/zh/12-taos-sql/06-select.md
@@ -24,7 +24,7 @@ SELECT [hints] [DISTINCT] [TAGS] select_list
hints: /*+ [hint([hint_param_list])] [hint([hint_param_list])] */
hint:
- BATCH_SCAN | NO_BATCH_SCAN | SORT_FOR_GROUP | PARA_TABLES_SORT
+ BATCH_SCAN | NO_BATCH_SCAN | SORT_FOR_GROUP | PARTITION_FIRST | PARA_TABLES_SORT | SMALLDATA_TS_SORT
select_list:
select_expr [, select_expr] ...
@@ -94,6 +94,8 @@ Hints 是用户控制单个语句查询优化的一种手段,当 Hint 不适
| SORT_FOR_GROUP| 无 | 采用sort方式进行分组, 与PARTITION_FIRST冲突 | partition by 列表有普通列时 |
| PARTITION_FIRST| 无 | 在聚合之前使用PARTITION计算分组, 与SORT_FOR_GROUP冲突 | partition by 列表有普通列时 |
| PARA_TABLES_SORT| 无 | 超级表的数据按时间戳排序时, 不使用临时磁盘空间, 只使用内存。当子表数量多, 行长比较大时候, 会使用大量内存, 可能发生OOM | 超级表的数据按时间戳排序时 |
+| SMALLDATA_TS_SORT| 无 | 超级表的数据按时间戳排序时, 查询列长度大于等于256, 但是行数不多, 使用这个提示, 可以提高性能 | 超级表的数据按时间戳排序时 |
+
举例:
```sql
@@ -101,6 +103,7 @@ SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0
SELECT /*+ SORT_FOR_GROUP() */ count(*), c1 FROM stable1 PARTITION BY c1;
SELECT /*+ PARTITION_FIRST() */ count(*), c1 FROM stable1 PARTITION BY c1;
SELECT /*+ PARA_TABLES_SORT() */ * from stable1 order by ts;
+SELECT /*+ SMALLDATA_TS_SORT() */ * from stable1 order by ts;
```
## 列表
diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md
index 8ae3f900f4..f73919a970 100755
--- a/docs/zh/12-taos-sql/12-distinguished.md
+++ b/docs/zh/12-taos-sql/12-distinguished.md
@@ -49,6 +49,7 @@ window_clause: {
| STATE_WINDOW(col)
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)]
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition
+ | COUNT_WINDOW(count_val[, sliding_val])
}
```
@@ -180,6 +181,19 @@ select _wstart, _wend, count(*) from t event_window start with c1 > 0 end with c

+### 计数窗口
+
+计数窗口按固定的数据行数来划分窗口。默认将数据按时间戳排序,再按照count_val的值,将数据划分为多个窗口,然后做聚合计算。count_val表示每个count window包含的最大数据行数,总数据行数不能整除count_val时,最后一个窗口的行数会小于count_val。sliding_val是常量,表示窗口滑动的数量,类似于 interval的SLIDING。
+
+以下面的 SQL 语句为例,计数窗口切分如图所示:
+```sql
+select _wstart, _wend, count(*) from t count_window(4);
+```
+
+
+
+
+
### 时间戳伪列
窗口聚合查询结果中,如果 SQL 语句中没有指定输出查询结果中的时间戳列,那么最终结果中不会自动包含窗口的时间列信息。如果需要在结果中输出聚合结果所对应的时间窗口信息,需要在 SELECT 子句中使用时间戳相关的伪列: 时间窗口起始时间 (\_WSTART), 时间窗口结束时间 (\_WEND), 时间窗口持续时间 (\_WDURATION), 以及查询整体窗口相关的伪列: 查询窗口起始时间(\_QSTART) 和查询窗口结束时间(\_QEND)。需要注意的是时间窗口起始时间和结束时间均是闭区间,时间窗口持续时间是数据当前时间分辨率下的数值。例如,如果当前数据库的时间分辨率是毫秒,那么结果中 500 就表示当前时间窗口的持续时间是 500毫秒 (500 ms)。
diff --git a/docs/zh/12-taos-sql/14-stream.md b/docs/zh/12-taos-sql/14-stream.md
index 979fc436b9..8868b728f8 100644
--- a/docs/zh/12-taos-sql/14-stream.md
+++ b/docs/zh/12-taos-sql/14-stream.md
@@ -49,10 +49,14 @@ window_clause: {
SESSION(ts_col, tol_val)
| STATE_WINDOW(col)
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)]
+ | EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition
+ | COUNT_WINDOW(count_val[, sliding_val])
}
```
其中,SESSION 是会话窗口,tol_val 是时间间隔的最大范围。在 tol_val 时间间隔范围内的数据都属于同一个窗口,如果连续的两条数据的时间超过 tol_val,则自动开启下一个窗口。
+EVENT_WINDOW 是事件窗口,根据开始条件和结束条件来划定窗口。当 start_trigger_condition 满足时则窗口开始,直到 end_trigger_condition 满足时窗口关闭。 start_trigger_condition 和 end_trigger_condition 可以是任意 TDengine 支持的条件表达式,且可以包含不同的列。
+COUNT_WINDOW 是计数窗口,按固定的数据行数来划分窗口。 count_val 是常量,是正整数,必须大于等于2,小于2147483648。 count_val 表示每个 COUNT_WINDOW 包含的最大数据行数,总数据行数不能整除 count_val 时,最后一个窗口的行数会小于 count_val 。 sliding_val 是常量,表示窗口滑动的数量,类似于 INTERVAL 的 SLIDING 。
窗口的定义与时序数据特色查询中的定义完全相同,详见 [TDengine 特色查询](../distinguished)
@@ -61,6 +65,12 @@ window_clause: {
```sql
CREATE STREAM avg_vol_s INTO avg_vol AS
SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname INTERVAL(1m) SLIDING(30s);
+
+CREATE STREAM streams0 INTO streamt0 AS
+SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname EVENT_WINDOW START WITH voltage < 0 END WITH voltage > 9;
+
+CREATE STREAM streams1 IGNORE EXPIRED 1 WATERMARK 100s INTO streamt1 AS
+SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname COUNT_WINDOW(10);
```
## 流式计算的 partition
diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md
index b0a81e01a1..1c51f934fe 100644
--- a/docs/zh/28-releases/01-tdengine.md
+++ b/docs/zh/28-releases/01-tdengine.md
@@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do
import Release from "/components/ReleaseV3";
+## 3.2.3.0
+
+
+
## 3.2.2.0
diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h
index 30ff0ee564..7242c51933 100644
--- a/include/common/tdataformat.h
+++ b/include/common/tdataformat.h
@@ -19,6 +19,7 @@
#include "os.h"
#include "talgo.h"
#include "tarray.h"
+#include "tbuffer.h"
#include "tencode.h"
#include "ttypes.h"
#include "tutil.h"
@@ -27,19 +28,21 @@
extern "C" {
#endif
-typedef struct SBuffer SBuffer;
-typedef struct SSchema SSchema;
+typedef struct SSchema SSchema;
+typedef struct SSchema2 SSchema2;
typedef struct SSchemaExt SSchemaExt;
-typedef struct SSchema2 SSchema2;
-typedef struct STColumn STColumn;
-typedef struct STSchema STSchema;
-typedef struct SValue SValue;
-typedef struct SColVal SColVal;
-typedef struct SRow SRow;
-typedef struct SRowIter SRowIter;
-typedef struct STagVal STagVal;
-typedef struct STag STag;
-typedef struct SColData SColData;
+typedef struct STColumn STColumn;
+typedef struct STSchema STSchema;
+typedef struct SValue SValue;
+typedef struct SColVal SColVal;
+typedef struct SRow SRow;
+typedef struct SRowIter SRowIter;
+typedef struct STagVal STagVal;
+typedef struct STag STag;
+typedef struct SColData SColData;
+
+typedef struct SRowKey SRowKey;
+typedef struct SValueColumn SValueColumn;
#define HAS_NONE ((uint8_t)0x1)
#define HAS_NULL ((uint8_t)0x2)
@@ -54,9 +57,9 @@ const static uint8_t BIT2_MAP[4] = {0b11111100, 0b11110011, 0b11001111, 0b001111
#define ONE ((uint8_t)1)
#define THREE ((uint8_t)3)
#define DIV_8(i) ((i) >> 3)
-#define MOD_8(i) ((i)&7)
+#define MOD_8(i) ((i) & 7)
#define DIV_4(i) ((i) >> 2)
-#define MOD_4(i) ((i)&3)
+#define MOD_4(i) ((i) & 3)
#define MOD_4_TIME_2(i) (MOD_4(i) << 1)
#define BIT1_SIZE(n) (DIV_8((n)-1) + 1)
#define BIT2_SIZE(n) (DIV_4((n)-1) + 1)
@@ -79,32 +82,42 @@ const static uint8_t BIT2_MAP[4] = {0b11111100, 0b11110011, 0b11001111, 0b001111
} while (0)
#define GET_BIT2(p, i) (((p)[DIV_4(i)] >> MOD_4_TIME_2(i)) & THREE)
-// SBuffer ================================
-struct SBuffer {
- int64_t nBuf;
- uint8_t *pBuf;
-};
-
-#define tBufferCreate() \
- (SBuffer) { .nBuf = 0, .pBuf = NULL }
-void tBufferDestroy(SBuffer *pBuffer);
-int32_t tBufferInit(SBuffer *pBuffer, int64_t size);
-int32_t tBufferPut(SBuffer *pBuffer, const void *pData, int64_t nData);
-int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData);
-
// SColVal ================================
#define CV_FLAG_VALUE ((int8_t)0x0)
#define CV_FLAG_NONE ((int8_t)0x1)
#define CV_FLAG_NULL ((int8_t)0x2)
-#define COL_VAL_NONE(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .flag = CV_FLAG_NONE})
-#define COL_VAL_NULL(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .flag = CV_FLAG_NULL})
-#define COL_VAL_VALUE(CID, TYPE, V) ((SColVal){.cid = (CID), .type = (TYPE), .value = (V)})
+#define COL_VAL_NONE(CID, TYPE) ((SColVal){.cid = (CID), .flag = CV_FLAG_NONE, .value = {.type = (TYPE)}})
+#define COL_VAL_NULL(CID, TYPE) ((SColVal){.cid = (CID), .flag = CV_FLAG_NULL, .value = {.type = (TYPE)}})
+#define COL_VAL_VALUE(CID, V) ((SColVal){.cid = (CID), .flag = CV_FLAG_VALUE, .value = (V)})
#define COL_VAL_IS_NONE(CV) ((CV)->flag == CV_FLAG_NONE)
#define COL_VAL_IS_NULL(CV) ((CV)->flag == CV_FLAG_NULL)
#define COL_VAL_IS_VALUE(CV) ((CV)->flag == CV_FLAG_VALUE)
+// SValueColumn ================================
+typedef struct {
+ int8_t cmprAlg; // filled by caller
+ int8_t type;
+ int32_t dataOriginalSize;
+ int32_t dataCompressedSize;
+ int32_t offsetOriginalSize;
+ int32_t offsetCompressedSize;
+} SValueColumnCompressInfo;
+
+int32_t tValueColumnInit(SValueColumn *valCol);
+int32_t tValueColumnDestroy(SValueColumn *valCol);
+int32_t tValueColumnClear(SValueColumn *valCol);
+int32_t tValueColumnAppend(SValueColumn *valCol, const SValue *value);
+int32_t tValueColumnUpdate(SValueColumn *valCol, int32_t idx, const SValue *value);
+int32_t tValueColumnGet(SValueColumn *valCol, int32_t idx, SValue *value);
+int32_t tValueColumnCompress(SValueColumn *valCol, SValueColumnCompressInfo *info, SBuffer *output, SBuffer *assist);
+int32_t tValueColumnDecompress(void *input, const SValueColumnCompressInfo *compressInfo, SValueColumn *valCol,
+ SBuffer *buffer);
+int32_t tValueColumnCompressInfoEncode(const SValueColumnCompressInfo *compressInfo, SBuffer *buffer);
+int32_t tValueColumnCompressInfoDecode(SBufferReader *reader, SValueColumnCompressInfo *compressInfo);
+int32_t tValueCompare(const SValue *tv1, const SValue *tv2);
+
// SRow ================================
int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow);
int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal);
@@ -112,6 +125,8 @@ void tRowDestroy(SRow *pRow);
int32_t tRowSort(SArray *aRowP);
int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int8_t flag);
int32_t tRowUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag);
+void tRowGetKey(SRow *pRow, SRowKey *key);
+int32_t tRowKeyCompare(const void *p1, const void *p2);
// SRowIter ================================
int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter);
@@ -133,9 +148,25 @@ void debugPrintSTag(STag *pTag, const char *tag, int32_t ln); // TODO: remov
int32_t parseJsontoTagData(const char *json, SArray *pTagVals, STag **ppTag, void *pMsgBuf);
// SColData ================================
+typedef struct {
+ int8_t cmprAlg; // filled by caller
+ int8_t columnFlag;
+ int8_t flag;
+ int8_t dataType;
+ int16_t columnId;
+ int32_t numOfData;
+ int32_t bitmapOriginalSize;
+ int32_t bitmapCompressedSize;
+ int32_t offsetOriginalSize;
+ int32_t offsetCompressedSize;
+ int32_t dataOriginalSize;
+ int32_t dataCompressedSize;
+} SColDataCompressInfo;
+
typedef void *(*xMallocFn)(void *, int32_t);
+
void tColDataDestroy(void *ph);
-void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn);
+void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t cflag);
void tColDataClear(SColData *pColData);
void tColDataDeepClear(SColData *pColData);
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal);
@@ -143,8 +174,12 @@ int32_t tColDataUpdateValue(SColData *pColData, SColVal *pColVal, bool forward);
void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal);
uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal);
int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMalloc, void *arg);
+
extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min, int16_t *numOfNull);
+int32_t tColDataCompress(SColData *colData, SColDataCompressInfo *info, SBuffer *output, SBuffer *assist);
+int32_t tColDataDecompress(void *input, SColDataCompressInfo *info, SColData *colData, SBuffer *assist);
+
// for stmt bind
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen);
void tColDataSortMerge(SArray *colDataArr);
@@ -173,28 +208,47 @@ struct STSchema {
STColumn columns[];
};
+/*
+ * 1. Tuple format:
+ * SRow + [(type, offset) * numOfPKs +] [bit map +] fix-length data + [var-length data]
+ *
+ * 2. K-V format:
+ * SRow + [(type, offset) * numOfPKs +] offset array + ([-]cid [+ data]) * numColsNotNone
+ */
struct SRow {
uint8_t flag;
- uint8_t rsv;
+ uint8_t numOfPKs;
uint16_t sver;
uint32_t len;
TSKEY ts;
uint8_t data[];
};
+typedef struct {
+ int8_t type;
+ uint32_t offset;
+} SPrimaryKeyIndex;
+
struct SValue {
+ int8_t type;
union {
int64_t val;
struct {
- uint32_t nData;
uint8_t *pData;
+ uint32_t nData;
};
};
};
+#define TD_MAX_PK_COLS 2
+struct SRowKey {
+ TSKEY ts;
+ uint8_t numOfPKs;
+ SValue pks[TD_MAX_PK_COLS];
+};
+
struct SColVal {
int16_t cid;
- int8_t type;
int8_t flag;
SValue value;
};
@@ -202,7 +256,7 @@ struct SColVal {
struct SColData {
int16_t cid;
int8_t type;
- int8_t smaOn;
+ int8_t cflag;
int32_t numOfNone; // # of none
int32_t numOfNull; // # of null
int32_t numOfValue; // # of vale
@@ -274,6 +328,36 @@ STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version);
pTSchema = NULL; \
} \
} while (0)
+const STColumn *tTSchemaSearchColumn(const STSchema *pTSchema, int16_t cid);
+
+struct SValueColumn {
+ int8_t type;
+ uint32_t numOfValues;
+ SBuffer data;
+ SBuffer offsets;
+};
+
+typedef struct {
+ int8_t dataType; // filled by caller
+ int8_t cmprAlg; // filled by caller
+ int32_t originalSize; // filled by caller
+ int32_t compressedSize;
+} SCompressInfo;
+
+int32_t tCompressData(void *input, // input
+ SCompressInfo *info, // compress info
+ void *output, // output
+ int32_t outputSize, // output size
+ SBuffer *buffer // assistant buffer provided by caller, can be NULL
+);
+int32_t tDecompressData(void *input, // input
+ const SCompressInfo *info, // compress info
+ void *output, // output
+ int32_t outputSize, // output size
+ SBuffer *buffer // assistant buffer provided by caller, can be NULL
+);
+int32_t tCompressDataToBuffer(void *input, SCompressInfo *info, SBuffer *output, SBuffer *assist);
+int32_t tDecompressDataToBuffer(void *input, SCompressInfo *info, SBuffer *output, SBuffer *assist);
#endif
diff --git a/include/common/tglobal.h b/include/common/tglobal.h
index ef18d1fefb..93f17fa887 100644
--- a/include/common/tglobal.h
+++ b/include/common/tglobal.h
@@ -219,7 +219,6 @@ extern bool tsFilterScalarMode;
extern int32_t tsMaxStreamBackendCache;
extern int32_t tsPQSortMemThreshold;
extern int32_t tsResolveFQDNRetryTime;
-extern bool tsDisableCount;
extern bool tsExperimental;
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index b7180fe5da..e714dc1522 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -615,13 +615,14 @@ typedef struct {
};
} SSubmitRsp;
-int32_t tEncodeSSubmitRsp(SEncoder* pEncoder, const SSubmitRsp* pRsp);
-int32_t tDecodeSSubmitRsp(SDecoder* pDecoder, SSubmitRsp* pRsp);
+// int32_t tEncodeSSubmitRsp(SEncoder* pEncoder, const SSubmitRsp* pRsp);
+// int32_t tDecodeSSubmitRsp(SDecoder* pDecoder, SSubmitRsp* pRsp);
// void tFreeSSubmitBlkRsp(void* param);
void tFreeSSubmitRsp(SSubmitRsp* pRsp);
#define COL_SMA_ON ((int8_t)0x1)
#define COL_IDX_ON ((int8_t)0x2)
+#define COL_IS_KEY ((int8_t)0x4)
#define COL_SET_NULL ((int8_t)0x10)
#define COL_SET_VAL ((int8_t)0x20)
#define COL_IS_SYSINFO ((int8_t)0x40)
@@ -979,8 +980,8 @@ typedef struct {
int64_t maxStorage;
} SCreateAcctReq, SAlterAcctReq;
-int32_t tSerializeSCreateAcctReq(void* buf, int32_t bufLen, SCreateAcctReq* pReq);
-int32_t tDeserializeSCreateAcctReq(void* buf, int32_t bufLen, SCreateAcctReq* pReq);
+// int32_t tSerializeSCreateAcctReq(void* buf, int32_t bufLen, SCreateAcctReq* pReq);
+// int32_t tDeserializeSCreateAcctReq(void* buf, int32_t bufLen, SCreateAcctReq* pReq);
typedef struct {
char user[TSDB_USER_LEN];
@@ -3543,7 +3544,7 @@ int32_t tDeserializeSCreateTagIdxReq(void* buf, int32_t bufLen, SCreateTagIndexR
typedef SMDropSmaReq SDropTagIndexReq;
-int32_t tSerializeSDropTagIdxReq(void* buf, int32_t bufLen, SDropTagIndexReq* pReq);
+// int32_t tSerializeSDropTagIdxReq(void* buf, int32_t bufLen, SDropTagIndexReq* pReq);
int32_t tDeserializeSDropTagIdxReq(void* buf, int32_t bufLen, SDropTagIndexReq* pReq);
typedef struct {
@@ -3664,8 +3665,8 @@ typedef struct {
int8_t igNotExists;
} SMDropFullTextReq;
-int32_t tSerializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
-int32_t tDeserializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
+// int32_t tSerializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
+// int32_t tDeserializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
typedef struct {
char indexFName[TSDB_INDEX_FNAME_LEN];
@@ -3917,6 +3918,7 @@ typedef struct {
uint32_t phyLen;
char* sql;
char* msg;
+ int8_t source;
} SVDeleteReq;
int32_t tSerializeSVDeleteReq(void* buf, int32_t bufLen, SVDeleteReq* pReq);
@@ -3938,6 +3940,7 @@ typedef struct SDeleteRes {
char tableFName[TSDB_TABLE_NAME_LEN];
char tsColName[TSDB_COL_NAME_LEN];
int64_t ctimeMs; // fill by vnode
+ int8_t source;
} SDeleteRes;
int32_t tEncodeDeleteRes(SEncoder* pCoder, const SDeleteRes* pRes);
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index 32a7585497..cdb7a699ee 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -134,239 +134,240 @@
#define TK_NK_EQ 115
#define TK_USING 116
#define TK_TAGS 117
-#define TK_BOOL 118
-#define TK_TINYINT 119
-#define TK_SMALLINT 120
-#define TK_INT 121
-#define TK_INTEGER 122
-#define TK_BIGINT 123
-#define TK_FLOAT 124
-#define TK_DOUBLE 125
-#define TK_BINARY 126
-#define TK_NCHAR 127
-#define TK_UNSIGNED 128
-#define TK_JSON 129
-#define TK_VARCHAR 130
-#define TK_MEDIUMBLOB 131
-#define TK_BLOB 132
-#define TK_VARBINARY 133
-#define TK_GEOMETRY 134
-#define TK_DECIMAL 135
-#define TK_COMMENT 136
-#define TK_MAX_DELAY 137
-#define TK_WATERMARK 138
-#define TK_ROLLUP 139
-#define TK_TTL 140
-#define TK_SMA 141
-#define TK_DELETE_MARK 142
-#define TK_FIRST 143
-#define TK_LAST 144
-#define TK_SHOW 145
-#define TK_PRIVILEGES 146
-#define TK_DATABASES 147
-#define TK_TABLES 148
-#define TK_STABLES 149
-#define TK_MNODES 150
-#define TK_QNODES 151
-#define TK_FUNCTIONS 152
-#define TK_INDEXES 153
-#define TK_ACCOUNTS 154
-#define TK_APPS 155
-#define TK_CONNECTIONS 156
-#define TK_LICENCES 157
-#define TK_GRANTS 158
-#define TK_FULL 159
-#define TK_LOGS 160
-#define TK_MACHINES 161
-#define TK_QUERIES 162
-#define TK_SCORES 163
-#define TK_TOPICS 164
-#define TK_VARIABLES 165
-#define TK_BNODES 166
-#define TK_SNODES 167
-#define TK_TRANSACTIONS 168
-#define TK_DISTRIBUTED 169
-#define TK_CONSUMERS 170
-#define TK_SUBSCRIPTIONS 171
-#define TK_VNODES 172
-#define TK_ALIVE 173
-#define TK_VIEWS 174
-#define TK_VIEW 175
-#define TK_COMPACTS 176
-#define TK_NORMAL 177
-#define TK_CHILD 178
-#define TK_LIKE 179
-#define TK_TBNAME 180
-#define TK_QTAGS 181
-#define TK_AS 182
-#define TK_SYSTEM 183
-#define TK_INDEX 184
-#define TK_FUNCTION 185
-#define TK_INTERVAL 186
-#define TK_COUNT 187
-#define TK_LAST_ROW 188
-#define TK_META 189
-#define TK_ONLY 190
-#define TK_TOPIC 191
-#define TK_CONSUMER 192
-#define TK_GROUP 193
-#define TK_DESC 194
-#define TK_DESCRIBE 195
-#define TK_RESET 196
-#define TK_QUERY 197
-#define TK_CACHE 198
-#define TK_EXPLAIN 199
-#define TK_ANALYZE 200
-#define TK_VERBOSE 201
-#define TK_NK_BOOL 202
-#define TK_RATIO 203
-#define TK_NK_FLOAT 204
-#define TK_OUTPUTTYPE 205
-#define TK_AGGREGATE 206
-#define TK_BUFSIZE 207
-#define TK_LANGUAGE 208
-#define TK_REPLACE 209
-#define TK_STREAM 210
-#define TK_INTO 211
-#define TK_PAUSE 212
-#define TK_RESUME 213
-#define TK_TRIGGER 214
-#define TK_AT_ONCE 215
-#define TK_WINDOW_CLOSE 216
-#define TK_IGNORE 217
-#define TK_EXPIRED 218
-#define TK_FILL_HISTORY 219
-#define TK_UPDATE 220
-#define TK_SUBTABLE 221
-#define TK_UNTREATED 222
-#define TK_KILL 223
-#define TK_CONNECTION 224
-#define TK_TRANSACTION 225
-#define TK_BALANCE 226
-#define TK_VGROUP 227
-#define TK_LEADER 228
-#define TK_MERGE 229
-#define TK_REDISTRIBUTE 230
-#define TK_SPLIT 231
-#define TK_DELETE 232
-#define TK_INSERT 233
-#define TK_NULL 234
-#define TK_NK_QUESTION 235
-#define TK_NK_ALIAS 236
-#define TK_NK_ARROW 237
-#define TK_ROWTS 238
-#define TK_QSTART 239
-#define TK_QEND 240
-#define TK_QDURATION 241
-#define TK_WSTART 242
-#define TK_WEND 243
-#define TK_WDURATION 244
-#define TK_IROWTS 245
-#define TK_ISFILLED 246
-#define TK_CAST 247
-#define TK_NOW 248
-#define TK_TODAY 249
-#define TK_TIMEZONE 250
-#define TK_CLIENT_VERSION 251
-#define TK_SERVER_VERSION 252
-#define TK_SERVER_STATUS 253
-#define TK_CURRENT_USER 254
-#define TK_CASE 255
-#define TK_WHEN 256
-#define TK_THEN 257
-#define TK_ELSE 258
-#define TK_BETWEEN 259
-#define TK_IS 260
-#define TK_NK_LT 261
-#define TK_NK_GT 262
-#define TK_NK_LE 263
-#define TK_NK_GE 264
-#define TK_NK_NE 265
-#define TK_MATCH 266
-#define TK_NMATCH 267
-#define TK_CONTAINS 268
-#define TK_IN 269
-#define TK_JOIN 270
-#define TK_INNER 271
-#define TK_SELECT 272
-#define TK_NK_HINT 273
-#define TK_DISTINCT 274
-#define TK_WHERE 275
-#define TK_PARTITION 276
-#define TK_BY 277
-#define TK_SESSION 278
-#define TK_STATE_WINDOW 279
-#define TK_EVENT_WINDOW 280
-#define TK_COUNT_WINDOW 281
-#define TK_SLIDING 282
-#define TK_FILL 283
-#define TK_VALUE 284
-#define TK_VALUE_F 285
-#define TK_NONE 286
-#define TK_PREV 287
-#define TK_NULL_F 288
-#define TK_LINEAR 289
-#define TK_NEXT 290
-#define TK_HAVING 291
-#define TK_RANGE 292
-#define TK_EVERY 293
-#define TK_ORDER 294
-#define TK_SLIMIT 295
-#define TK_SOFFSET 296
-#define TK_LIMIT 297
-#define TK_OFFSET 298
-#define TK_ASC 299
-#define TK_NULLS 300
-#define TK_ABORT 301
-#define TK_AFTER 302
-#define TK_ATTACH 303
-#define TK_BEFORE 304
-#define TK_BEGIN 305
-#define TK_BITAND 306
-#define TK_BITNOT 307
-#define TK_BITOR 308
-#define TK_BLOCKS 309
-#define TK_CHANGE 310
-#define TK_COMMA 311
-#define TK_CONCAT 312
-#define TK_CONFLICT 313
-#define TK_COPY 314
-#define TK_DEFERRED 315
-#define TK_DELIMITERS 316
-#define TK_DETACH 317
-#define TK_DIVIDE 318
-#define TK_DOT 319
-#define TK_EACH 320
-#define TK_FAIL 321
-#define TK_FILE 322
-#define TK_FOR 323
-#define TK_GLOB 324
-#define TK_ID 325
-#define TK_IMMEDIATE 326
-#define TK_IMPORT 327
-#define TK_INITIALLY 328
-#define TK_INSTEAD 329
-#define TK_ISNULL 330
-#define TK_KEY 331
-#define TK_MODULES 332
-#define TK_NK_BITNOT 333
-#define TK_NK_SEMI 334
-#define TK_NOTNULL 335
-#define TK_OF 336
-#define TK_PLUS 337
-#define TK_PRIVILEGE 338
-#define TK_RAISE 339
-#define TK_RESTRICT 340
-#define TK_ROW 341
-#define TK_SEMI 342
-#define TK_STAR 343
-#define TK_STATEMENT 344
-#define TK_STRICT 345
-#define TK_STRING 346
-#define TK_TIMES 347
-#define TK_VALUES 348
-#define TK_VARIABLE 349
-#define TK_WAL 350
+#define TK_PRIMARY 118
+#define TK_KEY 119
+#define TK_BOOL 120
+#define TK_TINYINT 121
+#define TK_SMALLINT 122
+#define TK_INT 123
+#define TK_INTEGER 124
+#define TK_BIGINT 125
+#define TK_FLOAT 126
+#define TK_DOUBLE 127
+#define TK_BINARY 128
+#define TK_NCHAR 129
+#define TK_UNSIGNED 130
+#define TK_JSON 131
+#define TK_VARCHAR 132
+#define TK_MEDIUMBLOB 133
+#define TK_BLOB 134
+#define TK_VARBINARY 135
+#define TK_GEOMETRY 136
+#define TK_DECIMAL 137
+#define TK_COMMENT 138
+#define TK_MAX_DELAY 139
+#define TK_WATERMARK 140
+#define TK_ROLLUP 141
+#define TK_TTL 142
+#define TK_SMA 143
+#define TK_DELETE_MARK 144
+#define TK_FIRST 145
+#define TK_LAST 146
+#define TK_SHOW 147
+#define TK_PRIVILEGES 148
+#define TK_DATABASES 149
+#define TK_TABLES 150
+#define TK_STABLES 151
+#define TK_MNODES 152
+#define TK_QNODES 153
+#define TK_FUNCTIONS 154
+#define TK_INDEXES 155
+#define TK_ACCOUNTS 156
+#define TK_APPS 157
+#define TK_CONNECTIONS 158
+#define TK_LICENCES 159
+#define TK_GRANTS 160
+#define TK_FULL 161
+#define TK_LOGS 162
+#define TK_MACHINES 163
+#define TK_QUERIES 164
+#define TK_SCORES 165
+#define TK_TOPICS 166
+#define TK_VARIABLES 167
+#define TK_BNODES 168
+#define TK_SNODES 169
+#define TK_TRANSACTIONS 170
+#define TK_DISTRIBUTED 171
+#define TK_CONSUMERS 172
+#define TK_SUBSCRIPTIONS 173
+#define TK_VNODES 174
+#define TK_ALIVE 175
+#define TK_VIEWS 176
+#define TK_VIEW 177
+#define TK_COMPACTS 178
+#define TK_NORMAL 179
+#define TK_CHILD 180
+#define TK_LIKE 181
+#define TK_TBNAME 182
+#define TK_QTAGS 183
+#define TK_AS 184
+#define TK_SYSTEM 185
+#define TK_INDEX 186
+#define TK_FUNCTION 187
+#define TK_INTERVAL 188
+#define TK_COUNT 189
+#define TK_LAST_ROW 190
+#define TK_META 191
+#define TK_ONLY 192
+#define TK_TOPIC 193
+#define TK_CONSUMER 194
+#define TK_GROUP 195
+#define TK_DESC 196
+#define TK_DESCRIBE 197
+#define TK_RESET 198
+#define TK_QUERY 199
+#define TK_CACHE 200
+#define TK_EXPLAIN 201
+#define TK_ANALYZE 202
+#define TK_VERBOSE 203
+#define TK_NK_BOOL 204
+#define TK_RATIO 205
+#define TK_NK_FLOAT 206
+#define TK_OUTPUTTYPE 207
+#define TK_AGGREGATE 208
+#define TK_BUFSIZE 209
+#define TK_LANGUAGE 210
+#define TK_REPLACE 211
+#define TK_STREAM 212
+#define TK_INTO 213
+#define TK_PAUSE 214
+#define TK_RESUME 215
+#define TK_TRIGGER 216
+#define TK_AT_ONCE 217
+#define TK_WINDOW_CLOSE 218
+#define TK_IGNORE 219
+#define TK_EXPIRED 220
+#define TK_FILL_HISTORY 221
+#define TK_UPDATE 222
+#define TK_SUBTABLE 223
+#define TK_UNTREATED 224
+#define TK_KILL 225
+#define TK_CONNECTION 226
+#define TK_TRANSACTION 227
+#define TK_BALANCE 228
+#define TK_VGROUP 229
+#define TK_LEADER 230
+#define TK_MERGE 231
+#define TK_REDISTRIBUTE 232
+#define TK_SPLIT 233
+#define TK_DELETE 234
+#define TK_INSERT 235
+#define TK_NULL 236
+#define TK_NK_QUESTION 237
+#define TK_NK_ALIAS 238
+#define TK_NK_ARROW 239
+#define TK_ROWTS 240
+#define TK_QSTART 241
+#define TK_QEND 242
+#define TK_QDURATION 243
+#define TK_WSTART 244
+#define TK_WEND 245
+#define TK_WDURATION 246
+#define TK_IROWTS 247
+#define TK_ISFILLED 248
+#define TK_CAST 249
+#define TK_NOW 250
+#define TK_TODAY 251
+#define TK_TIMEZONE 252
+#define TK_CLIENT_VERSION 253
+#define TK_SERVER_VERSION 254
+#define TK_SERVER_STATUS 255
+#define TK_CURRENT_USER 256
+#define TK_CASE 257
+#define TK_WHEN 258
+#define TK_THEN 259
+#define TK_ELSE 260
+#define TK_BETWEEN 261
+#define TK_IS 262
+#define TK_NK_LT 263
+#define TK_NK_GT 264
+#define TK_NK_LE 265
+#define TK_NK_GE 266
+#define TK_NK_NE 267
+#define TK_MATCH 268
+#define TK_NMATCH 269
+#define TK_CONTAINS 270
+#define TK_IN 271
+#define TK_JOIN 272
+#define TK_INNER 273
+#define TK_SELECT 274
+#define TK_NK_HINT 275
+#define TK_DISTINCT 276
+#define TK_WHERE 277
+#define TK_PARTITION 278
+#define TK_BY 279
+#define TK_SESSION 280
+#define TK_STATE_WINDOW 281
+#define TK_EVENT_WINDOW 282
+#define TK_COUNT_WINDOW 283
+#define TK_SLIDING 284
+#define TK_FILL 285
+#define TK_VALUE 286
+#define TK_VALUE_F 287
+#define TK_NONE 288
+#define TK_PREV 289
+#define TK_NULL_F 290
+#define TK_LINEAR 291
+#define TK_NEXT 292
+#define TK_HAVING 293
+#define TK_RANGE 294
+#define TK_EVERY 295
+#define TK_ORDER 296
+#define TK_SLIMIT 297
+#define TK_SOFFSET 298
+#define TK_LIMIT 299
+#define TK_OFFSET 300
+#define TK_ASC 301
+#define TK_NULLS 302
+#define TK_ABORT 303
+#define TK_AFTER 304
+#define TK_ATTACH 305
+#define TK_BEFORE 306
+#define TK_BEGIN 307
+#define TK_BITAND 308
+#define TK_BITNOT 309
+#define TK_BITOR 310
+#define TK_BLOCKS 311
+#define TK_CHANGE 312
+#define TK_COMMA 313
+#define TK_CONCAT 314
+#define TK_CONFLICT 315
+#define TK_COPY 316
+#define TK_DEFERRED 317
+#define TK_DELIMITERS 318
+#define TK_DETACH 319
+#define TK_DIVIDE 320
+#define TK_DOT 321
+#define TK_EACH 322
+#define TK_FAIL 323
+#define TK_FILE 324
+#define TK_FOR 325
+#define TK_GLOB 326
+#define TK_ID 327
+#define TK_IMMEDIATE 328
+#define TK_IMPORT 329
+#define TK_INITIALLY 330
+#define TK_INSTEAD 331
+#define TK_ISNULL 332
+#define TK_MODULES 333
+#define TK_NK_BITNOT 334
+#define TK_NK_SEMI 335
+#define TK_NOTNULL 336
+#define TK_OF 337
+#define TK_PLUS 338
+#define TK_PRIVILEGE 339
+#define TK_RAISE 340
+#define TK_RESTRICT 341
+#define TK_ROW 342
+#define TK_SEMI 343
+#define TK_STAR 344
+#define TK_STATEMENT 345
+#define TK_STRICT 346
+#define TK_STRING 347
+#define TK_TIMES 348
+#define TK_VALUES 349
+#define TK_VARIABLE 350
+#define TK_WAL 351
#define TK_ENCODE 351
#define TK_COMPRESS 352
#define TK_LEVEL 353
@@ -382,7 +383,7 @@
#define TK_SORT_FOR_GROUP 608
#define TK_PARTITION_FIRST 609
#define TK_PARA_TABLES_SORT 610
-
+#define TK_SMALLDATA_TS_SORT 611
#define TK_NK_NIL 65535
diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h
index c5b135d967..6234d17746 100644
--- a/include/libs/executor/storageapi.h
+++ b/include/libs/executor/storageapi.h
@@ -225,10 +225,10 @@ typedef struct SStoreTqReader {
bool (*tqReaderCurrentBlockConsumed)();
struct SWalReader* (*tqReaderGetWalReader)(); // todo remove it
- int32_t (*tqReaderRetrieveTaosXBlock)(); // todo remove it
+// int32_t (*tqReaderRetrieveTaosXBlock)(); // todo remove it
int32_t (*tqReaderSetSubmitMsg)(); // todo remove it
- bool (*tqReaderNextBlockFilterOut)();
+// bool (*tqReaderNextBlockFilterOut)();
} SStoreTqReader;
typedef struct SStoreSnapshotFn {
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index a0097374f4..60850936ad 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -171,6 +171,7 @@ typedef struct SColumnOptions {
char encode[TSDB_CL_COMPRESS_OPTION_LEN];
char compress[TSDB_CL_COMPRESS_OPTION_LEN];
char compressLevel[TSDB_CL_COMPRESS_OPTION_LEN];
+ bool bPrimaryKey;
} SColumnOptions;
typedef struct SColumnDefNode {
ENodeType type;
@@ -179,6 +180,7 @@ typedef struct SColumnDefNode {
char comments[TSDB_TB_COMMENT_LEN];
SColumnOptions* pOptions;
bool sma;
+ bool is_pk;
} SColumnDefNode;
typedef struct SCreateTableStmt {
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index 0bc3ce04ef..cbf38102de 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -122,6 +122,7 @@ typedef struct SScanLogicNode {
bool isCountByTag; // true if selectstmt hasCountFunc & part by tag/tbname
SArray* pFuncTypes; // for last, last_row
bool paraTablesSort; // for table merge scan
+ bool smallDataTsSort; // disable row id sort for table merge scan
} SScanLogicNode;
typedef struct SJoinLogicNode {
@@ -445,6 +446,7 @@ typedef struct STableScanPhysiNode {
bool filesetDelimited;
bool needCountEmptyTable;
bool paraTablesSort;
+ bool smallDataTsSort;
} STableScanPhysiNode;
typedef STableScanPhysiNode STableSeqScanPhysiNode;
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index 7ceb7e0278..97ac4ff3b9 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -128,7 +128,8 @@ typedef enum EHintOption {
HINT_BATCH_SCAN,
HINT_SORT_FOR_GROUP,
HINT_PARTITION_FIRST,
- HINT_PARA_TABLES_SORT
+ HINT_PARA_TABLES_SORT,
+ HINT_SMALLDATA_TS_SORT,
} EHintOption;
typedef struct SHintNode {
diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h
index 958d63349d..952af3c443 100644
--- a/include/libs/scheduler/scheduler.h
+++ b/include/libs/scheduler/scheduler.h
@@ -78,6 +78,7 @@ typedef struct SSchedulerReq {
void* chkKillParam;
SExecResult* pExecRes;
void** pFetchRes;
+ int8_t source;
} SSchedulerReq;
int32_t schedulerInit(void);
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index 64ce735843..5f3761d7b7 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -56,7 +56,6 @@ extern "C" {
#define STREAM_EXEC_T_RESTART_ALL_TASKS (-4)
#define STREAM_EXEC_T_STOP_ALL_TASKS (-5)
#define STREAM_EXEC_T_RESUME_TASK (-6)
-#define STREAM_EXEC_T_UPDATE_TASK_EPSET (-7)
typedef struct SStreamTask SStreamTask;
typedef struct SStreamQueue SStreamQueue;
@@ -783,11 +782,14 @@ bool streamTaskIsAllUpstreamClosed(SStreamTask* pTask);
bool streamTaskSetSchedStatusWait(SStreamTask* pTask);
int8_t streamTaskSetSchedStatusActive(SStreamTask* pTask);
int8_t streamTaskSetSchedStatusInactive(SStreamTask* pTask);
-int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t clearRelHalt, bool metaLock);
+int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t clearRelHalt);
int32_t streamTaskHandleEvent(SStreamTaskSM* pSM, EStreamTaskEvent event);
-int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent event);
-void streamTaskRestoreStatus(SStreamTask* pTask);
+
+typedef int32_t (*__state_trans_user_fn)(SStreamTask*, void* param);
+int32_t streamTaskHandleEventAsync(SStreamTaskSM* pSM, EStreamTaskEvent event, __state_trans_user_fn callbackFn, void* param);
+int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent event, __state_trans_user_fn callbackFn, void* param);
+int32_t streamTaskRestoreStatus(SStreamTask* pTask);
int32_t streamSendCheckRsp(const SStreamMeta* pMeta, const SStreamTaskCheckReq* pReq, SStreamTaskCheckRsp* pRsp,
SRpcHandleInfo* pRpcInfo, int32_t taskId);
diff --git a/include/libs/transport/trpc.h b/include/libs/transport/trpc.h
index e7b0b25653..460b8962ea 100644
--- a/include/libs/transport/trpc.h
+++ b/include/libs/transport/trpc.h
@@ -62,6 +62,7 @@ typedef struct SRpcHandleInfo {
SRpcConnInfo conn;
int8_t forbiddenIp;
+ int8_t notFreeAhandle;
} SRpcHandleInfo;
diff --git a/include/os/osFile.h b/include/os/osFile.h
index eb0862a719..9c9027e931 100644
--- a/include/os/osFile.h
+++ b/include/os/osFile.h
@@ -119,6 +119,13 @@ int32_t taosSetFileHandlesLimit();
int32_t taosLinkFile(char *src, char *dst);
+FILE* taosOpenCFile(const char* filename, const char* mode);
+int taosSeekCFile(FILE* file, int64_t offset, int whence);
+size_t taosReadFromCFile(void *buffer, size_t size, size_t count, FILE *stream );
+size_t taosWriteToCFile(const void* ptr, size_t size, size_t nitems, FILE* stream);
+int taosCloseCFile(FILE *);
+int taosSetAutoDelFile(char* path);
+
bool lastErrorIsFileNotExist();
#ifdef __cplusplus
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index 450681482c..c9c0298a83 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -436,7 +436,7 @@ int32_t* taosGetErrno();
//mnode-compact
#define TSDB_CODE_MND_INVALID_COMPACT_ID TAOS_DEF_ERROR_CODE(0, 0x04B1)
-
+#define TSDB_CODE_MND_COMPACT_DETAIL_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x04B2)
// vnode
// #define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500) // 2.x
@@ -761,6 +761,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_VIEW_CONFLICT_WITH_TABLE TAOS_DEF_ERROR_CODE(0, 0x266E)
#define TSDB_CODE_PAR_ORDERBY_AMBIGUOUS TAOS_DEF_ERROR_CODE(0, 0x266F)
#define TSDB_CODE_PAR_NOT_SUPPORT_MULTI_RESULT TAOS_DEF_ERROR_CODE(0, 0x2670)
+#define TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY TAOS_DEF_ERROR_CODE(0, 0x2671)
+#define TSDB_CODE_PAR_SECOND_COL_PK TAOS_DEF_ERROR_CODE(0, 0x2672)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner
diff --git a/include/util/tbuffer.h b/include/util/tbuffer.h
new file mode 100644
index 0000000000..094d0e37ba
--- /dev/null
+++ b/include/util/tbuffer.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "os.h"
+
+#ifndef __TD_BUFFER_H__
+#define __TD_BUFFER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct SBuffer SBuffer;
+typedef struct SBufferReader SBufferReader;
+
+// SBuffer
+#define BUFFER_INITIALIZER ((SBuffer){0, 0, NULL})
+static int32_t tBufferInit(SBuffer *buffer);
+static int32_t tBufferDestroy(SBuffer *buffer);
+static int32_t tBufferClear(SBuffer *buffer);
+static int32_t tBufferEnsureCapacity(SBuffer *buffer, uint32_t capacity);
+static int32_t tBufferPut(SBuffer *buffer, const void *data, uint32_t size);
+static int32_t tBufferPutAt(SBuffer *buffer, uint32_t offset, const void *data, uint32_t size);
+static int32_t tBufferPutI8(SBuffer *buffer, int8_t value);
+static int32_t tBufferPutI16(SBuffer *buffer, int16_t value);
+static int32_t tBufferPutI32(SBuffer *buffer, int32_t value);
+static int32_t tBufferPutI64(SBuffer *buffer, int64_t value);
+static int32_t tBufferPutU8(SBuffer *buffer, uint8_t value);
+static int32_t tBufferPutU16(SBuffer *buffer, uint16_t value);
+static int32_t tBufferPutU32(SBuffer *buffer, uint32_t value);
+static int32_t tBufferPutU64(SBuffer *buffer, uint64_t value);
+static int32_t tBufferPutI16v(SBuffer *buffer, int16_t value);
+static int32_t tBufferPutI32v(SBuffer *buffer, int32_t value);
+static int32_t tBufferPutI64v(SBuffer *buffer, int64_t value);
+static int32_t tBufferPutU16v(SBuffer *buffer, uint16_t value);
+static int32_t tBufferPutU32v(SBuffer *buffer, uint32_t value);
+static int32_t tBufferPutU64v(SBuffer *buffer, uint64_t value);
+static int32_t tBufferPutBinary(SBuffer *buffer, const void *data, uint32_t size);
+static int32_t tBufferPutCStr(SBuffer *buffer, const char *str);
+static int32_t tBufferPutF32(SBuffer *buffer, float value);
+static int32_t tBufferPutF64(SBuffer *buffer, double value);
+
+#define tBufferGetSize(buffer) ((buffer)->size)
+#define tBufferGetCapacity(buffer) ((buffer)->capacity)
+#define tBufferGetData(buffer) ((buffer)->data)
+#define tBufferGetDataAt(buffer, offset) ((char *)(buffer)->data + (offset))
+#define tBufferGetDataEnd(buffer) ((char *)(buffer)->data + (buffer)->size)
+
+// SBufferReader
+#define BUFFER_READER_INITIALIZER(offset, buffer) ((SBufferReader){offset, buffer})
+#define BR_PTR(br) tBufferGetDataAt((br)->buffer, (br)->offset)
+#define tBufferReaderDestroy(reader) ((void)0)
+#define tBufferReaderGetOffset(reader) ((reader)->offset)
+static int32_t tBufferGet(SBufferReader *reader, uint32_t size, void *data);
+static int32_t tBufferReaderInit(SBufferReader *reader, uint32_t offset, SBuffer *buffer);
+static int32_t tBufferGetI8(SBufferReader *reader, int8_t *value);
+static int32_t tBufferGetI16(SBufferReader *reader, int16_t *value);
+static int32_t tBufferGetI32(SBufferReader *reader, int32_t *value);
+static int32_t tBufferGetI64(SBufferReader *reader, int64_t *value);
+static int32_t tBufferGetU8(SBufferReader *reader, uint8_t *value);
+static int32_t tBufferGetU16(SBufferReader *reader, uint16_t *value);
+static int32_t tBufferGetU32(SBufferReader *reader, uint32_t *value);
+static int32_t tBufferGetU64(SBufferReader *reader, uint64_t *value);
+static int32_t tBufferGetI16v(SBufferReader *reader, int16_t *value);
+static int32_t tBufferGetI32v(SBufferReader *reader, int32_t *value);
+static int32_t tBufferGetI64v(SBufferReader *reader, int64_t *value);
+static int32_t tBufferGetU16v(SBufferReader *reader, uint16_t *value);
+static int32_t tBufferGetU32v(SBufferReader *reader, uint32_t *value);
+static int32_t tBufferGetU64v(SBufferReader *reader, uint64_t *value);
+static int32_t tBufferGetBinary(SBufferReader *reader, const void **data, uint32_t *size);
+static int32_t tBufferGetCStr(SBufferReader *reader, const char **str);
+static int32_t tBufferGetF32(SBufferReader *reader, float *value);
+static int32_t tBufferGetF64(SBufferReader *reader, double *value);
+
+#include "tbuffer.inc"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__TD_BUFFER_H__*/
\ No newline at end of file
diff --git a/include/util/tbuffer.inc b/include/util/tbuffer.inc
new file mode 100644
index 0000000000..f0137ee978
--- /dev/null
+++ b/include/util/tbuffer.inc
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "taoserror.h"
+#include "tcoding.h"
+
+struct SBuffer {
+ uint32_t size;
+ uint32_t capacity;
+ void *data;
+};
+
+struct SBufferReader {
+ uint32_t offset;
+ SBuffer *buffer;
+};
+
+// SBuffer
+static FORCE_INLINE int32_t tBufferInit(SBuffer *buffer) {
+ buffer->size = 0;
+ buffer->capacity = 0;
+ buffer->data = NULL;
+ return 0;
+}
+
+static FORCE_INLINE int32_t tBufferDestroy(SBuffer *buffer) {
+ buffer->size = 0;
+ buffer->capacity = 0;
+ if (buffer->data) {
+ taosMemoryFree(buffer->data);
+ buffer->data = NULL;
+ }
+ return 0;
+}
+
+static FORCE_INLINE int32_t tBufferClear(SBuffer *buffer) {
+ buffer->size = 0;
+ return 0;
+}
+
+static FORCE_INLINE int32_t tBufferEnsureCapacity(SBuffer *buffer, uint32_t capacity) {
+ if (buffer->capacity < capacity) {
+ uint32_t newCapacity = (buffer->capacity > 0) ? (buffer->capacity << 1) : 1024;
+ while (newCapacity < capacity) {
+ newCapacity <<= 1;
+ }
+ void *newData = taosMemoryRealloc(buffer->data, newCapacity);
+ if (newData == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ buffer->data = newData;
+ buffer->capacity = newCapacity;
+ }
+ return 0;
+}
+
+static FORCE_INLINE int32_t tBufferPut(SBuffer *buffer, const void *data, uint32_t size) {
+ int32_t code = tBufferEnsureCapacity(buffer, buffer->size + size);
+ if (code) return code;
+ memcpy((char *)buffer->data + buffer->size, data, size);
+ buffer->size += size;
+ return 0;
+}
+
+static int32_t tBufferPutAt(SBuffer *buffer, uint32_t offset, const void *data, uint32_t size) {
+ if (offset + size > buffer->size) {
+ return TSDB_CODE_OUT_OF_RANGE;
+ }
+ memcpy((char *)buffer->data + offset, data, size);
+ return 0;
+}
+
+static FORCE_INLINE int32_t tBufferPutI8(SBuffer *buffer, int8_t value) {
+ return tBufferPut(buffer, &value, sizeof(value));
+}
+
+static FORCE_INLINE int32_t tBufferPutI16(SBuffer *buffer, int16_t value) {
+ return tBufferPut(buffer, &value, sizeof(value));
+}
+
+static FORCE_INLINE int32_t tBufferPutI32(SBuffer *buffer, int32_t value) {
+ return tBufferPut(buffer, &value, sizeof(value));
+}
+
+static FORCE_INLINE int32_t tBufferPutI64(SBuffer *buffer, int64_t value) {
+ return tBufferPut(buffer, &value, sizeof(value));
+}
+
+static FORCE_INLINE int32_t tBufferPutU8(SBuffer *buffer, uint8_t value) {
+ return tBufferPut(buffer, &value, sizeof(value));
+}
+
+static FORCE_INLINE int32_t tBufferPutU16(SBuffer *buffer, uint16_t value) {
+ return tBufferPut(buffer, &value, sizeof(value));
+}
+
+static FORCE_INLINE int32_t tBufferPutU32(SBuffer *buffer, uint32_t value) {
+ return tBufferPut(buffer, &value, sizeof(value));
+}
+
+static FORCE_INLINE int32_t tBufferPutU64(SBuffer *buffer, uint64_t value) {
+ return tBufferPut(buffer, &value, sizeof(value));
+}
+
+static FORCE_INLINE int32_t tBufferPutU16v(SBuffer *buffer, uint16_t value) { return tBufferPutU64v(buffer, value); }
+
+static FORCE_INLINE int32_t tBufferPutU32v(SBuffer *buffer, uint32_t value) { return tBufferPutU64v(buffer, value); }
+
+static FORCE_INLINE int32_t tBufferPutU64v(SBuffer *buffer, uint64_t value) {
+ int32_t code;
+ while (value >= 0x80) {
+ code = tBufferPutU8(buffer, (value & 0x7F) | 0x80);
+ if (code) return code;
+ value >>= 7;
+ }
+ return tBufferPutU8(buffer, value);
+}
+
+static FORCE_INLINE int32_t tBufferPutI16v(SBuffer *buffer, int16_t value) {
+ return tBufferPutU64v(buffer, ZIGZAGE(int16_t, value));
+}
+
+static FORCE_INLINE int32_t tBufferPutI32v(SBuffer *buffer, int32_t value) {
+ return tBufferPutU64v(buffer, ZIGZAGE(int32_t, value));
+}
+
+static FORCE_INLINE int32_t tBufferPutI64v(SBuffer *buffer, int64_t value) {
+ return tBufferPutU64v(buffer, ZIGZAGE(int64_t, value));
+}
+
+static FORCE_INLINE int32_t tBufferPutBinary(SBuffer *buffer, const void *data, uint32_t size) {
+ int32_t code = tBufferPutU32v(buffer, size);
+ if (code) return code;
+ return tBufferPut(buffer, data, size);
+}
+
+static FORCE_INLINE int32_t tBufferPutCStr(SBuffer *buffer, const char *str) {
+ return tBufferPutBinary(buffer, str, str ? strlen(str) + 1 : 0);
+}
+
+static FORCE_INLINE int32_t tBufferPutF32(SBuffer *buffer, float value) {
+ union {
+ float f;
+ uint32_t u;
+ } u;
+ u.f = value;
+ return tBufferPutU32(buffer, u.u);
+}
+
+static FORCE_INLINE int32_t tBufferPutF64(SBuffer *buffer, double value) {
+ union {
+ double f;
+ uint64_t u;
+ } u;
+ u.f = value;
+ return tBufferPutU64(buffer, u.u);
+}
+
+// reader
+// SBufferReader
+static int32_t tBufferReaderInit(SBufferReader *reader, uint32_t offset, SBuffer *buffer) {
+ reader->offset = offset;
+ reader->buffer = buffer;
+ return 0;
+}
+
+static FORCE_INLINE int32_t tBufferGet(SBufferReader *reader, uint32_t size, void *data) {
+ if (reader->offset < 0 || reader->offset + size > reader->buffer->size) {
+ return TSDB_CODE_OUT_OF_RANGE;
+ }
+ if (data) {
+ memcpy(data, BR_PTR(reader), size);
+ }
+ reader->offset += size;
+ return 0;
+}
+
+static int32_t tBufferGetI8(SBufferReader *reader, int8_t *value) { return tBufferGet(reader, sizeof(*value), value); }
+
+static int32_t tBufferGetI16(SBufferReader *reader, int16_t *value) {
+ return tBufferGet(reader, sizeof(*value), value);
+}
+
+static int32_t tBufferGetI32(SBufferReader *reader, int32_t *value) {
+ return tBufferGet(reader, sizeof(*value), value);
+}
+
+static int32_t tBufferGetI64(SBufferReader *reader, int64_t *value) {
+ return tBufferGet(reader, sizeof(*value), value);
+}
+
+static int32_t tBufferGetU8(SBufferReader *reader, uint8_t *value) { return tBufferGet(reader, sizeof(*value), value); }
+
+static int32_t tBufferGetU16(SBufferReader *reader, uint16_t *value) {
+ return tBufferGet(reader, sizeof(*value), value);
+}
+
+static int32_t tBufferGetU32(SBufferReader *reader, uint32_t *value) {
+ return tBufferGet(reader, sizeof(*value), value);
+}
+
+static int32_t tBufferGetU64(SBufferReader *reader, uint64_t *value) {
+ return tBufferGet(reader, sizeof(*value), value);
+}
+
+static int32_t tBufferGetU64v(SBufferReader *reader, uint64_t *value) {
+ uint8_t byte;
+ int32_t code;
+ uint64_t u64 = 0;
+
+ for (int32_t i = 0;; i++) {
+ code = tBufferGetU8(reader, &byte);
+ if (code) return code;
+
+ u64 |= (((uint64_t)(byte & 0x7F)) << (i * 7));
+
+ if (byte < 0x80) {
+ break;
+ }
+ }
+
+ if (value) {
+ *value = u64;
+ }
+
+ return 0;
+}
+
+static int32_t tBufferGetU16v(SBufferReader *reader, uint16_t *value) {
+ uint64_t u64;
+ int32_t code = tBufferGetU64v(reader, &u64);
+ if (code) return code;
+ if (value) {
+ *value = (uint16_t)u64;
+ }
+ return 0;
+}
+
+static int32_t tBufferGetU32v(SBufferReader *reader, uint32_t *value) {
+ uint64_t u64;
+ int32_t code = tBufferGetU64v(reader, &u64);
+ if (code) return code;
+ if (value) {
+ *value = (uint32_t)u64;
+ }
+ return 0;
+}
+
+static int32_t tBufferGetI16v(SBufferReader *reader, int16_t *value) {
+ uint16_t u16;
+ int32_t code = tBufferGetU16v(reader, &u16);
+ if (code) return code;
+ if (value) {
+ *value = ZIGZAGD(int16_t, u16);
+ }
+ return 0;
+}
+
+static int32_t tBufferGetI32v(SBufferReader *reader, int32_t *value) {
+ uint32_t u32;
+ int32_t code = tBufferGetU32v(reader, &u32);
+ if (code) return code;
+ if (value) {
+ *value = ZIGZAGD(int32_t, u32);
+ }
+ return 0;
+}
+
+static int32_t tBufferGetI64v(SBufferReader *reader, int64_t *value) {
+ uint64_t u64;
+ int32_t code = tBufferGetU64v(reader, &u64);
+ if (code) return code;
+ if (value) {
+ *value = ZIGZAGD(int64_t, u64);
+ }
+ return 0;
+}
+
+static int32_t tBufferGetBinary(SBufferReader *reader, const void **data, uint32_t *size) {
+ uint32_t tmpSize;
+ int32_t code;
+
+ // size
+ code = tBufferGetU32v(reader, &tmpSize);
+ if (code) return code;
+ if (size) {
+ *size = tmpSize;
+ }
+
+ // data
+ if (tmpSize > 0) {
+ if (reader->offset + tmpSize > reader->buffer->size) {
+ return TSDB_CODE_OUT_OF_RANGE;
+ }
+ if (data) {
+ *data = BR_PTR(reader);
+ }
+ reader->offset += tmpSize;
+ } else if (data) {
+ *data = NULL;
+ }
+
+ return 0;
+}
+
+static int32_t tBufferGetCStr(SBufferReader *reader, const char **str) {
+ return tBufferGetBinary(reader, (const void **)str, NULL);
+}
+
+static int32_t tBufferGetF32(SBufferReader *reader, float *value) {
+ union {
+ float f;
+ uint32_t u;
+ } u;
+ int32_t code = tBufferGetU32(reader, &u.u);
+ if (code) return code;
+ if (value) {
+ *value = u.f;
+ }
+ return 0;
+}
+
+static int32_t tBufferGetF64(SBufferReader *reader, double *value) {
+ union {
+ double f;
+ uint64_t u;
+ } u;
+ int32_t code = tBufferGetU64(reader, &u.u);
+ if (code) return code;
+ if (value) {
+ *value = u.f;
+ }
+ return 0;
+}
diff --git a/include/util/tdef.h b/include/util/tdef.h
index 8371ee24bb..e2d1beb5a5 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -187,6 +187,8 @@ typedef enum ELogicConditionType {
LOGIC_COND_TYPE_NOT,
} ELogicConditionType;
+#define TSDB_INT32_ID_LEN 11
+
#define TSDB_NAME_DELIMITER_LEN 1
#define TSDB_UNI_LEN 24
diff --git a/include/util/tqueue.h b/include/util/tqueue.h
index 9f09bd2930..eb887596d0 100644
--- a/include/util/tqueue.h
+++ b/include/util/tqueue.h
@@ -72,40 +72,6 @@ struct STaosQnode {
char item[];
};
-struct STaosQueue {
- STaosQnode *head;
- STaosQnode *tail;
- STaosQueue *next; // for queue set
- STaosQset *qset; // for queue set
- void *ahandle; // for queue set
- FItem itemFp;
- FItems itemsFp;
- TdThreadMutex mutex;
- int64_t memOfItems;
- int32_t numOfItems;
- int64_t threadId;
- int64_t memLimit;
- int64_t itemLimit;
-};
-
-struct STaosQset {
- STaosQueue *head;
- STaosQueue *current;
- TdThreadMutex mutex;
- tsem_t sem;
- int32_t numOfQueues;
- int32_t numOfItems;
-};
-
-struct STaosQall {
- STaosQnode *current;
- STaosQnode *start;
- int32_t numOfItems;
- int64_t memOfItems;
- int32_t unAccessedNumOfItems;
- int64_t unAccessMemOfItems;
-};
-
STaosQueue *taosOpenQueue();
void taosCloseQueue(STaosQueue *queue);
void taosSetQueueFp(STaosQueue *queue, FItem itemFp, FItems itemsFp);
@@ -140,6 +106,8 @@ int32_t taosGetQueueNumber(STaosQset *qset);
int32_t taosReadQitemFromQset(STaosQset *qset, void **ppItem, SQueueInfo *qinfo);
int32_t taosReadAllQitemsFromQset(STaosQset *qset, STaosQall *qall, SQueueInfo *qinfo);
void taosResetQsetThread(STaosQset *qset, void *pItem);
+void taosQueueSetThreadId(STaosQueue *pQueue, int64_t threadId);
+int64_t taosQueueGetThreadId(STaosQueue *pQueue);
#ifdef __cplusplus
}
diff --git a/include/util/tscalablebf.h b/include/util/tscalablebf.h
index 2cf170cf04..d3ce2eb23b 100644
--- a/include/util/tscalablebf.h
+++ b/include/util/tscalablebf.h
@@ -26,6 +26,8 @@ typedef struct SScalableBf {
SArray *bfArray; // array of bloom filters
uint32_t growth;
uint64_t numBits;
+ uint32_t maxBloomFilters;
+ int8_t status;
_hash_fn_t hashFn1;
_hash_fn_t hashFn2;
} SScalableBf;
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index 989c6614a6..6c3603b4e0 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -284,6 +284,7 @@ typedef struct SRequestObj {
void* pWrapper;
SMetaData parseMeta;
char* effectiveUser;
+ int8_t source;
} SRequestObj;
typedef struct SSyncQueryParam {
@@ -297,8 +298,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4);
void doSetOneRowPtr(SReqResultInfo* pResultInfo);
void setResPrecision(SReqResultInfo* pResInfo, int32_t precision);
-int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4,
- bool freeAfterUse);
+int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4);
int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows,
bool convertUcs4);
void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols);
@@ -306,10 +306,10 @@ void doFreeReqResultInfo(SReqResultInfo* pResInfo);
int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, SArray** pReq);
void syncCatalogFn(SMetaData* pResult, void* param, int32_t code);
-TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly);
+TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t source);
TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, int64_t reqid);
-void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
+void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly, int8_t source);
void taosAsyncQueryImplWithReqid(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly,
int64_t reqid);
void taosAsyncFetchImpl(SRequestObj *pRequest, __taos_async_fn_t fp, void *param);
@@ -354,6 +354,7 @@ SRequestObj* acquireRequest(int64_t rid);
int32_t releaseRequest(int64_t rid);
int32_t removeRequest(int64_t rid);
void doDestroyRequest(void* p);
+int64_t removeFromMostPrevReq(SRequestObj* pRequest);
char* getDbOfConnection(STscObj* pObj);
void setConnectionDB(STscObj* pTscObj, const char* db);
diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h
index b732abffb1..122914fd34 100644
--- a/source/client/inc/clientSml.h
+++ b/source/client/inc/clientSml.h
@@ -80,7 +80,7 @@ extern "C" {
#define IS_SAME_KEY (maxKV->type == kv->type && maxKV->keyLen == kv->keyLen && memcmp(maxKV->key, kv->key, kv->keyLen) == 0)
#define IS_SLASH_LETTER_IN_MEASUREMENT(sql) \
- (*((sql)-1) == SLASH && (*(sql) == COMMA || *(sql) == SPACE))
+ (*((sql)-1) == SLASH && (*(sql) == COMMA || *(sql) == SPACE || *(sql) == SLASH))
#define MOVE_FORWARD_ONE(sql, len) (memmove((void *)((sql)-1), (sql), len))
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index 1df50a51da..6c20813118 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -385,6 +385,33 @@ int32_t releaseRequest(int64_t rid) { return taosReleaseRef(clientReqRefPool, ri
int32_t removeRequest(int64_t rid) { return taosRemoveRef(clientReqRefPool, rid); }
+/// return the most previous req ref id
+int64_t removeFromMostPrevReq(SRequestObj* pRequest) {
+ int64_t mostPrevReqRefId = pRequest->self;
+ SRequestObj* pTmp = pRequest;
+ while (pTmp->relation.prevRefId) {
+ pTmp = acquireRequest(pTmp->relation.prevRefId);
+ if (pTmp) {
+ mostPrevReqRefId = pTmp->self;
+ releaseRequest(mostPrevReqRefId);
+ } else {
+ break;
+ }
+ }
+ removeRequest(mostPrevReqRefId);
+ return mostPrevReqRefId;
+}
+
+void destroyNextReq(int64_t nextRefId) {
+ if (nextRefId) {
+ SRequestObj* pObj = acquireRequest(nextRefId);
+ if (pObj) {
+ releaseRequest(nextRefId);
+ releaseRequest(nextRefId);
+ }
+ }
+}
+
void destroySubRequests(SRequestObj *pRequest) {
int32_t reqIdx = -1;
SRequestObj *pReqList[16] = {NULL};
@@ -435,7 +462,7 @@ void doDestroyRequest(void *p) {
uint64_t reqId = pRequest->requestId;
tscTrace("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest);
- destroySubRequests(pRequest);
+ int64_t nextReqRefId = pRequest->relation.nextRefId;
taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self));
@@ -471,6 +498,7 @@ void doDestroyRequest(void *p) {
taosMemoryFreeClear(pRequest->sqlstr);
taosMemoryFree(pRequest);
tscTrace("end to destroy request %" PRIx64 " p:%p", reqId, pRequest);
+ destroyNextReq(nextReqRefId);
}
void destroyRequest(SRequestObj *pRequest) {
@@ -479,7 +507,7 @@ void destroyRequest(SRequestObj *pRequest) {
}
taos_stop_query(pRequest);
- removeRequest(pRequest->self);
+ removeFromMostPrevReq(pRequest);
}
void taosStopQueryImpl(SRequestObj *pRequest) {
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index de4f9f16e4..e87e676f08 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -302,7 +302,7 @@ int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
int8_t biMode = atomic_load_8(&pRequest->pTscObj->biMode);
int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp, biMode);
if (TSDB_CODE_SUCCESS == code && NULL != pRsp) {
- code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true);
+ code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false);
}
return code;
@@ -341,7 +341,7 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp,
atomic_load_8(&pRequest->pTscObj->biMode));
if (TSDB_CODE_SUCCESS == code && NULL != pRsp) {
- code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true);
+ code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false);
}
SReqResultInfo* pResultInfo = &pRequest->body.resInfo;
@@ -743,6 +743,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
.chkKillFp = chkRequestKilled,
.chkKillParam = (void*)pRequest->self,
.pExecRes = &res,
+ .source = pRequest->source,
};
int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob);
@@ -1212,6 +1213,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
.chkKillFp = chkRequestKilled,
.chkKillParam = (void*)pRequest->self,
.pExecRes = NULL,
+ .source = pRequest->source,
};
code = schedulerExecJob(&req, &pRequest->body.queryJob);
taosArrayDestroy(pNodeList);
@@ -1719,7 +1721,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4)
}
pRequest->code =
- setQueryResultFromRsp(&pRequest->body.resInfo, (const SRetrieveTableRsp*)pResInfo->pData, convertUcs4, true);
+ setQueryResultFromRsp(&pRequest->body.resInfo, (const SRetrieveTableRsp*)pResInfo->pData, convertUcs4);
if (pRequest->code != TSDB_CODE_SUCCESS) {
pResultInfo->numOfRows = 0;
return NULL;
@@ -2178,15 +2180,13 @@ void resetConnectDB(STscObj* pTscObj) {
taosThreadMutexUnlock(&pTscObj->mutex);
}
-int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4,
- bool freeAfterUse) {
+int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4) {
if (pResultInfo == NULL || pRsp == NULL) {
tscError("setQueryResultFromRsp paras is null");
return TSDB_CODE_TSC_INTERNAL_ERROR;
}
- if (freeAfterUse) taosMemoryFreeClear(pResultInfo->pRspMsg);
-
+ taosMemoryFreeClear(pResultInfo->pRspMsg);
pResultInfo->pRspMsg = (const char*)pRsp;
pResultInfo->pData = (void*)pRsp->data;
pResultInfo->numOfRows = htobe64(pRsp->numOfRows);
@@ -2475,7 +2475,7 @@ void syncQueryFn(void* param, void* res, int32_t code) {
tsem_post(&pParam->sem);
}
-void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly) {
+void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly, int8_t source) {
if (sql == NULL || NULL == fp) {
terrno = TSDB_CODE_INVALID_PARA;
if (fp) {
@@ -2501,6 +2501,7 @@ void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp,
return;
}
+ pRequest->source = source;
pRequest->body.queryFp = fp;
doAsyncQuery(pRequest, false);
}
@@ -2535,7 +2536,7 @@ void taosAsyncQueryImplWithReqid(uint64_t connId, const char* sql, __taos_async_
doAsyncQuery(pRequest, false);
}
-TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) {
+TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t source) {
if (NULL == taos) {
terrno = TSDB_CODE_TSC_DISCONNECTED;
return NULL;
@@ -2550,7 +2551,7 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) {
}
tsem_init(¶m->sem, 0, 0);
- taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly);
+ taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, source);
tsem_wait(¶m->sem);
SRequestObj* pRequest = NULL;
@@ -2615,7 +2616,7 @@ static void fetchCallback(void* pResult, void* param, int32_t code) {
}
pRequest->code =
- setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp*)pResultInfo->pData, pResultInfo->convertUcs4, true);
+ setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp*)pResultInfo->pData, pResultInfo->convertUcs4);
if (pRequest->code != TSDB_CODE_SUCCESS) {
pResultInfo->numOfRows = 0;
pRequest->code = code;
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index 275ca0d2aa..a49d2091ac 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -350,7 +350,6 @@ void taos_free_result(TAOS_RES *res) {
taosArrayDestroy(pRsp->rsp.createTableLen);
taosArrayDestroyP(pRsp->rsp.createTableReq, taosMemoryFree);
- pRsp->resInfo.pRspMsg = NULL;
doFreeReqResultInfo(&pRsp->resInfo);
taosMemoryFree(pRsp);
} else if (TD_RES_TMQ(res)) {
@@ -359,7 +358,6 @@ void taos_free_result(TAOS_RES *res) {
taosArrayDestroy(pRsp->rsp.blockDataLen);
taosArrayDestroyP(pRsp->rsp.blockTbName, taosMemoryFree);
taosArrayDestroyP(pRsp->rsp.blockSchema, (FDelete)tDeleteSchemaWrapper);
- pRsp->resInfo.pRspMsg = NULL;
doFreeReqResultInfo(&pRsp->resInfo);
taosMemoryFree(pRsp);
} else if (TD_RES_TMQ_META(res)) {
@@ -402,7 +400,7 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
return pResInfo->userFields;
}
-TAOS_RES *taos_query(TAOS *taos, const char *sql) { return taosQueryImpl(taos, sql, false); }
+TAOS_RES *taos_query(TAOS *taos, const char *sql) { return taosQueryImpl(taos, sql, false, TD_REQ_FROM_APP); }
TAOS_RES *taos_query_with_reqid(TAOS *taos, const char *sql, int64_t reqid) {
return taosQueryImplWithReqid(taos, sql, false, reqid);
}
@@ -828,7 +826,7 @@ int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) {
}
int taos_validate_sql(TAOS *taos, const char *sql) {
- TAOS_RES *pObj = taosQueryImpl(taos, sql, true);
+ TAOS_RES *pObj = taosQueryImpl(taos, sql, true, TD_REQ_FROM_APP);
int code = taos_errno(pObj);
@@ -1126,7 +1124,7 @@ void continueInsertFromCsv(SSqlCallbackWrapper *pWrapper, SRequestObj *pRequest)
void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param) {
int64_t connId = *(int64_t *)taos;
tscDebug("taos_query_a start with sql:%s", sql);
- taosAsyncQueryImpl(connId, sql, fp, param, false);
+ taosAsyncQueryImpl(connId, sql, fp, param, false, TD_REQ_FROM_APP);
tscDebug("taos_query_a end with sql:%s", sql);
}
@@ -1254,54 +1252,34 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
}
void restartAsyncQuery(SRequestObj *pRequest, int32_t code) {
- int32_t reqIdx = 0;
- SRequestObj *pReqList[16] = {NULL};
- SRequestObj *pUserReq = NULL;
- pReqList[0] = pRequest;
- uint64_t tmpRefId = 0;
- SRequestObj *pTmp = pRequest;
- while (pTmp->relation.prevRefId) {
- tmpRefId = pTmp->relation.prevRefId;
- pTmp = acquireRequest(tmpRefId);
- if (pTmp) {
- pReqList[++reqIdx] = pTmp;
- releaseRequest(tmpRefId);
- } else {
- tscError("prev req ref 0x%" PRIx64 " is not there", tmpRefId);
+ tscInfo("restart request: %s p: %p", pRequest->sqlstr, pRequest);
+ SRequestObj* pUserReq = pRequest;
+ acquireRequest(pRequest->self);
+ while (pUserReq) {
+ if (pUserReq->self == pUserReq->relation.userRefId || pUserReq->relation.userRefId == 0) {
break;
- }
- }
-
- tmpRefId = pRequest->relation.nextRefId;
- while (tmpRefId) {
- pTmp = acquireRequest(tmpRefId);
- if (pTmp) {
- tmpRefId = pTmp->relation.nextRefId;
- removeRequest(pTmp->self);
- releaseRequest(pTmp->self);
} else {
- tscError("next req ref 0x%" PRIx64 " is not there", tmpRefId);
- break;
+ int64_t nextRefId = pUserReq->relation.nextRefId;
+ releaseRequest(pUserReq->self);
+ if (nextRefId) {
+ pUserReq = acquireRequest(nextRefId);
+ }
}
}
-
- for (int32_t i = reqIdx; i >= 0; i--) {
- destroyCtxInRequest(pReqList[i]);
- if (pReqList[i]->relation.userRefId == pReqList[i]->self || 0 == pReqList[i]->relation.userRefId) {
- pUserReq = pReqList[i];
- } else {
- removeRequest(pReqList[i]->self);
- }
- }
-
+ bool hasSubRequest = pUserReq != pRequest || pRequest->relation.prevRefId != 0;
if (pUserReq) {
+ destroyCtxInRequest(pUserReq);
pUserReq->prevCode = code;
memset(&pUserReq->relation, 0, sizeof(pUserReq->relation));
} else {
- tscError("user req is missing");
+ tscError("User req is missing");
+ removeFromMostPrevReq(pRequest);
return;
}
-
+ if (hasSubRequest)
+ removeFromMostPrevReq(pRequest);
+ else
+ releaseRequest(pUserReq->self);
doAsyncQuery(pUserReq, true);
}
diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c
index 324b99022b..360a346fb7 100644
--- a/source/client/src/clientMsgHandler.c
+++ b/source/client/src/clientMsgHandler.c
@@ -538,7 +538,7 @@ int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) {
code = buildShowVariablesRsp(rsp.variables, &pRes);
}
if (TSDB_CODE_SUCCESS == code) {
- code = setQueryResultFromRsp(&pRequest->body.resInfo, pRes, false, true);
+ code = setQueryResultFromRsp(&pRequest->body.resInfo, pRes, false);
}
if (code != 0) {
@@ -651,7 +651,7 @@ int32_t processCompactDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
code = buildRetriveTableRspForCompactDb(&rsp, &pRes);
}
if (TSDB_CODE_SUCCESS == code) {
- code = setQueryResultFromRsp(&pRequest->body.resInfo, pRes, false, true);
+ code = setQueryResultFromRsp(&pRequest->body.resInfo, pRes, false);
}
if (code != 0) {
diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c
index a4c67473ae..1b8081015f 100644
--- a/source/client/src/clientRawBlockWrite.c
+++ b/source/client/src/clientRawBlockWrite.c
@@ -1258,7 +1258,7 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) {
snprintf(sql, sizeof(sql), "delete from `%s` where `%s` >= %" PRId64 " and `%s` <= %" PRId64, req.tableFName,
req.tsColName, req.skey, req.tsColName, req.ekey);
- TAOS_RES* res = taos_query(taos, sql);
+ TAOS_RES* res = taosQueryImpl(taos, sql, false, TD_REQ_FROM_TAOX);
SRequestObj* pRequest = (SRequestObj*)res;
code = pRequest->code;
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_PAR_GET_META_ERROR) {
diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c
index 0c610a4611..7535cbfd0c 100644
--- a/source/client/src/clientSmlLine.c
+++ b/source/client/src/clientSmlLine.c
@@ -20,14 +20,14 @@
#include "clientSml.h"
-#define IS_COMMA(sql) (*(sql) == COMMA && *((sql)-1) != SLASH)
-#define IS_SPACE(sql) (*(sql) == SPACE && *((sql)-1) != SLASH)
-#define IS_EQUAL(sql) (*(sql) == EQUAL && *((sql)-1) != SLASH)
+#define IS_COMMA(sql,escapeChar) (*(sql) == COMMA && (*((sql)-1) != SLASH || ((sql)-1 == escapeChar)))
+#define IS_SPACE(sql,escapeChar) (*(sql) == SPACE && (*((sql)-1) != SLASH || ((sql)-1 == escapeChar)))
+#define IS_EQUAL(sql,escapeChar) (*(sql) == EQUAL && (*((sql)-1) != SLASH || ((sql)-1 == escapeChar)))
#define IS_SLASH_LETTER_IN_FIELD_VALUE(sql) (*((sql)-1) == SLASH && (*(sql) == QUOTE || *(sql) == SLASH))
#define IS_SLASH_LETTER_IN_TAG_FIELD_KEY(sql) \
- (*((sql)-1) == SLASH && (*(sql) == COMMA || *(sql) == SPACE || *(sql) == EQUAL))
+ (*((sql)-1) == SLASH && (*(sql) == COMMA || *(sql) == SPACE || *(sql) == EQUAL || *(sql) == SLASH))
#define PROCESS_SLASH_IN_FIELD_VALUE(key, keyLen) \
for (int i = 1; i < keyLen; ++i) { \
@@ -198,7 +198,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){
int cnt = 0;
while (*sql < sqlEnd) {
- if (unlikely(IS_SPACE(*sql))) {
+ if (unlikely(IS_SPACE(*sql,NULL))) {
break;
}
@@ -207,18 +207,21 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){
size_t keyLen = 0;
bool keyEscaped = false;
size_t keyLenEscaped = 0;
+ const char *escapeChar = NULL;
+
while (*sql < sqlEnd) {
- if (unlikely(IS_SPACE(*sql) || IS_COMMA(*sql))) {
+ if (unlikely(IS_SPACE(*sql,escapeChar) || IS_COMMA(*sql,escapeChar))) {
smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", *sql);
terrno = TSDB_CODE_SML_INVALID_DATA;
return -1;
}
- if (unlikely(IS_EQUAL(*sql))) {
+ if (unlikely(IS_EQUAL(*sql,escapeChar))) {
keyLen = *sql - key;
(*sql)++;
break;
}
if (IS_SLASH_LETTER_IN_TAG_FIELD_KEY(*sql)) {
+ escapeChar = *sql;
keyLenEscaped++;
keyEscaped = true;
}
@@ -238,15 +241,16 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){
size_t valueLenEscaped = 0;
while (*sql < sqlEnd) {
// parse value
- if (unlikely(IS_SPACE(*sql) || IS_COMMA(*sql))) {
+ if (unlikely(IS_SPACE(*sql,escapeChar) || IS_COMMA(*sql,escapeChar))) {
break;
- } else if (unlikely(IS_EQUAL(*sql))) {
+ } else if (unlikely(IS_EQUAL(*sql,escapeChar))) {
smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", *sql);
terrno = TSDB_CODE_SML_INVALID_DATA;
return -1;
}
if (IS_SLASH_LETTER_IN_TAG_FIELD_KEY(*sql)) {
+ escapeChar = *sql;
valueLenEscaped++;
valueEscaped = true;
}
@@ -293,7 +297,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){
}
cnt++;
- if (IS_SPACE(*sql)) {
+ if (IS_SPACE(*sql,escapeChar)) {
break;
}
(*sql)++;
@@ -326,7 +330,7 @@ static int32_t smlParseTagLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *currElement) {
int cnt = 0;
while (*sql < sqlEnd) {
- if (unlikely(IS_SPACE(*sql))) {
+ if (unlikely(IS_SPACE(*sql,NULL))) {
break;
}
@@ -335,17 +339,19 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
size_t keyLen = 0;
bool keyEscaped = false;
size_t keyLenEscaped = 0;
+ const char *escapeChar = NULL;
while (*sql < sqlEnd) {
- if (unlikely(IS_SPACE(*sql) || IS_COMMA(*sql))) {
+ if (unlikely(IS_SPACE(*sql,escapeChar) || IS_COMMA(*sql,escapeChar))) {
smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", *sql);
return TSDB_CODE_SML_INVALID_DATA;
}
- if (unlikely(IS_EQUAL(*sql))) {
+ if (unlikely(IS_EQUAL(*sql,escapeChar))) {
keyLen = *sql - key;
(*sql)++;
break;
}
if (IS_SLASH_LETTER_IN_TAG_FIELD_KEY(*sql)) {
+ escapeChar = *sql;
keyLenEscaped++;
keyEscaped = true;
}
@@ -363,7 +369,6 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
bool valueEscaped = false;
size_t valueLenEscaped = 0;
int quoteNum = 0;
- const char *escapeChar = NULL;
while (*sql < sqlEnd) {
// parse value
if (unlikely(*(*sql) == QUOTE && (*(*sql - 1) != SLASH || (*sql - 1) == escapeChar))) {
@@ -374,7 +379,7 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
}
continue;
}
- if (quoteNum % 2 == 0 && (unlikely(IS_SPACE(*sql) || IS_COMMA(*sql)))) {
+ if (quoteNum % 2 == 0 && (unlikely(IS_SPACE(*sql,escapeChar) || IS_COMMA(*sql,escapeChar)))) {
break;
}
if (IS_SLASH_LETTER_IN_FIELD_VALUE(*sql) && (*sql - 1) != escapeChar) {
@@ -437,7 +442,7 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
}
cnt++;
- if (IS_SPACE(*sql)) {
+ if (IS_SPACE(*sql,escapeChar)) {
break;
}
(*sql)++;
@@ -453,19 +458,18 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
elements->measure = sql;
// parse measure
size_t measureLenEscaped = 0;
+ const char *escapeChar = NULL;
while (sql < sqlEnd) {
- if (unlikely((sql != elements->measure) && IS_SLASH_LETTER_IN_MEASUREMENT(sql))) {
- elements->measureEscaped = true;
- measureLenEscaped++;
- sql++;
- continue;
- }
- if (unlikely(IS_COMMA(sql))) {
+ if (unlikely(IS_COMMA(sql,escapeChar) || IS_SPACE(sql,escapeChar))) {
break;
}
- if (unlikely(IS_SPACE(sql))) {
- break;
+ if (unlikely((sql != elements->measure) && IS_SLASH_LETTER_IN_MEASUREMENT(sql))) {
+ elements->measureEscaped = true;
+ escapeChar = sql;
+ measureLenEscaped++;
+ sql++;
+ continue;
}
sql++;
}
@@ -478,9 +482,12 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
// to get measureTagsLen before
const char *tmp = sql;
while (tmp < sqlEnd) {
- if (unlikely(IS_SPACE(tmp))) {
+ if (unlikely(IS_SPACE(tmp,escapeChar))) {
break;
}
+ if(unlikely(IS_SLASH_LETTER_IN_TAG_FIELD_KEY(tmp))){
+ escapeChar = tmp;
+ }
tmp++;
}
elements->measureTagsLen = tmp - elements->measure;
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index 9b74456da2..fb1882e472 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -876,12 +876,13 @@ int32_t tmqHandleAllDelayedTask(tmq_t* pTmq) {
STaosQall* qall = taosAllocateQall();
taosReadAllQitems(pTmq->delayedTask, qall);
- if (qall->numOfItems == 0) {
+ int32_t numOfItems = taosQallItemSize(qall);
+ if (numOfItems == 0) {
taosFreeQall(qall);
return TSDB_CODE_SUCCESS;
}
- tscDebug("consumer:0x%" PRIx64 " handle delayed %d tasks before poll data", pTmq->consumerId, qall->numOfItems);
+ tscDebug("consumer:0x%" PRIx64 " handle delayed %d tasks before poll data", pTmq->consumerId, numOfItems);
int8_t* pTaskType = NULL;
taosGetQitem(qall, (void**)&pTaskType);
@@ -1009,19 +1010,8 @@ int32_t tmq_unsubscribe(tmq_t* tmq) {
}
taosSsleep(2); // sleep 2s for hb to send offset and rows to server
- int32_t rsp;
- int32_t retryCnt = 0;
tmq_list_t* lst = tmq_list_new();
- while (1) {
- rsp = tmq_subscribe(tmq, lst);
- if (rsp != TSDB_CODE_MND_CONSUMER_NOT_READY || retryCnt > 5) {
- break;
- } else {
- retryCnt++;
- taosMsleep(500);
- }
- }
-
+ int32_t rsp = tmq_subscribe(tmq, lst);
tmq_list_destroy(lst);
return rsp;
}
@@ -1271,10 +1261,9 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
}
int32_t retryCnt = 0;
- while (syncAskEp(tmq) != 0) {
- if (retryCnt++ > MAX_RETRY_COUNT) {
+ while ((code = syncAskEp(tmq)) != 0) {
+ if (retryCnt++ > MAX_RETRY_COUNT || code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) {
tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry more than 2 minutes", tmq->consumerId);
- code = TSDB_CODE_MND_CONSUMER_NOT_READY;
goto FAIL;
}
@@ -1839,7 +1828,7 @@ static void updateVgInfo(SMqClientVg* pVg, STqOffsetVal* reqOffset, STqOffsetVal
}
static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
- tscDebug("consumer:0x%" PRIx64 " start to handle the rsp, total:%d", tmq->consumerId, tmq->qall->numOfItems);
+ tscDebug("consumer:0x%" PRIx64 " start to handle the rsp, total:%d", tmq->consumerId, taosQallItemSize(tmq->qall));
while (1) {
SMqRspWrapper* pRspWrapper = NULL;
@@ -2147,26 +2136,19 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
if (tmq->status == TMQ_CONSUMER_STATUS__READY) {
// if auto commit is set, commit before close consumer. Otherwise, do nothing.
if (tmq->autoCommit) {
- int32_t rsp = tmq_commit_sync(tmq, NULL);
- if (rsp != 0) {
- return rsp;
+ int32_t code = tmq_commit_sync(tmq, NULL);
+ if (code != 0) {
+ return code;
}
}
taosSsleep(2); // sleep 2s for hb to send offset and rows to server
- int32_t retryCnt = 0;
tmq_list_t* lst = tmq_list_new();
- while (1) {
- int32_t rsp = tmq_subscribe(tmq, lst);
- if (rsp != TSDB_CODE_MND_CONSUMER_NOT_READY || retryCnt > 5) {
- break;
- } else {
- retryCnt++;
- taosMsleep(500);
- }
- }
-
+ int32_t code = tmq_subscribe(tmq, lst);
tmq_list_destroy(lst);
+ if (code != 0) {
+ return code;
+ }
} else {
tscInfo("consumer:0x%" PRIx64 " not in ready state, close it directly", tmq->consumerId);
}
@@ -2646,13 +2628,9 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) {
SRetrieveTableRspForTmq* pRetrieveTmq =
(SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter);
if (pRspObj->rsp.withSchema) {
+ doFreeReqResultInfo(&pRspObj->resInfo);
SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(pRspObj->rsp.blockSchema, pRspObj->resIter);
setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols);
- taosMemoryFreeClear(pRspObj->resInfo.row);
- taosMemoryFreeClear(pRspObj->resInfo.pCol);
- taosMemoryFreeClear(pRspObj->resInfo.length);
- taosMemoryFreeClear(pRspObj->resInfo.convertBuf);
- taosMemoryFreeClear(pRspObj->resInfo.convertJson);
}
pRspObj->resInfo.pData = (void*)pRetrieveTmq->data;
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index 9f55b67ea3..f0ecf2365c 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -258,7 +258,7 @@ void colDataSetNItemsNull(SColumnInfoData* pColumnInfoData, uint32_t currentRow,
memset(&BMCharPos(pColumnInfoData->nullbitmap, currentRow + i), 0xFF, (numOfRows - i) / sizeof(char));
i += (numOfRows - i) / sizeof(char) * sizeof(char);
-
+
for (; i < numOfRows; ++i) {
colDataSetNull_f(pColumnInfoData->nullbitmap, currentRow + i);
}
@@ -266,23 +266,24 @@ void colDataSetNItemsNull(SColumnInfoData* pColumnInfoData, uint32_t currentRow,
}
}
-int32_t colDataCopyAndReassign(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, uint32_t numOfRows) {
+int32_t colDataCopyAndReassign(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData,
+ uint32_t numOfRows) {
int32_t code = colDataSetVal(pColumnInfoData, currentRow, pData, false);
if (code) {
return code;
}
-
+
if (numOfRows > 1) {
int32_t* pOffset = pColumnInfoData->varmeta.offset;
memset(&pOffset[currentRow + 1], pOffset[currentRow], sizeof(pOffset[0]) * (numOfRows - 1));
- pColumnInfoData->reassigned = true;
+ pColumnInfoData->reassigned = true;
}
return TSDB_CODE_SUCCESS;
}
-int32_t colDataCopyNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData,
- uint32_t numOfRows, bool isNull) {
+int32_t colDataCopyNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, uint32_t numOfRows,
+ bool isNull) {
int32_t len = pColumnInfoData->info.bytes;
if (isNull) {
colDataSetNItemsNull(pColumnInfoData, currentRow, numOfRows);
@@ -293,18 +294,18 @@ int32_t colDataCopyNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow,
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
return colDataCopyAndReassign(pColumnInfoData, currentRow, pData, numOfRows);
} else {
- int32_t colBytes = pColumnInfoData->info.bytes;
- int32_t colOffset = currentRow * colBytes;
+ int32_t colBytes = pColumnInfoData->info.bytes;
+ int32_t colOffset = currentRow * colBytes;
uint32_t num = 1;
void* pStart = pColumnInfoData->pData + colOffset;
memcpy(pStart, pData, colBytes);
colOffset += num * colBytes;
-
+
while (num < numOfRows) {
int32_t maxNum = num << 1;
int32_t tnum = maxNum > numOfRows ? (numOfRows - num) : num;
-
+
memcpy(pColumnInfoData->pData + colOffset, pStart, tnum * colBytes);
colOffset += tnum * colBytes;
num += tnum;
@@ -452,20 +453,21 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
}
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
+ int32_t newLen = pSource->varmeta.length;
memcpy(pColumnInfoData->varmeta.offset, pSource->varmeta.offset, sizeof(int32_t) * numOfRows);
- if (pColumnInfoData->varmeta.allocLen < pSource->varmeta.length) {
- char* tmp = taosMemoryRealloc(pColumnInfoData->pData, pSource->varmeta.length);
+ if (pColumnInfoData->varmeta.allocLen < newLen) {
+ char* tmp = taosMemoryRealloc(pColumnInfoData->pData, newLen);
if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pColumnInfoData->pData = tmp;
- pColumnInfoData->varmeta.allocLen = pSource->varmeta.length;
+ pColumnInfoData->varmeta.allocLen = newLen;
}
- pColumnInfoData->varmeta.length = pSource->varmeta.length;
+ pColumnInfoData->varmeta.length = newLen;
if (pColumnInfoData->pData != NULL && pSource->pData != NULL) {
- memcpy(pColumnInfoData->pData, pSource->pData, pSource->varmeta.length);
+ memcpy(pColumnInfoData->pData, pSource->pData, newLen);
}
} else {
memcpy(pColumnInfoData->nullbitmap, pSource->nullbitmap, BitmapLen(numOfRows));
@@ -867,8 +869,8 @@ size_t blockDataGetRowSize(SSDataBlock* pBlock) {
size_t blockDataGetSerialMetaSize(uint32_t numOfCols) {
// | version | total length | total rows | blankFull | total columns | flag seg| block group id | column schema
// | each column length |
- return sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) + sizeof(bool) + sizeof(int32_t) + sizeof(int32_t) + sizeof(uint64_t) +
- numOfCols * (sizeof(int8_t) + sizeof(int32_t)) + numOfCols * sizeof(int32_t);
+ return sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) + sizeof(bool) + sizeof(int32_t) + sizeof(int32_t) +
+ sizeof(uint64_t) + numOfCols * (sizeof(int8_t) + sizeof(int32_t)) + numOfCols * sizeof(int32_t);
}
double blockDataGetSerialRowSize(const SSDataBlock* pBlock) {
@@ -1687,7 +1689,29 @@ int32_t blockDataTrimFirstRows(SSDataBlock* pBlock, size_t n) {
}
static void colDataKeepFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_t total) {
+ if (n >= total || n == 0) return;
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
+ if (pColInfoData->varmeta.length != 0) {
+ int32_t newLen = pColInfoData->varmeta.offset[n];
+ if (-1 == newLen) {
+ for (int i = n - 1; i >= 0; --i) {
+ newLen = pColInfoData->varmeta.offset[i];
+ if (newLen != -1) {
+ if (pColInfoData->info.type == TSDB_DATA_TYPE_JSON) {
+ newLen += getJsonValueLen(pColInfoData->pData + newLen);
+ } else {
+ newLen += varDataTLen(pColInfoData->pData + newLen);
+ }
+ break;
+ }
+ }
+ }
+ if (newLen <= -1) {
+ uFatal("colDataKeepFirstNRows: newLen:%d old:%d", newLen, pColInfoData->varmeta.length);
+ } else {
+ pColInfoData->varmeta.length = newLen;
+ }
+ }
// pColInfoData->varmeta.length = colDataMoveVarData(pColInfoData, 0, n);
memset(&pColInfoData->varmeta.offset[n], 0, total - n);
}
@@ -1855,10 +1879,10 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf,
int32_t rows = pDataBlock->info.rows;
int32_t len = 0;
len += snprintf(dumpBuf + len, size - len,
- "%s===stream===%s|block type %d|child id %d|group id:%" PRIu64 "|uid:%" PRId64
- "|rows:%" PRId64 "|version:%" PRIu64 "|cal start:%" PRIu64 "|cal end:%" PRIu64 "|tbl:%s\n",
- taskIdStr, flag, (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.id.groupId,
- pDataBlock->info.id.uid, pDataBlock->info.rows, pDataBlock->info.version,
+ "%s===stream===%s|block type %d|child id %d|group id:%" PRIu64 "|uid:%" PRId64 "|rows:%" PRId64
+ "|version:%" PRIu64 "|cal start:%" PRIu64 "|cal end:%" PRIu64 "|tbl:%s\n",
+ taskIdStr, flag, (int32_t)pDataBlock->info.type, pDataBlock->info.childId,
+ pDataBlock->info.id.groupId, pDataBlock->info.id.uid, pDataBlock->info.rows, pDataBlock->info.version,
pDataBlock->info.calWin.skey, pDataBlock->info.calWin.ekey, pDataBlock->info.parTbName);
if (len >= size - 1) return dumpBuf;
@@ -2016,13 +2040,13 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
if (!isStartKey) {
isStartKey = true;
ASSERT(PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId);
- SColVal cv = COL_VAL_VALUE(pCol->colId, pCol->type, (SValue){.val = *(TSKEY*)var});
+ SColVal cv = COL_VAL_VALUE(pCol->colId, ((SValue){.type = pCol->type, .val = *(TSKEY*)var}));
taosArrayPush(pVals, &cv);
} else if (colDataIsNull_s(pColInfoData, j)) {
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
taosArrayPush(pVals, &cv);
} else {
- SColVal cv = COL_VAL_VALUE(pCol->colId, pCol->type, (SValue){.val = *(int64_t*)var});
+ SColVal cv = COL_VAL_VALUE(pCol->colId, ((SValue){.type = pCol->type, .val = *(int64_t*)var}));
taosArrayPush(pVals, &cv);
}
break;
@@ -2034,9 +2058,10 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
taosArrayPush(pVals, &cv);
} else {
- void* data = colDataGetVarData(pColInfoData, j);
- SValue sv = (SValue){.nData = varDataLen(data), .pData = varDataVal(data)}; // address copy, no value
- SColVal cv = COL_VAL_VALUE(pCol->colId, pCol->type, sv);
+ void* data = colDataGetVarData(pColInfoData, j);
+ SValue sv = (SValue){
+ .type = pCol->type, .nData = varDataLen(data), .pData = varDataVal(data)}; // address copy, no value
+ SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
taosArrayPush(pVals, &cv);
}
break;
@@ -2054,7 +2079,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); // should use pCol->type
taosArrayPush(pVals, &cv);
} else {
- SValue sv;
+ SValue sv = {.type = pCol->type};
if (pCol->type == pColInfoData->info.type) {
memcpy(&sv.val, var, tDataTypes[pCol->type].bytes);
} else {
@@ -2082,7 +2107,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
}
memcpy(&sv.val, tv, tDataTypes[pCol->type].bytes);
}
- SColVal cv = COL_VAL_VALUE(pCol->colId, pColInfoData->info.type, sv);
+ SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
taosArrayPush(pVals, &cv);
}
} else {
@@ -2118,9 +2143,9 @@ _end:
return TSDB_CODE_SUCCESS;
}
-void buildCtbNameAddGroupId(char* ctbName, uint64_t groupId){
+void buildCtbNameAddGroupId(char* ctbName, uint64_t groupId) {
char tmp[TSDB_TABLE_NAME_LEN] = {0};
- snprintf(tmp, TSDB_TABLE_NAME_LEN, "_%"PRIu64, groupId);
+ snprintf(tmp, TSDB_TABLE_NAME_LEN, "_%" PRIu64, groupId);
ctbName[TSDB_TABLE_NAME_LEN - strlen(tmp) - 1] = 0; // put groupId to the end
strcat(ctbName, tmp);
}
@@ -2176,7 +2201,7 @@ int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, cha
int8_t type = TSDB_DATA_TYPE_UBIGINT;
const char* name = "group_id";
int32_t len = strlen(name);
- SSmlKv pTag = { .key = name, .keyLen = len, .type = type, .u = groupId, .length = sizeof(uint64_t)};
+ SSmlKv pTag = {.key = name, .keyLen = len, .type = type, .u = groupId, .length = sizeof(uint64_t)};
taosArrayPush(tags, &pTag);
RandTableName rname = {
@@ -2558,7 +2583,7 @@ int32_t blockDataGetSortedRows(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
pOrder->compFn = getKeyComparFunc(pOrder->pColData->info.type, pOrder->order);
}
SSDataBlockSortHelper sortHelper = {.orderInfo = pOrderInfo, .pDataBlock = pDataBlock};
- int32_t rowIdx = 0, nextRowIdx = 1;
+ int32_t rowIdx = 0, nextRowIdx = 1;
for (; rowIdx < pDataBlock->info.rows && nextRowIdx < pDataBlock->info.rows; ++rowIdx, ++nextRowIdx) {
if (dataBlockCompar(&nextRowIdx, &rowIdx, &sortHelper) < 0) {
break;
diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c
index b98c89542a..af124f7a02 100644
--- a/source/common/src/tdataformat.c
+++ b/source/common/src/tdataformat.c
@@ -16,54 +16,19 @@
#define _DEFAULT_SOURCE
#include "tdataformat.h"
#include "tRealloc.h"
-#include "tcoding.h"
#include "tdatablock.h"
#include "tlog.h"
static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, uint8_t *pData, uint32_t nData);
static int32_t (*tColDataUpdateValueImpl[8][3])(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward);
-// SBuffer ================================
-#ifdef BUILD_NO_CALL
-void tBufferDestroy(SBuffer *pBuffer) {
- tFree(pBuffer->pBuf);
- pBuffer->pBuf = NULL;
-}
-
-int32_t tBufferInit(SBuffer *pBuffer, int64_t size) {
- pBuffer->nBuf = 0;
- return tRealloc(&pBuffer->pBuf, size);
-}
-
-int32_t tBufferPut(SBuffer *pBuffer, const void *pData, int64_t nData) {
- int32_t code = 0;
-
- code = tRealloc(&pBuffer->pBuf, pBuffer->nBuf + nData);
- if (code) return code;
-
- memcpy(pBuffer->pBuf + pBuffer->nBuf, pData, nData);
- pBuffer->nBuf += nData;
-
- return code;
-}
-
-int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData) {
- int32_t code = tRealloc(&pBuffer->pBuf, pBuffer->nBuf + nData);
- if (code) return code;
-
- *ppData = pBuffer->pBuf + pBuffer->nBuf;
- pBuffer->nBuf += nData;
-
- return code;
-}
-#endif
// ================================
static int32_t tGetTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson);
// SRow ========================================================================
#define KV_FLG_LIT ((uint8_t)0x10)
#define KV_FLG_MID ((uint8_t)0x20)
-#define KV_FLG_BIG ((uint8_t)0x30)
+#define KV_FLG_BIG ((uint8_t)0x40)
#define BIT_FLG_NONE ((uint8_t)0x0)
#define BIT_FLG_NULL ((uint8_t)0x1)
@@ -72,308 +37,385 @@ static int32_t tGetTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson);
#pragma pack(push, 1)
typedef struct {
int16_t nCol;
- char idx[]; // uint8_t * | uint16_t * | uint32_t *
+ uint8_t idx[]; // uint8_t * | uint16_t * | uint32_t *
} SKVIdx;
#pragma pack(pop)
-#define ROW_SET_BITMAP(PB, FLAG, IDX, VAL) \
- do { \
- if (PB) { \
- switch (FLAG) { \
- case (HAS_NULL | HAS_NONE): \
- SET_BIT1(PB, IDX, VAL); \
- break; \
- case (HAS_VALUE | HAS_NONE): \
- SET_BIT1(PB, IDX, (VAL) ? (VAL)-1 : 0); \
- break; \
- case (HAS_VALUE | HAS_NULL): \
- SET_BIT1(PB, IDX, (VAL)-1); \
- break; \
- case (HAS_VALUE | HAS_NULL | HAS_NONE): \
- SET_BIT2(PB, IDX, VAL); \
- break; \
- default: \
- ASSERT(0); \
- break; \
- } \
- } \
+#define ROW_SET_BITMAP(PB, FLAG, IDX, VAL) \
+ do { \
+ switch (FLAG) { \
+ case (HAS_NULL | HAS_NONE): \
+ SET_BIT1(PB, IDX, VAL); \
+ break; \
+ case (HAS_VALUE | HAS_NONE): \
+ SET_BIT1(PB, IDX, (VAL) ? (VAL)-1 : 0); \
+ break; \
+ case (HAS_VALUE | HAS_NULL): \
+ SET_BIT1(PB, IDX, (VAL)-1); \
+ break; \
+ case (HAS_VALUE | HAS_NULL | HAS_NONE): \
+ SET_BIT2(PB, IDX, VAL); \
+ break; \
+ default: \
+ break; \
+ } \
} while (0)
-int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
- int32_t code = 0;
+static int32_t tPutPrimaryKeyIndex(uint8_t *p, const SPrimaryKeyIndex *index) {
+ int32_t n = 0;
+ n += tPutI8(p ? p + n : p, index->type);
+ n += tPutU32v(p ? p + n : p, index->offset);
+ return n;
+}
- ASSERT(TARRAY_SIZE(aColVal) > 0);
- ASSERT(((SColVal *)aColVal->pData)[0].cid == PRIMARYKEY_TIMESTAMP_COL_ID);
- ASSERT(((SColVal *)aColVal->pData)[0].type == TSDB_DATA_TYPE_TIMESTAMP);
+static int32_t tGetPrimaryKeyIndex(uint8_t *p, SPrimaryKeyIndex *index) {
+ int32_t n = 0;
+ n += tGetI8(p + n, &index->type);
+ n += tGetU32v(p + n, &index->offset);
+ return n;
+}
- // scan ---------------
- SRow *pRow = NULL;
- SColVal *colVals = (SColVal *)TARRAY_DATA(aColVal);
- uint8_t flag = 0;
- int32_t iColVal = 1;
- const int32_t nColVal = TARRAY_SIZE(aColVal);
- SColVal *pColVal = (iColVal < nColVal) ? &colVals[iColVal] : NULL;
- int32_t iTColumn = 1;
- const STColumn *pTColumn = pTSchema->columns + iTColumn;
- int32_t ntp = 0;
- int32_t nkv = 0;
- int32_t maxIdx = 0;
- int32_t nIdx = 0;
- while (pTColumn) {
- if (pColVal) {
- if (pColVal->cid == pTColumn->colId) {
- if (COL_VAL_IS_VALUE(pColVal)) { // VALUE
- flag |= HAS_VALUE;
- maxIdx = nkv;
- if (IS_VAR_DATA_TYPE(pTColumn->type)) {
- ntp = ntp + tPutU32v(NULL, pColVal->value.nData) + pColVal->value.nData;
- nkv = nkv + tPutI16v(NULL, pTColumn->colId) + tPutU32v(NULL, pColVal->value.nData) + pColVal->value.nData;
- } else {
- nkv = nkv + tPutI16v(NULL, pTColumn->colId) + pTColumn->bytes;
- }
- nIdx++;
- } else if (COL_VAL_IS_NONE(pColVal)) { // NONE
- flag |= HAS_NONE;
- } else if (COL_VAL_IS_NULL(pColVal)) { // NULL
- flag |= HAS_NULL;
- maxIdx = nkv;
- nkv += tPutI16v(NULL, -pTColumn->colId);
- nIdx++;
- } else {
- if (ASSERTS(0, "invalid input")) {
- code = TSDB_CODE_INVALID_PARA;
- goto _exit;
- }
+typedef struct {
+ int32_t numOfNone;
+ int32_t numOfNull;
+ int32_t numOfValue;
+ int32_t numOfPKs;
+ int8_t flag;
+
+ // tuple
+ int8_t tupleFlag;
+ SPrimaryKeyIndex tupleIndices[TD_MAX_PK_COLS];
+ int32_t tuplePKSize; // primary key size
+ int32_t tupleBitmapSize; // bitmap size
+ int32_t tupleFixedSize; // fixed part size
+ int32_t tupleVarSize; // var part size
+ int32_t tupleRowSize;
+
+ // key-value
+ int8_t kvFlag;
+ SPrimaryKeyIndex kvIndices[TD_MAX_PK_COLS];
+ int32_t kvMaxOffset;
+ int32_t kvPKSize; // primary key size
+ int32_t kvIndexSize; // offset array size
+ int32_t kvPayloadSize; // payload size
+ int32_t kvRowSize;
+} SRowBuildScanInfo;
+
+static FORCE_INLINE void tRowBuildScanAddNone(SRowBuildScanInfo *sinfo, const STColumn *pTColumn) {
+ ASSERT((pTColumn->flags & COL_IS_KEY) == 0);
+ sinfo->numOfNone++;
+}
+
+static FORCE_INLINE void tRowBuildScanAddNull(SRowBuildScanInfo *sinfo, const STColumn *pTColumn) {
+ ASSERT((pTColumn->flags & COL_IS_KEY) == 0);
+ sinfo->numOfNull++;
+ sinfo->kvMaxOffset = sinfo->kvPayloadSize;
+ sinfo->kvPayloadSize += tPutI16v(NULL, -pTColumn->colId);
+}
+
+static FORCE_INLINE void tRowBuildScanAddValue(SRowBuildScanInfo *sinfo, SColVal *colVal, const STColumn *pTColumn) {
+ bool isPK = ((pTColumn->flags & COL_IS_KEY) != 0);
+
+ if (isPK) {
+ ASSERTS(sinfo->numOfPKs < TD_MAX_PK_COLS, "too many primary keys");
+ sinfo->tupleIndices[sinfo->numOfPKs].type = colVal->value.type;
+ sinfo->tupleIndices[sinfo->numOfPKs].offset =
+ IS_VAR_DATA_TYPE(pTColumn->type) ? sinfo->tupleVarSize + sinfo->tupleFixedSize : pTColumn->offset;
+ sinfo->kvIndices[sinfo->numOfPKs].type = colVal->value.type;
+ sinfo->kvIndices[sinfo->numOfPKs].offset = sinfo->kvPayloadSize;
+ sinfo->numOfPKs++;
+ }
+
+ sinfo->kvMaxOffset = sinfo->kvPayloadSize;
+ if (IS_VAR_DATA_TYPE(colVal->value.type)) {
+ sinfo->tupleVarSize += tPutU32v(NULL, colVal->value.nData) // size
+ + colVal->value.nData; // value
+
+ sinfo->kvPayloadSize += tPutI16v(NULL, colVal->cid) // colId
+ + tPutU32v(NULL, colVal->value.nData) // size
+ + colVal->value.nData; // value
+ } else {
+ sinfo->kvPayloadSize += tPutI16v(NULL, colVal->cid) // colId
+ + tDataTypes[colVal->value.type].bytes; // value
+ }
+ sinfo->numOfValue++;
+}
+
+static int32_t tRowBuildScan(SArray *colVals, const STSchema *schema, SRowBuildScanInfo *sinfo) {
+ int32_t colValIndex = 1;
+ int32_t numOfColVals = TARRAY_SIZE(colVals);
+ SColVal *colValArray = (SColVal *)TARRAY_DATA(colVals);
+
+ ASSERT(numOfColVals > 0);
+ ASSERT(colValArray[0].cid == PRIMARYKEY_TIMESTAMP_COL_ID);
+ ASSERT(colValArray[0].value.type == TSDB_DATA_TYPE_TIMESTAMP);
+
+ *sinfo = (SRowBuildScanInfo){
+ .tupleFixedSize = schema->flen,
+ };
+
+ // loop scan
+ for (int32_t i = 1; i < schema->numOfCols; i++) {
+ for (;;) {
+ if (colValIndex >= numOfColVals) {
+ tRowBuildScanAddNone(sinfo, schema->columns + i);
+ break;
+ }
+
+ if (colValArray[colValIndex].cid == schema->columns[i].colId) {
+ ASSERT(colValArray[colValIndex].value.type == schema->columns[i].type);
+
+ if (COL_VAL_IS_VALUE(&colValArray[colValIndex])) {
+ tRowBuildScanAddValue(sinfo, &colValArray[colValIndex], schema->columns + i);
+ } else if (COL_VAL_IS_NULL(&colValArray[colValIndex])) {
+ tRowBuildScanAddNull(sinfo, schema->columns + i);
+ } else if (COL_VAL_IS_NONE(&colValArray[colValIndex])) {
+ tRowBuildScanAddNone(sinfo, schema->columns + i);
}
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
- pColVal = (++iColVal < nColVal) ? &colVals[iColVal] : NULL;
- } else if (pColVal->cid > pTColumn->colId) { // NONE
- flag |= HAS_NONE;
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
- } else {
- pColVal = (++iColVal < nColVal) ? &colVals[iColVal] : NULL;
+ colValIndex++;
+ break;
+ } else if (colValArray[colValIndex].cid > schema->columns[i].colId) {
+ tRowBuildScanAddNone(sinfo, schema->columns + i);
+ break;
+ } else { // skip useless value
+ colValIndex++;
}
- } else { // NONE
- flag |= HAS_NONE;
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
}
}
- // compare ---------------
- switch (flag) {
+ if (sinfo->numOfNone) {
+ sinfo->flag |= HAS_NONE;
+ }
+ if (sinfo->numOfNull) {
+ sinfo->flag |= HAS_NULL;
+ }
+ if (sinfo->numOfValue) {
+ sinfo->flag |= HAS_VALUE;
+ }
+
+ // Tuple
+ sinfo->tupleFlag = sinfo->flag;
+ switch (sinfo->flag) {
case HAS_NONE:
case HAS_NULL:
- ntp = sizeof(SRow);
+ sinfo->tupleBitmapSize = 0;
+ sinfo->tupleFixedSize = 0;
break;
case HAS_VALUE:
- ntp = sizeof(SRow) + pTSchema->flen + ntp;
+ sinfo->tupleBitmapSize = 0;
+ sinfo->tupleFixedSize = schema->flen;
break;
- case (HAS_NULL | HAS_NONE):
- ntp = sizeof(SRow) + BIT1_SIZE(pTSchema->numOfCols - 1);
+ case (HAS_NONE | HAS_NULL):
+ sinfo->tupleBitmapSize = BIT1_SIZE(schema->numOfCols - 1);
+ sinfo->tupleFixedSize = 0;
break;
- case (HAS_VALUE | HAS_NONE):
- case (HAS_VALUE | HAS_NULL):
- ntp = sizeof(SRow) + BIT1_SIZE(pTSchema->numOfCols - 1) + pTSchema->flen + ntp;
+ case (HAS_NONE | HAS_VALUE):
+ case (HAS_NULL | HAS_VALUE):
+ sinfo->tupleBitmapSize = BIT1_SIZE(schema->numOfCols - 1);
+ sinfo->tupleFixedSize = schema->flen;
break;
- case (HAS_VALUE | HAS_NULL | HAS_NONE):
- ntp = sizeof(SRow) + BIT2_SIZE(pTSchema->numOfCols - 1) + pTSchema->flen + ntp;
+ case (HAS_NONE | HAS_NULL | HAS_VALUE):
+ sinfo->tupleBitmapSize = BIT2_SIZE(schema->numOfCols - 1);
+ sinfo->tupleFixedSize = schema->flen;
break;
- default:
- if (ASSERTS(0, "impossible")) {
- code = TSDB_CODE_INVALID_PARA;
- goto _exit;
+ }
+ for (int32_t i = 0; i < sinfo->numOfPKs; i++) {
+ sinfo->tupleIndices[i].offset += sinfo->tupleBitmapSize;
+ sinfo->tuplePKSize += tPutPrimaryKeyIndex(NULL, sinfo->tupleIndices + i);
+ }
+ sinfo->tupleRowSize = sizeof(SRow) // SRow
+ + sinfo->tuplePKSize // primary keys
+ + sinfo->tupleBitmapSize // bitmap
+ + sinfo->tupleFixedSize // fixed part
+ + sinfo->tupleVarSize; // var part
+
+ // Key-Value
+ if (sinfo->kvMaxOffset <= UINT8_MAX) {
+ sinfo->kvFlag = (KV_FLG_LIT | sinfo->flag);
+ sinfo->kvIndexSize = sizeof(SKVIdx) + (sinfo->numOfNull + sinfo->numOfValue) * sizeof(uint8_t);
+ } else if (sinfo->kvMaxOffset <= UINT16_MAX) {
+ sinfo->kvFlag = (KV_FLG_MID | sinfo->flag);
+ sinfo->kvIndexSize = sizeof(SKVIdx) + (sinfo->numOfNull + sinfo->numOfValue) * sizeof(uint16_t);
+ } else {
+ sinfo->kvFlag = (KV_FLG_BIG | sinfo->flag);
+ sinfo->kvIndexSize = sizeof(SKVIdx) + (sinfo->numOfNull + sinfo->numOfValue) * sizeof(uint32_t);
+ }
+ for (int32_t i = 0; i < sinfo->numOfPKs; i++) {
+ sinfo->kvIndices[i].offset += sinfo->kvIndexSize;
+ sinfo->kvPKSize += tPutPrimaryKeyIndex(NULL, sinfo->kvIndices + i);
+ }
+ sinfo->kvRowSize = sizeof(SRow) // SRow
+ + sinfo->kvPKSize // primary keys
+ + sinfo->kvIndexSize // index array
+ + sinfo->kvPayloadSize; // payload
+
+ return 0;
+}
+
+static int32_t tRowBuildTupleRow(SArray *aColVal, const SRowBuildScanInfo *sinfo, const STSchema *schema,
+ SRow **ppRow) {
+ SColVal *colValArray = (SColVal *)TARRAY_DATA(aColVal);
+
+ *ppRow = (SRow *)taosMemoryCalloc(1, sinfo->tupleRowSize);
+ if (*ppRow == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ (*ppRow)->flag = sinfo->tupleFlag;
+ (*ppRow)->numOfPKs = sinfo->numOfPKs;
+ (*ppRow)->sver = schema->version;
+ (*ppRow)->len = sinfo->tupleRowSize;
+ (*ppRow)->ts = colValArray[0].value.val;
+
+ if (sinfo->tupleFlag == HAS_NONE || sinfo->tupleFlag == HAS_NULL) {
+ ASSERT(sinfo->tupleRowSize == sizeof(SRow));
+ return 0;
+ }
+
+ uint8_t *primaryKeys = (*ppRow)->data;
+ uint8_t *bitmap = primaryKeys + sinfo->tuplePKSize;
+ uint8_t *fixed = bitmap + sinfo->tupleBitmapSize;
+ uint8_t *varlen = fixed + sinfo->tupleFixedSize;
+
+ // primary keys
+ for (int32_t i = 0; i < sinfo->numOfPKs; i++) {
+ primaryKeys += tPutPrimaryKeyIndex(primaryKeys, sinfo->tupleIndices + i);
+ }
+ ASSERT(primaryKeys == bitmap);
+
+ // bitmap + fixed + varlen
+ int32_t numOfColVals = TARRAY_SIZE(aColVal);
+ int32_t colValIndex = 1;
+ for (int32_t i = 1; i < schema->numOfCols; i++) {
+ for (;;) {
+ if (colValIndex >= numOfColVals) { // NONE
+ ROW_SET_BITMAP(bitmap, sinfo->tupleFlag, i - 1, BIT_FLG_NONE);
+ break;
}
- }
- if (maxIdx <= UINT8_MAX) {
- nkv = sizeof(SRow) + sizeof(SKVIdx) + nIdx + nkv;
- flag |= KV_FLG_LIT;
- } else if (maxIdx <= UINT16_MAX) {
- nkv = sizeof(SRow) + sizeof(SKVIdx) + (nIdx << 1) + nkv;
- flag |= KV_FLG_MID;
- } else {
- nkv = sizeof(SRow) + sizeof(SKVIdx) + (nIdx << 2) + nkv;
- flag |= KV_FLG_BIG;
- }
- int32_t nRow;
- if (nkv < ntp) {
- nRow = nkv;
- } else {
- nRow = ntp;
- flag &= ((uint8_t)0x0f);
- }
- // alloc --------------
- pRow = taosMemoryMalloc(nRow);
- if (NULL == pRow) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _exit;
- }
+ if (colValArray[colValIndex].cid == schema->columns[i].colId) {
+ if (COL_VAL_IS_VALUE(&colValArray[colValIndex])) { // value
+ ROW_SET_BITMAP(bitmap, sinfo->tupleFlag, i - 1, BIT_FLG_VALUE);
- // build --------------
- pColVal = &colVals[0];
-
- pRow->flag = flag;
- pRow->rsv = 0;
- pRow->sver = pTSchema->version;
- pRow->len = nRow;
- memcpy(&pRow->ts, &pColVal->value.val, sizeof(TSKEY));
-
- if (flag == HAS_NONE || flag == HAS_NULL) {
- goto _exit;
- }
-
- iColVal = 1;
- pColVal = (iColVal < nColVal) ? &colVals[iColVal] : NULL;
- iTColumn = 1;
- pTColumn = pTSchema->columns + iTColumn;
- if (flag >> 4) { // KV
- SKVIdx *pIdx = (SKVIdx *)pRow->data;
- int32_t iIdx = 0;
- int32_t nv = 0;
- uint8_t *pv = NULL;
- if (flag & KV_FLG_LIT) {
- pv = pIdx->idx + nIdx;
- } else if (flag & KV_FLG_MID) {
- pv = pIdx->idx + (nIdx << 1);
- } else {
- pv = pIdx->idx + (nIdx << 2);
- }
- pIdx->nCol = nIdx;
-
- while (pTColumn) {
- if (pColVal) {
- if (pColVal->cid == pTColumn->colId) {
- if (COL_VAL_IS_VALUE(pColVal)) {
- if (flag & KV_FLG_LIT) {
- ((uint8_t *)pIdx->idx)[iIdx] = (uint8_t)nv;
- } else if (flag & KV_FLG_MID) {
- ((uint16_t *)pIdx->idx)[iIdx] = (uint16_t)nv;
- } else {
- ((uint32_t *)pIdx->idx)[iIdx] = (uint32_t)nv;
+ if (IS_VAR_DATA_TYPE(schema->columns[i].type)) {
+ *(int32_t *)(fixed + schema->columns[i].offset) = varlen - fixed - sinfo->tupleFixedSize;
+ varlen += tPutU32v(varlen, colValArray[colValIndex].value.nData);
+ if (colValArray[colValIndex].value.nData) {
+ memcpy(varlen, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData);
+ varlen += colValArray[colValIndex].value.nData;
}
- iIdx++;
-
- nv += tPutI16v(pv + nv, pTColumn->colId);
- if (IS_VAR_DATA_TYPE(pTColumn->type)) {
- nv += tPutU32v(pv + nv, pColVal->value.nData);
- memcpy(pv + nv, pColVal->value.pData, pColVal->value.nData);
- nv += pColVal->value.nData;
- } else {
- memcpy(pv + nv, &pColVal->value.val, pTColumn->bytes);
- nv += pTColumn->bytes;
- }
- } else if (COL_VAL_IS_NULL(pColVal)) {
- if (flag & KV_FLG_LIT) {
- ((uint8_t *)pIdx->idx)[iIdx] = (uint8_t)nv;
- } else if (flag & KV_FLG_MID) {
- ((uint16_t *)pIdx->idx)[iIdx] = (uint16_t)nv;
- } else {
- ((uint32_t *)pIdx->idx)[iIdx] = (uint32_t)nv;
- }
- iIdx++;
- nv += tPutI16v(pv + nv, -pTColumn->colId);
+ } else {
+ memcpy(fixed + schema->columns[i].offset, &colValArray[colValIndex].value.val,
+ tDataTypes[schema->columns[i].type].bytes);
}
-
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
- pColVal = (++iColVal < nColVal) ? &colVals[iColVal] : NULL;
- } else if (pColVal->cid > pTColumn->colId) { // NONE
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
- } else {
- pColVal = (++iColVal < nColVal) ? &colVals[iColVal] : NULL;
+ } else if (COL_VAL_IS_NULL(&colValArray[colValIndex])) { // NULL
+ ROW_SET_BITMAP(bitmap, sinfo->tupleFlag, i - 1, BIT_FLG_NULL);
+ } else if (COL_VAL_IS_NONE(&colValArray[colValIndex])) { // NONE
+ ROW_SET_BITMAP(bitmap, sinfo->tupleFlag, i - 1, BIT_FLG_NONE);
}
- } else { // NONE
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
- }
- }
- } else { // TUPLE
- uint8_t *pb = NULL;
- uint8_t *pf = NULL;
- uint8_t *pv = NULL;
- int32_t nv = 0;
- switch (flag) {
- case (HAS_NULL | HAS_NONE):
- pb = pRow->data;
+ colValIndex++;
break;
- case HAS_VALUE:
- pf = pRow->data;
- pv = pf + pTSchema->flen;
+ } else if (colValArray[colValIndex].cid > schema->columns[i].colId) { // NONE
+ ROW_SET_BITMAP(bitmap, sinfo->tupleFlag, i - 1, BIT_FLG_NONE);
break;
- case (HAS_VALUE | HAS_NONE):
- case (HAS_VALUE | HAS_NULL):
- pb = pRow->data;
- pf = pb + BIT1_SIZE(pTSchema->numOfCols - 1);
- pv = pf + pTSchema->flen;
- break;
- case (HAS_VALUE | HAS_NULL | HAS_NONE):
- pb = pRow->data;
- pf = pb + BIT2_SIZE(pTSchema->numOfCols - 1);
- pv = pf + pTSchema->flen;
- break;
- default:
- if (ASSERTS(0, "impossible")) {
- code = TSDB_CODE_INVALID_PARA;
- goto _exit;
- }
- }
-
- if (pb) {
- if (flag == (HAS_VALUE | HAS_NULL | HAS_NONE)) {
- memset(pb, 0, BIT2_SIZE(pTSchema->numOfCols - 1));
} else {
- memset(pb, 0, BIT1_SIZE(pTSchema->numOfCols - 1));
- }
- }
-
- // build impl
- while (pTColumn) {
- if (pColVal) {
- if (pColVal->cid == pTColumn->colId) {
- if (COL_VAL_IS_VALUE(pColVal)) { // VALUE
- ROW_SET_BITMAP(pb, flag, iTColumn - 1, BIT_FLG_VALUE);
-
- if (IS_VAR_DATA_TYPE(pTColumn->type)) {
- *(int32_t *)(pf + pTColumn->offset) = nv;
- nv += tPutU32v(pv + nv, pColVal->value.nData);
- if (pColVal->value.nData) {
- memcpy(pv + nv, pColVal->value.pData, pColVal->value.nData);
- nv += pColVal->value.nData;
- }
- } else {
- memcpy(pf + pTColumn->offset, &pColVal->value.val, TYPE_BYTES[pTColumn->type]);
- }
- } else if (COL_VAL_IS_NONE(pColVal)) { // NONE
- ROW_SET_BITMAP(pb, flag, iTColumn - 1, BIT_FLG_NONE);
- if (pf) memset(pf + pTColumn->offset, 0, TYPE_BYTES[pTColumn->type]);
- } else { // NULL
- ROW_SET_BITMAP(pb, flag, iTColumn - 1, BIT_FLG_NULL);
- if (pf) memset(pf + pTColumn->offset, 0, TYPE_BYTES[pTColumn->type]);
- }
-
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
- pColVal = (++iColVal < nColVal) ? &colVals[iColVal] : NULL;
- } else if (pColVal->cid > pTColumn->colId) { // NONE
- ROW_SET_BITMAP(pb, flag, iTColumn - 1, BIT_FLG_NONE);
- if (pf) memset(pf + pTColumn->offset, 0, TYPE_BYTES[pTColumn->type]);
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
- } else {
- pColVal = (++iColVal < nColVal) ? &colVals[iColVal] : NULL;
- }
- } else { // NONE
- ROW_SET_BITMAP(pb, flag, iTColumn - 1, BIT_FLG_NONE);
- if (pf) memset(pf + pTColumn->offset, 0, TYPE_BYTES[pTColumn->type]);
- pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
+ colValIndex++;
}
}
}
-_exit:
- if (code) {
- *ppRow = NULL;
- tRowDestroy(pRow);
+ return 0;
+}
+
+static FORCE_INLINE void tRowBuildKVRowSetIndex(uint8_t flag, SKVIdx *indices, uint32_t offset) {
+ if (flag & KV_FLG_LIT) {
+ ((uint8_t *)indices->idx)[indices->nCol] = (uint8_t)offset;
+ } else if (flag & KV_FLG_MID) {
+ ((uint16_t *)indices->idx)[indices->nCol] = (uint16_t)offset;
} else {
- *ppRow = pRow;
+ ((uint32_t *)indices->idx)[indices->nCol] = (uint32_t)offset;
+ }
+ indices->nCol++;
+}
+
+static int32_t tRowBuildKVRow(SArray *aColVal, const SRowBuildScanInfo *sinfo, const STSchema *schema, SRow **ppRow) {
+ SColVal *colValArray = (SColVal *)TARRAY_DATA(aColVal);
+
+ *ppRow = (SRow *)taosMemoryCalloc(1, sinfo->kvRowSize);
+ if (*ppRow == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ (*ppRow)->flag = sinfo->kvFlag;
+ (*ppRow)->numOfPKs = sinfo->numOfPKs;
+ (*ppRow)->sver = schema->version;
+ (*ppRow)->len = sinfo->kvRowSize;
+ (*ppRow)->ts = colValArray[0].value.val;
+
+ ASSERT(sinfo->flag != HAS_NONE && sinfo->flag != HAS_NULL);
+
+ uint8_t *primaryKeys = (*ppRow)->data;
+ SKVIdx *indices = (SKVIdx *)(primaryKeys + sinfo->kvPKSize);
+ uint8_t *payload = primaryKeys + sinfo->kvPKSize + sinfo->kvIndexSize;
+ uint32_t payloadSize = 0;
+
+ // primary keys
+ for (int32_t i = 0; i < sinfo->numOfPKs; i++) {
+ primaryKeys += tPutPrimaryKeyIndex(primaryKeys, sinfo->kvIndices + i);
+ }
+ ASSERT(primaryKeys == (uint8_t *)indices);
+
+ int32_t numOfColVals = TARRAY_SIZE(aColVal);
+ int32_t colValIndex = 1;
+ for (int32_t i = 1; i < schema->numOfCols; i++) {
+ for (;;) {
+ if (colValIndex >= numOfColVals) { // NONE
+ break;
+ }
+
+ if (colValArray[colValIndex].cid == schema->columns[i].colId) {
+ if (COL_VAL_IS_VALUE(&colValArray[colValIndex])) { // value
+ tRowBuildKVRowSetIndex(sinfo->kvFlag, indices, payloadSize);
+ if (IS_VAR_DATA_TYPE(schema->columns[i].type)) {
+ payloadSize += tPutI16v(payload + payloadSize, colValArray[colValIndex].cid);
+ payloadSize += tPutU32v(payload + payloadSize, colValArray[colValIndex].value.nData);
+ memcpy(payload + payloadSize, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData);
+ payloadSize += colValArray[colValIndex].value.nData;
+ } else {
+ payloadSize += tPutI16v(payload + payloadSize, colValArray[colValIndex].cid);
+ memcpy(payload + payloadSize, &colValArray[colValIndex].value.val,
+ tDataTypes[schema->columns[i].type].bytes);
+ payloadSize += tDataTypes[schema->columns[i].type].bytes;
+ }
+ } else if (COL_VAL_IS_NULL(&colValArray[colValIndex])) { // NULL
+ tRowBuildKVRowSetIndex(sinfo->kvFlag, indices, payloadSize);
+ payloadSize += tPutI16v(payload + payloadSize, -schema->columns[i].colId);
+ }
+
+ colValIndex++;
+ break;
+ } else if (colValArray[colValIndex].cid > schema->columns[i].colId) { // NONE
+ break;
+ } else {
+ colValIndex++;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
+ int32_t code;
+ SRowBuildScanInfo sinfo;
+
+ code = tRowBuildScan(aColVal, pTSchema, &sinfo);
+ if (code) return code;
+
+ if (sinfo.tupleRowSize <= sinfo.kvRowSize) {
+ code = tRowBuildTupleRow(aColVal, &sinfo, pTSchema, ppRow);
+ } else {
+ code = tRowBuildKVRow(aColVal, &sinfo, pTSchema, ppRow);
}
return code;
}
@@ -386,7 +428,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal)
if (iCol == 0) {
pColVal->cid = pTColumn->colId;
- pColVal->type = pTColumn->type;
+ pColVal->value.type = pTColumn->type;
pColVal->flag = CV_FLAG_VALUE;
memcpy(&pColVal->value.val, &pRow->ts, sizeof(TSKEY));
return 0;
@@ -402,9 +444,16 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal)
return 0;
}
+ SPrimaryKeyIndex index;
+ uint8_t *data = pRow->data;
+ for (int32_t i = 0; i < pRow->numOfPKs; i++) {
+ data += tGetPrimaryKeyIndex(data, &index);
+ }
+
if (pRow->flag >> 4) { // KV Row
- SKVIdx *pIdx = (SKVIdx *)pRow->data;
+ SKVIdx *pIdx = (SKVIdx *)data;
uint8_t *pv = NULL;
+
if (pRow->flag & KV_FLG_LIT) {
pv = pIdx->idx + pIdx->nCol;
} else if (pRow->flag & KV_FLG_MID) {
@@ -434,7 +483,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal)
*pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
} else {
pColVal->cid = pTColumn->colId;
- pColVal->type = pTColumn->type;
+ pColVal->value.type = pTColumn->type;
pColVal->flag = CV_FLAG_VALUE;
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
@@ -458,74 +507,45 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal)
*pColVal = COL_VAL_NONE(pTColumn->colId, pTColumn->type);
} else { // Tuple Row
+ uint8_t *bitmap = data;
+ uint8_t *fixed;
+ uint8_t *varlen;
+ uint8_t bit;
+
if (pRow->flag == HAS_VALUE) {
- pColVal->cid = pTColumn->colId;
- pColVal->type = pTColumn->type;
- pColVal->flag = CV_FLAG_VALUE;
- if (IS_VAR_DATA_TYPE(pTColumn->type)) {
- uint8_t *pData = pRow->data + pTSchema->flen + *(int32_t *)(pRow->data + pTColumn->offset);
- pData += tGetU32v(pData, &pColVal->value.nData);
- if (pColVal->value.nData) {
- pColVal->value.pData = pData;
- } else {
- pColVal->value.pData = NULL;
- }
- } else {
- memcpy(&pColVal->value.val, pRow->data + pTColumn->offset, TYPE_BYTES[pTColumn->type]);
- }
+ fixed = bitmap;
+ bit = BIT_FLG_VALUE;
+ } else if (pRow->flag == (HAS_NONE | HAS_NULL | HAS_VALUE)) {
+ fixed = BIT2_SIZE(pTSchema->numOfCols - 1) + bitmap;
+ bit = GET_BIT2(bitmap, iCol - 1);
} else {
- uint8_t *pf;
- uint8_t *pv;
- uint8_t bv = BIT_FLG_VALUE;
+ fixed = BIT1_SIZE(pTSchema->numOfCols - 1) + bitmap;
+ bit = GET_BIT1(bitmap, iCol - 1);
- switch (pRow->flag) {
- case (HAS_NULL | HAS_NONE):
- bv = GET_BIT1(pRow->data, iCol - 1);
- break;
- case (HAS_VALUE | HAS_NONE):
- bv = GET_BIT1(pRow->data, iCol - 1);
- if (bv) bv++;
- pf = pRow->data + BIT1_SIZE(pTSchema->numOfCols - 1);
- pv = pf + pTSchema->flen;
- break;
- case (HAS_VALUE | HAS_NULL):
- bv = GET_BIT1(pRow->data, iCol - 1);
- bv++;
- pf = pRow->data + BIT1_SIZE(pTSchema->numOfCols - 1);
- pv = pf + pTSchema->flen;
- break;
- case (HAS_VALUE | HAS_NULL | HAS_NONE):
- bv = GET_BIT2(pRow->data, iCol - 1);
- pf = pRow->data + BIT2_SIZE(pTSchema->numOfCols - 1);
- pv = pf + pTSchema->flen;
- break;
- default:
- ASSERTS(0, "invalid row format");
- return TSDB_CODE_INVALID_DATA_FMT;
+ if (pRow->flag == (HAS_NONE | HAS_VALUE)) {
+ if (bit) bit++;
+ } else if (pRow->flag == (HAS_NULL | HAS_VALUE)) {
+ bit++;
}
+ }
+ varlen = fixed + pTSchema->flen;
- if (bv == BIT_FLG_NONE) {
- *pColVal = COL_VAL_NONE(pTColumn->colId, pTColumn->type);
- return 0;
- } else if (bv == BIT_FLG_NULL) {
- *pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
- return 0;
- }
+ if (bit == BIT_FLG_NONE) {
+ *pColVal = COL_VAL_NONE(pTColumn->colId, pTColumn->type);
+ return 0;
+ } else if (bit == BIT_FLG_NULL) {
+ *pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
+ return 0;
+ }
- pColVal->cid = pTColumn->colId;
- pColVal->type = pTColumn->type;
- pColVal->flag = CV_FLAG_VALUE;
- if (IS_VAR_DATA_TYPE(pTColumn->type)) {
- uint8_t *pData = pv + *(int32_t *)(pf + pTColumn->offset);
- pData += tGetU32v(pData, &pColVal->value.nData);
- if (pColVal->value.nData) {
- pColVal->value.pData = pData;
- } else {
- pColVal->value.pData = NULL;
- }
- } else {
- memcpy(&pColVal->value.val, pf + pTColumn->offset, TYPE_BYTES[pTColumn->type]);
- }
+ pColVal->cid = pTColumn->colId;
+ pColVal->value.type = pTColumn->type;
+ pColVal->flag = CV_FLAG_VALUE;
+ if (IS_VAR_DATA_TYPE(pTColumn->type)) {
+ pColVal->value.pData = varlen + *(int32_t *)(fixed + pTColumn->offset);
+ pColVal->value.pData += tGetU32v(pColVal->value.pData, &pColVal->value.nData);
+ } else {
+ memcpy(&pColVal->value.val, fixed + pTColumn->offset, TYPE_BYTES[pTColumn->type]);
}
}
@@ -685,9 +705,15 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) {
if (pRow->flag == HAS_NONE || pRow->flag == HAS_NULL) goto _exit;
+ uint8_t *data = pRow->data;
+ SPrimaryKeyIndex index;
+ for (int32_t i = 0; i < pRow->numOfPKs; i++) {
+ data += tGetPrimaryKeyIndex(data, &index);
+ }
+
if (pRow->flag >> 4) {
pIter->iCol = 0;
- pIter->pIdx = (SKVIdx *)pRow->data;
+ pIter->pIdx = (SKVIdx *)data;
if (pRow->flag & KV_FLG_LIT) {
pIter->pv = pIter->pIdx->idx + pIter->pIdx->nCol;
} else if (pRow->flag & KV_FLG_MID) {
@@ -698,21 +724,21 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) {
} else {
switch (pRow->flag) {
case (HAS_NULL | HAS_NONE):
- pIter->pb = pRow->data;
+ pIter->pb = data;
break;
case HAS_VALUE:
- pIter->pf = pRow->data;
+ pIter->pf = data;
pIter->pv = pIter->pf + pTSchema->flen;
break;
case (HAS_VALUE | HAS_NONE):
case (HAS_VALUE | HAS_NULL):
- pIter->pb = pRow->data;
- pIter->pf = pRow->data + BIT1_SIZE(pTSchema->numOfCols - 1);
+ pIter->pb = data;
+ pIter->pf = data + BIT1_SIZE(pTSchema->numOfCols - 1);
pIter->pv = pIter->pf + pTSchema->flen;
break;
case (HAS_VALUE | HAS_NULL | HAS_NONE):
- pIter->pb = pRow->data;
- pIter->pf = pRow->data + BIT2_SIZE(pTSchema->numOfCols - 1);
+ pIter->pb = data;
+ pIter->pf = data + BIT2_SIZE(pTSchema->numOfCols - 1);
pIter->pv = pIter->pf + pTSchema->flen;
break;
default:
@@ -748,7 +774,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
// timestamp
if (0 == pIter->iTColumn) {
pIter->cv.cid = pTColumn->colId;
- pIter->cv.type = pTColumn->type;
+ pIter->cv.value.type = pTColumn->type;
pIter->cv.flag = CV_FLAG_VALUE;
memcpy(&pIter->cv.value.val, &pIter->pRow->ts, sizeof(TSKEY));
goto _exit;
@@ -784,7 +810,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
pIter->cv = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
} else {
pIter->cv.cid = pTColumn->colId;
- pIter->cv.type = pTColumn->type;
+ pIter->cv.value.type = pTColumn->type;
pIter->cv.flag = CV_FLAG_VALUE;
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
@@ -843,7 +869,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
}
pIter->cv.cid = pTColumn->colId;
- pIter->cv.type = pTColumn->type;
+ pIter->cv.value.type = pTColumn->type;
pIter->cv.flag = CV_FLAG_VALUE;
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
uint8_t *pData = pIter->pv + *(int32_t *)(pIter->pf + pTColumn->offset);
@@ -920,24 +946,29 @@ static int32_t tRowTupleUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *
int32_t iTColumn = 1;
STColumn *pTColumn = &pTSchema->columns[iTColumn];
- uint8_t *pb = NULL, *pf = NULL, *pv = NULL;
+ uint8_t *pb = NULL, *pf = NULL, *pv = NULL;
+ SPrimaryKeyIndex index;
+ uint8_t *data = pRow->data;
+ for (int32_t i = 0; i < pRow->numOfPKs; i++) {
+ data += tGetPrimaryKeyIndex(data, &index);
+ }
switch (pRow->flag) {
case HAS_VALUE:
- pf = pRow->data;
+ pf = data; // TODO: fix here
pv = pf + pTSchema->flen;
break;
case (HAS_NULL | HAS_NONE):
- pb = pRow->data;
+ pb = data;
break;
case (HAS_VALUE | HAS_NONE):
case (HAS_VALUE | HAS_NULL):
- pb = pRow->data;
+ pb = data;
pf = pb + BIT1_SIZE(pTSchema->numOfCols - 1);
pv = pf + pTSchema->flen;
break;
case (HAS_VALUE | HAS_NULL | HAS_NONE):
- pb = pRow->data;
+ pb = data;
pf = pb + BIT2_SIZE(pTSchema->numOfCols - 1);
pv = pf + pTSchema->flen;
break;
@@ -1135,6 +1166,124 @@ int32_t tRowUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, in
}
}
+void tRowGetKey(SRow *row, SRowKey *key) {
+ key->ts = row->ts;
+ key->numOfPKs = row->numOfPKs;
+
+ if (key->numOfPKs == 0) {
+ return;
+ }
+
+ ASSERT(row->numOfPKs <= TD_MAX_PK_COLS);
+
+ SPrimaryKeyIndex indices[TD_MAX_PK_COLS];
+
+ uint8_t *data = row->data;
+
+ for (int32_t i = 0; i < row->numOfPKs; i++) {
+ data += tGetPrimaryKeyIndex(data, &indices[i]);
+ }
+
+ // primary keys
+ for (int32_t i = 0; i < row->numOfPKs; i++) {
+ key->pks[i].type = indices[i].type;
+
+ if (IS_VAR_DATA_TYPE(indices[i].type)) {
+ key->pks[i].pData = data + indices[i].offset;
+ key->pks[i].pData += tGetU32v(key->pks[i].pData, &key->pks[i].nData);
+ } else {
+ memcpy(&key->pks[i].val, data + indices[i].offset, tDataTypes[indices[i].type].bytes);
+ }
+ }
+}
+
+#define T_COMPARE_SCALAR_VALUE(TYPE, V1, V2) \
+ do { \
+ if (*(TYPE *)(V1) < *(TYPE *)(V2)) { \
+ return -1; \
+ } else if (*(TYPE *)(V1) > *(TYPE *)(V2)) { \
+ return 1; \
+ } else { \
+ return 0; \
+ } \
+ } while (0)
+
+int32_t tValueCompare(const SValue *tv1, const SValue *tv2) {
+ ASSERT(tv1->type == tv2->type);
+
+ switch (tv1->type) {
+ case TSDB_DATA_TYPE_BOOL:
+ case TSDB_DATA_TYPE_TINYINT:
+ T_COMPARE_SCALAR_VALUE(int8_t, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_SMALLINT:
+ T_COMPARE_SCALAR_VALUE(int16_t, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_INT:
+ T_COMPARE_SCALAR_VALUE(int32_t, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_BIGINT:
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ T_COMPARE_SCALAR_VALUE(int64_t, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_FLOAT:
+ T_COMPARE_SCALAR_VALUE(float, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_DOUBLE:
+ T_COMPARE_SCALAR_VALUE(double, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_UTINYINT:
+ T_COMPARE_SCALAR_VALUE(uint8_t, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_USMALLINT:
+ T_COMPARE_SCALAR_VALUE(uint16_t, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_UINT:
+ T_COMPARE_SCALAR_VALUE(uint32_t, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_UBIGINT:
+ T_COMPARE_SCALAR_VALUE(uint64_t, &tv1->val, &tv2->val);
+ case TSDB_DATA_TYPE_GEOMETRY:
+ case TSDB_DATA_TYPE_BINARY: {
+ return strcmp((const char *)tv1->pData, (const char *)tv2->pData);
+ }
+ case TSDB_DATA_TYPE_NCHAR: {
+ int32_t ret = tasoUcs4Compare((TdUcs4 *)tv1->pData, (TdUcs4 *)tv2->pData,
+ tv1->nData < tv2->nData ? tv1->nData : tv2->nData);
+ return ret ? ret : (tv1->nData < tv2->nData ? -1 : (tv1->nData > tv2->nData ? 1 : 0));
+ }
+ case TSDB_DATA_TYPE_VARBINARY: {
+ int32_t ret = memcmp(tv1->pData, tv2->pData, tv1->nData < tv2->nData ? tv1->nData : tv2->nData);
+ return ret ? ret : (tv1->nData < tv2->nData ? -1 : (tv1->nData > tv2->nData ? 1 : 0));
+ }
+ case TSDB_DATA_TYPE_DECIMAL:
+ ASSERT(0);
+ break;
+ default:
+ ASSERT(0);
+ }
+
+ return 0;
+}
+
+// NOTE:
+// set key->numOfPKs to 0 as the smallest key with ts
+// set key->numOfPKs to (TD_MAX_PK_COLS + 1) as the largest key with ts
+int32_t tRowKeyCompare(const void *p1, const void *p2) {
+ SRowKey *key1 = (SRowKey *)p1;
+ SRowKey *key2 = (SRowKey *)p2;
+
+ if (key1->ts < key2->ts) {
+ return -1;
+ } else if (key1->ts > key2->ts) {
+ return 1;
+ }
+
+ if (key1->numOfPKs == key2->numOfPKs) {
+ for (uint8_t iKey = 0; iKey < key1->numOfPKs; iKey++) {
+ int32_t ret = tValueCompare(&key1->pks[iKey], &key2->pks[iKey]);
+ if (ret) return ret;
+ }
+ } else if (key1->numOfPKs < key2->numOfPKs) {
+ return -1;
+ } else {
+ return 1;
+ }
+
+ return 0;
+}
+
// STag ========================================
static int tTagValCmprFn(const void *p1, const void *p2) {
if (((STagVal *)p1)->cid < ((STagVal *)p2)->cid) {
@@ -1563,6 +1712,24 @@ STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version) {
return pTSchema;
}
+static int32_t tTColumnCompare(const void *p1, const void *p2) {
+ if (((STColumn *)p1)->colId < ((STColumn *)p2)->colId) {
+ return -1;
+ } else if (((STColumn *)p1)->colId > ((STColumn *)p2)->colId) {
+ return 1;
+ }
+
+ return 0;
+}
+
+const STColumn *tTSchemaSearchColumn(const STSchema *pTSchema, int16_t cid) {
+ STColumn tcol = {
+ .colId = cid,
+ };
+
+ return taosbsearch(&tcol, pTSchema->columns, pTSchema->numOfCols, sizeof(STColumn), tTColumnCompare, TD_EQ);
+}
+
// SColData ========================================
void tColDataDestroy(void *ph) {
if (ph) {
@@ -1574,10 +1741,10 @@ void tColDataDestroy(void *ph) {
}
}
-void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn) {
+void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t cflag) {
pColData->cid = cid;
pColData->type = type;
- pColData->smaOn = smaOn;
+ pColData->cflag = cflag;
tColDataClear(pColData);
}
@@ -1962,7 +2129,7 @@ static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, uint8_t *pDa
// VALUE NONE NULL
};
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) {
- ASSERT(pColData->cid == pColVal->cid && pColData->type == pColVal->type);
+ ASSERT(pColData->cid == pColVal->cid && pColData->type == pColVal->value.type);
return tColDataAppendValueImpl[pColData->flag][pColVal->flag](
pColData, IS_VAR_DATA_TYPE(pColData->type) ? pColVal->value.pData : (uint8_t *)&pColVal->value.val,
pColVal->value.nData);
@@ -2272,7 +2439,7 @@ static int32_t (*tColDataUpdateValueImpl[8][3])(SColData *pColData, uint8_t *pDa
// VALUE NONE NULL
};
int32_t tColDataUpdateValue(SColData *pColData, SColVal *pColVal, bool forward) {
- ASSERT(pColData->cid == pColVal->cid && pColData->type == pColVal->type);
+ ASSERT(pColData->cid == pColVal->cid && pColData->type == pColVal->value.type);
ASSERT(pColData->nVal > 0);
if (tColDataUpdateValueImpl[pColData->flag][pColVal->flag] == NULL) return 0;
@@ -2302,7 +2469,7 @@ static FORCE_INLINE void tColDataGetValue3(SColData *pColData, int32_t iVal,
}
}
static FORCE_INLINE void tColDataGetValue4(SColData *pColData, int32_t iVal, SColVal *pColVal) { // HAS_VALUE
- SValue value;
+ SValue value = {.type = pColData->type};
if (IS_VAR_DATA_TYPE(pColData->type)) {
if (iVal + 1 < pColData->nVal) {
value.nData = pColData->aOffset[iVal + 1] - pColData->aOffset[iVal];
@@ -2313,7 +2480,7 @@ static FORCE_INLINE void tColDataGetValue4(SColData *pColData, int32_t iVal, SCo
} else {
memcpy(&value.val, pColData->pData + tDataTypes[pColData->type].bytes * iVal, tDataTypes[pColData->type].bytes);
}
- *pColVal = COL_VAL_VALUE(pColData->cid, pColData->type, value);
+ *pColVal = COL_VAL_VALUE(pColData->cid, value);
}
static FORCE_INLINE void tColDataGetValue5(SColData *pColData, int32_t iVal,
SColVal *pColVal) { // HAS_VALUE|HAS_NONE
@@ -2453,6 +2620,226 @@ _exit:
return code;
}
+int32_t tColDataCompress(SColData *colData, SColDataCompressInfo *info, SBuffer *output, SBuffer *assist) {
+ int32_t code;
+ SBuffer local;
+
+ ASSERT(colData->nVal > 0);
+
+ (*info) = (SColDataCompressInfo){
+ .cmprAlg = info->cmprAlg,
+ .columnFlag = colData->cflag,
+ .flag = colData->flag,
+ .dataType = colData->type,
+ .columnId = colData->cid,
+ .numOfData = colData->nVal,
+ };
+
+ if (colData->flag == HAS_NONE || colData->flag == HAS_NULL) {
+ return 0;
+ }
+
+ tBufferInit(&local);
+ if (assist == NULL) {
+ assist = &local;
+ }
+
+ // bitmap
+ if (colData->flag != HAS_VALUE) {
+ if (colData->flag == (HAS_NONE | HAS_NULL | HAS_VALUE)) {
+ info->bitmapOriginalSize = BIT2_SIZE(colData->nVal);
+ } else {
+ info->bitmapOriginalSize = BIT1_SIZE(colData->nVal);
+ }
+
+ SCompressInfo cinfo = {
+ .dataType = TSDB_DATA_TYPE_TINYINT,
+ .cmprAlg = info->cmprAlg,
+ .originalSize = info->bitmapOriginalSize,
+ };
+
+ code = tCompressDataToBuffer(colData->pBitMap, &cinfo, output, assist);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ info->bitmapCompressedSize = cinfo.compressedSize;
+ }
+
+ if (colData->flag == (HAS_NONE | HAS_NULL)) {
+ tBufferDestroy(&local);
+ return 0;
+ }
+
+ // offset
+ if (IS_VAR_DATA_TYPE(colData->type)) {
+ info->offsetOriginalSize = sizeof(int32_t) * info->numOfData;
+
+ SCompressInfo cinfo = {
+ .dataType = TSDB_DATA_TYPE_INT,
+ .cmprAlg = info->cmprAlg,
+ .originalSize = info->offsetOriginalSize,
+ };
+
+ code = tCompressDataToBuffer(colData->aOffset, &cinfo, output, assist);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ info->offsetCompressedSize = cinfo.compressedSize;
+ }
+
+ // data
+ if (colData->nData > 0) {
+ info->dataOriginalSize = colData->nData;
+
+ SCompressInfo cinfo = {
+ .dataType = colData->type,
+ .cmprAlg = info->cmprAlg,
+ .originalSize = info->dataOriginalSize,
+ };
+
+ code = tCompressDataToBuffer(colData->pData, &cinfo, output, assist);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ info->dataCompressedSize = cinfo.compressedSize;
+ }
+
+ tBufferDestroy(&local);
+ return 0;
+}
+
+int32_t tColDataDecompress(void *input, SColDataCompressInfo *info, SColData *colData, SBuffer *assist) {
+ int32_t code;
+ SBuffer local;
+ uint8_t *data = (uint8_t *)input;
+
+ tBufferInit(&local);
+ if (assist == NULL) {
+ assist = &local;
+ }
+
+ tColDataClear(colData);
+ colData->cid = info->columnId;
+ colData->type = info->dataType;
+ colData->cflag = info->columnFlag;
+ colData->nVal = info->numOfData;
+ colData->flag = info->flag;
+
+ if (info->flag == HAS_NONE || info->flag == HAS_NULL) {
+ goto _exit;
+ }
+
+ // bitmap
+ if (info->bitmapOriginalSize > 0) {
+ SCompressInfo cinfo = {
+ .dataType = TSDB_DATA_TYPE_TINYINT,
+ .cmprAlg = info->cmprAlg,
+ .originalSize = info->bitmapOriginalSize,
+ .compressedSize = info->bitmapCompressedSize,
+ };
+
+ code = tRealloc(&colData->pBitMap, cinfo.originalSize);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ code = tDecompressData(data, &cinfo, colData->pBitMap, cinfo.originalSize, assist);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ data += cinfo.compressedSize;
+ }
+
+ if (info->flag == (HAS_NONE | HAS_NULL)) {
+ goto _exit;
+ }
+
+ // offset
+ if (info->offsetOriginalSize > 0) {
+ SCompressInfo cinfo = {
+ .cmprAlg = info->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_INT,
+ .originalSize = info->offsetOriginalSize,
+ .compressedSize = info->offsetCompressedSize,
+ };
+
+ code = tRealloc((uint8_t **)&colData->aOffset, cinfo.originalSize);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ code = tDecompressData(data, &cinfo, colData->aOffset, cinfo.originalSize, assist);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ data += cinfo.compressedSize;
+ }
+
+ // data
+ if (info->dataOriginalSize > 0) {
+ colData->nData = info->dataOriginalSize;
+
+ SCompressInfo cinfo = {
+ .cmprAlg = info->cmprAlg,
+ .dataType = colData->type,
+ .originalSize = info->dataOriginalSize,
+ .compressedSize = info->dataCompressedSize,
+ };
+
+ code = tRealloc((uint8_t **)&colData->pData, cinfo.originalSize);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ code = tDecompressData(data, &cinfo, colData->pData, cinfo.originalSize, assist);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+
+ data += cinfo.compressedSize;
+ }
+
+_exit:
+ switch (colData->flag) {
+ case HAS_NONE:
+ colData->numOfNone = colData->nVal;
+ break;
+ case HAS_NULL:
+ colData->numOfNull = colData->nVal;
+ break;
+ case HAS_VALUE:
+ colData->numOfValue = colData->nVal;
+ break;
+ default:
+ for (int32_t i = 0; i < colData->nVal; i++) {
+ uint8_t bitValue = tColDataGetBitValue(colData, i);
+ if (bitValue == 0) {
+ colData->numOfNone++;
+ } else if (bitValue == 1) {
+ colData->numOfNull++;
+ } else {
+ colData->numOfValue++;
+ }
+ }
+ }
+ tBufferDestroy(&local);
+ return 0;
+}
+
int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap,
char *data) {
int32_t code = 0;
@@ -2756,7 +3143,7 @@ static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t
if (end > start) {
aDstColData = taosMemoryCalloc(1, sizeof(SColData) * nColData);
for (int c = 0; c < nColData; ++c) {
- tColDataInit(&aDstColData[c], aColData[c].cid, aColData[c].type, aColData[c].smaOn);
+ tColDataInit(&aDstColData[c], aColData[c].cid, aColData[c].type, aColData[c].cflag);
}
if (aDstColData == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
@@ -3602,3 +3989,361 @@ void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_
NULL, // TSDB_DATA_TYPE_MEDIUMBLOB
tColDataCalcSMAVarType // TSDB_DATA_TYPE_GEOMETRY
};
+
+// SValueColumn ================================
+int32_t tValueColumnInit(SValueColumn *valCol) {
+ valCol->type = TSDB_DATA_TYPE_NULL;
+ valCol->numOfValues = 0;
+ tBufferInit(&valCol->data);
+ tBufferInit(&valCol->offsets);
+ return 0;
+}
+
+int32_t tValueColumnDestroy(SValueColumn *valCol) {
+ valCol->type = TSDB_DATA_TYPE_NULL;
+ valCol->numOfValues = 0;
+ tBufferDestroy(&valCol->data);
+ tBufferDestroy(&valCol->offsets);
+ return 0;
+}
+
+int32_t tValueColumnClear(SValueColumn *valCol) {
+ valCol->type = TSDB_DATA_TYPE_NULL;
+ valCol->numOfValues = 0;
+ tBufferClear(&valCol->data);
+ tBufferClear(&valCol->offsets);
+ return 0;
+}
+
+int32_t tValueColumnAppend(SValueColumn *valCol, const SValue *value) {
+ int32_t code;
+
+ if (valCol->numOfValues == 0) {
+ valCol->type = value->type;
+ }
+
+ ASSERT(value->type == valCol->type);
+
+ if (IS_VAR_DATA_TYPE(value->type)) {
+ if ((code = tBufferPutI32(&valCol->offsets, tBufferGetSize(&valCol->data)))) {
+ return code;
+ }
+ if ((code = tBufferPut(&valCol->data, value->pData, value->nData))) {
+ return code;
+ }
+ } else {
+ code = tBufferPut(&valCol->data, &value->val, tDataTypes[value->type].bytes);
+ if (code) return code;
+ }
+ valCol->numOfValues++;
+
+ return 0;
+}
+
+int32_t tValueColumnUpdate(SValueColumn *valCol, int32_t idx, const SValue *value) {
+ int32_t code;
+
+ if (idx < 0 || idx >= valCol->numOfValues) {
+ return TSDB_CODE_OUT_OF_RANGE;
+ }
+
+ if (IS_VAR_DATA_TYPE(valCol->type)) {
+ int32_t *offsets = (int32_t *)tBufferGetData(&valCol->offsets);
+ int32_t nextOffset = (idx == valCol->numOfValues - 1) ? tBufferGetSize(&valCol->data) : offsets[idx + 1];
+ int32_t oldDataSize = nextOffset - offsets[idx];
+ int32_t bytesAdded = value->nData - oldDataSize;
+
+ if (bytesAdded != 0) {
+ if ((code = tBufferEnsureCapacity(&valCol->data, tBufferGetSize(&valCol->data) + bytesAdded))) return code;
+ memmove(tBufferGetDataAt(&valCol->data, nextOffset + bytesAdded), tBufferGetDataAt(&valCol->data, nextOffset),
+ tBufferGetSize(&valCol->data) - nextOffset);
+ valCol->data.size += bytesAdded;
+
+ for (int32_t i = idx + 1; i < valCol->numOfValues; i++) {
+ offsets[i] += bytesAdded;
+ }
+ }
+ return tBufferPutAt(&valCol->data, offsets[idx], value->pData, value->nData);
+ } else {
+ return tBufferPutAt(&valCol->data, idx * tDataTypes[valCol->type].bytes, &value->val,
+ tDataTypes[valCol->type].bytes);
+ }
+ return 0;
+}
+
+int32_t tValueColumnGet(SValueColumn *valCol, int32_t idx, SValue *value) {
+ if (idx < 0 || idx >= valCol->numOfValues) {
+ return TSDB_CODE_OUT_OF_RANGE;
+ }
+
+ value->type = valCol->type;
+ if (IS_VAR_DATA_TYPE(value->type)) {
+ int32_t offset, nextOffset;
+ SBufferReader reader = BUFFER_READER_INITIALIZER(idx * sizeof(offset), &valCol->offsets);
+
+ tBufferGetI32(&reader, &offset);
+ if (idx == valCol->numOfValues - 1) {
+ nextOffset = tBufferGetSize(&valCol->data);
+ } else {
+ tBufferGetI32(&reader, &nextOffset);
+ }
+ value->nData = nextOffset - offset;
+ value->pData = (uint8_t *)tBufferGetDataAt(&valCol->data, offset);
+ } else {
+ SBufferReader reader = BUFFER_READER_INITIALIZER(idx * tDataTypes[value->type].bytes, &valCol->data);
+ tBufferGet(&reader, tDataTypes[value->type].bytes, &value->val);
+ }
+ return 0;
+}
+
+int32_t tValueColumnCompress(SValueColumn *valCol, SValueColumnCompressInfo *info, SBuffer *output, SBuffer *assist) {
+ int32_t code;
+
+ ASSERT(valCol->numOfValues > 0);
+
+ (*info) = (SValueColumnCompressInfo){
+ .cmprAlg = info->cmprAlg,
+ .type = valCol->type,
+ };
+
+ // offset
+ if (IS_VAR_DATA_TYPE(valCol->type)) {
+ SCompressInfo cinfo = {
+ .cmprAlg = info->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_INT,
+ .originalSize = valCol->offsets.size,
+ };
+
+ code = tCompressDataToBuffer(valCol->offsets.data, &cinfo, output, assist);
+ if (code) return code;
+
+ info->offsetOriginalSize = cinfo.originalSize;
+ info->offsetCompressedSize = cinfo.compressedSize;
+ }
+
+ // data
+ SCompressInfo cinfo = {
+ .cmprAlg = info->cmprAlg,
+ .dataType = valCol->type,
+ .originalSize = valCol->data.size,
+ };
+
+ code = tCompressDataToBuffer(valCol->data.data, &cinfo, output, assist);
+ if (code) return code;
+
+ info->dataOriginalSize = cinfo.originalSize;
+ info->dataCompressedSize = cinfo.compressedSize;
+
+ return 0;
+}
+
+int32_t tValueColumnDecompress(void *input, const SValueColumnCompressInfo *info, SValueColumn *valCol,
+ SBuffer *assist) {
+ int32_t code;
+
+ tValueColumnClear(valCol);
+ valCol->type = info->type;
+ // offset
+ if (IS_VAR_DATA_TYPE(valCol->type)) {
+ valCol->numOfValues = info->offsetOriginalSize / tDataTypes[TSDB_DATA_TYPE_INT].bytes;
+
+ SCompressInfo cinfo = {
+ .dataType = TSDB_DATA_TYPE_INT,
+ .cmprAlg = info->cmprAlg,
+ .originalSize = info->offsetOriginalSize,
+ .compressedSize = info->offsetCompressedSize,
+ };
+
+ code = tDecompressDataToBuffer(input, &cinfo, &valCol->offsets, assist);
+ if (code) {
+ return code;
+ }
+ } else {
+ valCol->numOfValues = info->dataOriginalSize / tDataTypes[valCol->type].bytes;
+ }
+
+ // data
+ SCompressInfo cinfo = {
+ .dataType = valCol->type,
+ .cmprAlg = info->cmprAlg,
+ .originalSize = info->dataOriginalSize,
+ .compressedSize = info->dataCompressedSize,
+ };
+
+ code = tDecompressDataToBuffer((char *)input + info->offsetCompressedSize, &cinfo, &valCol->data, assist);
+ if (code) {
+ return code;
+ }
+
+ return 0;
+}
+
+int32_t tValueColumnCompressInfoEncode(const SValueColumnCompressInfo *info, SBuffer *buffer) {
+ int32_t code;
+ uint8_t fmtVer = 0;
+
+ if ((code = tBufferPutU8(buffer, fmtVer))) return code;
+ if ((code = tBufferPutI8(buffer, info->cmprAlg))) return code;
+ if ((code = tBufferPutI8(buffer, info->type))) return code;
+ if (IS_VAR_DATA_TYPE(info->type)) {
+ if ((code = tBufferPutI32v(buffer, info->offsetOriginalSize))) return code;
+ if ((code = tBufferPutI32v(buffer, info->offsetCompressedSize))) return code;
+ }
+ if ((code = tBufferPutI32v(buffer, info->dataOriginalSize))) return code;
+ if ((code = tBufferPutI32v(buffer, info->dataCompressedSize))) return code;
+
+ return 0;
+}
+
+int32_t tValueColumnCompressInfoDecode(SBufferReader *reader, SValueColumnCompressInfo *info) {
+ int32_t code;
+ uint8_t fmtVer;
+
+ if ((code = tBufferGetU8(reader, &fmtVer))) return code;
+ if (fmtVer == 0) {
+ if ((code = tBufferGetI8(reader, &info->cmprAlg))) return code;
+ if ((code = tBufferGetI8(reader, &info->type))) return code;
+ if (IS_VAR_DATA_TYPE(info->type)) {
+ if ((code = tBufferGetI32v(reader, &info->offsetOriginalSize))) return code;
+ if ((code = tBufferGetI32v(reader, &info->offsetCompressedSize))) return code;
+ } else {
+ info->offsetOriginalSize = 0;
+ info->offsetCompressedSize = 0;
+ }
+ if ((code = tBufferGetI32v(reader, &info->dataOriginalSize))) return code;
+ if ((code = tBufferGetI32v(reader, &info->dataCompressedSize))) return code;
+ } else {
+ ASSERT(0);
+ }
+
+ return 0;
+}
+
+int32_t tCompressData(void *input, // input
+ SCompressInfo *info, // compress info
+ void *output, // output
+ int32_t outputSize, // output size
+ SBuffer *buffer // assistant buffer provided by caller, can be NULL
+) {
+ int32_t extraSizeNeeded;
+ int32_t code;
+
+ extraSizeNeeded = (info->cmprAlg == NO_COMPRESSION) ? info->originalSize : info->originalSize + COMP_OVERFLOW_BYTES;
+ ASSERT(outputSize >= extraSizeNeeded);
+
+ if (info->cmprAlg == NO_COMPRESSION) {
+ memcpy(output, input, info->originalSize);
+ info->compressedSize = info->originalSize;
+ } else {
+ SBuffer local;
+
+ tBufferInit(&local);
+ if (buffer == NULL) {
+ buffer = &local;
+ }
+
+ if (info->cmprAlg == TWO_STAGE_COMP) {
+ code = tBufferEnsureCapacity(buffer, extraSizeNeeded);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+ }
+
+ info->compressedSize = tDataTypes[info->dataType].compFunc( //
+ input, // input
+ info->originalSize, // input size
+ info->originalSize / tDataTypes[info->dataType].bytes, // number of elements
+ output, // output
+ outputSize, // output size
+ info->cmprAlg, // compression algorithm
+ buffer->data, // buffer
+ buffer->capacity // buffer size
+ );
+ if (info->compressedSize < 0) {
+ tBufferDestroy(&local);
+ return TSDB_CODE_COMPRESS_ERROR;
+ }
+
+ tBufferDestroy(&local);
+ }
+
+ return 0;
+}
+
+int32_t tDecompressData(void *input, // input
+ const SCompressInfo *info, // compress info
+ void *output, // output
+ int32_t outputSize, // output size
+ SBuffer *buffer // assistant buffer provided by caller, can be NULL
+) {
+ int32_t code;
+
+ ASSERT(outputSize >= info->originalSize);
+
+ if (info->cmprAlg == NO_COMPRESSION) {
+ ASSERT(info->compressedSize == info->originalSize);
+ memcpy(output, input, info->compressedSize);
+ } else {
+ SBuffer local;
+
+ tBufferInit(&local);
+ if (buffer == NULL) {
+ buffer = &local;
+ }
+
+ if (info->cmprAlg == TWO_STAGE_COMP) {
+ code = tBufferEnsureCapacity(buffer, info->originalSize + COMP_OVERFLOW_BYTES);
+ if (code) {
+ tBufferDestroy(&local);
+ return code;
+ }
+ }
+
+ int32_t decompressedSize = tDataTypes[info->dataType].decompFunc(
+ input, // input
+ info->compressedSize, // inputSize
+ info->originalSize / tDataTypes[info->dataType].bytes, // number of elements
+ output, // output
+ outputSize, // output size
+ info->cmprAlg, // compression algorithm
+ buffer->data, // helper buffer
+ buffer->capacity // extra buffer size
+ );
+ if (decompressedSize < 0) {
+ tBufferDestroy(&local);
+ return TSDB_CODE_COMPRESS_ERROR;
+ }
+
+ ASSERT(decompressedSize == info->originalSize);
+ tBufferDestroy(&local);
+ }
+
+ return 0;
+}
+
+int32_t tCompressDataToBuffer(void *input, SCompressInfo *info, SBuffer *output, SBuffer *assist) {
+ int32_t code;
+
+ code = tBufferEnsureCapacity(output, output->size + info->originalSize + COMP_OVERFLOW_BYTES);
+ if (code) return code;
+
+ code = tCompressData(input, info, tBufferGetDataEnd(output), output->capacity - output->size, assist);
+ if (code) return code;
+
+ output->size += info->compressedSize;
+ return 0;
+}
+
+int32_t tDecompressDataToBuffer(void *input, SCompressInfo *info, SBuffer *output, SBuffer *assist) {
+ int32_t code;
+
+ code = tBufferEnsureCapacity(output, output->size + info->originalSize);
+ if (code) return code;
+
+ code = tDecompressData(input, info, tBufferGetDataEnd(output), output->capacity - output->size, assist);
+ if (code) return code;
+
+ output->size += info->originalSize;
+ return 0;
+}
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index 5c51d83e4d..c0a2060907 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -58,7 +58,7 @@ int32_t tsNumOfMnodeQueryThreads = 4;
int32_t tsNumOfMnodeFetchThreads = 1;
int32_t tsNumOfMnodeReadThreads = 1;
int32_t tsNumOfVnodeQueryThreads = 4;
-float tsRatioOfVnodeStreamThreads = 1.5F;
+float tsRatioOfVnodeStreamThreads = 0.5F;
int32_t tsNumOfVnodeFetchThreads = 4;
int32_t tsNumOfVnodeRsmaThreads = 2;
int32_t tsNumOfQnodeQueryThreads = 4;
@@ -269,7 +269,6 @@ int64_t tsStreamBufferSize = 128 * 1024 * 1024;
bool tsFilterScalarMode = false;
int tsResolveFQDNRetryTime = 100; // seconds
int tsStreamAggCnt = 1000;
-bool tsDisableCount = true;
char tsS3Endpoint[TSDB_FQDN_LEN] = "";
char tsS3AccessKey[TSDB_FQDN_LEN] = "";
@@ -503,7 +502,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0)
return -1;
if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1;
- if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1;
+ if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0) return -1;
if (cfgAddInt64(pCfg, "queryMaxConcurrentTables", tsQueryMaxConcurrentTables, INT64_MIN, INT64_MAX, CFG_SCOPE_CLIENT,
CFG_DYN_NONE) != 0)
return -1;
@@ -539,10 +538,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
return -1;
if (cfgAddBool(pCfg, "experimental", tsExperimental, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
- if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1;
- if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
-
- if (cfgAddBool(pCfg, "disableCount", tsDisableCount, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1;
+ if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
+ if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
return 0;
}
@@ -589,7 +586,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
tsNumOfSupportVnodes = tsNumOfCores * 2;
tsNumOfSupportVnodes = TMAX(tsNumOfSupportVnodes, 2);
- if (cfgAddInt32(pCfg, "supportVnodes", tsNumOfSupportVnodes, 0, 4096, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
+ if (cfgAddInt32(pCfg, "supportVnodes", tsNumOfSupportVnodes, 0, 4096, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1;
if (cfgAddInt32(pCfg, "statusInterval", tsStatusInterval, 1, 30, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
if (cfgAddInt32(pCfg, "minSlidingTime", tsMinSlidingTime, 1, 1000000, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0)
@@ -603,18 +600,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
return -1;
if (cfgAddInt32(pCfg, "queryRspPolicy", tsQueryRspPolicy, 0, 1, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1;
- tsNumOfRpcThreads = tsNumOfCores / 2;
- tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
- if (cfgAddInt32(pCfg, "numOfRpcThreads", tsNumOfRpcThreads, 1, 1024, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
-
- tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 10000);
- if (cfgAddInt32(pCfg, "numOfRpcSessions", tsNumOfRpcSessions, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0)
- return -1;
-
- tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 1000000);
- if (cfgAddInt32(pCfg, "timeToGetAvailableConn", tsNumOfRpcSessions, 20, 1000000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0)
- return -1;
-
tsNumOfCommitThreads = tsNumOfCores / 2;
tsNumOfCommitThreads = TRANGE(tsNumOfCommitThreads, 2, 4);
if (cfgAddInt32(pCfg, "numOfCommitThreads", tsNumOfCommitThreads, 1, 1024, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0)
@@ -694,9 +679,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "grantMode", tsMndGrantMode, 0, 10000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
if (cfgAddBool(pCfg, "skipGrant", tsMndSkipGrant, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
- if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1;
- if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0)
- return -1;
if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
if (cfgAddInt32(pCfg, "monitorPort", tsMonitorPort, 1, 65056, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
if (cfgAddInt32(pCfg, "monitorMaxLogs", tsMonitorMaxLogs, 1, 1000000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
@@ -710,7 +692,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddBool(pCfg, "auditCreateTable", tsEnableAuditCreateTable, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
if (cfgAddInt32(pCfg, "auditInterval", tsAuditInterval, 500, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
- if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
if (cfgAddBool(pCfg, "telemetryReporting", tsEnableTelem, CFG_SCOPE_BOTH, CFG_DYN_ENT_SERVER) != 0) return -1;
if (cfgAddInt32(pCfg, "telemetryInterval", tsTelemInterval, 1, 200000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
if (cfgAddString(pCfg, "telemetryServer", tsTelemServer, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
@@ -817,8 +798,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
return -1;
if (cfgAddBool(pCfg, "enableWhiteList", tsEnableWhiteList, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1;
- if (cfgAddBool(pCfg, "experimental", tsExperimental, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
-
// GRANT_CFG_ADD;
return 0;
}
@@ -1109,8 +1088,6 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
tsKeepAliveIdle = cfgGetItem(pCfg, "keepAliveIdle")->i32;
tsExperimental = cfgGetItem(pCfg, "experimental")->bval;
-
- tsDisableCount = cfgGetItem(pCfg, "disableCount")->bval;
return 0;
}
@@ -1358,6 +1335,7 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile
if (taosAddClientLogCfg(tsCfg) != 0) return -1;
if (taosAddServerLogCfg(tsCfg) != 0) return -1;
}
+
taosAddSystemCfg(tsCfg);
if (taosLoadCfg(tsCfg, envCmd, cfgDir, envFile, apolloUrl) != 0) {
@@ -1384,7 +1362,9 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile
if (taosSetTfsCfg(tsCfg) != 0) return -1;
if (taosSetS3Cfg(tsCfg) != 0) return -1;
}
+
taosSetSystemCfg(tsCfg);
+
if (taosSetFileHandlesLimit() != 0) return -1;
taosSetAllDebugFlag(tsCfg, cfgGetItem(tsCfg, "debugFlag")->i32);
@@ -1631,6 +1611,10 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, char *name) {
tsLogSpace.reserved = (int64_t)(((double)pItem->fval) * 1024 * 1024 * 1024);
uInfo("%s set to %" PRId64, name, tsLogSpace.reserved);
matched = true;
+ } else if (strcasecmp("monitor", name) == 0) {
+ tsEnableMonitor = pItem->bval;
+ uInfo("%s set to %d", name, tsEnableMonitor);
+ matched = true;
}
break;
}
@@ -1739,8 +1723,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, char *name) {
{"shellActivityTimer", &tsShellActivityTimer},
{"slowLogThreshold", &tsSlowLogThreshold},
{"useAdapter", &tsUseAdapter},
- {"experimental", &tsExperimental},
- {"disableCount", &tsDisableCount}};
+ {"experimental", &tsExperimental}};
if (taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true) != 0) {
taosCfgSetOption(options, tListLen(options), pItem, false);
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index 12f62c3d7a..ecf11857ad 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -1014,19 +1014,19 @@ int32_t tDeserializeSCreateTagIdxReq(void *buf, int32_t bufLen, SCreateTagIndexR
tDecoderClear(&decoder);
return 0;
}
-int32_t tSerializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) {
- SEncoder encoder = {0};
- tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- tEndEncode(&encoder);
+// int32_t tSerializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) {
+// SEncoder encoder = {0};
+// tEncoderInit(&encoder, buf, bufLen);
+// if (tStartEncode(&encoder) < 0) return -1;
+// tEndEncode(&encoder);
- if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
+// if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
+// if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
- int32_t tlen = encoder.pos;
- tEncoderClear(&encoder);
- return tlen;
-}
+// int32_t tlen = encoder.pos;
+// tEncoderClear(&encoder);
+// return tlen;
+// }
int32_t tDeserializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) {
SDecoder decoder = {0};
tDecoderInit(&decoder, buf, bufLen);
@@ -1040,6 +1040,7 @@ int32_t tDeserializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *
return 0;
}
+
int32_t tSerializeSMCreateFullTextReq(void *buf, int32_t bufLen, SMCreateFullTextReq *pReq) {
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
@@ -1064,32 +1065,32 @@ void tFreeSMCreateFullTextReq(SMCreateFullTextReq *pReq) {
// impl later
return;
}
-int32_t tSerializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
- SEncoder encoder = {0};
- tEncoderInit(&encoder, buf, bufLen);
+// int32_t tSerializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
+// SEncoder encoder = {0};
+// tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
+// if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
+// if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
+// if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
- tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
- tEncoderClear(&encoder);
- return tlen;
-}
-int32_t tDeserializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
- SDecoder decoder = {0};
- tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
- if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
+// tEndEncode(&encoder);
+// int32_t tlen = encoder.pos;
+// tEncoderClear(&encoder);
+// return tlen;
+// }
+// int32_t tDeserializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
+// SDecoder decoder = {0};
+// tDecoderInit(&decoder, buf, bufLen);
+// if (tStartDecode(&decoder) < 0) return -1;
+// if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
+// if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
- tEndDecode(&decoder);
- tDecoderClear(&decoder);
- return 0;
-}
+// tEndDecode(&decoder);
+// tDecoderClear(&decoder);
+// return 0;
+// }
int32_t tSerializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) {
SEncoder encoder = {0};
@@ -1477,44 +1478,44 @@ int32_t tDeserializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *pReq) {
void tFreeSStatisReq(SStatisReq *pReq) { taosMemoryFreeClear(pReq->pCont); }
-int32_t tSerializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq) {
- SEncoder encoder = {0};
- tEncoderInit(&encoder, buf, bufLen);
+// int32_t tSerializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq) {
+// SEncoder encoder = {0};
+// tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1;
- if (tEncodeI32(&encoder, pReq->maxUsers) < 0) return -1;
- if (tEncodeI32(&encoder, pReq->maxDbs) < 0) return -1;
- if (tEncodeI32(&encoder, pReq->maxTimeSeries) < 0) return -1;
- if (tEncodeI32(&encoder, pReq->maxStreams) < 0) return -1;
- if (tEncodeI32(&encoder, pReq->accessState) < 0) return -1;
- if (tEncodeI64(&encoder, pReq->maxStorage) < 0) return -1;
- tEndEncode(&encoder);
+// if (tStartEncode(&encoder) < 0) return -1;
+// if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
+// if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1;
+// if (tEncodeI32(&encoder, pReq->maxUsers) < 0) return -1;
+// if (tEncodeI32(&encoder, pReq->maxDbs) < 0) return -1;
+// if (tEncodeI32(&encoder, pReq->maxTimeSeries) < 0) return -1;
+// if (tEncodeI32(&encoder, pReq->maxStreams) < 0) return -1;
+// if (tEncodeI32(&encoder, pReq->accessState) < 0) return -1;
+// if (tEncodeI64(&encoder, pReq->maxStorage) < 0) return -1;
+// tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
- tEncoderClear(&encoder);
- return tlen;
-}
+// int32_t tlen = encoder.pos;
+// tEncoderClear(&encoder);
+// return tlen;
+// }
-int32_t tDeserializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq) {
- SDecoder decoder = {0};
- tDecoderInit(&decoder, buf, bufLen);
+// int32_t tDeserializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq) {
+// SDecoder decoder = {0};
+// tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->maxUsers) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->maxDbs) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->maxTimeSeries) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->maxStreams) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->accessState) < 0) return -1;
- if (tDecodeI64(&decoder, &pReq->maxStorage) < 0) return -1;
- tEndDecode(&decoder);
+// if (tStartDecode(&decoder) < 0) return -1;
+// if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
+// if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1;
+// if (tDecodeI32(&decoder, &pReq->maxUsers) < 0) return -1;
+// if (tDecodeI32(&decoder, &pReq->maxDbs) < 0) return -1;
+// if (tDecodeI32(&decoder, &pReq->maxTimeSeries) < 0) return -1;
+// if (tDecodeI32(&decoder, &pReq->maxStreams) < 0) return -1;
+// if (tDecodeI32(&decoder, &pReq->accessState) < 0) return -1;
+// if (tDecodeI64(&decoder, &pReq->maxStorage) < 0) return -1;
+// tEndDecode(&decoder);
- tDecoderClear(&decoder);
- return 0;
-}
+// tDecoderClear(&decoder);
+// return 0;
+// }
int32_t tSerializeSDropUserReq(void *buf, int32_t bufLen, SDropUserReq *pReq) {
SEncoder encoder = {0};
@@ -5284,11 +5285,11 @@ int32_t tDeserializeSQueryCompactProgressRsp(void *buf, int32_t bufLen, SQueryCo
if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->numberFileset) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->finished) < 0) return -1;
+ if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -2;
+ if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -3;
+ if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -4;
+ if (tDecodeI32(&decoder, &pReq->numberFileset) < 0) return -5;
+ if (tDecodeI32(&decoder, &pReq->finished) < 0) return -6;
tEndDecode(&decoder);
tDecoderClear(&decoder);
@@ -7237,6 +7238,7 @@ int32_t tSerializeSVDeleteReq(void *buf, int32_t bufLen, SVDeleteReq *pReq) {
if (tEncodeU32(&encoder, pReq->sqlLen) < 0) return -1;
if (tEncodeCStr(&encoder, pReq->sql) < 0) return -1;
if (tEncodeBinary(&encoder, pReq->msg, pReq->phyLen) < 0) return -1;
+ if (tEncodeI8(&encoder, pReq->source) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
@@ -7273,6 +7275,9 @@ int32_t tDeserializeSVDeleteReq(void *buf, int32_t bufLen, SVDeleteReq *pReq) {
if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->msg, &msgLen) < 0) return -1;
pReq->phyLen = msgLen;
+ if (!tDecodeIsEnd(&decoder)) {
+ if (tDecodeI8(&decoder, &pReq->source) < 0) return -1;
+ }
tEndDecode(&decoder);
tDecoderClear(&decoder);
@@ -8029,64 +8034,64 @@ static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBl
return 0;
}
-static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
- if (tStartDecode(pDecoder) < 0) return -1;
+// static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
+// if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI32(pDecoder, &pBlock->code) < 0) return -1;
- if (tDecodeI64(pDecoder, &pBlock->uid) < 0) return -1;
- pBlock->tblFName = taosMemoryCalloc(TSDB_TABLE_FNAME_LEN, 1);
- if (NULL == pBlock->tblFName) return -1;
- if (tDecodeCStrTo(pDecoder, pBlock->tblFName) < 0) return -1;
- if (tDecodeI32v(pDecoder, &pBlock->numOfRows) < 0) return -1;
- if (tDecodeI32v(pDecoder, &pBlock->affectedRows) < 0) return -1;
- if (tDecodeI64v(pDecoder, &pBlock->sver) < 0) return -1;
+// if (tDecodeI32(pDecoder, &pBlock->code) < 0) return -1;
+// if (tDecodeI64(pDecoder, &pBlock->uid) < 0) return -1;
+// pBlock->tblFName = taosMemoryCalloc(TSDB_TABLE_FNAME_LEN, 1);
+// if (NULL == pBlock->tblFName) return -1;
+// if (tDecodeCStrTo(pDecoder, pBlock->tblFName) < 0) return -1;
+// if (tDecodeI32v(pDecoder, &pBlock->numOfRows) < 0) return -1;
+// if (tDecodeI32v(pDecoder, &pBlock->affectedRows) < 0) return -1;
+// if (tDecodeI64v(pDecoder, &pBlock->sver) < 0) return -1;
- int32_t meta = 0;
- if (tDecodeI32(pDecoder, &meta) < 0) return -1;
- if (meta) {
- pBlock->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
- if (NULL == pBlock->pMeta) return -1;
- if (tDecodeSTableMetaRsp(pDecoder, pBlock->pMeta) < 0) return -1;
- } else {
- pBlock->pMeta = NULL;
- }
+// int32_t meta = 0;
+// if (tDecodeI32(pDecoder, &meta) < 0) return -1;
+// if (meta) {
+// pBlock->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
+// if (NULL == pBlock->pMeta) return -1;
+// if (tDecodeSTableMetaRsp(pDecoder, pBlock->pMeta) < 0) return -1;
+// } else {
+// pBlock->pMeta = NULL;
+// }
- tEndDecode(pDecoder);
- return 0;
-}
+// tEndDecode(pDecoder);
+// return 0;
+// }
-int32_t tEncodeSSubmitRsp(SEncoder *pEncoder, const SSubmitRsp *pRsp) {
- int32_t nBlocks = taosArrayGetSize(pRsp->pArray);
+// int32_t tEncodeSSubmitRsp(SEncoder *pEncoder, const SSubmitRsp *pRsp) {
+// int32_t nBlocks = taosArrayGetSize(pRsp->pArray);
- if (tStartEncode(pEncoder) < 0) return -1;
+// if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI32v(pEncoder, pRsp->numOfRows) < 0) return -1;
- if (tEncodeI32v(pEncoder, pRsp->affectedRows) < 0) return -1;
- if (tEncodeI32v(pEncoder, nBlocks) < 0) return -1;
- for (int32_t iBlock = 0; iBlock < nBlocks; iBlock++) {
- if (tEncodeSSubmitBlkRsp(pEncoder, (SSubmitBlkRsp *)taosArrayGet(pRsp->pArray, iBlock)) < 0) return -1;
- }
+// if (tEncodeI32v(pEncoder, pRsp->numOfRows) < 0) return -1;
+// if (tEncodeI32v(pEncoder, pRsp->affectedRows) < 0) return -1;
+// if (tEncodeI32v(pEncoder, nBlocks) < 0) return -1;
+// for (int32_t iBlock = 0; iBlock < nBlocks; iBlock++) {
+// if (tEncodeSSubmitBlkRsp(pEncoder, (SSubmitBlkRsp *)taosArrayGet(pRsp->pArray, iBlock)) < 0) return -1;
+// }
- tEndEncode(pEncoder);
- return 0;
-}
+// tEndEncode(pEncoder);
+// return 0;
+// }
-int32_t tDecodeSSubmitRsp(SDecoder *pDecoder, SSubmitRsp *pRsp) {
- if (tStartDecode(pDecoder) < 0) return -1;
+// int32_t tDecodeSSubmitRsp(SDecoder *pDecoder, SSubmitRsp *pRsp) {
+// if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI32v(pDecoder, &pRsp->numOfRows) < 0) return -1;
- if (tDecodeI32v(pDecoder, &pRsp->affectedRows) < 0) return -1;
- if (tDecodeI32v(pDecoder, &pRsp->nBlocks) < 0) return -1;
- pRsp->pBlocks = taosMemoryCalloc(pRsp->nBlocks, sizeof(*pRsp->pBlocks));
- if (pRsp->pBlocks == NULL) return -1;
- for (int32_t iBlock = 0; iBlock < pRsp->nBlocks; iBlock++) {
- if (tDecodeSSubmitBlkRsp(pDecoder, pRsp->pBlocks + iBlock) < 0) return -1;
- }
+// if (tDecodeI32v(pDecoder, &pRsp->numOfRows) < 0) return -1;
+// if (tDecodeI32v(pDecoder, &pRsp->affectedRows) < 0) return -1;
+// if (tDecodeI32v(pDecoder, &pRsp->nBlocks) < 0) return -1;
+// pRsp->pBlocks = taosMemoryCalloc(pRsp->nBlocks, sizeof(*pRsp->pBlocks));
+// if (pRsp->pBlocks == NULL) return -1;
+// for (int32_t iBlock = 0; iBlock < pRsp->nBlocks; iBlock++) {
+// if (tDecodeSSubmitBlkRsp(pDecoder, pRsp->pBlocks + iBlock) < 0) return -1;
+// }
- tEndDecode(pDecoder);
- tDecoderClear(pDecoder);
- return 0;
-}
+// tEndDecode(pDecoder);
+// tDecoderClear(pDecoder);
+// return 0;
+// }
// void tFreeSSubmitBlkRsp(void *param) {
// if (NULL == param) {
@@ -8527,6 +8532,7 @@ int32_t tEncodeDeleteRes(SEncoder *pCoder, const SDeleteRes *pRes) {
if (tEncodeCStr(pCoder, pRes->tableFName) < 0) return -1;
if (tEncodeCStr(pCoder, pRes->tsColName) < 0) return -1;
if (tEncodeI64(pCoder, pRes->ctimeMs) < 0) return -1;
+ if (tEncodeI8(pCoder, pRes->source) < 0) return -1;
return 0;
}
@@ -8551,6 +8557,9 @@ int32_t tDecodeDeleteRes(SDecoder *pCoder, SDeleteRes *pRes) {
if (!tDecodeIsEnd(pCoder)) {
if (tDecodeI64(pCoder, &pRes->ctimeMs) < 0) return -1;
}
+ if (!tDecodeIsEnd(pCoder)) {
+ if (tDecodeI8(pCoder, &pRes->source) < 0) return -1;
+ }
return 0;
}
diff --git a/source/common/src/trow.c b/source/common/src/trow.c
index 6e9278c630..3c38c89e7f 100644
--- a/source/common/src/trow.c
+++ b/source/common/src/trow.c
@@ -510,9 +510,9 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow, int8_t r
rowTotalLen = sizeof(STSRow) + sizeof(col_id_t) + varDataLen + nonVarDataLen + (nBound - 1) * sizeof(SKvRowIdx) +
TD_BITMAP_BYTES(nBound - 1);
}
- if (!(*ppRow)) {
- *ppRow = (STSRow *)taosMemoryCalloc(1, rowTotalLen);
- isAlloc = true;
+ if (!(*ppRow)) {
+ *ppRow = (STSRow *)taosMemoryCalloc(1, rowTotalLen);
+ isAlloc = true;
}
if (!(*ppRow)) {
@@ -1106,7 +1106,7 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV
*pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
} else {
pColVal->cid = pTColumn->colId;
- pColVal->type = pTColumn->type;
+ pColVal->value.type = pTColumn->type;
pColVal->flag = CV_FLAG_VALUE;
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
diff --git a/source/common/test/dataformatTest.cpp b/source/common/test/dataformatTest.cpp
index 8bc7d47ebf..2dfa706728 100644
--- a/source/common/test/dataformatTest.cpp
+++ b/source/common/test/dataformatTest.cpp
@@ -143,73 +143,73 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) {
}
switch (i) {
case 0:
- colVal.type = TSDB_DATA_TYPE_TIMESTAMP;
+ colVal.value.type = TSDB_DATA_TYPE_TIMESTAMP;
sscanf(data[i], "%" PRIi64, &colVal.value.val);
break;
case 1:
- colVal.type = TSDB_DATA_TYPE_INT;
+ colVal.value.type = TSDB_DATA_TYPE_INT;
sscanf(data[i], "%" PRIi32, (int32_t *)&colVal.value.val);
break;
case 2:
- colVal.type = TSDB_DATA_TYPE_BIGINT;
+ colVal.value.type = TSDB_DATA_TYPE_BIGINT;
sscanf(data[i], "%" PRIi64, &colVal.value.val);
break;
case 3:
- colVal.type = TSDB_DATA_TYPE_FLOAT;
+ colVal.value.type = TSDB_DATA_TYPE_FLOAT;
sscanf(data[i], "%f", (float *)&colVal.value.val);
break;
case 4:
- colVal.type = TSDB_DATA_TYPE_DOUBLE;
+ colVal.value.type = TSDB_DATA_TYPE_DOUBLE;
sscanf(data[i], "%lf", (double *)&colVal.value.val);
break;
case 5: {
- colVal.type = TSDB_DATA_TYPE_BINARY;
+ colVal.value.type = TSDB_DATA_TYPE_BINARY;
int16_t dataLen = strlen(data[i]) + 1;
colVal.value.nData = dataLen < 10 ? dataLen : 10;
colVal.value.pData = (uint8_t *)data[i];
} break;
case 6: {
- colVal.type = TSDB_DATA_TYPE_NCHAR;
+ colVal.value.type = TSDB_DATA_TYPE_NCHAR;
int16_t dataLen = strlen(data[i]) + 1;
colVal.value.nData = dataLen < 40 ? dataLen : 40;
colVal.value.pData = (uint8_t *)data[i]; // just for test, not real nchar
} break;
case 7: {
- colVal.type = TSDB_DATA_TYPE_TINYINT;
+ colVal.value.type = TSDB_DATA_TYPE_TINYINT;
int32_t d8;
sscanf(data[i], "%" PRId32, &d8);
colVal.value.val = (int8_t)d8;
}
case 8: {
- colVal.type = TSDB_DATA_TYPE_SMALLINT;
+ colVal.value.type = TSDB_DATA_TYPE_SMALLINT;
int32_t d16;
sscanf(data[i], "%" PRId32, &d16);
colVal.value.val = (int16_t)d16;
} break;
case 9: {
- colVal.type = TSDB_DATA_TYPE_BOOL;
+ colVal.value.type = TSDB_DATA_TYPE_BOOL;
int32_t d8;
sscanf(data[i], "%" PRId32, &d8);
colVal.value.val = (int8_t)d8;
} break;
case 10: {
- colVal.type = TSDB_DATA_TYPE_UTINYINT;
+ colVal.value.type = TSDB_DATA_TYPE_UTINYINT;
uint32_t u8;
sscanf(data[i], "%" PRId32, &u8);
colVal.value.val = (uint8_t)u8;
} break;
case 11: {
- colVal.type = TSDB_DATA_TYPE_USMALLINT;
+ colVal.value.type = TSDB_DATA_TYPE_USMALLINT;
uint32_t u16;
sscanf(data[i], "%" PRId32, &u16);
colVal.value.val = (uint16_t)u16;
} break;
case 12: {
- colVal.type = TSDB_DATA_TYPE_UINT;
+ colVal.value.type = TSDB_DATA_TYPE_UINT;
sscanf(data[i], "%" PRIu32, (uint32_t *)&colVal.value.val);
} break;
case 13: {
- colVal.type = TSDB_DATA_TYPE_UBIGINT;
+ colVal.value.type = TSDB_DATA_TYPE_UBIGINT;
sscanf(data[i], "%" PRIu64, (uint64_t *)&colVal.value.val);
} break;
default:
@@ -430,7 +430,7 @@ static void checkTSRow(const char **data, STSRow *row, STSchema *pTSchema) {
}
colVal.cid = pCol->colId;
- colVal.type = pCol->type;
+ colVal.value.type = pCol->type;
if (tdValTypeIsNone(cv.valType)) {
colVal.flag = CV_FLAG_NONE;
} else if (tdValTypeIsNull(cv.valType)) {
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
index be88e8b3fd..3dfc2bd96f 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
@@ -194,26 +194,26 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
while (pVnode->refCount > 0) taosMsleep(10);
dInfo("vgId:%d, wait for vnode write queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pWriteW.queue,
- pVnode->pWriteW.queue->threadId);
+ taosQueueGetThreadId(pVnode->pWriteW.queue));
tMultiWorkerCleanup(&pVnode->pWriteW);
dInfo("vgId:%d, wait for vnode sync queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pSyncW.queue,
- pVnode->pSyncW.queue->threadId);
+ taosQueueGetThreadId(pVnode->pSyncW.queue));
tMultiWorkerCleanup(&pVnode->pSyncW);
dInfo("vgId:%d, wait for vnode sync rd queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pSyncRdW.queue,
- pVnode->pSyncRdW.queue->threadId);
+ taosQueueGetThreadId(pVnode->pSyncRdW.queue));
tMultiWorkerCleanup(&pVnode->pSyncRdW);
dInfo("vgId:%d, wait for vnode apply queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pApplyW.queue,
- pVnode->pApplyW.queue->threadId);
+ taosQueueGetThreadId(pVnode->pApplyW.queue));
tMultiWorkerCleanup(&pVnode->pApplyW);
dInfo("vgId:%d, wait for vnode query queue:%p is empty", pVnode->vgId, pVnode->pQueryQ);
while (!taosQueueEmpty(pVnode->pQueryQ)) taosMsleep(10);
dInfo("vgId:%d, wait for vnode fetch queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pFetchQ,
- pVnode->pFetchQ->threadId);
+ taosQueueGetThreadId(pVnode->pFetchQ));
while (!taosQueueEmpty(pVnode->pFetchQ)) taosMsleep(10);
tqNotifyClose(pVnode->pImpl->pTq);
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
index 8b80527447..a6abe5ab4d 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
@@ -365,16 +365,16 @@ int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
}
dInfo("vgId:%d, write-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pWriteW.queue,
- pVnode->pWriteW.queue->threadId);
+ taosQueueGetThreadId(pVnode->pWriteW.queue));
dInfo("vgId:%d, sync-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pSyncW.queue,
- pVnode->pSyncW.queue->threadId);
+ taosQueueGetThreadId(pVnode->pSyncW.queue));
dInfo("vgId:%d, sync-rd-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pSyncRdW.queue,
- pVnode->pSyncRdW.queue->threadId);
+ taosQueueGetThreadId(pVnode->pSyncRdW.queue));
dInfo("vgId:%d, apply-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pApplyW.queue,
- pVnode->pApplyW.queue->threadId);
+ taosQueueGetThreadId(pVnode->pApplyW.queue));
dInfo("vgId:%d, query-queue:%p is alloced", pVnode->vgId, pVnode->pQueryQ);
dInfo("vgId:%d, fetch-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pFetchQ,
- pVnode->pFetchQ->threadId);
+ taosQueueGetThreadId(pVnode->pFetchQ));
dInfo("vgId:%d, stream-queue:%p is alloced", pVnode->vgId, pVnode->pStreamQ);
return 0;
}
diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
index 1a31f08801..77760b16f4 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
@@ -345,6 +345,7 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit.parent = pDnode;
rpcInit.rfp = rpcRfp;
rpcInit.compressSize = tsCompressMsgSize;
+ rpcInit.dfp = destroyAhandle;
rpcInit.retryMinInterval = tsRedirectPeriod;
rpcInit.retryStepFactor = tsRedirectFactor;
diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h
index 57fd187da3..5307ff4b05 100644
--- a/source/dnode/mnode/impl/inc/mndStream.h
+++ b/source/dnode/mnode/impl/inc/mndStream.h
@@ -111,7 +111,7 @@ STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const
int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans, int32_t status);
SSdbRaw *mndStreamActionEncode(SStreamObj *pStream);
void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo);
-int32_t mndStreamSetUpdateEpsetAction(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans);
+int32_t mndStreamSetUpdateEpsetAction(SMnode *pMnode, SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans);
SStreamObj *mndGetStreamObj(SMnode *pMnode, int64_t streamId);
int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t taskId, int32_t nodeId);
diff --git a/source/dnode/mnode/impl/src/mndCompact.c b/source/dnode/mnode/impl/src/mndCompact.c
index deaaf7f2af..75b4531dbb 100644
--- a/source/dnode/mnode/impl/src/mndCompact.c
+++ b/source/dnode/mnode/impl/src/mndCompact.c
@@ -363,13 +363,15 @@ static int32_t mndAddKillCompactAction(SMnode *pMnode, STrans *pTrans, SVgObj *p
}
static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompact) {
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "kill-compact");
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB, pReq, "kill-compact");
if (pTrans == NULL) {
mError("compact:%" PRId32 ", failed to drop since %s" , pCompact->compactId, terrstr());
return -1;
}
mInfo("trans:%d, used to kill compact:%" PRId32, pTrans->id, pCompact->compactId);
+ mndTransSetDbName(pTrans, pCompact->dbname, NULL);
+
SSdbRaw *pCommitRaw = mndCompactActionEncode(pCompact);
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
mError("trans:%d, failed to append commit log since %s", pTrans->id, terrstr());
@@ -378,7 +380,7 @@ static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompa
}
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
- void *pIter = NULL;
+ void *pIter = NULL;
while (1) {
SCompactDetailObj *pDetail = NULL;
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
@@ -452,7 +454,7 @@ int32_t mndProcessKillCompactReq(SRpcMsg *pReq){
code = TSDB_CODE_ACTION_IN_PROGRESS;
- char obj[MND_COMPACT_ID_LEN] = {0};
+ char obj[TSDB_INT32_ID_LEN] = {0};
sprintf(obj, "%d", pCompact->compactId);
auditRecord(pReq, pMnode->clusterId, "killCompact", pCompact->dbname, obj, killCompactReq.sql, killCompactReq.sqlLen);
@@ -488,13 +490,17 @@ static int32_t mndUpdateCompactProgress(SMnode *pMnode, SRpcMsg *pReq, int32_t c
sdbRelease(pMnode->pSdb, pDetail);
}
- return -1;
+ return TSDB_CODE_MND_COMPACT_DETAIL_NOT_EXIST;
}
int32_t mndProcessQueryCompactRsp(SRpcMsg *pReq){
SQueryCompactProgressRsp req = {0};
- if (tDeserializeSQueryCompactProgressRsp(pReq->pCont, pReq->contLen, &req) != 0) {
+ int32_t code = 0;
+ code = tDeserializeSQueryCompactProgressRsp(pReq->pCont, pReq->contLen, &req);
+ if (code != 0) {
terrno = TSDB_CODE_INVALID_MSG;
+ mError("failed to deserialize vnode-query-compact-progress-rsp, ret:%d, pCont:%p, len:%d",
+ code, pReq->pCont, pReq->contLen);
return -1;
}
@@ -502,10 +508,10 @@ int32_t mndProcessQueryCompactRsp(SRpcMsg *pReq){
req.compactId, req.vgId, req.dnodeId, req.numberFileset, req.finished);
SMnode *pMnode = pReq->info.node;
- int32_t code = -1;
-
- if(mndUpdateCompactProgress(pMnode, pReq, req.compactId, &req) != 0){
+ code = mndUpdateCompactProgress(pMnode, pReq, req.compactId, &req);
+ if(code != 0){
+ terrno = code;
mError("compact:%d, failed to update progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d",
req.compactId, req.vgId, req.dnodeId, req.numberFileset, req.finished);
return -1;
@@ -612,15 +618,17 @@ static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
return 0;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, NULL, "update-compact-progress");
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB, NULL, "update-compact-progress");
if (pTrans == NULL) {
mError("trans:%" PRId32 ", failed to create since %s" , pTrans->id, terrstr());
return -1;
}
mInfo("compact:%d, trans:%d, used to update compact progress.", compactId, pTrans->id);
-
+
SCompactObj *pCompact = mndAcquireCompact(pMnode, compactId);
+ mndTransSetDbName(pTrans, pCompact->dbname, NULL);
+
pIter = NULL;
while (1) {
SCompactDetailObj *pDetail = NULL;
diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c
index 79a5f5fd83..befb6d3521 100644
--- a/source/dnode/mnode/impl/src/mndDnode.c
+++ b/source/dnode/mnode/impl/src/mndDnode.c
@@ -610,7 +610,7 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) {
for(int32_t j = 0; j < tagSize; j++){
SJson* item = tjsonGetArrayItem(arrayTag, j);
- *(labels + j) = taosMemoryMalloc(MONITOR_TAG_NAME_LEN);
+ *(labels + j) = taosMemoryMalloc(MONITOR_TAG_NAME_LEN);
tjsonGetStringValue(item, "name", *(labels + j));
*(sample_labels + j) = taosMemoryMalloc(MONITOR_TAG_VALUE_LEN);
@@ -626,7 +626,7 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) {
for(int32_t j = 0; j < metricLen; j++){
SJson *item = tjsonGetArrayItem(metrics, j);
- char name[MONITOR_METRIC_NAME_LEN] = {0};
+ char name[MONITOR_METRIC_NAME_LEN] = {0};
tjsonGetStringValue(item, "name", name);
double value = 0;
@@ -636,7 +636,7 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) {
tjsonGetDoubleValue(item, "type", &type);
int32_t metricNameLen = strlen(name) + strlen(tableName) + 2;
- char* metricName = taosMemoryMalloc(metricNameLen);
+ char* metricName = taosMemoryMalloc(metricNameLen);
memset(metricName, 0, metricNameLen);
sprintf(metricName, "%s:%s", tableName, name);
@@ -669,7 +669,7 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) {
else{
mTrace("get metric from registry:%p", metric);
}
-
+
if(type == 0){
taos_counter_add(metric, value, (const char**)sample_labels);
}
@@ -689,7 +689,7 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) {
taosMemoryFreeClear(labels);
}
}
-
+
}
code = 0;
@@ -1409,24 +1409,6 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
if (strcasecmp(cfgReq.config, "resetlog") == 0) {
strcpy(dcfgReq.config, "resetlog");
#ifdef TD_ENTERPRISE
- } else if (strncasecmp(cfgReq.config, "supportvnodes", 13) == 0) {
- int32_t optLen = strlen("supportvnodes");
- int32_t flag = -1;
- int32_t code = mndMCfgGetValInt32(&cfgReq, optLen, &flag);
- if (code < 0) return code;
-
- if (flag < 0 || flag > 4096) {
- mError("dnode:%d, failed to config supportVnodes since value:%d. Valid range: [0, 4096]", cfgReq.dnodeId, flag);
- terrno = TSDB_CODE_OUT_OF_RANGE;
- goto _err_out;
- }
- if (flag == 0) {
- flag = tsNumOfCores * 2;
- }
- flag = TMAX(flag, 2);
-
- strcpy(dcfgReq.config, "supportvnodes");
- snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag);
} else if (strncasecmp(cfgReq.config, "s3blocksize", 11) == 0) {
int32_t optLen = strlen("s3blocksize");
int32_t flag = -1;
diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c
index b188d314d9..69a0bd477d 100644
--- a/source/dnode/mnode/impl/src/mndMain.c
+++ b/source/dnode/mnode/impl/src/mndMain.c
@@ -709,7 +709,8 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
int32_t code = syncProcessMsg(pMgmt->sync, pMsg);
if (code != 0) {
- mGError("vgId:1, failed to process sync msg:%p type:%s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr());
+ mGError("vgId:1, failed to process sync msg:%p type:%s, errno: %s, code:0x%x", pMsg, TMSG_INFO(pMsg->msgType),
+ terrstr(), code);
}
return code;
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 3ef2f64df7..50e3dd0d03 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -721,6 +721,8 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
goto _OVER;
}
+ // add into buffer firstly
+ // to make sure when the hb from vnode arrived, the newly created tasks have been in the task map already.
taosThreadMutexLock(&execInfo.lock);
mDebug("stream stream:%s tasks register into node list", createReq.name);
saveStreamTasksInfo(&streamObj, &execInfo);
@@ -1811,7 +1813,7 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange
mDebug("stream:0x%" PRIx64 " %s involved node changed, create update trans, transId:%d", pStream->uid,
pStream->name, pTrans->id);
- int32_t code = mndStreamSetUpdateEpsetAction(pStream, pChangeInfo, pTrans);
+ int32_t code = mndStreamSetUpdateEpsetAction(pMnode, pStream, pChangeInfo, pTrans);
// todo: not continue, drop all and retry again
if (code != TSDB_CODE_SUCCESS) {
diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c
index 1ae85a2cc6..a124b4052c 100644
--- a/source/dnode/mnode/impl/src/mndStreamUtil.c
+++ b/source/dnode/mnode/impl/src/mndStreamUtil.c
@@ -115,6 +115,7 @@ SArray *mndTakeVgroupSnapshot(SMnode *pMnode, bool *allReady) {
char buf[256] = {0};
EPSET_TO_STR(&entry.epset, buf);
+
mDebug("take node snapshot, nodeId:%d %s", entry.nodeId, buf);
taosArrayPush(pVgroupListSnapshot, &entry);
sdbRelease(pSdb, pVgroup);
@@ -300,7 +301,10 @@ static int32_t doSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTa
return code;
}
- mDebug("pause node:%d, epset:%d", pTask->info.nodeId, epset.numOfEps);
+ char buf[256] = {0};
+ EPSET_TO_STR(&epset, buf);
+ mDebug("pause stream task in node:%d, epset:%s", pTask->info.nodeId, buf);
+
code = setTransAction(pTrans, pReq, sizeof(SVPauseStreamTaskReq), TDMT_STREAM_TASK_PAUSE, &epset, 0);
if (code != 0) {
taosMemoryFree(pReq);
@@ -462,14 +466,22 @@ static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupCha
return TSDB_CODE_SUCCESS;
}
-static int32_t doSetUpdateTaskAction(STrans *pTrans, SStreamTask *pTask, SVgroupChangeInfo *pInfo) {
+static int32_t doSetUpdateTaskAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, SVgroupChangeInfo *pInfo) {
void *pBuf = NULL;
int32_t len = 0;
streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList);
doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id);
- int32_t code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &pTask->info.epSet, 0);
+ SEpSet epset = {0};
+ bool hasEpset = false;
+ int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
+ if (code != TSDB_CODE_SUCCESS || !hasEpset) {
+ terrno = code;
+ return code;
+ }
+
+ code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &epset, TSDB_CODE_VND_INVALID_VGROUP_ID);
if (code != TSDB_CODE_SUCCESS) {
taosMemoryFree(pBuf);
}
@@ -478,14 +490,14 @@ static int32_t doSetUpdateTaskAction(STrans *pTrans, SStreamTask *pTask, SVgroup
}
// build trans to update the epset
-int32_t mndStreamSetUpdateEpsetAction(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans) {
+int32_t mndStreamSetUpdateEpsetAction(SMnode *pMnode, SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans) {
mDebug("stream:0x%" PRIx64 " set tasks epset update action", pStream->uid);
taosWLockLatch(&pStream->lock);
SStreamTaskIter *pIter = createStreamTaskIter(pStream);
while (streamTaskIterNextTask(pIter)) {
SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
- int32_t code = doSetUpdateTaskAction(pTrans, pTask, pInfo);
+ int32_t code = doSetUpdateTaskAction(pMnode, pTrans, pTask, pInfo);
if (code != TSDB_CODE_SUCCESS) {
destroyStreamTaskIter(pIter);
taosWUnLockLatch(&pStream->lock);
diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c
index 04d74112d4..f7db0d7b15 100644
--- a/source/dnode/mnode/impl/src/mndTrans.c
+++ b/source/dnode/mnode/impl/src/mndTrans.c
@@ -15,11 +15,11 @@
#define _DEFAULT_SOURCE
#include "mndTrans.h"
-#include "mndSubscribe.h"
#include "mndDb.h"
#include "mndPrivilege.h"
#include "mndShow.h"
#include "mndStb.h"
+#include "mndSubscribe.h"
#include "mndSync.h"
#include "mndUser.h"
@@ -801,16 +801,17 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) {
if (pNew->conflict == TRN_CONFLICT_TOPIC) {
if (pTrans->conflict == TRN_CONFLICT_GLOBAL) conflict = true;
if (pTrans->conflict == TRN_CONFLICT_TOPIC || pTrans->conflict == TRN_CONFLICT_TOPIC_INSIDE) {
- if (strcasecmp(pNew->dbname, pTrans->dbname) == 0 ) conflict = true;
+ if (strcasecmp(pNew->dbname, pTrans->dbname) == 0) conflict = true;
}
}
if (pNew->conflict == TRN_CONFLICT_TOPIC_INSIDE) {
if (pTrans->conflict == TRN_CONFLICT_GLOBAL) conflict = true;
- if (pTrans->conflict == TRN_CONFLICT_TOPIC ) {
- if (strcasecmp(pNew->dbname, pTrans->dbname) == 0 ) conflict = true;
+ if (pTrans->conflict == TRN_CONFLICT_TOPIC) {
+ if (strcasecmp(pNew->dbname, pTrans->dbname) == 0) conflict = true;
}
if (pTrans->conflict == TRN_CONFLICT_TOPIC_INSIDE) {
- if (strcasecmp(pNew->dbname, pTrans->dbname) == 0 && strcasecmp(pNew->stbname, pTrans->stbname) == 0) conflict = true;
+ if (strcasecmp(pNew->dbname, pTrans->dbname) == 0 && strcasecmp(pNew->stbname, pTrans->stbname) == 0)
+ conflict = true;
}
}
@@ -847,7 +848,7 @@ int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans) {
}
int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
- if(pTrans == NULL) return -1;
+ if (pTrans == NULL) return -1;
if (mndTransCheckConflict(pMnode, pTrans) != 0) {
return -1;
@@ -1142,6 +1143,7 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
return -1;
}
rpcMsg.info.traceId.rootId = pTrans->mTraceId;
+ rpcMsg.info.notFreeAhandle = 1;
memcpy(rpcMsg.pCont, pAction->pCont, pAction->contLen);
@@ -1156,7 +1158,7 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
int32_t code = tmsgSendReq(&pAction->epSet, &rpcMsg);
if (code == 0) {
pAction->msgSent = 1;
- //pAction->msgReceived = 0;
+ // pAction->msgReceived = 0;
pAction->errCode = TSDB_CODE_ACTION_IN_PROGRESS;
mInfo("trans:%d, %s:%d is sent, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, detail);
@@ -1253,16 +1255,16 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
for (int32_t action = 0; action < numOfActions; ++action) {
STransAction *pAction = taosArrayGet(pArray, action);
- mDebug("trans:%d, %s:%d Sent:%d, Received:%d, errCode:0x%x, acceptableCode:0x%x, retryCode:0x%x",
- pTrans->id, mndTransStr(pAction->stage), pAction->id, pAction->msgSent, pAction->msgReceived,
- pAction->errCode, pAction->acceptableCode, pAction->retryCode);
+ mDebug("trans:%d, %s:%d Sent:%d, Received:%d, errCode:0x%x, acceptableCode:0x%x, retryCode:0x%x", pTrans->id,
+ mndTransStr(pAction->stage), pAction->id, pAction->msgSent, pAction->msgReceived, pAction->errCode,
+ pAction->acceptableCode, pAction->retryCode);
if (pAction->msgSent) {
if (pAction->msgReceived) {
if (pAction->errCode != 0 && pAction->errCode != pAction->acceptableCode) {
mndTransResetAction(pMnode, pTrans, pAction);
mInfo("trans:%d, %s:%d reset", pTrans->id, mndTransStr(pAction->stage), pAction->id);
}
- }
+ }
}
}
return TSDB_CODE_ACTION_IN_PROGRESS;
diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h
index cac3be9ee3..cf4392e51c 100644
--- a/source/dnode/vnode/src/inc/tsdb.h
+++ b/source/dnode/vnode/src/inc/tsdb.h
@@ -75,6 +75,7 @@ typedef struct SBlkInfo SBlkInfo;
typedef struct STsdbDataIter2 STsdbDataIter2;
typedef struct STsdbFilterInfo STsdbFilterInfo;
typedef struct STFileSystem STFileSystem;
+typedef struct STsdbRowKey STsdbRowKey;
#define TSDBROW_ROW_FMT ((int8_t)0x0)
#define TSDBROW_COL_FMT ((int8_t)0x1)
@@ -93,7 +94,7 @@ typedef struct STFileSystem STFileSystem;
#define PAGE_CONTENT_SIZE(PAGE) ((PAGE) - sizeof(TSCKSUM))
#define LOGIC_TO_FILE_OFFSET(LOFFSET, PAGE) \
((LOFFSET) / PAGE_CONTENT_SIZE(PAGE) * (PAGE) + (LOFFSET) % PAGE_CONTENT_SIZE(PAGE))
-#define FILE_TO_LOGIC_OFFSET(OFFSET, PAGE) ((OFFSET) / (PAGE)*PAGE_CONTENT_SIZE(PAGE) + (OFFSET) % (PAGE))
+#define FILE_TO_LOGIC_OFFSET(OFFSET, PAGE) ((OFFSET) / (PAGE) * PAGE_CONTENT_SIZE(PAGE) + (OFFSET) % (PAGE))
#define PAGE_OFFSET(PGNO, PAGE) (((PGNO)-1) * (PAGE))
#define OFFSET_PGNO(OFFSET, PAGE) ((OFFSET) / (PAGE) + 1)
@@ -120,7 +121,10 @@ static FORCE_INLINE int64_t tsdbLogicToFileSize(int64_t lSize, int32_t szPage) {
((TSDBROW){.type = TSDBROW_COL_FMT, .pBlockData = (BLOCKDATA), .iRow = (IROW)})
void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal);
-int32_t tsdbRowCmprFn(const void *p1, const void *p2);
+int32_t tsdbRowCompare(const void *p1, const void *p2);
+int32_t tsdbRowCompareWithoutVersion(const void *p1, const void *p2);
+int32_t tsdbRowKeyCmpr(const STsdbRowKey *key1, const STsdbRowKey *key2);
+void tsdbRowGetKey(TSDBROW *row, STsdbRowKey *key);
// STSDBRowIter
int32_t tsdbRowIterOpen(STSDBRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema);
void tsdbRowClose(STSDBRowIter *pIter);
@@ -139,8 +143,8 @@ int32_t tTABLEIDCmprFn(const void *p1, const void *p2);
#define MIN_TSDBKEY(KEY1, KEY2) ((tsdbKeyCmprFn(&(KEY1), &(KEY2)) < 0) ? (KEY1) : (KEY2))
#define MAX_TSDBKEY(KEY1, KEY2) ((tsdbKeyCmprFn(&(KEY1), &(KEY2)) > 0) ? (KEY1) : (KEY2))
// SBlockCol
-int32_t tPutBlockCol(uint8_t *p, void *ph);
-int32_t tGetBlockCol(uint8_t *p, void *ph);
+int32_t tPutBlockCol(SBuffer *buffer, const SBlockCol *pBlockCol);
+int32_t tGetBlockCol(SBufferReader *br, SBlockCol *pBlockCol);
int32_t tBlockColCmprFn(const void *p1, const void *p2);
// SDataBlk
void tDataBlkReset(SDataBlk *pBlock);
@@ -172,13 +176,17 @@ int32_t tBlockDataUpdateRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
int32_t tBlockDataTryUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, int64_t uid);
int32_t tBlockDataUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid);
void tBlockDataClear(SBlockData *pBlockData);
-void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColData);
-int32_t tCmprBlockData(SBlockData *pBlockData, int8_t cmprAlg, uint8_t **ppOut, int32_t *szOut, uint8_t *aBuf[],
- int32_t aBufN[]);
-int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uint8_t *aBuf[]);
+int32_t tBlockDataCompress(SBlockData *bData, int8_t cmprAlg, SBuffer *buffers, SBuffer *assist);
+int32_t tBlockDataDecompress(SBufferReader *br, SBlockData *blockData, SBuffer *assist);
+int32_t tBlockDataDecompressKeyPart(const SDiskDataHdr *hdr, SBufferReader *br, SBlockData *blockData, SBuffer *assist);
+int32_t tBlockDataDecompressColData(const SDiskDataHdr *hdr, const SBlockCol *blockCol, SBufferReader *br,
+ SBlockData *blockData, SBuffer *assist);
+
+SColData *tBlockDataGetColData(SBlockData *pBlockData, int16_t cid);
+int32_t tBlockDataAddColData(SBlockData *pBlockData, int16_t cid, int8_t type, int8_t cflag, SColData **ppColData);
// SDiskDataHdr
-int32_t tPutDiskDataHdr(uint8_t *p, const SDiskDataHdr *pHdr);
-int32_t tGetDiskDataHdr(uint8_t *p, void *ph);
+int32_t tPutDiskDataHdr(SBuffer *buffer, const SDiskDataHdr *pHdr);
+int32_t tGetDiskDataHdr(SBufferReader *br, SDiskDataHdr *pHdr);
// SDelIdx
int32_t tPutDelIdx(uint8_t *p, void *ph);
int32_t tGetDelIdx(uint8_t *p, void *ph);
@@ -204,16 +212,8 @@ int32_t tsdbKeyFid(TSKEY key, int32_t minutes, int8_t precision);
void tsdbFidKeyRange(int32_t fid, int32_t minutes, int8_t precision, TSKEY *minKey, TSKEY *maxKey);
int32_t tsdbFidLevel(int32_t fid, STsdbKeepCfg *pKeepCfg, int64_t nowSec);
int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SArray *aSkyline);
-int32_t tPutColumnDataAgg(uint8_t *p, SColumnDataAgg *pColAgg);
-int32_t tGetColumnDataAgg(uint8_t *p, SColumnDataAgg *pColAgg);
-int32_t tsdbCmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, uint8_t **ppOut, int32_t nOut,
- int32_t *szOut, uint8_t **ppBuf);
-int32_t tsdbDecmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, uint8_t **ppOut, int32_t szOut,
- uint8_t **ppBuf);
-int32_t tsdbCmprColData(SColData *pColData, int8_t cmprAlg, SBlockCol *pBlockCol, uint8_t **ppOut, int32_t nOut,
- uint8_t **ppBuf);
-int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, int32_t nVal, SColData *pColData,
- uint8_t **ppBuf);
+int32_t tPutColumnDataAgg(SBuffer *buffer, SColumnDataAgg *pColAgg);
+int32_t tGetColumnDataAgg(SBufferReader *br, SColumnDataAgg *pColAgg);
int32_t tRowInfoCmprFn(const void *p1, const void *p2);
// tsdbMemTable ==============================================================================================
// SMemTable
@@ -224,9 +224,9 @@ int32_t tsdbRefMemTable(SMemTable *pMemTable, SQueryNode *pQNode);
int32_t tsdbUnrefMemTable(SMemTable *pMemTable, SQueryNode *pNode, bool proactive);
SArray *tsdbMemTableGetTbDataArray(SMemTable *pMemTable);
// STbDataIter
-int32_t tsdbTbDataIterCreate(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter **ppIter);
+int32_t tsdbTbDataIterCreate(STbData *pTbData, STsdbRowKey *pFrom, int8_t backward, STbDataIter **ppIter);
void *tsdbTbDataIterDestroy(STbDataIter *pIter);
-void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter *pIter);
+void tsdbTbDataIterOpen(STbData *pTbData, STsdbRowKey *pFrom, int8_t backward, STbDataIter *pIter);
bool tsdbTbDataIterNext(STbDataIter *pIter);
void tsdbMemTableCountRows(SMemTable *pMemTable, SSHashObj *pTableMap, int64_t *rowsNum);
@@ -264,11 +264,6 @@ int32_t tsdbDataFReaderClose(SDataFReader **ppReader);
int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx);
int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *mDataBlk);
int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk);
-int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pBlock, SArray *aColumnDataAgg);
-int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pBlock, SBlockData *pBlockData);
-int32_t tsdbReadDataBlockEx(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData *pBlockData);
-int32_t tsdbReadSttBlock(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData);
-int32_t tsdbReadSttBlockEx(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData);
// SDelFReader
int32_t tsdbDelFReaderOpen(SDelFReader **ppReader, SDelFile *pFile, STsdb *pTsdb);
int32_t tsdbDelFReaderClose(SDelFReader **ppReader);
@@ -279,7 +274,7 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx);
// tsdbRead.c ==============================================================================================
int32_t tsdbTakeReadSnap2(STsdbReader *pReader, _query_reseek_func_t reseek, STsdbReadSnap **ppSnap);
void tsdbUntakeReadSnap2(STsdbReader *pReader, STsdbReadSnap *pSnap, bool proactive);
-int32_t tsdbGetTableSchema(SMeta* pMeta, int64_t uid, STSchema** pSchema, int64_t* suid);
+int32_t tsdbGetTableSchema(SMeta *pMeta, int64_t uid, STSchema **pSchema, int64_t *suid);
// tsdbMerge.c ==============================================================================================
typedef struct {
@@ -289,14 +284,6 @@ typedef struct {
int32_t tsdbMerge(void *arg);
-// tsdbDiskData ==============================================================================================
-int32_t tDiskDataBuilderCreate(SDiskDataBuilder **ppBuilder);
-void *tDiskDataBuilderDestroy(SDiskDataBuilder *pBuilder);
-int32_t tDiskDataBuilderInit(SDiskDataBuilder *pBuilder, STSchema *pTSchema, TABLEID *pId, uint8_t cmprAlg,
- uint8_t calcSma);
-int32_t tDiskDataBuilderClear(SDiskDataBuilder *pBuilder);
-int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTSchema, TABLEID *pId);
-int32_t tGnrtDiskData(SDiskDataBuilder *pBuilder, const SDiskData **ppDiskData, const SBlkInfo **ppBlkInfo);
// tsdbDataIter.c ==============================================================================================
#define TSDB_MEM_TABLE_DATA_ITER 0
#define TSDB_DATA_FILE_DATA_ITER 1
@@ -375,15 +362,6 @@ struct TSDBKEY {
};
typedef struct SMemSkipListNode SMemSkipListNode;
-struct SMemSkipListNode {
- int8_t level;
- int8_t flag; // TSDBROW_ROW_FMT for row format, TSDBROW_COL_FMT for col format
- int32_t iRow;
- int64_t version;
- void *pData;
- SMemSkipListNode *forwards[0];
-};
-
typedef struct SMemSkipList {
int64_t size;
uint32_t seed;
@@ -437,6 +415,17 @@ struct TSDBROW {
};
};
+struct SMemSkipListNode {
+ int8_t level;
+ TSDBROW row;
+ SMemSkipListNode *forwards[0];
+};
+
+struct STsdbRowKey {
+ SRowKey key;
+ int64_t version;
+};
+
struct SBlockIdx {
int64_t suid;
int64_t uid;
@@ -454,7 +443,7 @@ struct SMapData {
struct SBlockCol {
int16_t cid;
int8_t type;
- int8_t smaOn;
+ int8_t cflag;
int8_t flag; // HAS_NONE|HAS_NULL|HAS_VALUE
int32_t szOrigin; // original column value size (only save for variant data type)
int32_t szBitmap; // bitmap size, 0 only for flag == HAS_VAL
@@ -562,6 +551,10 @@ struct SDiskDataHdr {
int32_t szBlkCol;
int32_t nRow;
int8_t cmprAlg;
+
+ // fmtVer == 1
+ int8_t numOfPKs;
+ SBlockCol primaryBlockCols[TD_MAX_PK_COLS];
};
struct SDelFile {
@@ -942,34 +935,7 @@ static FORCE_INLINE int32_t tsdbKeyCmprFn(const void *p1, const void *p2) {
// #define SL_NODE_FORWARD(n, l) ((n)->forwards[l])
// #define SL_NODE_BACKWARD(n, l) ((n)->forwards[(n)->level + (l)])
-static FORCE_INLINE TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) {
- if (pIter == NULL) return NULL;
-
- if (pIter->pRow) {
- return pIter->pRow;
- }
-
- if (pIter->backward) {
- if (pIter->pNode == pIter->pTbData->sl.pHead) {
- return NULL;
- }
- } else {
- if (pIter->pNode == pIter->pTbData->sl.pTail) {
- return NULL;
- }
- }
-
- pIter->pRow = &pIter->row;
- if (pIter->pNode->flag == TSDBROW_ROW_FMT) {
- pIter->row = tsdbRowFromTSRow(pIter->pNode->version, pIter->pNode->pData);
- } else if (pIter->pNode->flag == TSDBROW_COL_FMT) {
- pIter->row = tsdbRowFromBlockData(pIter->pNode->pData, pIter->pNode->iRow);
- } else {
- ASSERT(0);
- }
-
- return pIter->pRow;
-}
+TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter);
typedef struct {
int64_t suid;
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index e610161544..9fdb4993bd 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -106,7 +106,7 @@ typedef struct SQueryNode SQueryNode;
#define VND_INFO_FNAME "vnode.json"
#define VND_INFO_FNAME_TMP "vnode_tmp.json"
-#define VNODE_METRIC_SQL_COUNT "taos_sql_req:count"
+#define VNODE_METRIC_SQL_COUNT "taosd_sql_req:count"
#define VNODE_METRIC_TAG_NAME_SQL_TYPE "sql_type"
#define VNODE_METRIC_TAG_NAME_CLUSTER_ID "cluster_id"
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index 011e62cb89..47900d540c 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -917,6 +917,22 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
}
}
+int32_t handleStep2Async(SStreamTask* pStreamTask, void* param) {
+ STQ* pTq = param;
+
+ SStreamMeta* pMeta = pStreamTask->pMeta;
+ STaskId hId = pStreamTask->hTaskInfo.id;
+ SStreamTask* pTask = streamMetaAcquireTask(pStreamTask->pMeta, hId.streamId, hId.taskId);
+ if (pTask == NULL) {
+ // todo handle error
+ }
+
+ doStartFillhistoryStep2(pTask, pStreamTask, pTq);
+
+ streamMetaReleaseTask(pMeta, pTask);
+ return 0;
+}
+
// this function should be executed by only one thread, so we set an sentinel to protect this function
int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
SStreamScanHistoryReq* pReq = (SStreamScanHistoryReq*)pMsg->pCont;
@@ -1007,37 +1023,27 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
// the following procedure should be executed, no matter status is stop/pause or not
tqDebug("s-task:%s scan-history(step 1) ended, elapsed time:%.2fs", id, pTask->execInfo.step1El);
- if (pTask->info.fillHistory) {
- SStreamTask* pStreamTask = NULL;
+ ASSERT(pTask->info.fillHistory == 1);
- // 1. get the related stream task
- pStreamTask = streamMetaAcquireTask(pMeta, pTask->streamTaskId.streamId, pTask->streamTaskId.taskId);
- if (pStreamTask == NULL) {
- tqError("failed to find s-task:0x%" PRIx64 ", it may have been destroyed, drop related fill-history task:%s",
- pTask->streamTaskId.taskId, pTask->id.idStr);
+ // 1. get the related stream task
+ SStreamTask* pStreamTask = streamMetaAcquireTask(pMeta, pTask->streamTaskId.streamId, pTask->streamTaskId.taskId);
+ if (pStreamTask == NULL) {
+ tqError("failed to find s-task:0x%" PRIx64 ", it may have been destroyed, drop related fill-history task:%s",
+ pTask->streamTaskId.taskId, pTask->id.idStr);
tqDebug("s-task:%s fill-history task set status to be dropping and drop it", id);
streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0);
- atomic_store_32(&pTask->status.inScanHistorySentinel, 0);
- streamMetaReleaseTask(pMeta, pTask);
- return -1;
- }
-
- ASSERT(pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE);
-
- code = streamTaskHandleEvent(pStreamTask->status.pSM, TASK_EVENT_HALT);
- if (code == TSDB_CODE_SUCCESS) {
- doStartFillhistoryStep2(pTask, pStreamTask, pTq);
- } else {
- tqError("s-task:%s failed to halt s-task:%s, not launch step2", id, pStreamTask->id.idStr);
- }
-
- streamMetaReleaseTask(pMeta, pStreamTask);
- } else {
- ASSERT(0);
+ atomic_store_32(&pTask->status.inScanHistorySentinel, 0);
+ streamMetaReleaseTask(pMeta, pTask);
+ return -1;
}
+ ASSERT(pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE);
+ code = streamTaskHandleEventAsync(pStreamTask->status.pSM, TASK_EVENT_HALT, handleStep2Async, pTq);
+
+ streamMetaReleaseTask(pMeta, pStreamTask);
+
atomic_store_32(&pTask->status.inScanHistorySentinel, 0);
streamMetaReleaseTask(pMeta, pTask);
return code;
diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c
index 7a737fbb5d..a99caa3323 100644
--- a/source/dnode/vnode/src/tq/tqRead.c
+++ b/source/dnode/vnode/src/tq/tqRead.c
@@ -368,24 +368,11 @@ int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, con
}
}
-// todo ignore the error in wal?
bool tqNextBlockInWal(STqReader* pReader, const char* id, int sourceExcluded) {
SWalReader* pWalReader = pReader->pWalReader;
- SSDataBlock* pDataBlock = NULL;
uint64_t st = taosGetTimestampMs();
while (1) {
- // try next message in wal file
- if (walNextValidMsg(pWalReader) < 0) {
- return false;
- }
-
- void* pBody = POINTER_SHIFT(pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg));
- int32_t bodyLen = pWalReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg);
- int64_t ver = pWalReader->pHead->head.version;
-
- tqReaderSetSubmitMsg(pReader, pBody, bodyLen, ver);
- pReader->nextBlk = 0;
int32_t numOfBlocks = taosArrayGetSize(pReader->submit.aSubmitTbData);
while (pReader->nextBlk < numOfBlocks) {
tqTrace("tq reader next data block %d/%d, len:%d %" PRId64, pReader->nextBlk, numOfBlocks, pReader->msg.msgLen,
@@ -400,33 +387,32 @@ bool tqNextBlockInWal(STqReader* pReader, const char* id, int sourceExcluded) {
tqTrace("tq reader return submit block, uid:%" PRId64, pSubmitTbData->uid);
SSDataBlock* pRes = NULL;
int32_t code = tqRetrieveDataBlock(pReader, &pRes, NULL);
- if (code == TSDB_CODE_SUCCESS && pRes->info.rows > 0) {
- if (pDataBlock == NULL) {
- pDataBlock = createOneDataBlock(pRes, true);
- } else {
- blockDataMerge(pDataBlock, pRes);
- }
+ if (code == TSDB_CODE_SUCCESS) {
+ return true;
}
} else {
pReader->nextBlk += 1;
tqTrace("tq reader discard submit block, uid:%" PRId64 ", continue", pSubmitTbData->uid);
}
}
+
tDestroySubmitReq(&pReader->submit, TSDB_MSG_FLG_DECODE);
pReader->msg.msgStr = NULL;
- if (pDataBlock != NULL) {
- blockDataCleanup(pReader->pResBlock);
- copyDataBlock(pReader->pResBlock, pDataBlock);
- blockDataDestroy(pDataBlock);
- return true;
- } else {
- qTrace("stream scan return empty, all %d submit blocks consumed, %s", numOfBlocks, id);
- }
-
if (taosGetTimestampMs() - st > 1000) {
return false;
}
+
+ // try next message in wal file
+ if (walNextValidMsg(pWalReader) < 0) {
+ return false;
+ }
+
+ void* pBody = POINTER_SHIFT(pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg));
+ int32_t bodyLen = pWalReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg);
+ int64_t ver = pWalReader->pHead->head.version;
+ tqReaderSetSubmitMsg(pReader, pBody, bodyLen, ver);
+ pReader->nextBlk = 0;
}
}
@@ -592,7 +578,7 @@ static int32_t buildResSDataBlock(SSDataBlock* pBlock, SSchemaWrapper* pSchema,
static int32_t doSetVal(SColumnInfoData* pColumnInfoData, int32_t rowIndex, SColVal* pColVal) {
int32_t code = TSDB_CODE_SUCCESS;
- if (IS_STR_DATA_TYPE(pColVal->type)) {
+ if (IS_STR_DATA_TYPE(pColVal->value.type)) {
char val[65535 + 2] = {0};
if (COL_VAL_IS_VALUE(pColVal)) {
if (pColVal->value.pData != NULL) {
diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c
index 9ff4e3ba62..a7dbdd9a48 100644
--- a/source/dnode/vnode/src/tq/tqSink.c
+++ b/source/dnode/vnode/src/tq/tqSink.c
@@ -567,13 +567,14 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
void* colData = colDataGetData(pColData, j);
if (IS_STR_DATA_TYPE(pCol->type)) {
// address copy, no value
- SValue sv = (SValue){.nData = varDataLen(colData), .pData = (uint8_t*)varDataVal(colData)};
- SColVal cv = COL_VAL_VALUE(pCol->colId, pCol->type, sv);
+ SValue sv =
+ (SValue){.type = pCol->type, .nData = varDataLen(colData), .pData = (uint8_t*)varDataVal(colData)};
+ SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
taosArrayPush(pVals, &cv);
} else {
- SValue sv;
+ SValue sv = {.type = pCol->type};
memcpy(&sv.val, colData, tDataTypes[pCol->type].bytes);
- SColVal cv = COL_VAL_VALUE(pCol->colId, pCol->type, sv);
+ SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
taosArrayPush(pVals, &cv);
}
dataIndex++;
diff --git a/source/dnode/vnode/src/tq/tqStreamTask.c b/source/dnode/vnode/src/tq/tqStreamTask.c
index 280c110711..73508202d9 100644
--- a/source/dnode/vnode/src/tq/tqStreamTask.c
+++ b/source/dnode/vnode/src/tq/tqStreamTask.c
@@ -28,8 +28,8 @@ static int32_t tqScanWalInFuture(STQ* pTq, int32_t numOfTasks, int32_t idleDurat
// extract data blocks(submit/delete) from WAL, and add them into the input queue for all the sources tasks.
int32_t tqScanWal(STQ* pTq) {
- int32_t vgId = TD_VID(pTq->pVnode);
SStreamMeta* pMeta = pTq->pStreamMeta;
+ int32_t vgId = pMeta->vgId;
int64_t st = taosGetTimestampMs();
tqDebug("vgId:%d continue to check if data in wal are available, scanCounter:%d", vgId, pMeta->scanInfo.scanCounter);
diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c
index dad1211326..6029575e2c 100644
--- a/source/dnode/vnode/src/tq/tqUtil.c
+++ b/source/dnode/vnode/src/tq/tqUtil.c
@@ -263,8 +263,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
} else if (pHead->msgType == TDMT_VND_CREATE_STB || pHead->msgType == TDMT_VND_ALTER_STB) {
PROCESS_EXCLUDED_MSG(SVCreateStbReq, tDecodeSVCreateStbReq)
} else if (pHead->msgType == TDMT_VND_DELETE) {
- fetchVer++;
- continue;
+ PROCESS_EXCLUDED_MSG(SDeleteRes, tDecodeDeleteRes)
}
}
diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c
index a2d45062b9..9bfdd70477 100644
--- a/source/dnode/vnode/src/tqCommon/tqCommon.c
+++ b/source/dnode/vnode/src/tqCommon/tqCommon.c
@@ -142,8 +142,10 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM
if (HAS_RELATED_FILLHISTORY_TASK(pTask)) {
ppHTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &pTask->hTaskInfo.id, sizeof(pTask->hTaskInfo.id));
if (ppHTask == NULL || *ppHTask == NULL) {
- tqError("vgId:%d failed to acquire fill-history task:0x%x when handling update, it may have been dropped already",
- vgId, req.taskId);
+ tqError(
+ "vgId:%d failed to acquire fill-history task:0x%x when handling update, may have been dropped already, rel "
+ "stream task:0x%x",
+ vgId, (uint32_t)pTask->hTaskInfo.id.taskId, req.taskId);
CLEAR_RELATED_FILLHISTORY_TASK(pTask);
} else {
tqDebug("s-task:%s fill-history task update nodeEp along with stream task", (*ppHTask)->id.idStr);
@@ -612,23 +614,35 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve
int32_t tqStreamTaskProcessDropReq(SStreamMeta* pMeta, char* msg, int32_t msgLen) {
SVDropStreamTaskReq* pReq = (SVDropStreamTaskReq*)msg;
+ int32_t vgId = pMeta->vgId;
+ STaskId hTaskId = {0};
- int32_t vgId = pMeta->vgId;
tqDebug("vgId:%d receive msg to drop s-task:0x%x", vgId, pReq->taskId);
- SStreamTask* pTask = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->taskId);
- if (pTask != NULL) {
- // drop the related fill-history task firstly
+ streamMetaWLock(pMeta);
+
+ STaskId id = {.streamId = pReq->streamId, .taskId = pReq->taskId};
+ SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id));
+ if ((ppTask != NULL) && ((*ppTask) != NULL)) {
+ streamMetaAcquireOneTask(*ppTask);
+ SStreamTask* pTask = *ppTask;
+
if (HAS_RELATED_FILLHISTORY_TASK(pTask)) {
- STaskId* pHTaskId = &pTask->hTaskInfo.id;
- streamMetaUnregisterTask(pMeta, pHTaskId->streamId, pHTaskId->taskId);
- tqDebug("s-task:0x%x vgId:%d drop fill-history task:0x%x firstly", pReq->taskId, vgId,
- (int32_t)pHTaskId->taskId);
+ hTaskId.streamId = pTask->hTaskInfo.id.streamId;
+ hTaskId.taskId = pTask->hTaskInfo.id.taskId;
}
+
+ streamTaskClearHTaskAttr(pTask, pReq->resetRelHalt);
streamMetaReleaseTask(pMeta, pTask);
}
- streamTaskClearHTaskAttr(pTask, pReq->resetRelHalt, true);
+ streamMetaWUnLock(pMeta);
+
+ // drop the related fill-history task firstly
+ if (hTaskId.taskId != 0 && hTaskId.streamId != 0) {
+ streamMetaUnregisterTask(pMeta, hTaskId.streamId, hTaskId.taskId);
+ tqDebug("s-task:0x%x vgId:%d drop rel fill-history task:0x%x firstly", pReq->taskId, vgId, (int32_t)hTaskId.taskId);
+ }
// drop the stream task now
streamMetaUnregisterTask(pMeta, pReq->streamId, pReq->taskId);
@@ -865,7 +879,7 @@ int32_t tqStreamTaskProcessTaskPauseReq(SStreamMeta* pMeta, char* pMsg){
pHistoryTask = streamMetaAcquireTask(pMeta, pTask->hTaskInfo.id.streamId, pTask->hTaskInfo.id.taskId);
if (pHistoryTask == NULL) {
tqError("vgId:%d process pause req, failed to acquire fill-history task:0x%" PRIx64
- ", it may have been dropped already",
+ ", it may have been dropped already",
pMeta->vgId, pTask->hTaskInfo.id.taskId);
streamMetaReleaseTask(pMeta, pTask);
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index 1ef2a451a7..5c6c6c3e9d 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -329,7 +329,7 @@ static SLastCol *tsdbCacheDeserialize(char const *value) {
SLastCol *pLastCol = (SLastCol *)value;
SColVal *pColVal = &pLastCol->colVal;
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
if (pColVal->value.nData > 0) {
pColVal->value.pData = (char *)value + sizeof(*pLastCol);
} else {
@@ -343,13 +343,13 @@ static SLastCol *tsdbCacheDeserialize(char const *value) {
static void tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size) {
SColVal *pColVal = &pLastCol->colVal;
size_t length = sizeof(*pLastCol);
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
length += pColVal->value.nData;
}
*value = taosMemoryMalloc(length);
*(SLastCol *)(*value) = *pLastCol;
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
uint8_t *pVal = pColVal->value.pData;
SColVal *pDColVal = &((SLastCol *)(*value))->colVal;
pDColVal->value.pData = *value + sizeof(*pLastCol);
@@ -434,7 +434,7 @@ int32_t tsdbCacheCommit(STsdb *pTsdb) {
}
static void reallocVarData(SColVal *pColVal) {
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
uint8_t *pVal = pColVal->value.pData;
if (pColVal->value.nData > 0) {
pColVal->value.pData = taosMemoryMalloc(pColVal->value.nData);
@@ -452,7 +452,7 @@ static void tsdbCacheDeleter(const void *key, size_t klen, void *value, void *ud
tsdbCachePutBatch(pLastCol, key, klen, (SCacheFlushState *)ud);
}
- if (IS_VAR_DATA_TYPE(pLastCol->colVal.type) /* && pLastCol->colVal.value.nData > 0*/) {
+ if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type) /* && pLastCol->colVal.value.nData > 0*/) {
taosMemoryFree(pLastCol->colVal.value.pData);
}
@@ -473,7 +473,7 @@ static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, i
reallocVarData(&pLastCol->colVal);
size_t charge = sizeof(*pLastCol);
- if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) {
+ if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) {
charge += pLastCol->colVal.value.nData;
}
@@ -789,25 +789,6 @@ int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_
return code;
}
-static SLastCol *tsdbCacheLookup(STsdb *pTsdb, tb_uid_t uid, int16_t cid, int8_t ltype) {
- SLastCol *pLastCol = NULL;
-
- char *err = NULL;
- size_t vlen = 0;
- SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid};
- size_t klen = ROCKS_KEY_LEN;
- char *value = NULL;
- value = rocksdb_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, (char *)key, klen, &vlen, &err);
- if (NULL != err) {
- tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err);
- rocksdb_free(err);
- }
-
- pLastCol = tsdbCacheDeserialize(value);
-
- return pLastCol;
-}
-
typedef struct {
int idx;
SLastKey key;
@@ -858,12 +839,12 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
if (pLastCol->ts <= keyTs) {
uint8_t *pVal = NULL;
int nData = pLastCol->colVal.value.nData;
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
pVal = pLastCol->colVal.value.pData;
}
pLastCol->ts = keyTs;
pLastCol->colVal = *pColVal;
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
if (nData < pColVal->value.nData) {
taosMemoryFree(pVal);
pLastCol->colVal.value.pData = taosMemoryCalloc(1, pColVal->value.nData);
@@ -897,12 +878,12 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
if (pLastCol->ts <= keyTs) {
uint8_t *pVal = NULL;
int nData = pLastCol->colVal.value.nData;
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
pVal = pLastCol->colVal.value.pData;
}
pLastCol->ts = keyTs;
pLastCol->colVal = *pColVal;
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
if (nData < pColVal->value.nData) {
taosMemoryFree(pVal);
pLastCol->colVal.value.pData = taosMemoryCalloc(1, pColVal->value.nData);
@@ -981,7 +962,7 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
reallocVarData(&pLastCol->colVal);
size_t charge = sizeof(*pLastCol);
- if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) {
+ if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) {
charge += pLastCol->colVal.value.nData;
}
@@ -1013,7 +994,7 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
reallocVarData(&pLastCol->colVal);
size_t charge = sizeof(*pLastCol);
- if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) {
+ if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) {
charge += pLastCol->colVal.value.nData;
}
@@ -1052,6 +1033,25 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr, int16_t *aCols,
int nCols, int16_t *slotIds);
#ifdef BUILD_NO_CALL
+static SLastCol *tsdbCacheLookup(STsdb *pTsdb, tb_uid_t uid, int16_t cid, int8_t ltype) {
+ SLastCol *pLastCol = NULL;
+
+ char *err = NULL;
+ size_t vlen = 0;
+ SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid};
+ size_t klen = ROCKS_KEY_LEN;
+ char *value = NULL;
+ value = rocksdb_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, (char *)key, klen, &vlen, &err);
+ if (NULL != err) {
+ tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err);
+ rocksdb_free(err);
+ }
+
+ pLastCol = tsdbCacheDeserialize(value);
+
+ return pLastCol;
+}
+
int32_t tsdbCacheGetSlow(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int8_t ltype) {
rocksdb_writebatch_t *wb = NULL;
int32_t code = 0;
@@ -1233,10 +1233,10 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
int16_t *lastSlotIds = taosMemoryMalloc(num_keys * sizeof(int16_t));
int16_t *lastrowColIds = taosMemoryMalloc(num_keys * sizeof(int16_t));
int16_t *lastrowSlotIds = taosMemoryMalloc(num_keys * sizeof(int16_t));
- SArray* lastTmpColArray = NULL;
- SArray* lastTmpIndexArray = NULL;
- SArray* lastrowTmpColArray = NULL;
- SArray* lastrowTmpIndexArray = NULL;
+ SArray *lastTmpColArray = NULL;
+ SArray *lastTmpIndexArray = NULL;
+ SArray *lastrowTmpColArray = NULL;
+ SArray *lastrowTmpIndexArray = NULL;
int lastIndex = 0;
int lastrowIndex = 0;
@@ -1245,7 +1245,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
SIdxKey *idxKey = taosArrayGet(remainCols, i);
slotIds[i] = pr->pSlotIds[idxKey->idx];
if (idxKey->key.ltype == CACHESCAN_RETRIEVE_LAST >> 3) {
- if(NULL == lastTmpIndexArray) {
+ if (NULL == lastTmpIndexArray) {
lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
}
taosArrayPush(lastTmpIndexArray, &(i));
@@ -1253,7 +1253,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
lastSlotIds[lastIndex] = pr->pSlotIds[idxKey->idx];
lastIndex++;
} else {
- if(NULL == lastrowTmpIndexArray) {
+ if (NULL == lastrowTmpIndexArray) {
lastrowTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
}
taosArrayPush(lastrowTmpIndexArray, &(i));
@@ -1265,17 +1265,18 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
pTmpColArray = taosArrayInit(lastIndex + lastrowIndex, sizeof(SLastCol));
- if(lastTmpIndexArray != NULL) {
+ if (lastTmpIndexArray != NULL) {
mergeLastCid(uid, pTsdb, &lastTmpColArray, pr, lastColIds, lastIndex, lastSlotIds);
- for(int i = 0; i < taosArrayGetSize(lastTmpColArray); i++) {
- taosArrayInsert(pTmpColArray, *(int32_t*)taosArrayGet(lastTmpIndexArray, i), taosArrayGet(lastTmpColArray, i));
+ for (int i = 0; i < taosArrayGetSize(lastTmpColArray); i++) {
+ taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastTmpIndexArray, i), taosArrayGet(lastTmpColArray, i));
}
}
- if(lastrowTmpIndexArray != NULL) {
+ if (lastrowTmpIndexArray != NULL) {
mergeLastRowCid(uid, pTsdb, &lastrowTmpColArray, pr, lastrowColIds, lastrowIndex, lastrowSlotIds);
- for(int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
- taosArrayInsert(pTmpColArray, *(int32_t*)taosArrayGet(lastrowTmpIndexArray, i), taosArrayGet(lastrowTmpColArray, i));
+ for (int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
+ taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastrowTmpIndexArray, i),
+ taosArrayGet(lastrowTmpColArray, i));
}
}
@@ -1309,7 +1310,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
reallocVarData(&pLastCol->colVal);
size_t charge = sizeof(*pLastCol);
- if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) {
+ if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) {
charge += pLastCol->colVal.value.nData;
}
@@ -1393,7 +1394,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
reallocVarData(&pLastCol->colVal);
size_t charge = sizeof(*pLastCol);
- if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) {
+ if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) {
charge += pLastCol->colVal.value.nData;
}
@@ -2174,7 +2175,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
STombRecord record = {0};
bool finished = false;
- for (int32_t k = 0; k < TARRAY2_SIZE(block.suid); ++k) {
+ for (int32_t k = 0; k < TOMB_BLOCK_SIZE(&block); ++k) {
code = tTombBlockGet(&block, k, &record);
if (code != TSDB_CODE_SUCCESS) {
finished = true;
@@ -2550,7 +2551,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
goto _err;
}
- state->iBrinRecord = BRIN_BLOCK_SIZE(&state->brinBlock) - 1;
+ state->iBrinRecord = state->brinBlock.numOfRecords - 1;
state->state = SFSNEXTROW_BRINBLOCK;
}
@@ -3184,14 +3185,14 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
if (slotIds[iCol] == 0) {
STColumn *pTColumn = &pTSchema->columns[0];
- *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = rowTs});
+ *pColVal = COL_VAL_VALUE(pTColumn->colId, ((SValue){.type = pTColumn->type, .val = rowTs}));
taosArraySet(pColArray, 0, &(SLastCol){.ts = rowTs, .colVal = *pColVal});
continue;
}
tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal);
*pCol = (SLastCol){.ts = rowTs, .colVal = *pColVal};
- if (IS_VAR_DATA_TYPE(pColVal->type) /*&& pColVal->value.nData > 0*/) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type) /*&& pColVal->value.nData > 0*/) {
if (pColVal->value.nData > 0) {
pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData);
if (pCol->colVal.value.pData == NULL) {
@@ -3241,7 +3242,7 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal);
if (!COL_VAL_IS_VALUE(tColVal) && COL_VAL_IS_VALUE(pColVal)) {
SLastCol lastCol = {.ts = rowTs, .colVal = *pColVal};
- if (IS_VAR_DATA_TYPE(pColVal->type) /* && pColVal->value.nData > 0 */) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type) /* && pColVal->value.nData > 0 */) {
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pColArray, iCol);
taosMemoryFree(pLastCol->colVal.value.pData);
@@ -3363,14 +3364,14 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
if (slotIds[iCol] == 0) {
STColumn *pTColumn = &pTSchema->columns[0];
- *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = rowTs});
+ *pColVal = COL_VAL_VALUE(pTColumn->colId, ((SValue){.type = pTColumn->type, .val = rowTs}));
taosArraySet(pColArray, 0, &(SLastCol){.ts = rowTs, .colVal = *pColVal});
continue;
}
tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal);
*pCol = (SLastCol){.ts = rowTs, .colVal = *pColVal};
- if (IS_VAR_DATA_TYPE(pColVal->type) /*&& pColVal->value.nData > 0*/) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type) /*&& pColVal->value.nData > 0*/) {
if (pColVal->value.nData > 0) {
pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData);
if (pCol->colVal.value.pData == NULL) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
index d05e184fd8..b7fe92c2c5 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
@@ -24,7 +24,7 @@
#define HASTYPE(_type, _t) (((_type) & (_t)) == (_t))
static void setFirstLastResColToNull(SColumnInfoData* pCol, int32_t row) {
- char *buf = taosMemoryCalloc(1, pCol->info.bytes);
+ char* buf = taosMemoryCalloc(1, pCol->info.bytes);
SFirstLastRes* pRes = (SFirstLastRes*)((char*)buf + VARSTR_HEADER_SIZE);
pRes->bytes = 0;
pRes->hasResult = true;
@@ -36,10 +36,10 @@ static void setFirstLastResColToNull(SColumnInfoData* pCol, int32_t row) {
static void saveOneRowForLastRaw(SLastCol* pColVal, SCacheRowsReader* pReader, const int32_t slotId,
SColumnInfoData* pColInfoData, int32_t numOfRows) {
- SColVal* pVal = &pColVal->colVal;
+ SColVal* pVal = &pColVal->colVal;
// allNullRow = false;
- if (IS_VAR_DATA_TYPE(pColVal->colVal.type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) {
if (!COL_VAL_IS_VALUE(&pColVal->colVal)) {
colDataSetNULL(pColInfoData, numOfRows);
} else {
@@ -60,15 +60,14 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
// bool allNullRow = true;
if (HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST)) {
-
- uint64_t ts = TSKEY_MIN;
+ uint64_t ts = TSKEY_MIN;
SFirstLastRes* p = NULL;
- col_id_t colId = -1;
+ col_id_t colId = -1;
SArray* funcTypeBlockArray = taosArrayInit(pReader->numOfCols, sizeof(int32_t));
for (int32_t i = 0; i < pReader->numOfCols; ++i) {
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotIds[i]);
- int32_t funcType = FUNCTION_TYPE_CACHE_LAST;
+ int32_t funcType = FUNCTION_TYPE_CACHE_LAST;
if (pReader->pFuncTypeList != NULL && taosArrayGetSize(pReader->pFuncTypeList) > i) {
funcType = *(int32_t*)taosArrayGet(pReader->pFuncTypeList, i);
}
@@ -98,13 +97,13 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal);
// allNullRow = p->isNull & allNullRow;
if (!p->isNull) {
- if (IS_VAR_DATA_TYPE(pColVal->colVal.type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) {
varDataSetLen(p->buf, pColVal->colVal.value.nData);
memcpy(varDataVal(p->buf), pColVal->colVal.value.pData, pColVal->colVal.value.nData);
p->bytes = pColVal->colVal.value.nData + VARSTR_HEADER_SIZE; // binary needs to plus the header size
} else {
- memcpy(p->buf, &pColVal->colVal.value, pReader->pSchema->columns[slotId].bytes);
+ memcpy(p->buf, &pColVal->colVal.value.val, pReader->pSchema->columns[slotId].bytes);
p->bytes = pReader->pSchema->columns[slotId].bytes;
}
}
@@ -117,7 +116,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
for (int32_t idx = 0; idx < taosArrayGetSize(pBlock->pDataBlock); ++idx) {
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, idx);
if (idx < funcTypeBlockArray->size) {
- int32_t funcType = *(int32_t*)taosArrayGet(funcTypeBlockArray, idx);
+ int32_t funcType = *(int32_t*)taosArrayGet(funcTypeBlockArray, idx);
if (FUNCTION_TYPE_CACHE_LAST_ROW == funcType) {
continue;
}
@@ -146,7 +145,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
for (int32_t i = 0; i < pReader->numOfCols; ++i) {
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotIds[i]);
- int32_t slotId = slotIds[i];
+ int32_t slotId = slotIds[i];
if (slotId == -1) {
colDataSetNULL(pColInfoData, numOfRows);
continue;
@@ -315,7 +314,7 @@ void* tsdbCacherowsReaderClose(void* pReader) {
static void freeItem(void* pItem) {
SLastCol* pCol = (SLastCol*)pItem;
- if (IS_VAR_DATA_TYPE(pCol->colVal.type) && pCol->colVal.value.pData) {
+ if (IS_VAR_DATA_TYPE(pCol->colVal.value.type) && pCol->colVal.value.pData) {
taosMemoryFree(pCol->colVal.value.pData);
}
}
@@ -388,14 +387,14 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
}
for (int32_t i = 0; i < pr->numOfCols; ++i) {
- int32_t slotId = slotIds[i];
+ int32_t slotId = slotIds[i];
if (slotId == -1) {
- SLastCol p = {.ts = INT64_MIN, .colVal.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL};
+ SLastCol p = {.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL};
taosArrayPush(pLastCols, &p);
continue;
}
struct STColumn* pCol = &pr->pSchema->columns[slotId];
- SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type, .colVal.flag = CV_FLAG_NULL};
+ SLastCol p = {.ts = INT64_MIN, .colVal.value.type = pCol->type, .colVal.flag = CV_FLAG_NULL};
if (IS_VAR_DATA_TYPE(pCol->type)) {
p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char));
@@ -427,7 +426,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
if (!COL_VAL_IS_VALUE(&p->colVal)) {
hasNotNullRow = false;
}
- // For all of cols is null, the last null col of last table will be save
+ // For all of cols is null, the last null col of last table will be save
if (i != pr->numOfTables - 1 || k != pr->numOfCols - 1 || hasRes) {
continue;
}
@@ -447,7 +446,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
singleTableLastTs = pColVal->ts;
}
- if (!IS_VAR_DATA_TYPE(pColVal->colVal.type)) {
+ if (!IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) {
p->colVal = pColVal->colVal;
} else {
if (COL_VAL_IS_VALUE(&pColVal->colVal)) {
@@ -455,7 +454,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
}
p->colVal.value.nData = pColVal->colVal.value.nData;
- p->colVal.type = pColVal->colVal.type;
+ p->colVal.value.type = pColVal->colVal.value.type;
p->colVal.flag = pColVal->colVal.flag;
p->colVal.cid = pColVal->colVal.cid;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c
index 37413ef920..f9a464b3bf 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCommit.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c
@@ -31,7 +31,7 @@ int32_t tRowInfoCmprFn(const void *p1, const void *p2) {
return 1;
}
- return tsdbRowCmprFn(&pInfo1->row, &pInfo2->row);
+ return tsdbRowCompare(&pInfo1->row, &pInfo2->row);
}
int32_t tsdbBegin(STsdb *pTsdb) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c
index 32abbfdb3b..4c38cabcf3 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c
@@ -300,8 +300,11 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) {
// mem data iter
config.type = TSDB_ITER_TYPE_MEMT;
config.memt = committer->tsdb->imem;
- config.from->ts = committer->ctx->minKey;
config.from->version = VERSION_MIN;
+ config.from->key = (SRowKey){
+ .ts = committer->ctx->minKey,
+ .numOfPKs = 0, // TODO: support multiple primary keys
+ };
code = tsdbIterOpen(&config, &iter);
TSDB_CHECK_CODE(code, lino, _exit);
diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
index 9afa4bbcf1..17b420e83a 100644
--- a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
+++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
@@ -19,7 +19,8 @@
struct SDataFileReader {
SDataFileReaderConfig config[1];
- uint8_t *bufArr[5];
+ SBuffer local[10];
+ SBuffer *buffers;
struct {
bool headFooterLoaded;
@@ -89,9 +90,14 @@ int32_t tsdbDataFileReaderOpen(const char *fname[], const SDataFileReaderConfig
TSDB_CHECK_CODE(code, lino, _exit);
}
+ for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->local); i++) {
+ tBufferInit(reader[0]->local + i);
+ }
+
reader[0]->config[0] = config[0];
- if (reader[0]->config->bufArr == NULL) {
- reader[0]->config->bufArr = reader[0]->bufArr;
+ reader[0]->buffers = config->buffers;
+ if (reader[0]->buffers == NULL) {
+ reader[0]->buffers = reader[0]->local;
}
if (fname) {
@@ -125,19 +131,14 @@ int32_t tsdbDataFileReaderClose(SDataFileReader **reader) {
TARRAY2_DESTROY(reader[0]->tombBlkArray, NULL);
TARRAY2_DESTROY(reader[0]->brinBlkArray, NULL);
-#if 0
- TARRAY2_DESTROY(reader[0]->dataBlkArray, NULL);
- TARRAY2_DESTROY(reader[0]->blockIdxArray, NULL);
-#endif
-
for (int32_t i = 0; i < TSDB_FTYPE_MAX; ++i) {
if (reader[0]->fd[i]) {
tsdbCloseFile(&reader[0]->fd[i]);
}
}
- for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->bufArr); ++i) {
- tFree(reader[0]->bufArr[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->local); ++i) {
+ tBufferDestroy(reader[0]->local + i);
}
taosMemoryFree(reader[0]);
@@ -188,37 +189,76 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
int32_t code = 0;
int32_t lino = 0;
- code = tRealloc(&reader->config->bufArr[0], brinBlk->dp->size);
+ SBuffer *buffer = reader->buffers + 0;
+ SBuffer *assist = reader->buffers + 1;
+
+ // load data
+ tBufferClear(buffer);
+ code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_HEAD], brinBlk->dp->offset, brinBlk->dp->size, buffer, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- code =
- tsdbReadFile(reader->fd[TSDB_FTYPE_HEAD], brinBlk->dp->offset, reader->config->bufArr[0], brinBlk->dp->size, 0);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- int32_t size = 0;
+ // decode brin block
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer);
tBrinBlockClear(brinBlock);
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr1); i++) {
- code = tsdbDecmprData(reader->config->bufArr[0] + size, brinBlk->size[i], TSDB_DATA_TYPE_BIGINT, brinBlk->cmprAlg,
- &reader->config->bufArr[1], brinBlk->numRec * sizeof(int64_t), &reader->config->bufArr[2]);
+ brinBlock->numOfPKs = brinBlk->numOfPKs;
+ brinBlock->numOfRecords = brinBlk->numRec;
+ for (int32_t i = 0; i < 10; i++) { // int64_t
+ SCompressInfo cinfo = {
+ .cmprAlg = brinBlk->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .compressedSize = brinBlk->size[i],
+ .originalSize = brinBlk->numRec * sizeof(int64_t),
+ };
+ code = tDecompressDataToBuffer(BR_PTR(&br), &cinfo, brinBlock->buffers + i, assist);
TSDB_CHECK_CODE(code, lino, _exit);
-
- code = TARRAY2_APPEND_BATCH(&brinBlock->dataArr1[i], reader->config->bufArr[1], brinBlk->numRec);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- size += brinBlk->size[i];
+ br.offset += brinBlk->size[i];
}
- for (int32_t i = 0, j = ARRAY_SIZE(brinBlock->dataArr1); i < ARRAY_SIZE(brinBlock->dataArr2); i++, j++) {
- code = tsdbDecmprData(reader->config->bufArr[0] + size, brinBlk->size[j], TSDB_DATA_TYPE_INT, brinBlk->cmprAlg,
- &reader->config->bufArr[1], brinBlk->numRec * sizeof(int32_t), &reader->config->bufArr[2]);
+ for (int32_t i = 10; i < 15; i++) { // int32_t
+ SCompressInfo cinfo = {
+ .cmprAlg = brinBlk->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_INT,
+ .compressedSize = brinBlk->size[i],
+ .originalSize = brinBlk->numRec * sizeof(int32_t),
+ };
+ code = tDecompressDataToBuffer(BR_PTR(&br), &cinfo, brinBlock->buffers + i, assist);
TSDB_CHECK_CODE(code, lino, _exit);
-
- code = TARRAY2_APPEND_BATCH(&brinBlock->dataArr2[i], reader->config->bufArr[1], brinBlk->numRec);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- size += brinBlk->size[j];
+ br.offset += brinBlk->size[i];
}
+ // primary keys
+ if (brinBlk->numOfPKs > 0) { // decode the primary keys
+ SValueColumnCompressInfo firstInfos[TD_MAX_PK_COLS];
+ SValueColumnCompressInfo lastInfos[TD_MAX_PK_COLS];
+
+ for (int32_t i = 0; i < brinBlk->numOfPKs; i++) {
+ code = tValueColumnCompressInfoDecode(&br, firstInfos + i);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+ for (int32_t i = 0; i < brinBlk->numOfPKs; i++) {
+ code = tValueColumnCompressInfoDecode(&br, lastInfos + i);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ for (int32_t i = 0; i < brinBlk->numOfPKs; i++) {
+ SValueColumnCompressInfo *info = firstInfos + i;
+
+ code = tValueColumnDecompress(BR_PTR(&br), info, brinBlock->firstKeyPKs + i, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ br.offset += (info->offsetCompressedSize + info->dataCompressedSize);
+ }
+
+ for (int32_t i = 0; i < brinBlk->numOfPKs; i++) {
+ SValueColumnCompressInfo *info = lastInfos + i;
+
+ code = tValueColumnDecompress(BR_PTR(&br), info, brinBlock->lastKeyPKs + i, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ br.offset += (info->offsetCompressedSize + info->dataCompressedSize);
+ }
+ }
+
+ ASSERT(br.offset == br.buffer->size);
+
_exit:
if (code) {
TSDB_ERROR_LOG(TD_VID(reader->config->tsdb->pVnode), lino, code);
@@ -226,19 +266,25 @@ _exit:
return code;
}
+extern int32_t tBlockDataDecompress(SBufferReader *br, SBlockData *blockData, SBuffer *assist);
+
int32_t tsdbDataFileReadBlockData(SDataFileReader *reader, const SBrinRecord *record, SBlockData *bData) {
int32_t code = 0;
int32_t lino = 0;
- code = tRealloc(&reader->config->bufArr[0], record->blockSize);
+ SBuffer *buffer = reader->buffers + 0;
+ SBuffer *assist = reader->buffers + 1;
+
+ // load data
+ tBufferClear(buffer);
+ code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, record->blockSize, buffer, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- code =
- tsdbReadFile(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, reader->config->bufArr[0], record->blockSize, 0);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tDecmprBlockData(reader->config->bufArr[0], record->blockSize, bData, &reader->config->bufArr[1]);
+ // decompress
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer);
+ code = tBlockDataDecompress(&br, bData, assist);
TSDB_CHECK_CODE(code, lino, _exit);
+ ASSERT(br.offset == buffer->size);
_exit:
if (code) {
@@ -252,138 +298,101 @@ int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRe
int32_t code = 0;
int32_t lino = 0;
- code = tBlockDataInit(bData, (TABLEID *)record, pTSchema, cids, ncid);
+ SDiskDataHdr hdr;
+ SBuffer *buffer0 = reader->buffers + 0;
+ SBuffer *buffer1 = reader->buffers + 1;
+ SBuffer *assist = reader->buffers + 2;
+
+ // load key part
+ tBufferClear(buffer0);
+ code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, record->blockKeySize, buffer0, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- // uid + version + tskey
- code = tRealloc(&reader->config->bufArr[0], record->blockKeySize);
+ // SDiskDataHdr
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0);
+ code = tGetDiskDataHdr(&br, &hdr);
TSDB_CHECK_CODE(code, lino, _exit);
- code = tsdbReadFile(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, reader->config->bufArr[0], record->blockKeySize,
- 0);
+ ASSERT(hdr.delimiter == TSDB_FILE_DLMT);
+
+ tBlockDataReset(bData);
+ bData->suid = hdr.suid;
+ bData->uid = hdr.uid;
+ bData->nRow = hdr.nRow;
+
+ // Key part
+ code = tBlockDataDecompressKeyPart(&hdr, &br, bData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ ASSERT(br.offset == buffer0->size);
+
+ bool loadExtra = false;
+ for (int i = 0; i < ncid; i++) {
+ if (tBlockDataGetColData(bData, cids[i]) == NULL) {
+ loadExtra = true;
+ break;
+ }
+ }
+
+ if (!loadExtra) {
+ goto _exit;
+ }
+
+ // load SBlockCol part
+ tBufferClear(buffer0);
+ code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset + record->blockKeySize, hdr.szBlkCol,
+ buffer0, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- // hdr
- SDiskDataHdr hdr[1];
- int32_t size = 0;
+ // load each column
+ SBlockCol blockCol = {
+ .cid = 0,
+ };
+ br = BUFFER_READER_INITIALIZER(0, buffer0);
+ for (int32_t i = 0; i < ncid; i++) {
+ int16_t cid = cids[i];
- size += tGetDiskDataHdr(reader->config->bufArr[0] + size, hdr);
+ if (tBlockDataGetColData(bData, cid)) { // already loaded
+ continue;
+ }
- ASSERT(hdr->delimiter == TSDB_FILE_DLMT);
- ASSERT(record->uid == hdr->uid);
+ while (cid > blockCol.cid) {
+ if (br.offset >= buffer0->size) {
+ blockCol.cid = INT16_MAX;
+ break;
+ }
- bData->nRow = hdr->nRow;
-
- // uid
- ASSERT(hdr->uid);
-
- // version
- code = tsdbDecmprData(reader->config->bufArr[0] + size, hdr->szVer, TSDB_DATA_TYPE_BIGINT, hdr->cmprAlg,
- (uint8_t **)&bData->aVersion, sizeof(int64_t) * hdr->nRow, &reader->config->bufArr[1]);
- TSDB_CHECK_CODE(code, lino, _exit);
- size += hdr->szVer;
-
- // ts
- code = tsdbDecmprData(reader->config->bufArr[0] + size, hdr->szKey, TSDB_DATA_TYPE_TIMESTAMP, hdr->cmprAlg,
- (uint8_t **)&bData->aTSKEY, sizeof(TSKEY) * hdr->nRow, &reader->config->bufArr[1]);
- TSDB_CHECK_CODE(code, lino, _exit);
- size += hdr->szKey;
-
- ASSERT(size == record->blockKeySize);
-
- // other columns
- if (bData->nColData > 0) {
- if (hdr->szBlkCol > 0) {
- code = tRealloc(&reader->config->bufArr[0], hdr->szBlkCol);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tsdbReadFile(reader->fd[TSDB_FTYPE_DATA], record->blockOffset + record->blockKeySize,
- reader->config->bufArr[0], hdr->szBlkCol, 0);
+ code = tGetBlockCol(&br, &blockCol);
TSDB_CHECK_CODE(code, lino, _exit);
}
- int64_t szHint = 0;
- if (bData->nColData > 3) {
- int64_t offset = 0;
- SBlockCol bc = {.cid = 0};
- SBlockCol *blockCol = &bc;
+ if (cid < blockCol.cid) {
+ const STColumn *tcol = tTSchemaSearchColumn(pTSchema, cid);
+ ASSERT(tcol);
+ SBlockCol none = {
+ .cid = cid,
+ .type = tcol->type,
+ .cflag = tcol->flags,
+ .flag = HAS_NONE,
+ .szOrigin = 0,
+ .szBitmap = 0,
+ .szOffset = 0,
+ .szValue = 0,
+ .offset = 0,
+ };
+ code = tBlockDataDecompressColData(&hdr, &none, &br, bData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ } else if (cid == blockCol.cid) {
+ // load from file
+ tBufferClear(buffer1);
+ code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA],
+ record->blockOffset + record->blockKeySize + hdr.szBlkCol + blockCol.offset,
+ blockCol.szBitmap + blockCol.szOffset + blockCol.szValue, buffer1, 0);
+ TSDB_CHECK_CODE(code, lino, _exit);
- size = 0;
- SColData *colData = tBlockDataGetColDataByIdx(bData, 0);
- while (blockCol && blockCol->cid < colData->cid) {
- if (size < hdr->szBlkCol) {
- size += tGetBlockCol(reader->config->bufArr[0] + size, blockCol);
- } else {
- ASSERT(size == hdr->szBlkCol);
- blockCol = NULL;
- }
- }
-
- if (blockCol && blockCol->flag == HAS_VALUE) {
- offset = blockCol->offset;
-
- SColData *colDataEnd = tBlockDataGetColDataByIdx(bData, bData->nColData - 1);
- while (blockCol && blockCol->cid < colDataEnd->cid) {
- if (size < hdr->szBlkCol) {
- size += tGetBlockCol(reader->config->bufArr[0] + size, blockCol);
- } else {
- ASSERT(size == hdr->szBlkCol);
- blockCol = NULL;
- }
- }
-
- if (blockCol && blockCol->flag == HAS_VALUE) {
- szHint = blockCol->offset + blockCol->szBitmap + blockCol->szOffset + blockCol->szValue - offset;
- }
- }
- }
-
- SBlockCol bc[1] = {{.cid = 0}};
- SBlockCol *blockCol = bc;
-
- size = 0;
- for (int32_t i = 0; i < bData->nColData; i++) {
- SColData *colData = tBlockDataGetColDataByIdx(bData, i);
-
- while (blockCol && blockCol->cid < colData->cid) {
- if (size < hdr->szBlkCol) {
- size += tGetBlockCol(reader->config->bufArr[0] + size, blockCol);
- } else {
- ASSERT(size == hdr->szBlkCol);
- blockCol = NULL;
- }
- }
-
- if (blockCol == NULL || blockCol->cid > colData->cid) {
- for (int32_t iRow = 0; iRow < hdr->nRow; iRow++) {
- code = tColDataAppendValue(colData, &COL_VAL_NONE(colData->cid, colData->type));
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- } else {
- ASSERT(blockCol->type == colData->type);
- ASSERT(blockCol->flag && blockCol->flag != HAS_NONE);
-
- if (blockCol->flag == HAS_NULL) {
- for (int32_t iRow = 0; iRow < hdr->nRow; iRow++) {
- code = tColDataAppendValue(colData, &COL_VAL_NULL(blockCol->cid, blockCol->type));
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- } else {
- int32_t size1 = blockCol->szBitmap + blockCol->szOffset + blockCol->szValue;
-
- code = tRealloc(&reader->config->bufArr[1], size1);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tsdbReadFile(reader->fd[TSDB_FTYPE_DATA],
- record->blockOffset + record->blockKeySize + hdr->szBlkCol + blockCol->offset,
- reader->config->bufArr[1], size1, i > 0 ? 0 : szHint);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tsdbDecmprColData(reader->config->bufArr[1], blockCol, hdr->cmprAlg, hdr->nRow, colData,
- &reader->config->bufArr[2]);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- }
+ // decode the buffer
+ SBufferReader br1 = BUFFER_READER_INITIALIZER(0, buffer1);
+ code = tBlockDataDecompressColData(&hdr, &blockCol, &br1, bData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
}
@@ -396,28 +405,28 @@ _exit:
int32_t tsdbDataFileReadBlockSma(SDataFileReader *reader, const SBrinRecord *record,
TColumnDataAggArray *columnDataAggArray) {
- int32_t code = 0;
- int32_t lino = 0;
+ int32_t code = 0;
+ int32_t lino = 0;
+ SBuffer *buffer = reader->buffers + 0;
TARRAY2_CLEAR(columnDataAggArray, NULL);
if (record->smaSize > 0) {
- code = tRealloc(&reader->config->bufArr[0], record->smaSize);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tsdbReadFile(reader->fd[TSDB_FTYPE_SMA], record->smaOffset, reader->config->bufArr[0], record->smaSize, 0);
+ tBufferClear(buffer);
+ code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_SMA], record->smaOffset, record->smaSize, buffer, 0);
TSDB_CHECK_CODE(code, lino, _exit);
// decode sma data
- int32_t size = 0;
- while (size < record->smaSize) {
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer);
+ while (br.offset < record->smaSize) {
SColumnDataAgg sma[1];
- size += tGetColumnDataAgg(reader->config->bufArr[0] + size, sma);
+ code = tGetColumnDataAgg(&br, sma);
+ TSDB_CHECK_CODE(code, lino, _exit);
code = TARRAY2_APPEND_PTR(columnDataAggArray, sma);
TSDB_CHECK_CODE(code, lino, _exit);
}
- ASSERT(size == record->smaSize);
+ ASSERT(br.offset == record->smaSize);
}
_exit:
@@ -470,26 +479,28 @@ int32_t tsdbDataFileReadTombBlock(SDataFileReader *reader, const STombBlk *tombB
int32_t code = 0;
int32_t lino = 0;
- code = tRealloc(&reader->config->bufArr[0], tombBlk->dp->size);
+ SBuffer *buffer0 = reader->buffers + 0;
+ SBuffer *assist = reader->buffers + 1;
+
+ tBufferClear(buffer0);
+ code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_TOMB], tombBlk->dp->offset, tombBlk->dp->size, buffer0, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- code =
- tsdbReadFile(reader->fd[TSDB_FTYPE_TOMB], tombBlk->dp->offset, reader->config->bufArr[0], tombBlk->dp->size, 0);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- int32_t size = 0;
+ int32_t size = 0;
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0);
tTombBlockClear(tData);
- for (int32_t i = 0; i < ARRAY_SIZE(tData->dataArr); ++i) {
- code = tsdbDecmprData(reader->config->bufArr[0] + size, tombBlk->size[i], TSDB_DATA_TYPE_BIGINT, tombBlk->cmprAlg,
- &reader->config->bufArr[1], sizeof(int64_t) * tombBlk->numRec, &reader->config->bufArr[2]);
+ tData->numOfRecords = tombBlk->numRec;
+ for (int32_t i = 0; i < ARRAY_SIZE(tData->buffers); ++i) {
+ SCompressInfo cinfo = {
+ .cmprAlg = tombBlk->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .originalSize = tombBlk->numRec * sizeof(int64_t),
+ .compressedSize = tombBlk->size[i],
+ };
+ code = tDecompressDataToBuffer(BR_PTR(&br), &cinfo, tData->buffers + i, assist);
TSDB_CHECK_CODE(code, lino, _exit);
-
- code = TARRAY2_APPEND_BATCH(&tData->dataArr[i], reader->config->bufArr[1], tombBlk->numRec);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- size += tombBlk->size[i];
+ br.offset += tombBlk->size[i];
}
- ASSERT(size == tombBlk->dp->size);
_exit:
if (code) {
@@ -504,7 +515,8 @@ struct SDataFileWriter {
SSkmInfo skmTb[1];
SSkmInfo skmRow[1];
- uint8_t *bufArr[5];
+ SBuffer local[10];
+ SBuffer *buffers;
struct {
bool opened;
@@ -565,8 +577,8 @@ static int32_t tsdbDataFileWriterDoClose(SDataFileWriter *writer) {
tBlockDataDestroy(writer->ctx->blockData);
tBrinBlockDestroy(writer->ctx->brinBlock);
- for (int32_t i = 0; i < ARRAY_SIZE(writer->bufArr); ++i) {
- tFree(writer->bufArr[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(writer->local); ++i) {
+ tBufferDestroy(writer->local + i);
}
tDestroyTSchema(writer->skmRow->pTSchema);
@@ -583,7 +595,7 @@ static int32_t tsdbDataFileWriterDoOpenReader(SDataFileWriter *writer) {
SDataFileReaderConfig config[1] = {{
.tsdb = writer->config->tsdb,
.szPage = writer->config->szPage,
- .bufArr = writer->config->bufArr,
+ .buffers = writer->buffers,
}};
for (int32_t i = 0; i < TSDB_FTYPE_MAX; ++i) {
@@ -613,7 +625,10 @@ static int32_t tsdbDataFileWriterDoOpen(SDataFileWriter *writer) {
if (!writer->config->skmTb) writer->config->skmTb = writer->skmTb;
if (!writer->config->skmRow) writer->config->skmRow = writer->skmRow;
- if (!writer->config->bufArr) writer->config->bufArr = writer->bufArr;
+ writer->buffers = writer->config->buffers;
+ if (writer->buffers == NULL) {
+ writer->buffers = writer->local;
+ }
// open reader
code = tsdbDataFileWriterDoOpenReader(writer);
@@ -695,83 +710,110 @@ int32_t tsdbWriterUpdVerRange(SVersionRange *range, int64_t minVer, int64_t maxV
}
int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, int8_t cmprAlg, int64_t *fileSize,
- TBrinBlkArray *brinBlkArray, uint8_t **bufArr, SVersionRange *range) {
- if (BRIN_BLOCK_SIZE(brinBlock) == 0) return 0;
+ TBrinBlkArray *brinBlkArray, SBuffer *buffers, SVersionRange *range) {
+ if (brinBlock->numOfRecords == 0) return 0;
- int32_t code;
+ int32_t code;
+ SBuffer *buffer0 = buffers + 0;
+ SBuffer *buffer1 = buffers + 1;
+ SBuffer *assist = buffers + 2;
- // get SBrinBlk
- SBrinBlk brinBlk[1] = {
- {
- .dp[0] =
- {
- .offset = *fileSize,
- .size = 0,
- },
- .minTbid =
- {
- .suid = TARRAY2_FIRST(brinBlock->suid),
- .uid = TARRAY2_FIRST(brinBlock->uid),
- },
- .maxTbid =
- {
- .suid = TARRAY2_LAST(brinBlock->suid),
- .uid = TARRAY2_LAST(brinBlock->uid),
- },
- .minVer = TARRAY2_FIRST(brinBlock->minVer),
- .maxVer = TARRAY2_FIRST(brinBlock->minVer),
- .numRec = BRIN_BLOCK_SIZE(brinBlock),
- .cmprAlg = cmprAlg,
- },
+ SBrinBlk brinBlk = {
+ .dp[0] =
+ {
+ .offset = *fileSize,
+ .size = 0,
+ },
+ .numRec = brinBlock->numOfRecords,
+ .numOfPKs = brinBlock->numOfPKs,
+ .cmprAlg = cmprAlg,
};
+ for (int i = 0; i < brinBlock->numOfRecords; i++) {
+ SBrinRecord record;
- for (int32_t i = 1; i < BRIN_BLOCK_SIZE(brinBlock); i++) {
- if (brinBlk->minVer > TARRAY2_GET(brinBlock->minVer, i)) {
- brinBlk->minVer = TARRAY2_GET(brinBlock->minVer, i);
+ tBrinBlockGet(brinBlock, i, &record);
+ if (i == 0) {
+ brinBlk.minTbid.suid = record.suid;
+ brinBlk.minTbid.uid = record.uid;
+ brinBlk.minVer = record.minVer;
+ brinBlk.maxVer = record.maxVer;
}
- if (brinBlk->maxVer < TARRAY2_GET(brinBlock->maxVer, i)) {
- brinBlk->maxVer = TARRAY2_GET(brinBlock->maxVer, i);
+ if (i == brinBlock->numOfRecords - 1) {
+ brinBlk.maxTbid.suid = record.suid;
+ brinBlk.maxTbid.uid = record.uid;
+ }
+ if (record.minVer < brinBlk.minVer) {
+ brinBlk.minVer = record.minVer;
+ }
+ if (record.maxVer > brinBlk.maxVer) {
+ brinBlk.maxVer = record.maxVer;
}
}
- tsdbWriterUpdVerRange(range, brinBlk->minVer, brinBlk->maxVer);
+ tsdbWriterUpdVerRange(range, brinBlk.minVer, brinBlk.maxVer);
// write to file
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr1); i++) {
- code = tsdbCmprData((uint8_t *)TARRAY2_DATA(brinBlock->dataArr1 + i), TARRAY2_DATA_LEN(brinBlock->dataArr1 + i),
- TSDB_DATA_TYPE_BIGINT, brinBlk->cmprAlg, &bufArr[0], 0, &brinBlk->size[i], &bufArr[1]);
- if (code) return code;
+ for (int32_t i = 0; i < 10; ++i) {
+ SCompressInfo info = {
+ .cmprAlg = cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .originalSize = brinBlock->buffers[i].size,
+ };
- code = tsdbWriteFile(fd, *fileSize, bufArr[0], brinBlk->size[i]);
+ tBufferClear(buffer0);
+ code = tCompressDataToBuffer(brinBlock->buffers[i].data, &info, buffer0, assist);
if (code) return code;
+ code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size);
+ if (code) return code;
+ brinBlk.size[i] = info.compressedSize;
+ brinBlk.dp->size += info.compressedSize;
+ *fileSize += info.compressedSize;
+ }
+ for (int32_t i = 10; i < 15; ++i) {
+ SCompressInfo info = {
+ .cmprAlg = cmprAlg,
+ .dataType = TSDB_DATA_TYPE_INT,
+ .originalSize = brinBlock->buffers[i].size,
+ };
- brinBlk->dp->size += brinBlk->size[i];
- *fileSize += brinBlk->size[i];
+ tBufferClear(buffer0);
+ code = tCompressDataToBuffer(brinBlock->buffers[i].data, &info, buffer0, assist);
+ if (code) return code;
+ code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size);
+ if (code) return code;
+ brinBlk.size[i] = info.compressedSize;
+ brinBlk.dp->size += info.compressedSize;
+ *fileSize += info.compressedSize;
}
- for (int32_t i = 0, j = ARRAY_SIZE(brinBlock->dataArr1); i < ARRAY_SIZE(brinBlock->dataArr2); i++, j++) {
- code = tsdbCmprData((uint8_t *)TARRAY2_DATA(brinBlock->dataArr2 + i), TARRAY2_DATA_LEN(brinBlock->dataArr2 + i),
- TSDB_DATA_TYPE_INT, brinBlk->cmprAlg, &bufArr[0], 0, &brinBlk->size[j], &bufArr[1]);
- if (code) return code;
+ // write primary keys to file
+ if (brinBlock->numOfPKs > 0) {
+ tBufferClear(buffer0);
+ tBufferClear(buffer1);
- code = tsdbWriteFile(fd, *fileSize, bufArr[0], brinBlk->size[j]);
- if (code) return code;
+ // encode
+ for (int i = 0; i < brinBlock->numOfPKs; i++) {
+ SValueColumnCompressInfo info = {.cmprAlg = cmprAlg};
+ if ((code = tValueColumnCompress(&brinBlock->firstKeyPKs[i], &info, buffer1, assist))) return code;
+ if ((code = tValueColumnCompressInfoEncode(&info, buffer0))) return code;
+ }
+ for (int i = 0; i < brinBlock->numOfPKs; i++) {
+ SValueColumnCompressInfo info = {.cmprAlg = cmprAlg};
+ if ((code = tValueColumnCompress(&brinBlock->lastKeyPKs[i], &info, buffer1, assist))) return code;
+ if ((code = tValueColumnCompressInfoEncode(&info, buffer0))) return code;
+ }
- brinBlk->dp->size += brinBlk->size[j];
- *fileSize += brinBlk->size[j];
+ // write to file
+ if ((code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size))) return code;
+ *fileSize += buffer0->size;
+ brinBlk.dp->size += buffer0->size;
+ if ((code = tsdbWriteFile(fd, *fileSize, buffer1->data, buffer1->size))) return code;
+ *fileSize += buffer1->size;
+ brinBlk.dp->size += buffer1->size;
}
-#if 0
- SBrinRecord record;
- for (int32_t i = 0; i < BRIN_BLOCK_SIZE(brinBlock); i++) {
- tBrinBlockGet(brinBlock, i, &record);
- tsdbInfo("write brin block, block num:%04d, idx:%04d suid:%ld, uid:%ld, offset:%ld, numRow:%d, count:%d",
- TARRAY2_SIZE(brinBlkArray), i, record.suid, record.uid, record.blockOffset, record.numRow, record.count);
- }
-#endif
-
// append to brinBlkArray
- code = TARRAY2_APPEND_PTR(brinBlkArray, brinBlk);
+ code = TARRAY2_APPEND_PTR(brinBlkArray, &brinBlk);
if (code) return code;
tBrinBlockClear(brinBlock);
@@ -780,13 +822,13 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, int8_t cmprAl
}
static int32_t tsdbDataFileWriteBrinBlock(SDataFileWriter *writer) {
- if (BRIN_BLOCK_SIZE(writer->brinBlock) == 0) return 0;
+ if (writer->brinBlock->numOfRecords == 0) return 0;
int32_t code = 0;
int32_t lino = 0;
code = tsdbFileWriteBrinBlock(writer->fd[TSDB_FTYPE_HEAD], writer->brinBlock, writer->config->cmprAlg,
- &writer->files[TSDB_FTYPE_HEAD].size, writer->brinBlkArray, writer->config->bufArr,
+ &writer->files[TSDB_FTYPE_HEAD].size, writer->brinBlkArray, writer->buffers,
&writer->ctx->range);
TSDB_CHECK_CODE(code, lino, _exit);
@@ -801,10 +843,20 @@ static int32_t tsdbDataFileWriteBrinRecord(SDataFileWriter *writer, const SBrinR
int32_t code = 0;
int32_t lino = 0;
- code = tBrinBlockPut(writer->brinBlock, record);
- TSDB_CHECK_CODE(code, lino, _exit);
+ for (;;) {
+ code = tBrinBlockPut(writer->brinBlock, record);
+ if (code == TSDB_CODE_INVALID_PARA) {
+ // different records with different primary keys
+ code = tsdbDataFileWriteBrinBlock(writer);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ continue;
+ } else {
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+ break;
+ }
- if (BRIN_BLOCK_SIZE(writer->brinBlock) >= writer->config->maxRow) {
+ if ((writer->brinBlock->numOfRecords) >= writer->config->maxRow) {
code = tsdbDataFileWriteBrinBlock(writer);
TSDB_CHECK_CODE(code, lino, _exit);
}
@@ -821,16 +873,14 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData
ASSERT(bData->uid);
- int32_t code = 0;
- int32_t lino = 0;
+ int32_t code = 0;
+ int32_t lino = 0;
+ SBuffer *buffers = writer->buffers;
+ SBuffer *assist = writer->buffers + 4;
SBrinRecord record[1] = {{
.suid = bData->suid,
.uid = bData->uid,
- .firstKey = bData->aTSKEY[0],
- .firstKeyVer = bData->aVersion[0],
- .lastKey = bData->aTSKEY[bData->nRow - 1],
- .lastKeyVer = bData->aVersion[bData->nRow - 1],
.minVer = bData->aVersion[0],
.maxVer = bData->aVersion[0],
.blockOffset = writer->files[TSDB_FTYPE_DATA].size,
@@ -843,8 +893,11 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData
}};
+ tsdbRowGetKey(&tsdbRowFromBlockData(bData, 0), &record->firstKey);
+ tsdbRowGetKey(&tsdbRowFromBlockData(bData, bData->nRow - 1), &record->lastKey);
+
for (int32_t i = 1; i < bData->nRow; ++i) {
- if (bData->aTSKEY[i] != bData->aTSKEY[i - 1]) {
+ if (tsdbRowCompareWithoutVersion(&tsdbRowFromBlockData(bData, i - 1), &tsdbRowFromBlockData(bData, i)) != 0) {
record->count++;
}
if (bData->aVersion[i] < record->minVer) {
@@ -858,42 +911,35 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData
tsdbWriterUpdVerRange(&writer->ctx->range, record->minVer, record->maxVer);
// to .data file
- int32_t sizeArr[5] = {0};
-
- code = tCmprBlockData(bData, writer->config->cmprAlg, NULL, NULL, writer->config->bufArr, sizeArr);
+ code = tBlockDataCompress(bData, writer->config->cmprAlg, buffers, assist);
TSDB_CHECK_CODE(code, lino, _exit);
- record->blockKeySize = sizeArr[3] + sizeArr[2];
- record->blockSize = sizeArr[0] + sizeArr[1] + record->blockKeySize;
+ record->blockKeySize = buffers[0].size + buffers[1].size;
+ record->blockSize = record->blockKeySize + buffers[2].size + buffers[3].size;
- for (int32_t i = 3; i >= 0; --i) {
- if (sizeArr[i]) {
- code = tsdbWriteFile(writer->fd[TSDB_FTYPE_DATA], writer->files[TSDB_FTYPE_DATA].size, writer->config->bufArr[i],
- sizeArr[i]);
- TSDB_CHECK_CODE(code, lino, _exit);
- writer->files[TSDB_FTYPE_DATA].size += sizeArr[i];
- }
+ for (int i = 0; i < 4; i++) {
+ code = tsdbWriteFile(writer->fd[TSDB_FTYPE_DATA], writer->files[TSDB_FTYPE_DATA].size, buffers[i].data,
+ buffers[i].size);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ writer->files[TSDB_FTYPE_DATA].size += buffers[i].size;
}
// to .sma file
+ tBufferClear(&buffers[0]);
for (int32_t i = 0; i < bData->nColData; ++i) {
SColData *colData = bData->aColData + i;
- if ((!colData->smaOn) || ((colData->flag & HAS_VALUE) == 0)) continue;
+ if ((colData->cflag & COL_SMA_ON) == 0 || ((colData->flag & HAS_VALUE) == 0)) continue;
SColumnDataAgg sma[1] = {{.colId = colData->cid}};
tColDataCalcSMA[colData->type](colData, &sma->sum, &sma->max, &sma->min, &sma->numOfNull);
- int32_t size = tPutColumnDataAgg(NULL, sma);
-
- code = tRealloc(&writer->config->bufArr[0], record->smaSize + size);
+ code = tPutColumnDataAgg(&buffers[0], sma);
TSDB_CHECK_CODE(code, lino, _exit);
-
- tPutColumnDataAgg(writer->config->bufArr[0] + record->smaSize, sma);
- record->smaSize += size;
}
+ record->smaSize = buffers[0].size;
if (record->smaSize > 0) {
- code = tsdbWriteFile(writer->fd[TSDB_FTYPE_SMA], record->smaOffset, writer->config->bufArr[0], record->smaSize);
+ code = tsdbWriteFile(writer->fd[TSDB_FTYPE_SMA], record->smaOffset, buffers[0].data, record->smaSize);
TSDB_CHECK_CODE(code, lino, _exit);
writer->files[TSDB_FTYPE_SMA].size += record->smaSize;
}
@@ -911,32 +957,6 @@ _exit:
return code;
}
-static int32_t tsdbDataFileWriteDataBlk(SDataFileWriter *writer, const TDataBlkArray *dataBlkArray) {
- if (TARRAY2_SIZE(dataBlkArray) == 0) return 0;
-
- int32_t code = 0;
- int32_t lino = 0;
-
- int32_t ftype = TSDB_FTYPE_HEAD;
- SBlockIdx blockIdx[1] = {{
- .suid = writer->ctx->tbid->suid,
- .uid = writer->ctx->tbid->uid,
- .offset = writer->files[ftype].size,
- .size = TARRAY2_DATA_LEN(dataBlkArray),
- }};
-
- code =
- tsdbWriteFile(writer->fd[ftype], blockIdx->offset, (const uint8_t *)TARRAY2_DATA(dataBlkArray), blockIdx->size);
- TSDB_CHECK_CODE(code, lino, _exit);
- writer->files[ftype].size += blockIdx->size;
-
-_exit:
- if (code) {
- TSDB_ERROR_LOG(TD_VID(writer->config->tsdb->pVnode), lino, code);
- }
- return code;
-}
-
static int32_t tsdbDataFileDoWriteTSRow(SDataFileWriter *writer, TSDBROW *row) {
int32_t code = 0;
int32_t lino = 0;
@@ -947,17 +967,10 @@ static int32_t tsdbDataFileDoWriteTSRow(SDataFileWriter *writer, TSDBROW *row) {
TSDB_CHECK_CODE(code, lino, _exit);
}
- TSDBKEY key[1];
- if (row->type == TSDBROW_ROW_FMT) {
- key->ts = row->pTSRow->ts;
- key->version = row->version;
- } else {
- key->ts = row->pBlockData->aTSKEY[row->iRow];
- key->version = row->pBlockData->aVersion[row->iRow];
- }
- if (key->version <= writer->config->compactVersion //
- && writer->blockData->nRow > 0 //
- && writer->blockData->aTSKEY[writer->blockData->nRow - 1] == key->ts //
+ if (TSDBROW_VERSION(row) <= writer->config->compactVersion //
+ && writer->blockData->nRow > 0 //
+ &&
+ tsdbRowCompareWithoutVersion(row, &tsdbRowFromBlockData(writer->blockData, writer->blockData->nRow - 1)) == 0 //
) {
code = tBlockDataUpdateRow(writer->blockData, row, writer->config->skmRow->pTSchema);
TSDB_CHECK_CODE(code, lino, _exit);
@@ -978,46 +991,57 @@ _exit:
return code;
}
-static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const TSDBKEY *key) {
+static FORCE_INLINE int32_t tsdbRowKeyCmprNullAsLargest(const STsdbRowKey *key1, const STsdbRowKey *key2) {
+ if (key1 == NULL) {
+ return 1;
+ } else if (key2 == NULL) {
+ return -1;
+ } else {
+ return tsdbRowKeyCmpr(key1, key2);
+ }
+}
+
+static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const STsdbRowKey *key) {
if (writer->ctx->tbHasOldData == false) return 0;
- int32_t code = 0;
- int32_t lino = 0;
+ int32_t code = 0;
+ int32_t lino = 0;
+ STsdbRowKey rowKey;
for (;;) {
for (;;) {
// SBlockData
for (; writer->ctx->blockDataIdx < writer->ctx->blockData->nRow; writer->ctx->blockDataIdx++) {
- if (key->ts < writer->ctx->blockData->aTSKEY[writer->ctx->blockDataIdx] //
- || (key->ts == writer->ctx->blockData->aTSKEY[writer->ctx->blockDataIdx] &&
- key->version < writer->ctx->blockData->aVersion[writer->ctx->blockDataIdx])) {
- goto _exit;
- } else {
- TSDBROW row = tsdbRowFromBlockData(writer->ctx->blockData, writer->ctx->blockDataIdx);
+ TSDBROW row = tsdbRowFromBlockData(writer->ctx->blockData, writer->ctx->blockDataIdx);
+
+ tsdbRowGetKey(&row, &rowKey);
+ if (tsdbRowKeyCmprNullAsLargest(&rowKey, key) < 0) { // key <= rowKey
code = tsdbDataFileDoWriteTSRow(writer, &row);
TSDB_CHECK_CODE(code, lino, _exit);
+ } else {
+ goto _exit;
}
}
// SBrinBlock
- if (writer->ctx->brinBlockIdx >= BRIN_BLOCK_SIZE(writer->ctx->brinBlock)) {
+ if (writer->ctx->brinBlockIdx >= writer->ctx->brinBlock->numOfRecords) {
break;
}
- for (; writer->ctx->brinBlockIdx < BRIN_BLOCK_SIZE(writer->ctx->brinBlock); writer->ctx->brinBlockIdx++) {
- if (TARRAY2_GET(writer->ctx->brinBlock->uid, writer->ctx->brinBlockIdx) != writer->ctx->tbid->uid) {
+ for (; writer->ctx->brinBlockIdx < writer->ctx->brinBlock->numOfRecords; writer->ctx->brinBlockIdx++) {
+ SBrinRecord record;
+ tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, &record);
+ if (record.uid != writer->ctx->tbid->uid) {
writer->ctx->tbHasOldData = false;
goto _exit;
}
- if (key->ts < TARRAY2_GET(writer->ctx->brinBlock->firstKey, writer->ctx->brinBlockIdx) //
- || (key->ts == TARRAY2_GET(writer->ctx->brinBlock->firstKey, writer->ctx->brinBlockIdx) &&
- key->version < TARRAY2_GET(writer->ctx->brinBlock->firstKeyVer, writer->ctx->brinBlockIdx))) {
+ if (tsdbRowKeyCmprNullAsLargest(key, &record.firstKey) < 0) { // key < record->firstKey
goto _exit;
} else {
SBrinRecord record[1];
tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, record);
- if (key->ts > record->lastKey || (key->ts == record->lastKey && key->version > record->maxVer)) {
+ if (tsdbRowKeyCmprNullAsLargest(key, &record->lastKey) > 0) { // key > record->lastKey
if (writer->blockData->nRow > 0) {
code = tsdbDataFileDoWriteBlockData(writer, writer->blockData);
TSDB_CHECK_CODE(code, lino, _exit);
@@ -1070,16 +1094,10 @@ static int32_t tsdbDataFileDoWriteTSData(SDataFileWriter *writer, TSDBROW *row)
int32_t lino = 0;
if (writer->ctx->tbHasOldData) {
- TSDBKEY key[1];
- if (row->type == TSDBROW_ROW_FMT) {
- key->ts = row->pTSRow->ts;
- key->version = row->version;
- } else {
- key->ts = row->pBlockData->aTSKEY[row->iRow];
- key->version = row->pBlockData->aVersion[row->iRow];
- }
+ STsdbRowKey key;
+ tsdbRowGetKey(row, &key);
- code = tsdbDataFileDoWriteTableOldData(writer, key);
+ code = tsdbDataFileDoWriteTableOldData(writer, &key);
TSDB_CHECK_CODE(code, lino, _exit);
}
@@ -1100,12 +1118,7 @@ static int32_t tsdbDataFileWriteTableDataEnd(SDataFileWriter *writer) {
int32_t lino = 0;
if (writer->ctx->tbHasOldData) {
- TSDBKEY key = {
- .ts = TSKEY_MAX,
- .version = VERSION_MAX,
- };
-
- code = tsdbDataFileDoWriteTableOldData(writer, &key);
+ code = tsdbDataFileDoWriteTableOldData(writer, NULL /* as the largest key */);
TSDB_CHECK_CODE(code, lino, _exit);
ASSERT(writer->ctx->tbHasOldData == false);
@@ -1133,35 +1146,32 @@ static int32_t tsdbDataFileWriteTableDataBegin(SDataFileWriter *writer, const TA
TABLEID tbid1[1];
writer->ctx->tbHasOldData = false;
while (writer->ctx->brinBlkArray) { // skip data of previous table
- for (; writer->ctx->brinBlockIdx < BRIN_BLOCK_SIZE(writer->ctx->brinBlock); writer->ctx->brinBlockIdx++) {
- TABLEID tbid2[1] = {{
- .suid = TARRAY2_GET(writer->ctx->brinBlock->suid, writer->ctx->brinBlockIdx),
- .uid = TARRAY2_GET(writer->ctx->brinBlock->uid, writer->ctx->brinBlockIdx),
- }};
+ for (; writer->ctx->brinBlockIdx < writer->ctx->brinBlock->numOfRecords; writer->ctx->brinBlockIdx++) {
+ SBrinRecord record;
+ tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, &record);
- if (tbid2->uid == tbid->uid) {
+ if (record.uid == tbid->uid) {
writer->ctx->tbHasOldData = true;
goto _begin;
- } else if (tbid2->suid > tbid->suid || (tbid2->suid == tbid->suid && tbid2->uid > tbid->uid)) {
+ } else if (record.suid > tbid->suid || (record.suid == tbid->suid && record.uid > tbid->uid)) {
goto _begin;
} else {
- if (tbid2->uid != writer->ctx->tbid->uid) {
- if (drop && tbid1->uid == tbid2->uid) {
+ if (record.uid != writer->ctx->tbid->uid) {
+ if (drop && tbid1->uid == record.uid) {
continue;
- } else if (metaGetInfo(writer->config->tsdb->pVnode->pMeta, tbid2->uid, &info, NULL) != 0) {
+ } else if (metaGetInfo(writer->config->tsdb->pVnode->pMeta, record.uid, &info, NULL) != 0) {
drop = true;
- *tbid1 = *tbid2;
+ tbid1->suid = record.suid;
+ tbid1->uid = record.uid;
continue;
} else {
drop = false;
- writer->ctx->tbid[0] = *tbid2;
+ writer->ctx->tbid->suid = record.suid;
+ writer->ctx->tbid->uid = record.uid;
}
}
- SBrinRecord record[1];
- tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, record);
-
- code = tsdbDataFileWriteBrinRecord(writer, record);
+ code = tsdbDataFileWriteBrinRecord(writer, &record);
TSDB_CHECK_CODE(code, lino, _exit);
}
}
@@ -1206,57 +1216,67 @@ int32_t tsdbFileWriteHeadFooter(STsdbFD *fd, int64_t *fileSize, const SHeadFoote
}
int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAlg, int64_t *fileSize,
- TTombBlkArray *tombBlkArray, uint8_t **bufArr, SVersionRange *range) {
+ TTombBlkArray *tombBlkArray, SBuffer *buffers, SVersionRange *range) {
int32_t code;
if (TOMB_BLOCK_SIZE(tombBlock) == 0) return 0;
- STombBlk tombBlk[1] = {{
+ SBuffer *buffer0 = buffers + 0;
+ SBuffer *assist = buffers + 1;
+
+ STombBlk tombBlk = {
.dp[0] =
{
.offset = *fileSize,
.size = 0,
},
- .minTbid =
- {
- .suid = TARRAY2_FIRST(tombBlock->suid),
- .uid = TARRAY2_FIRST(tombBlock->uid),
- },
- .maxTbid =
- {
- .suid = TARRAY2_LAST(tombBlock->suid),
- .uid = TARRAY2_LAST(tombBlock->uid),
- },
- .minVer = TARRAY2_FIRST(tombBlock->version),
- .maxVer = TARRAY2_FIRST(tombBlock->version),
.numRec = TOMB_BLOCK_SIZE(tombBlock),
.cmprAlg = cmprAlg,
- }};
+ };
+ for (int i = 0; i < TOMB_BLOCK_SIZE(tombBlock); i++) {
+ STombRecord record;
+ tTombBlockGet(tombBlock, i, &record);
- for (int32_t i = 1; i < TOMB_BLOCK_SIZE(tombBlock); i++) {
- if (tombBlk->minVer > TARRAY2_GET(tombBlock->version, i)) {
- tombBlk->minVer = TARRAY2_GET(tombBlock->version, i);
+ if (i == 0) {
+ tombBlk.minTbid.suid = record.suid;
+ tombBlk.minTbid.uid = record.uid;
+ tombBlk.minVer = record.version;
+ tombBlk.maxVer = record.version;
}
- if (tombBlk->maxVer < TARRAY2_GET(tombBlock->version, i)) {
- tombBlk->maxVer = TARRAY2_GET(tombBlock->version, i);
+ if (i == TOMB_BLOCK_SIZE(tombBlock) - 1) {
+ tombBlk.maxTbid.suid = record.suid;
+ tombBlk.maxTbid.uid = record.uid;
+ }
+ if (record.version < tombBlk.minVer) {
+ tombBlk.minVer = record.version;
+ }
+ if (record.version > tombBlk.maxVer) {
+ tombBlk.maxVer = record.version;
}
}
- tsdbWriterUpdVerRange(range, tombBlk->minVer, tombBlk->maxVer);
+ tsdbWriterUpdVerRange(range, tombBlk.minVer, tombBlk.maxVer);
- for (int32_t i = 0; i < ARRAY_SIZE(tombBlock->dataArr); i++) {
- code = tsdbCmprData((uint8_t *)TARRAY2_DATA(&tombBlock->dataArr[i]), TARRAY2_DATA_LEN(&tombBlock->dataArr[i]),
- TSDB_DATA_TYPE_BIGINT, tombBlk->cmprAlg, &bufArr[0], 0, &tombBlk->size[i], &bufArr[1]);
+ for (int32_t i = 0; i < ARRAY_SIZE(tombBlock->buffers); i++) {
+ tBufferClear(buffer0);
+
+ SCompressInfo cinfo = {
+ .cmprAlg = cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .originalSize = tombBlock->buffers[i].size,
+ };
+ code = tCompressDataToBuffer(tombBlock->buffers[i].data, &cinfo, buffer0, assist);
if (code) return code;
- code = tsdbWriteFile(fd, *fileSize, bufArr[0], tombBlk->size[i]);
+ code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size);
if (code) return code;
- tombBlk->dp->size += tombBlk->size[i];
- *fileSize += tombBlk->size[i];
+ tombBlk.size[i] = cinfo.compressedSize;
+ tombBlk.dp->size += tombBlk.size[i];
+ *fileSize += tombBlk.size[i];
}
- code = TARRAY2_APPEND_PTR(tombBlkArray, tombBlk);
+ code = TARRAY2_APPEND_PTR(tombBlkArray, &tombBlk);
if (code) return code;
tTombBlockClear(tombBlock);
@@ -1284,7 +1304,7 @@ static int32_t tsdbDataFileDoWriteTombBlock(SDataFileWriter *writer) {
int32_t lino = 0;
code = tsdbFileWriteTombBlock(writer->fd[TSDB_FTYPE_TOMB], writer->tombBlock, writer->config->cmprAlg,
- &writer->files[TSDB_FTYPE_TOMB].size, writer->tombBlkArray, writer->config->bufArr,
+ &writer->files[TSDB_FTYPE_TOMB].size, writer->tombBlkArray, writer->buffers,
&writer->ctx->tombRange);
TSDB_CHECK_CODE(code, lino, _exit);
@@ -1740,11 +1760,9 @@ int32_t tsdbDataFileWriteBlockData(SDataFileWriter *writer, SBlockData *bData) {
}
if (writer->ctx->tbHasOldData) {
- TSDBKEY key = {
- .ts = bData->aTSKEY[0],
- .version = bData->aVersion[0],
- };
+ STsdbRowKey key;
+ tsdbRowGetKey(&tsdbRowFromBlockData(bData, 0), &key);
code = tsdbDataFileDoWriteTableOldData(writer, &key);
TSDB_CHECK_CODE(code, lino, _exit);
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h
index becb395836..ce879247bf 100644
--- a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h
+++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h
@@ -25,18 +25,16 @@
extern "C" {
#endif
-typedef TARRAY2(SBlockIdx) TBlockIdxArray;
-typedef TARRAY2(SDataBlk) TDataBlkArray;
typedef TARRAY2(SColumnDataAgg) TColumnDataAggArray;
typedef struct {
SFDataPtr brinBlkPtr[1];
- SFDataPtr rsrvd[2];
+ char rsrvd[32];
} SHeadFooter;
typedef struct {
SFDataPtr tombBlkPtr[1];
- SFDataPtr rsrvd[2];
+ char rsrvd[32];
} STombFooter;
// SDataFileReader =============================================
@@ -48,7 +46,7 @@ typedef struct SDataFileReaderConfig {
bool exist;
STFile file;
} files[TSDB_FTYPE_MAX];
- uint8_t **bufArr;
+ SBuffer *buffers;
} SDataFileReaderConfig;
int32_t tsdbDataFileReaderOpen(const char *fname[/* TSDB_FTYPE_MAX */], const SDataFileReaderConfig *config,
@@ -86,7 +84,7 @@ typedef struct SDataFileWriterConfig {
SSkmInfo *skmTb;
SSkmInfo *skmRow;
SHashObj *pColCmpr;
- uint8_t **bufArr;
+ SBuffer *buffers;
} SDataFileWriterConfig;
int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWriter **writer);
@@ -98,14 +96,14 @@ int32_t tsdbDataFileFlush(SDataFileWriter *writer);
// head
int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, int8_t cmprAlg, int64_t *fileSize,
- TBrinBlkArray *brinBlkArray, uint8_t **bufArr, SVersionRange *range);
+ TBrinBlkArray *brinBlkArray, SBuffer *buffers, SVersionRange *range);
int32_t tsdbFileWriteBrinBlk(STsdbFD *fd, TBrinBlkArray *brinBlkArray, SFDataPtr *ptr, int64_t *fileSize);
int32_t tsdbFileWriteHeadFooter(STsdbFD *fd, int64_t *fileSize, const SHeadFooter *footer);
// tomb
int32_t tsdbDataFileWriteTombRecord(SDataFileWriter *writer, const STombRecord *record);
int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAlg, int64_t *fileSize,
- TTombBlkArray *tombBlkArray, uint8_t **bufArr, SVersionRange *range);
+ TTombBlkArray *tombBlkArray, SBuffer *buffers, SVersionRange *range);
int32_t tsdbFileWriteTombBlk(STsdbFD *fd, const TTombBlkArray *tombBlkArray, SFDataPtr *ptr, int64_t *fileSize);
int32_t tsdbFileWriteTombFooter(STsdbFD *fd, const STombFooter *footer, int64_t *fileSize);
diff --git a/source/dnode/vnode/src/tsdb/tsdbDataIter.c b/source/dnode/vnode/src/tsdb/tsdbDataIter.c
deleted file mode 100644
index e1e6bd5f1f..0000000000
--- a/source/dnode/vnode/src/tsdb/tsdbDataIter.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright (c) 2019 TAOS Data, Inc.
- *
- * This program is free software: you can use, redistribute, and/or modify
- * it under the terms of the GNU Affero General Public License, version 3
- * or later ("AGPL"), as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-#include "tsdb.h"
-#include "vnodeInt.h"
-
-#ifdef BUILD_NO_CALL
-// STsdbDataIter2
-/* open */
-int32_t tsdbOpenDataFileDataIter(SDataFReader* pReader, STsdbDataIter2** ppIter) {
- int32_t code = 0;
- int32_t lino = 0;
-
- // create handle
- STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter));
- if (pIter == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- pIter->type = TSDB_DATA_FILE_DATA_ITER;
- pIter->dIter.pReader = pReader;
- if ((pIter->dIter.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- code = tBlockDataCreate(&pIter->dIter.bData);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pIter->dIter.iBlockIdx = 0;
- pIter->dIter.iDataBlk = 0;
- pIter->dIter.iRow = 0;
-
- // read data
- code = tsdbReadBlockIdx(pReader, pIter->dIter.aBlockIdx);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- if (taosArrayGetSize(pIter->dIter.aBlockIdx) == 0) goto _clear;
-
-_exit:
- if (code) {
- if (pIter) {
- _clear:
- tBlockDataDestroy(&pIter->dIter.bData);
- taosArrayDestroy(pIter->dIter.aBlockIdx);
- taosMemoryFree(pIter);
- pIter = NULL;
- }
- }
- *ppIter = pIter;
- return code;
-}
-
-int32_t tsdbOpenSttFileDataIter(SDataFReader* pReader, int32_t iStt, STsdbDataIter2** ppIter) {
- int32_t code = 0;
- int32_t lino = 0;
-
- // create handle
- STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter));
- if (pIter == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- pIter->type = TSDB_STT_FILE_DATA_ITER;
- pIter->sIter.pReader = pReader;
- pIter->sIter.iStt = iStt;
- pIter->sIter.aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
- if (pIter->sIter.aSttBlk == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- code = tBlockDataCreate(&pIter->sIter.bData);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pIter->sIter.iSttBlk = 0;
- pIter->sIter.iRow = 0;
-
- // read data
- code = tsdbReadSttBlk(pReader, iStt, pIter->sIter.aSttBlk);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- if (taosArrayGetSize(pIter->sIter.aSttBlk) == 0) goto _clear;
-
-_exit:
- if (code) {
- if (pIter) {
- _clear:
- taosArrayDestroy(pIter->sIter.aSttBlk);
- tBlockDataDestroy(&pIter->sIter.bData);
- taosMemoryFree(pIter);
- pIter = NULL;
- }
- }
- *ppIter = pIter;
- return code;
-}
-
-int32_t tsdbOpenTombFileDataIter(SDelFReader* pReader, STsdbDataIter2** ppIter) {
- int32_t code = 0;
- int32_t lino = 0;
-
- STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter));
- if (pIter == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- pIter->type = TSDB_TOMB_FILE_DATA_ITER;
-
- pIter->tIter.pReader = pReader;
- if ((pIter->tIter.aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- if ((pIter->tIter.aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- code = tsdbReadDelIdx(pReader, pIter->tIter.aDelIdx);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- if (taosArrayGetSize(pIter->tIter.aDelIdx) == 0) goto _clear;
-
- pIter->tIter.iDelIdx = 0;
- pIter->tIter.iDelData = 0;
-
-_exit:
- if (code) {
- if (pIter) {
- _clear:
- taosArrayDestroy(pIter->tIter.aDelIdx);
- taosArrayDestroy(pIter->tIter.aDelData);
- taosMemoryFree(pIter);
- pIter = NULL;
- }
- }
- *ppIter = pIter;
- return code;
-}
-
-/* close */
-static void tsdbCloseDataFileDataIter(STsdbDataIter2* pIter) {
- tBlockDataDestroy(&pIter->dIter.bData);
- tMapDataClear(&pIter->dIter.mDataBlk);
- taosArrayDestroy(pIter->dIter.aBlockIdx);
- taosMemoryFree(pIter);
-}
-
-static void tsdbCloseSttFileDataIter(STsdbDataIter2* pIter) {
- tBlockDataDestroy(&pIter->sIter.bData);
- taosArrayDestroy(pIter->sIter.aSttBlk);
- taosMemoryFree(pIter);
-}
-
-static void tsdbCloseTombFileDataIter(STsdbDataIter2* pIter) {
- taosArrayDestroy(pIter->tIter.aDelData);
- taosArrayDestroy(pIter->tIter.aDelIdx);
- taosMemoryFree(pIter);
-}
-
-void tsdbCloseDataIter2(STsdbDataIter2* pIter) {
- if (pIter->type == TSDB_MEM_TABLE_DATA_ITER) {
- ASSERT(0);
- } else if (pIter->type == TSDB_DATA_FILE_DATA_ITER) {
- tsdbCloseDataFileDataIter(pIter);
- } else if (pIter->type == TSDB_STT_FILE_DATA_ITER) {
- tsdbCloseSttFileDataIter(pIter);
- } else if (pIter->type == TSDB_TOMB_FILE_DATA_ITER) {
- tsdbCloseTombFileDataIter(pIter);
- } else {
- ASSERT(0);
- }
-}
-
-/* cmpr */
-int32_t tsdbDataIterCmprFn(const SRBTreeNode* pNode1, const SRBTreeNode* pNode2) {
- STsdbDataIter2* pIter1 = TSDB_RBTN_TO_DATA_ITER(pNode1);
- STsdbDataIter2* pIter2 = TSDB_RBTN_TO_DATA_ITER(pNode2);
- return tRowInfoCmprFn(&pIter1->rowInfo, &pIter2->rowInfo);
-}
-
-/* seek */
-
-/* iter next */
-static int32_t tsdbDataFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) {
- int32_t code = 0;
- int32_t lino = 0;
-
- for (;;) {
- while (pIter->dIter.iRow < pIter->dIter.bData.nRow) {
- if (pFilterInfo) {
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
- if (pIter->dIter.bData.aVersion[pIter->dIter.iRow] < pFilterInfo->sver ||
- pIter->dIter.bData.aVersion[pIter->dIter.iRow] > pFilterInfo->ever) {
- pIter->dIter.iRow++;
- continue;
- }
- }
- }
-
- ASSERT(pIter->rowInfo.suid == pIter->dIter.bData.suid);
- ASSERT(pIter->rowInfo.uid == pIter->dIter.bData.uid);
- pIter->rowInfo.row = tsdbRowFromBlockData(&pIter->dIter.bData, pIter->dIter.iRow);
- pIter->dIter.iRow++;
- goto _exit;
- }
-
- for (;;) {
- while (pIter->dIter.iDataBlk < pIter->dIter.mDataBlk.nItem) {
- SDataBlk dataBlk;
- tMapDataGetItemByIdx(&pIter->dIter.mDataBlk, pIter->dIter.iDataBlk, &dataBlk, tGetDataBlk);
-
- // filter
- if (pFilterInfo) {
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
- if (pFilterInfo->sver > dataBlk.maxVer || pFilterInfo->ever < dataBlk.minVer) {
- pIter->dIter.iDataBlk++;
- continue;
- }
- }
- }
-
- code = tsdbReadDataBlockEx(pIter->dIter.pReader, &dataBlk, &pIter->dIter.bData);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pIter->dIter.iDataBlk++;
- pIter->dIter.iRow = 0;
-
- break;
- }
-
- if (pIter->dIter.iRow < pIter->dIter.bData.nRow) break;
-
- for (;;) {
- if (pIter->dIter.iBlockIdx < taosArrayGetSize(pIter->dIter.aBlockIdx)) {
- SBlockIdx* pBlockIdx = taosArrayGet(pIter->dIter.aBlockIdx, pIter->dIter.iBlockIdx);
-
- if (pFilterInfo) {
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_TABLEID) {
- int32_t c = tTABLEIDCmprFn(pBlockIdx, &pFilterInfo->tbid);
- if (c == 0) {
- pIter->dIter.iBlockIdx++;
- continue;
- } else if (c < 0) {
- ASSERT(0);
- }
- }
-
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_IGNORE_DROPPED_TABLE) {
- SMetaInfo info;
- if (metaGetInfo(pIter->dIter.pReader->pTsdb->pVnode->pMeta, pBlockIdx->uid, &info, NULL)) {
- pIter->dIter.iBlockIdx++;
- continue;
- }
- }
- }
-
- code = tsdbReadDataBlk(pIter->dIter.pReader, pBlockIdx, &pIter->dIter.mDataBlk);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pIter->rowInfo.suid = pBlockIdx->suid;
- pIter->rowInfo.uid = pBlockIdx->uid;
-
- pIter->dIter.iBlockIdx++;
- pIter->dIter.iDataBlk = 0;
-
- break;
- } else {
- pIter->rowInfo = (SRowInfo){0};
- goto _exit;
- }
- }
- }
- }
-
-_exit:
- if (code) {
- tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- }
- return code;
-}
-
-static int32_t tsdbSttFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) {
- int32_t code = 0;
- int32_t lino = 0;
-
- for (;;) {
- while (pIter->sIter.iRow < pIter->sIter.bData.nRow) {
- if (pFilterInfo) {
- int64_t uid = pIter->sIter.bData.uid ? pIter->sIter.bData.uid : pIter->sIter.bData.aUid[pIter->sIter.iRow];
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_TABLEID) {
- if (pFilterInfo->tbid.uid == uid) {
- pIter->sIter.iRow++;
- continue;
- }
- }
-
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_IGNORE_DROPPED_TABLE) {
- if (pIter->rowInfo.uid != uid) {
- SMetaInfo info;
- if (metaGetInfo(pIter->sIter.pReader->pTsdb->pVnode->pMeta, uid, &info, NULL)) {
- pIter->sIter.iRow++;
- continue;
- }
- }
- }
-
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
- if (pFilterInfo->sver > pIter->sIter.bData.aVersion[pIter->sIter.iRow] ||
- pFilterInfo->ever < pIter->sIter.bData.aVersion[pIter->sIter.iRow]) {
- pIter->sIter.iRow++;
- continue;
- }
- }
- }
-
- pIter->rowInfo.suid = pIter->sIter.bData.suid;
- pIter->rowInfo.uid = pIter->sIter.bData.uid ? pIter->sIter.bData.uid : pIter->sIter.bData.aUid[pIter->sIter.iRow];
- pIter->rowInfo.row = tsdbRowFromBlockData(&pIter->sIter.bData, pIter->sIter.iRow);
- pIter->sIter.iRow++;
- goto _exit;
- }
-
- for (;;) {
- if (pIter->sIter.iSttBlk < taosArrayGetSize(pIter->sIter.aSttBlk)) {
- SSttBlk* pSttBlk = taosArrayGet(pIter->sIter.aSttBlk, pIter->sIter.iSttBlk);
-
- if (pFilterInfo) {
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_TABLEID) {
- if (pSttBlk->suid == pFilterInfo->tbid.suid && pSttBlk->minUid == pFilterInfo->tbid.uid &&
- pSttBlk->maxUid == pFilterInfo->tbid.uid) {
- pIter->sIter.iSttBlk++;
- continue;
- }
- }
-
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
- if (pFilterInfo->sver > pSttBlk->maxVer || pFilterInfo->ever < pSttBlk->minVer) {
- pIter->sIter.iSttBlk++;
- continue;
- }
- }
- }
-
- code = tsdbReadSttBlockEx(pIter->sIter.pReader, pIter->sIter.iStt, pSttBlk, &pIter->sIter.bData);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pIter->sIter.iRow = 0;
- pIter->sIter.iSttBlk++;
- break;
- } else {
- pIter->rowInfo = (SRowInfo){0};
- goto _exit;
- }
- }
- }
-
-_exit:
- if (code) {
- tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- }
- return code;
-}
-
-static int32_t tsdbTombFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) {
- int32_t code = 0;
- int32_t lino = 0;
-
- for (;;) {
- while (pIter->tIter.iDelData < taosArrayGetSize(pIter->tIter.aDelData)) {
- SDelData* pDelData = taosArrayGet(pIter->tIter.aDelData, pIter->tIter.iDelData);
-
- if (pFilterInfo) {
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
- if (pFilterInfo->sver > pDelData->version || pFilterInfo->ever < pDelData->version) {
- pIter->tIter.iDelData++;
- continue;
- }
- }
- }
-
- pIter->delInfo.delData = *pDelData;
- pIter->tIter.iDelData++;
- goto _exit;
- }
-
- for (;;) {
- if (pIter->tIter.iDelIdx < taosArrayGetSize(pIter->tIter.aDelIdx)) {
- SDelIdx* pDelIdx = taosArrayGet(pIter->tIter.aDelIdx, pIter->tIter.iDelIdx);
-
- if (pFilterInfo) {
- if (pFilterInfo->flag & TSDB_FILTER_FLAG_IGNORE_DROPPED_TABLE) {
- SMetaInfo info;
- if (metaGetInfo(pIter->dIter.pReader->pTsdb->pVnode->pMeta, pDelIdx->uid, &info, NULL)) {
- pIter->tIter.iDelIdx++;
- continue;
- }
- }
- }
-
- code = tsdbReadDelDatav1(pIter->tIter.pReader, pDelIdx, pIter->tIter.aDelData, INT64_MAX);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pIter->delInfo.suid = pDelIdx->suid;
- pIter->delInfo.uid = pDelIdx->uid;
- pIter->tIter.iDelData = 0;
- pIter->tIter.iDelIdx++;
- break;
- } else {
- pIter->delInfo = (SDelInfo){0};
- goto _exit;
- }
- }
- }
-
-_exit:
- if (code) {
- tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- }
- return code;
-}
-
-int32_t tsdbDataIterNext2(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) {
- int32_t code = 0;
-
- if (pIter->type == TSDB_MEM_TABLE_DATA_ITER) {
- ASSERT(0);
- return code;
- } else if (pIter->type == TSDB_DATA_FILE_DATA_ITER) {
- return tsdbDataFileDataIterNext(pIter, pFilterInfo);
- } else if (pIter->type == TSDB_STT_FILE_DATA_ITER) {
- return tsdbSttFileDataIterNext(pIter, pFilterInfo);
- } else if (pIter->type == TSDB_TOMB_FILE_DATA_ITER) {
- return tsdbTombFileDataIterNext(pIter, pFilterInfo);
- } else {
- ASSERT(0);
- return code;
- }
-}
-#endif
-
-/* get */
-
-// STsdbFSetIter
-typedef struct STsdbFSetDataIter {
- STsdb* pTsdb;
- int32_t flags;
-
- /* tombstone */
- SDelFReader* pDelFReader;
- SArray* aDelIdx; // SArray
- SArray* aDelData; // SArray
- SArray* aSkeyLine; // SArray
- int32_t iDelIdx;
- int32_t iSkyLine;
-
- /* time-series data */
- SDataFReader* pReader;
- STsdbDataIter2* iterList;
- STsdbDataIter2* pIter;
- SRBTree rbt;
-} STsdbFSetDataIter;
diff --git a/source/dnode/vnode/src/tsdb/tsdbDef.h b/source/dnode/vnode/src/tsdb/tsdbDef.h
index 0f512e1306..0eaf3e68a6 100644
--- a/source/dnode/vnode/src/tsdb/tsdbDef.h
+++ b/source/dnode/vnode/src/tsdb/tsdbDef.h
@@ -35,6 +35,7 @@ extern int32_t tsdbOpenFile(const char *path, STsdb *pTsdb, int32_t flag, STsdbF
extern void tsdbCloseFile(STsdbFD **ppFD);
extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t size);
extern int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size, int64_t szHint);
+extern int32_t tsdbReadFileToBuffer(STsdbFD *pFD, int64_t offset, int64_t size, SBuffer *buffer, int64_t szHint);
extern int32_t tsdbFsyncFile(STsdbFD *pFD);
#ifdef __cplusplus
diff --git a/source/dnode/vnode/src/tsdb/tsdbDiskData.c b/source/dnode/vnode/src/tsdb/tsdbDiskData.c
deleted file mode 100644
index ae9af11f5a..0000000000
--- a/source/dnode/vnode/src/tsdb/tsdbDiskData.c
+++ /dev/null
@@ -1,697 +0,0 @@
-/*
- * Copyright (c) 2019 TAOS Data, Inc.
- *
- * This program is free software: you can use, redistribute, and/or modify
- * it under the terms of the GNU Affero General Public License, version 3
- * or later ("AGPL"), as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-#include "tsdb.h"
-
-typedef struct SDiskColBuilder SDiskColBuilder;
-
-struct SDiskColBuilder {
- int16_t cid;
- int8_t type;
- uint8_t cmprAlg;
- uint8_t calcSma;
- int8_t flag;
- int32_t nVal;
- uint8_t *pBitMap;
- int32_t offset;
- SCompressor *pOffC;
- SCompressor *pValC;
- SColumnDataAgg sma;
- uint8_t minSet;
- uint8_t maxSet;
- uint8_t *aBuf[2];
-};
-
-// SDiskData ================================================
-static int32_t tDiskDataDestroy(SDiskData *pDiskData) {
- int32_t code = 0;
- pDiskData->aDiskCol = taosArrayDestroy(pDiskData->aDiskCol);
- return code;
-}
-
-// SDiskColBuilder ================================================
-#define tDiskColBuilderCreate() \
- (SDiskColBuilder) { 0 }
-
-static int32_t tDiskColBuilderDestroy(SDiskColBuilder *pBuilder) {
- int32_t code = 0;
-
- tFree(pBuilder->pBitMap);
- if (pBuilder->pOffC) tCompressorDestroy(pBuilder->pOffC);
- if (pBuilder->pValC) tCompressorDestroy(pBuilder->pValC);
- for (int32_t iBuf = 0; iBuf < sizeof(pBuilder->aBuf) / sizeof(pBuilder->aBuf[0]); iBuf++) {
- tFree(pBuilder->aBuf[iBuf]);
- }
-
- return code;
-}
-
-static int32_t tDiskColBuilderInit(SDiskColBuilder *pBuilder, int16_t cid, int8_t type, uint8_t cmprAlg,
- uint8_t calcSma) {
- int32_t code = 0;
-
- pBuilder->cid = cid;
- pBuilder->type = type;
- pBuilder->cmprAlg = cmprAlg;
- pBuilder->calcSma = IS_VAR_DATA_TYPE(type) ? 0 : calcSma;
- pBuilder->flag = 0;
- pBuilder->nVal = 0;
- pBuilder->offset = 0;
-
- if (IS_VAR_DATA_TYPE(type)) {
- if (pBuilder->pOffC == NULL && (code = tCompressorCreate(&pBuilder->pOffC))) return code;
- code = tCompressStart(pBuilder->pOffC, TSDB_DATA_TYPE_INT, cmprAlg);
- if (code) return code;
- }
-
- if (pBuilder->pValC == NULL && (code = tCompressorCreate(&pBuilder->pValC))) return code;
- code = tCompressStart(pBuilder->pValC, type, cmprAlg);
- if (code) return code;
-
- if (pBuilder->calcSma) {
- pBuilder->sma = (SColumnDataAgg){.colId = cid};
- pBuilder->minSet = 0;
- pBuilder->maxSet = 0;
- }
-
- return code;
-}
-
-static int32_t tGnrtDiskCol(SDiskColBuilder *pBuilder, SDiskCol *pDiskCol) {
- int32_t code = 0;
-
- ASSERT(pBuilder->flag && pBuilder->flag != HAS_NONE);
-
- *pDiskCol = (SDiskCol){(SBlockCol){.cid = pBuilder->cid,
- .type = pBuilder->type,
- .smaOn = pBuilder->calcSma,
- .flag = pBuilder->flag,
- .szOrigin = 0,
- .szBitmap = 0,
- .szOffset = 0,
- .szValue = 0,
- .offset = 0},
- .pBit = NULL, .pOff = NULL, .pVal = NULL, .agg = pBuilder->sma};
-
- if (pBuilder->flag == HAS_NULL) return code;
-
- // BITMAP
- if (pBuilder->flag != HAS_VALUE) {
- int32_t nBit;
- if (pBuilder->flag == (HAS_VALUE | HAS_NULL | HAS_NONE)) {
- nBit = BIT2_SIZE(pBuilder->nVal);
- } else {
- nBit = BIT1_SIZE(pBuilder->nVal);
- }
-
- code = tRealloc(&pBuilder->aBuf[0], nBit + COMP_OVERFLOW_BYTES);
- if (code) return code;
-
- code = tRealloc(&pBuilder->aBuf[1], nBit + COMP_OVERFLOW_BYTES);
- if (code) return code;
-
- pDiskCol->bCol.szBitmap =
- tsCompressTinyint(pBuilder->pBitMap, nBit, nBit, pBuilder->aBuf[0], nBit + COMP_OVERFLOW_BYTES,
- pBuilder->cmprAlg, pBuilder->aBuf[1], nBit + COMP_OVERFLOW_BYTES);
- pDiskCol->pBit = pBuilder->aBuf[0];
- }
-
- // OFFSET
- if (IS_VAR_DATA_TYPE(pBuilder->type)) {
- code = tCompressEnd(pBuilder->pOffC, &pDiskCol->pOff, &pDiskCol->bCol.szOffset, NULL);
- if (code) return code;
- }
-
- // VALUE
- if (pBuilder->flag != (HAS_NULL | HAS_NONE)) {
- code = tCompressEnd(pBuilder->pValC, &pDiskCol->pVal, &pDiskCol->bCol.szValue, &pDiskCol->bCol.szOrigin);
- if (code) return code;
- }
-
- return code;
-}
-
-static FORCE_INLINE int32_t tDiskColPutValue(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
- code = tCompress(pBuilder->pOffC, &pBuilder->offset, sizeof(int32_t));
- if (code) return code;
- pBuilder->offset += pColVal->value.nData;
-
- code = tCompress(pBuilder->pValC, pColVal->value.pData, pColVal->value.nData);
- if (code) return code;
- } else {
- code = tCompress(pBuilder->pValC, &pColVal->value.val, tDataTypes[pColVal->type].bytes);
- if (code) return code;
- }
-
- return code;
-}
-static FORCE_INLINE int32_t tDiskColAddVal00(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- pBuilder->flag = HAS_VALUE;
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal01(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- pBuilder->flag = HAS_NONE;
- return 0;
-}
-static FORCE_INLINE int32_t tDiskColAddVal02(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- pBuilder->flag = HAS_NULL;
- return 0;
-}
-static FORCE_INLINE int32_t tDiskColAddVal10(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- // bit map
- int32_t nBit = BIT1_SIZE(pBuilder->nVal + 1);
- code = tRealloc(&pBuilder->pBitMap, nBit);
- if (code) return code;
-
- memset(pBuilder->pBitMap, 0, nBit);
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 1);
-
- // value
- pBuilder->flag |= HAS_VALUE;
-
- SColVal cv = COL_VAL_VALUE(pColVal->cid, pColVal->type, (SValue){0});
- for (int32_t iVal = 0; iVal < pBuilder->nVal; iVal++) {
- code = tDiskColPutValue(pBuilder, &cv);
- if (code) return code;
- }
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal12(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- int32_t nBit = BIT1_SIZE(pBuilder->nVal + 1);
- code = tRealloc(&pBuilder->pBitMap, nBit);
- if (code) return code;
-
- memset(pBuilder->pBitMap, 0, nBit);
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 1);
-
- pBuilder->flag |= HAS_NULL;
-
- return code;
-}
-static FORCE_INLINE int32_t tDiskColAddVal20(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- int32_t nBit = BIT1_SIZE(pBuilder->nVal + 1);
- code = tRealloc(&pBuilder->pBitMap, nBit);
- if (code) return code;
-
- pBuilder->flag |= HAS_VALUE;
-
- memset(pBuilder->pBitMap, 0, nBit);
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 1);
-
- SColVal cv = COL_VAL_VALUE(pColVal->cid, pColVal->type, (SValue){0});
- for (int32_t iVal = 0; iVal < pBuilder->nVal; iVal++) {
- code = tDiskColPutValue(pBuilder, &cv);
- if (code) return code;
- }
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal21(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- int32_t nBit = BIT1_SIZE(pBuilder->nVal + 1);
- code = tRealloc(&pBuilder->pBitMap, nBit);
- if (code) return code;
-
- pBuilder->flag |= HAS_NONE;
-
- memset(pBuilder->pBitMap, 255, nBit);
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 0);
-
- return code;
-}
-static FORCE_INLINE int32_t tDiskColAddVal30(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- pBuilder->flag |= HAS_VALUE;
-
- uint8_t *pBitMap = NULL;
- code = tRealloc(&pBitMap, BIT2_SIZE(pBuilder->nVal + 1));
- if (code) return code;
-
- for (int32_t iVal = 0; iVal < pBuilder->nVal; iVal++) {
- SET_BIT2(pBitMap, iVal, GET_BIT1(pBuilder->pBitMap, iVal));
- }
- SET_BIT2(pBitMap, pBuilder->nVal, 2);
-
- tFree(pBuilder->pBitMap);
- pBuilder->pBitMap = pBitMap;
-
- SColVal cv = COL_VAL_VALUE(pColVal->cid, pColVal->type, (SValue){0});
- for (int32_t iVal = 0; iVal < pBuilder->nVal; iVal++) {
- code = tDiskColPutValue(pBuilder, &cv);
- if (code) return code;
- }
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal31(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT1_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 0);
-
- return code;
-}
-static FORCE_INLINE int32_t tDiskColAddVal32(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT1_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 1);
-
- return code;
-}
-static FORCE_INLINE int32_t tDiskColAddVal40(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal41(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- pBuilder->flag |= HAS_NONE;
-
- int32_t nBit = BIT1_SIZE(pBuilder->nVal + 1);
- code = tRealloc(&pBuilder->pBitMap, nBit);
- if (code) return code;
-
- memset(pBuilder->pBitMap, 255, nBit);
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 0);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal42(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- pBuilder->flag |= HAS_NULL;
-
- int32_t nBit = BIT1_SIZE(pBuilder->nVal + 1);
- code = tRealloc(&pBuilder->pBitMap, nBit);
- if (code) return code;
-
- memset(pBuilder->pBitMap, 255, nBit);
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 0);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal50(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT1_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 1);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal51(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT1_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 0);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal52(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- pBuilder->flag |= HAS_NULL;
-
- uint8_t *pBitMap = NULL;
- code = tRealloc(&pBitMap, BIT2_SIZE(pBuilder->nVal + 1));
- if (code) return code;
-
- for (int32_t iVal = 0; iVal < pBuilder->nVal; iVal++) {
- SET_BIT2(pBitMap, iVal, GET_BIT1(pBuilder->pBitMap, iVal) ? 2 : 0);
- }
- SET_BIT2(pBitMap, pBuilder->nVal, 1);
-
- tFree(pBuilder->pBitMap);
- pBuilder->pBitMap = pBitMap;
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal60(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT1_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 1);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal61(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- pBuilder->flag |= HAS_NONE;
-
- uint8_t *pBitMap = NULL;
- code = tRealloc(&pBitMap, BIT2_SIZE(pBuilder->nVal + 1));
- if (code) return code;
-
- for (int32_t iVal = 0; iVal < pBuilder->nVal; iVal++) {
- SET_BIT2(pBitMap, iVal, GET_BIT1(pBuilder->pBitMap, iVal) ? 2 : 1);
- }
- SET_BIT2(pBitMap, pBuilder->nVal, 0);
-
- tFree(pBuilder->pBitMap);
- pBuilder->pBitMap = pBitMap;
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal62(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT1_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT1(pBuilder->pBitMap, pBuilder->nVal, 0);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal70(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT2_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT2(pBuilder->pBitMap, pBuilder->nVal, 2);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal71(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT2_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT2(pBuilder->pBitMap, pBuilder->nVal, 0);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static FORCE_INLINE int32_t tDiskColAddVal72(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- code = tRealloc(&pBuilder->pBitMap, BIT2_SIZE(pBuilder->nVal + 1));
- if (code) return code;
- SET_BIT2(pBuilder->pBitMap, pBuilder->nVal, 1);
-
- return tDiskColPutValue(pBuilder, pColVal);
-}
-static int32_t (*tDiskColAddValImpl[8][3])(SDiskColBuilder *pBuilder, SColVal *pColVal) = {
- {tDiskColAddVal00, tDiskColAddVal01, tDiskColAddVal02}, // 0
- {tDiskColAddVal10, NULL, tDiskColAddVal12}, // HAS_NONE
- {tDiskColAddVal20, tDiskColAddVal21, NULL}, // HAS_NULL
- {tDiskColAddVal30, tDiskColAddVal31, tDiskColAddVal32}, // HAS_NULL|HAS_NONE
- {tDiskColAddVal40, tDiskColAddVal41, tDiskColAddVal42}, // HAS_VALUE
- {tDiskColAddVal50, tDiskColAddVal51, tDiskColAddVal52}, // HAS_VALUE|HAS_NONE
- {tDiskColAddVal60, tDiskColAddVal61, tDiskColAddVal62}, // HAS_VALUE|HAS_NULL
- {tDiskColAddVal70, tDiskColAddVal71, tDiskColAddVal72} // HAS_VALUE|HAS_NULL|HAS_NONE
-};
-// extern void (*tSmaUpdateImpl[])(SColumnDataAgg *pColAgg, SColVal *pColVal, uint8_t *minSet, uint8_t *maxSet);
-static int32_t tDiskColAddVal(SDiskColBuilder *pBuilder, SColVal *pColVal) {
- int32_t code = 0;
-
- if (pBuilder->calcSma) {
- if (COL_VAL_IS_VALUE(pColVal)) {
- // tSmaUpdateImpl[pBuilder->type](&pBuilder->sma, pColVal, &pBuilder->minSet, &pBuilder->maxSet);
- } else {
- pBuilder->sma.numOfNull++;
- }
- }
-
- if (tDiskColAddValImpl[pBuilder->flag][pColVal->flag]) {
- code = tDiskColAddValImpl[pBuilder->flag][pColVal->flag](pBuilder, pColVal);
- if (code) return code;
- }
-
- pBuilder->nVal++;
-
- return code;
-}
-
-// SDiskDataBuilder ================================================
-int32_t tDiskDataBuilderCreate(SDiskDataBuilder **ppBuilder) {
- int32_t code = 0;
-
- *ppBuilder = (SDiskDataBuilder *)taosMemoryCalloc(1, sizeof(SDiskDataBuilder));
- if (*ppBuilder == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- return code;
- }
-
- return code;
-}
-
-void *tDiskDataBuilderDestroy(SDiskDataBuilder *pBuilder) {
- if (pBuilder == NULL) return NULL;
-
- if (pBuilder->pUidC) tCompressorDestroy(pBuilder->pUidC);
- if (pBuilder->pVerC) tCompressorDestroy(pBuilder->pVerC);
- if (pBuilder->pKeyC) tCompressorDestroy(pBuilder->pKeyC);
-
- if (pBuilder->aBuilder) {
- for (int32_t iBuilder = 0; iBuilder < taosArrayGetSize(pBuilder->aBuilder); iBuilder++) {
- SDiskColBuilder *pDCBuilder = (SDiskColBuilder *)taosArrayGet(pBuilder->aBuilder, iBuilder);
- tDiskColBuilderDestroy(pDCBuilder);
- }
- taosArrayDestroy(pBuilder->aBuilder);
- }
- for (int32_t iBuf = 0; iBuf < sizeof(pBuilder->aBuf) / sizeof(pBuilder->aBuf[0]); iBuf++) {
- tFree(pBuilder->aBuf[iBuf]);
- }
- tDiskDataDestroy(&pBuilder->dd);
- taosMemoryFree(pBuilder);
-
- return NULL;
-}
-
-int32_t tDiskDataBuilderInit(SDiskDataBuilder *pBuilder, STSchema *pTSchema, TABLEID *pId, uint8_t cmprAlg,
- uint8_t calcSma) {
- int32_t code = 0;
-
- ASSERT(pId->suid || pId->uid);
-
- pBuilder->suid = pId->suid;
- pBuilder->uid = pId->uid;
- pBuilder->nRow = 0;
- pBuilder->cmprAlg = cmprAlg;
- pBuilder->calcSma = calcSma;
- pBuilder->bi = (SBlkInfo){.minUid = INT64_MAX,
- .maxUid = INT64_MIN,
- .minKey = TSKEY_MAX,
- .maxKey = TSKEY_MIN,
- .minVer = VERSION_MAX,
- .maxVer = VERSION_MIN,
- .minTKey = TSDBKEY_MAX,
- .maxTKey = TSDBKEY_MIN};
-
- if (pBuilder->pUidC == NULL && (code = tCompressorCreate(&pBuilder->pUidC))) return code;
- code = tCompressStart(pBuilder->pUidC, TSDB_DATA_TYPE_BIGINT, cmprAlg);
- if (code) return code;
-
- if (pBuilder->pVerC == NULL && (code = tCompressorCreate(&pBuilder->pVerC))) return code;
- code = tCompressStart(pBuilder->pVerC, TSDB_DATA_TYPE_BIGINT, cmprAlg);
- if (code) return code;
-
- if (pBuilder->pKeyC == NULL && (code = tCompressorCreate(&pBuilder->pKeyC))) return code;
- code = tCompressStart(pBuilder->pKeyC, TSDB_DATA_TYPE_TIMESTAMP, cmprAlg);
- if (code) return code;
-
- if (pBuilder->aBuilder == NULL) {
- pBuilder->aBuilder = taosArrayInit(pTSchema->numOfCols - 1, sizeof(SDiskColBuilder));
- if (pBuilder->aBuilder == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- return code;
- }
- }
-
- pBuilder->nBuilder = 0;
- for (int32_t iCol = 1; iCol < pTSchema->numOfCols; iCol++) {
- STColumn *pTColumn = &pTSchema->columns[iCol];
-
- if (pBuilder->nBuilder >= taosArrayGetSize(pBuilder->aBuilder)) {
- SDiskColBuilder dc = tDiskColBuilderCreate();
- if (taosArrayPush(pBuilder->aBuilder, &dc) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- return code;
- }
- }
-
- SDiskColBuilder *pDCBuilder = (SDiskColBuilder *)taosArrayGet(pBuilder->aBuilder, pBuilder->nBuilder);
-
- code = tDiskColBuilderInit(pDCBuilder, pTColumn->colId, pTColumn->type, cmprAlg,
- (calcSma && (pTColumn->flags & COL_SMA_ON)));
- if (code) return code;
-
- pBuilder->nBuilder++;
- }
-
- return code;
-}
-
-int32_t tDiskDataBuilderClear(SDiskDataBuilder *pBuilder) {
- int32_t code = 0;
- pBuilder->suid = 0;
- pBuilder->uid = 0;
- pBuilder->nRow = 0;
- return code;
-}
-
-int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTSchema, TABLEID *pId) {
- int32_t code = 0;
-
- ASSERT(pBuilder->suid || pBuilder->uid);
- ASSERT(pId->suid == pBuilder->suid);
-
- TSDBKEY kRow = TSDBROW_KEY(pRow);
- if (tsdbKeyCmprFn(&pBuilder->bi.minTKey, &kRow) > 0) pBuilder->bi.minTKey = kRow;
- if (tsdbKeyCmprFn(&pBuilder->bi.maxTKey, &kRow) < 0) pBuilder->bi.maxTKey = kRow;
-
- // uid
- if (pBuilder->uid && pBuilder->uid != pId->uid) {
- ASSERT(pBuilder->suid);
- for (int32_t iRow = 0; iRow < pBuilder->nRow; iRow++) {
- code = tCompress(pBuilder->pUidC, &pBuilder->uid, sizeof(int64_t));
- if (code) return code;
- }
- pBuilder->uid = 0;
- }
- if (pBuilder->uid == 0) {
- code = tCompress(pBuilder->pUidC, &pId->uid, sizeof(int64_t));
- if (code) return code;
- }
- if (pBuilder->bi.minUid > pId->uid) pBuilder->bi.minUid = pId->uid;
- if (pBuilder->bi.maxUid < pId->uid) pBuilder->bi.maxUid = pId->uid;
-
- // version
- code = tCompress(pBuilder->pVerC, &kRow.version, sizeof(int64_t));
- if (code) return code;
- if (pBuilder->bi.minVer > kRow.version) pBuilder->bi.minVer = kRow.version;
- if (pBuilder->bi.maxVer < kRow.version) pBuilder->bi.maxVer = kRow.version;
-
- // TSKEY
- code = tCompress(pBuilder->pKeyC, &kRow.ts, sizeof(int64_t));
- if (code) return code;
- if (pBuilder->bi.minKey > kRow.ts) pBuilder->bi.minKey = kRow.ts;
- if (pBuilder->bi.maxKey < kRow.ts) pBuilder->bi.maxKey = kRow.ts;
-
- STSDBRowIter iter = {0};
- tsdbRowIterOpen(&iter, pRow, pTSchema);
-
- SColVal *pColVal = tsdbRowIterNext(&iter);
- for (int32_t iBuilder = 0; iBuilder < pBuilder->nBuilder; iBuilder++) {
- SDiskColBuilder *pDCBuilder = (SDiskColBuilder *)taosArrayGet(pBuilder->aBuilder, iBuilder);
-
- while (pColVal && pColVal->cid < pDCBuilder->cid) {
- pColVal = tsdbRowIterNext(&iter);
- }
-
- if (pColVal && pColVal->cid == pDCBuilder->cid) {
- code = tDiskColAddVal(pDCBuilder, pColVal);
- if (code) return code;
- pColVal = tsdbRowIterNext(&iter);
- } else {
- code = tDiskColAddVal(pDCBuilder, &COL_VAL_NONE(pDCBuilder->cid, pDCBuilder->type));
- if (code) return code;
- }
- }
- pBuilder->nRow++;
-
- return code;
-}
-
-int32_t tGnrtDiskData(SDiskDataBuilder *pBuilder, const SDiskData **ppDiskData, const SBlkInfo **ppBlkInfo) {
- int32_t code = 0;
-
- ASSERT(pBuilder->nRow);
-
- *ppDiskData = NULL;
- *ppBlkInfo = NULL;
-
- SDiskData *pDiskData = &pBuilder->dd;
- // reset SDiskData
- pDiskData->hdr = (SDiskDataHdr){.delimiter = TSDB_FILE_DLMT,
- .fmtVer = 0,
- .suid = pBuilder->suid,
- .uid = pBuilder->uid,
- .szUid = 0,
- .szVer = 0,
- .szKey = 0,
- .szBlkCol = 0,
- .nRow = pBuilder->nRow,
- .cmprAlg = pBuilder->cmprAlg};
- pDiskData->pUid = NULL;
- pDiskData->pVer = NULL;
- pDiskData->pKey = NULL;
-
- // UID
- if (pBuilder->uid == 0) {
- code = tCompressEnd(pBuilder->pUidC, &pDiskData->pUid, &pDiskData->hdr.szUid, NULL);
- if (code) return code;
- }
-
- // VERSION
- code = tCompressEnd(pBuilder->pVerC, &pDiskData->pVer, &pDiskData->hdr.szVer, NULL);
- if (code) return code;
-
- // TSKEY
- code = tCompressEnd(pBuilder->pKeyC, &pDiskData->pKey, &pDiskData->hdr.szKey, NULL);
- if (code) return code;
-
- // aDiskCol
- if (pDiskData->aDiskCol) {
- taosArrayClear(pDiskData->aDiskCol);
- } else {
- pDiskData->aDiskCol = taosArrayInit(pBuilder->nBuilder, sizeof(SDiskCol));
- if (pDiskData->aDiskCol == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- return code;
- }
- }
-
- int32_t offset = 0;
- for (int32_t iBuilder = 0; iBuilder < pBuilder->nBuilder; iBuilder++) {
- SDiskColBuilder *pDCBuilder = (SDiskColBuilder *)taosArrayGet(pBuilder->aBuilder, iBuilder);
-
- if (pDCBuilder->flag == HAS_NONE) continue;
-
- SDiskCol dCol;
-
- code = tGnrtDiskCol(pDCBuilder, &dCol);
- if (code) return code;
-
- dCol.bCol.offset = offset;
- offset = offset + dCol.bCol.szBitmap + dCol.bCol.szOffset + dCol.bCol.szValue;
-
- if (taosArrayPush(pDiskData->aDiskCol, &dCol) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- return code;
- }
-
- pDiskData->hdr.szBlkCol += tPutBlockCol(NULL, &dCol.bCol);
- }
-
- *ppDiskData = pDiskData;
- *ppBlkInfo = &pBuilder->bi;
- return code;
-}
diff --git a/source/dnode/vnode/src/tsdb/tsdbFSetRW.c b/source/dnode/vnode/src/tsdb/tsdbFSetRW.c
index e524d6874e..b0917cceb0 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFSetRW.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFSetRW.c
@@ -22,7 +22,7 @@ struct SFSetWriter {
SSkmInfo skmTb[1];
SSkmInfo skmRow[1];
- uint8_t *bufArr[10];
+ SBuffer buffers[10];
struct {
TABLEID tbid[1];
@@ -152,7 +152,7 @@ int32_t tsdbFSetWriterOpen(SFSetWriterConfig *config, SFSetWriter **writer) {
.compactVersion = config->compactVersion,
.skmTb = writer[0]->skmTb,
.skmRow = writer[0]->skmRow,
- .bufArr = writer[0]->bufArr,
+ .buffers = writer[0]->buffers,
};
for (int32_t ftype = 0; ftype < TSDB_FTYPE_MAX; ++ftype) {
dataWriterConfig.files[ftype].exist = config->files[ftype].exist;
@@ -176,7 +176,8 @@ int32_t tsdbFSetWriterOpen(SFSetWriterConfig *config, SFSetWriter **writer) {
.level = config->level,
.skmTb = writer[0]->skmTb,
.skmRow = writer[0]->skmRow,
- .bufArr = writer[0]->bufArr,
+ .buffers = writer[0]->buffers,
+
};
code = tsdbSttFileWriterOpen(&sttWriterConfig, &writer[0]->sttWriter);
TSDB_CHECK_CODE(code, lino, _exit);
@@ -212,8 +213,8 @@ int32_t tsdbFSetWriterClose(SFSetWriter **writer, bool abort, TFileOpArray *fopA
for (int32_t i = 0; i < ARRAY_SIZE(writer[0]->blockData); i++) {
tBlockDataDestroy(&writer[0]->blockData[i]);
}
- for (int32_t i = 0; i < ARRAY_SIZE(writer[0]->bufArr); i++) {
- tFree(writer[0]->bufArr[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(writer[0]->buffers); i++) {
+ tBufferDestroy(&writer[0]->buffers[i]);
}
tDestroyTSchema(writer[0]->skmRow->pTSchema);
tDestroyTSchema(writer[0]->skmTb->pTSchema);
@@ -248,10 +249,11 @@ int32_t tsdbFSetWriteRow(SFSetWriter *writer, SRowInfo *row) {
TSDB_CHECK_CODE(code, lino, _exit);
}
- TSDBKEY key = TSDBROW_KEY(&row->row);
- if (key.version <= writer->config->compactVersion //
- && writer->blockData[writer->blockDataIdx].nRow > 0 //
- && key.ts == writer->blockData[writer->blockDataIdx].aTSKEY[writer->blockData[writer->blockDataIdx].nRow - 1]) {
+ if (TSDBROW_VERSION(&row->row) <= writer->config->compactVersion //
+ && writer->blockData[writer->blockDataIdx].nRow > 0 //
+ && tsdbRowCompareWithoutVersion(&row->row,
+ &tsdbRowFromBlockData(&writer->blockData[writer->blockDataIdx],
+ writer->blockData[writer->blockDataIdx].nRow - 1)) == 0) {
code = tBlockDataUpdateRow(&writer->blockData[writer->blockDataIdx], &row->row, writer->skmRow->pTSchema);
TSDB_CHECK_CODE(code, lino, _exit);
} else {
diff --git a/source/dnode/vnode/src/tsdb/tsdbIter.c b/source/dnode/vnode/src/tsdb/tsdbIter.c
index 447832108d..42afe1cdc0 100644
--- a/source/dnode/vnode/src/tsdb/tsdbIter.c
+++ b/source/dnode/vnode/src/tsdb/tsdbIter.c
@@ -45,7 +45,7 @@ struct STsdbIter {
} dataData[1];
struct {
SMemTable *memt;
- TSDBKEY from[1];
+ STsdbRowKey from[1];
SRBTreeIter iter[1];
STbData *tbData;
STbDataIter tbIter[1];
@@ -147,12 +147,11 @@ static int32_t tsdbDataIterNext(STsdbIter *iter, const TABLEID *tbid) {
}
// SBrinBlock
- if (iter->dataData->brinBlockIdx >= BRIN_BLOCK_SIZE(iter->dataData->brinBlock)) {
+ if (iter->dataData->brinBlockIdx >= iter->dataData->brinBlock->numOfRecords) {
break;
}
- for (; iter->dataData->brinBlockIdx < BRIN_BLOCK_SIZE(iter->dataData->brinBlock);
- iter->dataData->brinBlockIdx++) {
+ for (; iter->dataData->brinBlockIdx < iter->dataData->brinBlock->numOfRecords; iter->dataData->brinBlockIdx++) {
SBrinRecord record[1];
tBrinBlockGet(iter->dataData->brinBlock, iter->dataData->brinBlockIdx, record);
@@ -255,9 +254,7 @@ _exit:
static int32_t tsdbDataTombIterNext(STsdbIter *iter, const TABLEID *tbid) {
while (!iter->noMoreData) {
for (; iter->dataTomb->tombBlockIdx < TOMB_BLOCK_SIZE(iter->dataTomb->tombBlock); iter->dataTomb->tombBlockIdx++) {
- iter->record->suid = TARRAY2_GET(iter->dataTomb->tombBlock->suid, iter->dataTomb->tombBlockIdx);
- iter->record->uid = TARRAY2_GET(iter->dataTomb->tombBlock->uid, iter->dataTomb->tombBlockIdx);
- iter->record->version = TARRAY2_GET(iter->dataTomb->tombBlock->version, iter->dataTomb->tombBlockIdx);
+ tTombBlockGet(iter->dataTomb->tombBlock, iter->dataTomb->tombBlockIdx, iter->record);
if (iter->filterByVersion && (iter->record->version < iter->range[0] || iter->record->version > iter->range[1])) {
continue;
@@ -266,9 +263,6 @@ static int32_t tsdbDataTombIterNext(STsdbIter *iter, const TABLEID *tbid) {
if (tbid && iter->record->suid == tbid->suid && iter->record->uid == tbid->uid) {
continue;
}
-
- iter->record->skey = TARRAY2_GET(iter->dataTomb->tombBlock->skey, iter->dataTomb->tombBlockIdx);
- iter->record->ekey = TARRAY2_GET(iter->dataTomb->tombBlock->ekey, iter->dataTomb->tombBlockIdx);
iter->dataTomb->tombBlockIdx++;
goto _exit;
}
@@ -445,9 +439,7 @@ static int32_t tsdbMemTableIterClose(STsdbIter *iter) { return 0; }
static int32_t tsdbSttTombIterNext(STsdbIter *iter, const TABLEID *tbid) {
while (!iter->noMoreData) {
for (; iter->sttTomb->tombBlockIdx < TOMB_BLOCK_SIZE(iter->sttTomb->tombBlock); iter->sttTomb->tombBlockIdx++) {
- iter->record->suid = TARRAY2_GET(iter->sttTomb->tombBlock->suid, iter->sttTomb->tombBlockIdx);
- iter->record->uid = TARRAY2_GET(iter->sttTomb->tombBlock->uid, iter->sttTomb->tombBlockIdx);
- iter->record->version = TARRAY2_GET(iter->sttTomb->tombBlock->version, iter->sttTomb->tombBlockIdx);
+ tTombBlockGet(iter->sttTomb->tombBlock, iter->sttTomb->tombBlockIdx, iter->record);
if (iter->filterByVersion && (iter->record->version < iter->range[0] || iter->record->version > iter->range[1])) {
continue;
@@ -457,8 +449,6 @@ static int32_t tsdbSttTombIterNext(STsdbIter *iter, const TABLEID *tbid) {
continue;
}
- iter->record->skey = TARRAY2_GET(iter->sttTomb->tombBlock->skey, iter->sttTomb->tombBlockIdx);
- iter->record->ekey = TARRAY2_GET(iter->sttTomb->tombBlock->ekey, iter->sttTomb->tombBlockIdx);
iter->sttTomb->tombBlockIdx++;
goto _exit;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbIter.h b/source/dnode/vnode/src/tsdb/tsdbIter.h
index 367901bd84..05449d2042 100644
--- a/source/dnode/vnode/src/tsdb/tsdbIter.h
+++ b/source/dnode/vnode/src/tsdb/tsdbIter.h
@@ -44,8 +44,8 @@ typedef struct {
SSttFileReader *sttReader; // TSDB_ITER_TYPE_STT || TSDB_ITER_TYPE_STT_TOMB
SDataFileReader *dataReader; // TSDB_ITER_TYPE_DATA || TSDB_ITER_TYPE_DATA_TOMB
struct {
- SMemTable *memt; // TSDB_ITER_TYPE_MEMT_TOMB
- TSDBKEY from[1];
+ SMemTable *memt; // TSDB_ITER_TYPE_MEMT_TOMB
+ STsdbRowKey from[1];
}; // TSDB_ITER_TYPE_MEMT
};
bool filterByVersion;
diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c
index 4657b60f62..8be8fa5bd7 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c
@@ -31,7 +31,7 @@
#define SL_MOVE_BACKWARD 0x1
#define SL_MOVE_FROM_POS 0x2
-static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, TSDBKEY *pKey, int32_t flags);
+static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, STsdbRowKey *pKey, int32_t flags);
static int32_t tsdbGetOrCreateTbData(SMemTable *pMemTable, tb_uid_t suid, tb_uid_t uid, STbData **ppTbData);
static int32_t tsdbInsertRowDataToTable(SMemTable *pMemTable, STbData *pTbData, int64_t version,
SSubmitTbData *pSubmitTbData, int32_t *affectedRows);
@@ -219,7 +219,7 @@ _err:
return code;
}
-int32_t tsdbTbDataIterCreate(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter **ppIter) {
+int32_t tsdbTbDataIterCreate(STbData *pTbData, STsdbRowKey *pFrom, int8_t backward, STbDataIter **ppIter) {
int32_t code = 0;
(*ppIter) = (STbDataIter *)taosMemoryCalloc(1, sizeof(STbDataIter));
@@ -241,7 +241,7 @@ void *tsdbTbDataIterDestroy(STbDataIter *pIter) {
return NULL;
}
-void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter *pIter) {
+void tsdbTbDataIterOpen(STbData *pTbData, STsdbRowKey *pFrom, int8_t backward, STbDataIter *pIter) {
SMemSkipListNode *pos[SL_MAX_LEVEL];
SMemSkipListNode *pHead;
SMemSkipListNode *pTail;
@@ -433,10 +433,10 @@ _err:
return code;
}
-static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, TSDBKEY *pKey, int32_t flags) {
+static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, STsdbRowKey *pKey, int32_t flags) {
SMemSkipListNode *px;
SMemSkipListNode *pn;
- TSDBKEY tKey = {0};
+ STsdbRowKey tKey;
int32_t backward = flags & SL_MOVE_BACKWARD;
int32_t fromPos = flags & SL_MOVE_FROM_POS;
@@ -455,15 +455,9 @@ static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, TSDBKEY *p
for (int8_t iLevel = pTbData->sl.level - 1; iLevel >= 0; iLevel--) {
pn = SL_GET_NODE_BACKWARD(px, iLevel);
while (pn != pTbData->sl.pHead) {
- if (pn->flag == TSDBROW_ROW_FMT) {
- tKey.version = pn->version;
- tKey.ts = ((SRow *)pn->pData)->ts;
- } else if (pn->flag == TSDBROW_COL_FMT) {
- tKey.version = ((SBlockData *)pn->pData)->aVersion[pn->iRow];
- tKey.ts = ((SBlockData *)pn->pData)->aTSKEY[pn->iRow];
- }
+ tsdbRowGetKey(&pn->row, &tKey);
- int32_t c = tsdbKeyCmprFn(&tKey, pKey);
+ int32_t c = tsdbRowKeyCmpr(&tKey, pKey);
if (c <= 0) {
break;
} else {
@@ -490,15 +484,9 @@ static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, TSDBKEY *p
for (int8_t iLevel = pTbData->sl.level - 1; iLevel >= 0; iLevel--) {
pn = SL_GET_NODE_FORWARD(px, iLevel);
while (pn != pTbData->sl.pTail) {
- if (pn->flag == TSDBROW_ROW_FMT) {
- tKey.version = pn->version;
- tKey.ts = ((SRow *)pn->pData)->ts;
- } else if (pn->flag == TSDBROW_COL_FMT) {
- tKey.version = ((SBlockData *)pn->pData)->aVersion[pn->iRow];
- tKey.ts = ((SBlockData *)pn->pData)->aTSKEY[pn->iRow];
- }
+ tsdbRowGetKey(&pn->row, &tKey);
- int32_t c = tsdbKeyCmprFn(&tKey, pKey);
+ int32_t c = tsdbRowKeyCmpr(&tKey, pKey);
if (c >= 0) {
break;
} else {
@@ -547,16 +535,10 @@ static int32_t tbDataDoPut(SMemTable *pMemTable, STbData *pTbData, SMemSkipListN
}
pNode->level = level;
- pNode->flag = pRow->type;
+ pNode->row = *pRow;
if (pRow->type == TSDBROW_ROW_FMT) {
- pNode->version = pRow->version;
- pNode->pData = (char *)pNode + nSize;
- memcpy(pNode->pData, pRow->pTSRow, pRow->pTSRow->len);
- } else if (pRow->type == TSDBROW_COL_FMT) {
- pNode->iRow = pRow->iRow;
- pNode->pData = pRow->pBlockData;
- } else {
- ASSERT(0);
+ pNode->row.pTSRow = (SRow *)((char *)pNode + nSize);
+ memcpy(pNode->row.pTSRow, pRow->pTSRow, pRow->pTSRow->len);
}
// set node
@@ -656,13 +638,14 @@ static int32_t tsdbInsertColDataToTable(SMemTable *pMemTable, STbData *pTbData,
// loop to add each row to the skiplist
SMemSkipListNode *pos[SL_MAX_LEVEL];
TSDBROW tRow = tsdbRowFromBlockData(pBlockData, 0);
- TSDBKEY key = {.version = version, .ts = pBlockData->aTSKEY[0]};
+ STsdbRowKey key;
TSDBROW lRow; // last row
// first row
+ tsdbRowGetKey(&tRow, &key);
tbDataMovePosTo(pTbData, pos, &key, SL_MOVE_BACKWARD);
if ((code = tbDataDoPut(pMemTable, pTbData, pos, &tRow, 0))) goto _exit;
- pTbData->minKey = TMIN(pTbData->minKey, key.ts);
+ pTbData->minKey = TMIN(pTbData->minKey, key.key.ts);
lRow = tRow;
// remain row
@@ -673,7 +656,7 @@ static int32_t tsdbInsertColDataToTable(SMemTable *pMemTable, STbData *pTbData,
}
while (tRow.iRow < pBlockData->nRow) {
- key.ts = pBlockData->aTSKEY[tRow.iRow];
+ tsdbRowGetKey(&tRow, &key);
if (SL_NODE_FORWARD(pos[0], 0) != pTbData->sl.pTail) {
tbDataMovePosTo(pTbData, pos, &key, SL_MOVE_FROM_POS);
@@ -686,8 +669,8 @@ static int32_t tsdbInsertColDataToTable(SMemTable *pMemTable, STbData *pTbData,
}
}
- if (key.ts >= pTbData->maxKey) {
- pTbData->maxKey = key.ts;
+ if (key.key.ts >= pTbData->maxKey) {
+ pTbData->maxKey = key.key.ts;
}
if (!TSDB_CACHE_NO(pMemTable->pTsdb->pVnode->config)) {
@@ -711,7 +694,7 @@ static int32_t tsdbInsertRowDataToTable(SMemTable *pMemTable, STbData *pTbData,
int32_t nRow = TARRAY_SIZE(pSubmitTbData->aRowP);
SRow **aRow = (SRow **)TARRAY_DATA(pSubmitTbData->aRowP);
- TSDBKEY key = {.version = version};
+ STsdbRowKey key;
SMemSkipListNode *pos[SL_MAX_LEVEL];
TSDBROW tRow = {.type = TSDBROW_ROW_FMT, .version = version};
int32_t iRow = 0;
@@ -719,13 +702,13 @@ static int32_t tsdbInsertRowDataToTable(SMemTable *pMemTable, STbData *pTbData,
// backward put first data
tRow.pTSRow = aRow[iRow++];
- key.ts = tRow.pTSRow->ts;
+ tsdbRowGetKey(&tRow, &key);
tbDataMovePosTo(pTbData, pos, &key, SL_MOVE_BACKWARD);
code = tbDataDoPut(pMemTable, pTbData, pos, &tRow, 0);
if (code) goto _exit;
lRow = tRow;
- pTbData->minKey = TMIN(pTbData->minKey, key.ts);
+ pTbData->minKey = TMIN(pTbData->minKey, key.key.ts);
// forward put rest data
if (iRow < nRow) {
@@ -735,7 +718,7 @@ static int32_t tsdbInsertRowDataToTable(SMemTable *pMemTable, STbData *pTbData,
while (iRow < nRow) {
tRow.pTSRow = aRow[iRow];
- key.ts = tRow.pTSRow->ts;
+ tsdbRowGetKey(&tRow, &key);
if (SL_NODE_FORWARD(pos[0], 0) != pTbData->sl.pTail) {
tbDataMovePosTo(pTbData, pos, &key, SL_MOVE_FROM_POS);
@@ -750,8 +733,8 @@ static int32_t tsdbInsertRowDataToTable(SMemTable *pMemTable, STbData *pTbData,
}
}
- if (key.ts >= pTbData->maxKey) {
- pTbData->maxKey = key.ts;
+ if (key.key.ts >= pTbData->maxKey) {
+ pTbData->maxKey = key.key.ts;
}
if (!TSDB_CACHE_NO(pMemTable->pTsdb->pVnode->config)) {
tsdbCacheUpdate(pMemTable->pTsdb, pTbData->suid, pTbData->uid, &lRow);
@@ -833,3 +816,26 @@ SArray *tsdbMemTableGetTbDataArray(SMemTable *pMemTable) {
_exit:
return aTbDataP;
}
+
+TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) {
+ if (pIter == NULL) return NULL;
+
+ if (pIter->pRow) {
+ return pIter->pRow;
+ }
+
+ if (pIter->backward) {
+ if (pIter->pNode == pIter->pTbData->sl.pHead) {
+ return NULL;
+ }
+ } else {
+ if (pIter->pNode == pIter->pTbData->sl.pTail) {
+ return NULL;
+ }
+ }
+
+ pIter->pRow = &pIter->row;
+ pIter->row = pIter->pNode->row;
+
+ return pIter->pRow;
+}
\ No newline at end of file
diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
index 0b86cae1be..ee6f0a8c84 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
@@ -15,10 +15,10 @@
#include "tsdb.h"
#include "tsdbFSet2.h"
-#include "tsdbUtil2.h"
#include "tsdbMerge.h"
#include "tsdbReadUtil.h"
#include "tsdbSttFileRW.h"
+#include "tsdbUtil2.h"
static void tLDataIterClose2(SLDataIter *pIter);
@@ -60,7 +60,7 @@ void *destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
pLoadInfo->currentLoadBlockIndex = 1;
- SBlockDataInfo* pInfo = &pLoadInfo->blockData[0];
+ SBlockDataInfo *pInfo = &pLoadInfo->blockData[0];
tBlockDataDestroy(&pInfo->data);
pInfo->sttBlockIndex = -1;
pInfo->pin = false;
@@ -88,7 +88,7 @@ void destroyLDataIter(SLDataIter *pIter) {
taosMemoryFree(pIter);
}
-void *destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo* pLoadCost) {
+void *destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo *pLoadCost) {
if (pLDataIterArray == NULL) {
return NULL;
}
@@ -115,7 +115,7 @@ void *destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo* pLoa
}
// choose the unpinned slot to load next data block
-static void updateBlockLoadSlot(SSttBlockLoadInfo* pLoadInfo) {
+static void updateBlockLoadSlot(SSttBlockLoadInfo *pLoadInfo) {
int32_t nextSlotIndex = pLoadInfo->currentLoadBlockIndex ^ 1;
if (pLoadInfo->blockData[nextSlotIndex].pin) {
nextSlotIndex = nextSlotIndex ^ 1;
@@ -180,7 +180,7 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) {
pInfo->blockData[1].sttBlockIndex, pIter->iRow, idStr);
return &pInfo->blockData[pInfo->currentLoadBlockIndex].data;
- _exit:
+_exit:
if (code != TSDB_CODE_SUCCESS) {
terrno = code;
}
@@ -325,7 +325,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
}
int32_t startIndex = 0;
- while((startIndex < numOfBlocks) && (pStatisBlkArray->data[startIndex].maxTbid.suid < suid)) {
+ while ((startIndex < numOfBlocks) && (pStatisBlkArray->data[startIndex].maxTbid.suid < suid)) {
++startIndex;
}
@@ -334,7 +334,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
}
int32_t endIndex = startIndex;
- while(endIndex < numOfBlocks && pStatisBlkArray->data[endIndex].minTbid.suid <= suid) {
+ while (endIndex < numOfBlocks && pStatisBlkArray->data[endIndex].minTbid.suid <= suid) {
++endIndex;
}
@@ -346,12 +346,12 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
int64_t st = taosGetTimestampUs();
- for(int32_t k = startIndex; k < endIndex; ++k) {
+ for (int32_t k = startIndex; k < endIndex; ++k) {
tsdbSttFileReadStatisBlock(pSttFileReader, &pStatisBlkArray->data[k], &block);
int32_t i = 0;
- int32_t rows = TARRAY2_SIZE(block.suid);
- while (i < rows && block.suid->data[i] != suid) {
+ int32_t rows = block.numOfRecords;
+ while (i < rows && ((int64_t *)block.suids.data)[i] != suid) {
++i;
}
@@ -365,16 +365,24 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
}
if (pStatisBlkArray->data[k].maxTbid.suid == suid) {
- taosArrayAddBatch(pBlockLoadInfo->info.pUid, &block.uid->data[i], rows - i);
- taosArrayAddBatch(pBlockLoadInfo->info.pFirstKey, &block.firstKey->data[i], rows - i);
- taosArrayAddBatch(pBlockLoadInfo->info.pLastKey, &block.lastKey->data[i], rows - i);
- taosArrayAddBatch(pBlockLoadInfo->info.pCount, &block.count->data[i], rows - i);
+ taosArrayAddBatch(pBlockLoadInfo->info.pUid, tBufferGetDataAt(&block.suids, i * sizeof(int64_t)), rows - i);
+ taosArrayAddBatch(pBlockLoadInfo->info.pFirstKey,
+ tBufferGetDataAt(&block.firstKeyTimestamps, i * sizeof(int64_t)), rows - i);
+ taosArrayAddBatch(pBlockLoadInfo->info.pLastKey,
+ tBufferGetDataAt(&block.lastKeyTimestamps, i * sizeof(int64_t)), rows - i);
+ taosArrayAddBatch(pBlockLoadInfo->info.pCount, tBufferGetDataAt(&block.counts, i * sizeof(int64_t)), rows - i);
} else {
- while (i < rows && block.suid->data[i] == suid) {
- taosArrayPush(pBlockLoadInfo->info.pUid, &block.uid->data[i]);
- taosArrayPush(pBlockLoadInfo->info.pFirstKey, &block.firstKey->data[i]);
- taosArrayPush(pBlockLoadInfo->info.pLastKey, &block.lastKey->data[i]);
- taosArrayPush(pBlockLoadInfo->info.pCount, &block.count->data[i]);
+ STbStatisRecord record;
+ while (i < rows) {
+ tStatisBlockGet(&block, i, &record);
+ if (record.suid != suid) {
+ break;
+ }
+
+ taosArrayPush(pBlockLoadInfo->info.pUid, &record.uid);
+ taosArrayPush(pBlockLoadInfo->info.pFirstKey, &record.firstKey.ts);
+ taosArrayPush(pBlockLoadInfo->info.pLastKey, &record.lastKey.ts);
+ taosArrayPush(pBlockLoadInfo->info.pCount, &record.count);
i += 1;
}
}
@@ -411,6 +419,7 @@ static int32_t doLoadSttFilesBlk(SSttBlockLoadInfo *pBlockLoadInfo, SLDataIter *
return code;
}
+#if 0
// load stt statistics block for all stt-blocks, to decide if the data of queried table exists in current stt file
TStatisBlkArray *pStatisBlkArray = NULL;
code = tsdbSttFileReadStatisBlk(pIter->pReader, (const TStatisBlkArray **)&pStatisBlkArray);
@@ -425,6 +434,7 @@ static int32_t doLoadSttFilesBlk(SSttBlockLoadInfo *pBlockLoadInfo, SLDataIter *
tsdbError("failed to load stt statistics block data, code:%s, %s", tstrerror(code), idStr);
return code;
}
+#endif
code = loadTombFn(pReader1, pIter->pReader, pIter->pBlockLoadInfo);
@@ -433,14 +443,14 @@ static int32_t doLoadSttFilesBlk(SSttBlockLoadInfo *pBlockLoadInfo, SLDataIter *
return code;
}
-static int32_t uidComparFn(const void* p1, const void* p2) {
+static int32_t uidComparFn(const void *p1, const void *p2) {
const uint64_t *pFirst = p1;
const uint64_t *pVal = p2;
if (*pFirst == *pVal) {
return 0;
} else {
- return *pFirst < *pVal? -1:1;
+ return *pFirst < *pVal ? -1 : 1;
}
}
@@ -455,7 +465,7 @@ static void setSttInfoForCurrentTable(SSttBlockLoadInfo *pLoadInfo, uint64_t uid
pTimeWindow->skey = *(int64_t *)taosArrayGet(pLoadInfo->info.pFirstKey, index);
pTimeWindow->ekey = *(int64_t *)taosArrayGet(pLoadInfo->info.pLastKey, index);
- *numOfRows += *(int64_t*) taosArrayGet(pLoadInfo->info.pCount, index);
+ *numOfRows += *(int64_t *)taosArrayGet(pLoadInfo->info.pCount, index);
}
}
@@ -709,7 +719,7 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char *idStr) {
pIter->rInfo.uid = pBlockData->uid;
pIter->rInfo.row = tsdbRowFromBlockData(pBlockData, pIter->iRow);
- _exit:
+_exit:
return (terrno == TSDB_CODE_SUCCESS) && (pIter->pSttBlk != NULL) && (pBlockData != NULL);
}
@@ -740,7 +750,7 @@ static FORCE_INLINE int32_t tLDataIterDescCmprFn(const SRBTreeNode *p1, const SR
return -1 * tLDataIterCmprFn(p1, p2);
}
-int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoForTable* pSttDataInfo) {
+int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoForTable *pSttDataInfo) {
int32_t code = TSDB_CODE_SUCCESS;
pMTree->pIter = NULL;
@@ -765,12 +775,12 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF
for (int32_t j = 0; j < numOfLevels; ++j) {
SSttLvl *pSttLevel = ((STFileSet *)pConf->pCurrentFileset)->lvlArr->data[j];
- SArray * pList = taosArrayGetP(pConf->pSttFileBlockIterArray, j);
+ SArray *pList = taosArrayGetP(pConf->pSttFileBlockIterArray, j);
for (int32_t i = 0; i < TARRAY2_SIZE(pSttLevel->fobjArr); ++i) { // open all last file
SLDataIter *pIter = taosArrayGetP(pList, i);
- SSttFileReader * pSttFileReader = pIter->pReader;
+ SSttFileReader *pSttFileReader = pIter->pReader;
SSttBlockLoadInfo *pLoadInfo = pIter->pBlockLoadInfo;
// open stt file reader if not opened yet
@@ -796,7 +806,8 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF
int64_t numOfRows = 0;
int64_t cid = pSttLevel->fobjArr->data[i]->f->cid;
- code = tLDataIterOpen2(pIter, pSttFileReader, cid, pMTree->backward, pConf, pLoadInfo, &w, &numOfRows, pMTree->idStr);
+ code = tLDataIterOpen2(pIter, pSttFileReader, cid, pMTree->backward, pConf, pLoadInfo, &w, &numOfRows,
+ pMTree->idStr);
if (code != TSDB_CODE_SUCCESS) {
goto _end;
}
@@ -820,7 +831,7 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF
return code;
- _end:
+_end:
tMergeTreeClose(pMTree);
return code;
}
@@ -829,8 +840,8 @@ void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter) { tRBTreePut(&pMTr
bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree) { return pMTree->ignoreEarlierTs; }
-static void tLDataIterPinSttBlock(SLDataIter* pIter, const char* id) {
- SSttBlockLoadInfo* pInfo = pIter->pBlockLoadInfo;
+static void tLDataIterPinSttBlock(SLDataIter *pIter, const char *id) {
+ SSttBlockLoadInfo *pInfo = pIter->pBlockLoadInfo;
if (pInfo->blockData[0].sttBlockIndex == pIter->iSttBlk) {
pInfo->blockData[0].pin = true;
@@ -842,15 +853,15 @@ static void tLDataIterPinSttBlock(SLDataIter* pIter, const char* id) {
if (pInfo->blockData[1].sttBlockIndex == pIter->iSttBlk) {
pInfo->blockData[1].pin = true;
ASSERT(!pInfo->blockData[0].pin);
- tsdbTrace("pin stt-block, blockIndex:%d, stt-fileVer:%"PRId64" %s", pIter->iSttBlk, pIter->cid, id);
+ tsdbTrace("pin stt-block, blockIndex:%d, stt-fileVer:%" PRId64 " %s", pIter->iSttBlk, pIter->cid, id);
return;
}
- tsdbError("failed to pin any stt block, sttBlock:%d stt-fileVer:%"PRId64" %s", pIter->iSttBlk, pIter->cid, id);
+ tsdbError("failed to pin any stt block, sttBlock:%d stt-fileVer:%" PRId64 " %s", pIter->iSttBlk, pIter->cid, id);
}
-static void tLDataIterUnpinSttBlock(SLDataIter* pIter, const char* id) {
- SSttBlockLoadInfo* pInfo = pIter->pBlockLoadInfo;
+static void tLDataIterUnpinSttBlock(SLDataIter *pIter, const char *id) {
+ SSttBlockLoadInfo *pInfo = pIter->pBlockLoadInfo;
if (pInfo->blockData[0].pin) {
ASSERT(!pInfo->blockData[1].pin);
pInfo->blockData[0].pin = false;
@@ -883,7 +894,7 @@ void tMergeTreeUnpinSttBlock(SMergeTree *pMTree) {
return;
}
- SLDataIter* pIter = pMTree->pPinnedBlockIter;
+ SLDataIter *pIter = pMTree->pPinnedBlockIter;
pMTree->pPinnedBlockIter = NULL;
tLDataIterUnpinSttBlock(pIter, pMTree->idStr);
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c
index 90a26d17dc..d7f0476d30 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c
@@ -42,7 +42,8 @@ static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbRe
static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader);
static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts,
SRowMerger* pMerger, SVersionRange* pVerRange, const char* id);
-static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDelList, STsdbReader* pReader);
+static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, STsdbRowKey* pKey, SArray* pDelList,
+ STsdbReader* pReader);
static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pTSRow,
STableBlockScanInfo* pScanInfo);
static int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBlockData* pBlockData,
@@ -79,6 +80,32 @@ static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWi
static void resetPreFilesetMemTableListIndex(SReaderStatus* pStatus);
+static int32_t pkComp(STsdbReader* pReader, TSDBROW* p1, TSDBROW* p2) {
+ STsdbRowKey k1 = {0}, k2 = {0};
+
+ if (pReader->pkComparFn == NULL) {
+ ASSERT(TSDBROW_TS(p1) != TSDBROW_TS(p2));
+ ASSERT(pReader->pkChecked);
+ return 0;
+ }
+
+ tsdbRowGetKey(p1, &k1);
+ tsdbRowGetKey(p2, &k2);
+ return pReader->pkComparFn(&k1.key.pks[0].val, &k2.key.pks[0].val);
+}
+
+static int32_t pkComp1(STsdbReader* pReader, STsdbRowKey* p1, TSDBROW* p2) {
+ if (pReader->pkComparFn == NULL) {
+ ASSERT(p1->key.ts != TSDBROW_TS(p2));
+ ASSERT(pReader->pkChecked);
+ return 0;
+ }
+
+ STsdbRowKey k2 = {0};
+ tsdbRowGetKey(p2, &k2);
+ return pReader->pkComparFn(&p1->key.pks[0].val, &k2.key.pks[0].val);
+}
+
static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pCols, const int32_t* pSlotIdList,
int32_t numOfCols) {
pSupInfo->smaValid = true;
@@ -591,7 +618,7 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
}
// 1. time range check
- if (pRecord->firstKey > w.ekey || pRecord->lastKey < w.skey) {
+ if (pRecord->firstKey.key.ts > w.ekey || pRecord->lastKey.key.ts < w.skey) {
continue;
}
@@ -609,11 +636,11 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
return TSDB_CODE_OUT_OF_MEMORY;
}
- if (pScanInfo->filesetWindow.skey > pRecord->firstKey) {
- pScanInfo->filesetWindow.skey = pRecord->firstKey;
+ if (pScanInfo->filesetWindow.skey > pRecord->firstKey.key.ts) {
+ pScanInfo->filesetWindow.skey = pRecord->firstKey.key.ts;
}
- if (pScanInfo->filesetWindow.ekey < pRecord->lastKey) {
- pScanInfo->filesetWindow.ekey = pRecord->lastKey;
+ if (pScanInfo->filesetWindow.ekey < pRecord->lastKey.key.ts) {
+ pScanInfo->filesetWindow.ekey = pRecord->lastKey.key.ts;
}
pBlockNum->numOfBlocks += 1;
@@ -653,7 +680,7 @@ static void setBlockAllDumped(SFileBlockDumpInfo* pDumpInfo, int64_t maxKey, int
static int32_t doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_t colIndex, SColVal* pColVal,
SBlockLoadSuppInfo* pSup) {
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
if (!COL_VAL_IS_VALUE(pColVal)) {
colDataSetNULL(pColInfoData, rowIndex);
} else {
@@ -670,7 +697,7 @@ static int32_t doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int
colDataSetVal(pColInfoData, rowIndex, pSup->buildBuf[colIndex], false);
}
} else {
- colDataSetVal(pColInfoData, rowIndex, (const char*)&pColVal->value, !COL_VAL_IS_VALUE(pColVal));
+ colDataSetVal(pColInfoData, rowIndex, (const char*)&pColVal->value.val, !COL_VAL_IS_VALUE(pColVal));
}
return TSDB_CODE_SUCCESS;
@@ -744,9 +771,9 @@ static int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData
int32_t endPos = -1;
bool asc = ASCENDING_TRAVERSE(pReader->info.order);
- if (asc && pReader->info.window.ekey >= pRecord->lastKey) {
+ if (asc && pReader->info.window.ekey >= pRecord->lastKey.key.ts) {
endPos = pRecord->numRow - 1;
- } else if (!asc && pReader->info.window.skey <= pRecord->firstKey) {
+ } else if (!asc && pReader->info.window.skey <= pRecord->firstKey.key.ts) {
endPos = 0;
} else {
int64_t key = asc ? pReader->info.window.ekey : pReader->info.window.skey;
@@ -887,10 +914,14 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo
}
}
-static void blockInfoToRecord(SBrinRecord* record, SFileDataBlockInfo* pBlockInfo){
+static void blockInfoToRecord(SBrinRecord* record, SFileDataBlockInfo* pBlockInfo) {
record->uid = pBlockInfo->uid;
- record->firstKey = pBlockInfo->firstKey;
- record->lastKey = pBlockInfo->lastKey;
+ record->firstKey = (STsdbRowKey){
+ .key = {.ts = pBlockInfo->firstKey, .numOfPKs = 0},
+ };
+ record->lastKey = (STsdbRowKey){
+ .key = {.ts = pBlockInfo->lastKey, .numOfPKs = 0},
+ };
record->minVer = pBlockInfo->minVer;
record->maxVer = pBlockInfo->maxVer;
record->blockOffset = pBlockInfo->blockOffset;
@@ -933,9 +964,10 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
// row index of dump info remain the initial position, let's find the appropriate start position.
if ((pDumpInfo->rowIndex == 0 && asc) || (pDumpInfo->rowIndex == pRecord->numRow - 1 && (!asc))) {
- if (asc && pReader->info.window.skey <= pRecord->firstKey && pReader->info.verRange.minVer <= pRecord->minVer) {
+ if (asc && pReader->info.window.skey <= pRecord->firstKey.key.ts &&
+ pReader->info.verRange.minVer <= pRecord->minVer) {
// pDumpInfo->rowIndex = 0;
- } else if (!asc && pReader->info.window.ekey >= pRecord->lastKey &&
+ } else if (!asc && pReader->info.window.ekey >= pRecord->lastKey.key.ts &&
pReader->info.verRange.maxVer >= pRecord->maxVer) {
// pDumpInfo->rowIndex = pRecord->numRow - 1;
} else { // find the appropriate the start position in current block, and set it to be the current rowIndex
@@ -948,8 +980,8 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
tsdbError(
"%p failed to locate the start position in current block, global index:%d, table index:%d, brange:%" PRId64
"-%" PRId64 ", minVer:%" PRId64 ", maxVer:%" PRId64 " %s",
- pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pRecord->firstKey, pRecord->lastKey, pRecord->minVer,
- pRecord->maxVer, pReader->idStr);
+ pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pRecord->firstKey.key.ts, pRecord->lastKey.key.ts,
+ pRecord->minVer, pRecord->maxVer, pReader->idStr);
return TSDB_CODE_INVALID_PARA;
}
@@ -1058,7 +1090,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
setBlockAllDumped(pDumpInfo, ts, pReader->info.order);
}
} else {
- int64_t ts = asc ? pRecord->lastKey : pRecord->firstKey;
+ int64_t ts = asc ? pRecord->lastKey.key.ts : pRecord->firstKey.key.ts;
setBlockAllDumped(pDumpInfo, ts, pReader->info.order);
}
@@ -1068,8 +1100,8 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
int32_t unDumpedRows = asc ? pRecord->numRow - pDumpInfo->rowIndex : pDumpInfo->rowIndex + 1;
tsdbDebug("%p copy file block to sdatablock, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", uid:%" PRIu64 " elapsed time:%.2f ms, %s",
- pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pRecord->firstKey, pRecord->lastKey, dumpedRows,
- unDumpedRows, pRecord->minVer, pRecord->maxVer, pBlockInfo->uid, elapsedTime, pReader->idStr);
+ pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pRecord->firstKey.key.ts, pRecord->lastKey.key.ts,
+ dumpedRows, unDumpedRows, pRecord->minVer, pRecord->maxVer, pBlockInfo->uid, elapsedTime, pReader->idStr);
return TSDB_CODE_SUCCESS;
}
@@ -1122,8 +1154,8 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
if (code != TSDB_CODE_SUCCESS) {
tsdbError("%p error occurs in loading file block, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
", rows:%d, code:%s %s",
- pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlockInfo->firstKey,
- pBlockInfo->lastKey, pBlockInfo->numRow, tstrerror(code), pReader->idStr);
+ pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlockInfo->firstKey, pBlockInfo->lastKey,
+ pBlockInfo->numRow, tstrerror(code), pReader->idStr);
return code;
}
@@ -1131,8 +1163,8 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
tsdbDebug("%p load file block into buffer, global index:%d, index in table block list:%d, brange:%" PRId64 "-%" PRId64
", rows:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", elapsed time:%.2f ms, %s",
- pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pRecord->firstKey, pRecord->lastKey, pRecord->numRow,
- pRecord->minVer, pRecord->maxVer, elapsedTime, pReader->idStr);
+ pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pRecord->firstKey.key.ts, pRecord->lastKey.key.ts,
+ pRecord->numRow, pRecord->minVer, pRecord->maxVer, elapsedTime, pReader->idStr);
pReader->cost.blockLoadTime += elapsedTime;
pDumpInfo->allDumped = false;
@@ -1235,9 +1267,9 @@ static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIte
static bool overlapWithNeighborBlock2(SFileDataBlockInfo* pBlock, SBrinRecord* pRec, int32_t order) {
// it is the last block in current file, no chance to overlap with neighbor blocks.
if (ASCENDING_TRAVERSE(order)) {
- return pBlock->lastKey == pRec->firstKey;
+ return pBlock->lastKey == pRec->firstKey.key.ts;
} else {
- return pBlock->firstKey == pRec->lastKey;
+ return pBlock->firstKey == pRec->lastKey.key.ts;
}
}
@@ -1265,8 +1297,8 @@ static bool bufferDataInFileBlockGap(TSDBKEY keyInBuf, SFileDataBlockInfo* pBloc
}
static bool keyOverlapFileBlock(TSDBKEY key, SFileDataBlockInfo* pBlock, SVersionRange* pVerRange) {
- return (key.ts >= pBlock->firstKey && key.ts <= pBlock->lastKey) &&
- (pBlock->maxVer >= pVerRange->minVer) && (pBlock->minVer <= pVerRange->maxVer);
+ return (key.ts >= pBlock->firstKey && key.ts <= pBlock->lastKey) && (pBlock->maxVer >= pVerRange->minVer) &&
+ (pBlock->minVer <= pVerRange->maxVer);
}
static void getBlockToLoadInfo(SDataBlockToLoadInfo* pInfo, SFileDataBlockInfo* pBlockInfo,
@@ -1291,8 +1323,7 @@ static void getBlockToLoadInfo(SDataBlockToLoadInfo* pInfo, SFileDataBlockInfo*
ASSERT(pScanInfo->sttKeyInfo.status != STT_FILE_READER_UNINIT);
if (pScanInfo->sttKeyInfo.status == STT_FILE_HAS_DATA) {
int64_t nextProcKeyInStt = pScanInfo->sttKeyInfo.nextProcKey;
- pInfo->overlapWithSttBlock =
- !(pBlockInfo->lastKey < nextProcKeyInStt || pBlockInfo->firstKey > nextProcKeyInStt);
+ pInfo->overlapWithSttBlock = !(pBlockInfo->lastKey < nextProcKeyInStt || pBlockInfo->firstKey > nextProcKeyInStt);
}
pInfo->moreThanCapcity = pBlockInfo->numRow > pReader->resBlockInfo.capacity;
@@ -1499,7 +1530,9 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
tsLast = getCurrentKeyInSttBlock(pSttBlockReader);
}
- TSDBKEY k = TSDBROW_KEY(pRow);
+ STsdbRowKey k;
+ tsdbRowGetKey(pRow, &k);
+
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
// merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized
@@ -1518,8 +1551,8 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
minKey = tsLast;
}
- if (minKey > k.ts) {
- minKey = k.ts;
+ if (minKey > k.key.ts) {
+ minKey = k.key.ts;
}
if (minKey > key && hasDataInFileBlock(pBlockData, pDumpInfo)) {
@@ -1531,8 +1564,8 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
minKey = tsLast;
}
- if (minKey < k.ts) {
- minKey = k.ts;
+ if (minKey < k.key.ts) {
+ minKey = k.key.ts;
}
if (minKey < key && hasDataInFileBlock(pBlockData, pDumpInfo)) {
@@ -1560,7 +1593,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, tsLast, pMerger, &pReader->info.verRange, pReader->idStr);
}
- if (minKey == k.ts) {
+ if (minKey == k.key.ts) {
STSchema* pTSchema = NULL;
if (pRow->type == TSDBROW_ROW_FMT) {
pTSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
@@ -1574,13 +1607,13 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
return code;
}
- code = doMergeRowsInBuf(pIter, pBlockScanInfo->uid, k.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(pIter, pBlockScanInfo->uid, &k, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
}
} else {
- if (minKey == k.ts) {
+ if (minKey == k.key.ts) {
STSchema* pTSchema = NULL;
if (pRow->type == TSDBROW_ROW_FMT) {
pTSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
@@ -1594,7 +1627,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
return code;
}
- code = doMergeRowsInBuf(pIter, pBlockScanInfo->uid, k.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(pIter, pBlockScanInfo->uid, &k, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS || pMerger->pTSchema == NULL) {
return code;
}
@@ -1742,8 +1775,9 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
int64_t key = hasDataInFileBlock(pBlockData, pDumpInfo) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN;
- TSDBKEY k = TSDBROW_KEY(pRow);
- TSDBKEY ik = TSDBROW_KEY(piRow);
+ STsdbRowKey k, ik;
+ tsdbRowGetKey(pRow, &k);
+ tsdbRowGetKey(piRow, &ik);
STSchema* pSchema = NULL;
if (pRow->type == TSDBROW_ROW_FMT) {
@@ -1773,12 +1807,12 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
int64_t minKey = 0;
if (ASCENDING_TRAVERSE(pReader->info.order)) {
minKey = INT64_MAX; // let's find the minimum
- if (minKey > k.ts) {
- minKey = k.ts;
+ if (minKey > k.key.ts) {
+ minKey = k.key.ts;
}
- if (minKey > ik.ts) {
- minKey = ik.ts;
+ if (minKey > ik.key.ts) {
+ minKey = ik.key.ts;
}
if (minKey > key && hasDataInFileBlock(pBlockData, pDumpInfo)) {
@@ -1790,12 +1824,12 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
}
} else {
minKey = INT64_MIN; // let find the maximum ts value
- if (minKey < k.ts) {
- minKey = k.ts;
+ if (minKey < k.key.ts) {
+ minKey = k.key.ts;
}
- if (minKey < ik.ts) {
- minKey = ik.ts;
+ if (minKey < ik.key.ts) {
+ minKey = ik.key.ts;
}
if (minKey < key && hasDataInFileBlock(pBlockData, pDumpInfo)) {
@@ -1830,49 +1864,49 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, tsLast, pMerger, &pReader->info.verRange, pReader->idStr);
}
- if (minKey == ik.ts) {
+ if (minKey == ik.key.ts) {
code = tsdbRowMergerAdd(pMerger, piRow, piSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
- code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, ik.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, &ik, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
}
- if (minKey == k.ts) {
+ if (minKey == k.key.ts) {
code = tsdbRowMergerAdd(pMerger, pRow, pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
- code = doMergeRowsInBuf(&pBlockScanInfo->iter, pBlockScanInfo->uid, k.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(&pBlockScanInfo->iter, pBlockScanInfo->uid, &k, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
}
} else {
- if (minKey == k.ts) {
+ if (minKey == k.key.ts) {
code = tsdbRowMergerAdd(pMerger, pRow, pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
- code = doMergeRowsInBuf(&pBlockScanInfo->iter, pBlockScanInfo->uid, k.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(&pBlockScanInfo->iter, pBlockScanInfo->uid, &k, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
}
- if (minKey == ik.ts) {
+ if (minKey == ik.key.ts) {
code = tsdbRowMergerAdd(pMerger, piRow, piSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
- code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, ik.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, &ik, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -1911,7 +1945,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
return code;
}
-int32_t doInitMemDataIter(STsdbReader* pReader, STbData** pData, STableBlockScanInfo* pBlockScanInfo, TSDBKEY* pKey,
+int32_t doInitMemDataIter(STsdbReader* pReader, STbData** pData, STableBlockScanInfo* pBlockScanInfo, STsdbRowKey* pKey,
SMemTable* pMem, SIterInfo* pIter, const char* type) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t backward = (!ASCENDING_TRAVERSE(pReader->info.order));
@@ -1927,8 +1961,8 @@ int32_t doInitMemDataIter(STsdbReader* pReader, STbData** pData, STableBlockScan
tsdbDebug("%p uid:%" PRIu64 ", check data in %s from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
"-%" PRId64 " %s",
- pReader, pBlockScanInfo->uid, type, pKey->ts, pReader->info.order, (*pData)->minKey, (*pData)->maxKey,
- pReader->idStr);
+ pReader, pBlockScanInfo->uid, type, pKey->key.ts, pReader->info.order, (*pData)->minKey,
+ (*pData)->maxKey, pReader->idStr);
} else {
tsdbError("%p uid:%" PRIu64 ", failed to create iterator for %s, code:%s, %s", pReader, pBlockScanInfo->uid,
type, tstrerror(code), pReader->idStr);
@@ -1947,12 +1981,20 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea
return TSDB_CODE_SUCCESS;
}
- STbData* d = NULL;
- TSDBKEY startKey = {0};
+ STbData* d = NULL;
+ STsdbRowKey startKey = {0};
if (ASCENDING_TRAVERSE(pReader->info.order)) {
- startKey = (TSDBKEY){.ts = pBlockScanInfo->lastProcKey + 1, .version = pReader->info.verRange.minVer};
+ startKey = (STsdbRowKey){.version = pReader->info.verRange.minVer,
+ .key = {
+ .ts = pBlockScanInfo->lastProcKey + 1,
+ .numOfPKs = 0, // TODO: change here if multi-key is supported
+ }};
} else {
- startKey = (TSDBKEY){.ts = pBlockScanInfo->lastProcKey - 1, .version = pReader->info.verRange.maxVer};
+ startKey = (STsdbRowKey){.version = pReader->info.verRange.maxVer,
+ .key = {
+ .ts = pBlockScanInfo->lastProcKey - 1,
+ .numOfPKs = 0, // TODO: change here if multi-key is supported
+ }};
}
int32_t code =
@@ -2000,8 +2042,8 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, int32_t rowIndex, STable
}
if (pBlockScanInfo->delSkyline != NULL && TARRAY_SIZE(pBlockScanInfo->delSkyline) > 0) {
- bool dropped = hasBeenDropped(pBlockScanInfo->delSkyline, &pBlockScanInfo->fileDelIndex, ts, ver,
- pInfo->order, &pInfo->verRange);
+ bool dropped = hasBeenDropped(pBlockScanInfo->delSkyline, &pBlockScanInfo->fileDelIndex, ts, ver, pInfo->order,
+ &pInfo->verRange);
if (dropped) {
return false;
}
@@ -2068,7 +2110,7 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan
initMemDataIterator(pScanInfo, pReader);
initDelSkylineIterator(pScanInfo, pReader->info.order, &pReader->cost);
- if (conf.rspRows) {
+ if (0 /*conf.rspRows*/) {
pScanInfo->cleanSttBlocks =
isCleanSttBlock(info.pTimeWindowList, &pReader->info.window, pScanInfo, pReader->info.order);
@@ -2093,14 +2135,14 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan
pScanInfo->sttKeyInfo.nextProcKey =
ASCENDING_TRAVERSE(pReader->info.order) ? pScanInfo->sttWindow.skey : pScanInfo->sttWindow.ekey;
hasData = true;
- } else { // not clean stt blocks
- INIT_TIMEWINDOW(&pScanInfo->sttWindow); //reset the time window
+ } else { // not clean stt blocks
+ INIT_TIMEWINDOW(&pScanInfo->sttWindow); // reset the time window
pScanInfo->sttBlockReturned = false;
hasData = nextRowFromSttBlocks(pSttBlockReader, pScanInfo, &pReader->info.verRange);
}
} else {
pScanInfo->cleanSttBlocks = false;
- INIT_TIMEWINDOW(&pScanInfo->sttWindow); //reset the time window
+ INIT_TIMEWINDOW(&pScanInfo->sttWindow); // reset the time window
pScanInfo->sttBlockReturned = false;
hasData = nextRowFromSttBlocks(pSttBlockReader, pScanInfo, &pReader->info.verRange);
}
@@ -2674,7 +2716,8 @@ static void buildCleanBlockFromDataFiles(STsdbReader* pReader, STableBlockScanIn
// update the last key for the corresponding table
pScanInfo->lastProcKey = asc ? pInfo->window.ekey : pInfo->window.skey;
- tsdbDebug("%p uid:%" PRIu64 " clean file block retrieved from file, global index:%d, "
+ tsdbDebug("%p uid:%" PRIu64
+ " clean file block retrieved from file, global index:%d, "
"table index:%d, rows:%d, brange:%" PRId64 "-%" PRId64 ", %s",
pReader, pScanInfo->uid, blockIndex, pBlockInfo->tbBlockIdx, pBlockInfo->numRow, pBlockInfo->firstKey,
pBlockInfo->lastKey, pReader->idStr);
@@ -3326,9 +3369,18 @@ TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* p
return NULL;
}
- TSDBROW* pRow = tsdbTbDataIterGet(pIter->iter);
- TSDBKEY key = TSDBROW_KEY(pRow);
int32_t order = pReader->info.order;
+ TSDBROW* pRow = tsdbTbDataIterGet(pIter->iter);
+
+ if (!pReader->pkChecked) {
+ STsdbRowKey k;
+ tsdbRowGetKey(pRow, &k);
+
+ pReader->pkComparFn = getComparFunc(k.key.pks[0].type, 0);
+ pReader->pkChecked = true;
+ }
+
+ TSDBKEY key = TSDBROW_KEY(pRow);
if (outOfTimeWindow(key.ts, &pReader->info.window)) {
pIter->hasVal = false;
return NULL;
@@ -3373,7 +3425,7 @@ TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* p
}
}
-int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDelList, STsdbReader* pReader) {
+int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, STsdbRowKey *pCurKey, SArray* pDelList, STsdbReader* pReader) {
SRowMerger* pMerger = &pReader->status.merger;
while (1) {
@@ -3389,8 +3441,11 @@ int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDe
}
// ts is not identical, quit
- TSDBKEY k = TSDBROW_KEY(pRow);
- if (k.ts != ts) {
+ if (TSDBROW_TS(pRow) != pCurKey->key.ts) {
+ break;
+ }
+
+ if (pkComp1(pReader, pCurKey, pRow) != 0) {
break;
}
@@ -3511,6 +3566,9 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
TSDBROW* pNextRow = NULL;
TSDBROW current = *pRow;
+ STsdbRowKey curKey = {0};
+ tsdbRowGetKey(¤t, &curKey);
+
{ // if the timestamp of the next valid row has a different ts, return current row directly
pIter->hasVal = tsdbTbDataIterNext(pIter->iter);
@@ -3526,7 +3584,7 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
return TSDB_CODE_SUCCESS;
}
- if (TSDBROW_TS(¤t) != TSDBROW_TS(pNextRow)) {
+ if (TSDBROW_TS(¤t) != TSDBROW_TS(pNextRow) || (pkComp1(pReader, &curKey, pNextRow) != 0)) {
*pResRow = current;
*freeTSRow = false;
return TSDB_CODE_SUCCESS;
@@ -3564,7 +3622,7 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
return code;
}
- code = doMergeRowsInBuf(pIter, uid, TSDBROW_TS(¤t), pDelList, pReader);
+ code = doMergeRowsInBuf(pIter, uid, &curKey, pDelList, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3585,8 +3643,9 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
SRow** pTSRow) {
SRowMerger* pMerger = &pReader->status.merger;
- TSDBKEY k = TSDBROW_KEY(pRow);
- TSDBKEY ik = TSDBROW_KEY(piRow);
+ STsdbRowKey k, ik;
+ tsdbRowGetKey(pRow, &k);
+ tsdbRowGetKey(piRow, &ik);
STSchema* pSchema = NULL;
if (pRow->type == TSDBROW_ROW_FMT) {
@@ -3610,13 +3669,13 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
return code;
}
- code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, ik.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, &ik, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
tsdbRowMergerAdd(&pReader->status.merger, pRow, pSchema);
- code = doMergeRowsInBuf(&pBlockScanInfo->iter, pBlockScanInfo->uid, k.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(&pBlockScanInfo->iter, pBlockScanInfo->uid, &k, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3627,13 +3686,13 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
return code;
}
- code = doMergeRowsInBuf(&pBlockScanInfo->iter, pBlockScanInfo->uid, k.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(&pBlockScanInfo->iter, pBlockScanInfo->uid, &k, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
tsdbRowMergerAdd(&pReader->status.merger, piRow, piSchema);
- code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, ik.ts, pBlockScanInfo->delSkyline, pReader);
+ code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, &ik, pBlockScanInfo->delSkyline, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3672,7 +3731,7 @@ static int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbRea
TSDBKEY ik = TSDBROW_KEY(piRow);
int32_t code = TSDB_CODE_SUCCESS;
- if (ik.ts != k.ts) {
+ if (ik.ts != k.ts || (pkComp(pReader, pRow, piRow) != 0)) {
if (((ik.ts < k.ts) && asc) || ((ik.ts > k.ts) && (!asc))) { // ik.ts < k.ts
code = doMergeMemTableMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, pResRow, pReader, freeTSRow);
} else if (((k.ts < ik.ts) && asc) || ((k.ts > ik.ts) && (!asc))) {
@@ -3691,8 +3750,7 @@ static int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbRea
}
if (pBlockScanInfo->iter.hasVal && pRow != NULL) {
- return doMergeMemTableMultiRows(pRow, pBlockScanInfo->uid, &pBlockScanInfo->iter, pDelList, pResRow, pReader,
- freeTSRow);
+ return doMergeMemTableMultiRows(pRow, uid, &pBlockScanInfo->iter, pDelList, pResRow, pReader, freeTSRow);
}
if (pBlockScanInfo->iiter.hasVal && piRow != NULL) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c
index 33604d21de..4c742c0572 100644
--- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c
+++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c
@@ -14,7 +14,6 @@
*/
#include "tsdbReadUtil.h"
-#include "osDef.h"
#include "tsdb.h"
#include "tsdbDataFileRW.h"
#include "tsdbFS2.h"
@@ -281,7 +280,7 @@ void initBrinRecordIter(SBrinRecordIter* pIter, SDataFileReader* pReader, SArray
}
SBrinRecord* getNextBrinRecord(SBrinRecordIter* pIter) {
- if (pIter->blockIndex == -1 || (pIter->recordIndex + 1) >= TARRAY2_SIZE(pIter->block.numRow)) {
+ if (pIter->blockIndex == -1 || (pIter->recordIndex + 1) >= pIter->block.numOfRecords) {
pIter->blockIndex += 1;
if (pIter->blockIndex >= taosArrayGetSize(pIter->pBrinBlockList)) {
return NULL;
@@ -356,10 +355,10 @@ static int32_t fileDataBlockOrderCompar(const void* pLeft, const void* pRight, v
return pLeftBlock->offset > pRightBlock->offset ? 1 : -1;
}
-static void recordToBlockInfo(SFileDataBlockInfo* pBlockInfo, SBrinRecord* record){
+static void recordToBlockInfo(SFileDataBlockInfo* pBlockInfo, SBrinRecord* record) {
pBlockInfo->uid = record->uid;
- pBlockInfo->firstKey = record->firstKey;
- pBlockInfo->lastKey = record->lastKey;
+ pBlockInfo->firstKey = record->firstKey.key.ts;
+ pBlockInfo->lastKey = record->lastKey.key.ts;
pBlockInfo->minVer = record->minVer;
pBlockInfo->maxVer = record->maxVer;
pBlockInfo->blockOffset = record->blockOffset;
@@ -429,7 +428,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
}
for (int32_t i = 0; i < numOfBlocks; ++i) {
SFileDataBlockInfo blockInfo = {.tbBlockIdx = i};
- SBrinRecord* record = (SBrinRecord*)taosArrayGet(sup.pDataBlockInfo[0][i].pInfo->pBlockList, i);
+ SBrinRecord* record = (SBrinRecord*)taosArrayGet(sup.pDataBlockInfo[0][i].pInfo->pBlockList, i);
recordToBlockInfo(&blockInfo, record);
taosArrayPush(pBlockIter->blockList, &blockInfo);
@@ -464,7 +463,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
int32_t index = sup.indexPerTable[pos]++;
SFileDataBlockInfo blockInfo = {.tbBlockIdx = index};
- SBrinRecord* record = (SBrinRecord*)taosArrayGet(sup.pDataBlockInfo[pos][index].pInfo->pBlockList, index);
+ SBrinRecord* record = (SBrinRecord*)taosArrayGet(sup.pDataBlockInfo[pos][index].pInfo->pBlockList, index);
recordToBlockInfo(&blockInfo, record);
taosArrayPush(pBlockIter->blockList, &blockInfo);
@@ -529,7 +528,7 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_
pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData));
}
- for (int32_t k = 0; k < TARRAY2_SIZE(pBlock->suid); ++k) {
+ for (int32_t k = 0; k < pBlock->numOfRecords; ++k) {
code = tTombBlockGet(pBlock, k, &record);
if (code != TSDB_CODE_SUCCESS) {
*pRet = BLK_CHECK_QUIT;
@@ -722,11 +721,11 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
pBlockLoadInfo->cost.statisElapsedTime += el;
int32_t index = 0;
- while (index < TARRAY2_SIZE(pStatisBlock->suid) && pStatisBlock->suid->data[index] < suid) {
+ while (index < pStatisBlock->numOfRecords && ((int64_t*)pStatisBlock->suids.data)[index] < suid) {
++index;
}
- if (index >= TARRAY2_SIZE(pStatisBlock->suid)) {
+ if (index >= pStatisBlock->numOfRecords) {
tStatisBlockDestroy(pStatisBlock);
taosMemoryFreeClear(pStatisBlock);
return num;
@@ -744,14 +743,14 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
uint64_t uid = pUidList[uidIndex];
- if (pStatisBlock->uid->data[j] == uid) {
- num += pStatisBlock->count->data[j];
+ if (((int64_t*)pStatisBlock->uids.data)[j] == uid) {
+ num += ((int64_t*)pStatisBlock->counts.data)[j];
uidIndex += 1;
j += 1;
- loadNextStatisticsBlock(pSttFileReader, pStatisBlock, pStatisBlkArray, pStatisBlock->suid->size, &i, &j);
- } else if (pStatisBlock->uid->data[j] < uid) {
+ loadNextStatisticsBlock(pSttFileReader, pStatisBlock, pStatisBlkArray, pStatisBlock->numOfRecords, &i, &j);
+ } else if (((int64_t*)pStatisBlock->uids.data)[j] < uid) {
j += 1;
- loadNextStatisticsBlock(pSttFileReader, pStatisBlock, pStatisBlkArray, pStatisBlock->suid->size, &i, &j);
+ loadNextStatisticsBlock(pSttFileReader, pStatisBlock, pStatisBlkArray, pStatisBlock->numOfRecords, &i, &j);
} else {
uidIndex += 1;
}
@@ -962,15 +961,15 @@ static bool doCheckDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, const S
for (int32_t i = startIndex; i < num; i += 1) {
TSDBKEY* p = taosArrayGet(pBlockScanInfo->delSkyline, i);
- if (p->ts >= pRecord->firstKey && p->ts <= pRecord->lastKey) {
+ if (p->ts >= pRecord->firstKey.key.ts && p->ts <= pRecord->lastKey.key.ts) {
if (p->version >= pRecord->minVer) {
return true;
}
- } else if (p->ts < pRecord->firstKey) { // p->ts < pBlock->minKey.ts
+ } else if (p->ts < pRecord->firstKey.key.ts) { // p->ts < pBlock->minKey.ts
if (p->version >= pRecord->minVer) {
if (i < num - 1) {
TSDBKEY* pnext = taosArrayGet(pBlockScanInfo->delSkyline, i + 1);
- if (pnext->ts >= pRecord->firstKey) {
+ if (pnext->ts >= pRecord->firstKey.key.ts) {
return true;
}
} else { // it must be the last point
@@ -991,12 +990,12 @@ static bool doCheckDatablockOverlapWithoutVersion(STableBlockScanInfo* pBlockSca
for (int32_t i = startIndex; i < num; i += 1) {
TSDBKEY* p = taosArrayGet(pBlockScanInfo->delSkyline, i);
- if (p->ts >= pRecord->firstKey && p->ts <= pRecord->lastKey) {
+ if (p->ts >= pRecord->firstKey.key.ts && p->ts <= pRecord->lastKey.key.ts) {
return true;
- } else if (p->ts < pRecord->firstKey) { // p->ts < pBlock->minKey.ts
+ } else if (p->ts < pRecord->firstKey.key.ts) { // p->ts < pBlock->minKey.ts
if (i < num - 1) {
TSDBKEY* pnext = taosArrayGet(pBlockScanInfo->delSkyline, i + 1);
- if (pnext->ts >= pRecord->firstKey) {
+ if (pnext->ts >= pRecord->firstKey.key.ts) {
return true;
}
}
@@ -1016,7 +1015,7 @@ bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SBrinRecor
// ts is not overlap
TSDBKEY* pFirst = taosArrayGet(pBlockScanInfo->delSkyline, 0);
TSDBKEY* pLast = taosArrayGetLast(pBlockScanInfo->delSkyline);
- if (pRecord->firstKey > pLast->ts || pRecord->lastKey < pFirst->ts) {
+ if (pRecord->firstKey.key.ts > pLast->ts || pRecord->lastKey.key.ts < pFirst->ts) {
return false;
}
@@ -1027,10 +1026,10 @@ bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SBrinRecor
int32_t index = pBlockScanInfo->fileDelIndex;
while (1) {
TSDBKEY* p = taosArrayGet(pBlockScanInfo->delSkyline, index);
- if (p->ts > pRecord->firstKey && index > 0) {
+ if (p->ts > pRecord->firstKey.key.ts && index > 0) {
index -= 1;
} else { // find the first point that is smaller than the minKey.ts of dataBlock.
- if (p->ts == pRecord->firstKey && p->version < pRecord->maxVer && index > 0) {
+ if (p->ts == pRecord->firstKey.key.ts && p->version < pRecord->maxVer && index > 0) {
index -= 1;
}
break;
@@ -1049,7 +1048,7 @@ bool overlapWithDelSkylineWithoutVer(STableBlockScanInfo* pBlockScanInfo, const
// ts is not overlap
TSDBKEY* pFirst = taosArrayGet(pBlockScanInfo->delSkyline, 0);
TSDBKEY* pLast = taosArrayGetLast(pBlockScanInfo->delSkyline);
- if (pRecord->firstKey > pLast->ts || pRecord->lastKey < pFirst->ts) {
+ if (pRecord->firstKey.key.ts > pLast->ts || pRecord->lastKey.key.ts < pFirst->ts) {
return false;
}
@@ -1060,10 +1059,10 @@ bool overlapWithDelSkylineWithoutVer(STableBlockScanInfo* pBlockScanInfo, const
int32_t index = pBlockScanInfo->fileDelIndex;
while (1) {
TSDBKEY* p = taosArrayGet(pBlockScanInfo->delSkyline, index);
- if (p->ts > pRecord->firstKey && index > 0) {
+ if (p->ts > pRecord->firstKey.key.ts && index > 0) {
index -= 1;
} else { // find the first point that is smaller than the minKey.ts of dataBlock.
- if (p->ts == pRecord->firstKey && index > 0) {
+ if (p->ts == pRecord->firstKey.key.ts && index > 0) {
index -= 1;
}
break;
diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h
index c27e9ebe04..7966a87500 100644
--- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h
+++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h
@@ -266,7 +266,9 @@ struct STsdbReader {
STsdbReader* innerReader[2];
bool bFilesetDelimited; // duration by duration output
TsdReaderNotifyCbFn notifyFn;
- void* notifyParam;
+ void* notifyParam;
+ __compar_fn_t pkComparFn;
+ bool pkChecked;
};
typedef struct SBrinRecordIter {
diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
index babf8c75fb..76a8ee0e2a 100644
--- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
@@ -414,6 +414,18 @@ _exit:
return code;
}
+int32_t tsdbReadFileToBuffer(STsdbFD *pFD, int64_t offset, int64_t size, SBuffer *buffer, int64_t szHint) {
+ int32_t code;
+
+ code = tBufferEnsureCapacity(buffer, buffer->size + size);
+ if (code) return code;
+ code = tsdbReadFile(pFD, offset, (uint8_t *)tBufferGetDataEnd(buffer), size, szHint);
+ if (code) return code;
+ buffer->size += size;
+
+ return code;
+}
+
int32_t tsdbFsyncFile(STsdbFD *pFD) {
int32_t code = 0;
@@ -620,235 +632,6 @@ _err:
return code;
}
-int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pDataBlk, SArray *aColumnDataAgg) {
- int32_t code = 0;
- SSmaInfo *pSmaInfo = &pDataBlk->smaInfo;
-
- ASSERT(pSmaInfo->size > 0);
-
- taosArrayClear(aColumnDataAgg);
-
- // alloc
- code = tRealloc(&pReader->aBuf[0], pSmaInfo->size);
- if (code) goto _err;
-
- // read
- code = tsdbReadFile(pReader->pSmaFD, pSmaInfo->offset, pReader->aBuf[0], pSmaInfo->size, 0);
- if (code) goto _err;
-
- // decode
- int32_t n = 0;
- while (n < pSmaInfo->size) {
- SColumnDataAgg sma;
- n += tGetColumnDataAgg(pReader->aBuf[0] + n, &sma);
-
- if (taosArrayPush(aColumnDataAgg, &sma) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
- }
- ASSERT(n == pSmaInfo->size);
- return code;
-
-_err:
- tsdbError("vgId:%d, tsdb read block sma failed since %s", TD_VID(pReader->pTsdb->pVnode), tstrerror(code));
- return code;
-}
-
-static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo, SBlockData *pBlockData,
- int32_t iStt) {
- int32_t code = 0;
-
- tBlockDataClear(pBlockData);
-
- STsdbFD *pFD = (iStt < 0) ? pReader->pDataFD : pReader->aSttFD[iStt];
-
- // uid + version + tskey
- code = tRealloc(&pReader->aBuf[0], pBlkInfo->szKey);
- if (code) goto _err;
-
- code = tsdbReadFile(pFD, pBlkInfo->offset, pReader->aBuf[0], pBlkInfo->szKey, 0);
- if (code) goto _err;
-
- SDiskDataHdr hdr;
- uint8_t *p = pReader->aBuf[0] + tGetDiskDataHdr(pReader->aBuf[0], &hdr);
-
- ASSERT(hdr.delimiter == TSDB_FILE_DLMT);
- ASSERT(pBlockData->suid == hdr.suid);
-
- pBlockData->uid = hdr.uid;
- pBlockData->nRow = hdr.nRow;
-
- // uid
- if (hdr.uid == 0) {
- ASSERT(hdr.szUid);
- code = tsdbDecmprData(p, hdr.szUid, TSDB_DATA_TYPE_BIGINT, hdr.cmprAlg, (uint8_t **)&pBlockData->aUid,
- sizeof(int64_t) * hdr.nRow, &pReader->aBuf[1]);
- if (code) goto _err;
- } else {
- ASSERT(!hdr.szUid);
- }
- p += hdr.szUid;
-
- // version
- code = tsdbDecmprData(p, hdr.szVer, TSDB_DATA_TYPE_BIGINT, hdr.cmprAlg, (uint8_t **)&pBlockData->aVersion,
- sizeof(int64_t) * hdr.nRow, &pReader->aBuf[1]);
- if (code) goto _err;
- p += hdr.szVer;
-
- // TSKEY
- code = tsdbDecmprData(p, hdr.szKey, TSDB_DATA_TYPE_TIMESTAMP, hdr.cmprAlg, (uint8_t **)&pBlockData->aTSKEY,
- sizeof(TSKEY) * hdr.nRow, &pReader->aBuf[1]);
- if (code) goto _err;
- p += hdr.szKey;
-
- ASSERT(p - pReader->aBuf[0] == pBlkInfo->szKey);
-
- // read and decode columns
- if (pBlockData->nColData == 0) goto _exit;
-
- if (hdr.szBlkCol > 0) {
- int64_t offset = pBlkInfo->offset + pBlkInfo->szKey;
-
- code = tRealloc(&pReader->aBuf[0], hdr.szBlkCol);
- if (code) goto _err;
-
- code = tsdbReadFile(pFD, offset, pReader->aBuf[0], hdr.szBlkCol, 0);
- if (code) goto _err;
- }
-
- SBlockCol blockCol = {.cid = 0};
- SBlockCol *pBlockCol = &blockCol;
- int32_t n = 0;
-
- for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) {
- SColData *pColData = tBlockDataGetColDataByIdx(pBlockData, iColData);
-
- while (pBlockCol && pBlockCol->cid < pColData->cid) {
- if (n < hdr.szBlkCol) {
- n += tGetBlockCol(pReader->aBuf[0] + n, pBlockCol);
- } else {
- ASSERT(n == hdr.szBlkCol);
- pBlockCol = NULL;
- }
- }
-
- if (pBlockCol == NULL || pBlockCol->cid > pColData->cid) {
- // add a lot of NONE
- for (int32_t iRow = 0; iRow < hdr.nRow; iRow++) {
- code = tColDataAppendValue(pColData, &COL_VAL_NONE(pColData->cid, pColData->type));
- if (code) goto _err;
- }
- } else {
- ASSERT(pBlockCol->type == pColData->type);
- ASSERT(pBlockCol->flag && pBlockCol->flag != HAS_NONE);
-
- if (pBlockCol->flag == HAS_NULL) {
- // add a lot of NULL
- for (int32_t iRow = 0; iRow < hdr.nRow; iRow++) {
- code = tColDataAppendValue(pColData, &COL_VAL_NULL(pBlockCol->cid, pBlockCol->type));
- if (code) goto _err;
- }
- } else {
- // decode from binary
- int64_t offset = pBlkInfo->offset + pBlkInfo->szKey + hdr.szBlkCol + pBlockCol->offset;
- int32_t size = pBlockCol->szBitmap + pBlockCol->szOffset + pBlockCol->szValue;
-
- code = tRealloc(&pReader->aBuf[1], size);
- if (code) goto _err;
-
- code = tsdbReadFile(pFD, offset, pReader->aBuf[1], size, 0);
- if (code) goto _err;
-
- code = tsdbDecmprColData(pReader->aBuf[1], pBlockCol, hdr.cmprAlg, hdr.nRow, pColData, &pReader->aBuf[2]);
- if (code) goto _err;
- }
- }
- }
-
-_exit:
- return code;
-
-_err:
- tsdbError("vgId:%d, tsdb read block data impl failed since %s", TD_VID(pReader->pTsdb->pVnode), tstrerror(code));
- return code;
-}
-
-int32_t tsdbReadDataBlockEx(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData *pBlockData) {
- int32_t code = 0;
- SBlockInfo *pBlockInfo = &pDataBlk->aSubBlock[0];
-
- // alloc
- code = tRealloc(&pReader->aBuf[0], pBlockInfo->szBlock);
- if (code) goto _err;
-
- // read
- code = tsdbReadFile(pReader->pDataFD, pBlockInfo->offset, pReader->aBuf[0], pBlockInfo->szBlock, 0);
- if (code) goto _err;
-
- // decmpr
- code = tDecmprBlockData(pReader->aBuf[0], pBlockInfo->szBlock, pBlockData, &pReader->aBuf[1]);
- if (code) goto _err;
-
- return code;
-
-_err:
- tsdbError("vgId:%d, tsdb read data block ex failed since %s", TD_VID(pReader->pTsdb->pVnode), tstrerror(code));
- return code;
-}
-
-int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData *pBlockData) {
- int32_t code = 0;
-
- code = tsdbReadBlockDataImpl(pReader, &pDataBlk->aSubBlock[0], pBlockData, -1);
- if (code) goto _err;
-
- ASSERT(pDataBlk->nSubBlock == 1);
-
- return code;
-
-_err:
- tsdbError("vgId:%d, tsdb read data block failed since %s", TD_VID(pReader->pTsdb->pVnode), tstrerror(code));
- return code;
-}
-
-int32_t tsdbReadSttBlock(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData) {
- int32_t code = 0;
- int32_t lino = 0;
-
- code = tsdbReadBlockDataImpl(pReader, &pSttBlk->bInfo, pBlockData, iStt);
- TSDB_CHECK_CODE(code, lino, _exit);
-
-_exit:
- if (code) {
- tsdbError("vgId:%d, %s failed at %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code));
- }
- return code;
-}
-
-int32_t tsdbReadSttBlockEx(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData) {
- int32_t code = 0;
- int32_t lino = 0;
-
- // alloc
- code = tRealloc(&pReader->aBuf[0], pSttBlk->bInfo.szBlock);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // read
- code = tsdbReadFile(pReader->aSttFD[iStt], pSttBlk->bInfo.offset, pReader->aBuf[0], pSttBlk->bInfo.szBlock, 0);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // decmpr
- code = tDecmprBlockData(pReader->aBuf[0], pSttBlk->bInfo.szBlock, pBlockData, &pReader->aBuf[1]);
- TSDB_CHECK_CODE(code, lino, _exit);
-
-_exit:
- if (code) {
- tsdbError("vgId:%d, %s failed at %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code));
- }
- return code;
-}
-
// SDelFReader ====================================================
struct SDelFReader {
STsdb *pTsdb;
diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
index 81a136a0e3..dece1c7b98 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
@@ -29,17 +29,17 @@ struct STsdbSnapReader {
int64_t ever;
int8_t type;
- uint8_t* aBuf[5];
+ SBuffer buffers[10];
SSkmInfo skmTb[1];
TFileSetRangeArray* fsrArr;
// context
struct {
- int32_t fsrArrIdx;
+ int32_t fsrArrIdx;
STFileSetRange* fsr;
- bool isDataDone;
- bool isTombDone;
+ bool isDataDone;
+ bool isTombDone;
} ctx[1];
// reader
@@ -68,7 +68,7 @@ static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) {
SDataFileReaderConfig config = {
.tsdb = reader->tsdb,
.szPage = reader->tsdb->pVnode->config.tsdbPageSize,
- .bufArr = reader->aBuf,
+ .buffers = reader->buffers,
};
bool hasDataFile = false;
for (int32_t ftype = 0; ftype < TSDB_FTYPE_MAX; ftype++) {
@@ -94,7 +94,7 @@ static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) {
.tsdb = reader->tsdb,
.szPage = reader->tsdb->pVnode->config.tsdbPageSize,
.file = fobj->f[0],
- .bufArr = reader->aBuf,
+ .buffers = reader->buffers,
};
code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader);
@@ -247,11 +247,14 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* reader, uint8_t** data) {
int32_t code = 0;
int32_t lino = 0;
- int32_t aBufN[5] = {0};
- code = tCmprBlockData(reader->blockData, NO_COMPRESSION, NULL, NULL, reader->aBuf, aBufN);
+ code = tBlockDataCompress(reader->blockData, NO_COMPRESSION, reader->buffers, reader->buffers + 4);
TSDB_CHECK_CODE(code, lino, _exit);
+ // TSDB_CHECK_CODE(code, lino, _exit);
- int32_t size = aBufN[0] + aBufN[1] + aBufN[2] + aBufN[3];
+ int32_t size = 0;
+ for (int i = 0; i < 4; i++) {
+ size += reader->buffers[i].size;
+ }
*data = taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
if (*data == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -259,16 +262,13 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* reader, uint8_t** data) {
}
SSnapDataHdr* pHdr = (SSnapDataHdr*)*data;
+ uint8_t* pBuf = pHdr->data;
+
pHdr->type = reader->type;
pHdr->size = size;
-
- memcpy(pHdr->data, reader->aBuf[3], aBufN[3]);
- memcpy(pHdr->data + aBufN[3], reader->aBuf[2], aBufN[2]);
- if (aBufN[1]) {
- memcpy(pHdr->data + aBufN[3] + aBufN[2], reader->aBuf[1], aBufN[1]);
- }
- if (aBufN[0]) {
- memcpy(pHdr->data + aBufN[3] + aBufN[2] + aBufN[1], reader->aBuf[0], aBufN[0]);
+ for (int i = 0; i < 4; i++) {
+ memcpy(pBuf, reader->buffers[i].data, reader->buffers[i].size);
+ pBuf += reader->buffers[i].size;
}
_exit:
@@ -355,8 +355,8 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* reader, uint8_t** data) {
int32_t lino = 0;
int64_t size = 0;
- for (int32_t i = 0; i < ARRAY_SIZE(reader->tombBlock->dataArr); i++) {
- size += TARRAY2_DATA_LEN(reader->tombBlock->dataArr + i);
+ for (int32_t i = 0; i < ARRAY_SIZE(reader->tombBlock->buffers); i++) {
+ size += reader->tombBlock->buffers[i].size;
}
data[0] = taosMemoryMalloc(size + sizeof(SSnapDataHdr));
@@ -370,9 +370,9 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* reader, uint8_t** data) {
hdr->size = size;
uint8_t* tdata = hdr->data;
- for (int32_t i = 0; i < ARRAY_SIZE(reader->tombBlock->dataArr); i++) {
- memcpy(tdata, TARRAY2_DATA(reader->tombBlock->dataArr + i), TARRAY2_DATA_LEN(reader->tombBlock->dataArr + i));
- tdata += TARRAY2_DATA_LEN(reader->tombBlock->dataArr + i);
+ for (int32_t i = 0; i < ARRAY_SIZE(reader->tombBlock->buffers); i++) {
+ memcpy(tdata, reader->tombBlock->buffers[i].data, reader->tombBlock->buffers[i].size);
+ tdata += reader->tombBlock->buffers[i].size;
}
_exit:
@@ -475,8 +475,8 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** reader) {
tsdbFSDestroyRefRangedSnapshot(&reader[0]->fsrArr);
tDestroyTSchema(reader[0]->skmTb->pTSchema);
- for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->aBuf); ++i) {
- tFree(reader[0]->aBuf[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->buffers); ++i) {
+ tBufferDestroy(reader[0]->buffers + i);
}
taosMemoryFree(reader[0]);
@@ -542,19 +542,19 @@ _exit:
// STsdbSnapWriter ========================================
struct STsdbSnapWriter {
- STsdb* tsdb;
- int64_t sver;
- int64_t ever;
- int32_t minutes;
- int8_t precision;
- int32_t minRow;
- int32_t maxRow;
- int8_t cmprAlg;
- int64_t commitID;
- int32_t szPage;
- int64_t compactVersion;
- int64_t now;
- uint8_t* aBuf[5];
+ STsdb* tsdb;
+ int64_t sver;
+ int64_t ever;
+ int32_t minutes;
+ int8_t precision;
+ int32_t minRow;
+ int32_t maxRow;
+ int8_t cmprAlg;
+ int64_t commitID;
+ int32_t szPage;
+ int64_t compactVersion;
+ int64_t now;
+ SBuffer buffers[10];
TFileSetArray* fsetArr;
TFileOpArray fopArr[1];
@@ -632,7 +632,7 @@ static int32_t tsdbSnapWriteFileSetOpenReader(STsdbSnapWriter* writer) {
// open data reader
SDataFileReaderConfig dataFileReaderConfig = {
.tsdb = writer->tsdb,
- .bufArr = writer->aBuf,
+ .buffers = writer->buffers,
.szPage = writer->szPage,
};
@@ -666,7 +666,7 @@ static int32_t tsdbSnapWriteFileSetOpenReader(STsdbSnapWriter* writer) {
SSttFileReaderConfig sttFileReaderConfig = {
.tsdb = writer->tsdb,
.szPage = writer->szPage,
- .bufArr = writer->aBuf,
+ .buffers = writer->buffers,
.file = fobj->f[0],
};
@@ -939,7 +939,14 @@ static int32_t tsdbSnapWriteTimeSeriesData(STsdbSnapWriter* writer, SSnapDataHdr
SBlockData blockData[1] = {0};
- code = tDecmprBlockData(hdr->data, hdr->size - sizeof(*hdr), blockData, writer->aBuf);
+ SBuffer buffer = {
+ .capacity = hdr->size,
+ .data = hdr->data,
+ .size = hdr->size,
+ };
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, &buffer);
+
+ code = tBlockDataDecompress(&br, blockData, &writer->buffers[0]);
TSDB_CHECK_CODE(code, lino, _exit);
int32_t fid = tsdbKeyFid(blockData->aTSKEY[0], writer->minutes, writer->precision);
@@ -977,15 +984,19 @@ static int32_t tsdbSnapWriteDecmprTombBlock(SSnapDataHdr* hdr, STombBlock* tombB
int32_t code = 0;
int32_t lino = 0;
+ tTombBlockClear(tombBlock);
+
int64_t size = hdr->size;
ASSERT(size % TOMB_RECORD_ELEM_NUM == 0);
size = size / TOMB_RECORD_ELEM_NUM;
- ASSERT(size % sizeof(int64_t) == 0);
+ tombBlock->numOfRecords = size / sizeof(int64_t);
- int64_t* data = (int64_t*)hdr->data;
+ // int64_t* data = (int64_t*)hdr->data;
+ uint8_t* data = hdr->data;
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
- code = TARRAY2_APPEND_BATCH(&tombBlock->dataArr[i], hdr->data + i * size, size / sizeof(int64_t));
+ code = tBufferPut(tombBlock->buffers + i, data, size);
TSDB_CHECK_CODE(code, lino, _exit);
+ data += size;
}
_exit:
@@ -1061,7 +1072,8 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, void* pRang
writer[0]->compactVersion = INT64_MAX;
writer[0]->now = taosGetTimestampMs();
- code = tsdbFSCreateCopyRangedSnapshot(pTsdb->pFS, (TFileSetRangeArray*)pRanges, &writer[0]->fsetArr, writer[0]->fopArr);
+ code =
+ tsdbFSCreateCopyRangedSnapshot(pTsdb->pFS, (TFileSetRangeArray*)pRanges, &writer[0]->fsetArr, writer[0]->fopArr);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:
@@ -1127,8 +1139,8 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** writer, int8_t rollback) {
TARRAY2_DESTROY(writer[0]->fopArr, NULL);
tsdbFSDestroyCopyRangedSnapshot(&writer[0]->fsetArr);
- for (int32_t i = 0; i < ARRAY_SIZE(writer[0]->aBuf); ++i) {
- tFree(writer[0]->aBuf[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(writer[0]->buffers); ++i) {
+ tBufferDestroy(writer[0]->buffers + i);
}
taosMemoryFree(writer[0]);
diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c
index f26c6540df..c8b2cf3adf 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c
+++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c
@@ -29,7 +29,8 @@ struct SSttFileReader {
TSttBlkArray sttBlkArray[1];
TStatisBlkArray statisBlkArray[1];
TTombBlkArray tombBlkArray[1];
- uint8_t *bufArr[5];
+ SBuffer local[10];
+ SBuffer *buffers;
};
// SSttFileReader
@@ -41,8 +42,9 @@ int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *con
if (reader[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
reader[0]->config[0] = config[0];
- if (reader[0]->config->bufArr == NULL) {
- reader[0]->config->bufArr = reader[0]->bufArr;
+ reader[0]->buffers = config->buffers;
+ if (reader[0]->buffers == NULL) {
+ reader[0]->buffers = reader[0]->local;
}
// open file
@@ -73,8 +75,8 @@ _exit:
int32_t tsdbSttFileReaderClose(SSttFileReader **reader) {
if (reader[0]) {
- for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->bufArr); ++i) {
- tFree(reader[0]->bufArr[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->local); ++i) {
+ tBufferDestroy(reader[0]->local + i);
}
tsdbCloseFile(&reader[0]->fd);
TARRAY2_DESTROY(reader[0]->tombBlkArray, NULL);
@@ -175,13 +177,16 @@ int32_t tsdbSttFileReadBlockData(SSttFileReader *reader, const SSttBlk *sttBlk,
int32_t code = 0;
int32_t lino = 0;
- code = tRealloc(&reader->config->bufArr[0], sttBlk->bInfo.szBlock);
+ SBuffer *buffer0 = reader->buffers + 0;
+ SBuffer *assist = reader->buffers + 1;
+
+ // load data
+ tBufferClear(buffer0);
+ code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset, sttBlk->bInfo.szBlock, buffer0, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- code = tsdbReadFile(reader->fd, sttBlk->bInfo.offset, reader->config->bufArr[0], sttBlk->bInfo.szBlock, 0);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tDecmprBlockData(reader->config->bufArr[0], sttBlk->bInfo.szBlock, bData, &reader->config->bufArr[1]);
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0);
+ code = tBlockDataDecompress(&br, bData, assist);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:
@@ -196,115 +201,101 @@ int32_t tsdbSttFileReadBlockDataByColumn(SSttFileReader *reader, const SSttBlk *
int32_t code = 0;
int32_t lino = 0;
- TABLEID tbid = {.suid = sttBlk->suid};
- if (tbid.suid == 0) {
- tbid.uid = sttBlk->minUid;
- } else {
- tbid.uid = 0;
+ SDiskDataHdr hdr;
+ SBuffer *buffer0 = reader->buffers + 0;
+ SBuffer *buffer1 = reader->buffers + 1;
+ SBuffer *assist = reader->buffers + 2;
+
+ // load key part
+ tBufferClear(buffer0);
+ code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset, sttBlk->bInfo.szKey, buffer0, 0);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ // decode header
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0);
+ code = tGetDiskDataHdr(&br, &hdr);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ ASSERT(hdr.delimiter == TSDB_FILE_DLMT);
+
+ // set data container
+ tBlockDataReset(bData);
+ bData->suid = hdr.suid;
+ bData->uid = (sttBlk->suid == 0) ? sttBlk->minUid : 0;
+ bData->nRow = hdr.nRow;
+
+ // key part
+ code = tBlockDataDecompressKeyPart(&hdr, &br, bData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ ASSERT(br.offset == buffer0->size);
+
+ bool loadExtra = false;
+ for (int i = 0; i < ncid; i++) {
+ if (tBlockDataGetColData(bData, cids[i]) == NULL) {
+ loadExtra = true;
+ break;
+ }
}
- code = tBlockDataInit(bData, &tbid, pTSchema, cids, ncid);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // uid + version + tskey
- code = tRealloc(&reader->config->bufArr[0], sttBlk->bInfo.szKey);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tsdbReadFile(reader->fd, sttBlk->bInfo.offset, reader->config->bufArr[0], sttBlk->bInfo.szKey, 0);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // hdr
- SDiskDataHdr hdr[1];
- int32_t size = 0;
-
- size += tGetDiskDataHdr(reader->config->bufArr[0] + size, hdr);
-
- ASSERT(hdr->delimiter == TSDB_FILE_DLMT);
-
- bData->nRow = hdr->nRow;
- bData->uid = hdr->uid;
-
- // uid
- if (hdr->uid == 0) {
- ASSERT(hdr->szUid);
- code = tsdbDecmprData(reader->config->bufArr[0] + size, hdr->szUid, TSDB_DATA_TYPE_BIGINT, hdr->cmprAlg,
- (uint8_t **)&bData->aUid, sizeof(int64_t) * hdr->nRow, &reader->config->bufArr[1]);
- TSDB_CHECK_CODE(code, lino, _exit);
- } else {
- ASSERT(hdr->szUid == 0);
+ if (!loadExtra) {
+ goto _exit;
}
- size += hdr->szUid;
- // version
- code = tsdbDecmprData(reader->config->bufArr[0] + size, hdr->szVer, TSDB_DATA_TYPE_BIGINT, hdr->cmprAlg,
- (uint8_t **)&bData->aVersion, sizeof(int64_t) * hdr->nRow, &reader->config->bufArr[1]);
+ // load SBlockCol part
+ tBufferClear(buffer0);
+ code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset + sttBlk->bInfo.szKey, hdr.szBlkCol, buffer0, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- size += hdr->szVer;
- // ts
- code = tsdbDecmprData(reader->config->bufArr[0] + size, hdr->szKey, TSDB_DATA_TYPE_TIMESTAMP, hdr->cmprAlg,
- (uint8_t **)&bData->aTSKEY, sizeof(TSKEY) * hdr->nRow, &reader->config->bufArr[1]);
- TSDB_CHECK_CODE(code, lino, _exit);
- size += hdr->szKey;
+ // load each column
+ SBlockCol blockCol = {
+ .cid = 0,
+ };
+ br = BUFFER_READER_INITIALIZER(0, buffer0);
+ for (int32_t i = 0; i < ncid; i++) {
+ int16_t cid = cids[i];
- ASSERT(size == sttBlk->bInfo.szKey);
+ if (tBlockDataGetColData(bData, cid)) { // already loaded
+ continue;
+ }
- // other columns
- if (bData->nColData > 0) {
- if (hdr->szBlkCol > 0) {
- code = tRealloc(&reader->config->bufArr[0], hdr->szBlkCol);
- TSDB_CHECK_CODE(code, lino, _exit);
+ while (cid > blockCol.cid) {
+ if (br.offset >= buffer0->size) {
+ blockCol.cid = INT16_MAX;
+ break;
+ }
- code = tsdbReadFile(reader->fd, sttBlk->bInfo.offset + sttBlk->bInfo.szKey, reader->config->bufArr[0],
- hdr->szBlkCol, 0);
+ code = tGetBlockCol(&br, &blockCol);
TSDB_CHECK_CODE(code, lino, _exit);
}
- SBlockCol bc[1] = {{.cid = 0}};
- SBlockCol *blockCol = bc;
+ if (cid < blockCol.cid) {
+ const STColumn *tcol = tTSchemaSearchColumn(pTSchema, cid);
+ ASSERT(tcol);
+ SBlockCol none = {
+ .cid = cid,
+ .type = tcol->type,
+ .cflag = tcol->flags,
+ .flag = HAS_NONE,
+ .szOrigin = 0,
+ .szBitmap = 0,
+ .szOffset = 0,
+ .szValue = 0,
+ .offset = 0,
+ };
+ code = tBlockDataDecompressColData(&hdr, &none, &br, bData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ } else if (cid == blockCol.cid) {
+ // load from file
+ tBufferClear(buffer1);
+ code =
+ tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset + sttBlk->bInfo.szKey + hdr.szBlkCol + blockCol.offset,
+ blockCol.szBitmap + blockCol.szOffset + blockCol.szValue, buffer1, 0);
+ TSDB_CHECK_CODE(code, lino, _exit);
- size = 0;
- for (int32_t i = 0; i < bData->nColData; i++) {
- SColData *colData = tBlockDataGetColDataByIdx(bData, i);
-
- while (blockCol && blockCol->cid < colData->cid) {
- if (size < hdr->szBlkCol) {
- size += tGetBlockCol(reader->config->bufArr[0] + size, blockCol);
- } else {
- ASSERT(size == hdr->szBlkCol);
- blockCol = NULL;
- }
- }
-
- if (blockCol == NULL || blockCol->cid > colData->cid) {
- for (int32_t iRow = 0; iRow < hdr->nRow; iRow++) {
- code = tColDataAppendValue(colData, &COL_VAL_NONE(colData->cid, colData->type));
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- } else {
- ASSERT(blockCol->type == colData->type);
- ASSERT(blockCol->flag && blockCol->flag != HAS_NONE);
-
- if (blockCol->flag == HAS_NULL) {
- for (int32_t iRow = 0; iRow < hdr->nRow; iRow++) {
- code = tColDataAppendValue(colData, &COL_VAL_NULL(blockCol->cid, blockCol->type));
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- } else {
- int32_t size1 = blockCol->szBitmap + blockCol->szOffset + blockCol->szValue;
-
- code = tRealloc(&reader->config->bufArr[1], size1);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tsdbReadFile(reader->fd, sttBlk->bInfo.offset + sttBlk->bInfo.szKey + hdr->szBlkCol + blockCol->offset,
- reader->config->bufArr[1], size1, 0);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- code = tsdbDecmprColData(reader->config->bufArr[1], blockCol, hdr->cmprAlg, hdr->nRow, colData,
- &reader->config->bufArr[2]);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- }
+ // decode the buffer
+ SBufferReader br1 = BUFFER_READER_INITIALIZER(0, buffer1);
+ code = tBlockDataDecompressColData(&hdr, &blockCol, &br1, bData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
}
@@ -319,26 +310,32 @@ int32_t tsdbSttFileReadTombBlock(SSttFileReader *reader, const STombBlk *tombBlk
int32_t code = 0;
int32_t lino = 0;
- code = tRealloc(&reader->config->bufArr[0], tombBlk->dp->size);
+ SBuffer *buffer0 = reader->buffers + 0;
+ SBuffer *assist = reader->buffers + 1;
+
+ // load
+ tBufferClear(buffer0);
+ code = tsdbReadFileToBuffer(reader->fd, tombBlk->dp->offset, tombBlk->dp->size, buffer0, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- code = tsdbReadFile(reader->fd, tombBlk->dp->offset, reader->config->bufArr[0], tombBlk->dp->size, 0);
- if (code) TSDB_CHECK_CODE(code, lino, _exit);
-
- int64_t size = 0;
+ // decode
+ int32_t size = 0;
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0);
tTombBlockClear(tombBlock);
- for (int32_t i = 0; i < ARRAY_SIZE(tombBlock->dataArr); ++i) {
- code = tsdbDecmprData(reader->config->bufArr[0] + size, tombBlk->size[i], TSDB_DATA_TYPE_BIGINT, tombBlk->cmprAlg,
- &reader->config->bufArr[1], sizeof(int64_t) * tombBlk->numRec, &reader->config->bufArr[2]);
+ tombBlock->numOfRecords = tombBlk->numRec;
+ for (int32_t i = 0; i < ARRAY_SIZE(tombBlock->buffers); ++i) {
+ SCompressInfo cinfo = {
+ .cmprAlg = tombBlk->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .originalSize = tombBlk->numRec * sizeof(int64_t),
+ .compressedSize = tombBlk->size[i],
+ };
+ code = tDecompressDataToBuffer(BR_PTR(&br), &cinfo, tombBlock->buffers + i, assist);
TSDB_CHECK_CODE(code, lino, _exit);
-
- code = TARRAY2_APPEND_BATCH(&tombBlock->dataArr[i], reader->config->bufArr[1], tombBlk->numRec);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- size += tombBlk->size[i];
+ br.offset += tombBlk->size[i];
}
- ASSERT(size == tombBlk->dp->size);
+ ASSERT(br.offset == tombBlk->dp->size);
_exit:
if (code) {
TSDB_ERROR_LOG(TD_VID(reader->config->tsdb->pVnode), lino, code);
@@ -350,27 +347,62 @@ int32_t tsdbSttFileReadStatisBlock(SSttFileReader *reader, const SStatisBlk *sta
int32_t code = 0;
int32_t lino = 0;
- code = tRealloc(&reader->config->bufArr[0], statisBlk->dp->size);
+ SBuffer *buffer0 = reader->buffers + 0;
+ SBuffer *assist = reader->buffers + 1;
+
+ // load data
+ tBufferClear(buffer0);
+ code = tsdbReadFileToBuffer(reader->fd, statisBlk->dp->offset, statisBlk->dp->size, buffer0, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- code = tsdbReadFile(reader->fd, statisBlk->dp->offset, reader->config->bufArr[0], statisBlk->dp->size, 0);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- int64_t size = 0;
+ // decode data
tStatisBlockClear(statisBlock);
- for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->dataArr); ++i) {
- code =
- tsdbDecmprData(reader->config->bufArr[0] + size, statisBlk->size[i], TSDB_DATA_TYPE_BIGINT, statisBlk->cmprAlg,
- &reader->config->bufArr[1], sizeof(int64_t) * statisBlk->numRec, &reader->config->bufArr[2]);
- TSDB_CHECK_CODE(code, lino, _exit);
+ statisBlock->numOfPKs = statisBlk->numOfPKs;
+ statisBlock->numOfRecords = statisBlk->numRec;
+ SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0);
+ for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
+ SCompressInfo info = {
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .cmprAlg = statisBlk->cmprAlg,
+ .compressedSize = statisBlk->size[i],
+ .originalSize = statisBlk->numRec * sizeof(int64_t),
+ };
- code = TARRAY2_APPEND_BATCH(statisBlock->dataArr + i, reader->config->bufArr[1], statisBlk->numRec);
+ code = tDecompressDataToBuffer(BR_PTR(&br), &info, &statisBlock->buffers[i], assist);
TSDB_CHECK_CODE(code, lino, _exit);
-
- size += statisBlk->size[i];
+ br.offset += statisBlk->size[i];
}
- ASSERT(size == statisBlk->dp->size);
+ if (statisBlk->numOfPKs > 0) {
+ SValueColumnCompressInfo firstKeyInfos[TD_MAX_PK_COLS];
+ SValueColumnCompressInfo lastKeyInfos[TD_MAX_PK_COLS];
+
+ // decode compress info
+ for (int32_t i = 0; i < statisBlk->numOfPKs; i++) {
+ code = tValueColumnCompressInfoDecode(&br, &firstKeyInfos[i]);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ for (int32_t i = 0; i < statisBlk->numOfPKs; i++) {
+ code = tValueColumnCompressInfoDecode(&br, &lastKeyInfos[i]);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ // decode value columns
+ for (int32_t i = 0; i < statisBlk->numOfPKs; i++) {
+ code = tValueColumnDecompress(BR_PTR(&br), firstKeyInfos + i, &statisBlock->firstKeyPKs[i], assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ br.offset += (firstKeyInfos[i].dataCompressedSize + firstKeyInfos[i].offsetCompressedSize);
+ }
+
+ for (int32_t i = 0; i < statisBlk->numOfPKs; i++) {
+ code = tValueColumnDecompress(BR_PTR(&br), &lastKeyInfos[i], &statisBlock->lastKeyPKs[i], assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ br.offset += (lastKeyInfos[i].dataCompressedSize + lastKeyInfos[i].offsetCompressedSize);
+ }
+ }
+
+ ASSERT(br.offset == buffer0->size);
_exit:
if (code) {
@@ -402,11 +434,12 @@ struct SSttFileWriter {
// helper data
SSkmInfo skmTb[1];
SSkmInfo skmRow[1];
- uint8_t *bufArr[5];
+ SBuffer local[10];
+ SBuffer *buffers;
};
static int32_t tsdbFileDoWriteSttBlockData(STsdbFD *fd, SBlockData *blockData, int8_t cmprAlg, int64_t *fileSize,
- TSttBlkArray *sttBlkArray, uint8_t **bufArr, SVersionRange *range) {
+ TSttBlkArray *sttBlkArray, SBuffer *buffers, SVersionRange *range) {
if (blockData->nRow == 0) return 0;
int32_t code = 0;
@@ -431,19 +464,17 @@ static int32_t tsdbFileDoWriteSttBlockData(STsdbFD *fd, SBlockData *blockData, i
tsdbWriterUpdVerRange(range, sttBlk->minVer, sttBlk->maxVer);
- int32_t sizeArr[5] = {0};
- code = tCmprBlockData(blockData, cmprAlg, NULL, NULL, bufArr, sizeArr);
+ code = tBlockDataCompress(blockData, cmprAlg, buffers, buffers + 4);
if (code) return code;
-
sttBlk->bInfo.offset = *fileSize;
- sttBlk->bInfo.szKey = sizeArr[2] + sizeArr[3];
- sttBlk->bInfo.szBlock = sizeArr[0] + sizeArr[1] + sttBlk->bInfo.szKey;
+ sttBlk->bInfo.szKey = buffers[0].size + buffers[1].size;
+ sttBlk->bInfo.szBlock = buffers[2].size + buffers[3].size + sttBlk->bInfo.szKey;
- for (int32_t i = 3; i >= 0; i--) {
- if (sizeArr[i]) {
- code = tsdbWriteFile(fd, *fileSize, bufArr[i], sizeArr[i]);
+ for (int i = 0; i < 4; i++) {
+ if (buffers[i].size) {
+ code = tsdbWriteFile(fd, *fileSize, buffers[i].data, buffers[i].size);
if (code) return code;
- *fileSize += sizeArr[i];
+ *fileSize += buffers[i].size;
}
}
@@ -462,7 +493,7 @@ static int32_t tsdbSttFileDoWriteBlockData(SSttFileWriter *writer) {
int32_t lino = 0;
code = tsdbFileDoWriteSttBlockData(writer->fd, writer->blockData, writer->config->cmprAlg, &writer->file->size,
- writer->sttBlkArray, writer->config->bufArr, &writer->ctx->range);
+ writer->sttBlkArray, writer->buffers, &writer->ctx->range);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:
@@ -473,45 +504,86 @@ _exit:
}
static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) {
- if (STATIS_BLOCK_SIZE(writer->staticBlock) == 0) return 0;
+ if (writer->staticBlock->numOfRecords == 0) return 0;
int32_t code = 0;
int32_t lino = 0;
- SStatisBlk statisBlk[1] = {{
- .dp[0] =
- {
- .offset = writer->file->size,
- .size = 0,
- },
- .minTbid =
- {
- .suid = TARRAY2_FIRST(writer->staticBlock->suid),
- .uid = TARRAY2_FIRST(writer->staticBlock->uid),
- },
- .maxTbid =
- {
- .suid = TARRAY2_LAST(writer->staticBlock->suid),
- .uid = TARRAY2_LAST(writer->staticBlock->uid),
- },
- .numRec = STATIS_BLOCK_SIZE(writer->staticBlock),
- .cmprAlg = writer->config->cmprAlg,
- }};
+ SBuffer *buffer0 = writer->buffers + 0;
+ SBuffer *buffer1 = writer->buffers + 1;
+ SBuffer *assist = writer->buffers + 2;
- for (int32_t i = 0; i < STATIS_RECORD_NUM_ELEM; i++) {
- code = tsdbCmprData((uint8_t *)TARRAY2_DATA(writer->staticBlock->dataArr + i),
- TARRAY2_DATA_LEN(&writer->staticBlock->dataArr[i]), TSDB_DATA_TYPE_BIGINT, statisBlk->cmprAlg,
- &writer->config->bufArr[0], 0, &statisBlk->size[i], &writer->config->bufArr[1]);
+ STbStatisRecord record;
+ STbStatisBlock *statisBlock = writer->staticBlock;
+ SStatisBlk statisBlk = {0};
+
+ statisBlk.dp->offset = writer->file->size;
+ statisBlk.dp->size = 0;
+ statisBlk.numRec = statisBlock->numOfRecords;
+ statisBlk.cmprAlg = writer->config->cmprAlg;
+ statisBlk.numOfPKs = statisBlock->numOfPKs;
+
+ tStatisBlockGet(statisBlock, 0, &record);
+ statisBlk.minTbid.suid = record.suid;
+ statisBlk.minTbid.uid = record.uid;
+
+ tStatisBlockGet(statisBlock, statisBlock->numOfRecords - 1, &record);
+ statisBlk.maxTbid.suid = record.suid;
+ statisBlk.maxTbid.uid = record.uid;
+
+ // compress each column
+ for (int32_t i = 0; i < ARRAY_SIZE(statisBlk.size); i++) {
+ SCompressInfo info = {
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .cmprAlg = statisBlk.cmprAlg,
+ .originalSize = statisBlock->buffers[i].size,
+ };
+
+ tBufferClear(buffer0);
+ code = tCompressDataToBuffer(statisBlock->buffers[i].data, &info, buffer0, assist);
TSDB_CHECK_CODE(code, lino, _exit);
- code = tsdbWriteFile(writer->fd, writer->file->size, writer->config->bufArr[0], statisBlk->size[i]);
+ code = tsdbWriteFile(writer->fd, writer->file->size, buffer0->data, info.compressedSize);
TSDB_CHECK_CODE(code, lino, _exit);
- statisBlk->dp->size += statisBlk->size[i];
- writer->file->size += statisBlk->size[i];
+ statisBlk.size[i] = info.compressedSize;
+ statisBlk.dp->size += info.compressedSize;
+ writer->file->size += info.compressedSize;
}
- code = TARRAY2_APPEND_PTR(writer->statisBlkArray, statisBlk);
+ // compress primary keys
+ if (statisBlk.numOfPKs > 0) {
+ SValueColumnCompressInfo compressInfo = {.cmprAlg = statisBlk.cmprAlg};
+
+ tBufferClear(buffer0);
+ tBufferClear(buffer0);
+
+ for (int32_t i = 0; i < statisBlk.numOfPKs; i++) {
+ code = tValueColumnCompress(&statisBlock->firstKeyPKs[i], &compressInfo, buffer1, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ code = tValueColumnCompressInfoEncode(&compressInfo, buffer0);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ for (int32_t i = 0; i < statisBlk.numOfPKs; i++) {
+ code = tValueColumnCompress(&statisBlock->lastKeyPKs[i], &compressInfo, buffer1, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ code = tValueColumnCompressInfoEncode(&compressInfo, buffer0);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ code = tsdbWriteFile(writer->fd, writer->file->size, buffer0->data, buffer0->size);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ writer->file->size += buffer0->size;
+ statisBlk.dp->size += buffer0->size;
+
+ code = tsdbWriteFile(writer->fd, writer->file->size, buffer1->data, buffer1->size);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ writer->file->size += buffer1->size;
+ statisBlk.dp->size += buffer1->size;
+ }
+
+ code = TARRAY2_APPEND_PTR(writer->statisBlkArray, &statisBlk);
TSDB_CHECK_CODE(code, lino, _exit);
tStatisBlockClear(writer->staticBlock);
@@ -530,7 +602,7 @@ static int32_t tsdbSttFileDoWriteTombBlock(SSttFileWriter *writer) {
int32_t lino = 0;
code = tsdbFileWriteTombBlock(writer->fd, writer->tombBlock, writer->config->cmprAlg, &writer->file->size,
- writer->tombBlkArray, writer->config->bufArr, &writer->ctx->range);
+ writer->tombBlkArray, writer->buffers, &writer->ctx->range);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:
@@ -621,7 +693,10 @@ static int32_t tsdbSttFWriterDoOpen(SSttFileWriter *writer) {
// set
if (!writer->config->skmTb) writer->config->skmTb = writer->skmTb;
if (!writer->config->skmRow) writer->config->skmRow = writer->skmRow;
- if (!writer->config->bufArr) writer->config->bufArr = writer->bufArr;
+ writer->buffers = writer->config->buffers;
+ if (writer->buffers == NULL) {
+ writer->buffers = writer->local;
+ }
writer->file[0] = (STFile){
.type = TSDB_FTYPE_STT,
@@ -665,8 +740,8 @@ _exit:
static void tsdbSttFWriterDoClose(SSttFileWriter *writer) {
ASSERT(writer->fd == NULL);
- for (int32_t i = 0; i < ARRAY_SIZE(writer->bufArr); ++i) {
- tFree(writer->bufArr[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(writer->local); ++i) {
+ tBufferDestroy(writer->local + i);
}
tDestroyTSchema(writer->skmRow->pTSchema);
tDestroyTSchema(writer->skmTb->pTSchema);
@@ -796,40 +871,24 @@ int32_t tsdbSttFileWriteRow(SSttFileWriter *writer, SRowInfo *row) {
TSDB_CHECK_CODE(code, lino, _exit);
}
- TSDBKEY key[1];
- if (row->row.type == TSDBROW_ROW_FMT) {
- key->ts = row->row.pTSRow->ts;
- key->version = row->row.version;
- } else {
- key->ts = row->row.pBlockData->aTSKEY[row->row.iRow];
- key->version = row->row.pBlockData->aVersion[row->row.iRow];
- }
-
if (writer->ctx->tbid->uid != row->uid) {
writer->ctx->tbid->suid = row->suid;
writer->ctx->tbid->uid = row->uid;
+ }
- if (STATIS_BLOCK_SIZE(writer->staticBlock) >= writer->config->maxRow) {
+ STsdbRowKey key;
+ tsdbRowGetKey(&row->row, &key);
+
+ for (;;) {
+ code = tStatisBlockPut(writer->staticBlock, row, writer->config->maxRow);
+ if (code == TSDB_CODE_INVALID_PARA) {
code = tsdbSttFileDoWriteStatisBlock(writer);
TSDB_CHECK_CODE(code, lino, _exit);
+ continue;
+ } else {
+ TSDB_CHECK_CODE(code, lino, _exit);
}
-
- STbStatisRecord record = {
- .suid = row->suid,
- .uid = row->uid,
- .firstKey = key->ts,
- .lastKey = key->ts,
- .count = 1,
- };
- code = tStatisBlockPut(writer->staticBlock, &record);
- TSDB_CHECK_CODE(code, lino, _exit);
- } else {
- ASSERT(key->ts >= TARRAY2_LAST(writer->staticBlock->lastKey));
-
- if (key->ts > TARRAY2_LAST(writer->staticBlock->lastKey)) {
- TARRAY2_LAST(writer->staticBlock->count)++;
- TARRAY2_LAST(writer->staticBlock->lastKey) = key->ts;
- }
+ break;
}
if (row->row.type == TSDBROW_ROW_FMT) {
@@ -839,12 +898,13 @@ int32_t tsdbSttFileWriteRow(SSttFileWriter *writer, SRowInfo *row) {
}
// row to col conversion
- if (key->version <= writer->config->compactVersion //
+ if (key.version <= writer->config->compactVersion //
&& writer->blockData->nRow > 0 //
- && writer->blockData->aTSKEY[writer->blockData->nRow - 1] == key->ts //
&& (writer->blockData->uid //
? writer->blockData->uid //
: writer->blockData->aUid[writer->blockData->nRow - 1]) == row->uid //
+ && tsdbRowCompareWithoutVersion(&row->row,
+ &tsdbRowFromBlockData(writer->blockData, writer->blockData->nRow - 1)) == 0 //
) {
code = tBlockDataUpdateRow(writer->blockData, &row->row, writer->config->skmRow->pTSchema);
TSDB_CHECK_CODE(code, lino, _exit);
diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.h b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.h
index 0051a6cd92..066e0c3498 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.h
+++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.h
@@ -54,10 +54,10 @@ int32_t tsdbSttFileReadStatisBlock(SSttFileReader *reader, const SStatisBlk *sta
int32_t tsdbSttFileReadTombBlock(SSttFileReader *reader, const STombBlk *delBlk, STombBlock *dData);
struct SSttFileReaderConfig {
- STsdb *tsdb;
- int32_t szPage;
- STFile file[1];
- uint8_t **bufArr;
+ STsdb *tsdb;
+ int32_t szPage;
+ STFile file[1];
+ SBuffer *buffers;
};
// SSttFileWriter ==========================================
@@ -86,7 +86,7 @@ struct SSttFileWriterConfig {
int32_t level;
SSkmInfo *skmTb;
SSkmInfo *skmRow;
- uint8_t **bufArr;
+ SBuffer *buffers;
};
#ifdef __cplusplus
diff --git a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c
index 876c0df4a0..b8f8e14b21 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c
+++ b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c
@@ -33,10 +33,10 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
// init
struct {
// config
- int32_t maxRow;
- int8_t cmprAlg;
- int32_t szPage;
- uint8_t *bufArr[8];
+ int32_t maxRow;
+ int8_t cmprAlg;
+ int32_t szPage;
+ SBuffer buffers[10];
// reader
SArray *aBlockIdx;
SMapData mDataBlk[1];
@@ -97,10 +97,24 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
SBrinRecord record = {
.suid = pBlockIdx->suid,
.uid = pBlockIdx->uid,
- .firstKey = dataBlk->minKey.ts,
- .firstKeyVer = dataBlk->minKey.version,
- .lastKey = dataBlk->maxKey.ts,
- .lastKeyVer = dataBlk->maxKey.version,
+ .firstKey =
+ (STsdbRowKey){
+ .key =
+ (SRowKey){
+ .ts = dataBlk->minKey.ts,
+ .numOfPKs = 0,
+ },
+ .version = dataBlk->minKey.version,
+ },
+ .lastKey =
+ (STsdbRowKey){
+ .key =
+ (SRowKey){
+ .ts = dataBlk->maxKey.ts,
+ .numOfPKs = 0,
+ },
+ .version = dataBlk->maxKey.version,
+ },
.minVer = dataBlk->minVer,
.maxVer = dataBlk->maxVer,
.blockOffset = dataBlk->aSubBlock->offset,
@@ -119,19 +133,19 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
code = tBrinBlockPut(ctx->brinBlock, &record);
TSDB_CHECK_CODE(code, lino, _exit);
- if (BRIN_BLOCK_SIZE(ctx->brinBlock) >= ctx->maxRow) {
+ if (ctx->brinBlock->numOfRecords >= ctx->maxRow) {
SVersionRange range = {.minVer = VERSION_MAX, .maxVer = VERSION_MIN};
code = tsdbFileWriteBrinBlock(ctx->fd, ctx->brinBlock, ctx->cmprAlg, &fset->farr[TSDB_FTYPE_HEAD]->f->size,
- ctx->brinBlkArray, ctx->bufArr, &range);
+ ctx->brinBlkArray, ctx->buffers, &range);
TSDB_CHECK_CODE(code, lino, _exit);
}
}
}
- if (BRIN_BLOCK_SIZE(ctx->brinBlock) > 0) {
+ if (ctx->brinBlock->numOfRecords > 0) {
SVersionRange range = {.minVer = VERSION_MAX, .maxVer = VERSION_MIN};
code = tsdbFileWriteBrinBlock(ctx->fd, ctx->brinBlock, ctx->cmprAlg, &fset->farr[TSDB_FTYPE_HEAD]->f->size,
- ctx->brinBlkArray, ctx->bufArr, &range);
+ ctx->brinBlkArray, ctx->buffers, &range);
TSDB_CHECK_CODE(code, lino, _exit);
}
@@ -157,8 +171,8 @@ _exit:
tBlockDataDestroy(ctx->blockData);
tMapDataClear(ctx->mDataBlk);
taosArrayDestroy(ctx->aBlockIdx);
- for (int32_t i = 0; i < ARRAY_SIZE(ctx->bufArr); ++i) {
- tFree(ctx->bufArr[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(ctx->buffers); ++i) {
+ tBufferDestroy(ctx->buffers + i);
}
return code;
}
@@ -434,12 +448,12 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray *
struct {
// context
- bool toStt;
- int8_t cmprAlg;
- int32_t maxRow;
- int64_t minKey;
- int64_t maxKey;
- uint8_t *bufArr[8];
+ bool toStt;
+ int8_t cmprAlg;
+ int32_t maxRow;
+ int64_t minKey;
+ int64_t maxKey;
+ SBuffer buffers[10];
// reader
SArray *aDelData;
// writer
@@ -488,7 +502,7 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray *
}
SVersionRange tombRange = {.minVer = VERSION_MAX, .maxVer = VERSION_MIN};
code = tsdbFileWriteTombBlock(ctx->fd, ctx->tombBlock, ctx->cmprAlg, &ctx->fobj->f->size, ctx->tombBlkArray,
- ctx->bufArr, &tombRange);
+ ctx->buffers, &tombRange);
TSDB_CHECK_CODE(code, lino, _exit);
}
}
@@ -501,7 +515,7 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray *
}
SVersionRange tombRange = {.minVer = VERSION_MAX, .maxVer = VERSION_MIN};
code = tsdbFileWriteTombBlock(ctx->fd, ctx->tombBlock, ctx->cmprAlg, &ctx->fobj->f->size, ctx->tombBlkArray,
- ctx->bufArr, &tombRange);
+ ctx->buffers, &tombRange);
TSDB_CHECK_CODE(code, lino, _exit);
}
@@ -530,8 +544,8 @@ _exit:
if (code) {
TSDB_ERROR_LOG(TD_VID(tsdb->pVnode), lino, code);
}
- for (int32_t i = 0; i < ARRAY_SIZE(ctx->bufArr); i++) {
- tFree(ctx->bufArr[i]);
+ for (int32_t i = 0; i < ARRAY_SIZE(ctx->buffers); i++) {
+ tBufferDestroy(ctx->buffers + i);
}
TARRAY2_DESTROY(ctx->tombBlkArray, NULL);
tTombBlockDestroy(ctx->tombBlock);
diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c
index 44621bf4e6..f708700b1a 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUtil.c
+++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c
@@ -16,6 +16,8 @@
#include "tdataformat.h"
#include "tsdb.h"
+static int32_t tBlockDataCompressKeyPart(SBlockData *bData, SDiskDataHdr *hdr, SBuffer *buffer, SBuffer *assist);
+
// SMapData =======================================================================
void tMapDataReset(SMapData *pMapData) {
pMapData->nItem = 0;
@@ -380,47 +382,44 @@ int32_t tGetSttBlk(uint8_t *p, void *ph) {
}
// SBlockCol ======================================================
-int32_t tPutBlockCol(uint8_t *p, void *ph) {
- int32_t n = 0;
- SBlockCol *pBlockCol = (SBlockCol *)ph;
+int32_t tPutBlockCol(SBuffer *buffer, const SBlockCol *pBlockCol) {
+ int32_t code;
ASSERT(pBlockCol->flag && (pBlockCol->flag != HAS_NONE));
- n += tPutI16v(p ? p + n : p, pBlockCol->cid);
- n += tPutI8(p ? p + n : p, pBlockCol->type);
- n += tPutI8(p ? p + n : p, pBlockCol->smaOn);
- n += tPutI8(p ? p + n : p, pBlockCol->flag);
- n += tPutI32v(p ? p + n : p, pBlockCol->szOrigin);
+ if ((code = tBufferPutI16v(buffer, pBlockCol->cid))) return code;
+ if ((code = tBufferPutI8(buffer, pBlockCol->type))) return code;
+ if ((code = tBufferPutI8(buffer, pBlockCol->cflag))) return code;
+ if ((code = tBufferPutI8(buffer, pBlockCol->flag))) return code;
+ if ((code = tBufferPutI32v(buffer, pBlockCol->szOrigin))) return code;
if (pBlockCol->flag != HAS_NULL) {
if (pBlockCol->flag != HAS_VALUE) {
- n += tPutI32v(p ? p + n : p, pBlockCol->szBitmap);
+ if ((code = tBufferPutI32v(buffer, pBlockCol->szBitmap))) return code;
}
if (IS_VAR_DATA_TYPE(pBlockCol->type)) {
- n += tPutI32v(p ? p + n : p, pBlockCol->szOffset);
+ if ((code = tBufferPutI32v(buffer, pBlockCol->szOffset))) return code;
}
if (pBlockCol->flag != (HAS_NULL | HAS_NONE)) {
- n += tPutI32v(p ? p + n : p, pBlockCol->szValue);
+ if ((code = tBufferPutI32v(buffer, pBlockCol->szValue))) return code;
}
- n += tPutI32v(p ? p + n : p, pBlockCol->offset);
+ if ((code = tBufferPutI32v(buffer, pBlockCol->offset))) return code;
}
-_exit:
- return n;
+ return 0;
}
-int32_t tGetBlockCol(uint8_t *p, void *ph) {
- int32_t n = 0;
- SBlockCol *pBlockCol = (SBlockCol *)ph;
+int32_t tGetBlockCol(SBufferReader *br, SBlockCol *pBlockCol) {
+ int32_t code;
- n += tGetI16v(p + n, &pBlockCol->cid);
- n += tGetI8(p + n, &pBlockCol->type);
- n += tGetI8(p + n, &pBlockCol->smaOn);
- n += tGetI8(p + n, &pBlockCol->flag);
- n += tGetI32v(p + n, &pBlockCol->szOrigin);
+ if ((code = tBufferGetI16v(br, &pBlockCol->cid))) return code;
+ if ((code = tBufferGetI8(br, &pBlockCol->type))) return code;
+ if ((code = tBufferGetI8(br, &pBlockCol->cflag))) return code;
+ if ((code = tBufferGetI8(br, &pBlockCol->flag))) return code;
+ if ((code = tBufferGetI32v(br, &pBlockCol->szOrigin))) return code;
ASSERT(pBlockCol->flag && (pBlockCol->flag != HAS_NONE));
@@ -431,21 +430,21 @@ int32_t tGetBlockCol(uint8_t *p, void *ph) {
if (pBlockCol->flag != HAS_NULL) {
if (pBlockCol->flag != HAS_VALUE) {
- n += tGetI32v(p + n, &pBlockCol->szBitmap);
+ if ((code = tBufferGetI32v(br, &pBlockCol->szBitmap))) return code;
}
if (IS_VAR_DATA_TYPE(pBlockCol->type)) {
- n += tGetI32v(p + n, &pBlockCol->szOffset);
+ if ((code = tBufferGetI32v(br, &pBlockCol->szOffset))) return code;
}
if (pBlockCol->flag != (HAS_NULL | HAS_NONE)) {
- n += tGetI32v(p + n, &pBlockCol->szValue);
+ if ((code = tBufferGetI32v(br, &pBlockCol->szValue))) return code;
}
- n += tGetI32v(p + n, &pBlockCol->offset);
+ if ((code = tBufferGetI32v(br, &pBlockCol->offset))) return code;
}
- return n;
+ return 0;
}
#ifdef BUILD_NO_CALL
@@ -589,9 +588,7 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *
if (pRow->type == TSDBROW_ROW_FMT) {
tRowGet(pRow->pTSRow, pTSchema, iCol, pColVal);
} else if (pRow->type == TSDBROW_COL_FMT) {
- SColData *pColData;
-
- tBlockDataGetColData(pRow->pBlockData, pTColumn->colId, &pColData);
+ SColData *pColData = tBlockDataGetColData(pRow->pBlockData, pTColumn->colId);
if (pColData) {
tColDataGetValue(pColData, pRow->iRow, pColVal);
@@ -603,8 +600,58 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *
}
}
-int32_t tsdbRowCmprFn(const void *p1, const void *p2) {
- return tsdbKeyCmprFn(&TSDBROW_KEY((TSDBROW *)p1), &TSDBROW_KEY((TSDBROW *)p2));
+void tsdbRowGetKey(TSDBROW *row, STsdbRowKey *key) {
+ if (row->type == TSDBROW_ROW_FMT) {
+ key->version = row->version;
+ tRowGetKey(row->pTSRow, &key->key);
+ } else {
+ key->version = row->pBlockData->aVersion[row->iRow];
+ key->key.ts = row->pBlockData->aTSKEY[row->iRow];
+ key->key.numOfPKs = 0;
+ for (int32_t i = 0; i < row->pBlockData->nColData; i++) {
+ SColData *pColData = &row->pBlockData->aColData[i];
+ if (pColData->cflag & COL_IS_KEY) {
+ SColVal cv;
+ tColDataGetValue(pColData, row->iRow, &cv);
+ ASSERT(COL_VAL_IS_VALUE(&cv));
+ key->key.pks[key->key.numOfPKs] = cv.value;
+ key->key.numOfPKs++;
+ } else {
+ break;
+ }
+ }
+ }
+}
+
+int32_t tsdbRowKeyCmpr(const STsdbRowKey *key1, const STsdbRowKey *key2) {
+ int32_t c = tRowKeyCompare(&key1->key, &key2->key);
+
+ if (c) {
+ return c;
+ }
+
+ if (key1->version < key2->version) {
+ return -1;
+ } else if (key1->version > key2->version) {
+ return 1;
+ }
+ return 0;
+}
+
+int32_t tsdbRowCompare(const void *p1, const void *p2) {
+ STsdbRowKey key1, key2;
+
+ tsdbRowGetKey((TSDBROW *)p1, &key1);
+ tsdbRowGetKey((TSDBROW *)p2, &key2);
+ return tsdbRowKeyCmpr(&key1, &key2);
+}
+
+int32_t tsdbRowCompareWithoutVersion(const void *p1, const void *p2) {
+ STsdbRowKey key1, key2;
+
+ tsdbRowGetKey((TSDBROW *)p1, &key1);
+ tsdbRowGetKey((TSDBROW *)p2, &key2);
+ return tRowKeyCompare(&key1.key, &key2.key);
}
// STSDBRowIter ======================================================
@@ -636,8 +683,9 @@ SColVal *tsdbRowIterNext(STSDBRowIter *pIter) {
return tRowIterNext(pIter->pIter);
} else if (pIter->pRow->type == TSDBROW_COL_FMT) {
if (pIter->iColData == 0) {
- pIter->cv = COL_VAL_VALUE(PRIMARYKEY_TIMESTAMP_COL_ID, TSDB_DATA_TYPE_TIMESTAMP,
- (SValue){.val = pIter->pRow->pBlockData->aTSKEY[pIter->pRow->iRow]});
+ pIter->cv = COL_VAL_VALUE(
+ PRIMARYKEY_TIMESTAMP_COL_ID,
+ ((SValue){.type = TSDB_DATA_TYPE_TIMESTAMP, .val = pIter->pRow->pBlockData->aTSKEY[pIter->pRow->iRow]}));
++pIter->iColData;
return &pIter->cv;
}
@@ -674,7 +722,7 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
ASSERT(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP);
- *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = key.ts});
+ *pColVal = COL_VAL_VALUE(pTColumn->colId, ((SValue){.type = pTColumn->type, .val = key.ts}));
if (taosArrayPush(pMerger->pArray, pColVal) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
return code;
@@ -694,7 +742,7 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
}
tsdbRowGetColVal(pRow, pTSchema, jCol++, pColVal);
- if ((!COL_VAL_IS_NONE(pColVal)) && (!COL_VAL_IS_NULL(pColVal)) && IS_VAR_DATA_TYPE(pColVal->type)) {
+ if ((!COL_VAL_IS_NONE(pColVal)) && (!COL_VAL_IS_NULL(pColVal)) && IS_VAR_DATA_TYPE(pColVal->value.type)) {
uint8_t *pVal = pColVal->value.pData;
pColVal->value.pData = NULL;
@@ -738,7 +786,7 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
if (key.version > pMerger->version) {
if (!COL_VAL_IS_NONE(pColVal)) {
- if (IS_VAR_DATA_TYPE(pColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pColVal->value.type)) {
SColVal *pTColVal = taosArrayGet(pMerger->pArray, iCol);
if (!COL_VAL_IS_NULL(pColVal)) {
code = tRealloc(&pTColVal->value.pData, pColVal->value.nData);
@@ -760,7 +808,7 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
} else if (key.version < pMerger->version) {
SColVal *tColVal = (SColVal *)taosArrayGet(pMerger->pArray, iCol);
if (COL_VAL_IS_NONE(tColVal) && !COL_VAL_IS_NONE(pColVal)) {
- if ((!COL_VAL_IS_NULL(pColVal)) && IS_VAR_DATA_TYPE(pColVal->type)) {
+ if ((!COL_VAL_IS_NULL(pColVal)) && IS_VAR_DATA_TYPE(pColVal->value.type)) {
code = tRealloc(&tColVal->value.pData, pColVal->value.nData);
if (code) return code;
@@ -796,7 +844,7 @@ int32_t tsdbRowMergerInit(SRowMerger *pMerger, STSchema *pSchema) {
void tsdbRowMergerClear(SRowMerger *pMerger) {
for (int32_t iCol = 1; iCol < pMerger->pTSchema->numOfCols; iCol++) {
SColVal *pTColVal = taosArrayGet(pMerger->pArray, iCol);
- if (IS_VAR_DATA_TYPE(pTColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pTColVal->value.type)) {
tFree(pTColVal->value.pData);
}
}
@@ -808,7 +856,7 @@ void tsdbRowMergerCleanup(SRowMerger *pMerger) {
int32_t numOfCols = taosArrayGetSize(pMerger->pArray);
for (int32_t iCol = 1; iCol < numOfCols; iCol++) {
SColVal *pTColVal = taosArrayGet(pMerger->pArray, iCol);
- if (IS_VAR_DATA_TYPE(pTColVal->type)) {
+ if (IS_VAR_DATA_TYPE(pTColVal->value.type)) {
tFree(pTColVal->value.pData);
}
}
@@ -1140,8 +1188,7 @@ int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema,
continue;
}
- tColDataInit(&pBlockData->aColData[iCid], pTColumn->colId, pTColumn->type,
- (pTColumn->flags & COL_SMA_ON) ? 1 : 0);
+ tColDataInit(&pBlockData->aColData[iCid], pTColumn->colId, pTColumn->type, pTColumn->flags);
iColumn++;
pTColumn = (iColumn < pTSchema->numOfCols) ? &pTSchema->columns[iColumn] : NULL;
@@ -1152,8 +1199,7 @@ int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema,
for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) {
STColumn *pTColumn = &pTSchema->columns[iColData + 1];
- tColDataInit(&pBlockData->aColData[iColData], pTColumn->colId, pTColumn->type,
- (pTColumn->flags & COL_SMA_ON) ? 1 : 0);
+ tColDataInit(&pBlockData->aColData[iColData], pTColumn->colId, pTColumn->type, pTColumn->flags);
}
}
@@ -1181,6 +1227,24 @@ void tBlockDataClear(SBlockData *pBlockData) {
}
}
+int32_t tBlockDataAddColData(SBlockData *pBlockData, int16_t cid, int8_t type, int8_t cflag, SColData **ppColData) {
+ ASSERT(pBlockData->nColData == 0 || pBlockData->aColData[pBlockData->nColData - 1].cid < cid);
+
+ SColData *newColData = taosMemoryRealloc(pBlockData->aColData, sizeof(SColData) * (pBlockData->nColData + 1));
+ if (newColData == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ pBlockData->aColData = newColData;
+ pBlockData->nColData++;
+
+ *ppColData = &pBlockData->aColData[pBlockData->nColData - 1];
+ memset(*ppColData, 0, sizeof(SColData));
+ tColDataInit(*ppColData, cid, type, cflag);
+
+ return 0;
+}
+
/* flag > 0: forward update
* flag == 0: insert
* flag < 0: backward update
@@ -1303,7 +1367,7 @@ int32_t tBlockDataUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
}
#endif
-void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColData) {
+SColData *tBlockDataGetColData(SBlockData *pBlockData, int16_t cid) {
ASSERT(cid != PRIMARYKEY_TIMESTAMP_COL_ID);
int32_t lidx = 0;
int32_t ridx = pBlockData->nColData - 1;
@@ -1314,8 +1378,7 @@ void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColD
int32_t c = (pColData->cid == cid) ? 0 : ((pColData->cid > cid) ? 1 : -1);
if (c == 0) {
- *ppColData = pColData;
- return;
+ return pColData;
} else if (c < 0) {
lidx = midx + 1;
} else {
@@ -1323,170 +1386,112 @@ void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColD
}
}
- *ppColData = NULL;
+ return NULL;
}
-int32_t tCmprBlockData(SBlockData *pBlockData, int8_t cmprAlg, uint8_t **ppOut, int32_t *szOut, uint8_t *aBuf[],
- int32_t aBufN[]) {
+/* buffers[0]: SDiskDataHdr
+ * buffers[1]: key part: uid + version + ts + primary keys
+ * buffers[2]: SBlockCol part
+ * buffers[3]: regular column part
+ */
+int32_t tBlockDataCompress(SBlockData *bData, int8_t cmprAlg, SBuffer *buffers, SBuffer *assist) {
int32_t code = 0;
+ int32_t lino = 0;
- SDiskDataHdr hdr = {.delimiter = TSDB_FILE_DLMT,
- .fmtVer = 0,
- .suid = pBlockData->suid,
- .uid = pBlockData->uid,
- .nRow = pBlockData->nRow,
- .cmprAlg = cmprAlg};
+ SDiskDataHdr hdr = {
+ .delimiter = TSDB_FILE_DLMT,
+ .fmtVer = 1,
+ .suid = bData->suid,
+ .uid = bData->uid,
+ .szUid = 0, // filled by compress key
+ .szVer = 0, // filled by compress key
+ .szKey = 0, // filled by compress key
+ .szBlkCol = 0, // filled by this func
+ .nRow = bData->nRow,
+ .cmprAlg = cmprAlg,
+ .numOfPKs = 0, // filled by compress key
+ };
- // encode =================
- // columns AND SBlockCol
- aBufN[0] = 0;
- for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) {
- SColData *pColData = tBlockDataGetColDataByIdx(pBlockData, iColData);
+ // Key part
+ tBufferClear(&buffers[1]);
+ code = tBlockDataCompressKeyPart(bData, &hdr, &buffers[1], assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
- ASSERT(pColData->flag);
+ // Regulart column part
+ tBufferClear(&buffers[2]);
+ tBufferClear(&buffers[3]);
+ for (int i = 0; i < bData->nColData; i++) {
+ SColData *colData = tBlockDataGetColDataByIdx(bData, i);
- if (pColData->flag == HAS_NONE) continue;
-
- SBlockCol blockCol = {.cid = pColData->cid,
- .type = pColData->type,
- .smaOn = pColData->smaOn,
- .flag = pColData->flag,
- .szOrigin = pColData->nData};
-
- if (pColData->flag != HAS_NULL) {
- code = tsdbCmprColData(pColData, cmprAlg, &blockCol, &aBuf[0], aBufN[0], &aBuf[2]);
- if (code) goto _exit;
-
- blockCol.offset = aBufN[0];
- aBufN[0] = aBufN[0] + blockCol.szBitmap + blockCol.szOffset + blockCol.szValue;
+ if (colData->cflag & COL_IS_KEY) {
+ continue;
+ }
+ if (colData->flag == HAS_NONE) {
+ continue;
}
- code = tRealloc(&aBuf[1], hdr.szBlkCol + tPutBlockCol(NULL, &blockCol));
- if (code) goto _exit;
- hdr.szBlkCol += tPutBlockCol(aBuf[1] + hdr.szBlkCol, &blockCol);
+ SColDataCompressInfo cinfo = {
+ .cmprAlg = cmprAlg,
+ };
+ int32_t offset = buffers[3].size;
+ code = tColDataCompress(colData, &cinfo, &buffers[3], assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ SBlockCol blockCol = (SBlockCol){
+ .cid = cinfo.columnId,
+ .type = cinfo.dataType,
+ .cflag = cinfo.columnFlag,
+ .flag = cinfo.flag,
+ .szOrigin = cinfo.dataOriginalSize,
+ .szBitmap = cinfo.bitmapCompressedSize,
+ .szOffset = cinfo.offsetCompressedSize,
+ .szValue = cinfo.dataCompressedSize,
+ .offset = offset,
+ };
+
+ code = tPutBlockCol(&buffers[2], &blockCol);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
+ hdr.szBlkCol = buffers[2].size;
- // SBlockCol
- aBufN[1] = hdr.szBlkCol;
-
- // uid + version + tskey
- aBufN[2] = 0;
- if (pBlockData->uid == 0) {
- code = tsdbCmprData((uint8_t *)pBlockData->aUid, sizeof(int64_t) * pBlockData->nRow, TSDB_DATA_TYPE_BIGINT, cmprAlg,
- &aBuf[2], aBufN[2], &hdr.szUid, &aBuf[3]);
- if (code) goto _exit;
- }
- aBufN[2] += hdr.szUid;
-
- code = tsdbCmprData((uint8_t *)pBlockData->aVersion, sizeof(int64_t) * pBlockData->nRow, TSDB_DATA_TYPE_BIGINT,
- cmprAlg, &aBuf[2], aBufN[2], &hdr.szVer, &aBuf[3]);
- if (code) goto _exit;
- aBufN[2] += hdr.szVer;
-
- code = tsdbCmprData((uint8_t *)pBlockData->aTSKEY, sizeof(TSKEY) * pBlockData->nRow, TSDB_DATA_TYPE_TIMESTAMP,
- cmprAlg, &aBuf[2], aBufN[2], &hdr.szKey, &aBuf[3]);
- if (code) goto _exit;
- aBufN[2] += hdr.szKey;
-
- // hdr
- aBufN[3] = tPutDiskDataHdr(NULL, &hdr);
- code = tRealloc(&aBuf[3], aBufN[3]);
- if (code) goto _exit;
- tPutDiskDataHdr(aBuf[3], &hdr);
-
- // aggragate
- if (ppOut) {
- *szOut = aBufN[0] + aBufN[1] + aBufN[2] + aBufN[3];
- code = tRealloc(ppOut, *szOut);
- if (code) goto _exit;
-
- memcpy(*ppOut, aBuf[3], aBufN[3]);
- memcpy(*ppOut + aBufN[3], aBuf[2], aBufN[2]);
- if (aBufN[1]) {
- memcpy(*ppOut + aBufN[3] + aBufN[2], aBuf[1], aBufN[1]);
- }
- if (aBufN[0]) {
- memcpy(*ppOut + aBufN[3] + aBufN[2] + aBufN[1], aBuf[0], aBufN[0]);
- }
- }
+ // SDiskDataHdr part
+ tBufferClear(&buffers[0]);
+ code = tPutDiskDataHdr(&buffers[0], &hdr);
+ TSDB_CHECK_CODE(code, lino, _exit);
_exit:
return code;
}
-int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uint8_t *aBuf[]) {
- int32_t code = 0;
-
- tBlockDataReset(pBlockData);
-
- int32_t n = 0;
- SDiskDataHdr hdr = {0};
+int32_t tBlockDataDecompress(SBufferReader *br, SBlockData *blockData, SBuffer *assist) {
+ int32_t code = 0;
+ int32_t lino = 0;
+ SDiskDataHdr hdr = {0};
+ SCompressInfo cinfo;
// SDiskDataHdr
- n += tGetDiskDataHdr(pIn + n, &hdr);
- ASSERT(hdr.delimiter == TSDB_FILE_DLMT);
+ code = tGetDiskDataHdr(br, &hdr);
+ TSDB_CHECK_CODE(code, lino, _exit);
- pBlockData->suid = hdr.suid;
- pBlockData->uid = hdr.uid;
- pBlockData->nRow = hdr.nRow;
+ tBlockDataReset(blockData);
+ blockData->suid = hdr.suid;
+ blockData->uid = hdr.uid;
+ blockData->nRow = hdr.nRow;
- // uid
- if (hdr.uid == 0) {
- ASSERT(hdr.szUid);
- code = tsdbDecmprData(pIn + n, hdr.szUid, TSDB_DATA_TYPE_BIGINT, hdr.cmprAlg, (uint8_t **)&pBlockData->aUid,
- sizeof(int64_t) * hdr.nRow, &aBuf[0]);
- if (code) goto _exit;
- } else {
- ASSERT(!hdr.szUid);
- }
- n += hdr.szUid;
+ // Key part
+ code = tBlockDataDecompressKeyPart(&hdr, br, blockData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
- // version
- code = tsdbDecmprData(pIn + n, hdr.szVer, TSDB_DATA_TYPE_BIGINT, hdr.cmprAlg, (uint8_t **)&pBlockData->aVersion,
- sizeof(int64_t) * hdr.nRow, &aBuf[0]);
- if (code) goto _exit;
- n += hdr.szVer;
+ // Column part
+ SBufferReader br2 = *br;
+ br->offset += hdr.szBlkCol;
+ for (uint32_t startOffset = br2.offset; br2.offset - startOffset < hdr.szBlkCol;) {
+ SBlockCol blockCol;
- // TSKEY
- code = tsdbDecmprData(pIn + n, hdr.szKey, TSDB_DATA_TYPE_TIMESTAMP, hdr.cmprAlg, (uint8_t **)&pBlockData->aTSKEY,
- sizeof(TSKEY) * hdr.nRow, &aBuf[0]);
- if (code) goto _exit;
- n += hdr.szKey;
-
- // loop to decode each column data
- if (hdr.szBlkCol == 0) goto _exit;
-
- int32_t nColData = 0;
- int32_t nt = 0;
- while (nt < hdr.szBlkCol) {
- SBlockCol blockCol = {0};
- nt += tGetBlockCol(pIn + n + nt, &blockCol);
- ++nColData;
- }
- ASSERT(nt == hdr.szBlkCol);
-
- code = tBlockDataAdjustColData(pBlockData, nColData);
- if (code) goto _exit;
-
- nt = 0;
- int32_t iColData = 0;
- while (nt < hdr.szBlkCol) {
- SBlockCol blockCol = {0};
- nt += tGetBlockCol(pIn + n + nt, &blockCol);
-
- SColData *pColData = &pBlockData->aColData[iColData++];
-
- tColDataInit(pColData, blockCol.cid, blockCol.type, blockCol.smaOn);
- if (blockCol.flag == HAS_NULL) {
- for (int32_t iRow = 0; iRow < hdr.nRow; iRow++) {
- code = tColDataAppendValue(pColData, &COL_VAL_NULL(blockCol.cid, blockCol.type));
- if (code) goto _exit;
- }
- } else {
- code = tsdbDecmprColData(pIn + n + hdr.szBlkCol + blockCol.offset, &blockCol, hdr.cmprAlg, hdr.nRow, pColData,
- &aBuf[0]);
- if (code) goto _exit;
- }
+ code = tGetBlockCol(&br2, &blockCol);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ code = tBlockDataDecompressColData(&hdr, &blockCol, br, blockData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
_exit:
@@ -1494,219 +1499,255 @@ _exit:
}
// SDiskDataHdr ==============================
-int32_t tPutDiskDataHdr(uint8_t *p, const SDiskDataHdr *pHdr) {
- int32_t n = 0;
+int32_t tPutDiskDataHdr(SBuffer *buffer, const SDiskDataHdr *pHdr) {
+ int32_t code;
- n += tPutU32(p ? p + n : p, pHdr->delimiter);
- n += tPutU32v(p ? p + n : p, pHdr->fmtVer);
- n += tPutI64(p ? p + n : p, pHdr->suid);
- n += tPutI64(p ? p + n : p, pHdr->uid);
- n += tPutI32v(p ? p + n : p, pHdr->szUid);
- n += tPutI32v(p ? p + n : p, pHdr->szVer);
- n += tPutI32v(p ? p + n : p, pHdr->szKey);
- n += tPutI32v(p ? p + n : p, pHdr->szBlkCol);
- n += tPutI32v(p ? p + n : p, pHdr->nRow);
- n += tPutI8(p ? p + n : p, pHdr->cmprAlg);
+ if ((code = tBufferPutU32(buffer, pHdr->delimiter))) return code;
+ if ((code = tBufferPutU32v(buffer, pHdr->fmtVer))) return code;
+ if ((code = tBufferPutI64(buffer, pHdr->suid))) return code;
+ if ((code = tBufferPutI64(buffer, pHdr->uid))) return code;
+ if ((code = tBufferPutI32v(buffer, pHdr->szUid))) return code;
+ if ((code = tBufferPutI32v(buffer, pHdr->szVer))) return code;
+ if ((code = tBufferPutI32v(buffer, pHdr->szKey))) return code;
+ if ((code = tBufferPutI32v(buffer, pHdr->szBlkCol))) return code;
+ if ((code = tBufferPutI32v(buffer, pHdr->nRow))) return code;
+ if ((code = tBufferPutI8(buffer, pHdr->cmprAlg))) return code;
+ if (pHdr->fmtVer == 1) {
+ if ((code = tBufferPutI8(buffer, pHdr->numOfPKs))) return code;
+ for (int i = 0; i < pHdr->numOfPKs; i++) {
+ if ((code = tPutBlockCol(buffer, &pHdr->primaryBlockCols[i]))) return code;
+ }
+ }
- return n;
+ return 0;
}
-int32_t tGetDiskDataHdr(uint8_t *p, void *ph) {
- int32_t n = 0;
- SDiskDataHdr *pHdr = (SDiskDataHdr *)ph;
+int32_t tGetDiskDataHdr(SBufferReader *br, SDiskDataHdr *pHdr) {
+ int32_t code;
- n += tGetU32(p + n, &pHdr->delimiter);
- n += tGetU32v(p + n, &pHdr->fmtVer);
- n += tGetI64(p + n, &pHdr->suid);
- n += tGetI64(p + n, &pHdr->uid);
- n += tGetI32v(p + n, &pHdr->szUid);
- n += tGetI32v(p + n, &pHdr->szVer);
- n += tGetI32v(p + n, &pHdr->szKey);
- n += tGetI32v(p + n, &pHdr->szBlkCol);
- n += tGetI32v(p + n, &pHdr->nRow);
- n += tGetI8(p + n, &pHdr->cmprAlg);
+ if ((code = tBufferGetU32(br, &pHdr->delimiter))) return code;
+ if ((code = tBufferGetU32v(br, &pHdr->fmtVer))) return code;
+ if ((code = tBufferGetI64(br, &pHdr->suid))) return code;
+ if ((code = tBufferGetI64(br, &pHdr->uid))) return code;
+ if ((code = tBufferGetI32v(br, &pHdr->szUid))) return code;
+ if ((code = tBufferGetI32v(br, &pHdr->szVer))) return code;
+ if ((code = tBufferGetI32v(br, &pHdr->szKey))) return code;
+ if ((code = tBufferGetI32v(br, &pHdr->szBlkCol))) return code;
+ if ((code = tBufferGetI32v(br, &pHdr->nRow))) return code;
+ if ((code = tBufferGetI8(br, &pHdr->cmprAlg))) return code;
+ if (pHdr->fmtVer == 1) {
+ if ((code = tBufferGetI8(br, &pHdr->numOfPKs))) return code;
+ for (int i = 0; i < pHdr->numOfPKs; i++) {
+ if ((code = tGetBlockCol(br, &pHdr->primaryBlockCols[i]))) return code;
+ }
+ } else {
+ pHdr->numOfPKs = 0;
+ }
- return n;
+ return 0;
}
// ALGORITHM ==============================
-int32_t tPutColumnDataAgg(uint8_t *p, SColumnDataAgg *pColAgg) {
- int32_t n = 0;
+int32_t tPutColumnDataAgg(SBuffer *buffer, SColumnDataAgg *pColAgg) {
+ int32_t code;
- n += tPutI16v(p ? p + n : p, pColAgg->colId);
- n += tPutI16v(p ? p + n : p, pColAgg->numOfNull);
- n += tPutI64(p ? p + n : p, pColAgg->sum);
- n += tPutI64(p ? p + n : p, pColAgg->max);
- n += tPutI64(p ? p + n : p, pColAgg->min);
+ if ((code = tBufferPutI16v(buffer, pColAgg->colId))) return code;
+ if ((code = tBufferPutI16v(buffer, pColAgg->numOfNull))) return code;
+ if ((code = tBufferPutI64(buffer, pColAgg->sum))) return code;
+ if ((code = tBufferPutI64(buffer, pColAgg->max))) return code;
+ if ((code = tBufferPutI64(buffer, pColAgg->min))) return code;
- return n;
+ return 0;
}
-int32_t tGetColumnDataAgg(uint8_t *p, SColumnDataAgg *pColAgg) {
- int32_t n = 0;
+int32_t tGetColumnDataAgg(SBufferReader *br, SColumnDataAgg *pColAgg) {
+ int32_t code;
- n += tGetI16v(p + n, &pColAgg->colId);
- n += tGetI16v(p + n, &pColAgg->numOfNull);
- n += tGetI64(p + n, &pColAgg->sum);
- n += tGetI64(p + n, &pColAgg->max);
- n += tGetI64(p + n, &pColAgg->min);
+ if ((code = tBufferGetI16v(br, &pColAgg->colId))) return code;
+ if ((code = tBufferGetI16v(br, &pColAgg->numOfNull))) return code;
+ if ((code = tBufferGetI64(br, &pColAgg->sum))) return code;
+ if ((code = tBufferGetI64(br, &pColAgg->max))) return code;
+ if ((code = tBufferGetI64(br, &pColAgg->min))) return code;
- return n;
+ return 0;
}
-int32_t tsdbCmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, uint8_t **ppOut, int32_t nOut,
- int32_t *szOut, uint8_t **ppBuf) {
- int32_t code = 0;
+static int32_t tBlockDataCompressKeyPart(SBlockData *bData, SDiskDataHdr *hdr, SBuffer *buffer, SBuffer *assist) {
+ int32_t code = 0;
+ int32_t lino = 0;
+ SCompressInfo cinfo;
- ASSERT(szIn > 0 && ppOut);
+ // uid
+ if (bData->uid == 0) {
+ cinfo = (SCompressInfo){
+ .cmprAlg = hdr->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .originalSize = sizeof(int64_t) * bData->nRow,
+ };
+ code = tCompressDataToBuffer(bData->aUid, &cinfo, buffer, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ hdr->szUid = cinfo.compressedSize;
+ }
- if (cmprAlg == NO_COMPRESSION) {
- code = tRealloc(ppOut, nOut + szIn);
- if (code) goto _exit;
+ // version
+ cinfo = (SCompressInfo){
+ .cmprAlg = hdr->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .originalSize = sizeof(int64_t) * bData->nRow,
+ };
+ code = tCompressDataToBuffer((uint8_t *)bData->aVersion, &cinfo, buffer, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ hdr->szVer = cinfo.compressedSize;
- memcpy(*ppOut + nOut, pIn, szIn);
- *szOut = szIn;
- } else {
- int32_t size = szIn + COMP_OVERFLOW_BYTES;
+ // ts
+ cinfo = (SCompressInfo){
+ .cmprAlg = hdr->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_TIMESTAMP,
+ .originalSize = sizeof(TSKEY) * bData->nRow,
+ };
+ code = tCompressDataToBuffer((uint8_t *)bData->aTSKEY, &cinfo, buffer, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ hdr->szKey = cinfo.compressedSize;
- code = tRealloc(ppOut, nOut + size);
- if (code) goto _exit;
+ // primary keys
+ for (hdr->numOfPKs = 0; hdr->numOfPKs < bData->nColData; hdr->numOfPKs++) {
+ ASSERT(hdr->numOfPKs <= TD_MAX_PK_COLS);
- if (cmprAlg == TWO_STAGE_COMP) {
- ASSERT(ppBuf);
- code = tRealloc(ppBuf, size);
- if (code) goto _exit;
+ SBlockCol *blockCol = &hdr->primaryBlockCols[hdr->numOfPKs];
+ SColData *colData = tBlockDataGetColDataByIdx(bData, hdr->numOfPKs);
+
+ if ((colData->cflag & COL_IS_KEY) == 0) {
+ break;
}
- *szOut =
- tDataTypes[type].compFunc(pIn, szIn, szIn / tDataTypes[type].bytes, *ppOut + nOut, size, cmprAlg, *ppBuf, size);
- if (*szOut <= 0) {
- code = TSDB_CODE_COMPRESS_ERROR;
- goto _exit;
- }
+ SColDataCompressInfo info = {
+ .cmprAlg = hdr->cmprAlg,
+ };
+ code = tColDataCompress(colData, &info, buffer, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ *blockCol = (SBlockCol){
+ .cid = info.columnId,
+ .type = info.dataType,
+ .cflag = info.columnFlag,
+ .flag = info.flag,
+ .szOrigin = info.dataOriginalSize,
+ .szBitmap = info.bitmapCompressedSize,
+ .szOffset = info.offsetCompressedSize,
+ .szValue = info.dataCompressedSize,
+ .offset = 0,
+ };
}
_exit:
return code;
}
-int32_t tsdbDecmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, uint8_t **ppOut, int32_t szOut,
- uint8_t **ppBuf) {
+int32_t tBlockDataDecompressColData(const SDiskDataHdr *hdr, const SBlockCol *blockCol, SBufferReader *br,
+ SBlockData *blockData, SBuffer *assist) {
int32_t code = 0;
+ int32_t lino = 0;
- code = tRealloc(ppOut, szOut);
- if (code) goto _exit;
+ SColData *colData;
- if (cmprAlg == NO_COMPRESSION) {
- ASSERT(szIn == szOut);
- memcpy(*ppOut, pIn, szOut);
- } else {
- if (cmprAlg == TWO_STAGE_COMP) {
- code = tRealloc(ppBuf, szOut + COMP_OVERFLOW_BYTES);
- if (code) goto _exit;
- }
+ code = tBlockDataAddColData(blockData, blockCol->cid, blockCol->type, blockCol->cflag, &colData);
+ TSDB_CHECK_CODE(code, lino, _exit);
- int32_t size = tDataTypes[type].decompFunc(pIn, szIn, szOut / tDataTypes[type].bytes, *ppOut, szOut, cmprAlg,
- *ppBuf, szOut + COMP_OVERFLOW_BYTES);
- if (size <= 0) {
- code = TSDB_CODE_COMPRESS_ERROR;
- goto _exit;
- }
+ // ASSERT(blockCol->flag != HAS_NONE);
- ASSERT(size == szOut);
+ SColDataCompressInfo info = {
+ .cmprAlg = hdr->cmprAlg,
+ .columnFlag = blockCol->cflag,
+ .flag = blockCol->flag,
+ .dataType = blockCol->type,
+ .columnId = blockCol->cid,
+ .numOfData = hdr->nRow,
+ .bitmapOriginalSize = 0,
+ .bitmapCompressedSize = blockCol->szBitmap,
+ .offsetOriginalSize = blockCol->szOffset ? sizeof(int32_t) * hdr->nRow : 0,
+ .offsetCompressedSize = blockCol->szOffset,
+ .dataOriginalSize = blockCol->szOrigin,
+ .dataCompressedSize = blockCol->szValue,
+ };
+
+ switch (blockCol->flag) {
+ case (HAS_NONE | HAS_NULL | HAS_VALUE):
+ info.bitmapOriginalSize = BIT2_SIZE(hdr->nRow);
+ break;
+ case (HAS_NONE | HAS_NULL):
+ case (HAS_NONE | HAS_VALUE):
+ case (HAS_NULL | HAS_VALUE):
+ info.bitmapOriginalSize = BIT1_SIZE(hdr->nRow);
+ break;
}
+ code = tColDataDecompress(BR_PTR(br), &info, colData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ br->offset += blockCol->szBitmap + blockCol->szOffset + blockCol->szValue;
+
_exit:
return code;
}
-int32_t tsdbCmprColData(SColData *pColData, int8_t cmprAlg, SBlockCol *pBlockCol, uint8_t **ppOut, int32_t nOut,
- uint8_t **ppBuf) {
- int32_t code = 0;
+int32_t tBlockDataDecompressKeyPart(const SDiskDataHdr *hdr, SBufferReader *br, SBlockData *blockData,
+ SBuffer *assist) {
+ int32_t code = 0;
+ int32_t lino = 0;
+ SCompressInfo cinfo;
- ASSERT(pColData->flag && (pColData->flag != HAS_NONE) && (pColData->flag != HAS_NULL));
+ // uid
+ if (hdr->szUid > 0) {
+ cinfo = (SCompressInfo){
+ .cmprAlg = hdr->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .compressedSize = hdr->szUid,
+ .originalSize = sizeof(int64_t) * hdr->nRow,
+ };
- pBlockCol->szBitmap = 0;
- pBlockCol->szOffset = 0;
- pBlockCol->szValue = 0;
-
- int32_t size = 0;
- // bitmap
- if (pColData->flag != HAS_VALUE) {
- int32_t szBitMap;
- if (pColData->flag == (HAS_VALUE | HAS_NULL | HAS_NONE)) {
- szBitMap = BIT2_SIZE(pColData->nVal);
- } else {
- szBitMap = BIT1_SIZE(pColData->nVal);
- }
-
- code = tsdbCmprData(pColData->pBitMap, szBitMap, TSDB_DATA_TYPE_TINYINT, cmprAlg, ppOut, nOut + size,
- &pBlockCol->szBitmap, ppBuf);
- if (code) goto _exit;
+ code = tRealloc((uint8_t **)&blockData->aUid, cinfo.originalSize);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ code = tDecompressData(BR_PTR(br), &cinfo, blockData->aUid, cinfo.originalSize, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ br->offset += cinfo.compressedSize;
}
- size += pBlockCol->szBitmap;
- // offset
- if (IS_VAR_DATA_TYPE(pColData->type) && pColData->flag != (HAS_NULL | HAS_NONE)) {
- code = tsdbCmprData((uint8_t *)pColData->aOffset, sizeof(int32_t) * pColData->nVal, TSDB_DATA_TYPE_INT, cmprAlg,
- ppOut, nOut + size, &pBlockCol->szOffset, ppBuf);
- if (code) goto _exit;
- }
- size += pBlockCol->szOffset;
+ // version
+ cinfo = (SCompressInfo){
+ .cmprAlg = hdr->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_BIGINT,
+ .compressedSize = hdr->szVer,
+ .originalSize = sizeof(int64_t) * hdr->nRow,
+ };
+ code = tRealloc((uint8_t **)&blockData->aVersion, cinfo.originalSize);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ code = tDecompressData(BR_PTR(br), &cinfo, blockData->aVersion, cinfo.originalSize, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ br->offset += cinfo.compressedSize;
- // value
- if ((pColData->flag != (HAS_NULL | HAS_NONE)) && pColData->nData) {
- code = tsdbCmprData((uint8_t *)pColData->pData, pColData->nData, pColData->type, cmprAlg, ppOut, nOut + size,
- &pBlockCol->szValue, ppBuf);
- if (code) goto _exit;
+ // ts
+ cinfo = (SCompressInfo){
+ .cmprAlg = hdr->cmprAlg,
+ .dataType = TSDB_DATA_TYPE_TIMESTAMP,
+ .compressedSize = hdr->szKey,
+ .originalSize = sizeof(TSKEY) * hdr->nRow,
+ };
+ code = tRealloc((uint8_t **)&blockData->aTSKEY, cinfo.originalSize);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ code = tDecompressData(BR_PTR(br), &cinfo, blockData->aTSKEY, cinfo.originalSize, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ br->offset += cinfo.compressedSize;
+
+ // primary keys
+ for (int i = 0; i < hdr->numOfPKs; i++) {
+ const SBlockCol *blockCol = &hdr->primaryBlockCols[i];
+
+ ASSERT(blockCol->flag == HAS_VALUE);
+ ASSERT(blockCol->cflag & COL_IS_KEY);
+
+ code = tBlockDataDecompressColData(hdr, blockCol, br, blockData, assist);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
- size += pBlockCol->szValue;
_exit:
return code;
-}
-
-int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, int32_t nVal, SColData *pColData,
- uint8_t **ppBuf) {
- int32_t code = 0;
-
- ASSERT(pColData->cid == pBlockCol->cid);
- ASSERT(pColData->type == pBlockCol->type);
- pColData->smaOn = pBlockCol->smaOn;
- pColData->flag = pBlockCol->flag;
- pColData->nVal = nVal;
- pColData->nData = pBlockCol->szOrigin;
-
- uint8_t *p = pIn;
- // bitmap
- if (pBlockCol->szBitmap) {
- int32_t szBitMap;
- if (pColData->flag == (HAS_VALUE | HAS_NULL | HAS_NONE)) {
- szBitMap = BIT2_SIZE(pColData->nVal);
- } else {
- szBitMap = BIT1_SIZE(pColData->nVal);
- }
-
- code = tsdbDecmprData(p, pBlockCol->szBitmap, TSDB_DATA_TYPE_TINYINT, cmprAlg, &pColData->pBitMap, szBitMap, ppBuf);
- if (code) goto _exit;
- }
- p += pBlockCol->szBitmap;
-
- // offset
- if (pBlockCol->szOffset) {
- code = tsdbDecmprData(p, pBlockCol->szOffset, TSDB_DATA_TYPE_INT, cmprAlg, (uint8_t **)&pColData->aOffset,
- sizeof(int32_t) * pColData->nVal, ppBuf);
- if (code) goto _exit;
- }
- p += pBlockCol->szOffset;
-
- // value
- if (pBlockCol->szValue) {
- code = tsdbDecmprData(p, pBlockCol->szValue, pColData->type, cmprAlg, &pColData->pData, pColData->nData, ppBuf);
- if (code) goto _exit;
- }
- p += pBlockCol->szValue;
-
-_exit:
- return code;
-}
+}
\ No newline at end of file
diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil2.c b/source/dnode/vnode/src/tsdb/tsdbUtil2.c
index fe9d71fcc6..d8e93cbe7c 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUtil2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbUtil2.c
@@ -17,39 +17,46 @@
// SDelBlock ----------
int32_t tTombBlockInit(STombBlock *tombBlock) {
+ tombBlock->numOfRecords = 0;
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
- TARRAY2_INIT(&tombBlock->dataArr[i]);
+ tBufferInit(&tombBlock->buffers[i]);
}
return 0;
}
int32_t tTombBlockDestroy(STombBlock *tombBlock) {
+ tombBlock->numOfRecords = 0;
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
- TARRAY2_DESTROY(&tombBlock->dataArr[i], NULL);
+ tBufferDestroy(&tombBlock->buffers[i]);
}
return 0;
}
int32_t tTombBlockClear(STombBlock *tombBlock) {
+ tombBlock->numOfRecords = 0;
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
- TARRAY2_CLEAR(&tombBlock->dataArr[i], NULL);
+ tBufferClear(&tombBlock->buffers[i]);
}
return 0;
}
int32_t tTombBlockPut(STombBlock *tombBlock, const STombRecord *record) {
- int32_t code;
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
- code = TARRAY2_APPEND(&tombBlock->dataArr[i], record->dataArr[i]);
+ int32_t code = tBufferPutI64(&tombBlock->buffers[i], record->data[i]);
if (code) return code;
}
+ tombBlock->numOfRecords++;
return 0;
}
int32_t tTombBlockGet(STombBlock *tombBlock, int32_t idx, STombRecord *record) {
- if (idx >= TOMB_BLOCK_SIZE(tombBlock)) return TSDB_CODE_OUT_OF_RANGE;
+ if (idx < 0 || idx >= tombBlock->numOfRecords) {
+ return TSDB_CODE_OUT_OF_RANGE;
+ }
+
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
- record->dataArr[i] = TARRAY2_GET(&tombBlock->dataArr[i], idx);
+ SBufferReader br = BUFFER_READER_INITIALIZER(sizeof(int64_t) * idx, &tombBlock->buffers[i]);
+ tBufferGetI64(&br, &record->data[i]);
}
return 0;
}
@@ -66,95 +73,374 @@ int32_t tTombRecordCompare(const STombRecord *r1, const STombRecord *r2) {
// STbStatisBlock ----------
int32_t tStatisBlockInit(STbStatisBlock *statisBlock) {
- for (int32_t i = 0; i < STATIS_RECORD_NUM_ELEM; ++i) {
- TARRAY2_INIT(&statisBlock->dataArr[i]);
+ statisBlock->numOfPKs = 0;
+ statisBlock->numOfRecords = 0;
+ for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
+ tBufferInit(&statisBlock->buffers[i]);
+ }
+ for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
+ tValueColumnInit(&statisBlock->firstKeyPKs[i]);
+ tValueColumnInit(&statisBlock->lastKeyPKs[i]);
}
return 0;
}
int32_t tStatisBlockDestroy(STbStatisBlock *statisBlock) {
- for (int32_t i = 0; i < STATIS_RECORD_NUM_ELEM; ++i) {
- TARRAY2_DESTROY(&statisBlock->dataArr[i], NULL);
+ statisBlock->numOfPKs = 0;
+ statisBlock->numOfRecords = 0;
+ for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
+ tBufferDestroy(&statisBlock->buffers[i]);
+ }
+ for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
+ tValueColumnDestroy(&statisBlock->firstKeyPKs[i]);
+ tValueColumnDestroy(&statisBlock->lastKeyPKs[i]);
}
return 0;
}
int32_t tStatisBlockClear(STbStatisBlock *statisBlock) {
- for (int32_t i = 0; i < STATIS_RECORD_NUM_ELEM; ++i) {
- TARRAY2_CLEAR(&statisBlock->dataArr[i], NULL);
+ statisBlock->numOfPKs = 0;
+ statisBlock->numOfRecords = 0;
+ for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
+ tBufferClear(&statisBlock->buffers[i]);
+ }
+ for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
+ tValueColumnClear(&statisBlock->firstKeyPKs[i]);
+ tValueColumnClear(&statisBlock->lastKeyPKs[i]);
}
return 0;
}
-int32_t tStatisBlockPut(STbStatisBlock *statisBlock, const STbStatisRecord *record) {
- int32_t code;
- for (int32_t i = 0; i < STATIS_RECORD_NUM_ELEM; ++i) {
- code = TARRAY2_APPEND(&statisBlock->dataArr[i], record->dataArr[i]);
- if (code) return code;
+static int32_t tStatisBlockAppend(STbStatisBlock *block, SRowInfo *row) {
+ int32_t code;
+ STsdbRowKey key;
+
+ tsdbRowGetKey(&row->row, &key);
+ if (block->numOfRecords == 0) {
+ block->numOfPKs = key.key.numOfPKs;
+ } else if (block->numOfPKs != key.key.numOfPKs) {
+ return TSDB_CODE_INVALID_PARA;
+ } else {
+ for (int i = 0; i < block->numOfPKs; i++) {
+ if (key.key.pks[i].type != block->firstKeyPKs[i].type) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+ }
}
+
+ if ((code = tBufferPutI64(&block->suids, row->suid))) return code;
+ if ((code = tBufferPutI64(&block->uids, row->uid))) return code;
+ if ((code = tBufferPutI64(&block->firstKeyTimestamps, key.key.ts))) return code;
+ if ((code = tBufferPutI64(&block->lastKeyTimestamps, key.key.ts))) return code;
+ if ((code = tBufferPutI64(&block->counts, 1))) return code;
+ for (int32_t i = 0; i < block->numOfPKs; ++i) {
+ if ((code = tValueColumnAppend(block->firstKeyPKs + i, key.key.pks + i))) return code;
+ if ((code = tValueColumnAppend(block->lastKeyPKs + i, key.key.pks + i))) return code;
+ }
+
+ block->numOfRecords++;
return 0;
}
+static int32_t tStatisBlockUpdate(STbStatisBlock *block, SRowInfo *row) {
+ STbStatisRecord record;
+ STsdbRowKey key;
+ int32_t c;
+ int32_t code;
+
+ tStatisBlockGet(block, block->numOfRecords - 1, &record);
+ tsdbRowGetKey(&row->row, &key);
+
+ c = tRowKeyCompare(&record.lastKey, &key.key);
+ if (c == 0) {
+ return 0;
+ } else if (c < 0) {
+ // last ts
+ code = tBufferPutAt(&block->lastKeyTimestamps, (block->numOfRecords - 1) * sizeof(record.lastKey.ts), &key.key.ts,
+ sizeof(key.key.ts));
+ if (code) return code;
+
+ // last primary keys
+ for (int i = 0; i < block->numOfPKs; i++) {
+ code = tValueColumnUpdate(&block->lastKeyPKs[i], block->numOfRecords - 1, &key.key.pks[i]);
+ if (code) return code;
+ }
+
+ // count
+ record.count++;
+ code = tBufferPutAt(&block->counts, (block->numOfRecords - 1) * sizeof(record.count), &record.count,
+ sizeof(record.count));
+ if (code) return code;
+ } else {
+ ASSERT(0);
+ }
+
+ return 0;
+}
+
+int32_t tStatisBlockPut(STbStatisBlock *block, SRowInfo *row, int32_t maxRecords) {
+ if (block->numOfRecords > 0) {
+ int64_t lastUid;
+ SBufferReader br = BUFFER_READER_INITIALIZER(sizeof(int64_t) * (block->numOfRecords - 1), &block->uids);
+ tBufferGetI64(&br, &lastUid);
+
+ if (lastUid == row->uid) {
+ return tStatisBlockUpdate(block, row);
+ } else if (block->numOfRecords >= maxRecords) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+ }
+ return tStatisBlockAppend(block, row);
+}
+
int32_t tStatisBlockGet(STbStatisBlock *statisBlock, int32_t idx, STbStatisRecord *record) {
- if (idx >= STATIS_BLOCK_SIZE(statisBlock)) return TSDB_CODE_OUT_OF_RANGE;
- for (int32_t i = 0; i < STATIS_RECORD_NUM_ELEM; ++i) {
- record->dataArr[i] = TARRAY2_GET(&statisBlock->dataArr[i], idx);
+ int32_t code;
+ SBufferReader reader;
+
+ if (idx < 0 || idx >= statisBlock->numOfRecords) {
+ return TSDB_CODE_OUT_OF_RANGE;
}
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(record->suid), &statisBlock->suids);
+ code = tBufferGetI64(&reader, &record->suid);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(record->uid), &statisBlock->uids);
+ code = tBufferGetI64(&reader, &record->uid);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(record->firstKey.ts), &statisBlock->firstKeyTimestamps);
+ code = tBufferGetI64(&reader, &record->firstKey.ts);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(record->lastKey.ts), &statisBlock->lastKeyTimestamps);
+ code = tBufferGetI64(&reader, &record->lastKey.ts);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(record->count), &statisBlock->counts);
+ code = tBufferGetI64(&reader, &record->count);
+ if (code) return code;
+
+ // primary keys
+ for (record->firstKey.numOfPKs = 0; record->firstKey.numOfPKs < statisBlock->numOfPKs; record->firstKey.numOfPKs++) {
+ code = tValueColumnGet(&statisBlock->firstKeyPKs[record->firstKey.numOfPKs], idx,
+ &record->firstKey.pks[record->firstKey.numOfPKs]);
+ if (code) return code;
+ }
+
+ for (record->lastKey.numOfPKs = 0; record->lastKey.numOfPKs < statisBlock->numOfPKs; record->lastKey.numOfPKs++) {
+ code = tValueColumnGet(&statisBlock->lastKeyPKs[record->lastKey.numOfPKs], idx,
+ &record->lastKey.pks[record->lastKey.numOfPKs]);
+ if (code) return code;
+ }
+
return 0;
}
// SBrinRecord ----------
int32_t tBrinBlockInit(SBrinBlock *brinBlock) {
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr1); ++i) {
- TARRAY2_INIT(&brinBlock->dataArr1[i]);
+ brinBlock->numOfPKs = 0;
+ brinBlock->numOfRecords = 0;
+ for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
+ tBufferInit(&brinBlock->buffers[i]);
}
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr2); ++i) {
- TARRAY2_INIT(&brinBlock->dataArr2[i]);
+ for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
+ tValueColumnInit(&brinBlock->firstKeyPKs[i]);
+ tValueColumnInit(&brinBlock->lastKeyPKs[i]);
}
return 0;
}
int32_t tBrinBlockDestroy(SBrinBlock *brinBlock) {
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr1); ++i) {
- TARRAY2_DESTROY(&brinBlock->dataArr1[i], NULL);
+ brinBlock->numOfPKs = 0;
+ brinBlock->numOfRecords = 0;
+ for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
+ tBufferDestroy(&brinBlock->buffers[i]);
}
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr2); ++i) {
- TARRAY2_DESTROY(&brinBlock->dataArr2[i], NULL);
+ for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
+ tValueColumnDestroy(&brinBlock->firstKeyPKs[i]);
+ tValueColumnDestroy(&brinBlock->lastKeyPKs[i]);
}
return 0;
}
int32_t tBrinBlockClear(SBrinBlock *brinBlock) {
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr1); ++i) {
- TARRAY2_CLEAR(&brinBlock->dataArr1[i], NULL);
+ brinBlock->numOfPKs = 0;
+ brinBlock->numOfRecords = 0;
+ for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
+ tBufferClear(&brinBlock->buffers[i]);
}
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr2); ++i) {
- TARRAY2_CLEAR(&brinBlock->dataArr2[i], NULL);
+ for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
+ tValueColumnClear(&brinBlock->firstKeyPKs[i]);
+ tValueColumnClear(&brinBlock->lastKeyPKs[i]);
}
return 0;
}
int32_t tBrinBlockPut(SBrinBlock *brinBlock, const SBrinRecord *record) {
int32_t code;
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr1); ++i) {
- code = TARRAY2_APPEND(&brinBlock->dataArr1[i], record->dataArr1[i]);
- if (code) return code;
+
+ ASSERT(record->firstKey.key.numOfPKs == record->lastKey.key.numOfPKs);
+
+ if (brinBlock->numOfRecords == 0) { // the first row
+ brinBlock->numOfPKs = record->firstKey.key.numOfPKs;
+ } else if (brinBlock->numOfPKs != record->firstKey.key.numOfPKs) {
+ // if the number of primary keys are not the same,
+ // return an error code and the caller should handle it
+ return TSDB_CODE_INVALID_PARA;
+ } else {
+ for (int i = 0; i < brinBlock->numOfPKs; i++) {
+ if (record->firstKey.key.pks[i].type != brinBlock->firstKeyPKs[i].type) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+ }
}
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr2); ++i) {
- code = TARRAY2_APPEND(&brinBlock->dataArr2[i], record->dataArr2[i]);
- if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->suids, record->suid);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->uids, record->uid);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->firstKeyTimestamps, record->firstKey.key.ts);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->firstKeyVersions, record->firstKey.version);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->lastKeyTimestamps, record->lastKey.key.ts);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->lastKeyVersions, record->lastKey.version);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->minVers, record->minVer);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->maxVers, record->maxVer);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->blockOffsets, record->blockOffset);
+ if (code) return code;
+
+ code = tBufferPutI64(&brinBlock->smaOffsets, record->smaOffset);
+ if (code) return code;
+
+ code = tBufferPutI32(&brinBlock->blockSizes, record->blockSize);
+ if (code) return code;
+
+ code = tBufferPutI32(&brinBlock->blockKeySizes, record->blockKeySize);
+ if (code) return code;
+
+ code = tBufferPutI32(&brinBlock->smaSizes, record->smaSize);
+ if (code) return code;
+
+ code = tBufferPutI32(&brinBlock->numRows, record->numRow);
+ if (code) return code;
+
+ code = tBufferPutI32(&brinBlock->counts, record->count);
+ if (code) return code;
+
+ if (brinBlock->numOfPKs > 0) {
+ for (int32_t i = 0; i < brinBlock->numOfPKs; ++i) {
+ code = tValueColumnAppend(&brinBlock->firstKeyPKs[i], &record->firstKey.key.pks[i]);
+ if (code) return code;
+ }
+
+ for (int32_t i = 0; i < brinBlock->numOfPKs; ++i) {
+ code = tValueColumnAppend(&brinBlock->lastKeyPKs[i], &record->lastKey.key.pks[i]);
+ if (code) return code;
+ }
}
+
+ brinBlock->numOfRecords++;
+
return 0;
}
int32_t tBrinBlockGet(SBrinBlock *brinBlock, int32_t idx, SBrinRecord *record) {
- if (idx >= BRIN_BLOCK_SIZE(brinBlock)) return TSDB_CODE_OUT_OF_RANGE;
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr1); ++i) {
- record->dataArr1[i] = TARRAY2_GET(&brinBlock->dataArr1[i], idx);
+ int32_t code;
+ SBufferReader reader;
+
+ if (idx < 0 || idx >= brinBlock->numOfRecords) {
+ return TSDB_CODE_OUT_OF_RANGE;
}
- for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->dataArr2); ++i) {
- record->dataArr2[i] = TARRAY2_GET(&brinBlock->dataArr2[i], idx);
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->suids);
+ code = tBufferGetI64(&reader, &record->suid);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->uids);
+ code = tBufferGetI64(&reader, &record->uid);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->firstKeyTimestamps);
+ code = tBufferGetI64(&reader, &record->firstKey.key.ts);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->firstKeyVersions);
+ code = tBufferGetI64(&reader, &record->firstKey.version);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->lastKeyTimestamps);
+ code = tBufferGetI64(&reader, &record->lastKey.key.ts);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->lastKeyVersions);
+ code = tBufferGetI64(&reader, &record->lastKey.version);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->minVers);
+ code = tBufferGetI64(&reader, &record->minVer);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->maxVers);
+ code = tBufferGetI64(&reader, &record->maxVer);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->blockOffsets);
+ code = tBufferGetI64(&reader, &record->blockOffset);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int64_t), &brinBlock->smaOffsets);
+ code = tBufferGetI64(&reader, &record->smaOffset);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int32_t), &brinBlock->blockSizes);
+ code = tBufferGetI32(&reader, &record->blockSize);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int32_t), &brinBlock->blockKeySizes);
+ code = tBufferGetI32(&reader, &record->blockKeySize);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int32_t), &brinBlock->smaSizes);
+ code = tBufferGetI32(&reader, &record->smaSize);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int32_t), &brinBlock->numRows);
+ code = tBufferGetI32(&reader, &record->numRow);
+ if (code) return code;
+
+ reader = BUFFER_READER_INITIALIZER(idx * sizeof(int32_t), &brinBlock->counts);
+ code = tBufferGetI32(&reader, &record->count);
+ if (code) return code;
+
+ // primary keys
+ for (record->firstKey.key.numOfPKs = 0; record->firstKey.key.numOfPKs < brinBlock->numOfPKs;
+ record->firstKey.key.numOfPKs++) {
+ code = tValueColumnGet(&brinBlock->firstKeyPKs[record->firstKey.key.numOfPKs], idx,
+ &record->firstKey.key.pks[record->firstKey.key.numOfPKs]);
+ if (code) return code;
}
+
+ for (record->lastKey.key.numOfPKs = 0; record->lastKey.key.numOfPKs < brinBlock->numOfPKs;
+ record->lastKey.key.numOfPKs++) {
+ code = tValueColumnGet(&brinBlock->lastKeyPKs[record->lastKey.key.numOfPKs], idx,
+ &record->lastKey.key.pks[record->lastKey.key.numOfPKs]);
+ if (code) return code;
+ }
+
return 0;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil2.h b/source/dnode/vnode/src/tsdb/tsdbUtil2.h
index fa06368341..71f47a5f8e 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUtil2.h
+++ b/source/dnode/vnode/src/tsdb/tsdbUtil2.h
@@ -25,7 +25,7 @@ extern "C" {
// STombRecord ----------
#define TOMB_RECORD_ELEM_NUM 5
typedef union {
- int64_t dataArr[TOMB_RECORD_ELEM_NUM];
+ int64_t data[TOMB_RECORD_ELEM_NUM];
struct {
int64_t suid;
int64_t uid;
@@ -35,14 +35,17 @@ typedef union {
};
} STombRecord;
-typedef union {
- TARRAY2(int64_t) dataArr[TOMB_RECORD_ELEM_NUM];
- struct {
- TARRAY2(int64_t) suid[1];
- TARRAY2(int64_t) uid[1];
- TARRAY2(int64_t) version[1];
- TARRAY2(int64_t) skey[1];
- TARRAY2(int64_t) ekey[1];
+typedef struct {
+ int32_t numOfRecords;
+ union {
+ SBuffer buffers[TOMB_RECORD_ELEM_NUM];
+ struct {
+ SBuffer suids;
+ SBuffer uids;
+ SBuffer versions;
+ SBuffer skeys;
+ SBuffer ekeys;
+ };
};
} STombBlock;
@@ -60,7 +63,7 @@ typedef struct {
typedef TARRAY2(STombBlk) TTombBlkArray;
-#define TOMB_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
+#define TOMB_BLOCK_SIZE(db) ((db)->numOfRecords)
int32_t tTombBlockInit(STombBlock *tombBlock);
int32_t tTombBlockDestroy(STombBlock *tombBlock);
@@ -70,27 +73,29 @@ int32_t tTombBlockGet(STombBlock *tombBlock, int32_t idx, STombRecord *record);
int32_t tTombRecordCompare(const STombRecord *record1, const STombRecord *record2);
// STbStatisRecord ----------
-#define STATIS_RECORD_NUM_ELEM 5
-typedef union {
- int64_t dataArr[STATIS_RECORD_NUM_ELEM];
- struct {
- int64_t suid;
- int64_t uid;
- int64_t firstKey;
- int64_t lastKey;
- int64_t count;
- };
+typedef struct {
+ int64_t suid;
+ int64_t uid;
+ SRowKey firstKey;
+ SRowKey lastKey;
+ int64_t count;
} STbStatisRecord;
-typedef union {
- TARRAY2(int64_t) dataArr[STATIS_RECORD_NUM_ELEM];
- struct {
- TARRAY2(int64_t) suid[1];
- TARRAY2(int64_t) uid[1];
- TARRAY2(int64_t) firstKey[1];
- TARRAY2(int64_t) lastKey[1];
- TARRAY2(int64_t) count[1];
+typedef struct {
+ int8_t numOfPKs;
+ int32_t numOfRecords;
+ union {
+ SBuffer buffers[5];
+ struct {
+ SBuffer suids; // int64_t
+ SBuffer uids; // int64_t
+ SBuffer firstKeyTimestamps; // int64_t
+ SBuffer lastKeyTimestamps; // int64_t
+ SBuffer counts; // int64_t
+ };
};
+ SValueColumn firstKeyPKs[TD_MAX_PK_COLS];
+ SValueColumn lastKeyPKs[TD_MAX_PK_COLS];
} STbStatisBlock;
typedef struct {
@@ -98,66 +103,62 @@ typedef struct {
TABLEID minTbid;
TABLEID maxTbid;
int32_t numRec;
- int32_t size[STATIS_RECORD_NUM_ELEM];
+ int32_t size[5];
int8_t cmprAlg;
- int8_t rsvd[7];
+ int8_t numOfPKs; // number of primary keys
+ int8_t rsvd[6];
} SStatisBlk;
-#define STATIS_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
+#define STATIS_BLOCK_SIZE(db) ((db)->numOfRecords)
int32_t tStatisBlockInit(STbStatisBlock *statisBlock);
int32_t tStatisBlockDestroy(STbStatisBlock *statisBlock);
int32_t tStatisBlockClear(STbStatisBlock *statisBlock);
-int32_t tStatisBlockPut(STbStatisBlock *statisBlock, const STbStatisRecord *record);
+int32_t tStatisBlockPut(STbStatisBlock *statisBlock, SRowInfo *row, int32_t maxRecords);
int32_t tStatisBlockGet(STbStatisBlock *statisBlock, int32_t idx, STbStatisRecord *record);
// SBrinRecord ----------
-typedef union {
- struct {
- int64_t dataArr1[10];
- int32_t dataArr2[5];
- };
- struct {
- int64_t suid;
- int64_t uid;
- int64_t firstKey;
- int64_t firstKeyVer;
- int64_t lastKey;
- int64_t lastKeyVer;
- int64_t minVer;
- int64_t maxVer;
- int64_t blockOffset;
- int64_t smaOffset;
- int32_t blockSize;
- int32_t blockKeySize;
- int32_t smaSize;
- int32_t numRow;
- int32_t count;
- };
+typedef struct {
+ int64_t suid;
+ int64_t uid;
+ STsdbRowKey firstKey;
+ STsdbRowKey lastKey;
+ int64_t minVer;
+ int64_t maxVer;
+ int64_t blockOffset;
+ int64_t smaOffset;
+ int32_t blockSize;
+ int32_t blockKeySize;
+ int32_t smaSize;
+ int32_t numRow;
+ int32_t count;
} SBrinRecord;
-typedef union {
- struct {
- TARRAY2(int64_t) dataArr1[10];
- TARRAY2(int32_t) dataArr2[5];
- };
- struct {
- TARRAY2(int64_t) suid[1];
- TARRAY2(int64_t) uid[1];
- TARRAY2(int64_t) firstKey[1];
- TARRAY2(int64_t) firstKeyVer[1];
- TARRAY2(int64_t) lastKey[1];
- TARRAY2(int64_t) lastKeyVer[1];
- TARRAY2(int64_t) minVer[1];
- TARRAY2(int64_t) maxVer[1];
- TARRAY2(int64_t) blockOffset[1];
- TARRAY2(int64_t) smaOffset[1];
- TARRAY2(int32_t) blockSize[1];
- TARRAY2(int32_t) blockKeySize[1];
- TARRAY2(int32_t) smaSize[1];
- TARRAY2(int32_t) numRow[1];
- TARRAY2(int32_t) count[1];
+typedef struct {
+ int8_t numOfPKs;
+ int32_t numOfRecords;
+ union {
+ SBuffer buffers[15];
+ struct {
+ SBuffer suids; // int64_t
+ SBuffer uids; // int64_t
+ SBuffer firstKeyTimestamps; // int64_t
+ SBuffer firstKeyVersions; // int64_t
+ SBuffer lastKeyTimestamps; // int64_t
+ SBuffer lastKeyVersions; // int64_t
+ SBuffer minVers; // int64_t
+ SBuffer maxVers; // int64_t
+ SBuffer blockOffsets; // int64_t
+ SBuffer smaOffsets; // int64_t
+ SBuffer blockSizes; // int32_t
+ SBuffer blockKeySizes; // int32_t
+ SBuffer smaSizes; // int32_t
+ SBuffer numRows; // int32_t
+ SBuffer counts; // int32_t
+ };
};
+ SValueColumn firstKeyPKs[TD_MAX_PK_COLS];
+ SValueColumn lastKeyPKs[TD_MAX_PK_COLS];
} SBrinBlock;
typedef struct {
@@ -169,12 +170,13 @@ typedef struct {
int32_t numRec;
int32_t size[15];
int8_t cmprAlg;
- int8_t rsvd[7];
+ int8_t numOfPKs; // number of primary keys
+ int8_t rsvd[6];
} SBrinBlk;
typedef TARRAY2(SBrinBlk) TBrinBlkArray;
-#define BRIN_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
+#define BRIN_BLOCK_SIZE(db) ((db)->numOfRecords)
int32_t tBrinBlockInit(SBrinBlock *brinBlock);
int32_t tBrinBlockDestroy(SBrinBlock *brinBlock);
diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c
index aff7e4642b..16abe69def 100644
--- a/source/dnode/vnode/src/vnd/vnodeInitApi.c
+++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c
@@ -128,12 +128,12 @@ void initTqAPI(SStoreTqReader* pTq) {
pTq->tqReaderCurrentBlockConsumed = tqCurrentBlockConsumed;
pTq->tqReaderGetWalReader = tqGetWalReader; // todo remove it
- pTq->tqReaderRetrieveTaosXBlock = tqRetrieveTaosxBlock; // todo remove it
+// pTq->tqReaderRetrieveTaosXBlock = tqRetrieveTaosxBlock; // todo remove it
pTq->tqReaderSetSubmitMsg = tqReaderSetSubmitMsg; // todo remove it
pTq->tqGetResultBlock = tqGetResultBlock;
- pTq->tqReaderNextBlockFilterOut = tqNextDataBlockFilterOut;
+// pTq->tqReaderNextBlockFilterOut = tqNextDataBlockFilterOut;
pTq->tqGetResultBlockTime = tqGetResultBlockTime;
pTq->tqGetStreamExecProgress = tqGetStreamExecInfo;
diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c
index 5f4b7b8442..f9f2ae6b21 100644
--- a/source/dnode/vnode/src/vnd/vnodeSync.c
+++ b/source/dnode/vnode/src/vnd/vnodeSync.c
@@ -372,8 +372,8 @@ int32_t vnodeProcessSyncMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
int32_t code = syncProcessMsg(pVnode->sync, pMsg);
if (code != 0) {
- vGError("vgId:%d, failed to process sync msg:%p type:%s since %s", pVnode->config.vgId, pMsg,
- TMSG_INFO(pMsg->msgType), terrstr());
+ vGError("vgId:%d, failed to process sync msg:%p type:%s, errno: %s, code:0x%x", pVnode->config.vgId, pMsg,
+ TMSG_INFO(pMsg->msgType), terrstr(), code);
}
return code;
diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h
index a280fd6e9b..98e96bb250 100644
--- a/source/libs/executor/inc/executorInt.h
+++ b/source/libs/executor/inc/executorInt.h
@@ -352,6 +352,8 @@ typedef struct STableMergeScanInfo {
SSDataBlock* nextDurationBlocks[2];
bool rtnNextDurationBlocks;
int32_t nextDurationBlocksIdx;
+
+ bool bSortRowId;
STmsSubTablesMergeInfo* pSubTablesMergeInfo;
} STableMergeScanInfo;
diff --git a/source/libs/executor/inc/tsort.h b/source/libs/executor/inc/tsort.h
index 436d1cefb8..ca799673ea 100644
--- a/source/libs/executor/inc/tsort.h
+++ b/source/libs/executor/inc/tsort.h
@@ -194,6 +194,9 @@ void tsortSetClosed(SSortHandle* pHandle);
void tsortSetSingleTableMerge(SSortHandle* pHandle);
void tsortSetAbortCheckFn(SSortHandle* pHandle, bool (*checkFn)(void* param), void* param);
+int32_t tsortSetSortByRowId(SSortHandle* pHandle, int32_t extRowsSize);
+
+void tsortAppendTupleToBlock(SSortHandle* pHandle, SSDataBlock* pBlock, STupleHandle* pTupleHandle);
/**
* @brief comp the tuple with keyBuf, if not equal, new keys will be built in keyBuf, newLen will be stored in keyLen
* @param [in] pSortCols cols to comp and build
diff --git a/source/libs/executor/src/countwindowoperator.c b/source/libs/executor/src/countwindowoperator.c
index 1d2a55fac8..1f38264644 100644
--- a/source/libs/executor/src/countwindowoperator.c
+++ b/source/libs/executor/src/countwindowoperator.c
@@ -94,10 +94,10 @@ int32_t doCountWindowAggImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
int32_t code = TSDB_CODE_SUCCESS;
for (int32_t i = 0; i < pBlock->info.rows;) {
- int32_t step = pInfo->windowSliding;
SCountWindowResult* pBuffInfo = setCountWindowOutputBuff(pExprSup, &pInfo->countSup, &pInfo->pRow);
int32_t prevRows = pBuffInfo->winRows;
int32_t num = updateCountWindowInfo(i, pBlock->info.rows, pInfo->windowCount, &pBuffInfo->winRows);
+ int32_t step = num;
if (prevRows == 0) {
pInfo->pRow->win.skey = tsCols[i];
}
@@ -118,6 +118,8 @@ int32_t doCountWindowAggImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
if (prevRows <= pInfo->windowSliding) {
if (pBuffInfo->winRows > pInfo->windowSliding) {
step = pInfo->windowSliding - prevRows;
+ } else {
+ step = pInfo->windowSliding;
}
} else {
step = 0;
diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c
index 00b58263e2..88fb60fc4c 100644
--- a/source/libs/executor/src/dataInserter.c
+++ b/source/libs/executor/src/dataInserter.c
@@ -220,9 +220,10 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
taosArrayPush(pVals, &cv);
} else {
- void* data = colDataGetVarData(pColInfoData, j);
- SValue sv = (SValue){.nData = varDataLen(data), .pData = varDataVal(data)}; // address copy, no value
- SColVal cv = COL_VAL_VALUE(pCol->colId, pCol->type, sv);
+ void* data = colDataGetVarData(pColInfoData, j);
+ SValue sv = (SValue){
+ .type = pCol->type, .nData = varDataLen(data), .pData = varDataVal(data)}; // address copy, no value
+ SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
taosArrayPush(pVals, &cv);
}
break;
@@ -243,7 +244,7 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp
terrno = TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL;
goto _end;
}
-
+
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); // should use pCol->type
taosArrayPush(pVals, &cv);
} else {
@@ -257,9 +258,9 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp
}
}
- SValue sv;
+ SValue sv = {.type = pCol->type};
memcpy(&sv.val, var, tDataTypes[pCol->type].bytes);
- SColVal cv = COL_VAL_VALUE(pCol->colId, pCol->type, sv);
+ SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
taosArrayPush(pVals, &cv);
}
} else {
@@ -288,7 +289,7 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp
if (disorderTs) {
if ((tRowSort(tbData.aRowP) != TSDB_CODE_SUCCESS) ||
- (terrno = tRowMerge(tbData.aRowP, (STSchema*)pTSchema, 0)) != 0) {
+ (terrno = tRowMerge(tbData.aRowP, (STSchema*)pTSchema, 0)) != 0) {
goto _end;
}
}
@@ -393,7 +394,7 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
taosMemoryFree(pInserter->pParam);
taosHashCleanup(pInserter->pCols);
taosThreadMutexDestroy(&pInserter->mutex);
-
+
taosMemoryFree(pInserter->pManager);
return TSDB_CODE_SUCCESS;
}
@@ -475,6 +476,6 @@ _return:
} else {
taosMemoryFree(pManager);
}
-
- return terrno;
+
+ return terrno;
}
diff --git a/source/libs/executor/src/dynqueryctrloperator.c b/source/libs/executor/src/dynqueryctrloperator.c
index 9e7f1144f8..e7c9c17a0b 100755
--- a/source/libs/executor/src/dynqueryctrloperator.c
+++ b/source/libs/executor/src/dynqueryctrloperator.c
@@ -456,7 +456,8 @@ static int32_t buildSeqStbJoinOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SS
code = pInfo->stbJoin.basic.srcScan[1] ? buildSingleTableScanOperatorParam(&pSrcParam1, 1, rightVg, rightUid) : buildExchangeOperatorParam(&pSrcParam1, 1, rightVg, rightUid);
}
}
-
+
+ bool initParam = pSrcParam0 ? true : false;
if (TSDB_CODE_SUCCESS == code) {
code = buildGroupCacheOperatorParam(&pGcParam0, 0, *leftVg, *leftUid, pPost->leftNeedCache, pSrcParam0);
pSrcParam0 = NULL;
@@ -466,7 +467,7 @@ static int32_t buildSeqStbJoinOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SS
pSrcParam1 = NULL;
}
if (TSDB_CODE_SUCCESS == code) {
- code = buildMergeJoinOperatorParam(ppParam, pSrcParam0 ? true : false, pGcParam0, pGcParam1);
+ code = buildMergeJoinOperatorParam(ppParam, initParam, pGcParam0, pGcParam1);
}
if (TSDB_CODE_SUCCESS != code) {
if (pSrcParam0) {
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index 2534c5e9f0..831fd4e883 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -1009,6 +1009,22 @@ int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) {
pSup->deleteMark = INT64_MAX;
pInfo->ignoreExpiredDataSaved = pInfo->ignoreExpiredData;
pInfo->ignoreExpiredData = false;
+ } else if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT) {
+ SStreamCountAggOperatorInfo* pInfo = pOperator->info;
+ STimeWindowAggSupp* pSup = &pInfo->twAggSup;
+
+ ASSERT(pSup->calTrigger == STREAM_TRIGGER_AT_ONCE || pSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);
+ ASSERT(pSup->calTriggerSaved == 0 && pSup->deleteMarkSaved == 0);
+
+ qInfo("save stream param for state: %d, %" PRId64, pSup->calTrigger, pSup->deleteMark);
+
+ pSup->calTriggerSaved = pSup->calTrigger;
+ pSup->deleteMarkSaved = pSup->deleteMark;
+ pSup->calTrigger = STREAM_TRIGGER_AT_ONCE;
+ pSup->deleteMark = INT64_MAX;
+ pInfo->ignoreExpiredDataSaved = pInfo->ignoreExpiredData;
+ pInfo->ignoreExpiredData = false;
+ qInfo("save stream task:%s, param for state: %d", GET_TASKID(pTaskInfo), pInfo->ignoreExpiredData);
}
// iterate operator tree
diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c
index ecc2526dd9..e1aa75d828 100644
--- a/source/libs/executor/src/filloperator.c
+++ b/source/libs/executor/src/filloperator.c
@@ -32,12 +32,6 @@
#include "operator.h"
#include "querytask.h"
-
-#define FILL_POS_INVALID 0
-#define FILL_POS_START 1
-#define FILL_POS_MID 2
-#define FILL_POS_END 3
-
typedef struct STimeRange {
TSKEY skey;
TSKEY ekey;
@@ -474,1139 +468,3 @@ _error:
taosMemoryFreeClear(pOperator);
return NULL;
}
-
-TSKEY getNextWindowTs(TSKEY ts, SInterval* pInterval) {
- STimeWindow win = {.skey = ts, .ekey = ts};
- getNextTimeWindow(pInterval, &win, TSDB_ORDER_ASC);
- return win.skey;
-}
-
-TSKEY getPrevWindowTs(TSKEY ts, SInterval* pInterval) {
- STimeWindow win = {.skey = ts, .ekey = ts};
- getNextTimeWindow(pInterval, &win, TSDB_ORDER_DESC);
- return win.skey;
-}
-
-void setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell) {
- colDataSetVal(pCol, rowId, pCell->pData, pCell->isNull);
-}
-
-SResultCellData* getResultCell(SResultRowData* pRaw, int32_t index) {
- if (!pRaw || !pRaw->pRowVal) {
- return NULL;
- }
- char* pData = (char*)pRaw->pRowVal;
- SResultCellData* pCell = pRaw->pRowVal;
- for (int32_t i = 0; i < index; i++) {
- pData += (pCell->bytes + sizeof(SResultCellData));
- pCell = (SResultCellData*)pData;
- }
- return pCell;
-}
-
-void* destroyFillColumnInfo(SFillColInfo* pFillCol, int32_t start, int32_t end) {
- for (int32_t i = start; i < end; i++) {
- destroyExprInfo(pFillCol[i].pExpr, 1);
- taosVariantDestroy(&pFillCol[i].fillVal);
- }
- taosMemoryFreeClear(pFillCol[start].pExpr);
- taosMemoryFree(pFillCol);
- return NULL;
-}
-
-void* destroyStreamFillSupporter(SStreamFillSupporter* pFillSup) {
- pFillSup->pAllColInfo = destroyFillColumnInfo(pFillSup->pAllColInfo, pFillSup->numOfFillCols, pFillSup->numOfAllCols);
- tSimpleHashCleanup(pFillSup->pResMap);
- pFillSup->pResMap = NULL;
- cleanupExprSupp(&pFillSup->notFillExprSup);
- if (pFillSup->cur.pRowVal != pFillSup->prev.pRowVal && pFillSup->cur.pRowVal != pFillSup->next.pRowVal) {
- taosMemoryFree(pFillSup->cur.pRowVal);
- }
- taosMemoryFree(pFillSup->prev.pRowVal);
- taosMemoryFree(pFillSup->next.pRowVal);
- taosMemoryFree(pFillSup->nextNext.pRowVal);
-
- taosMemoryFree(pFillSup);
- return NULL;
-}
-
-void destroySPoint(void* ptr) {
- SPoint* point = (SPoint*) ptr;
- taosMemoryFreeClear(point->val);
-}
-
-void* destroyStreamFillLinearInfo(SStreamFillLinearInfo* pFillLinear) {
- taosArrayDestroyEx(pFillLinear->pEndPoints, destroySPoint);
- taosArrayDestroyEx(pFillLinear->pNextEndPoints, destroySPoint);
- taosMemoryFree(pFillLinear);
- return NULL;
-}
-void* destroyStreamFillInfo(SStreamFillInfo* pFillInfo) {
- if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F ||
- pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) {
- taosMemoryFreeClear(pFillInfo->pResRow->pRowVal);
- taosMemoryFreeClear(pFillInfo->pResRow);
- }
- pFillInfo->pLinearInfo = destroyStreamFillLinearInfo(pFillInfo->pLinearInfo);
- taosArrayDestroy(pFillInfo->delRanges);
- taosMemoryFree(pFillInfo);
- return NULL;
-}
-
-static void destroyStreamFillOperatorInfo(void* param) {
- SStreamFillOperatorInfo* pInfo = (SStreamFillOperatorInfo*)param;
- pInfo->pFillInfo = destroyStreamFillInfo(pInfo->pFillInfo);
- pInfo->pFillSup = destroyStreamFillSupporter(pInfo->pFillSup);
- pInfo->pRes = blockDataDestroy(pInfo->pRes);
- pInfo->pSrcBlock = blockDataDestroy(pInfo->pSrcBlock);
- pInfo->pDelRes = blockDataDestroy(pInfo->pDelRes);
- pInfo->matchInfo.pList = taosArrayDestroy(pInfo->matchInfo.pList);
- taosMemoryFree(pInfo);
-}
-
-static void resetFillWindow(SResultRowData* pRowData) {
- pRowData->key = INT64_MIN;
- taosMemoryFreeClear(pRowData->pRowVal);
-}
-
-void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup, void* pState, SStorageAPI* pAPI) {
- if (pFillSup->cur.pRowVal != pFillSup->prev.pRowVal && pFillSup->cur.pRowVal != pFillSup->next.pRowVal) {
- resetFillWindow(&pFillSup->cur);
- } else {
- pFillSup->cur.key = INT64_MIN;
- pFillSup->cur.pRowVal = NULL;
- }
- resetFillWindow(&pFillSup->prev);
- resetFillWindow(&pFillSup->next);
- resetFillWindow(&pFillSup->nextNext);
-}
-
-void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) {
- SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
-
- void* pState = pOperator->pTaskInfo->streamInfo.pState;
- resetPrevAndNextWindow(pFillSup, pState, pAPI);
-
- SWinKey key = {.ts = ts, .groupId = groupId};
- int32_t curVLen = 0;
-
- int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&pFillSup->cur.pRowVal, &curVLen);
- ASSERT(code == TSDB_CODE_SUCCESS);
- pFillSup->cur.key = key.ts;
-}
-
-void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) {
- SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
- void* pState = pOperator->pTaskInfo->streamInfo.pState;
- resetPrevAndNextWindow(pFillSup, pState, pAPI);
-
- SWinKey key = {.ts = ts, .groupId = groupId};
- void* curVal = NULL;
- int32_t curVLen = 0;
- int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&curVal, &curVLen);
- ASSERT(code == TSDB_CODE_SUCCESS);
- pFillSup->cur.key = key.ts;
- pFillSup->cur.pRowVal = curVal;
-
- SStreamStateCur* pCur = pAPI->stateStore.streamStateFillSeekKeyPrev(pState, &key);
- SWinKey preKey = {.ts = INT64_MIN, .groupId = groupId};
- void* preVal = NULL;
- int32_t preVLen = 0;
- code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &preKey, (const void**)&preVal, &preVLen);
-
- if (code == TSDB_CODE_SUCCESS) {
- pFillSup->prev.key = preKey.ts;
- pFillSup->prev.pRowVal = preVal;
-
- code = pAPI->stateStore.streamStateCurNext(pState, pCur);
- ASSERT(code == TSDB_CODE_SUCCESS);
-
- code = pAPI->stateStore.streamStateCurNext(pState, pCur);
- if (code != TSDB_CODE_SUCCESS) {
- pAPI->stateStore.streamStateFreeCur(pCur);
- pCur = NULL;
- }
- } else {
- pAPI->stateStore.streamStateFreeCur(pCur);
- pCur = pAPI->stateStore.streamStateFillSeekKeyNext(pState, &key);
- }
-
- SWinKey nextKey = {.ts = INT64_MIN, .groupId = groupId};
- void* nextVal = NULL;
- int32_t nextVLen = 0;
- code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextVLen);
- if (code == TSDB_CODE_SUCCESS) {
- pFillSup->next.key = nextKey.ts;
- pFillSup->next.pRowVal = nextVal;
- if (pFillSup->type == TSDB_FILL_PREV || pFillSup->type == TSDB_FILL_NEXT) {
- code = pAPI->stateStore.streamStateCurNext(pState, pCur);
- if (code == TSDB_CODE_SUCCESS) {
- SWinKey nextNextKey = {.groupId = groupId};
- void* nextNextVal = NULL;
- int32_t nextNextVLen = 0;
- code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextNextKey, (const void**)&nextNextVal, &nextNextVLen);
- if (code == TSDB_CODE_SUCCESS) {
- pFillSup->nextNext.key = nextNextKey.ts;
- pFillSup->nextNext.pRowVal = nextNextVal;
- }
- }
- }
- }
- pAPI->stateStore.streamStateFreeCur(pCur);
-}
-
-static bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; }
-static bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; }
-static bool hasNextNextWindow(SStreamFillSupporter* pFillSup) {
- return pFillSup->nextNext.key != INT64_MIN;
- return false;
-}
-
-static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) {
- int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
- for (int32_t i = 0; i < numOfCols; ++i) {
- SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
- SResultCellData* pCell = getResultCell(pRowVal, i);
- if (!colDataIsNull_s(pColData, rowId)) {
- pCell->isNull = false;
- pCell->type = pColData->info.type;
- pCell->bytes = pColData->info.bytes;
- char* val = colDataGetData(pColData, rowId);
- if (IS_VAR_DATA_TYPE(pCell->type)) {
- memcpy(pCell->pData, val, varDataTLen(val));
- } else {
- memcpy(pCell->pData, val, pCell->bytes);
- }
- } else {
- pCell->isNull = true;
- }
- }
- pRowVal->key = ts;
-}
-
-static void calcDeltaData(SSDataBlock* pBlock, int32_t rowId, SResultRowData* pRowVal, SArray* pDelta,
- SFillColInfo* pFillCol, int32_t numOfCol, int32_t winCount, int32_t order) {
- for (int32_t i = 0; i < numOfCol; i++) {
- if (!pFillCol[i].notFillCol) {
- int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i);
- SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
- char* var = colDataGetData(pCol, rowId);
- double start = 0;
- GET_TYPED_DATA(start, double, pCol->info.type, var);
- SResultCellData* pCell = getResultCell(pRowVal, slotId);
- double end = 0;
- GET_TYPED_DATA(end, double, pCell->type, pCell->pData);
- double delta = 0;
- if (order == TSDB_ORDER_ASC) {
- delta = (end - start) / winCount;
- } else {
- delta = (start - end) / winCount;
- }
- taosArraySet(pDelta, slotId, &delta);
- }
- }
-}
-
-static void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol,
- int32_t numOfCol) {
- for (int32_t i = 0; i < numOfCol; i++) {
- if (!pFillCol[i].notFillCol) {
- int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i);
- SResultCellData* pECell = getResultCell(pEndRow, slotId);
- SPoint* pPoint = taosArrayGet(pEndPoins, slotId);
- pPoint->key = pEndRow->key;
- memcpy(pPoint->val, pECell->pData, pECell->bytes);
- }
- }
-}
-
-static void setFillInfoStart(TSKEY ts, SInterval* pInterval, SStreamFillInfo* pFillInfo) {
- ts = taosTimeAdd(ts, pInterval->sliding, pInterval->slidingUnit, pInterval->precision);
- pFillInfo->start = ts;
-}
-
-static void setFillInfoEnd(TSKEY ts, SInterval* pInterval, SStreamFillInfo* pFillInfo) {
- ts = taosTimeAdd(ts, pInterval->sliding * -1, pInterval->slidingUnit, pInterval->precision);
- pFillInfo->end = ts;
-}
-
-static void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo) {
- setFillInfoStart(start, pInterval, pFillInfo);
- pFillInfo->current = pFillInfo->start;
- setFillInfoEnd(end, pInterval, pFillInfo);
-}
-
-void setDeleteFillValueInfo(TSKEY start, TSKEY end, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) {
- if (!hasPrevWindow(pFillSup) || !hasNextWindow(pFillSup)) {
- pFillInfo->needFill = false;
- return;
- }
-
- TSKEY realStart = taosTimeAdd(pFillSup->prev.key, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
- pFillSup->interval.precision);
-
- pFillInfo->needFill = true;
- pFillInfo->start = realStart;
- pFillInfo->current = pFillInfo->start;
- pFillInfo->end = end;
- pFillInfo->pos = FILL_POS_INVALID;
- switch (pFillInfo->type) {
- case TSDB_FILL_NULL:
- case TSDB_FILL_NULL_F:
- case TSDB_FILL_SET_VALUE:
- case TSDB_FILL_SET_VALUE_F:
- break;
- case TSDB_FILL_PREV:
- pFillInfo->pResRow = &pFillSup->prev;
- break;
- case TSDB_FILL_NEXT:
- pFillInfo->pResRow = &pFillSup->next;
- break;
- case TSDB_FILL_LINEAR: {
- setFillKeyInfo(pFillSup->prev.key, pFillSup->next.key, &pFillSup->interval, pFillInfo);
- pFillInfo->pLinearInfo->hasNext = false;
- pFillInfo->pLinearInfo->nextEnd = INT64_MIN;
- calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo,
- pFillSup->numOfAllCols);
- pFillInfo->pResRow = &pFillSup->prev;
- pFillInfo->pLinearInfo->winIndex = 0;
- } break;
- default:
- ASSERT(0);
- break;
- }
-}
-
-void copyNotFillExpData(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) {
- for (int32_t i = pFillSup->numOfFillCols; i < pFillSup->numOfAllCols; ++i) {
- SFillColInfo* pFillCol = pFillSup->pAllColInfo + i;
- int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
- SResultCellData* pCell = getResultCell(pFillInfo->pResRow, slotId);
- SResultCellData* pCurCell = getResultCell(&pFillSup->cur, slotId);
- pCell->isNull = pCurCell->isNull;
- if (!pCurCell->isNull) {
- memcpy(pCell->pData, pCurCell->pData, pCell->bytes);
- }
- }
-}
-
-void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillSupporter* pFillSup,
- SStreamFillInfo* pFillInfo) {
- pFillInfo->preRowKey = pFillSup->cur.key;
- if (!hasPrevWindow(pFillSup) && !hasNextWindow(pFillSup)) {
- pFillInfo->needFill = false;
- pFillInfo->pos = FILL_POS_START;
- return;
- }
- TSKEY prevWKey = INT64_MIN;
- TSKEY nextWKey = INT64_MIN;
- if (hasPrevWindow(pFillSup)) {
- prevWKey = pFillSup->prev.key;
- }
- if (hasNextWindow(pFillSup)) {
- nextWKey = pFillSup->next.key;
- }
-
- pFillInfo->needFill = true;
- pFillInfo->pos = FILL_POS_INVALID;
- switch (pFillInfo->type) {
- case TSDB_FILL_NULL:
- case TSDB_FILL_NULL_F:
- case TSDB_FILL_SET_VALUE:
- case TSDB_FILL_SET_VALUE_F: {
- if (pFillSup->prev.key == pFillInfo->preRowKey) {
- resetFillWindow(&pFillSup->prev);
- }
- if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) {
- if (pFillSup->next.key == pFillInfo->nextRowKey) {
- pFillInfo->preRowKey = INT64_MIN;
- setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_END;
- } else {
- pFillInfo->needFill = false;
- pFillInfo->pos = FILL_POS_START;
- }
- } else if (hasPrevWindow(pFillSup)) {
- setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_END;
- } else {
- setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_START;
- }
- copyNotFillExpData(pFillSup, pFillInfo);
- } break;
- case TSDB_FILL_PREV: {
- if (hasNextWindow(pFillSup) && ((pFillSup->next.key != pFillInfo->nextRowKey) ||
- (pFillSup->next.key == pFillInfo->nextRowKey && hasNextNextWindow(pFillSup)) ||
- (pFillSup->next.key == pFillInfo->nextRowKey && !hasPrevWindow(pFillSup)))) {
- setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_START;
- resetFillWindow(&pFillSup->prev);
- pFillSup->prev.key = pFillSup->cur.key;
- pFillSup->prev.pRowVal = pFillSup->cur.pRowVal;
- } else if (hasPrevWindow(pFillSup)) {
- setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_END;
- pFillInfo->preRowKey = INT64_MIN;
- }
- pFillInfo->pResRow = &pFillSup->prev;
- } break;
- case TSDB_FILL_NEXT: {
- if (hasPrevWindow(pFillSup)) {
- setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_END;
- resetFillWindow(&pFillSup->next);
- pFillSup->next.key = pFillSup->cur.key;
- pFillSup->next.pRowVal = pFillSup->cur.pRowVal;
- pFillInfo->preRowKey = INT64_MIN;
- } else {
- ASSERT(hasNextWindow(pFillSup));
- setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_START;
- }
- pFillInfo->pResRow = &pFillSup->next;
- } break;
- case TSDB_FILL_LINEAR: {
- pFillInfo->pLinearInfo->winIndex = 0;
- if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) {
- setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_MID;
- pFillInfo->pLinearInfo->nextEnd = nextWKey;
- calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo,
- pFillSup->numOfAllCols);
- pFillInfo->pResRow = &pFillSup->prev;
-
- calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pNextEndPoints, pFillSup->pAllColInfo,
- pFillSup->numOfAllCols);
- pFillInfo->pLinearInfo->hasNext = true;
- } else if (hasPrevWindow(pFillSup)) {
- setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_END;
- pFillInfo->pLinearInfo->nextEnd = INT64_MIN;
- calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo,
- pFillSup->numOfAllCols);
- pFillInfo->pResRow = &pFillSup->prev;
- pFillInfo->pLinearInfo->hasNext = false;
- } else {
- ASSERT(hasNextWindow(pFillSup));
- setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo);
- pFillInfo->pos = FILL_POS_START;
- pFillInfo->pLinearInfo->nextEnd = INT64_MIN;
- calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo,
- pFillSup->numOfAllCols);
- pFillInfo->pResRow = &pFillSup->cur;
- pFillInfo->pLinearInfo->hasNext = false;
- }
- } break;
- default:
- ASSERT(0);
- break;
- }
- ASSERT(pFillInfo->pos != FILL_POS_INVALID);
-}
-
-static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId) {
- SWinKey key = {.groupId = groupId, .ts = ts};
- if (tSimpleHashGet(pFillSup->pResMap, &key, sizeof(SWinKey)) != NULL) {
- return false;
- }
- tSimpleHashPut(pFillSup->pResMap, &key, sizeof(SWinKey), NULL, 0);
- return true;
-}
-
-static bool buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFillSup, TSKEY ts, SSDataBlock* pBlock) {
- if (pBlock->info.rows >= pBlock->info.capacity) {
- return false;
- }
- uint64_t groupId = pBlock->info.id.groupId;
- if (pFillSup->hasDelete && !checkResult(pFillSup, ts, groupId)) {
- return true;
- }
- for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) {
- SFillColInfo* pFillCol = pFillSup->pAllColInfo + i;
- int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
- SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, slotId);
- SFillInfo tmpInfo = {
- .currentKey = ts,
- .order = TSDB_ORDER_ASC,
- .interval = pFillSup->interval,
- };
- bool filled = fillIfWindowPseudoColumn(&tmpInfo, pFillCol, pColData, pBlock->info.rows);
- if (!filled) {
- SResultCellData* pCell = getResultCell(pResRow, slotId);
- setRowCell(pColData, pBlock->info.rows, pCell);
- }
- }
- pBlock->info.rows++;
- return true;
-}
-
-static bool hasRemainCalc(SStreamFillInfo* pFillInfo) {
- if (pFillInfo->current != INT64_MIN && pFillInfo->current <= pFillInfo->end) {
- return true;
- }
- return false;
-}
-
-static void doStreamFillNormal(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) {
- while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) {
- STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current};
- if (inWinRange(&pFillSup->winRange, &st)) {
- buildFillResult(pFillInfo->pResRow, pFillSup, pFillInfo->current, pBlock);
- }
- pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
- pFillSup->interval.precision);
- }
-}
-
-static void doStreamFillLinear(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) {
- while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) {
- uint64_t groupId = pBlock->info.id.groupId;
- SWinKey key = {.groupId = groupId, .ts = pFillInfo->current};
- STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current};
- if ( ( pFillSup->hasDelete && !checkResult(pFillSup, pFillInfo->current, groupId) ) || !inWinRange(&pFillSup->winRange, &st) ) {
- pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
- pFillSup->interval.precision);
- pFillInfo->pLinearInfo->winIndex++;
- continue;
- }
- pFillInfo->pLinearInfo->winIndex++;
- for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) {
- SFillColInfo* pFillCol = pFillSup->pAllColInfo + i;
- SFillInfo tmp = {
- .currentKey = pFillInfo->current,
- .order = TSDB_ORDER_ASC,
- .interval = pFillSup->interval,
- };
-
- int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
- SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, slotId);
- int16_t type = pColData->info.type;
- SResultCellData* pCell = getResultCell(pFillInfo->pResRow, slotId);
- int32_t index = pBlock->info.rows;
- if (pFillCol->notFillCol) {
- bool filled = fillIfWindowPseudoColumn(&tmp, pFillCol, pColData, index);
- if (!filled) {
- setRowCell(pColData, index, pCell);
- }
- } else {
- if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pCell->isNull) {
- colDataSetNULL(pColData, index);
- continue;
- }
- SPoint* pEnd = taosArrayGet(pFillInfo->pLinearInfo->pEndPoints, slotId);
- double vCell = 0;
- SPoint start = {0};
- start.key = pFillInfo->pResRow->key;
- start.val = pCell->pData;
-
- SPoint cur = {0};
- cur.key = pFillInfo->current;
- cur.val = taosMemoryCalloc(1, pCell->bytes);
- taosGetLinearInterpolationVal(&cur, pCell->type, &start, pEnd, pCell->type);
- colDataSetVal(pColData, index, (const char*)cur.val, false);
- destroySPoint(&cur);
- }
- }
- pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
- pFillSup->interval.precision);
- pBlock->info.rows++;
- }
-}
-
-static void keepResultInDiscBuf(SOperatorInfo* pOperator, uint64_t groupId, SResultRowData* pRow, int32_t len) {
- SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
-
- SWinKey key = {.groupId = groupId, .ts = pRow->key};
- int32_t code = pAPI->stateStore.streamStateFillPut(pOperator->pTaskInfo->streamInfo.pState, &key, pRow->pRowVal, len);
- qDebug("===stream===fill operator save key ts:%" PRId64 " group id:%" PRIu64 " code:%d", key.ts, key.groupId, code);
- ASSERT(code == TSDB_CODE_SUCCESS);
-}
-
-static void doStreamFillRange(SStreamFillInfo* pFillInfo, SStreamFillSupporter* pFillSup, SSDataBlock* pRes) {
- if (pFillInfo->needFill == false) {
- buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes);
- return;
- }
-
- if (pFillInfo->pos == FILL_POS_START) {
- if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
- pFillInfo->pos = FILL_POS_INVALID;
- }
- }
- if (pFillInfo->type != TSDB_FILL_LINEAR) {
- doStreamFillNormal(pFillSup, pFillInfo, pRes);
- } else {
- doStreamFillLinear(pFillSup, pFillInfo, pRes);
-
- if (pFillInfo->pos == FILL_POS_MID) {
- if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
- pFillInfo->pos = FILL_POS_INVALID;
- }
- }
-
- if (pFillInfo->current > pFillInfo->end && pFillInfo->pLinearInfo->hasNext) {
- pFillInfo->pLinearInfo->hasNext = false;
- pFillInfo->pLinearInfo->winIndex = 0;
- taosArraySwap(pFillInfo->pLinearInfo->pEndPoints, pFillInfo->pLinearInfo->pNextEndPoints);
- pFillInfo->pResRow = &pFillSup->cur;
- setFillKeyInfo(pFillSup->cur.key, pFillInfo->pLinearInfo->nextEnd, &pFillSup->interval, pFillInfo);
- doStreamFillLinear(pFillSup, pFillInfo, pRes);
- }
- }
- if (pFillInfo->pos == FILL_POS_END) {
- if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
- pFillInfo->pos = FILL_POS_INVALID;
- }
- }
-}
-
-void keepBlockRowInDiscBuf(SOperatorInfo* pOperator, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, TSKEY* tsCol,
- int32_t rowId, uint64_t groupId, int32_t rowSize) {
- TSKEY ts = tsCol[rowId];
- pFillInfo->nextRowKey = ts;
- SResultRowData tmpNextRow = {.key = ts};
- tmpNextRow.pRowVal = taosMemoryCalloc(1, rowSize);
- transBlockToResultRow(pBlock, rowId, ts, &tmpNextRow);
- keepResultInDiscBuf(pOperator, groupId, &tmpNextRow, rowSize);
- taosMemoryFreeClear(tmpNextRow.pRowVal);
-}
-
-static void doFillResults(SOperatorInfo* pOperator, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo,
- SSDataBlock* pBlock, TSKEY* tsCol, int32_t rowId, SSDataBlock* pRes) {
- uint64_t groupId = pBlock->info.id.groupId;
- getWindowFromDiscBuf(pOperator, tsCol[rowId], groupId, pFillSup);
- if (pFillSup->prev.key == pFillInfo->preRowKey) {
- resetFillWindow(&pFillSup->prev);
- }
- setFillValueInfo(pBlock, tsCol[rowId], rowId, pFillSup, pFillInfo);
- doStreamFillRange(pFillInfo, pFillSup, pRes);
-}
-
-static void doStreamFillImpl(SOperatorInfo* pOperator) {
- SStreamFillOperatorInfo* pInfo = pOperator->info;
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
- SStreamFillSupporter* pFillSup = pInfo->pFillSup;
- SStreamFillInfo* pFillInfo = pInfo->pFillInfo;
- SSDataBlock* pBlock = pInfo->pSrcBlock;
- uint64_t groupId = pBlock->info.id.groupId;
- SSDataBlock* pRes = pInfo->pRes;
- SColumnInfoData* pTsCol = taosArrayGet(pInfo->pSrcBlock->pDataBlock, pInfo->primaryTsCol);
- TSKEY* tsCol = (TSKEY*)pTsCol->pData;
- pRes->info.id.groupId = groupId;
- pInfo->srcRowIndex++;
-
- if (pInfo->srcRowIndex == 0) {
- keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex, groupId, pFillSup->rowSize);
- pInfo->srcRowIndex++;
- }
-
- while (pInfo->srcRowIndex < pBlock->info.rows) {
- TSKEY ts = tsCol[pInfo->srcRowIndex];
- keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex, groupId, pFillSup->rowSize);
- doFillResults(pOperator, pFillSup, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex - 1, pRes);
- if (pInfo->pRes->info.rows == pInfo->pRes->info.capacity) {
- blockDataUpdateTsWindow(pRes, pInfo->primaryTsCol);
- return;
- }
- pInfo->srcRowIndex++;
- }
- doFillResults(pOperator, pFillSup, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex - 1, pRes);
- blockDataUpdateTsWindow(pRes, pInfo->primaryTsCol);
- blockDataCleanup(pInfo->pSrcBlock);
-}
-
-static void buildDeleteRange(SOperatorInfo* pOp, TSKEY start, TSKEY end, uint64_t groupId, SSDataBlock* delRes) {
- SStorageAPI* pAPI = &pOp->pTaskInfo->storageAPI;
- void* pState = pOp->pTaskInfo->streamInfo.pState;
-
- SSDataBlock* pBlock = delRes;
- SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
- SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
- SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX);
- SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
- SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
- SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
- SColumnInfoData* pTbNameCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
- colDataSetVal(pStartCol, pBlock->info.rows, (const char*)&start, false);
- colDataSetVal(pEndCol, pBlock->info.rows, (const char*)&end, false);
- colDataSetNULL(pUidCol, pBlock->info.rows);
- colDataSetVal(pGroupCol, pBlock->info.rows, (const char*)&groupId, false);
- colDataSetNULL(pCalStartCol, pBlock->info.rows);
- colDataSetNULL(pCalEndCol, pBlock->info.rows);
-
- SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
-
- void* tbname = NULL;
- pAPI->stateStore.streamStateGetParName(pOp->pTaskInfo->streamInfo.pState, groupId, &tbname);
- if (tbname == NULL) {
- colDataSetNULL(pTableCol, pBlock->info.rows);
- } else {
- char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN];
- STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName));
- colDataSetVal(pTableCol, pBlock->info.rows, (const char*)parTbName, false);
- pAPI->stateStore.streamStateFreeVal(tbname);
- }
-
- pBlock->info.rows++;
-}
-
-static void buildDeleteResult(SOperatorInfo* pOperator, TSKEY startTs, TSKEY endTs, uint64_t groupId,
- SSDataBlock* delRes) {
- SStreamFillOperatorInfo* pInfo = pOperator->info;
- SStreamFillSupporter* pFillSup = pInfo->pFillSup;
- if (hasPrevWindow(pFillSup)) {
- TSKEY start = getNextWindowTs(pFillSup->prev.key, &pFillSup->interval);
- buildDeleteRange(pOperator, start, endTs, groupId, delRes);
- } else if (hasNextWindow(pFillSup)) {
- TSKEY end = getPrevWindowTs(pFillSup->next.key, &pFillSup->interval);
- buildDeleteRange(pOperator, startTs, end, groupId, delRes);
- } else {
- buildDeleteRange(pOperator, startTs, endTs, groupId, delRes);
- }
-}
-
-static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKEY endTs, uint64_t groupId) {
- SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
- SStreamFillOperatorInfo* pInfo = pOperator->info;
- getWindowFromDiscBuf(pOperator, startTs, groupId, pInfo->pFillSup);
- setDeleteFillValueInfo(startTs, endTs, pInfo->pFillSup, pInfo->pFillInfo);
- SWinKey key = {.ts = startTs, .groupId = groupId};
- if (!pInfo->pFillInfo->needFill) {
- pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key);
- buildDeleteResult(pOperator, startTs, endTs, groupId, pInfo->pDelRes);
- } else {
- STimeRange tw = {
- .skey = startTs,
- .ekey = endTs,
- .groupId = groupId,
- };
- taosArrayPush(pInfo->pFillInfo->delRanges, &tw);
- while (key.ts <= endTs) {
- key.ts = taosTimeAdd(key.ts, pInfo->pFillSup->interval.sliding, pInfo->pFillSup->interval.slidingUnit,
- pInfo->pFillSup->interval.precision);
- tSimpleHashPut(pInfo->pFillSup->pResMap, &key, sizeof(SWinKey), NULL, 0);
- }
- }
-}
-
-static void doDeleteFillFinalize(SOperatorInfo* pOperator) {
- SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
-
- SStreamFillOperatorInfo* pInfo = pOperator->info;
- SStreamFillInfo* pFillInfo = pInfo->pFillInfo;
- int32_t size = taosArrayGetSize(pFillInfo->delRanges);
- tSimpleHashClear(pInfo->pFillSup->pResMap);
- for (; pFillInfo->delIndex < size; pFillInfo->delIndex++) {
- STimeRange* range = taosArrayGet(pFillInfo->delRanges, pFillInfo->delIndex);
- if (pInfo->pRes->info.id.groupId != 0 && pInfo->pRes->info.id.groupId != range->groupId) {
- return;
- }
- getWindowFromDiscBuf(pOperator, range->skey, range->groupId, pInfo->pFillSup);
- setDeleteFillValueInfo(range->skey, range->ekey, pInfo->pFillSup, pInfo->pFillInfo);
- if (pInfo->pFillInfo->needFill) {
- doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes);
- pInfo->pRes->info.id.groupId = range->groupId;
- }
- SWinKey key = {.ts = range->skey, .groupId = range->groupId};
- pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key);
- }
-}
-
-static void doDeleteFillResult(SOperatorInfo* pOperator) {
- SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
-
- SStreamFillOperatorInfo* pInfo = pOperator->info;
- SStreamFillInfo* pFillInfo = pInfo->pFillInfo;
- SSDataBlock* pBlock = pInfo->pSrcDelBlock;
-
- SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
- TSKEY* tsStarts = (TSKEY*)pStartCol->pData;
- SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
- uint64_t* groupIds = (uint64_t*)pGroupCol->pData;
- while (pInfo->srcDelRowIndex < pBlock->info.rows) {
- TSKEY ts = tsStarts[pInfo->srcDelRowIndex];
- TSKEY endTs = ts;
- uint64_t groupId = groupIds[pInfo->srcDelRowIndex];
- SWinKey key = {.ts = ts, .groupId = groupId};
- SStreamStateCur* pCur = pAPI->stateStore.streamStateGetAndCheckCur(pOperator->pTaskInfo->streamInfo.pState, &key);
-
- if (!pCur) {
- pInfo->srcDelRowIndex++;
- continue;
- }
-
- SWinKey nextKey = {.groupId = groupId, .ts = ts};
- while (pInfo->srcDelRowIndex < pBlock->info.rows) {
- TSKEY delTs = tsStarts[pInfo->srcDelRowIndex];
- uint64_t delGroupId = groupIds[pInfo->srcDelRowIndex];
- int32_t code = TSDB_CODE_SUCCESS;
- if (groupId != delGroupId) {
- break;
- }
- if (delTs > nextKey.ts) {
- break;
- }
-
- SWinKey delKey = {.groupId = delGroupId, .ts = delTs};
- if (delTs == nextKey.ts) {
- code = pAPI->stateStore.streamStateCurNext(pOperator->pTaskInfo->streamInfo.pState, pCur);
- if (code == TSDB_CODE_SUCCESS) {
- code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, NULL, NULL);
- }
- // ts will be deleted later
- if (delTs != ts) {
- pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &delKey);
- pAPI->stateStore.streamStateFreeCur(pCur);
- pCur = pAPI->stateStore.streamStateGetAndCheckCur(pOperator->pTaskInfo->streamInfo.pState, &nextKey);
- }
- endTs = TMAX(delTs, nextKey.ts - 1);
- if (code != TSDB_CODE_SUCCESS) {
- break;
- }
- }
- pInfo->srcDelRowIndex++;
- }
-
- pAPI->stateStore.streamStateFreeCur(pCur);
- doDeleteFillResultImpl(pOperator, ts, endTs, groupId);
- }
-
- pFillInfo->current = pFillInfo->end + 1;
-}
-
-static void resetStreamFillInfo(SStreamFillOperatorInfo* pInfo) {
- tSimpleHashClear(pInfo->pFillSup->pResMap);
- pInfo->pFillSup->hasDelete = false;
- taosArrayClear(pInfo->pFillInfo->delRanges);
- pInfo->pFillInfo->delIndex = 0;
-}
-
-static void doApplyStreamScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pSrcBlock, SSDataBlock* pDstBlock) {
- SStreamFillOperatorInfo* pInfo = pOperator->info;
- SExprSupp* pSup = &pOperator->exprSupp;
-
- blockDataCleanup(pDstBlock);
- blockDataEnsureCapacity(pDstBlock, pSrcBlock->info.rows);
- setInputDataBlock(pSup, pSrcBlock, TSDB_ORDER_ASC, MAIN_SCAN, false);
- projectApplyFunctions(pSup->pExprInfo, pDstBlock, pSrcBlock, pSup->pCtx, pSup->numOfExprs, NULL);
-
- pDstBlock->info.rows = 0;
- pSup = &pInfo->pFillSup->notFillExprSup;
- setInputDataBlock(pSup, pSrcBlock, TSDB_ORDER_ASC, MAIN_SCAN, false);
- projectApplyFunctions(pSup->pExprInfo, pDstBlock, pSrcBlock, pSup->pCtx, pSup->numOfExprs, NULL);
- pDstBlock->info.id.groupId = pSrcBlock->info.id.groupId;
-
- blockDataUpdateTsWindow(pDstBlock, pInfo->primaryTsCol);
-}
-
-static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) {
- SStreamFillOperatorInfo* pInfo = pOperator->info;
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
-
- if (pOperator->status == OP_EXEC_DONE) {
- return NULL;
- }
- blockDataCleanup(pInfo->pRes);
- if (hasRemainCalc(pInfo->pFillInfo) ||
- (pInfo->pFillInfo->pos != FILL_POS_INVALID && pInfo->pFillInfo->needFill == true)) {
- doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes);
- if (pInfo->pRes->info.rows > 0) {
- printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
- return pInfo->pRes;
- }
- }
- if (pOperator->status == OP_RES_TO_RETURN) {
- doDeleteFillFinalize(pOperator);
- if (pInfo->pRes->info.rows > 0) {
- printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
- return pInfo->pRes;
- }
- setOperatorCompleted(pOperator);
- resetStreamFillInfo(pInfo);
- return NULL;
- }
-
- SSDataBlock* fillResult = NULL;
- SOperatorInfo* downstream = pOperator->pDownstream[0];
- while (1) {
- if (pInfo->srcRowIndex >= pInfo->pSrcBlock->info.rows || pInfo->pSrcBlock->info.rows == 0) {
- // If there are delete datablocks, we receive them first.
- SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0);
- if (pBlock == NULL) {
- pOperator->status = OP_RES_TO_RETURN;
- pInfo->pFillInfo->preRowKey = INT64_MIN;
- if (pInfo->pRes->info.rows > 0) {
- printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
- return pInfo->pRes;
- }
- break;
- }
- printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo));
-
- if (pInfo->pFillInfo->curGroupId != pBlock->info.id.groupId) {
- pInfo->pFillInfo->curGroupId = pBlock->info.id.groupId;
- pInfo->pFillInfo->preRowKey = INT64_MIN;
- }
-
- pInfo->pFillSup->winRange = pTaskInfo->streamInfo.fillHistoryWindow;
- if (pInfo->pFillSup->winRange.ekey <= 0) {
- pInfo->pFillSup->winRange.ekey = INT64_MAX;
- }
-
- switch (pBlock->info.type) {
- case STREAM_RETRIEVE:
- return pBlock;
- case STREAM_DELETE_RESULT: {
- pInfo->pSrcDelBlock = pBlock;
- pInfo->srcDelRowIndex = 0;
- blockDataCleanup(pInfo->pDelRes);
- pInfo->pFillSup->hasDelete = true;
- doDeleteFillResult(pOperator);
- if (pInfo->pDelRes->info.rows > 0) {
- printDataBlock(pInfo->pDelRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
- return pInfo->pDelRes;
- }
- continue;
- } break;
- case STREAM_NORMAL:
- case STREAM_INVALID:
- case STREAM_PULL_DATA: {
- doApplyStreamScalarCalculation(pOperator, pBlock, pInfo->pSrcBlock);
- memcpy(pInfo->pSrcBlock->info.parTbName, pBlock->info.parTbName, TSDB_TABLE_NAME_LEN);
- pInfo->srcRowIndex = -1;
- } break;
- case STREAM_CHECKPOINT:
- case STREAM_CREATE_CHILD_TABLE: {
- return pBlock;
- } break;
- default:
- ASSERTS(false, "invalid SSDataBlock type");
- }
- }
-
- doStreamFillImpl(pOperator);
- doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, &pInfo->matchInfo);
- memcpy(pInfo->pRes->info.parTbName, pInfo->pSrcBlock->info.parTbName, TSDB_TABLE_NAME_LEN);
- pOperator->resultInfo.totalRows += pInfo->pRes->info.rows;
- if (pInfo->pRes->info.rows > 0) {
- break;
- }
- }
- if (pOperator->status == OP_RES_TO_RETURN) {
- doDeleteFillFinalize(pOperator);
- }
-
- if (pInfo->pRes->info.rows == 0) {
- setOperatorCompleted(pOperator);
- resetStreamFillInfo(pInfo);
- return NULL;
- }
-
- pOperator->resultInfo.totalRows += pInfo->pRes->info.rows;
- printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
- return pInfo->pRes;
-}
-
-static int32_t initResultBuf(SStreamFillSupporter* pFillSup) {
- pFillSup->rowSize = sizeof(SResultCellData) * pFillSup->numOfAllCols;
- for (int i = 0; i < pFillSup->numOfAllCols; i++) {
- SFillColInfo* pCol = &pFillSup->pAllColInfo[i];
- SResSchema* pSchema = &pCol->pExpr->base.resSchema;
- pFillSup->rowSize += pSchema->bytes;
- }
- pFillSup->next.key = INT64_MIN;
- pFillSup->nextNext.key = INT64_MIN;
- pFillSup->prev.key = INT64_MIN;
- pFillSup->cur.key = INT64_MIN;
- pFillSup->next.pRowVal = NULL;
- pFillSup->nextNext.pRowVal = NULL;
- pFillSup->prev.pRowVal = NULL;
- pFillSup->cur.pRowVal = NULL;
-
- return TSDB_CODE_SUCCESS;
-}
-
-static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNode, SInterval* pInterval,
- SExprInfo* pFillExprInfo, int32_t numOfFillCols, SStorageAPI* pAPI) {
- SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter));
- if (!pFillSup) {
- return NULL;
- }
- pFillSup->numOfFillCols = numOfFillCols;
- int32_t numOfNotFillCols = 0;
- SExprInfo* noFillExprInfo = createExprInfo(pPhyFillNode->pNotFillExprs, NULL, &numOfNotFillCols);
- pFillSup->pAllColInfo = createFillColInfo(pFillExprInfo, pFillSup->numOfFillCols, noFillExprInfo, numOfNotFillCols,
- (const SNodeListNode*)(pPhyFillNode->pValues));
- pFillSup->type = convertFillType(pPhyFillNode->mode);
- pFillSup->numOfAllCols = pFillSup->numOfFillCols + numOfNotFillCols;
- pFillSup->interval = *pInterval;
- pFillSup->pAPI = pAPI;
-
- int32_t code = initResultBuf(pFillSup);
- if (code != TSDB_CODE_SUCCESS) {
- destroyStreamFillSupporter(pFillSup);
- return NULL;
- }
-
- SExprInfo* noFillExpr = createExprInfo(pPhyFillNode->pNotFillExprs, NULL, &numOfNotFillCols);
- code = initExprSupp(&pFillSup->notFillExprSup, noFillExpr, numOfNotFillCols, &pAPI->functionStore);
- if (code != TSDB_CODE_SUCCESS) {
- destroyStreamFillSupporter(pFillSup);
- return NULL;
- }
-
- _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
- pFillSup->pResMap = tSimpleHashInit(16, hashFn);
- pFillSup->hasDelete = false;
- return pFillSup;
-}
-
-SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pRes) {
- SStreamFillInfo* pFillInfo = taosMemoryCalloc(1, sizeof(SStreamFillInfo));
- pFillInfo->start = INT64_MIN;
- pFillInfo->current = INT64_MIN;
- pFillInfo->end = INT64_MIN;
- pFillInfo->preRowKey = INT64_MIN;
- pFillInfo->needFill = false;
- pFillInfo->pLinearInfo = taosMemoryCalloc(1, sizeof(SStreamFillLinearInfo));
- pFillInfo->pLinearInfo->hasNext = false;
- pFillInfo->pLinearInfo->nextEnd = INT64_MIN;
- pFillInfo->pLinearInfo->pEndPoints = NULL;
- pFillInfo->pLinearInfo->pNextEndPoints = NULL;
- if (pFillSup->type == TSDB_FILL_LINEAR) {
- pFillInfo->pLinearInfo->pEndPoints = taosArrayInit(pFillSup->numOfAllCols, sizeof(SPoint));
- pFillInfo->pLinearInfo->pNextEndPoints = taosArrayInit(pFillSup->numOfAllCols, sizeof(SPoint));
- for (int32_t i = 0; i < pFillSup->numOfAllCols; i++) {
- SColumnInfoData* pColData = taosArrayGet(pRes->pDataBlock, i);
- SPoint value = {0};
- value.val = taosMemoryCalloc(1, pColData->info.bytes);
- taosArrayPush(pFillInfo->pLinearInfo->pEndPoints, &value);
-
- value.val = taosMemoryCalloc(1, pColData->info.bytes);
- taosArrayPush(pFillInfo->pLinearInfo->pNextEndPoints, &value);
- }
- }
- pFillInfo->pLinearInfo->winIndex = 0;
-
- pFillInfo->pResRow = NULL;
- if (pFillSup->type == TSDB_FILL_SET_VALUE || pFillSup->type == TSDB_FILL_SET_VALUE_F ||
- pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) {
- pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData));
- pFillInfo->pResRow->key = INT64_MIN;
- pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize);
- for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) {
- SColumnInfoData* pColData = taosArrayGet(pRes->pDataBlock, i);
- SResultCellData* pCell = getResultCell(pFillInfo->pResRow, i);
- pCell->bytes = pColData->info.bytes;
- pCell->type = pColData->info.type;
- }
- }
-
- pFillInfo->type = pFillSup->type;
- pFillInfo->delRanges = taosArrayInit(16, sizeof(STimeRange));
- pFillInfo->delIndex = 0;
- pFillInfo->curGroupId = 0;
- return pFillInfo;
-}
-
-SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysiNode* pPhyFillNode,
- SExecTaskInfo* pTaskInfo) {
- SStreamFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamFillOperatorInfo));
- SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
- if (pInfo == NULL || pOperator == NULL) {
- goto _error;
- }
-
- SInterval* pInterval = &((SStreamIntervalOperatorInfo*)downstream->info)->interval;
- int32_t numOfFillCols = 0;
- SExprInfo* pFillExprInfo = createExprInfo(pPhyFillNode->pFillExprs, NULL, &numOfFillCols);
- pInfo->pFillSup = initStreamFillSup(pPhyFillNode, pInterval, pFillExprInfo, numOfFillCols, &pTaskInfo->storageAPI);
- if (!pInfo->pFillSup) {
- goto _error;
- }
-
- initResultSizeInfo(&pOperator->resultInfo, 4096);
- pInfo->pRes = createDataBlockFromDescNode(pPhyFillNode->node.pOutputDataBlockDesc);
- pInfo->pSrcBlock = createDataBlockFromDescNode(pPhyFillNode->node.pOutputDataBlockDesc);
- blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
- blockDataEnsureCapacity(pInfo->pSrcBlock, pOperator->resultInfo.capacity);
-
- pInfo->pFillInfo = initStreamFillInfo(pInfo->pFillSup, pInfo->pRes);
- if (!pInfo->pFillInfo) {
- goto _error;
- }
-
- if (pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE || pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE_F) {
- for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) {
- SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i;
- int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
- SResultCellData* pCell = getResultCell(pInfo->pFillInfo->pResRow, slotId);
- SVariant* pVar = &(pFillCol->fillVal);
- if (pCell->type == TSDB_DATA_TYPE_FLOAT) {
- float v = 0;
- GET_TYPED_DATA(v, float, pVar->nType, &pVar->i);
- SET_TYPED_DATA(pCell->pData, pCell->type, v);
- } else if (IS_FLOAT_TYPE(pCell->type)) {
- double v = 0;
- GET_TYPED_DATA(v, double, pVar->nType, &pVar->i);
- SET_TYPED_DATA(pCell->pData, pCell->type, v);
- } else if (IS_INTEGER_TYPE(pCell->type)) {
- int64_t v = 0;
- GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i);
- SET_TYPED_DATA(pCell->pData, pCell->type, v);
- } else {
- pCell->isNull = true;
- }
- }
- } else if (pInfo->pFillInfo->type == TSDB_FILL_NULL || pInfo->pFillInfo->type == TSDB_FILL_NULL_F) {
- for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) {
- SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i;
- int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
- SResultCellData* pCell = getResultCell(pInfo->pFillInfo->pResRow, slotId);
- pCell->isNull = true;
- }
- }
-
- pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT);
- blockDataEnsureCapacity(pInfo->pDelRes, pOperator->resultInfo.capacity);
-
- pInfo->primaryTsCol = ((STargetNode*)pPhyFillNode->pWStartTs)->slotId;
- pInfo->primarySrcSlotId = ((SColumnNode*)((STargetNode*)pPhyFillNode->pWStartTs)->pExpr)->slotId;
-
- int32_t numOfOutputCols = 0;
- int32_t code = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc,
- &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo);
- if (code != TSDB_CODE_SUCCESS) {
- goto _error;
- }
-
- code = filterInitFromNode((SNode*)pPhyFillNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
- if (code != TSDB_CODE_SUCCESS) {
- goto _error;
- }
-
- code = initExprSupp(&pOperator->exprSupp, pFillExprInfo, numOfFillCols, &pTaskInfo->storageAPI.functionStore);
- if (code != TSDB_CODE_SUCCESS) {
- goto _error;
- }
-
- pInfo->srcRowIndex = -1;
- setOperatorInfo(pOperator, "StreamFillOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, false, OP_NOT_OPENED, pInfo,
- pTaskInfo);
- pOperator->fpSet =
- createOperatorFpSet(optrDummyOpenFn, doStreamFill, NULL, destroyStreamFillOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
- setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState);
-
- code = appendDownstream(pOperator, &downstream, 1);
- if (code != TSDB_CODE_SUCCESS) {
- goto _error;
- }
- return pOperator;
-
-_error:
- destroyStreamFillOperatorInfo(pInfo);
- taosMemoryFreeClear(pOperator);
- pTaskInfo->code = code;
- return NULL;
-}
diff --git a/source/libs/executor/src/mergeoperator.c b/source/libs/executor/src/mergeoperator.c
index 093b6ab11e..c1a51898bc 100755
--- a/source/libs/executor/src/mergeoperator.c
+++ b/source/libs/executor/src/mergeoperator.c
@@ -269,6 +269,7 @@ SSDataBlock* doNonSortMerge(SOperatorInfo* pOperator) {
SMultiwayMergeOperatorInfo* pInfo = pOperator->info;
SNonSortMergeInfo* pNonSortMerge = &pInfo->nsortMergeInfo;
SSDataBlock* pBlock = NULL;
+ SSDataBlock* pRes = pInfo->binfo.pRes;
qDebug("start to merge no sorted rows, %s", GET_TASKID(pTaskInfo));
@@ -278,13 +279,18 @@ SSDataBlock* doNonSortMerge(SOperatorInfo* pOperator) {
if (NULL == pBlock) {
TSWAP(pNonSortMerge->pSourceStatus[pNonSortMerge->sourceWorkIdx], pNonSortMerge->pSourceStatus[idx]);
pNonSortMerge->sourceWorkIdx++;
- idx = NON_SORT_NEXT_SRC(pNonSortMerge, idx);
+ idx = NON_SORT_NEXT_SRC(pNonSortMerge, pNonSortMerge->lastSourceIdx);
continue;
}
break;
}
- return pBlock;
+ if (!pBlock) {
+ return NULL;
+ }
+ copyDataBlock(pRes, pBlock);
+
+ return pRes;
}
void destroyNonSortMergeOperatorInfo(void* param) {
@@ -491,6 +497,9 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size
}
case MERGE_TYPE_NON_SORT: {
SNonSortMergeInfo* pNonSortMerge = &pInfo->nsortMergeInfo;
+ pInfo->binfo.pRes = createDataBlockFromDescNode(pDescNode);
+ initResultSizeInfo(&pOperator->resultInfo, 1024);
+ blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
break;
}
case MERGE_TYPE_COLUMNS: {
diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c
index 691210e5ba..c6ebb04446 100644
--- a/source/libs/executor/src/projectoperator.c
+++ b/source/libs/executor/src/projectoperator.c
@@ -28,6 +28,7 @@ typedef struct SProjectOperatorInfo {
bool mergeDataBlocks;
SSDataBlock* pFinalRes;
bool inputIgnoreGroup;
+ bool outputIgnoreGroup;
} SProjectOperatorInfo;
typedef struct SIndefOperatorInfo {
@@ -111,6 +112,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
pInfo->binfo.inputTsOrder = pProjPhyNode->node.inputTsOrder;
pInfo->binfo.outputTsOrder = pProjPhyNode->node.outputTsOrder;
pInfo->inputIgnoreGroup = pProjPhyNode->inputIgnoreGroup;
+ pInfo->outputIgnoreGroup = pProjPhyNode->ignoreGroupId;
if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM || pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) {
pInfo->mergeDataBlocks = false;
@@ -276,6 +278,10 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
T_LONG_JMP(pTaskInfo->env, code);
}
+ if (pProjectInfo->outputIgnoreGroup) {
+ pRes->info.id.groupId = 0;
+ }
+
return (pRes->info.rows > 0) ? pRes : NULL;
}
@@ -385,6 +391,10 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
printDataBlock(p, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
}
+ if (pProjectInfo->outputIgnoreGroup) {
+ p->info.id.groupId = 0;
+ }
+
return (p->info.rows > 0) ? p : NULL;
}
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index 8cc2f72adb..51edfcb42c 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -2269,6 +2269,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
if (pStreamInfo->recoverStep == STREAM_RECOVER_STEP__SCAN1) {
if (isTaskKilled(pTaskInfo)) {
+ qInfo("===stream===stream scan is killed. task id:%s, code %s", id, tstrerror(pTaskInfo->code));
return NULL;
}
@@ -3763,8 +3764,9 @@ static int32_t stopSubTablesTableMergeScan(STableMergeScanInfo* pInfo) {
taosMemoryFree(pSubTblsInfo);
pInfo->pSubTablesMergeInfo = NULL;
+
+ taosMemoryTrim(0);
}
- taosMemoryTrim(0);
return TSDB_CODE_SUCCESS;
}
@@ -3869,6 +3871,7 @@ static void doGetBlockForTableMergeScan(SOperatorInfo* pOperator, bool* pFinishe
uint32_t status = 0;
code = loadDataBlock(pOperator, &pInfo->base, pBlock, &status);
+
if (code != TSDB_CODE_SUCCESS) {
qInfo("table merge scan load datablock code %d, %s", code, GET_TASKID(pTaskInfo));
T_LONG_JMP(pTaskInfo->env, code);
@@ -3955,7 +3958,9 @@ static SSDataBlock* getBlockForTableMergeScan(void* param) {
pBlock->info.id.groupId = tableListGetTableGroupId(pInfo->base.pTableListInfo, pBlock->info.id.uid);
pOperator->resultInfo.totalRows += pBlock->info.rows;
+
pInfo->base.readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0;
+
return pBlock;
}
@@ -4007,9 +4012,16 @@ int32_t startDurationForGroupTableMergeScan(SOperatorInfo* pOperator) {
pInfo->sortBufSize = 2048 * pInfo->bufPageSize;
int32_t numOfBufPage = pInfo->sortBufSize / pInfo->bufPageSize;
- pInfo->pSortHandle = tsortCreateSortHandle(pInfo->pSortInfo, SORT_BLOCK_TS_MERGE, pInfo->bufPageSize, numOfBufPage,
- pInfo->pSortInputBlock, pTaskInfo->id.str, 0, 0, 0);
+ pInfo->pSortHandle = tsortCreateSortHandle(pInfo->pSortInfo, SORT_BLOCK_TS_MERGE, pInfo->bufPageSize, numOfBufPage,
+ pInfo->pSortInputBlock, pTaskInfo->id.str, 0, 0, 0);
+ if (pInfo->bSortRowId && numOfTable != 1) {
+ int32_t memSize = 512 * 1024 * 1024;
+ code = tsortSetSortByRowId(pInfo->pSortHandle, memSize);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+ }
tsortSetMergeLimit(pInfo->pSortHandle, pInfo->mergeLimit);
tsortSetMergeLimitReachedFp(pInfo->pSortHandle, tableMergeScanDoSkipTable, pInfo);
tsortSetAbortCheckFn(pInfo->pSortHandle, isTaskKilled, pOperator->pTaskInfo);
@@ -4046,6 +4058,7 @@ void stopDurationForGroupTableMergeScan(SOperatorInfo* pOperator) {
tsortDestroySortHandle(pInfo->pSortHandle);
pInfo->pSortHandle = NULL;
+
}
int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
@@ -4130,8 +4143,7 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock*
if (pTupleHandle == NULL) {
break;
}
-
- appendOneRowToDataBlock(pResBlock, pTupleHandle);
+ tsortAppendTupleToBlock(pInfo->pSortHandle, pResBlock, pTupleHandle);
if (pResBlock->info.rows >= capacity) {
break;
}
@@ -4198,7 +4210,10 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
} else {
if (pInfo->bNewFilesetEvent) {
stopDurationForGroupTableMergeScan(pOperator);
- startDurationForGroupTableMergeScan(pOperator);
+ code = startDurationForGroupTableMergeScan(pOperator);
+ if (code != TSDB_CODE_SUCCESS) {
+ T_LONG_JMP(pTaskInfo->env, terrno);
+ }
} else {
// Data of this group are all dumped, let's try the next group
stopGroupTableMergeScan(pOperator);
@@ -4329,10 +4344,15 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
pInfo->mergeLimit = pInfo->limitInfo.limit.limit + pInfo->limitInfo.limit.offset;
pInfo->mSkipTables = NULL;
}
-
+
initResultSizeInfo(&pOperator->resultInfo, 1024);
pInfo->pResBlock = createDataBlockFromDescNode(pDescNode);
blockDataEnsureCapacity(pInfo->pResBlock, pOperator->resultInfo.capacity);
+ if (!hasLimit && blockDataGetRowSize(pInfo->pResBlock) >= 256 && !pTableScanNode->smallDataTsSort) {
+ pInfo->bSortRowId = true;
+ } else {
+ pInfo->bSortRowId = false;
+ }
pInfo->pSortInfo = generateSortByTsInfo(pInfo->base.matchInfo.pList, pInfo->base.cond.order);
pInfo->pReaderBlock = createOneDataBlock(pInfo->pResBlock, false);
@@ -4341,6 +4361,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
int32_t rowSize = pInfo->pResBlock->info.rowSize;
uint32_t nCols = taosArrayGetSize(pInfo->pResBlock->pDataBlock);
+
pInfo->bufPageSize = getProperSortPageSize(rowSize, nCols);
//start one reader variable
diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c
index f9c7b51316..720734431f 100644
--- a/source/libs/executor/src/streamcountwindowoperator.c
+++ b/source/libs/executor/src/streamcountwindowoperator.c
@@ -390,10 +390,12 @@ void* doStreamCountDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperato
buf = taosDecodeFixedI32(buf, &mapSize);
for (int32_t i = 0; i < mapSize; i++) {
SSessionKey key = {0};
- SResultWindowInfo winfo = {0};
+ SCountWindowInfo curWin = {0};
buf = decodeSSessionKey(buf, &key);
- buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize);
- tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo));
+ SBuffInfo buffInfo = {.rebuildWindow = false, .winBuffOp = NONE_WINDOW, .pCur = NULL};
+ setCountOutputBuf(&pInfo->streamAggSup, key.win.skey, key.groupId, &curWin, &buffInfo);
+ buf = decodeSResultWindowInfo(buf, &curWin.winInfo, pInfo->streamAggSup.resultRowSize);
+ tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &curWin.winInfo, sizeof(SResultWindowInfo));
}
// 2.twAggSup
@@ -694,6 +696,8 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo->recvGetAll = false;
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT;
+ setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, true,
+ OP_NOT_OPENED, pInfo, pTaskInfo);
// for stream
void* buff = NULL;
int32_t len = 0;
@@ -704,8 +708,6 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys
doStreamCountDecodeOpState(buff, len, pOperator, true);
taosMemoryFree(buff);
}
- setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, true,
- OP_NOT_OPENED, pInfo, pTaskInfo);
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamCountAgg, NULL, destroyStreamCountAggOperatorInfo,
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
setOperatorStreamStateFn(pOperator, streamCountReleaseState, streamCountReloadState);
diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c
index 4a2fe2416f..11d8d1487a 100644
--- a/source/libs/executor/src/streameventwindowoperator.c
+++ b/source/libs/executor/src/streameventwindowoperator.c
@@ -406,6 +406,7 @@ void* doStreamEventDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperato
if (!pInfo) {
return buf;
}
+ SStreamAggSupporter* pAggSup = &pInfo->streamAggSup;
// 4.checksum
int32_t dataLen = len - sizeof(uint32_t);
@@ -423,6 +424,8 @@ void* doStreamEventDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperato
SSessionKey key = {0};
SResultWindowInfo winfo = {0};
buf = decodeSSessionKey(buf, &key);
+ pAggSup->stateStore.streamStateSessionAddIfNotExist(pAggSup->pState, &winfo.sessionWin, pAggSup->gap,
+ (void**)&winfo.pStatePos, &pAggSup->resultRowSize);
buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize);
tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo));
}
@@ -735,6 +738,8 @@ SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo->reCkBlock = false;
pInfo->recvGetAll = false;
+ setOperatorInfo(pOperator, "StreamEventAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, true, OP_NOT_OPENED,
+ pInfo, pTaskInfo);
// for stream
void* buff = NULL;
int32_t len = 0;
@@ -746,8 +751,6 @@ SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhys
taosMemoryFree(buff);
}
- setOperatorInfo(pOperator, "StreamEventAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, true, OP_NOT_OPENED,
- pInfo, pTaskInfo);
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamEventAgg, NULL, destroyStreamEventOperatorInfo,
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
setOperatorStreamStateFn(pOperator, streamEventReleaseState, streamEventReloadState);
diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c
new file mode 100644
index 0000000000..b54802e2c6
--- /dev/null
+++ b/source/libs/executor/src/streamfilloperator.c
@@ -0,0 +1,1181 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "filter.h"
+#include "os.h"
+#include "query.h"
+#include "taosdef.h"
+#include "tmsg.h"
+#include "ttypes.h"
+
+#include "executorInt.h"
+#include "tcommon.h"
+#include "thash.h"
+#include "ttime.h"
+
+#include "function.h"
+#include "querynodes.h"
+#include "tdatablock.h"
+#include "tfill.h"
+#include "operator.h"
+#include "querytask.h"
+
+
+#define FILL_POS_INVALID 0
+#define FILL_POS_START 1
+#define FILL_POS_MID 2
+#define FILL_POS_END 3
+
+typedef struct STimeRange {
+ TSKEY skey;
+ TSKEY ekey;
+ uint64_t groupId;
+} STimeRange;
+
+TSKEY getNextWindowTs(TSKEY ts, SInterval* pInterval) {
+ STimeWindow win = {.skey = ts, .ekey = ts};
+ getNextTimeWindow(pInterval, &win, TSDB_ORDER_ASC);
+ return win.skey;
+}
+
+TSKEY getPrevWindowTs(TSKEY ts, SInterval* pInterval) {
+ STimeWindow win = {.skey = ts, .ekey = ts};
+ getNextTimeWindow(pInterval, &win, TSDB_ORDER_DESC);
+ return win.skey;
+}
+
+void setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell) {
+ colDataSetVal(pCol, rowId, pCell->pData, pCell->isNull);
+}
+
+SResultCellData* getResultCell(SResultRowData* pRaw, int32_t index) {
+ if (!pRaw || !pRaw->pRowVal) {
+ return NULL;
+ }
+ char* pData = (char*)pRaw->pRowVal;
+ SResultCellData* pCell = pRaw->pRowVal;
+ for (int32_t i = 0; i < index; i++) {
+ pData += (pCell->bytes + sizeof(SResultCellData));
+ pCell = (SResultCellData*)pData;
+ }
+ return pCell;
+}
+
+void* destroyFillColumnInfo(SFillColInfo* pFillCol, int32_t start, int32_t end) {
+ for (int32_t i = start; i < end; i++) {
+ destroyExprInfo(pFillCol[i].pExpr, 1);
+ taosVariantDestroy(&pFillCol[i].fillVal);
+ }
+ taosMemoryFreeClear(pFillCol[start].pExpr);
+ taosMemoryFree(pFillCol);
+ return NULL;
+}
+
+void* destroyStreamFillSupporter(SStreamFillSupporter* pFillSup) {
+ pFillSup->pAllColInfo = destroyFillColumnInfo(pFillSup->pAllColInfo, pFillSup->numOfFillCols, pFillSup->numOfAllCols);
+ tSimpleHashCleanup(pFillSup->pResMap);
+ pFillSup->pResMap = NULL;
+ cleanupExprSupp(&pFillSup->notFillExprSup);
+ if (pFillSup->cur.pRowVal != pFillSup->prev.pRowVal && pFillSup->cur.pRowVal != pFillSup->next.pRowVal) {
+ taosMemoryFree(pFillSup->cur.pRowVal);
+ }
+ taosMemoryFree(pFillSup->prev.pRowVal);
+ taosMemoryFree(pFillSup->next.pRowVal);
+ taosMemoryFree(pFillSup->nextNext.pRowVal);
+
+ taosMemoryFree(pFillSup);
+ return NULL;
+}
+
+void destroySPoint(void* ptr) {
+ SPoint* point = (SPoint*) ptr;
+ taosMemoryFreeClear(point->val);
+}
+
+void* destroyStreamFillLinearInfo(SStreamFillLinearInfo* pFillLinear) {
+ taosArrayDestroyEx(pFillLinear->pEndPoints, destroySPoint);
+ taosArrayDestroyEx(pFillLinear->pNextEndPoints, destroySPoint);
+ taosMemoryFree(pFillLinear);
+ return NULL;
+}
+void* destroyStreamFillInfo(SStreamFillInfo* pFillInfo) {
+ if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F ||
+ pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) {
+ taosMemoryFreeClear(pFillInfo->pResRow->pRowVal);
+ taosMemoryFreeClear(pFillInfo->pResRow);
+ }
+ pFillInfo->pLinearInfo = destroyStreamFillLinearInfo(pFillInfo->pLinearInfo);
+ taosArrayDestroy(pFillInfo->delRanges);
+ taosMemoryFree(pFillInfo);
+ return NULL;
+}
+
+static void destroyStreamFillOperatorInfo(void* param) {
+ SStreamFillOperatorInfo* pInfo = (SStreamFillOperatorInfo*)param;
+ pInfo->pFillInfo = destroyStreamFillInfo(pInfo->pFillInfo);
+ pInfo->pFillSup = destroyStreamFillSupporter(pInfo->pFillSup);
+ pInfo->pRes = blockDataDestroy(pInfo->pRes);
+ pInfo->pSrcBlock = blockDataDestroy(pInfo->pSrcBlock);
+ pInfo->pDelRes = blockDataDestroy(pInfo->pDelRes);
+ pInfo->matchInfo.pList = taosArrayDestroy(pInfo->matchInfo.pList);
+ taosMemoryFree(pInfo);
+}
+
+static void resetFillWindow(SResultRowData* pRowData) {
+ pRowData->key = INT64_MIN;
+ taosMemoryFreeClear(pRowData->pRowVal);
+}
+
+void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup, void* pState, SStorageAPI* pAPI) {
+ if (pFillSup->cur.pRowVal != pFillSup->prev.pRowVal && pFillSup->cur.pRowVal != pFillSup->next.pRowVal) {
+ resetFillWindow(&pFillSup->cur);
+ } else {
+ pFillSup->cur.key = INT64_MIN;
+ pFillSup->cur.pRowVal = NULL;
+ }
+ resetFillWindow(&pFillSup->prev);
+ resetFillWindow(&pFillSup->next);
+ resetFillWindow(&pFillSup->nextNext);
+}
+
+void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) {
+ SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
+
+ void* pState = pOperator->pTaskInfo->streamInfo.pState;
+ resetPrevAndNextWindow(pFillSup, pState, pAPI);
+
+ SWinKey key = {.ts = ts, .groupId = groupId};
+ int32_t curVLen = 0;
+
+ int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&pFillSup->cur.pRowVal, &curVLen);
+ ASSERT(code == TSDB_CODE_SUCCESS);
+ pFillSup->cur.key = key.ts;
+}
+
+void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) {
+ SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
+ void* pState = pOperator->pTaskInfo->streamInfo.pState;
+ resetPrevAndNextWindow(pFillSup, pState, pAPI);
+
+ SWinKey key = {.ts = ts, .groupId = groupId};
+ void* curVal = NULL;
+ int32_t curVLen = 0;
+ int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&curVal, &curVLen);
+ ASSERT(code == TSDB_CODE_SUCCESS);
+ pFillSup->cur.key = key.ts;
+ pFillSup->cur.pRowVal = curVal;
+
+ SStreamStateCur* pCur = pAPI->stateStore.streamStateFillSeekKeyPrev(pState, &key);
+ SWinKey preKey = {.ts = INT64_MIN, .groupId = groupId};
+ void* preVal = NULL;
+ int32_t preVLen = 0;
+ code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &preKey, (const void**)&preVal, &preVLen);
+
+ if (code == TSDB_CODE_SUCCESS) {
+ pFillSup->prev.key = preKey.ts;
+ pFillSup->prev.pRowVal = preVal;
+
+ code = pAPI->stateStore.streamStateCurNext(pState, pCur);
+ ASSERT(code == TSDB_CODE_SUCCESS);
+
+ code = pAPI->stateStore.streamStateCurNext(pState, pCur);
+ if (code != TSDB_CODE_SUCCESS) {
+ pAPI->stateStore.streamStateFreeCur(pCur);
+ pCur = NULL;
+ }
+ } else {
+ pAPI->stateStore.streamStateFreeCur(pCur);
+ pCur = pAPI->stateStore.streamStateFillSeekKeyNext(pState, &key);
+ }
+
+ SWinKey nextKey = {.ts = INT64_MIN, .groupId = groupId};
+ void* nextVal = NULL;
+ int32_t nextVLen = 0;
+ code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextVLen);
+ if (code == TSDB_CODE_SUCCESS) {
+ pFillSup->next.key = nextKey.ts;
+ pFillSup->next.pRowVal = nextVal;
+ if (pFillSup->type == TSDB_FILL_PREV || pFillSup->type == TSDB_FILL_NEXT) {
+ code = pAPI->stateStore.streamStateCurNext(pState, pCur);
+ if (code == TSDB_CODE_SUCCESS) {
+ SWinKey nextNextKey = {.groupId = groupId};
+ void* nextNextVal = NULL;
+ int32_t nextNextVLen = 0;
+ code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextNextKey, (const void**)&nextNextVal, &nextNextVLen);
+ if (code == TSDB_CODE_SUCCESS) {
+ pFillSup->nextNext.key = nextNextKey.ts;
+ pFillSup->nextNext.pRowVal = nextNextVal;
+ }
+ }
+ }
+ }
+ pAPI->stateStore.streamStateFreeCur(pCur);
+}
+
+static bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; }
+static bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; }
+static bool hasNextNextWindow(SStreamFillSupporter* pFillSup) {
+ return pFillSup->nextNext.key != INT64_MIN;
+ return false;
+}
+
+static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) {
+ int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
+ for (int32_t i = 0; i < numOfCols; ++i) {
+ SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
+ SResultCellData* pCell = getResultCell(pRowVal, i);
+ if (!colDataIsNull_s(pColData, rowId)) {
+ pCell->isNull = false;
+ pCell->type = pColData->info.type;
+ pCell->bytes = pColData->info.bytes;
+ char* val = colDataGetData(pColData, rowId);
+ if (IS_VAR_DATA_TYPE(pCell->type)) {
+ memcpy(pCell->pData, val, varDataTLen(val));
+ } else {
+ memcpy(pCell->pData, val, pCell->bytes);
+ }
+ } else {
+ pCell->isNull = true;
+ }
+ }
+ pRowVal->key = ts;
+}
+
+static void calcDeltaData(SSDataBlock* pBlock, int32_t rowId, SResultRowData* pRowVal, SArray* pDelta,
+ SFillColInfo* pFillCol, int32_t numOfCol, int32_t winCount, int32_t order) {
+ for (int32_t i = 0; i < numOfCol; i++) {
+ if (!pFillCol[i].notFillCol) {
+ int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i);
+ SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
+ char* var = colDataGetData(pCol, rowId);
+ double start = 0;
+ GET_TYPED_DATA(start, double, pCol->info.type, var);
+ SResultCellData* pCell = getResultCell(pRowVal, slotId);
+ double end = 0;
+ GET_TYPED_DATA(end, double, pCell->type, pCell->pData);
+ double delta = 0;
+ if (order == TSDB_ORDER_ASC) {
+ delta = (end - start) / winCount;
+ } else {
+ delta = (start - end) / winCount;
+ }
+ taosArraySet(pDelta, slotId, &delta);
+ }
+ }
+}
+
+static void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol,
+ int32_t numOfCol) {
+ for (int32_t i = 0; i < numOfCol; i++) {
+ if (!pFillCol[i].notFillCol) {
+ int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i);
+ SResultCellData* pECell = getResultCell(pEndRow, slotId);
+ SPoint* pPoint = taosArrayGet(pEndPoins, slotId);
+ pPoint->key = pEndRow->key;
+ memcpy(pPoint->val, pECell->pData, pECell->bytes);
+ }
+ }
+}
+
+static void setFillInfoStart(TSKEY ts, SInterval* pInterval, SStreamFillInfo* pFillInfo) {
+ ts = taosTimeAdd(ts, pInterval->sliding, pInterval->slidingUnit, pInterval->precision);
+ pFillInfo->start = ts;
+}
+
+static void setFillInfoEnd(TSKEY ts, SInterval* pInterval, SStreamFillInfo* pFillInfo) {
+ ts = taosTimeAdd(ts, pInterval->sliding * -1, pInterval->slidingUnit, pInterval->precision);
+ pFillInfo->end = ts;
+}
+
+static void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo) {
+ setFillInfoStart(start, pInterval, pFillInfo);
+ pFillInfo->current = pFillInfo->start;
+ setFillInfoEnd(end, pInterval, pFillInfo);
+}
+
+void setDeleteFillValueInfo(TSKEY start, TSKEY end, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) {
+ if (!hasPrevWindow(pFillSup) || !hasNextWindow(pFillSup)) {
+ pFillInfo->needFill = false;
+ return;
+ }
+
+ TSKEY realStart = taosTimeAdd(pFillSup->prev.key, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
+ pFillSup->interval.precision);
+
+ pFillInfo->needFill = true;
+ pFillInfo->start = realStart;
+ pFillInfo->current = pFillInfo->start;
+ pFillInfo->end = end;
+ pFillInfo->pos = FILL_POS_INVALID;
+ switch (pFillInfo->type) {
+ case TSDB_FILL_NULL:
+ case TSDB_FILL_NULL_F:
+ case TSDB_FILL_SET_VALUE:
+ case TSDB_FILL_SET_VALUE_F:
+ break;
+ case TSDB_FILL_PREV:
+ pFillInfo->pResRow = &pFillSup->prev;
+ break;
+ case TSDB_FILL_NEXT:
+ pFillInfo->pResRow = &pFillSup->next;
+ break;
+ case TSDB_FILL_LINEAR: {
+ setFillKeyInfo(pFillSup->prev.key, pFillSup->next.key, &pFillSup->interval, pFillInfo);
+ pFillInfo->pLinearInfo->hasNext = false;
+ pFillInfo->pLinearInfo->nextEnd = INT64_MIN;
+ calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo,
+ pFillSup->numOfAllCols);
+ pFillInfo->pResRow = &pFillSup->prev;
+ pFillInfo->pLinearInfo->winIndex = 0;
+ } break;
+ default:
+ ASSERT(0);
+ break;
+ }
+}
+
+void copyNotFillExpData(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) {
+ for (int32_t i = pFillSup->numOfFillCols; i < pFillSup->numOfAllCols; ++i) {
+ SFillColInfo* pFillCol = pFillSup->pAllColInfo + i;
+ int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
+ SResultCellData* pCell = getResultCell(pFillInfo->pResRow, slotId);
+ SResultCellData* pCurCell = getResultCell(&pFillSup->cur, slotId);
+ pCell->isNull = pCurCell->isNull;
+ if (!pCurCell->isNull) {
+ memcpy(pCell->pData, pCurCell->pData, pCell->bytes);
+ }
+ }
+}
+
+void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillSupporter* pFillSup,
+ SStreamFillInfo* pFillInfo) {
+ pFillInfo->preRowKey = pFillSup->cur.key;
+ if (!hasPrevWindow(pFillSup) && !hasNextWindow(pFillSup)) {
+ pFillInfo->needFill = false;
+ pFillInfo->pos = FILL_POS_START;
+ return;
+ }
+ TSKEY prevWKey = INT64_MIN;
+ TSKEY nextWKey = INT64_MIN;
+ if (hasPrevWindow(pFillSup)) {
+ prevWKey = pFillSup->prev.key;
+ }
+ if (hasNextWindow(pFillSup)) {
+ nextWKey = pFillSup->next.key;
+ }
+
+ pFillInfo->needFill = true;
+ pFillInfo->pos = FILL_POS_INVALID;
+ switch (pFillInfo->type) {
+ case TSDB_FILL_NULL:
+ case TSDB_FILL_NULL_F:
+ case TSDB_FILL_SET_VALUE:
+ case TSDB_FILL_SET_VALUE_F: {
+ if (pFillSup->prev.key == pFillInfo->preRowKey) {
+ resetFillWindow(&pFillSup->prev);
+ }
+ if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) {
+ if (pFillSup->next.key == pFillInfo->nextRowKey) {
+ pFillInfo->preRowKey = INT64_MIN;
+ setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_END;
+ } else {
+ pFillInfo->needFill = false;
+ pFillInfo->pos = FILL_POS_START;
+ }
+ } else if (hasPrevWindow(pFillSup)) {
+ setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_END;
+ } else {
+ setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_START;
+ }
+ copyNotFillExpData(pFillSup, pFillInfo);
+ } break;
+ case TSDB_FILL_PREV: {
+ if (hasNextWindow(pFillSup) && ((pFillSup->next.key != pFillInfo->nextRowKey) ||
+ (pFillSup->next.key == pFillInfo->nextRowKey && hasNextNextWindow(pFillSup)) ||
+ (pFillSup->next.key == pFillInfo->nextRowKey && !hasPrevWindow(pFillSup)))) {
+ setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_START;
+ resetFillWindow(&pFillSup->prev);
+ pFillSup->prev.key = pFillSup->cur.key;
+ pFillSup->prev.pRowVal = pFillSup->cur.pRowVal;
+ } else if (hasPrevWindow(pFillSup)) {
+ setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_END;
+ pFillInfo->preRowKey = INT64_MIN;
+ }
+ pFillInfo->pResRow = &pFillSup->prev;
+ } break;
+ case TSDB_FILL_NEXT: {
+ if (hasPrevWindow(pFillSup)) {
+ setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_END;
+ resetFillWindow(&pFillSup->next);
+ pFillSup->next.key = pFillSup->cur.key;
+ pFillSup->next.pRowVal = pFillSup->cur.pRowVal;
+ pFillInfo->preRowKey = INT64_MIN;
+ } else {
+ ASSERT(hasNextWindow(pFillSup));
+ setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_START;
+ }
+ pFillInfo->pResRow = &pFillSup->next;
+ } break;
+ case TSDB_FILL_LINEAR: {
+ pFillInfo->pLinearInfo->winIndex = 0;
+ if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) {
+ setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_MID;
+ pFillInfo->pLinearInfo->nextEnd = nextWKey;
+ calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo,
+ pFillSup->numOfAllCols);
+ pFillInfo->pResRow = &pFillSup->prev;
+
+ calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pNextEndPoints, pFillSup->pAllColInfo,
+ pFillSup->numOfAllCols);
+ pFillInfo->pLinearInfo->hasNext = true;
+ } else if (hasPrevWindow(pFillSup)) {
+ setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_END;
+ pFillInfo->pLinearInfo->nextEnd = INT64_MIN;
+ calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo,
+ pFillSup->numOfAllCols);
+ pFillInfo->pResRow = &pFillSup->prev;
+ pFillInfo->pLinearInfo->hasNext = false;
+ } else {
+ ASSERT(hasNextWindow(pFillSup));
+ setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo);
+ pFillInfo->pos = FILL_POS_START;
+ pFillInfo->pLinearInfo->nextEnd = INT64_MIN;
+ calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo,
+ pFillSup->numOfAllCols);
+ pFillInfo->pResRow = &pFillSup->cur;
+ pFillInfo->pLinearInfo->hasNext = false;
+ }
+ } break;
+ default:
+ ASSERT(0);
+ break;
+ }
+ ASSERT(pFillInfo->pos != FILL_POS_INVALID);
+}
+
+static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId) {
+ SWinKey key = {.groupId = groupId, .ts = ts};
+ if (tSimpleHashGet(pFillSup->pResMap, &key, sizeof(SWinKey)) != NULL) {
+ return false;
+ }
+ tSimpleHashPut(pFillSup->pResMap, &key, sizeof(SWinKey), NULL, 0);
+ return true;
+}
+
+static bool buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFillSup, TSKEY ts, SSDataBlock* pBlock) {
+ if (pBlock->info.rows >= pBlock->info.capacity) {
+ return false;
+ }
+ uint64_t groupId = pBlock->info.id.groupId;
+ if (pFillSup->hasDelete && !checkResult(pFillSup, ts, groupId)) {
+ return true;
+ }
+ for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) {
+ SFillColInfo* pFillCol = pFillSup->pAllColInfo + i;
+ int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
+ SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, slotId);
+ SFillInfo tmpInfo = {
+ .currentKey = ts,
+ .order = TSDB_ORDER_ASC,
+ .interval = pFillSup->interval,
+ };
+ bool filled = fillIfWindowPseudoColumn(&tmpInfo, pFillCol, pColData, pBlock->info.rows);
+ if (!filled) {
+ SResultCellData* pCell = getResultCell(pResRow, slotId);
+ setRowCell(pColData, pBlock->info.rows, pCell);
+ }
+ }
+ pBlock->info.rows++;
+ return true;
+}
+
+static bool hasRemainCalc(SStreamFillInfo* pFillInfo) {
+ if (pFillInfo->current != INT64_MIN && pFillInfo->current <= pFillInfo->end) {
+ return true;
+ }
+ return false;
+}
+
+static void doStreamFillNormal(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) {
+ while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) {
+ STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current};
+ if (inWinRange(&pFillSup->winRange, &st)) {
+ buildFillResult(pFillInfo->pResRow, pFillSup, pFillInfo->current, pBlock);
+ }
+ pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
+ pFillSup->interval.precision);
+ }
+}
+
+static void doStreamFillLinear(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) {
+ while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) {
+ uint64_t groupId = pBlock->info.id.groupId;
+ SWinKey key = {.groupId = groupId, .ts = pFillInfo->current};
+ STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current};
+ if ( ( pFillSup->hasDelete && !checkResult(pFillSup, pFillInfo->current, groupId) ) || !inWinRange(&pFillSup->winRange, &st) ) {
+ pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
+ pFillSup->interval.precision);
+ pFillInfo->pLinearInfo->winIndex++;
+ continue;
+ }
+ pFillInfo->pLinearInfo->winIndex++;
+ for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) {
+ SFillColInfo* pFillCol = pFillSup->pAllColInfo + i;
+ SFillInfo tmp = {
+ .currentKey = pFillInfo->current,
+ .order = TSDB_ORDER_ASC,
+ .interval = pFillSup->interval,
+ };
+
+ int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
+ SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, slotId);
+ int16_t type = pColData->info.type;
+ SResultCellData* pCell = getResultCell(pFillInfo->pResRow, slotId);
+ int32_t index = pBlock->info.rows;
+ if (pFillCol->notFillCol) {
+ bool filled = fillIfWindowPseudoColumn(&tmp, pFillCol, pColData, index);
+ if (!filled) {
+ setRowCell(pColData, index, pCell);
+ }
+ } else {
+ if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pCell->isNull) {
+ colDataSetNULL(pColData, index);
+ continue;
+ }
+ SPoint* pEnd = taosArrayGet(pFillInfo->pLinearInfo->pEndPoints, slotId);
+ double vCell = 0;
+ SPoint start = {0};
+ start.key = pFillInfo->pResRow->key;
+ start.val = pCell->pData;
+
+ SPoint cur = {0};
+ cur.key = pFillInfo->current;
+ cur.val = taosMemoryCalloc(1, pCell->bytes);
+ taosGetLinearInterpolationVal(&cur, pCell->type, &start, pEnd, pCell->type);
+ colDataSetVal(pColData, index, (const char*)cur.val, false);
+ destroySPoint(&cur);
+ }
+ }
+ pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
+ pFillSup->interval.precision);
+ pBlock->info.rows++;
+ }
+}
+
+static void keepResultInDiscBuf(SOperatorInfo* pOperator, uint64_t groupId, SResultRowData* pRow, int32_t len) {
+ SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
+
+ SWinKey key = {.groupId = groupId, .ts = pRow->key};
+ int32_t code = pAPI->stateStore.streamStateFillPut(pOperator->pTaskInfo->streamInfo.pState, &key, pRow->pRowVal, len);
+ qDebug("===stream===fill operator save key ts:%" PRId64 " group id:%" PRIu64 " code:%d", key.ts, key.groupId, code);
+ ASSERT(code == TSDB_CODE_SUCCESS);
+}
+
+static void doStreamFillRange(SStreamFillInfo* pFillInfo, SStreamFillSupporter* pFillSup, SSDataBlock* pRes) {
+ if (pFillInfo->needFill == false) {
+ buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes);
+ return;
+ }
+
+ if (pFillInfo->pos == FILL_POS_START) {
+ if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
+ pFillInfo->pos = FILL_POS_INVALID;
+ }
+ }
+ if (pFillInfo->type != TSDB_FILL_LINEAR) {
+ doStreamFillNormal(pFillSup, pFillInfo, pRes);
+ } else {
+ doStreamFillLinear(pFillSup, pFillInfo, pRes);
+
+ if (pFillInfo->pos == FILL_POS_MID) {
+ if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
+ pFillInfo->pos = FILL_POS_INVALID;
+ }
+ }
+
+ if (pFillInfo->current > pFillInfo->end && pFillInfo->pLinearInfo->hasNext) {
+ pFillInfo->pLinearInfo->hasNext = false;
+ pFillInfo->pLinearInfo->winIndex = 0;
+ taosArraySwap(pFillInfo->pLinearInfo->pEndPoints, pFillInfo->pLinearInfo->pNextEndPoints);
+ pFillInfo->pResRow = &pFillSup->cur;
+ setFillKeyInfo(pFillSup->cur.key, pFillInfo->pLinearInfo->nextEnd, &pFillSup->interval, pFillInfo);
+ doStreamFillLinear(pFillSup, pFillInfo, pRes);
+ }
+ }
+ if (pFillInfo->pos == FILL_POS_END) {
+ if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
+ pFillInfo->pos = FILL_POS_INVALID;
+ }
+ }
+}
+
+void keepBlockRowInDiscBuf(SOperatorInfo* pOperator, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, TSKEY* tsCol,
+ int32_t rowId, uint64_t groupId, int32_t rowSize) {
+ TSKEY ts = tsCol[rowId];
+ pFillInfo->nextRowKey = ts;
+ SResultRowData tmpNextRow = {.key = ts};
+ tmpNextRow.pRowVal = taosMemoryCalloc(1, rowSize);
+ transBlockToResultRow(pBlock, rowId, ts, &tmpNextRow);
+ keepResultInDiscBuf(pOperator, groupId, &tmpNextRow, rowSize);
+ taosMemoryFreeClear(tmpNextRow.pRowVal);
+}
+
+static void doFillResults(SOperatorInfo* pOperator, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo,
+ SSDataBlock* pBlock, TSKEY* tsCol, int32_t rowId, SSDataBlock* pRes) {
+ uint64_t groupId = pBlock->info.id.groupId;
+ getWindowFromDiscBuf(pOperator, tsCol[rowId], groupId, pFillSup);
+ if (pFillSup->prev.key == pFillInfo->preRowKey) {
+ resetFillWindow(&pFillSup->prev);
+ }
+ setFillValueInfo(pBlock, tsCol[rowId], rowId, pFillSup, pFillInfo);
+ doStreamFillRange(pFillInfo, pFillSup, pRes);
+}
+
+static void doStreamFillImpl(SOperatorInfo* pOperator) {
+ SStreamFillOperatorInfo* pInfo = pOperator->info;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SStreamFillSupporter* pFillSup = pInfo->pFillSup;
+ SStreamFillInfo* pFillInfo = pInfo->pFillInfo;
+ SSDataBlock* pBlock = pInfo->pSrcBlock;
+ uint64_t groupId = pBlock->info.id.groupId;
+ SSDataBlock* pRes = pInfo->pRes;
+ SColumnInfoData* pTsCol = taosArrayGet(pInfo->pSrcBlock->pDataBlock, pInfo->primaryTsCol);
+ TSKEY* tsCol = (TSKEY*)pTsCol->pData;
+ pRes->info.id.groupId = groupId;
+ pInfo->srcRowIndex++;
+
+ if (pInfo->srcRowIndex == 0) {
+ keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex, groupId, pFillSup->rowSize);
+ pInfo->srcRowIndex++;
+ }
+
+ while (pInfo->srcRowIndex < pBlock->info.rows) {
+ TSKEY ts = tsCol[pInfo->srcRowIndex];
+ keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex, groupId, pFillSup->rowSize);
+ doFillResults(pOperator, pFillSup, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex - 1, pRes);
+ if (pInfo->pRes->info.rows == pInfo->pRes->info.capacity) {
+ blockDataUpdateTsWindow(pRes, pInfo->primaryTsCol);
+ return;
+ }
+ pInfo->srcRowIndex++;
+ }
+ doFillResults(pOperator, pFillSup, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex - 1, pRes);
+ blockDataUpdateTsWindow(pRes, pInfo->primaryTsCol);
+ blockDataCleanup(pInfo->pSrcBlock);
+}
+
+static void buildDeleteRange(SOperatorInfo* pOp, TSKEY start, TSKEY end, uint64_t groupId, SSDataBlock* delRes) {
+ SStorageAPI* pAPI = &pOp->pTaskInfo->storageAPI;
+ void* pState = pOp->pTaskInfo->streamInfo.pState;
+
+ SSDataBlock* pBlock = delRes;
+ SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
+ SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
+ SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX);
+ SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
+ SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
+ SColumnInfoData* pTbNameCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
+ colDataSetVal(pStartCol, pBlock->info.rows, (const char*)&start, false);
+ colDataSetVal(pEndCol, pBlock->info.rows, (const char*)&end, false);
+ colDataSetNULL(pUidCol, pBlock->info.rows);
+ colDataSetVal(pGroupCol, pBlock->info.rows, (const char*)&groupId, false);
+ colDataSetNULL(pCalStartCol, pBlock->info.rows);
+ colDataSetNULL(pCalEndCol, pBlock->info.rows);
+
+ SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
+
+ void* tbname = NULL;
+ pAPI->stateStore.streamStateGetParName(pOp->pTaskInfo->streamInfo.pState, groupId, &tbname);
+ if (tbname == NULL) {
+ colDataSetNULL(pTableCol, pBlock->info.rows);
+ } else {
+ char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN];
+ STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName));
+ colDataSetVal(pTableCol, pBlock->info.rows, (const char*)parTbName, false);
+ pAPI->stateStore.streamStateFreeVal(tbname);
+ }
+
+ pBlock->info.rows++;
+}
+
+static void buildDeleteResult(SOperatorInfo* pOperator, TSKEY startTs, TSKEY endTs, uint64_t groupId,
+ SSDataBlock* delRes) {
+ SStreamFillOperatorInfo* pInfo = pOperator->info;
+ SStreamFillSupporter* pFillSup = pInfo->pFillSup;
+ if (hasPrevWindow(pFillSup)) {
+ TSKEY start = getNextWindowTs(pFillSup->prev.key, &pFillSup->interval);
+ buildDeleteRange(pOperator, start, endTs, groupId, delRes);
+ } else if (hasNextWindow(pFillSup)) {
+ TSKEY end = getPrevWindowTs(pFillSup->next.key, &pFillSup->interval);
+ buildDeleteRange(pOperator, startTs, end, groupId, delRes);
+ } else {
+ buildDeleteRange(pOperator, startTs, endTs, groupId, delRes);
+ }
+}
+
+static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKEY endTs, uint64_t groupId) {
+ SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
+ SStreamFillOperatorInfo* pInfo = pOperator->info;
+ getWindowFromDiscBuf(pOperator, startTs, groupId, pInfo->pFillSup);
+ setDeleteFillValueInfo(startTs, endTs, pInfo->pFillSup, pInfo->pFillInfo);
+ SWinKey key = {.ts = startTs, .groupId = groupId};
+ if (!pInfo->pFillInfo->needFill) {
+ pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key);
+ buildDeleteResult(pOperator, startTs, endTs, groupId, pInfo->pDelRes);
+ } else {
+ STimeRange tw = {
+ .skey = startTs,
+ .ekey = endTs,
+ .groupId = groupId,
+ };
+ taosArrayPush(pInfo->pFillInfo->delRanges, &tw);
+ while (key.ts <= endTs) {
+ key.ts = taosTimeAdd(key.ts, pInfo->pFillSup->interval.sliding, pInfo->pFillSup->interval.slidingUnit,
+ pInfo->pFillSup->interval.precision);
+ tSimpleHashPut(pInfo->pFillSup->pResMap, &key, sizeof(SWinKey), NULL, 0);
+ }
+ }
+}
+
+static void doDeleteFillFinalize(SOperatorInfo* pOperator) {
+ SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
+
+ SStreamFillOperatorInfo* pInfo = pOperator->info;
+ SStreamFillInfo* pFillInfo = pInfo->pFillInfo;
+ int32_t size = taosArrayGetSize(pFillInfo->delRanges);
+ tSimpleHashClear(pInfo->pFillSup->pResMap);
+ for (; pFillInfo->delIndex < size; pFillInfo->delIndex++) {
+ STimeRange* range = taosArrayGet(pFillInfo->delRanges, pFillInfo->delIndex);
+ if (pInfo->pRes->info.id.groupId != 0 && pInfo->pRes->info.id.groupId != range->groupId) {
+ return;
+ }
+ getWindowFromDiscBuf(pOperator, range->skey, range->groupId, pInfo->pFillSup);
+ setDeleteFillValueInfo(range->skey, range->ekey, pInfo->pFillSup, pInfo->pFillInfo);
+ if (pInfo->pFillInfo->needFill) {
+ doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes);
+ pInfo->pRes->info.id.groupId = range->groupId;
+ }
+ SWinKey key = {.ts = range->skey, .groupId = range->groupId};
+ pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key);
+ }
+}
+
+static void doDeleteFillResult(SOperatorInfo* pOperator) {
+ SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI;
+
+ SStreamFillOperatorInfo* pInfo = pOperator->info;
+ SStreamFillInfo* pFillInfo = pInfo->pFillInfo;
+ SSDataBlock* pBlock = pInfo->pSrcDelBlock;
+
+ SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
+ TSKEY* tsStarts = (TSKEY*)pStartCol->pData;
+ SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ uint64_t* groupIds = (uint64_t*)pGroupCol->pData;
+ while (pInfo->srcDelRowIndex < pBlock->info.rows) {
+ TSKEY ts = tsStarts[pInfo->srcDelRowIndex];
+ TSKEY endTs = ts;
+ uint64_t groupId = groupIds[pInfo->srcDelRowIndex];
+ SWinKey key = {.ts = ts, .groupId = groupId};
+ SStreamStateCur* pCur = pAPI->stateStore.streamStateGetAndCheckCur(pOperator->pTaskInfo->streamInfo.pState, &key);
+
+ if (!pCur) {
+ pInfo->srcDelRowIndex++;
+ continue;
+ }
+
+ SWinKey nextKey = {.groupId = groupId, .ts = ts};
+ while (pInfo->srcDelRowIndex < pBlock->info.rows) {
+ TSKEY delTs = tsStarts[pInfo->srcDelRowIndex];
+ uint64_t delGroupId = groupIds[pInfo->srcDelRowIndex];
+ int32_t code = TSDB_CODE_SUCCESS;
+ if (groupId != delGroupId) {
+ break;
+ }
+ if (delTs > nextKey.ts) {
+ break;
+ }
+
+ SWinKey delKey = {.groupId = delGroupId, .ts = delTs};
+ if (delTs == nextKey.ts) {
+ code = pAPI->stateStore.streamStateCurNext(pOperator->pTaskInfo->streamInfo.pState, pCur);
+ if (code == TSDB_CODE_SUCCESS) {
+ code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, NULL, NULL);
+ }
+ // ts will be deleted later
+ if (delTs != ts) {
+ pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &delKey);
+ pAPI->stateStore.streamStateFreeCur(pCur);
+ pCur = pAPI->stateStore.streamStateGetAndCheckCur(pOperator->pTaskInfo->streamInfo.pState, &nextKey);
+ }
+ endTs = TMAX(delTs, nextKey.ts - 1);
+ if (code != TSDB_CODE_SUCCESS) {
+ break;
+ }
+ }
+ pInfo->srcDelRowIndex++;
+ }
+
+ pAPI->stateStore.streamStateFreeCur(pCur);
+ doDeleteFillResultImpl(pOperator, ts, endTs, groupId);
+ }
+
+ pFillInfo->current = pFillInfo->end + 1;
+}
+
+static void resetStreamFillInfo(SStreamFillOperatorInfo* pInfo) {
+ tSimpleHashClear(pInfo->pFillSup->pResMap);
+ pInfo->pFillSup->hasDelete = false;
+ taosArrayClear(pInfo->pFillInfo->delRanges);
+ pInfo->pFillInfo->delIndex = 0;
+}
+
+static void doApplyStreamScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pSrcBlock, SSDataBlock* pDstBlock) {
+ SStreamFillOperatorInfo* pInfo = pOperator->info;
+ SExprSupp* pSup = &pOperator->exprSupp;
+
+ blockDataCleanup(pDstBlock);
+ blockDataEnsureCapacity(pDstBlock, pSrcBlock->info.rows);
+ setInputDataBlock(pSup, pSrcBlock, TSDB_ORDER_ASC, MAIN_SCAN, false);
+ projectApplyFunctions(pSup->pExprInfo, pDstBlock, pSrcBlock, pSup->pCtx, pSup->numOfExprs, NULL);
+
+ pDstBlock->info.rows = 0;
+ pSup = &pInfo->pFillSup->notFillExprSup;
+ setInputDataBlock(pSup, pSrcBlock, TSDB_ORDER_ASC, MAIN_SCAN, false);
+ projectApplyFunctions(pSup->pExprInfo, pDstBlock, pSrcBlock, pSup->pCtx, pSup->numOfExprs, NULL);
+ pDstBlock->info.id.groupId = pSrcBlock->info.id.groupId;
+
+ blockDataUpdateTsWindow(pDstBlock, pInfo->primaryTsCol);
+}
+
+static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) {
+ SStreamFillOperatorInfo* pInfo = pOperator->info;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+
+ if (pOperator->status == OP_EXEC_DONE) {
+ return NULL;
+ }
+ blockDataCleanup(pInfo->pRes);
+ if (hasRemainCalc(pInfo->pFillInfo) ||
+ (pInfo->pFillInfo->pos != FILL_POS_INVALID && pInfo->pFillInfo->needFill == true)) {
+ doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes);
+ if (pInfo->pRes->info.rows > 0) {
+ printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
+ return pInfo->pRes;
+ }
+ }
+ if (pOperator->status == OP_RES_TO_RETURN) {
+ doDeleteFillFinalize(pOperator);
+ if (pInfo->pRes->info.rows > 0) {
+ printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
+ return pInfo->pRes;
+ }
+ setOperatorCompleted(pOperator);
+ resetStreamFillInfo(pInfo);
+ return NULL;
+ }
+
+ SSDataBlock* fillResult = NULL;
+ SOperatorInfo* downstream = pOperator->pDownstream[0];
+ while (1) {
+ if (pInfo->srcRowIndex >= pInfo->pSrcBlock->info.rows || pInfo->pSrcBlock->info.rows == 0) {
+ // If there are delete datablocks, we receive them first.
+ SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0);
+ if (pBlock == NULL) {
+ pOperator->status = OP_RES_TO_RETURN;
+ pInfo->pFillInfo->preRowKey = INT64_MIN;
+ if (pInfo->pRes->info.rows > 0) {
+ printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
+ return pInfo->pRes;
+ }
+ break;
+ }
+ printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo));
+
+ if (pInfo->pFillInfo->curGroupId != pBlock->info.id.groupId) {
+ pInfo->pFillInfo->curGroupId = pBlock->info.id.groupId;
+ pInfo->pFillInfo->preRowKey = INT64_MIN;
+ }
+
+ pInfo->pFillSup->winRange = pTaskInfo->streamInfo.fillHistoryWindow;
+ if (pInfo->pFillSup->winRange.ekey <= 0) {
+ pInfo->pFillSup->winRange.ekey = INT64_MAX;
+ }
+
+ switch (pBlock->info.type) {
+ case STREAM_RETRIEVE:
+ return pBlock;
+ case STREAM_DELETE_RESULT: {
+ pInfo->pSrcDelBlock = pBlock;
+ pInfo->srcDelRowIndex = 0;
+ blockDataCleanup(pInfo->pDelRes);
+ pInfo->pFillSup->hasDelete = true;
+ doDeleteFillResult(pOperator);
+ if (pInfo->pDelRes->info.rows > 0) {
+ printDataBlock(pInfo->pDelRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
+ return pInfo->pDelRes;
+ }
+ continue;
+ } break;
+ case STREAM_NORMAL:
+ case STREAM_INVALID:
+ case STREAM_PULL_DATA: {
+ doApplyStreamScalarCalculation(pOperator, pBlock, pInfo->pSrcBlock);
+ memcpy(pInfo->pSrcBlock->info.parTbName, pBlock->info.parTbName, TSDB_TABLE_NAME_LEN);
+ pInfo->srcRowIndex = -1;
+ } break;
+ case STREAM_CHECKPOINT:
+ case STREAM_CREATE_CHILD_TABLE: {
+ return pBlock;
+ } break;
+ default:
+ ASSERTS(false, "invalid SSDataBlock type");
+ }
+ }
+
+ doStreamFillImpl(pOperator);
+ doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, &pInfo->matchInfo);
+ memcpy(pInfo->pRes->info.parTbName, pInfo->pSrcBlock->info.parTbName, TSDB_TABLE_NAME_LEN);
+ pOperator->resultInfo.totalRows += pInfo->pRes->info.rows;
+ if (pInfo->pRes->info.rows > 0) {
+ break;
+ }
+ }
+ if (pOperator->status == OP_RES_TO_RETURN) {
+ doDeleteFillFinalize(pOperator);
+ }
+
+ if (pInfo->pRes->info.rows == 0) {
+ setOperatorCompleted(pOperator);
+ resetStreamFillInfo(pInfo);
+ return NULL;
+ }
+
+ pOperator->resultInfo.totalRows += pInfo->pRes->info.rows;
+ printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
+ return pInfo->pRes;
+}
+
+static int32_t initResultBuf(SStreamFillSupporter* pFillSup) {
+ pFillSup->rowSize = sizeof(SResultCellData) * pFillSup->numOfAllCols;
+ for (int i = 0; i < pFillSup->numOfAllCols; i++) {
+ SFillColInfo* pCol = &pFillSup->pAllColInfo[i];
+ SResSchema* pSchema = &pCol->pExpr->base.resSchema;
+ pFillSup->rowSize += pSchema->bytes;
+ }
+ pFillSup->next.key = INT64_MIN;
+ pFillSup->nextNext.key = INT64_MIN;
+ pFillSup->prev.key = INT64_MIN;
+ pFillSup->cur.key = INT64_MIN;
+ pFillSup->next.pRowVal = NULL;
+ pFillSup->nextNext.pRowVal = NULL;
+ pFillSup->prev.pRowVal = NULL;
+ pFillSup->cur.pRowVal = NULL;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNode, SInterval* pInterval,
+ SExprInfo* pFillExprInfo, int32_t numOfFillCols, SStorageAPI* pAPI) {
+ SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter));
+ if (!pFillSup) {
+ return NULL;
+ }
+ pFillSup->numOfFillCols = numOfFillCols;
+ int32_t numOfNotFillCols = 0;
+ SExprInfo* noFillExprInfo = createExprInfo(pPhyFillNode->pNotFillExprs, NULL, &numOfNotFillCols);
+ pFillSup->pAllColInfo = createFillColInfo(pFillExprInfo, pFillSup->numOfFillCols, noFillExprInfo, numOfNotFillCols,
+ (const SNodeListNode*)(pPhyFillNode->pValues));
+ pFillSup->type = convertFillType(pPhyFillNode->mode);
+ pFillSup->numOfAllCols = pFillSup->numOfFillCols + numOfNotFillCols;
+ pFillSup->interval = *pInterval;
+ pFillSup->pAPI = pAPI;
+
+ int32_t code = initResultBuf(pFillSup);
+ if (code != TSDB_CODE_SUCCESS) {
+ destroyStreamFillSupporter(pFillSup);
+ return NULL;
+ }
+
+ SExprInfo* noFillExpr = createExprInfo(pPhyFillNode->pNotFillExprs, NULL, &numOfNotFillCols);
+ code = initExprSupp(&pFillSup->notFillExprSup, noFillExpr, numOfNotFillCols, &pAPI->functionStore);
+ if (code != TSDB_CODE_SUCCESS) {
+ destroyStreamFillSupporter(pFillSup);
+ return NULL;
+ }
+
+ _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+ pFillSup->pResMap = tSimpleHashInit(16, hashFn);
+ pFillSup->hasDelete = false;
+ return pFillSup;
+}
+
+SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pRes) {
+ SStreamFillInfo* pFillInfo = taosMemoryCalloc(1, sizeof(SStreamFillInfo));
+ pFillInfo->start = INT64_MIN;
+ pFillInfo->current = INT64_MIN;
+ pFillInfo->end = INT64_MIN;
+ pFillInfo->preRowKey = INT64_MIN;
+ pFillInfo->needFill = false;
+ pFillInfo->pLinearInfo = taosMemoryCalloc(1, sizeof(SStreamFillLinearInfo));
+ pFillInfo->pLinearInfo->hasNext = false;
+ pFillInfo->pLinearInfo->nextEnd = INT64_MIN;
+ pFillInfo->pLinearInfo->pEndPoints = NULL;
+ pFillInfo->pLinearInfo->pNextEndPoints = NULL;
+ if (pFillSup->type == TSDB_FILL_LINEAR) {
+ pFillInfo->pLinearInfo->pEndPoints = taosArrayInit(pFillSup->numOfAllCols, sizeof(SPoint));
+ pFillInfo->pLinearInfo->pNextEndPoints = taosArrayInit(pFillSup->numOfAllCols, sizeof(SPoint));
+ for (int32_t i = 0; i < pFillSup->numOfAllCols; i++) {
+ SColumnInfoData* pColData = taosArrayGet(pRes->pDataBlock, i);
+ SPoint value = {0};
+ value.val = taosMemoryCalloc(1, pColData->info.bytes);
+ taosArrayPush(pFillInfo->pLinearInfo->pEndPoints, &value);
+
+ value.val = taosMemoryCalloc(1, pColData->info.bytes);
+ taosArrayPush(pFillInfo->pLinearInfo->pNextEndPoints, &value);
+ }
+ }
+ pFillInfo->pLinearInfo->winIndex = 0;
+
+ pFillInfo->pResRow = NULL;
+ if (pFillSup->type == TSDB_FILL_SET_VALUE || pFillSup->type == TSDB_FILL_SET_VALUE_F ||
+ pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) {
+ pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData));
+ pFillInfo->pResRow->key = INT64_MIN;
+ pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize);
+ for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) {
+ SColumnInfoData* pColData = taosArrayGet(pRes->pDataBlock, i);
+ SResultCellData* pCell = getResultCell(pFillInfo->pResRow, i);
+ pCell->bytes = pColData->info.bytes;
+ pCell->type = pColData->info.type;
+ }
+ }
+
+ pFillInfo->type = pFillSup->type;
+ pFillInfo->delRanges = taosArrayInit(16, sizeof(STimeRange));
+ pFillInfo->delIndex = 0;
+ pFillInfo->curGroupId = 0;
+ return pFillInfo;
+}
+
+SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysiNode* pPhyFillNode,
+ SExecTaskInfo* pTaskInfo) {
+ SStreamFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamFillOperatorInfo));
+ SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
+ if (pInfo == NULL || pOperator == NULL) {
+ goto _error;
+ }
+
+ SInterval* pInterval = &((SStreamIntervalOperatorInfo*)downstream->info)->interval;
+ int32_t numOfFillCols = 0;
+ SExprInfo* pFillExprInfo = createExprInfo(pPhyFillNode->pFillExprs, NULL, &numOfFillCols);
+ pInfo->pFillSup = initStreamFillSup(pPhyFillNode, pInterval, pFillExprInfo, numOfFillCols, &pTaskInfo->storageAPI);
+ if (!pInfo->pFillSup) {
+ goto _error;
+ }
+
+ initResultSizeInfo(&pOperator->resultInfo, 4096);
+ pInfo->pRes = createDataBlockFromDescNode(pPhyFillNode->node.pOutputDataBlockDesc);
+ pInfo->pSrcBlock = createDataBlockFromDescNode(pPhyFillNode->node.pOutputDataBlockDesc);
+ blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
+ blockDataEnsureCapacity(pInfo->pSrcBlock, pOperator->resultInfo.capacity);
+
+ pInfo->pFillInfo = initStreamFillInfo(pInfo->pFillSup, pInfo->pRes);
+ if (!pInfo->pFillInfo) {
+ goto _error;
+ }
+
+ if (pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE || pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE_F) {
+ for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) {
+ SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i;
+ int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
+ SResultCellData* pCell = getResultCell(pInfo->pFillInfo->pResRow, slotId);
+ SVariant* pVar = &(pFillCol->fillVal);
+ if (pCell->type == TSDB_DATA_TYPE_FLOAT) {
+ float v = 0;
+ GET_TYPED_DATA(v, float, pVar->nType, &pVar->i);
+ SET_TYPED_DATA(pCell->pData, pCell->type, v);
+ } else if (IS_FLOAT_TYPE(pCell->type)) {
+ double v = 0;
+ GET_TYPED_DATA(v, double, pVar->nType, &pVar->i);
+ SET_TYPED_DATA(pCell->pData, pCell->type, v);
+ } else if (IS_INTEGER_TYPE(pCell->type)) {
+ int64_t v = 0;
+ GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i);
+ SET_TYPED_DATA(pCell->pData, pCell->type, v);
+ } else {
+ pCell->isNull = true;
+ }
+ }
+ } else if (pInfo->pFillInfo->type == TSDB_FILL_NULL || pInfo->pFillInfo->type == TSDB_FILL_NULL_F) {
+ for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) {
+ SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i;
+ int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
+ SResultCellData* pCell = getResultCell(pInfo->pFillInfo->pResRow, slotId);
+ pCell->isNull = true;
+ }
+ }
+
+ pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT);
+ blockDataEnsureCapacity(pInfo->pDelRes, pOperator->resultInfo.capacity);
+
+ pInfo->primaryTsCol = ((STargetNode*)pPhyFillNode->pWStartTs)->slotId;
+ pInfo->primarySrcSlotId = ((SColumnNode*)((STargetNode*)pPhyFillNode->pWStartTs)->pExpr)->slotId;
+
+ int32_t numOfOutputCols = 0;
+ int32_t code = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc,
+ &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
+ code = filterInitFromNode((SNode*)pPhyFillNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
+ code = initExprSupp(&pOperator->exprSupp, pFillExprInfo, numOfFillCols, &pTaskInfo->storageAPI.functionStore);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
+ pInfo->srcRowIndex = -1;
+ setOperatorInfo(pOperator, "StreamFillOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, false, OP_NOT_OPENED, pInfo,
+ pTaskInfo);
+ pOperator->fpSet =
+ createOperatorFpSet(optrDummyOpenFn, doStreamFill, NULL, destroyStreamFillOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
+ setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState);
+
+ code = appendDownstream(pOperator, &downstream, 1);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+ return pOperator;
+
+_error:
+ destroyStreamFillOperatorInfo(pInfo);
+ taosMemoryFreeClear(pOperator);
+ pTaskInfo->code = code;
+ return NULL;
+}
diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c
index 2838d005ab..a05e6fbfb8 100644
--- a/source/libs/executor/src/streamtimewindowoperator.c
+++ b/source/libs/executor/src/streamtimewindowoperator.c
@@ -1281,8 +1281,8 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
tSimpleHashCleanup(pInfo->pUpdatedMap);
pInfo->pUpdatedMap = NULL;
}
- qInfo("%s task is killed, code %s", GET_TASKID(pTaskInfo), tstrerror(pTaskInfo->code));
- T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ qInfo("===stream=== %s task is killed, code %s", GET_TASKID(pTaskInfo), tstrerror(pTaskInfo->code));
+ return NULL;
}
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
@@ -2533,7 +2533,6 @@ int32_t encodeSResultWindowInfo(void** buf, SResultWindowInfo* key, int32_t outL
void* decodeSResultWindowInfo(void* buf, SResultWindowInfo* key, int32_t outLen) {
buf = taosDecodeFixedBool(buf, &key->isOutput);
- key->pStatePos->pRowBuff = NULL;
buf = decodeSSessionKey(buf, &key->sessionWin);
return buf;
}
@@ -2591,6 +2590,7 @@ void* doStreamSessionDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOpera
if (!pInfo) {
return buf;
}
+ SStreamAggSupporter* pAggSup = &pInfo->streamAggSup;
// 5.checksum
if (isParent) {
@@ -2609,6 +2609,8 @@ void* doStreamSessionDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOpera
SSessionKey key = {0};
SResultWindowInfo winfo = {0};
buf = decodeSSessionKey(buf, &key);
+ pAggSup->stateStore.streamStateSessionAddIfNotExist(pAggSup->pState, &winfo.sessionWin, pAggSup->gap,
+ (void**)&winfo.pStatePos, &pAggSup->resultRowSize);
buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize);
tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo));
}
@@ -2992,6 +2994,8 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
pInfo->recvGetAll = false;
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION;
+ setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, true,
+ OP_NOT_OPENED, pInfo, pTaskInfo);
// for stream
void* buff = NULL;
int32_t len = 0;
@@ -3002,8 +3006,6 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
doStreamSessionDecodeOpState(buff, len, pOperator, true);
taosMemoryFree(buff);
}
- setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, true,
- OP_NOT_OPENED, pInfo, pTaskInfo);
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamSessionAgg, NULL, destroyStreamSessionAggOperatorInfo,
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
setOperatorStreamStateFn(pOperator, streamSessionReleaseState, streamSessionReloadState);
@@ -3538,6 +3540,7 @@ void* doStreamStateDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperato
if (!pInfo) {
return buf;
}
+ SStreamAggSupporter* pAggSup = &pInfo->streamAggSup;
// 5.checksum
if (isParent) {
@@ -3556,6 +3559,9 @@ void* doStreamStateDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperato
SSessionKey key = {0};
SResultWindowInfo winfo = {0};
buf = decodeSSessionKey(buf, &key);
+ pAggSup->stateStore.streamStateStateAddIfNotExist(pAggSup->pState, &winfo.sessionWin, NULL,
+ pAggSup->stateKeySize, compareStateKey,
+ (void**)&winfo.pStatePos, &pAggSup->resultRowSize);
buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize);
tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo));
}
@@ -3873,6 +3879,8 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT);
pInfo->recvGetAll = false;
+ setOperatorInfo(pOperator, "StreamStateAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, true, OP_NOT_OPENED,
+ pInfo, pTaskInfo);
// for stream
void* buff = NULL;
int32_t len = 0;
@@ -3884,8 +3892,6 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
taosMemoryFree(buff);
}
- setOperatorInfo(pOperator, "StreamStateAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, true, OP_NOT_OPENED,
- pInfo, pTaskInfo);
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamStateAgg, NULL, destroyStreamStateOperatorInfo,
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
setOperatorStreamStateFn(pOperator, streamStateReleaseState, streamStateReloadState);
@@ -4326,7 +4332,8 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) {
pInfo->pUpdatedMap = NULL;
}
- T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ qInfo("===stream=== %s task is killed, code %s", GET_TASKID(pTaskInfo), tstrerror(pTaskInfo->code));
+ return NULL;
}
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c
index 9ff903cdb9..82881dcd14 100644
--- a/source/libs/executor/src/tsort.c
+++ b/source/libs/executor/src/tsort.c
@@ -32,6 +32,32 @@ struct STupleHandle {
int32_t rowIndex;
};
+typedef struct SSortMemFileRegion {
+ int64_t fileOffset;
+ int32_t regionSize;
+
+ int32_t bufRegOffset;
+ int32_t bufLen;
+ char* buf;
+} SSortMemFileRegion;
+
+typedef struct SSortMemFile {
+ char* writeBuf;
+ int32_t writeBufSize;
+ int64_t writeFileOffset;
+
+ int32_t currRegionId;
+ int32_t currRegionOffset;
+ bool bRegionDirty;
+
+ SArray* aFileRegions;
+ int32_t cacheSize;
+ int32_t blockSize;
+
+ FILE* pTdFile;
+ char memFilePath[PATH_MAX];
+} SSortMemFile;
+
struct SSortHandle {
int32_t type;
int32_t pageSize;
@@ -76,10 +102,21 @@ struct SSortHandle {
bool (*abortCheckFn)(void* param);
void* abortCheckParam;
+ bool bSortByRowId;
+ SSortMemFile* pExtRowsMemFile;
+ int32_t extRowBytes;
+ int32_t extRowsPageSize;
+ int32_t extRowsMemSize;
+ int32_t srcTsSlotId;
+ SBlockOrderInfo extRowsOrderInfo;
+
void (*mergeLimitReachedFn)(uint64_t tableUid, void* param);
void* mergeLimitReachedParam;
};
+static int32_t destroySortMemFile(SSortHandle* pHandle);
+static int32_t getRowBufFromExtMemFile(SSortHandle* pHandle, int32_t regionId, int32_t tupleOffset, int32_t rowLen,
+ char** ppRow, bool* pFreeRow);
void tsortSetSingleTableMerge(SSortHandle* pHandle) {
pHandle->singleTableMerge = true;
}
@@ -189,6 +226,7 @@ void destroyTuple(void* t) {
}
}
+
/**
*
* @param type
@@ -202,7 +240,7 @@ SSortHandle* tsortCreateSortHandle(SArray* pSortInfo, int32_t type, int32_t page
pSortHandle->type = type;
pSortHandle->pageSize = pageSize;
pSortHandle->numOfPages = numOfPages;
- pSortHandle->pSortInfo = pSortInfo;
+ pSortHandle->pSortInfo = taosArrayDup(pSortInfo, NULL);
pSortHandle->loops = 0;
pSortHandle->pqMaxTupleLength = pqMaxTupleLength;
@@ -305,6 +343,10 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) {
qDebug("all source fetch time: %" PRId64 "us num:%" PRId64 " %s", fetchUs, fetchNum, pSortHandle->idStr);
taosArrayDestroy(pSortHandle->pOrderedSource);
+ if (pSortHandle->pExtRowsMemFile != NULL) {
+ destroySortMemFile(pSortHandle);
+ }
+ taosArrayDestroy(pSortHandle->pSortInfo);
taosMemoryFreeClear(pSortHandle);
}
@@ -851,6 +893,389 @@ static int32_t createPageBuf(SSortHandle* pHandle) {
return 0;
}
+void tsortAppendTupleToBlock(SSortHandle* pHandle, SSDataBlock* pBlock, STupleHandle* pTupleHandle) {
+ if (pHandle->bSortByRowId) {
+ int32_t regionId = *(int32_t*)tsortGetValue(pTupleHandle, 1);
+ int32_t offset = *(int32_t*)tsortGetValue(pTupleHandle, 2);
+ int32_t length = *(int32_t*)tsortGetValue(pTupleHandle, 3);
+
+ char* buf = NULL;
+ bool bFreeRow = false;
+ getRowBufFromExtMemFile(pHandle, regionId, offset, length, &buf, &bFreeRow);
+ int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
+ char* isNull = (char*)buf;
+ char* pStart = (char*)buf + sizeof(int8_t) * numOfCols;
+ for (int32_t i = 0; i < numOfCols; ++i) {
+ SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, i);
+
+ if (!isNull[i]) {
+ colDataSetVal(pColInfo, pBlock->info.rows, pStart, false);
+ if (pColInfo->info.type == TSDB_DATA_TYPE_JSON) {
+ int32_t dataLen = getJsonValueLen(pStart);
+ pStart += dataLen;
+ } else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
+ pStart += varDataTLen(pStart);
+ } else {
+ int32_t bytes = pColInfo->info.bytes;
+ pStart += bytes;
+ }
+ } else {
+ colDataSetNULL(pColInfo, pBlock->info.rows);
+ }
+ }
+ if (bFreeRow) {
+ taosMemoryFree(buf);
+ }
+ if (*(int32_t*)pStart != pStart - buf) {
+ qError("table merge scan row buf deserialization. length error %d != %d ", *(int32_t*)pStart,
+ (int32_t)(pStart - buf));
+ };
+
+ pBlock->info.dataLoad = 1;
+ pBlock->info.scanFlag = ((SDataBlockInfo*)tsortGetBlockInfo(pTupleHandle))->scanFlag;
+ pBlock->info.rows += 1;
+
+ } else {
+ for (int32_t i = 0; i < taosArrayGetSize(pBlock->pDataBlock); ++i) {
+ SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, i);
+ bool isNull = tsortIsNullVal(pTupleHandle, i);
+ if (isNull) {
+ colDataSetNULL(pColInfo, pBlock->info.rows);
+ } else {
+ char* pData = tsortGetValue(pTupleHandle, i);
+ if (pData != NULL) {
+ colDataSetVal(pColInfo, pBlock->info.rows, pData, false);
+ }
+ }
+ }
+
+ pBlock->info.dataLoad = 1;
+ pBlock->info.scanFlag = ((SDataBlockInfo*)tsortGetBlockInfo(pTupleHandle))->scanFlag;
+ pBlock->info.rows += 1;
+ }
+}
+
+static int32_t blockRowToBuf(SSDataBlock* pBlock, int32_t rowIdx, char* buf) {
+ size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
+
+ char* isNull = (char*)buf;
+ char* pStart = (char*)buf + sizeof(int8_t) * numOfCols;
+ for (int32_t i = 0; i < numOfCols; ++i) {
+ SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, i);
+ if (colDataIsNull_s(pCol, rowIdx)) {
+ isNull[i] = 1;
+ continue;
+ }
+
+ isNull[i] = 0;
+ char* pData = colDataGetData(pCol, rowIdx);
+ if (pCol->info.type == TSDB_DATA_TYPE_JSON) {
+ if (pCol->pData) {
+ int32_t dataLen = getJsonValueLen(pData);
+ memcpy(pStart, pData, dataLen);
+ pStart += dataLen;
+ } else {
+ // the column that is pre-allocated has no data and has offset
+ *pStart = 0;
+ pStart += 1;
+ }
+ } else if (IS_VAR_DATA_TYPE(pCol->info.type)) {
+ if (pCol->pData) {
+ varDataCopy(pStart, pData);
+ pStart += varDataTLen(pData);
+ } else {
+ // the column that is pre-allocated has no data and has offset
+ *(VarDataLenT*)(pStart) = 0;
+ pStart += VARSTR_HEADER_SIZE;
+ }
+ } else {
+ int32_t bytes = pCol->info.bytes;
+ memcpy(pStart, pData, bytes);
+ pStart += bytes;
+ }
+ }
+ *(int32_t*)pStart = (char*)pStart - (char*)buf;
+ pStart += sizeof(int32_t);
+ return (int32_t)(pStart - (char*)buf);
+}
+
+static int32_t getRowBufFromExtMemFile(SSortHandle* pHandle, int32_t regionId, int32_t tupleOffset, int32_t rowLen,
+ char** ppRow, bool* pFreeRow) {
+ SSortMemFile* pMemFile = pHandle->pExtRowsMemFile;
+ SSortMemFileRegion* pRegion = taosArrayGet(pMemFile->aFileRegions, regionId);
+ if (pRegion->buf == NULL) {
+ pRegion->bufRegOffset = 0;
+ pRegion->buf = taosMemoryMalloc(pMemFile->blockSize);
+ if (pRegion->buf == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ taosSeekCFile(pMemFile->pTdFile, pRegion->fileOffset, SEEK_SET);
+ int32_t readBytes = TMIN(pMemFile->blockSize, pRegion->regionSize);
+ int ret = taosReadFromCFile(pRegion->buf, readBytes, 1, pMemFile->pTdFile);
+ if (ret != 1) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return terrno;
+ }
+ pRegion->bufLen = readBytes;
+ }
+ ASSERT(pRegion->bufRegOffset <= tupleOffset);
+ if (pRegion->bufRegOffset + pRegion->bufLen >= tupleOffset + rowLen) {
+ *pFreeRow = false;
+ *ppRow = pRegion->buf + tupleOffset - pRegion->bufRegOffset;
+ } else {
+ *ppRow = taosMemoryMalloc(rowLen);
+ if (*ppRow == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ int32_t szThisBlock = pRegion->bufLen - (tupleOffset - pRegion->bufRegOffset);
+ memcpy(*ppRow, pRegion->buf + tupleOffset - pRegion->bufRegOffset, szThisBlock);
+ taosSeekCFile(pMemFile->pTdFile, pRegion->fileOffset + pRegion->bufRegOffset + pRegion->bufLen, SEEK_SET);
+ int32_t readBytes = TMIN(pMemFile->blockSize, pRegion->regionSize - (pRegion->bufRegOffset + pRegion->bufLen));
+ int ret = taosReadFromCFile(pRegion->buf, readBytes, 1, pMemFile->pTdFile);
+ if (ret != 1) {
+ taosMemoryFreeClear(*ppRow);
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return terrno;
+ }
+ memcpy(*ppRow + szThisBlock, pRegion->buf, rowLen - szThisBlock);
+ *pFreeRow = true;
+ pRegion->bufRegOffset += pRegion->bufLen;
+ pRegion->bufLen = readBytes;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t createSortMemFile(SSortHandle* pHandle) {
+ if (pHandle->pExtRowsMemFile != NULL) {
+ return TSDB_CODE_SUCCESS;
+ }
+ int32_t code = TSDB_CODE_SUCCESS;
+ SSortMemFile* pMemFile = taosMemoryCalloc(1, sizeof(SSortMemFile));
+ if (pMemFile == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ }
+ if (code == TSDB_CODE_SUCCESS) {
+ taosGetTmpfilePath(tsTempDir, "sort-ext-mem", pMemFile->memFilePath);
+ pMemFile->pTdFile = taosOpenCFile(pMemFile->memFilePath, "w+");
+ if (pMemFile->pTdFile == NULL) {
+ code = terrno = TAOS_SYSTEM_ERROR(errno);
+ }
+ }
+ if (code == TSDB_CODE_SUCCESS) {
+ taosSetAutoDelFile(pMemFile->memFilePath);
+
+ pMemFile->currRegionId = -1;
+ pMemFile->currRegionOffset = -1;
+
+ pMemFile->writeBufSize = 4 * 1024 * 1024;
+ pMemFile->writeFileOffset = -1;
+ pMemFile->bRegionDirty = false;
+
+ pMemFile->writeBuf = taosMemoryMalloc(pMemFile->writeBufSize);
+ if (pMemFile->writeBuf == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+ if (code == TSDB_CODE_SUCCESS) {
+ pMemFile->cacheSize = pHandle->extRowsMemSize;
+ pMemFile->aFileRegions = taosArrayInit(64, sizeof(SSortMemFileRegion));
+ if (pMemFile->aFileRegions == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+ if (code == TSDB_CODE_SUCCESS) {
+ pHandle->pExtRowsMemFile = pMemFile;
+ } else {
+ if (pMemFile) {
+ if (pMemFile->aFileRegions) taosMemoryFreeClear(pMemFile->aFileRegions);
+ if (pMemFile->writeBuf) taosMemoryFreeClear(pMemFile->writeBuf);
+ if (pMemFile->pTdFile) {
+ taosCloseCFile(pMemFile->pTdFile);
+ pMemFile->pTdFile = NULL;
+ }
+ taosMemoryFreeClear(pMemFile);
+ }
+ }
+ return code;
+}
+
+static int32_t destroySortMemFile(SSortHandle* pHandle) {
+ if (pHandle->pExtRowsMemFile == NULL) return TSDB_CODE_SUCCESS;
+
+ SSortMemFile* pMemFile = pHandle->pExtRowsMemFile;
+ for (int32_t i = 0; i < taosArrayGetSize(pMemFile->aFileRegions); ++i) {
+ SSortMemFileRegion* pRegion = taosArrayGet(pMemFile->aFileRegions, i);
+ taosMemoryFree(pRegion->buf);
+ }
+ taosArrayDestroy(pMemFile->aFileRegions);
+ pMemFile->aFileRegions = NULL;
+
+ taosMemoryFree(pMemFile->writeBuf);
+ pMemFile->writeBuf = NULL;
+
+ taosCloseCFile(pMemFile->pTdFile);
+ pMemFile->pTdFile = NULL;
+ taosRemoveFile(pMemFile->memFilePath);
+ taosMemoryFree(pMemFile);
+ pHandle->pExtRowsMemFile = NULL;
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t tsortOpenRegion(SSortHandle* pHandle) {
+ SSortMemFile* pMemFile = pHandle->pExtRowsMemFile;
+ if (pMemFile->currRegionId == -1) {
+ SSortMemFileRegion region = {0};
+ region.fileOffset = 0;
+ region.bufRegOffset = 0;
+ taosArrayPush(pMemFile->aFileRegions, ®ion);
+ pMemFile->currRegionId = 0;
+ pMemFile->currRegionOffset = 0;
+ pMemFile->writeFileOffset = 0;
+ } else {
+ SSortMemFileRegion regionNew = {0};
+ SSortMemFileRegion* pRegion = taosArrayGet(pMemFile->aFileRegions, pMemFile->currRegionId);
+ regionNew.fileOffset = pRegion->fileOffset + pRegion->regionSize;
+ regionNew.bufRegOffset = 0;
+ taosArrayPush(pMemFile->aFileRegions, ®ionNew);
+ ++pMemFile->currRegionId;
+ pMemFile->currRegionOffset = 0;
+ pMemFile->writeFileOffset = regionNew.fileOffset;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t tsortCloseRegion(SSortHandle* pHandle) {
+ SSortMemFile* pMemFile = pHandle->pExtRowsMemFile;
+ SSortMemFileRegion* pRegion = taosArrayGet(pMemFile->aFileRegions, pMemFile->currRegionId);
+ pRegion->regionSize = pMemFile->currRegionOffset;
+ int32_t writeBytes = pRegion->regionSize - (pMemFile->writeFileOffset - pRegion->fileOffset);
+ if (writeBytes > 0) {
+ int ret = fwrite(pMemFile->writeBuf, writeBytes, 1, pMemFile->pTdFile);
+ if (ret != 1) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return terrno;
+ }
+ pMemFile->bRegionDirty = false;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t tsortFinalizeRegions(SSortHandle* pHandle) {
+ SSortMemFile* pMemFile = pHandle->pExtRowsMemFile;
+ size_t numRegions = taosArrayGetSize(pMemFile->aFileRegions);
+ ASSERT(numRegions == (pMemFile->currRegionId + 1));
+ if (numRegions == 0) return TSDB_CODE_SUCCESS;
+ int32_t blockReadBytes = (pMemFile->cacheSize / numRegions + 4095) & ~4095;
+ pMemFile->blockSize = blockReadBytes;
+
+ for (int32_t i = 0; i < numRegions; ++i) {
+ SSortMemFileRegion* pRegion = taosArrayGet(pMemFile->aFileRegions, i);
+ pRegion->bufRegOffset = 0;
+ }
+ taosMemoryFree(pMemFile->writeBuf);
+ pMemFile->writeBuf = NULL;
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t saveBlockRowToExtRowsMemFile(SSortHandle* pHandle, SSDataBlock* pBlock, int32_t rowIdx, int32_t* pRegionId, int32_t* pOffset, int32_t* pLength) {
+ SSortMemFile* pMemFile = pHandle->pExtRowsMemFile;
+ SSortMemFileRegion* pRegion = taosArrayGet(pMemFile->aFileRegions, pMemFile->currRegionId);
+ {
+ if (pMemFile->currRegionOffset + pHandle->extRowBytes >= pMemFile->writeBufSize) {
+ int32_t writeBytes = pMemFile->currRegionOffset - (pMemFile->writeFileOffset - pRegion->fileOffset);
+ int ret = fwrite(pMemFile->writeBuf, writeBytes, 1, pMemFile->pTdFile);
+ if (ret != 1) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return terrno;
+ }
+ pMemFile->writeFileOffset = pRegion->fileOffset + pMemFile->currRegionOffset;
+ }
+ }
+ *pRegionId = pMemFile->currRegionId;
+ *pOffset = pMemFile->currRegionOffset;
+ int32_t writeBufOffset = pMemFile->currRegionOffset - (pMemFile->writeFileOffset - pRegion->fileOffset);
+ int32_t blockLen = blockRowToBuf(pBlock, rowIdx, pMemFile->writeBuf + writeBufOffset);
+ *pLength = blockLen;
+ pMemFile->currRegionOffset += blockLen;
+ pMemFile->bRegionDirty = true;
+ return TSDB_CODE_SUCCESS;
+}
+
+static void appendToRowIndexDataBlock(SSortHandle* pHandle, SSDataBlock* pSource, int32_t* rowIndex) {
+ int32_t pageId = -1;
+ int32_t offset = -1;
+ int32_t length = -1;
+ saveBlockRowToExtRowsMemFile(pHandle, pSource, *rowIndex, &pageId, &offset, &length);
+
+ SSDataBlock* pBlock = pHandle->pDataBlock;
+ SColumnInfoData* pSrcTsCol = taosArrayGet(pSource->pDataBlock, pHandle->extRowsOrderInfo.slotId);
+ SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, 0);
+ char* pData = colDataGetData(pSrcTsCol, *rowIndex);
+ colDataSetVal(pTsCol, pBlock->info.rows, pData, false);
+
+ SColumnInfoData* pRegionIdCol = taosArrayGet(pBlock->pDataBlock, 1);
+ colDataSetInt32(pRegionIdCol, pBlock->info.rows, &pageId);
+
+ SColumnInfoData* pOffsetCol = taosArrayGet(pBlock->pDataBlock, 2);
+ colDataSetInt32(pOffsetCol, pBlock->info.rows, &offset);
+
+ SColumnInfoData* pLengthCol = taosArrayGet(pBlock->pDataBlock, 3);
+ colDataSetInt32(pLengthCol, pBlock->info.rows, &length);
+
+ pBlock->info.rows += 1;
+ *rowIndex += 1;
+}
+
+static void initRowIdSort(SSortHandle* pHandle) {
+
+ SSDataBlock* pSortInput = createDataBlock();
+ SColumnInfoData tsCol = createColumnInfoData(TSDB_DATA_TYPE_TIMESTAMP, 8, 1);
+ blockDataAppendColInfo(pSortInput, &tsCol);
+ SColumnInfoData regionIdCol = createColumnInfoData(TSDB_DATA_TYPE_INT, 4, 2);
+ blockDataAppendColInfo(pSortInput, ®ionIdCol);
+ SColumnInfoData offsetCol = createColumnInfoData(TSDB_DATA_TYPE_INT, 4, 3);
+ blockDataAppendColInfo(pSortInput, &offsetCol);
+ SColumnInfoData lengthCol = createColumnInfoData(TSDB_DATA_TYPE_INT, 4, 4);
+ blockDataAppendColInfo(pSortInput, &lengthCol);
+
+ blockDataDestroy(pHandle->pDataBlock);
+ pHandle->pDataBlock = pSortInput;
+
+ int32_t rowSize = blockDataGetRowSize(pHandle->pDataBlock);
+ size_t nCols = taosArrayGetSize(pHandle->pDataBlock->pDataBlock);
+ pHandle->pageSize = 256 * 1024; // 256k
+ pHandle->numOfPages = 256;
+
+ SBlockOrderInfo* pOrder = taosArrayGet(pHandle->pSortInfo, 0);
+ SBlockOrderInfo bi = {0};
+ bi.order = pOrder->order;
+ bi.slotId = 0;
+ bi.nullFirst = NULL_ORDER_FIRST;
+
+ SArray* aOrder = taosArrayInit(1, sizeof(SBlockOrderInfo));
+ taosArrayPush(aOrder, &bi);
+
+ taosArrayDestroy(pHandle->pSortInfo);
+ pHandle->pSortInfo = aOrder;
+ return;
+}
+
+int32_t tsortSetSortByRowId(SSortHandle* pHandle, int32_t extRowsMemSize) {
+ pHandle->extRowBytes = blockDataGetRowSize(pHandle->pDataBlock) + taosArrayGetSize(pHandle->pDataBlock->pDataBlock) + sizeof(int32_t);
+ pHandle->extRowsMemSize = extRowsMemSize;
+ SBlockOrderInfo* pOrder = taosArrayGet(pHandle->pSortInfo, 0);
+ pHandle->extRowsOrderInfo = *pOrder;
+ initRowIdSort(pHandle);
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_DISKSPACE;
+ qError("create sort mem file failed since %s, tempDir:%s", terrstr(), tsTempDir);
+ return terrno;
+ }
+ int32_t code = createSortMemFile(pHandle);
+ pHandle->bSortByRowId = true;
+ return code;
+}
+
typedef struct SBlkMergeSupport {
int64_t** aTs;
int32_t* aRowIdx;
@@ -925,7 +1350,7 @@ static int32_t getPageBufIncForRow(SSDataBlock* blk, int32_t row, int32_t rowIdx
return sz;
}
-static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockOrderInfo* order, SArray* aExtSrc) {
+static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SArray* aExtSrc) {
int32_t code = TSDB_CODE_SUCCESS;
int pgHeaderSz = sizeof(int32_t) + sizeof(int32_t) * taosArrayGetSize(pHandle->pDataBlock->pDataBlock);
int32_t rowCap = blockDataGetCapacityInRow(pHandle->pDataBlock, pHandle->pageSize, pgHeaderSz);
@@ -933,13 +1358,15 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
blockDataCleanup(pHandle->pDataBlock);
int32_t numBlks = taosArrayGetSize(aBlk);
+ SBlockOrderInfo* pOrigBlockOrder = (!pHandle->bSortByRowId) ? taosArrayGet(pHandle->pSortInfo, 0) : &pHandle->extRowsOrderInfo;
+ SBlockOrderInfo* pHandleBlockOrder = taosArrayGet(pHandle->pSortInfo, 0);
SBlkMergeSupport sup;
sup.aRowIdx = taosMemoryCalloc(numBlks, sizeof(int32_t));
sup.aTs = taosMemoryCalloc(numBlks, sizeof(int64_t*));
- sup.order = order->order;
+ sup.order = pOrigBlockOrder->order;
for (int i = 0; i < numBlks; ++i) {
SSDataBlock* blk = taosArrayGetP(aBlk, i);
- SColumnInfoData* col = taosArrayGet(blk->pDataBlock, order->slotId);
+ SColumnInfoData* col = taosArrayGet(blk->pDataBlock, pOrigBlockOrder->slotId);
sup.aTs[i] = (int64_t*)col->pData;
sup.aRowIdx[i] = 0;
}
@@ -963,16 +1390,17 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
int32_t nMergedRows = 0;
bool mergeLimitReached = false;
size_t blkPgSz = pgHeaderSz;
- int64_t lastPageBufTs = (order->order == TSDB_ORDER_ASC) ? INT64_MAX : INT64_MIN;
- int64_t currTs = (order->order == TSDB_ORDER_ASC) ? INT64_MAX : INT64_MIN;
+ int64_t lastPageBufTs = (pHandleBlockOrder->order == TSDB_ORDER_ASC) ? INT64_MAX : INT64_MIN;
+ int64_t currTs = (pHandleBlockOrder->order == TSDB_ORDER_ASC) ? INT64_MAX : INT64_MIN;
while (nRows < totalRows) {
int32_t minIdx = tMergeTreeGetChosenIndex(pTree);
SSDataBlock* minBlk = taosArrayGetP(aBlk, minIdx);
int32_t minRow = sup.aRowIdx[minIdx];
- int32_t bufInc = getPageBufIncForRow(minBlk, minRow, pHandle->pDataBlock->info.rows);
+ SSDataBlock* incBlock = (pHandle->bSortByRowId) ? pHandle->pDataBlock : minBlk;
+ int32_t bufInc = getPageBufIncForRow(incBlock, minRow, pHandle->pDataBlock->info.rows);
if (blkPgSz <= pHandle->pageSize && blkPgSz + bufInc > pHandle->pageSize) {
- SColumnInfoData* tsCol = taosArrayGet(pHandle->pDataBlock->pDataBlock, order->slotId);
+ SColumnInfoData* tsCol = taosArrayGet(pHandle->pDataBlock->pDataBlock, pHandleBlockOrder->slotId);
lastPageBufTs = ((int64_t*)tsCol->pData)[pHandle->pDataBlock->info.rows - 1];
code = appendDataBlockToPageBuf(pHandle, pHandle->pDataBlock, aPgId);
if (code != TSDB_CODE_SUCCESS) {
@@ -985,19 +1413,24 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
nMergedRows += pHandle->pDataBlock->info.rows;
blockDataCleanup(pHandle->pDataBlock);
blkPgSz = pgHeaderSz;
- bufInc = getPageBufIncForRow(minBlk, minRow, 0);
+ incBlock = (pHandle->bSortByRowId) ? pHandle->pDataBlock : minBlk;
+ bufInc = getPageBufIncForRow(incBlock, minRow, 0);
if ((pHandle->mergeLimit != -1) && (nMergedRows >= pHandle->mergeLimit)) {
mergeLimitReached = true;
- if ((lastPageBufTs < pHandle->currMergeLimitTs && order->order == TSDB_ORDER_ASC) ||
- (lastPageBufTs > pHandle->currMergeLimitTs && order->order == TSDB_ORDER_DESC)) {
+ if ((lastPageBufTs < pHandle->currMergeLimitTs && pHandleBlockOrder->order == TSDB_ORDER_ASC) ||
+ (lastPageBufTs > pHandle->currMergeLimitTs && pHandleBlockOrder->order == TSDB_ORDER_DESC)) {
pHandle->currMergeLimitTs = lastPageBufTs;
}
break;
}
}
blockDataEnsureCapacity(pHandle->pDataBlock, pHandle->pDataBlock->info.rows + 1);
- appendOneRowToDataBlock(pHandle->pDataBlock, minBlk, &minRow);
+ if (!pHandle->bSortByRowId) {
+ appendOneRowToDataBlock(pHandle->pDataBlock, minBlk, &minRow);
+ } else {
+ appendToRowIndexDataBlock(pHandle, minBlk, &minRow);
+ }
blkPgSz += bufInc;
++nRows;
@@ -1011,7 +1444,7 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
}
if (pHandle->pDataBlock->info.rows > 0) {
if (!mergeLimitReached) {
- SColumnInfoData* tsCol = taosArrayGet(pHandle->pDataBlock->pDataBlock, order->slotId);
+ SColumnInfoData* tsCol = taosArrayGet(pHandle->pDataBlock->pDataBlock, pHandleBlockOrder->slotId);
lastPageBufTs = ((int64_t*)tsCol->pData)[pHandle->pDataBlock->info.rows - 1];
code = appendDataBlockToPageBuf(pHandle, pHandle->pDataBlock, aPgId);
if (code != TSDB_CODE_SUCCESS) {
@@ -1024,14 +1457,15 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
nMergedRows += pHandle->pDataBlock->info.rows;
if ((pHandle->mergeLimit != -1) && (nMergedRows >= pHandle->mergeLimit)) {
mergeLimitReached = true;
- if ((lastPageBufTs < pHandle->currMergeLimitTs && order->order == TSDB_ORDER_ASC) ||
- (lastPageBufTs > pHandle->currMergeLimitTs && order->order == TSDB_ORDER_DESC)) {
+ if ((lastPageBufTs < pHandle->currMergeLimitTs && pHandleBlockOrder->order == TSDB_ORDER_ASC) ||
+ (lastPageBufTs > pHandle->currMergeLimitTs && pHandleBlockOrder->order == TSDB_ORDER_DESC)) {
pHandle->currMergeLimitTs = lastPageBufTs;
}
}
}
blockDataCleanup(pHandle->pDataBlock);
}
+
SSDataBlock* pMemSrcBlk = createOneDataBlock(pHandle->pDataBlock, false);
doAddNewExternalMemSource(pHandle->pBuf, aExtSrc, pMemSrcBlk, &pHandle->sourceId, aPgId);
@@ -1083,11 +1517,10 @@ static SSDataBlock* getRowsBlockWithinMergeLimit(const SSortHandle* pHandle, SSH
}
static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
- SBlockOrderInfo* pOrder = taosArrayGet(pHandle->pSortInfo, 0);
size_t nSrc = taosArrayGetSize(pHandle->pOrderedSource);
SArray* aExtSrc = taosArrayInit(nSrc, POINTER_BYTES);
- size_t maxBufSize = pHandle->numOfPages * pHandle->pageSize;
+ size_t maxBufSize = (pHandle->bSortByRowId) ? pHandle->extRowsMemSize : (pHandle->numOfPages * pHandle->pageSize);
int32_t code = createPageBuf(pHandle);
if (code != TSDB_CODE_SUCCESS) {
@@ -1098,7 +1531,8 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
SSortSource* pSrc = taosArrayGetP(pHandle->pOrderedSource, 0);
int32_t szSort = 0;
- if (pOrder->order == TSDB_ORDER_ASC) {
+ SBlockOrderInfo* pOrigOrder = (!pHandle->bSortByRowId) ? taosArrayGet(pHandle->pSortInfo, 0) : &pHandle->extRowsOrderInfo;
+ if (pOrigOrder->order == TSDB_ORDER_ASC) {
pHandle->currMergeLimitTs = INT64_MAX;
} else {
pHandle->currMergeLimitTs = INT64_MIN;
@@ -1110,7 +1544,6 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
while (1) {
SSDataBlock* pBlk = pHandle->fetchfp(pSrc->param);
- int64_t p = taosGetTimestampUs();
bool bExtractedBlock = false;
bool bSkipBlock = false;
if (pBlk != NULL && pHandle->mergeLimit > 0) {
@@ -1121,13 +1554,13 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
}
if (pBlk != NULL) {
- SColumnInfoData* tsCol = taosArrayGet(pBlk->pDataBlock, pOrder->slotId);
+ SColumnInfoData* tsCol = taosArrayGet(pBlk->pDataBlock, pOrigOrder->slotId);
int64_t firstRowTs = *(int64_t*)tsCol->pData;
- if ((pOrder->order == TSDB_ORDER_ASC && firstRowTs > pHandle->currMergeLimitTs) ||
- (pOrder->order == TSDB_ORDER_DESC && firstRowTs < pHandle->currMergeLimitTs)) {
+ if ((pOrigOrder->order == TSDB_ORDER_ASC && firstRowTs > pHandle->currMergeLimitTs) ||
+ (pOrigOrder->order == TSDB_ORDER_DESC && firstRowTs < pHandle->currMergeLimitTs)) {
if (bExtractedBlock) {
blockDataDestroy(pBlk);
- }
+ }
continue;
}
}
@@ -1150,7 +1583,13 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
if ((pBlk != NULL && szSort > maxBufSize) || (pBlk == NULL && szSort > 0)) {
tSimpleHashClear(mUidBlk);
- code = sortBlocksToExtSource(pHandle, aBlkSort, pOrder, aExtSrc);
+
+ int64_t p = taosGetTimestampUs();
+ if (pHandle->bSortByRowId) {
+ tsortOpenRegion(pHandle);
+ }
+ code = sortBlocksToExtSource(pHandle, aBlkSort, aExtSrc);
+
if (code != TSDB_CODE_SUCCESS) {
for (int i = 0; i < taosArrayGetSize(aBlkSort); ++i) {
blockDataDestroy(taosArrayGetP(aBlkSort, i));
@@ -1158,7 +1597,9 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
taosArrayClear(aBlkSort);
break;
}
-
+ if (pHandle->bSortByRowId) {
+ tsortCloseRegion(pHandle);
+ }
int64_t el = taosGetTimestampUs() - p;
pHandle->sortElapsed += el;
@@ -1195,10 +1636,25 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
}
taosArrayDestroy(aExtSrc);
tSimpleHashCleanup(mTableNumRows);
+ if (pHandle->bSortByRowId) {
+ tsortFinalizeRegions(pHandle);
+ }
pHandle->type = SORT_SINGLESOURCE_SORT;
return code;
}
+static void freeSSortSource(SSortSource* source) {
+ if (NULL == source) return;
+ if (source->param && !source->onlyRef) {
+ taosMemoryFree(source->param);
+ }
+ if (!source->onlyRef && source->src.pBlock) {
+ blockDataDestroy(source->src.pBlock);
+ source->src.pBlock = NULL;
+ }
+ taosMemoryFree(source);
+}
+
static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) {
int32_t code = 0;
size_t sortBufSize = pHandle->numOfPages * pHandle->pageSize;
@@ -1231,14 +1687,7 @@ static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) {
code = blockDataMerge(pHandle->pDataBlock, pBlock);
if (code != TSDB_CODE_SUCCESS) {
- if (source->param && !source->onlyRef) {
- taosMemoryFree(source->param);
- }
- if (!source->onlyRef && source->src.pBlock) {
- blockDataDestroy(source->src.pBlock);
- source->src.pBlock = NULL;
- }
- taosMemoryFree(source);
+ freeSSortSource(source);
return code;
}
@@ -1248,15 +1697,7 @@ static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) {
int64_t p = taosGetTimestampUs();
code = blockDataSort(pHandle->pDataBlock, pHandle->pSortInfo);
if (code != 0) {
- if (source->param && !source->onlyRef) {
- taosMemoryFree(source->param);
- }
- if (!source->onlyRef && source->src.pBlock) {
- blockDataDestroy(source->src.pBlock);
- source->src.pBlock = NULL;
- }
-
- taosMemoryFree(source);
+ freeSSortSource(source);
return code;
}
@@ -1265,16 +1706,13 @@ static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) {
if (pHandle->pqMaxRows > 0) blockDataKeepFirstNRows(pHandle->pDataBlock, pHandle->pqMaxRows);
code = doAddToBuf(pHandle->pDataBlock, pHandle);
if (code != TSDB_CODE_SUCCESS) {
+ freeSSortSource(source);
return code;
}
}
}
- if (source->param && !source->onlyRef) {
- taosMemoryFree(source->param);
- }
-
- taosMemoryFree(source);
+ freeSSortSource(source);
if (pHandle->pDataBlock != NULL && pHandle->pDataBlock->info.rows > 0) {
size_t size = blockDataGetSize(pHandle->pDataBlock);
diff --git a/source/libs/index/src/indexComm.c b/source/libs/index/src/indexComm.c
index 1313221952..b7b9f1cc9f 100644
--- a/source/libs/index/src/indexComm.c
+++ b/source/libs/index/src/indexComm.c
@@ -76,8 +76,8 @@ char* idxInt2str(int64_t val, char* dst, int radix) {
return dst - 1;
}
__compar_fn_t idxGetCompar(int8_t type) {
- if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY ||
- type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) {
+ if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_NCHAR ||
+ type == TSDB_DATA_TYPE_GEOMETRY) {
return (__compar_fn_t)strcmp;
}
return getComparFunc(type, 0);
@@ -108,8 +108,8 @@ static FORCE_INLINE TExeCond tCompareEqual(void* a, void* b, int8_t type) {
return tCompare(func, QUERY_TERM, a, b, type);
}
TExeCond tCompare(__compar_fn_t func, int8_t cmptype, void* a, void* b, int8_t dtype) {
- if (dtype == TSDB_DATA_TYPE_BINARY || dtype == TSDB_DATA_TYPE_NCHAR ||
- dtype == TSDB_DATA_TYPE_VARBINARY || dtype == TSDB_DATA_TYPE_GEOMETRY) {
+ if (dtype == TSDB_DATA_TYPE_BINARY || dtype == TSDB_DATA_TYPE_NCHAR || dtype == TSDB_DATA_TYPE_VARBINARY ||
+ dtype == TSDB_DATA_TYPE_GEOMETRY) {
return tDoCompare(func, cmptype, a, b);
}
#if 1
@@ -290,6 +290,7 @@ int idxUidCompare(const void* a, const void* b) {
uint64_t r = *(uint64_t*)b;
return l - r;
}
+#ifdef BUILD_NO_CALL
int32_t idxConvertData(void* src, int8_t type, void** dst) {
int tlen = -1;
switch (type) {
@@ -372,6 +373,8 @@ int32_t idxConvertData(void* src, int8_t type, void** dst) {
// indexMayFillNumbericData(*dst, tlen);
return tlen;
}
+#endif
+
int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
if (src == NULL) {
*dst = strndup(INDEX_DATA_NULL_STR, (int)strlen(INDEX_DATA_NULL_STR));
diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c
index 3f5ffcae32..453d927378 100644
--- a/source/libs/nodes/src/nodesCloneFuncs.c
+++ b/source/libs/nodes/src/nodesCloneFuncs.c
@@ -457,6 +457,7 @@ static int32_t logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) {
COPY_SCALAR_FIELD(isCountByTag);
CLONE_OBJECT_FIELD(pFuncTypes, functParamClone);
COPY_SCALAR_FIELD(paraTablesSort);
+ COPY_SCALAR_FIELD(smallDataTsSort);
return TSDB_CODE_SUCCESS;
}
@@ -690,6 +691,7 @@ static int32_t physiTableScanCopy(const STableScanPhysiNode* pSrc, STableScanPhy
COPY_SCALAR_FIELD(filesetDelimited);
COPY_SCALAR_FIELD(needCountEmptyTable);
COPY_SCALAR_FIELD(paraTablesSort);
+ COPY_SCALAR_FIELD(smallDataTsSort);
return TSDB_CODE_SUCCESS;
}
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index ae220cf334..6ebf93dc19 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -701,6 +701,7 @@ static const char* jkScanLogicPlanGroupTags = "GroupTags";
static const char* jkScanLogicPlanOnlyMetaCtbIdx = "OnlyMetaCtbIdx";
static const char* jkScanLogicPlanFilesetDelimited = "FilesetDelimited";
static const char* jkScanLogicPlanParaTablesSort = "ParaTablesSort";
+static const char* jkScanLogicPlanSmallDataTsSort = "SmallDataTsSort";
static int32_t logicScanNodeToJson(const void* pObj, SJson* pJson) {
const SScanLogicNode* pNode = (const SScanLogicNode*)pObj;
@@ -751,6 +752,9 @@ static int32_t logicScanNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkScanLogicPlanParaTablesSort, pNode->paraTablesSort);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkScanLogicPlanSmallDataTsSort, pNode->paraTablesSort);
+ }
return code;
}
@@ -802,7 +806,10 @@ static int32_t jsonToLogicScanNode(const SJson* pJson, void* pObj) {
code = tjsonGetBoolValue(pJson, jkScanLogicPlanFilesetDelimited, &pNode->filesetDelimited);
}
if (TSDB_CODE_SUCCESS == code) {
- code = tjsonGetBoolValue(pJson, jkScanLogicPlanParaTablesSort, &pNode->paraTablesSort);
+ code = tjsonGetBoolValue(pJson, jkScanLogicPlanParaTablesSort, &pNode->smallDataTsSort);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkScanLogicPlanSmallDataTsSort, &pNode->smallDataTsSort);
}
return code;
}
@@ -1898,6 +1905,7 @@ static const char* jkTableScanPhysiPlanIgnoreUpdate = "IgnoreUpdate";
static const char* jkTableScanPhysiPlanFilesetDelimited = "FilesetDelimited";
static const char* jkTableScanPhysiPlanNeedCountEmptyTable = "NeedCountEmptyTable";
static const char* jkTableScanPhysiPlanParaTablesSort = "ParaTablesSort";
+static const char* jkTableScanPhysiPlanSmallDataTsSort = "SmallDataTsSort";
static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) {
const STableScanPhysiNode* pNode = (const STableScanPhysiNode*)pObj;
@@ -1975,6 +1983,9 @@ static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkTableScanPhysiPlanParaTablesSort, pNode->paraTablesSort);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkTableScanPhysiPlanSmallDataTsSort, pNode->smallDataTsSort);
+ }
return code;
}
@@ -2054,6 +2065,9 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkTableScanPhysiPlanParaTablesSort, &pNode->paraTablesSort);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkTableScanPhysiPlanSmallDataTsSort, &pNode->smallDataTsSort);
+ }
return code;
}
@@ -4690,6 +4704,7 @@ static const char* jkColumnDefColName = "ColName";
static const char* jkColumnDefDataType = "DataType";
static const char* jkColumnDefComments = "Comments";
static const char* jkColumnDefSma = "Sma";
+static const char* jkColumnDefIsPK = "IsPK";
static int32_t columnDefNodeToJson(const void* pObj, SJson* pJson) {
const SColumnDefNode* pNode = (const SColumnDefNode*)pObj;
@@ -4704,6 +4719,9 @@ static int32_t columnDefNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkColumnDefSma, pNode->sma);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkColumnDefIsPK, pNode->is_pk);
+ }
return code;
}
@@ -4721,7 +4739,9 @@ static int32_t jsonToColumnDefNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkColumnDefSma, &pNode->sma);
}
-
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkColumnDefIsPK, &pNode->is_pk);
+ }
return code;
}
diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c
index 357abc2858..95a5c2f51e 100644
--- a/source/libs/nodes/src/nodesMsgFuncs.c
+++ b/source/libs/nodes/src/nodesMsgFuncs.c
@@ -2188,6 +2188,9 @@ static int32_t physiTableScanNodeInlineToMsg(const void* pObj, STlvEncoder* pEnc
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeValueBool(pEncoder, pNode->paraTablesSort);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeValueBool(pEncoder, pNode->smallDataTsSort);
+ }
return code;
}
@@ -2275,6 +2278,9 @@ static int32_t msgToPhysiTableScanNodeInline(STlvDecoder* pDecoder, void* pObj)
if (TSDB_CODE_SUCCESS == code) {
code = tlvDecodeValueBool(pDecoder, &pNode->paraTablesSort);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvDecodeValueBool(pDecoder, &pNode->smallDataTsSort);
+ }
return code;
}
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index 9fc3034116..ebc953f268 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -82,6 +82,7 @@ typedef enum EColumnOptionType {
COLUMN_OPTION_ENCODE,
COLUMN_OPTION_COMPRESS,
COLUMN_OPTION_LEVEL,
+ COLUMN_OPTION_PRIMARYKEY,
} EColumnOptionType;
typedef struct SAlterOption {
@@ -179,7 +180,7 @@ SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart
SNode* createDefaultTableOptions(SAstCreateContext* pCxt);
SNode* createAlterTableOptions(SAstCreateContext* pCxt);
SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal);
-SNode* createColumnDefNode(SAstCreateContext* pCxt, SToken* pColName, SDataType dataType, SNode* pOptions);
+SNode* createColumnDefNode(SAstCreateContext* pCxt, SToken* pColName, SDataType dataType, SNode* pOptions, bool bPrimaryKey);
SNode* setColumnOptions(SAstCreateContext* pCxt, SNode* pOptions, EColumnOptionType type, void* pVal);
SNode* createDefaultColumnOptions(SAstCreateContext* pCxt);
SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNodeList* pCols,
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index dc3625496e..25cec1aae6 100755
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -1286,6 +1286,7 @@ null_ordering_opt(A) ::= NULLS LAST.
STRICT STRING TIMES VALUES VARIABLE VIEW WAL.
column_options(A) ::= . { A = createDefaultColumnOptions(pCxt); }
+column_options(A) ::= column_options(B) PRIMARY KEY. { A = setColumnOptions(pCxt, B, COLUMN_OPTION_PRIMARYKEY, &C); }
column_options(A) ::= column_options(B) ENCODE NK_STRING(C). { A = setColumnOptions(pCxt, B, COLUMN_OPTION_ENCODE, &C); }
column_options(A) ::= column_options(B) COMPRESS NK_STRING(C). { A = setColumnOptions(pCxt, B, COLUMN_OPTION_COMPRESS, &C); }
column_options(A) ::= column_options(B) LEVEL NK_STRING(C). { A = setColumnOptions(pCxt, B, COLUMN_OPTION_LEVEL, &C); }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 7c88359833..4b7326eec4 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -404,6 +404,9 @@ bool addHintNodeToList(SAstCreateContext* pCxt, SNodeList** ppHintList, EHintOpt
case HINT_PARA_TABLES_SORT:
if (paramNum > 0 || hasHint(*ppHintList, HINT_PARA_TABLES_SORT)) return true;
break;
+ case HINT_SMALLDATA_TS_SORT:
+ if (paramNum > 0 || hasHint(*ppHintList, HINT_SMALLDATA_TS_SORT)) return true;
+ break;
default:
return true;
}
@@ -490,6 +493,14 @@ SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral) {
}
opt = HINT_PARA_TABLES_SORT;
break;
+ case TK_SMALLDATA_TS_SORT:
+ lastComma = false;
+ if (0 != opt || inParamList) {
+ quit = true;
+ break;
+ }
+ opt = HINT_SMALLDATA_TS_SORT;
+ break;
case TK_NK_LP:
lastComma = false;
if (0 == opt || inParamList) {
@@ -1492,6 +1503,7 @@ SNode* createDefaultColumnOptions(SAstCreateContext* pCxt) {
SColumnOptions* pOptions = (SColumnOptions*)nodesMakeNode(QUERY_NODE_COLUMN_OPTIONS);
CHECK_OUT_OF_MEM(pOptions);
pOptions->commentNull = true;
+ pOptions->bPrimaryKey = false;
return (SNode*)pOptions;
}
@@ -1519,6 +1531,9 @@ SNode* setColumnOptions(SAstCreateContext* pCxt, SNode* pOptions, EColumnOptionT
pCxt->errCode = TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
}
break;
+ case COLUMN_OPTION_PRIMARYKEY:
+ ((SColumnOptions*)pOptions)->bPrimaryKey = true;
+ break;
default:
break;
}
@@ -1540,6 +1555,7 @@ SNode* createColumnDefNode(SAstCreateContext* pCxt, SToken* pColName, SDataType
pCol->dataType = dataType;
pCol->pOptions = (SColumnOptions*)pNode;
pCol->sma = true;
+ pCol->is_pk = ((SColumnOptions*)pNode)->bPrimaryKey;
return (SNode*)pCol;
}
diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c
index 13c4431b62..c2ce77f02b 100644
--- a/source/libs/parser/src/parInsertSml.c
+++ b/source/libs/parser/src/parInsertSml.c
@@ -185,7 +185,8 @@ void clearColValArraySml(SArray* pCols) {
int32_t num = taosArrayGetSize(pCols);
for (int32_t i = 0; i < num; ++i) {
SColVal* pCol = taosArrayGet(pCols, i);
- if (TSDB_DATA_TYPE_NCHAR == pCol->type || TSDB_DATA_TYPE_GEOMETRY == pCol->type || TSDB_DATA_TYPE_VARBINARY == pCol->type) {
+ if (TSDB_DATA_TYPE_NCHAR == pCol->value.type || TSDB_DATA_TYPE_GEOMETRY == pCol->value.type ||
+ TSDB_DATA_TYPE_VARBINARY == pCol->value.type) {
taosMemoryFreeClear(pCol->value.pData);
}
pCol->flag = CV_FLAG_NONE;
diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c
index 7d10d1f2df..4d62f71b72 100644
--- a/source/libs/parser/src/parInsertSql.c
+++ b/source/libs/parser/src/parInsertSql.c
@@ -1661,7 +1661,7 @@ static void clearColValArray(SArray* pCols) {
int32_t num = taosArrayGetSize(pCols);
for (int32_t i = 0; i < num; ++i) {
SColVal* pCol = taosArrayGet(pCols, i);
- if (IS_VAR_DATA_TYPE(pCol->type)) {
+ if (IS_VAR_DATA_TYPE(pCol->value.type)) {
taosMemoryFreeClear(pCol->value.pData);
}
}
diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c
index 808ab71b92..3f87f79301 100644
--- a/source/libs/parser/src/parInsertUtil.c
+++ b/source/libs/parser/src/parInsertUtil.c
@@ -350,7 +350,8 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta*
static void destroyColVal(void* p) {
SColVal* pVal = p;
- if (TSDB_DATA_TYPE_NCHAR == pVal->type || TSDB_DATA_TYPE_GEOMETRY == pVal->type || TSDB_DATA_TYPE_VARBINARY == pVal->type) {
+ if (TSDB_DATA_TYPE_NCHAR == pVal->value.type || TSDB_DATA_TYPE_GEOMETRY == pVal->value.type ||
+ TSDB_DATA_TYPE_VARBINARY == pVal->value.type) {
taosMemoryFreeClear(pVal->value.pData);
}
}
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index 0da25ad118..6157aa1733 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -132,6 +132,7 @@ static SKeyword keywordTable[] = {
{"JOIN", TK_JOIN},
{"JSON", TK_JSON},
{"KEEP", TK_KEEP},
+ {"KEY", TK_KEY},
{"KILL", TK_KILL},
{"LANGUAGE", TK_LANGUAGE},
{"LAST", TK_LAST},
@@ -179,6 +180,7 @@ static SKeyword keywordTable[] = {
{"PASS", TK_PASS},
{"PORT", TK_PORT},
{"PPS", TK_PPS},
+ {"PRIMARY", TK_PRIMARY},
{"PRECISION", TK_PRECISION},
{"PREV", TK_PREV},
{"PRIVILEGES", TK_PRIVILEGES},
@@ -213,6 +215,7 @@ static SKeyword keywordTable[] = {
{"SLIDING", TK_SLIDING},
{"SLIMIT", TK_SLIMIT},
{"SMA", TK_SMA},
+ {"SMALLDATA_TS_SORT", TK_SMALLDATA_TS_SORT},
{"SMALLINT", TK_SMALLINT},
{"SNODE", TK_SNODE},
{"SNODES", TK_SNODES},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 4726fe7401..601725e326 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -4010,6 +4010,26 @@ static int32_t translateEventWindow(STranslateContext* pCxt, SSelectStmt* pSelec
}
static int32_t translateCountWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
+ SCountWindowNode* pCountWin = (SCountWindowNode*)pSelect->pWindow;
+ if (pCountWin->windowCount <= 1) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Size of Count window must exceed 1.");
+ }
+
+ if (pCountWin->windowSliding <= 0) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Size of Count window must exceed 0.");
+ }
+
+ if (pCountWin->windowSliding > pCountWin->windowCount) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "sliding value no larger than the count value.");
+ }
+
+ if (pCountWin->windowCount > INT32_MAX) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Size of Count window must less than 2147483647(INT32_MAX).");
+ }
if (QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) &&
!isGlobalTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TIMELINE_QUERY,
@@ -4528,7 +4548,7 @@ static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (TSDB_CODE_SUCCESS == code) {
code = getQueryTimeRange(pCxt, pSelect->pWhere, &pSelect->timeRange);
}
- if (pSelect->pWhere != NULL) {
+ if (pSelect->pWhere != NULL && pCxt->pParseCxt->topicQuery == false) {
setTableVgroupsFromEqualTbnameCond(pCxt, pSelect);
}
return code;
@@ -5788,6 +5808,9 @@ static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray) {
if (pCol->sma) {
field.flags |= COL_SMA_ON;
}
+ if (pCol->is_pk) {
+ field.flags |= COL_IS_KEY;
+ }
taosArrayPush(*pArray, &field);
}
return TSDB_CODE_SUCCESS;
@@ -5887,6 +5910,9 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN
if (NULL != taosHashGet(pHash, pTag->colName, len)) {
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_DUPLICATED_COLUMN);
}
+ if (TSDB_CODE_SUCCESS == code && pTag->is_pk) {
+ code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY, pTag->colName);
+ }
if (TSDB_CODE_SUCCESS == code && pTag->dataType.type == TSDB_DATA_TYPE_JSON && ntags > 1) {
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_ONE_JSON_TAG);
}
@@ -5943,6 +5969,9 @@ static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, in
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_FIRST_COLUMN);
}
}
+ if (TSDB_CODE_SUCCESS == code && pCol->is_pk && colIndex != 1) {
+ code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SECOND_COL_PK);
+ }
if (TSDB_CODE_SUCCESS == code && pCol->dataType.type == TSDB_DATA_TYPE_JSON) {
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COL_JSON);
}
@@ -6164,6 +6193,9 @@ static void toSchema(const SColumnDefNode* pCol, col_id_t colId, SSchema* pSchem
if (pCol->sma) {
flags |= COL_SMA_ON;
}
+ if (pCol->is_pk) {
+ flags |= COL_IS_KEY;
+ }
pSchema->colId = colId;
pSchema->type = pCol->dataType.type;
pSchema->bytes = calcTypeBytes(pCol->dataType);
@@ -7875,29 +7907,7 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm
if (pStmt->pOptions->ignoreExpired != 1) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
"Ignore expired data of Count window must be 1.");
- }
-
- SCountWindowNode* pCountWin = (SCountWindowNode*)pSelect->pWindow;
- if (pCountWin->windowCount <= 1) {
- return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
- "Size of Count window must exceed 1.");
}
-
- if (pCountWin->windowSliding <= 0) {
- return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
- "Size of Count window must exceed 0.");
- }
-
- if (pCountWin->windowSliding > pCountWin->windowCount) {
- return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
- "sliding value no larger than the count value.");
- }
-
- if (pCountWin->windowCount > INT32_MAX) {
- return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
- "Size of Count window must less than 2147483647(INT32_MAX).");
- }
-
}
return TSDB_CODE_SUCCESS;
@@ -8184,7 +8194,9 @@ static int32_t adjustTagsForCreateTable(STranslateContext* pCxt, SCreateStreamSt
SColumnDefNode* pDef = (SColumnDefNode*)pTagDef;
if (!dataTypeEqual(&pDef->dataType, &((SExprNode*)pTagExpr)->resType)) {
SNode* pFunc = NULL;
- int32_t code = createCastFunc(pCxt, pTagExpr, pDef->dataType, &pFunc);
+ SDataType defType = pDef->dataType;
+ defType.bytes = calcTypeBytes(defType);
+ int32_t code = createCastFunc(pCxt, pTagExpr, defType, &pFunc);
if (TSDB_CODE_SUCCESS != code) {
return code;
}
diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c
index 2a458f7746..f638022ed8 100644
--- a/source/libs/parser/src/parUtil.c
+++ b/source/libs/parser/src/parUtil.c
@@ -195,6 +195,10 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return "ORDER BY \"%s\" is ambiguous";
case TSDB_CODE_PAR_NOT_SUPPORT_MULTI_RESULT:
return "Operator not supported multi result: %s";
+ case TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY:
+ return "tag %s can not be primary key";
+ case TSDB_CODE_PAR_SECOND_COL_PK:
+ return "primary key column must be second column";
default:
return "Unknown error";
}
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 6f4109d1c4..8afd01ea0b 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -397,9 +397,6 @@
#define TK_VALUES 348
#define TK_VARIABLE 349
#define TK_WAL 350
-#define TK_ENCODE 351
-#define TK_COMPRESS 352
-#define TK_LEVEL 353
#endif
/**************** End token definitions ***************************************/
@@ -459,29 +456,29 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 518
+#define YYNOCODE 512
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- STokenPair yy21;
- int32_t yy396;
- SNodeList* yy404;
- EFillMode yy466;
- SDataType yy504;
- SAlterOption yy529;
- ENullOrder yy669;
- EJoinType yy680;
- SToken yy701;
- EShowKind yy705;
- bool yy733;
- EOperatorType yy884;
- SNode* yy896;
- int8_t yy915;
- EOrder yy918;
- int64_t yy949;
- SShowTablesOption yy989;
+ STokenPair yy57;
+ int64_t yy221;
+ EOperatorType yy252;
+ EShowKind yy321;
+ bool yy345;
+ EFillMode yy358;
+ SNode* yy360;
+ SNodeList* yy536;
+ int32_t yy580;
+ ENullOrder yy585;
+ EJoinType yy596;
+ EOrder yy642;
+ int8_t yy695;
+ SAlterOption yy797;
+ SDataType yy912;
+ SToken yy929;
+ SShowTablesOption yy1005;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -497,18 +494,18 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 860
-#define YYNRULE 657
-#define YYNRULE_WITH_ACTION 657
-#define YYNTOKEN 354
-#define YY_MAX_SHIFT 859
-#define YY_MIN_SHIFTREDUCE 1269
-#define YY_MAX_SHIFTREDUCE 1925
-#define YY_ERROR_ACTION 1926
-#define YY_ACCEPT_ACTION 1927
-#define YY_NO_ACTION 1928
-#define YY_MIN_REDUCE 1929
-#define YY_MAX_REDUCE 2585
+#define YYNSTATE 852
+#define YYNRULE 649
+#define YYNRULE_WITH_ACTION 649
+#define YYNTOKEN 351
+#define YY_MAX_SHIFT 851
+#define YY_MIN_SHIFTREDUCE 1256
+#define YY_MAX_SHIFTREDUCE 1904
+#define YY_ERROR_ACTION 1905
+#define YY_ACCEPT_ACTION 1906
+#define YY_NO_ACTION 1907
+#define YY_MIN_REDUCE 1908
+#define YY_MAX_REDUCE 2556
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -575,825 +572,853 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2797)
+#define YY_ACTTAB_COUNT (2941)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 2261, 742, 2120, 2109, 473, 742, 2120, 429, 2176, 472,
- /* 10 */ 2169, 2171, 48, 46, 1843, 417, 404, 34, 2258, 729,
- /* 20 */ 424, 210, 1684, 41, 40, 138, 2174, 47, 45, 44,
- /* 30 */ 43, 42, 615, 36, 1840, 1769, 2015, 1682, 1709, 41,
- /* 40 */ 40, 169, 2381, 47, 45, 44, 43, 42, 1712, 405,
- /* 50 */ 427, 2122, 721, 147, 680, 724, 2176, 2552, 814, 2174,
- /* 60 */ 112, 2080, 41, 40, 414, 1764, 47, 45, 44, 43,
- /* 70 */ 42, 19, 186, 1927, 2174, 2558, 205, 148, 1690, 2557,
- /* 80 */ 2553, 710, 2552, 2399, 41, 40, 2112, 30, 47, 45,
- /* 90 */ 44, 43, 42, 47, 45, 44, 43, 42, 2347, 2242,
- /* 100 */ 758, 2556, 396, 395, 856, 2553, 2555, 15, 577, 831,
- /* 110 */ 830, 829, 828, 436, 574, 827, 826, 152, 821, 820,
- /* 120 */ 819, 818, 817, 816, 815, 151, 809, 808, 807, 435,
- /* 130 */ 434, 804, 803, 802, 185, 184, 801, 572, 704, 2380,
- /* 140 */ 573, 1972, 2418, 1771, 1772, 114, 2382, 762, 2384, 2385,
- /* 150 */ 757, 276, 752, 1710, 1335, 439, 1334, 188, 480, 2471,
- /* 160 */ 438, 198, 1888, 420, 2467, 303, 2479, 720, 63, 139,
- /* 170 */ 719, 143, 2552, 173, 394, 393, 2163, 617, 207, 1309,
- /* 180 */ 1744, 1754, 427, 2122, 1887, 741, 2501, 1770, 1773, 1336,
- /* 190 */ 708, 205, 161, 721, 147, 2553, 710, 2194, 1316, 619,
- /* 200 */ 433, 432, 1685, 618, 1683, 680, 539, 537, 2552, 370,
- /* 210 */ 305, 41, 40, 219, 457, 47, 45, 44, 43, 42,
- /* 220 */ 664, 1311, 1314, 1315, 2381, 1691, 2558, 205, 225, 1652,
- /* 230 */ 1653, 2553, 710, 741, 1688, 1689, 1741, 759, 1743, 1746,
- /* 240 */ 1747, 1748, 1749, 1750, 1751, 1752, 1753, 754, 750, 1762,
- /* 250 */ 1763, 1765, 1766, 1767, 1768, 2, 48, 46, 2381, 1929,
- /* 260 */ 1710, 368, 1709, 1707, 424, 2399, 1684, 55, 186, 90,
- /* 270 */ 523, 724, 89, 542, 381, 703, 1512, 1513, 541, 1769,
- /* 280 */ 2347, 1682, 758, 137, 136, 135, 134, 133, 132, 131,
- /* 290 */ 130, 129, 2331, 390, 503, 2241, 543, 582, 2300, 2399,
- /* 300 */ 2340, 369, 505, 2399, 1839, 723, 203, 2479, 2480, 1764,
- /* 310 */ 145, 2484, 483, 811, 2347, 19, 758, 2261, 1798, 240,
- /* 320 */ 51, 2380, 1690, 575, 2418, 1980, 663, 114, 2382, 762,
- /* 330 */ 2384, 2385, 757, 307, 752, 2259, 729, 150, 88, 157,
- /* 340 */ 2442, 2471, 461, 446, 589, 420, 2467, 68, 856, 391,
- /* 350 */ 680, 15, 741, 2552, 1741, 2380, 518, 517, 2418, 2357,
- /* 360 */ 491, 114, 2382, 762, 2384, 2385, 757, 702, 752, 463,
- /* 370 */ 459, 2558, 205, 188, 2111, 2471, 2553, 710, 813, 420,
- /* 380 */ 2467, 699, 1799, 1603, 1604, 99, 2361, 1771, 1772, 1952,
- /* 390 */ 2248, 2227, 1694, 530, 529, 528, 527, 522, 521, 520,
- /* 400 */ 519, 372, 2502, 590, 2254, 509, 508, 507, 506, 500,
- /* 410 */ 499, 498, 2557, 493, 492, 389, 1631, 742, 2120, 484,
- /* 420 */ 1571, 1572, 1583, 1584, 1744, 1754, 1590, 1602, 1605, 1712,
- /* 430 */ 2363, 1770, 1773, 588, 634, 633, 632, 138, 172, 51,
- /* 440 */ 752, 624, 144, 628, 620, 2347, 1685, 627, 1683, 2126,
- /* 450 */ 63, 1847, 626, 631, 398, 397, 580, 1709, 625, 573,
- /* 460 */ 1972, 621, 37, 422, 1793, 1794, 1795, 1796, 1797, 1801,
- /* 470 */ 1802, 1803, 1804, 705, 700, 693, 689, 52, 1688, 1689,
- /* 480 */ 1741, 2486, 1743, 1746, 1747, 1748, 1749, 1750, 1751, 1752,
- /* 490 */ 1753, 754, 750, 1762, 1763, 1765, 1766, 1767, 1768, 2,
- /* 500 */ 12, 48, 46, 2381, 652, 489, 2237, 2483, 242, 424,
- /* 510 */ 2210, 1684, 575, 592, 1980, 533, 759, 1911, 1982, 650,
- /* 520 */ 1477, 648, 272, 271, 1769, 1709, 1682, 798, 163, 162,
- /* 530 */ 795, 794, 793, 160, 1468, 790, 789, 788, 1472, 787,
- /* 540 */ 1474, 1475, 786, 783, 2399, 1483, 780, 1485, 1486, 777,
- /* 550 */ 774, 771, 38, 323, 1764, 2018, 1713, 221, 175, 2347,
- /* 560 */ 19, 758, 44, 43, 42, 128, 2058, 1690, 127, 126,
- /* 570 */ 125, 124, 123, 122, 121, 120, 119, 230, 742, 2120,
- /* 580 */ 41, 40, 2381, 1779, 47, 45, 44, 43, 42, 1709,
- /* 590 */ 664, 305, 1713, 856, 800, 759, 15, 2509, 56, 1428,
- /* 600 */ 2380, 532, 229, 2418, 307, 661, 114, 2382, 762, 2384,
- /* 610 */ 2385, 757, 63, 752, 1427, 307, 1318, 1745, 2572, 1335,
- /* 620 */ 2471, 1334, 1708, 2399, 420, 2467, 495, 2237, 634, 633,
- /* 630 */ 632, 418, 1771, 1772, 106, 624, 144, 628, 2347, 172,
- /* 640 */ 758, 627, 307, 2095, 525, 2237, 626, 631, 398, 397,
- /* 650 */ 2125, 176, 625, 1941, 1336, 621, 1876, 41, 40, 2381,
- /* 660 */ 2113, 47, 45, 44, 43, 42, 12, 666, 2300, 1744,
- /* 670 */ 1754, 516, 759, 1742, 2522, 515, 1770, 1773, 223, 2380,
- /* 680 */ 2176, 544, 2418, 514, 1690, 114, 2382, 762, 2384, 2385,
- /* 690 */ 757, 1685, 752, 1683, 742, 2120, 228, 2572, 728, 2471,
- /* 700 */ 2399, 2170, 2171, 420, 2467, 1684, 696, 695, 1874, 1875,
- /* 710 */ 1877, 1878, 1879, 800, 477, 2347, 63, 758, 721, 147,
- /* 720 */ 1682, 2104, 375, 1688, 1689, 1741, 1713, 1743, 1746, 1747,
- /* 730 */ 1748, 1749, 1750, 1751, 1752, 1753, 754, 750, 1762, 1763,
- /* 740 */ 1765, 1766, 1767, 1768, 2, 48, 46, 1774, 3, 1745,
- /* 750 */ 767, 766, 765, 424, 201, 1684, 2380, 1859, 2381, 2418,
- /* 760 */ 54, 1690, 114, 2382, 762, 2384, 2385, 757, 1769, 752,
- /* 770 */ 1682, 759, 1714, 691, 2572, 679, 2471, 307, 41, 40,
- /* 780 */ 420, 2467, 47, 45, 44, 43, 42, 856, 2357, 2381,
- /* 790 */ 314, 315, 95, 742, 2120, 313, 14, 13, 1764, 2399,
- /* 800 */ 742, 2120, 759, 2365, 2545, 1742, 1338, 1339, 1714, 392,
- /* 810 */ 471, 1690, 470, 478, 2347, 2361, 758, 41, 40, 2115,
- /* 820 */ 497, 47, 45, 44, 43, 42, 2381, 1316, 742, 2120,
- /* 830 */ 2399, 204, 2479, 2480, 1432, 145, 2484, 856, 791, 759,
- /* 840 */ 49, 2490, 469, 2107, 1951, 2347, 275, 758, 510, 1431,
- /* 850 */ 274, 1314, 1315, 611, 610, 2380, 1950, 1416, 2418, 2363,
- /* 860 */ 421, 114, 2382, 762, 2384, 2385, 757, 2399, 752, 752,
- /* 870 */ 742, 2120, 12, 2572, 10, 2471, 1771, 1772, 95, 420,
- /* 880 */ 2467, 307, 2347, 2176, 758, 1685, 2380, 1683, 196, 2418,
- /* 890 */ 511, 419, 114, 2382, 762, 2384, 2385, 757, 1418, 752,
- /* 900 */ 2347, 2174, 2002, 1812, 2572, 2116, 2471, 61, 742, 2120,
- /* 910 */ 420, 2467, 2347, 1744, 1754, 677, 546, 1688, 1689, 98,
- /* 920 */ 1770, 1773, 376, 2380, 635, 403, 2418, 654, 512, 114,
- /* 930 */ 2382, 762, 2384, 2385, 757, 1685, 752, 1683, 2328, 742,
- /* 940 */ 2120, 2572, 1714, 2471, 2176, 742, 2120, 420, 2467, 1949,
- /* 950 */ 41, 40, 428, 2381, 47, 45, 44, 43, 42, 591,
- /* 960 */ 1713, 744, 2174, 2443, 1918, 2117, 759, 1688, 1689, 1741,
- /* 970 */ 9, 1743, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753,
- /* 980 */ 754, 750, 1762, 1763, 1765, 1766, 1767, 1768, 2, 48,
- /* 990 */ 46, 2381, 1930, 2096, 2399, 742, 2120, 424, 746, 1684,
- /* 1000 */ 2443, 613, 612, 2557, 759, 2347, 2552, 630, 629, 2347,
- /* 1010 */ 2176, 758, 1769, 128, 1682, 278, 127, 126, 125, 124,
- /* 1020 */ 123, 122, 121, 120, 119, 2556, 1868, 2176, 737, 2553,
- /* 1030 */ 2554, 569, 2399, 2094, 1948, 388, 1947, 1946, 825, 823,
- /* 1040 */ 567, 1869, 1764, 563, 559, 2174, 1945, 2347, 2556, 758,
- /* 1050 */ 2380, 1944, 2486, 2418, 430, 1690, 114, 2382, 762, 2384,
- /* 1060 */ 2385, 757, 172, 752, 1800, 742, 2120, 1943, 2446, 1917,
- /* 1070 */ 2471, 1957, 851, 2125, 420, 2467, 2491, 1832, 2482, 173,
- /* 1080 */ 1709, 856, 1867, 709, 49, 286, 2552, 2381, 2380, 2123,
- /* 1090 */ 2347, 2418, 2347, 2347, 114, 2382, 762, 2384, 2385, 757,
- /* 1100 */ 759, 752, 2347, 1940, 708, 205, 2444, 2347, 2471, 2553,
- /* 1110 */ 710, 1939, 420, 2467, 149, 709, 1709, 2442, 2552, 2220,
- /* 1120 */ 1771, 1772, 200, 2347, 171, 2357, 742, 2120, 2399, 798,
- /* 1130 */ 163, 162, 795, 794, 793, 160, 708, 205, 2176, 328,
- /* 1140 */ 2366, 2553, 710, 2347, 35, 758, 727, 2381, 742, 2120,
- /* 1150 */ 713, 1938, 2361, 2309, 1805, 2000, 2175, 1744, 1754, 2347,
- /* 1160 */ 759, 487, 742, 2120, 1770, 1773, 212, 2347, 318, 798,
- /* 1170 */ 163, 162, 795, 794, 793, 160, 1714, 637, 1991, 1685,
- /* 1180 */ 1937, 1683, 739, 76, 2380, 716, 1936, 2418, 2399, 1935,
- /* 1190 */ 114, 2382, 762, 2384, 2385, 757, 2363, 752, 792, 1832,
- /* 1200 */ 639, 2167, 745, 2347, 2471, 758, 752, 2347, 420, 2467,
- /* 1210 */ 277, 1688, 1689, 1741, 1934, 1743, 1746, 1747, 1748, 1749,
- /* 1220 */ 1750, 1751, 1752, 1753, 754, 750, 1762, 1763, 1765, 1766,
- /* 1230 */ 1767, 1768, 2, 48, 46, 87, 2347, 140, 1933, 2341,
- /* 1240 */ 1745, 424, 2347, 1684, 2380, 2347, 641, 2418, 1932, 86,
- /* 1250 */ 115, 2382, 762, 2384, 2385, 757, 1769, 752, 1682, 742,
- /* 1260 */ 2120, 653, 742, 2120, 2471, 742, 2120, 161, 2470, 2467,
- /* 1270 */ 2347, 796, 2486, 797, 2167, 2097, 2167, 273, 2381, 740,
- /* 1280 */ 338, 263, 324, 2153, 261, 431, 1764, 265, 161, 680,
- /* 1290 */ 264, 759, 2552, 644, 2347, 687, 1742, 622, 2481, 1690,
- /* 1300 */ 638, 636, 619, 623, 2347, 287, 618, 270, 153, 267,
- /* 1310 */ 2558, 205, 266, 1989, 749, 2553, 710, 269, 174, 2399,
- /* 1320 */ 268, 1413, 656, 344, 655, 856, 2102, 1411, 15, 50,
- /* 1330 */ 50, 189, 1742, 2381, 2347, 642, 758, 1920, 1921, 712,
- /* 1340 */ 342, 74, 1647, 659, 73, 2124, 759, 161, 72, 100,
- /* 1350 */ 283, 71, 2368, 111, 371, 1693, 50, 312, 14, 13,
- /* 1360 */ 753, 337, 108, 1650, 1771, 1772, 238, 554, 552, 549,
- /* 1370 */ 1863, 75, 158, 161, 2399, 2380, 66, 50, 2418, 199,
- /* 1380 */ 408, 115, 2382, 762, 2384, 2385, 757, 1692, 752, 2347,
- /* 1390 */ 2059, 758, 1942, 680, 2515, 2471, 2552, 805, 300, 747,
- /* 1400 */ 2467, 1744, 1754, 50, 1873, 1872, 292, 63, 1770, 1773,
- /* 1410 */ 2370, 769, 159, 714, 2558, 205, 697, 294, 161, 2553,
- /* 1420 */ 710, 1390, 726, 1685, 142, 1683, 2400, 721, 147, 806,
- /* 1430 */ 2380, 1600, 316, 2418, 141, 2056, 361, 2382, 762, 2384,
- /* 1440 */ 2385, 757, 158, 752, 1371, 64, 734, 320, 1459, 1983,
- /* 1450 */ 717, 1806, 1755, 1388, 2055, 1688, 1689, 1741, 2246, 1743,
- /* 1460 */ 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 754, 750,
- /* 1470 */ 1762, 1763, 1765, 1766, 1767, 1768, 2, 1790, 336, 2381,
- /* 1480 */ 1973, 433, 432, 2505, 437, 1372, 1490, 1494, 694, 410,
- /* 1490 */ 701, 1698, 759, 1501, 84, 83, 476, 406, 731, 218,
- /* 1500 */ 2247, 849, 1979, 2164, 1769, 2381, 1691, 673, 2506, 1499,
- /* 1510 */ 2516, 722, 468, 466, 302, 299, 306, 164, 756, 2081,
- /* 1520 */ 2399, 445, 1696, 367, 5, 440, 455, 386, 453, 452,
- /* 1530 */ 448, 444, 441, 469, 1764, 2347, 454, 758, 1717, 2381,
- /* 1540 */ 206, 2479, 2480, 465, 145, 2484, 2399, 1690, 464, 467,
- /* 1550 */ 213, 214, 759, 216, 1695, 1624, 481, 331, 1707, 1708,
- /* 1560 */ 488, 2347, 2381, 758, 227, 490, 494, 496, 535, 501,
- /* 1570 */ 513, 2239, 307, 748, 548, 759, 760, 531, 524, 2418,
- /* 1580 */ 2399, 526, 115, 2382, 762, 2384, 2385, 757, 534, 752,
- /* 1590 */ 547, 536, 545, 232, 233, 2347, 2471, 758, 550, 551,
- /* 1600 */ 380, 2467, 2380, 2399, 235, 2418, 553, 555, 360, 2382,
- /* 1610 */ 762, 2384, 2385, 757, 755, 752, 743, 2436, 2347, 1715,
- /* 1620 */ 758, 570, 4, 571, 579, 578, 243, 581, 92, 665,
- /* 1630 */ 1710, 583, 246, 1716, 1718, 584, 2380, 587, 585, 2418,
- /* 1640 */ 1719, 614, 177, 2382, 762, 2384, 2385, 757, 249, 752,
- /* 1650 */ 251, 2255, 93, 658, 94, 593, 256, 2318, 616, 2380,
- /* 1660 */ 725, 645, 2418, 2110, 117, 177, 2382, 762, 2384, 2385,
- /* 1670 */ 757, 1699, 752, 1694, 364, 260, 646, 97, 2106, 680,
- /* 1680 */ 262, 166, 2552, 2381, 681, 2512, 116, 2108, 660, 2103,
- /* 1690 */ 167, 168, 1711, 279, 2315, 154, 759, 669, 2314, 2381,
- /* 1700 */ 2558, 205, 668, 1702, 1704, 2553, 710, 667, 2513, 332,
- /* 1710 */ 680, 284, 759, 2552, 2301, 282, 675, 750, 1762, 1763,
- /* 1720 */ 1765, 1766, 1767, 1768, 2399, 672, 698, 2521, 684, 732,
- /* 1730 */ 289, 2558, 205, 291, 707, 8, 2553, 710, 2520, 2347,
- /* 1740 */ 2399, 758, 674, 685, 683, 298, 411, 2493, 682, 295,
- /* 1750 */ 293, 718, 1832, 180, 715, 2347, 2575, 758, 146, 2381,
- /* 1760 */ 1712, 1837, 192, 296, 1835, 2487, 308, 297, 155, 730,
- /* 1770 */ 735, 2269, 759, 2268, 2267, 416, 333, 334, 736, 301,
- /* 1780 */ 2380, 2381, 156, 2418, 208, 2121, 178, 2382, 762, 2384,
- /* 1790 */ 2385, 757, 335, 752, 759, 2381, 2380, 105, 2551, 2418,
- /* 1800 */ 2399, 1, 115, 2382, 762, 2384, 2385, 757, 759, 752,
- /* 1810 */ 62, 2452, 2168, 107, 2381, 2347, 2471, 758, 326, 1293,
- /* 1820 */ 764, 2468, 2399, 853, 339, 850, 165, 759, 409, 855,
- /* 1830 */ 363, 348, 377, 53, 385, 378, 2399, 2347, 341, 758,
- /* 1840 */ 711, 2573, 343, 362, 2339, 352, 2338, 2337, 81, 2332,
- /* 1850 */ 442, 2347, 443, 758, 447, 2399, 2380, 1675, 1676, 2418,
- /* 1860 */ 211, 415, 354, 2382, 762, 2384, 2385, 757, 2330, 752,
- /* 1870 */ 2347, 449, 758, 450, 451, 1674, 2329, 387, 2380, 2327,
- /* 1880 */ 456, 2418, 2326, 2325, 361, 2382, 762, 2384, 2385, 757,
- /* 1890 */ 458, 752, 2380, 2381, 460, 2418, 2324, 462, 178, 2382,
- /* 1900 */ 762, 2384, 2385, 757, 1663, 752, 756, 2305, 706, 215,
- /* 1910 */ 2304, 2380, 217, 1627, 2418, 82, 1626, 361, 2382, 762,
- /* 1920 */ 2384, 2385, 757, 662, 752, 2282, 2281, 2280, 474, 475,
- /* 1930 */ 2381, 2279, 2278, 2229, 2399, 479, 1570, 2226, 482, 258,
- /* 1940 */ 2225, 859, 2219, 759, 486, 485, 2216, 220, 2215, 2347,
- /* 1950 */ 85, 758, 2214, 2574, 2213, 181, 2218, 330, 222, 2217,
- /* 1960 */ 2212, 2381, 2211, 2209, 609, 605, 601, 597, 226, 257,
- /* 1970 */ 2208, 2399, 2207, 195, 759, 224, 502, 423, 2206, 504,
- /* 1980 */ 2204, 2203, 847, 843, 839, 835, 2347, 327, 758, 2202,
- /* 1990 */ 2380, 2201, 2224, 2418, 2200, 2199, 360, 2382, 762, 2384,
- /* 2000 */ 2385, 757, 2399, 752, 2198, 2437, 2222, 2205, 425, 2197,
- /* 2010 */ 96, 2196, 2195, 255, 2193, 2192, 2191, 2347, 2190, 758,
- /* 2020 */ 2189, 2188, 2187, 2186, 91, 2185, 2184, 2380, 113, 2223,
- /* 2030 */ 2418, 321, 2221, 361, 2382, 762, 2384, 2385, 757, 1576,
- /* 2040 */ 752, 2381, 2183, 2182, 2181, 231, 2180, 538, 2179, 540,
- /* 2050 */ 2178, 2177, 1429, 373, 759, 1433, 2021, 2020, 2380, 2019,
- /* 2060 */ 374, 2418, 2381, 738, 361, 2382, 762, 2384, 2385, 757,
- /* 2070 */ 234, 752, 1425, 236, 2017, 759, 2014, 556, 2381, 245,
- /* 2080 */ 558, 2013, 2399, 562, 237, 557, 560, 561, 254, 247,
- /* 2090 */ 2006, 759, 564, 1993, 566, 252, 586, 2347, 2381, 758,
- /* 2100 */ 568, 1968, 187, 2399, 565, 239, 310, 78, 1317, 1967,
- /* 2110 */ 2367, 759, 79, 309, 244, 197, 576, 2303, 2347, 2399,
- /* 2120 */ 758, 241, 2299, 2289, 2277, 248, 250, 2276, 253, 2253,
- /* 2130 */ 2098, 2016, 280, 2012, 2347, 594, 758, 595, 657, 2399,
- /* 2140 */ 1364, 2418, 596, 2010, 356, 2382, 762, 2384, 2385, 757,
- /* 2150 */ 598, 752, 600, 599, 2347, 2008, 758, 602, 2381, 2380,
- /* 2160 */ 604, 2005, 2418, 603, 1988, 346, 2382, 762, 2384, 2385,
- /* 2170 */ 757, 759, 752, 606, 2381, 2380, 607, 1986, 2418, 608,
- /* 2180 */ 1987, 345, 2382, 762, 2384, 2385, 757, 759, 752, 1985,
- /* 2190 */ 1964, 2100, 65, 259, 2381, 2380, 1506, 1505, 2418, 2399,
- /* 2200 */ 2099, 347, 2382, 762, 2384, 2385, 757, 759, 752, 1415,
- /* 2210 */ 1414, 1412, 822, 1410, 2347, 2399, 758, 2003, 1409, 1408,
- /* 2220 */ 1407, 1406, 1403, 1402, 1401, 824, 399, 2001, 400, 1992,
- /* 2230 */ 2347, 1400, 758, 401, 1990, 2399, 402, 1963, 643, 1962,
- /* 2240 */ 640, 1961, 647, 1960, 649, 1959, 651, 2381, 118, 1657,
- /* 2250 */ 2347, 29, 758, 1659, 1661, 2380, 1656, 2302, 2418, 69,
- /* 2260 */ 759, 353, 2382, 762, 2384, 2385, 757, 57, 752, 281,
- /* 2270 */ 2298, 2380, 2381, 58, 2418, 1633, 1635, 357, 2382, 762,
- /* 2280 */ 2384, 2385, 757, 2288, 752, 759, 670, 170, 2399, 671,
- /* 2290 */ 285, 2380, 2275, 1637, 2418, 2274, 1612, 349, 2382, 762,
- /* 2300 */ 2384, 2385, 757, 2347, 752, 758, 2557, 2381, 1611, 20,
- /* 2310 */ 676, 1890, 686, 2399, 17, 31, 288, 678, 1864, 407,
- /* 2320 */ 759, 6, 7, 690, 692, 2381, 21, 22, 2347, 688,
- /* 2330 */ 758, 290, 191, 1871, 1858, 202, 2368, 179, 759, 190,
- /* 2340 */ 32, 33, 80, 2381, 2380, 67, 24, 2418, 2399, 23,
- /* 2350 */ 358, 2382, 762, 2384, 2385, 757, 759, 752, 1910, 1911,
- /* 2360 */ 1905, 1904, 412, 2347, 18, 758, 2399, 1909, 1908, 2380,
- /* 2370 */ 413, 1829, 2418, 1828, 59, 350, 2382, 762, 2384, 2385,
- /* 2380 */ 757, 2347, 752, 758, 2399, 304, 60, 182, 2273, 2252,
- /* 2390 */ 102, 101, 25, 2251, 103, 193, 2381, 311, 1866, 2347,
- /* 2400 */ 322, 758, 26, 317, 2380, 70, 11, 2418, 104, 759,
- /* 2410 */ 359, 2382, 762, 2384, 2385, 757, 108, 752, 13, 1781,
- /* 2420 */ 319, 2381, 2380, 1780, 1700, 2418, 733, 1791, 351, 2382,
- /* 2430 */ 762, 2384, 2385, 757, 759, 752, 1759, 2399, 763, 2421,
- /* 2440 */ 2380, 751, 39, 2418, 183, 1757, 365, 2382, 762, 2384,
- /* 2450 */ 2385, 757, 2347, 752, 758, 1756, 2381, 16, 194, 1734,
- /* 2460 */ 1925, 27, 2399, 1726, 28, 1924, 1923, 1491, 768, 759,
- /* 2470 */ 426, 770, 772, 1488, 773, 776, 2381, 2347, 1487, 758,
- /* 2480 */ 1484, 761, 775, 778, 779, 781, 1478, 782, 784, 759,
- /* 2490 */ 1476, 785, 2381, 2380, 1482, 325, 2418, 2399, 109, 366,
- /* 2500 */ 2382, 762, 2384, 2385, 757, 759, 752, 1481, 110, 1480,
- /* 2510 */ 1500, 1479, 2347, 77, 758, 1496, 1397, 2399, 2380, 1362,
- /* 2520 */ 799, 2418, 1394, 1393, 2393, 2382, 762, 2384, 2385, 757,
- /* 2530 */ 1423, 752, 2347, 2399, 758, 1392, 1391, 1389, 1387, 1386,
- /* 2540 */ 1385, 810, 1422, 812, 209, 1383, 1382, 1381, 2347, 1380,
- /* 2550 */ 758, 1379, 2381, 2380, 1378, 1377, 2418, 1417, 1419, 2392,
- /* 2560 */ 2382, 762, 2384, 2385, 757, 759, 752, 1374, 1373, 1370,
- /* 2570 */ 1369, 1368, 2381, 2380, 1367, 2011, 2418, 832, 2009, 2391,
- /* 2580 */ 2382, 762, 2384, 2385, 757, 759, 752, 833, 2381, 2380,
- /* 2590 */ 834, 836, 2418, 2399, 837, 382, 2382, 762, 2384, 2385,
- /* 2600 */ 757, 759, 752, 838, 2007, 840, 841, 842, 2347, 2004,
- /* 2610 */ 758, 844, 846, 2399, 845, 1984, 848, 1306, 1958, 1294,
- /* 2620 */ 852, 329, 854, 1928, 1686, 340, 857, 858, 2347, 2399,
- /* 2630 */ 758, 1928, 1928, 1928, 1928, 1928, 1928, 1928, 1928, 1928,
- /* 2640 */ 1928, 1928, 1928, 1928, 2347, 1928, 758, 1928, 1928, 2380,
- /* 2650 */ 1928, 1928, 2418, 1928, 1928, 383, 2382, 762, 2384, 2385,
- /* 2660 */ 757, 2381, 752, 1928, 1928, 1928, 1928, 1928, 1928, 2380,
- /* 2670 */ 1928, 1928, 2418, 1928, 759, 379, 2382, 762, 2384, 2385,
- /* 2680 */ 757, 1928, 752, 1928, 1928, 2380, 2381, 1928, 2418, 1928,
- /* 2690 */ 1928, 384, 2382, 762, 2384, 2385, 757, 1928, 752, 759,
- /* 2700 */ 1928, 1928, 2399, 1928, 1928, 1928, 1928, 1928, 1928, 1928,
- /* 2710 */ 1928, 1928, 1928, 1928, 1928, 1928, 1928, 2347, 1928, 758,
- /* 2720 */ 1928, 1928, 1928, 1928, 1928, 1928, 1928, 2399, 1928, 1928,
- /* 2730 */ 1928, 1928, 1928, 1928, 1928, 1928, 1928, 1928, 1928, 1928,
- /* 2740 */ 1928, 1928, 2347, 1928, 758, 1928, 1928, 1928, 1928, 1928,
- /* 2750 */ 1928, 1928, 1928, 1928, 1928, 1928, 1928, 1928, 760, 1928,
- /* 2760 */ 1928, 2418, 1928, 1928, 356, 2382, 762, 2384, 2385, 757,
- /* 2770 */ 1928, 752, 1928, 1928, 1928, 1928, 1928, 1928, 1928, 1928,
- /* 2780 */ 1928, 1928, 1928, 2380, 1928, 1928, 2418, 1928, 1928, 355,
- /* 2790 */ 2382, 762, 2384, 2385, 757, 1928, 752,
+ /* 0 */ 95, 2332, 567, 2151, 468, 568, 1951, 14, 13, 467,
+ /* 10 */ 2185, 2315, 48, 46, 1826, 2340, 2532, 387, 723, 2527,
+ /* 20 */ 419, 699, 1667, 41, 40, 2336, 2093, 47, 45, 44,
+ /* 30 */ 43, 42, 174, 647, 1920, 1752, 1994, 1665, 2531, 737,
+ /* 40 */ 2098, 704, 2528, 2530, 2527, 2356, 38, 321, 645, 584,
+ /* 50 */ 643, 270, 269, 1696, 675, 716, 146, 2527, 719, 137,
+ /* 60 */ 112, 675, 703, 203, 2527, 1747, 610, 2528, 705, 2338,
+ /* 70 */ 416, 19, 739, 2236, 2418, 2533, 203, 147, 1673, 747,
+ /* 80 */ 2528, 705, 2533, 203, 2236, 2090, 2374, 2528, 705, 41,
+ /* 90 */ 40, 2234, 724, 47, 45, 44, 43, 42, 2322, 412,
+ /* 100 */ 753, 587, 2233, 724, 848, 585, 2229, 15, 475, 823,
+ /* 110 */ 822, 821, 820, 431, 1795, 819, 818, 151, 813, 812,
+ /* 120 */ 811, 810, 809, 808, 807, 150, 801, 800, 799, 430,
+ /* 130 */ 429, 796, 795, 794, 183, 182, 793, 2074, 1322, 2355,
+ /* 140 */ 1321, 63, 2393, 1754, 1755, 114, 2357, 757, 2359, 2360,
+ /* 150 */ 752, 1692, 747, 534, 532, 142, 367, 186, 575, 2446,
+ /* 160 */ 217, 568, 1951, 415, 2442, 301, 2454, 715, 572, 138,
+ /* 170 */ 714, 511, 2527, 1323, 569, 510, 184, 2151, 205, 2532,
+ /* 180 */ 1727, 1737, 2527, 509, 383, 736, 2476, 1753, 1756, 1870,
+ /* 190 */ 703, 203, 2149, 716, 146, 2528, 705, 1908, 385, 52,
+ /* 200 */ 2216, 2531, 1668, 63, 1666, 2528, 2529, 792, 196, 1901,
+ /* 210 */ 1692, 41, 40, 2145, 2146, 47, 45, 44, 43, 42,
+ /* 220 */ 2138, 136, 135, 134, 133, 132, 131, 130, 129, 128,
+ /* 230 */ 736, 484, 2212, 528, 1671, 1672, 1724, 1724, 1726, 1729,
+ /* 240 */ 1730, 1731, 1732, 1733, 1734, 1735, 1736, 749, 745, 1745,
+ /* 250 */ 1746, 1748, 1749, 1750, 1751, 2, 48, 46, 1325, 1326,
+ /* 260 */ 1693, 365, 704, 1690, 419, 2527, 1667, 428, 427, 1697,
+ /* 270 */ 518, 238, 2356, 537, 377, 570, 658, 1959, 536, 1752,
+ /* 280 */ 219, 1665, 223, 703, 203, 751, 273, 240, 2528, 705,
+ /* 290 */ 272, 570, 1674, 1959, 498, 228, 538, 466, 1696, 465,
+ /* 300 */ 698, 366, 500, 202, 2454, 2455, 305, 144, 2459, 1747,
+ /* 310 */ 1931, 659, 478, 2374, 1900, 19, 1460, 51, 1781, 527,
+ /* 320 */ 227, 452, 1673, 90, 274, 2322, 89, 753, 2374, 464,
+ /* 330 */ 1451, 782, 781, 780, 1455, 779, 1457, 1458, 778, 775,
+ /* 340 */ 583, 1466, 772, 1468, 1469, 769, 766, 763, 848, 386,
+ /* 350 */ 1693, 15, 790, 161, 160, 787, 786, 785, 158, 98,
+ /* 360 */ 486, 1997, 372, 2322, 305, 398, 2355, 649, 305, 2393,
+ /* 370 */ 1566, 1567, 357, 2357, 757, 2359, 2360, 752, 750, 747,
+ /* 380 */ 738, 2411, 1782, 1586, 1587, 577, 2275, 1754, 1755, 697,
+ /* 390 */ 2223, 2202, 88, 525, 524, 523, 522, 517, 516, 515,
+ /* 400 */ 514, 369, 1635, 1636, 1930, 504, 503, 502, 501, 495,
+ /* 410 */ 494, 493, 2532, 488, 487, 384, 184, 737, 2098, 479,
+ /* 420 */ 1554, 1555, 716, 146, 1727, 1737, 1573, 1585, 1588, 1695,
+ /* 430 */ 2461, 1753, 1756, 1695, 629, 628, 627, 137, 716, 146,
+ /* 440 */ 2217, 619, 143, 623, 615, 1305, 1668, 622, 1666, 456,
+ /* 450 */ 1696, 1691, 621, 626, 393, 392, 2458, 2322, 620, 1677,
+ /* 460 */ 194, 616, 37, 417, 1776, 1777, 1778, 1779, 1780, 1784,
+ /* 470 */ 1785, 1786, 1787, 1495, 1496, 792, 458, 454, 1671, 1672,
+ /* 480 */ 1724, 744, 1726, 1729, 1730, 1731, 1732, 1733, 1734, 1735,
+ /* 490 */ 1736, 749, 745, 1745, 1746, 1748, 1749, 1750, 1751, 2,
+ /* 500 */ 12, 48, 46, 2356, 1322, 2332, 1321, 736, 2531, 419,
+ /* 510 */ 2075, 1667, 422, 1823, 1697, 256, 754, 1894, 424, 2089,
+ /* 520 */ 168, 2144, 2146, 2151, 1752, 1929, 1665, 400, 2100, 2336,
+ /* 530 */ 399, 179, 204, 2454, 2455, 2149, 144, 2459, 2149, 1323,
+ /* 540 */ 604, 600, 596, 592, 2374, 255, 106, 718, 201, 2454,
+ /* 550 */ 2455, 1303, 144, 2459, 1747, 12, 2322, 2151, 753, 656,
+ /* 560 */ 19, 629, 628, 627, 409, 3, 694, 1673, 619, 143,
+ /* 570 */ 623, 2091, 2149, 2338, 622, 1301, 1302, 54, 2322, 621,
+ /* 580 */ 626, 393, 392, 747, 1859, 620, 96, 1692, 616, 253,
+ /* 590 */ 12, 303, 10, 848, 51, 303, 15, 2355, 737, 2098,
+ /* 600 */ 2393, 2356, 95, 114, 2357, 757, 2359, 2360, 752, 741,
+ /* 610 */ 747, 2418, 198, 149, 754, 156, 2417, 2446, 492, 41,
+ /* 620 */ 40, 415, 2442, 47, 45, 44, 43, 42, 2094, 2332,
+ /* 630 */ 1415, 1696, 1754, 1755, 691, 690, 1857, 1858, 1860, 1861,
+ /* 640 */ 1862, 1928, 2374, 2341, 1773, 1414, 790, 161, 160, 787,
+ /* 650 */ 786, 785, 158, 2336, 2322, 243, 753, 1909, 700, 695,
+ /* 660 */ 688, 684, 490, 2212, 252, 245, 1697, 520, 2212, 1727,
+ /* 670 */ 1737, 250, 581, 1927, 63, 659, 1753, 1756, 127, 68,
+ /* 680 */ 2303, 126, 125, 124, 123, 122, 121, 120, 119, 118,
+ /* 690 */ 242, 1668, 173, 1666, 2322, 2355, 806, 2338, 2393, 2059,
+ /* 700 */ 2037, 114, 2357, 757, 2359, 2360, 752, 747, 747, 564,
+ /* 710 */ 1926, 221, 539, 2421, 2316, 2446, 226, 1673, 562, 415,
+ /* 720 */ 2442, 558, 554, 1671, 1672, 1724, 2322, 1726, 1729, 1730,
+ /* 730 */ 1731, 1732, 1733, 1734, 1735, 1736, 749, 745, 1745, 1746,
+ /* 740 */ 1748, 1749, 1750, 1751, 2, 48, 46, 1757, 2356, 661,
+ /* 750 */ 2275, 737, 2098, 419, 2284, 1667, 654, 312, 313, 305,
+ /* 760 */ 159, 719, 311, 2322, 675, 1936, 843, 2527, 1752, 127,
+ /* 770 */ 1665, 208, 126, 125, 124, 123, 122, 121, 120, 119,
+ /* 780 */ 118, 2356, 63, 1822, 413, 2533, 203, 737, 2098, 2374,
+ /* 790 */ 2528, 705, 171, 199, 754, 2151, 1961, 326, 1747, 707,
+ /* 800 */ 2100, 2322, 414, 753, 737, 2098, 675, 56, 275, 2527,
+ /* 810 */ 2149, 1673, 41, 40, 2151, 422, 47, 45, 44, 43,
+ /* 820 */ 42, 423, 2374, 171, 472, 606, 605, 2533, 203, 2149,
+ /* 830 */ 425, 2100, 2528, 705, 2322, 55, 753, 848, 171, 305,
+ /* 840 */ 49, 9, 2355, 737, 2098, 2393, 2100, 1697, 114, 2357,
+ /* 850 */ 757, 2359, 2360, 752, 1925, 747, 2356, 1924, 783, 1667,
+ /* 860 */ 186, 1296, 2446, 473, 171, 1923, 415, 2442, 2461, 754,
+ /* 870 */ 737, 2098, 2101, 1922, 1665, 2355, 1754, 1755, 2393, 2073,
+ /* 880 */ 1303, 114, 2357, 757, 2359, 2360, 752, 1919, 747, 2477,
+ /* 890 */ 505, 636, 1830, 2547, 2457, 2446, 1762, 2374, 1692, 415,
+ /* 900 */ 2442, 197, 1692, 1298, 1301, 1302, 648, 2322, 210, 2322,
+ /* 910 */ 2322, 753, 1842, 1727, 1737, 1673, 737, 2098, 2322, 2306,
+ /* 920 */ 1753, 1756, 271, 41, 40, 1692, 2322, 47, 45, 44,
+ /* 930 */ 43, 42, 44, 43, 42, 1668, 506, 1666, 639, 1851,
+ /* 940 */ 2322, 848, 674, 625, 624, 633, 631, 305, 30, 2151,
+ /* 950 */ 2355, 1403, 268, 2393, 1852, 660, 176, 2357, 757, 2359,
+ /* 960 */ 2360, 752, 2087, 747, 732, 608, 607, 1671, 1672, 1724,
+ /* 970 */ 441, 1726, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736,
+ /* 980 */ 749, 745, 1745, 1746, 1748, 1749, 1750, 1751, 2, 48,
+ /* 990 */ 46, 2083, 1405, 72, 1918, 1850, 71, 419, 1917, 1667,
+ /* 1000 */ 47, 45, 44, 43, 42, 675, 1916, 1915, 2527, 2085,
+ /* 1010 */ 706, 2548, 1752, 2151, 1665, 790, 161, 160, 787, 786,
+ /* 1020 */ 785, 158, 1914, 1871, 1913, 2356, 2533, 203, 2150, 41,
+ /* 1030 */ 40, 2528, 705, 47, 45, 44, 43, 42, 754, 1668,
+ /* 1040 */ 2484, 1666, 1747, 1783, 737, 2098, 1692, 2322, 2356, 737,
+ /* 1050 */ 2098, 2322, 1419, 737, 2098, 1673, 737, 2098, 1728, 2322,
+ /* 1060 */ 2322, 754, 1728, 2497, 507, 148, 2374, 1418, 2417, 586,
+ /* 1070 */ 1815, 1671, 1672, 2095, 61, 2322, 276, 2322, 2322, 76,
+ /* 1080 */ 753, 848, 672, 2356, 49, 1728, 614, 41, 40, 2374,
+ /* 1090 */ 613, 47, 45, 44, 43, 42, 754, 708, 686, 34,
+ /* 1100 */ 2169, 2322, 2081, 753, 784, 41, 40, 2142, 1912, 47,
+ /* 1110 */ 45, 44, 43, 42, 1725, 737, 2098, 803, 1725, 2355,
+ /* 1120 */ 1754, 1755, 2393, 35, 2374, 114, 2357, 757, 2359, 2360,
+ /* 1130 */ 752, 87, 747, 1788, 541, 284, 2322, 2547, 753, 2446,
+ /* 1140 */ 711, 1725, 2355, 415, 2442, 2393, 1981, 99, 114, 2357,
+ /* 1150 */ 757, 2359, 2360, 752, 2195, 747, 1911, 1727, 1737, 1676,
+ /* 1160 */ 2547, 2322, 2446, 1675, 1753, 1756, 415, 2442, 630, 737,
+ /* 1170 */ 2098, 737, 2098, 788, 737, 2098, 2142, 2355, 1614, 1668,
+ /* 1180 */ 2393, 1666, 805, 114, 2357, 757, 2359, 2360, 752, 322,
+ /* 1190 */ 747, 722, 720, 36, 316, 2547, 482, 2446, 139, 41,
+ /* 1200 */ 40, 415, 2442, 47, 45, 44, 43, 42, 2102, 2322,
+ /* 1210 */ 86, 1671, 1672, 1724, 281, 1726, 1729, 1730, 1731, 1732,
+ /* 1220 */ 1733, 1734, 1735, 1736, 749, 745, 1745, 1746, 1748, 1749,
+ /* 1230 */ 1750, 1751, 2, 48, 46, 391, 390, 737, 2098, 2461,
+ /* 1240 */ 2076, 419, 675, 1667, 159, 2527, 737, 2098, 817, 815,
+ /* 1250 */ 737, 2098, 789, 2466, 1815, 2142, 1752, 734, 1665, 513,
+ /* 1260 */ 512, 170, 1725, 2533, 203, 2456, 735, 159, 2528, 705,
+ /* 1270 */ 426, 335, 261, 152, 2128, 259, 2356, 263, 265, 617,
+ /* 1280 */ 262, 264, 267, 1979, 1970, 266, 1747, 618, 682, 754,
+ /* 1290 */ 1968, 2520, 651, 285, 650, 2343, 50, 50, 1921, 1673,
+ /* 1300 */ 1903, 1904, 748, 1400, 1358, 632, 634, 389, 388, 187,
+ /* 1310 */ 612, 1398, 637, 14, 13, 2038, 2490, 2374, 172, 1630,
+ /* 1320 */ 298, 159, 50, 341, 310, 848, 1679, 797, 15, 2322,
+ /* 1330 */ 1678, 753, 614, 692, 2356, 75, 613, 100, 292, 157,
+ /* 1340 */ 339, 74, 1633, 159, 73, 1359, 66, 754, 141, 2465,
+ /* 1350 */ 111, 1377, 50, 2345, 368, 50, 2375, 761, 157, 108,
+ /* 1360 */ 709, 798, 2035, 1846, 1754, 1755, 236, 549, 547, 544,
+ /* 1370 */ 2355, 1856, 1855, 2393, 159, 2374, 114, 2357, 757, 2359,
+ /* 1380 */ 2360, 752, 2034, 747, 290, 1375, 2221, 2322, 2547, 753,
+ /* 1390 */ 2446, 1962, 1952, 2480, 415, 2442, 721, 1583, 689, 314,
+ /* 1400 */ 405, 1727, 1737, 140, 157, 712, 696, 63, 1753, 1756,
+ /* 1410 */ 729, 401, 432, 2222, 318, 1958, 2139, 2481, 1445, 726,
+ /* 1420 */ 2491, 1789, 668, 1668, 717, 1666, 300, 1738, 2355, 297,
+ /* 1430 */ 334, 2393, 1473, 1477, 114, 2357, 757, 2359, 2360, 752,
+ /* 1440 */ 2060, 747, 304, 841, 5, 64, 2547, 435, 2446, 1484,
+ /* 1450 */ 440, 381, 415, 2442, 448, 1671, 1672, 1724, 449, 1726,
+ /* 1460 */ 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 749, 745,
+ /* 1470 */ 1745, 1746, 1748, 1749, 1750, 1751, 2, 1700, 1482, 162,
+ /* 1480 */ 460, 428, 427, 211, 2356, 459, 212, 462, 214, 329,
+ /* 1490 */ 1690, 1681, 1607, 476, 84, 83, 471, 754, 1691, 216,
+ /* 1500 */ 483, 225, 485, 489, 1752, 491, 1674, 2356, 530, 496,
+ /* 1510 */ 508, 2214, 463, 461, 519, 521, 526, 543, 529, 531,
+ /* 1520 */ 754, 542, 540, 364, 231, 2374, 450, 230, 545, 447,
+ /* 1530 */ 443, 439, 436, 464, 1747, 1698, 1906, 2322, 546, 753,
+ /* 1540 */ 233, 548, 2356, 550, 4, 565, 566, 1673, 2374, 573,
+ /* 1550 */ 574, 576, 1693, 241, 92, 754, 244, 578, 1699, 1701,
+ /* 1560 */ 2322, 579, 753, 580, 247, 582, 1702, 249, 588, 93,
+ /* 1570 */ 94, 609, 305, 743, 2230, 254, 640, 611, 2355, 2088,
+ /* 1580 */ 116, 2393, 641, 2374, 114, 2357, 757, 2359, 2360, 752,
+ /* 1590 */ 361, 747, 97, 258, 2084, 2322, 2419, 753, 2446, 260,
+ /* 1600 */ 164, 2355, 415, 2442, 2393, 165, 653, 114, 2357, 757,
+ /* 1610 */ 2359, 2360, 752, 2086, 747, 434, 2293, 2082, 166, 740,
+ /* 1620 */ 433, 2446, 167, 2290, 2289, 415, 2442, 277, 1694, 663,
+ /* 1630 */ 662, 282, 693, 667, 669, 670, 2355, 679, 727, 2393,
+ /* 1640 */ 664, 2356, 115, 2357, 757, 2359, 2360, 752, 8, 747,
+ /* 1650 */ 330, 153, 655, 280, 754, 2496, 2446, 287, 289, 702,
+ /* 1660 */ 2445, 2442, 2495, 677, 2468, 675, 291, 2276, 2527, 680,
+ /* 1670 */ 293, 1682, 2356, 1677, 678, 296, 713, 406, 710, 1815,
+ /* 1680 */ 1695, 2526, 2374, 145, 1820, 754, 2533, 203, 2462, 190,
+ /* 1690 */ 1818, 2528, 705, 306, 2322, 331, 753, 332, 730, 2356,
+ /* 1700 */ 154, 725, 294, 1685, 1687, 2244, 2243, 731, 2242, 155,
+ /* 1710 */ 411, 178, 754, 2374, 333, 105, 62, 745, 1745, 1746,
+ /* 1720 */ 1748, 1749, 1750, 1751, 295, 2322, 2099, 753, 1, 206,
+ /* 1730 */ 2427, 107, 759, 299, 336, 2355, 324, 2143, 2393, 1280,
+ /* 1740 */ 2374, 115, 2357, 757, 2359, 2360, 752, 842, 747, 2550,
+ /* 1750 */ 845, 847, 2322, 163, 753, 2446, 345, 2356, 360, 742,
+ /* 1760 */ 2442, 373, 53, 374, 359, 340, 755, 349, 2314, 2393,
+ /* 1770 */ 754, 338, 115, 2357, 757, 2359, 2360, 752, 2313, 747,
+ /* 1780 */ 2312, 81, 2307, 437, 438, 1658, 2446, 1659, 209, 442,
+ /* 1790 */ 376, 2442, 2356, 2355, 2305, 444, 2393, 445, 2374, 175,
+ /* 1800 */ 2357, 757, 2359, 2360, 752, 754, 747, 446, 1657, 2304,
+ /* 1810 */ 2322, 382, 753, 2302, 451, 2301, 453, 2300, 455, 2299,
+ /* 1820 */ 457, 1646, 2356, 213, 2279, 215, 1610, 82, 1609, 2257,
+ /* 1830 */ 2256, 2255, 469, 2374, 2280, 754, 470, 2254, 2253, 2204,
+ /* 1840 */ 474, 676, 2487, 2201, 1553, 2322, 2200, 753, 477, 2194,
+ /* 1850 */ 481, 2355, 2191, 480, 2393, 218, 2190, 115, 2357, 757,
+ /* 1860 */ 2359, 2360, 752, 2374, 747, 85, 2189, 2188, 403, 2193,
+ /* 1870 */ 220, 2446, 2192, 2187, 2186, 2322, 2443, 753, 2184, 2183,
+ /* 1880 */ 2182, 222, 497, 2181, 499, 2179, 2355, 2356, 2178, 2393,
+ /* 1890 */ 2177, 2176, 175, 2357, 757, 2359, 2360, 752, 91, 747,
+ /* 1900 */ 754, 2199, 2356, 2175, 2174, 2173, 2197, 2180, 2172, 2171,
+ /* 1910 */ 2170, 2168, 2167, 2166, 2165, 754, 2355, 2356, 1559, 2393,
+ /* 1920 */ 2164, 2163, 358, 2357, 757, 2359, 2360, 752, 2374, 747,
+ /* 1930 */ 754, 224, 2162, 404, 229, 2488, 2161, 2160, 2159, 2198,
+ /* 1940 */ 2322, 2196, 753, 2374, 2158, 2157, 2156, 2155, 533, 2154,
+ /* 1950 */ 535, 2153, 2152, 1416, 2000, 2322, 1412, 753, 2374, 232,
+ /* 1960 */ 1999, 1998, 1420, 1996, 234, 370, 371, 235, 1993, 553,
+ /* 1970 */ 2322, 1992, 753, 552, 556, 557, 1985, 560, 1972, 551,
+ /* 1980 */ 555, 2355, 1947, 185, 2393, 559, 1304, 358, 2357, 757,
+ /* 1990 */ 2359, 2360, 752, 563, 747, 561, 2355, 2356, 1946, 2393,
+ /* 2000 */ 237, 78, 351, 2357, 757, 2359, 2360, 752, 239, 747,
+ /* 2010 */ 754, 2355, 79, 2342, 2393, 2356, 195, 176, 2357, 757,
+ /* 2020 */ 2359, 2360, 752, 571, 747, 2278, 2274, 2264, 751, 246,
+ /* 2030 */ 2251, 2228, 248, 251, 2077, 1995, 1991, 589, 2374, 2252,
+ /* 2040 */ 2356, 1351, 1989, 410, 590, 591, 593, 594, 701, 595,
+ /* 2050 */ 2322, 1987, 753, 754, 597, 598, 2374, 599, 1984, 601,
+ /* 2060 */ 603, 602, 1967, 1965, 1966, 1964, 1943, 2079, 2322, 1489,
+ /* 2070 */ 753, 2078, 2549, 65, 1488, 257, 1388, 1402, 1401, 1982,
+ /* 2080 */ 1399, 2374, 1397, 1396, 1395, 1394, 418, 1393, 814, 816,
+ /* 2090 */ 1390, 2355, 394, 2322, 2393, 753, 1389, 358, 2357, 757,
+ /* 2100 */ 2359, 2360, 752, 1980, 747, 1387, 395, 1971, 396, 2355,
+ /* 2110 */ 2356, 1969, 2393, 635, 657, 357, 2357, 757, 2359, 2360,
+ /* 2120 */ 752, 397, 747, 754, 2412, 638, 1942, 1941, 1940, 642,
+ /* 2130 */ 1939, 644, 851, 1938, 2355, 117, 646, 2393, 1640, 1642,
+ /* 2140 */ 358, 2357, 757, 2359, 2360, 752, 2356, 747, 328, 1639,
+ /* 2150 */ 2277, 2374, 1644, 279, 2273, 57, 420, 58, 1616, 754,
+ /* 2160 */ 1618, 2263, 665, 2322, 193, 753, 1620, 666, 29, 2250,
+ /* 2170 */ 2249, 169, 1595, 839, 835, 831, 827, 2356, 325, 69,
+ /* 2180 */ 283, 671, 2532, 1594, 20, 31, 673, 2374, 1873, 286,
+ /* 2190 */ 754, 1847, 681, 402, 17, 6, 683, 7, 685, 2322,
+ /* 2200 */ 687, 753, 200, 288, 2355, 21, 22, 2393, 1854, 189,
+ /* 2210 */ 358, 2357, 757, 2359, 2360, 752, 177, 747, 2374, 113,
+ /* 2220 */ 2343, 33, 319, 188, 32, 67, 1841, 80, 24, 1888,
+ /* 2230 */ 2322, 1893, 753, 1894, 1887, 407, 1892, 1891, 408, 1812,
+ /* 2240 */ 652, 60, 1811, 2393, 2248, 302, 353, 2357, 757, 2359,
+ /* 2250 */ 2360, 752, 2356, 747, 733, 180, 23, 18, 59, 2227,
+ /* 2260 */ 102, 728, 2226, 103, 101, 754, 25, 26, 108, 317,
+ /* 2270 */ 309, 2355, 2356, 1849, 2393, 191, 320, 343, 2357, 757,
+ /* 2280 */ 2359, 2360, 752, 1764, 747, 754, 1763, 315, 2356, 70,
+ /* 2290 */ 104, 1683, 13, 2374, 11, 1742, 2396, 308, 746, 181,
+ /* 2300 */ 39, 754, 1740, 1774, 307, 2322, 192, 753, 1717, 323,
+ /* 2310 */ 1739, 16, 27, 2374, 756, 1709, 28, 760, 1474, 421,
+ /* 2320 */ 758, 762, 764, 278, 1471, 2322, 765, 753, 1470, 2374,
+ /* 2330 */ 767, 768, 770, 1467, 1461, 771, 773, 774, 776, 1459,
+ /* 2340 */ 777, 2322, 1483, 753, 109, 2356, 2355, 110, 77, 2393,
+ /* 2350 */ 1479, 1465, 342, 2357, 757, 2359, 2360, 752, 754, 747,
+ /* 2360 */ 1464, 1384, 791, 1463, 1462, 2356, 2355, 1381, 1349, 2393,
+ /* 2370 */ 1380, 1379, 344, 2357, 757, 2359, 2360, 752, 754, 747,
+ /* 2380 */ 1378, 1376, 2355, 2356, 1374, 2393, 2374, 1373, 350, 2357,
+ /* 2390 */ 757, 2359, 2360, 752, 1372, 747, 754, 1410, 2322, 802,
+ /* 2400 */ 753, 1409, 207, 2356, 804, 1370, 2374, 1369, 1368, 1367,
+ /* 2410 */ 1366, 1365, 1364, 1406, 1404, 1361, 754, 1360, 2322, 1357,
+ /* 2420 */ 753, 1355, 1356, 1354, 2374, 1990, 824, 825, 1988, 828,
+ /* 2430 */ 826, 1986, 829, 830, 832, 834, 2322, 1983, 753, 2355,
+ /* 2440 */ 836, 2356, 2393, 838, 2374, 354, 2357, 757, 2359, 2360,
+ /* 2450 */ 752, 833, 747, 837, 754, 1963, 2322, 840, 753, 2355,
+ /* 2460 */ 1293, 1937, 2393, 1281, 846, 346, 2357, 757, 2359, 2360,
+ /* 2470 */ 752, 844, 747, 327, 1669, 337, 850, 2355, 2356, 849,
+ /* 2480 */ 2393, 1907, 2374, 355, 2357, 757, 2359, 2360, 752, 1907,
+ /* 2490 */ 747, 754, 1907, 1907, 2322, 1907, 753, 2355, 2356, 1907,
+ /* 2500 */ 2393, 1907, 1907, 347, 2357, 757, 2359, 2360, 752, 1907,
+ /* 2510 */ 747, 754, 1907, 1907, 2356, 1907, 1907, 1907, 1907, 2374,
+ /* 2520 */ 1907, 1907, 1907, 1907, 1907, 1907, 1907, 754, 1907, 1907,
+ /* 2530 */ 1907, 2322, 1907, 753, 1907, 2355, 1907, 1907, 2393, 2374,
+ /* 2540 */ 1907, 356, 2357, 757, 2359, 2360, 752, 1907, 747, 1907,
+ /* 2550 */ 1907, 2322, 1907, 753, 1907, 2374, 1907, 1907, 1907, 1907,
+ /* 2560 */ 1907, 1907, 1907, 1907, 1907, 1907, 1907, 2322, 1907, 753,
+ /* 2570 */ 1907, 1907, 2355, 1907, 1907, 2393, 1907, 1907, 348, 2357,
+ /* 2580 */ 757, 2359, 2360, 752, 1907, 747, 1907, 1907, 1907, 1907,
+ /* 2590 */ 1907, 1907, 2355, 1907, 1907, 2393, 1907, 1907, 362, 2357,
+ /* 2600 */ 757, 2359, 2360, 752, 1907, 747, 1907, 2356, 2355, 1907,
+ /* 2610 */ 1907, 2393, 1907, 1907, 363, 2357, 757, 2359, 2360, 752,
+ /* 2620 */ 754, 747, 1907, 1907, 1907, 1907, 2356, 1907, 1907, 1907,
+ /* 2630 */ 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 754,
+ /* 2640 */ 1907, 1907, 1907, 2356, 1907, 1907, 1907, 1907, 2374, 1907,
+ /* 2650 */ 1907, 1907, 1907, 1907, 1907, 1907, 754, 1907, 1907, 1907,
+ /* 2660 */ 2322, 1907, 753, 1907, 1907, 1907, 1907, 2374, 1907, 1907,
+ /* 2670 */ 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 2322,
+ /* 2680 */ 1907, 753, 1907, 1907, 2374, 1907, 1907, 1907, 1907, 1907,
+ /* 2690 */ 1907, 1907, 1907, 1907, 1907, 1907, 2322, 1907, 753, 1907,
+ /* 2700 */ 2356, 2355, 1907, 1907, 2393, 1907, 1907, 2368, 2357, 757,
+ /* 2710 */ 2359, 2360, 752, 754, 747, 1907, 1907, 1907, 1907, 1907,
+ /* 2720 */ 2355, 2356, 1907, 2393, 1907, 1907, 2367, 2357, 757, 2359,
+ /* 2730 */ 2360, 752, 1907, 747, 754, 1907, 1907, 2355, 2356, 1907,
+ /* 2740 */ 2393, 2374, 1907, 2366, 2357, 757, 2359, 2360, 752, 1907,
+ /* 2750 */ 747, 754, 1907, 2322, 1907, 753, 1907, 1907, 2356, 1907,
+ /* 2760 */ 1907, 1907, 2374, 1907, 1907, 1907, 1907, 1907, 1907, 1907,
+ /* 2770 */ 1907, 754, 1907, 1907, 2322, 1907, 753, 1907, 1907, 2374,
+ /* 2780 */ 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907,
+ /* 2790 */ 1907, 2322, 1907, 753, 2355, 1907, 2356, 2393, 1907, 2374,
+ /* 2800 */ 378, 2357, 757, 2359, 2360, 752, 1907, 747, 1907, 754,
+ /* 2810 */ 1907, 2322, 1907, 753, 1907, 2355, 1907, 1907, 2393, 1907,
+ /* 2820 */ 1907, 379, 2357, 757, 2359, 2360, 752, 1907, 747, 1907,
+ /* 2830 */ 1907, 1907, 2355, 2356, 1907, 2393, 1907, 2374, 375, 2357,
+ /* 2840 */ 757, 2359, 2360, 752, 1907, 747, 754, 1907, 1907, 2322,
+ /* 2850 */ 1907, 753, 2355, 1907, 1907, 2393, 1907, 1907, 380, 2357,
+ /* 2860 */ 757, 2359, 2360, 752, 1907, 747, 1907, 1907, 1907, 1907,
+ /* 2870 */ 1907, 1907, 1907, 1907, 2374, 1907, 1907, 1907, 1907, 1907,
+ /* 2880 */ 1907, 1907, 1907, 1907, 1907, 1907, 2322, 1907, 753, 1907,
+ /* 2890 */ 755, 1907, 1907, 2393, 1907, 1907, 353, 2357, 757, 2359,
+ /* 2900 */ 2360, 752, 1907, 747, 1907, 1907, 1907, 1907, 1907, 1907,
+ /* 2910 */ 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907,
+ /* 2920 */ 1907, 1907, 1907, 1907, 1907, 1907, 1907, 2355, 1907, 1907,
+ /* 2930 */ 2393, 1907, 1907, 352, 2357, 757, 2359, 2360, 752, 1907,
+ /* 2940 */ 747,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 415, 369, 370, 399, 436, 369, 370, 411, 398, 441,
- /* 10 */ 414, 415, 12, 13, 14, 430, 406, 2, 433, 434,
- /* 20 */ 20, 389, 22, 8, 9, 389, 416, 12, 13, 14,
- /* 30 */ 15, 16, 396, 2, 4, 35, 0, 37, 20, 8,
- /* 40 */ 9, 398, 357, 12, 13, 14, 15, 16, 20, 406,
- /* 50 */ 407, 408, 369, 370, 486, 370, 398, 489, 385, 416,
- /* 60 */ 376, 388, 8, 9, 406, 65, 12, 13, 14, 15,
- /* 70 */ 16, 71, 398, 354, 416, 507, 508, 393, 78, 486,
- /* 80 */ 512, 513, 489, 398, 8, 9, 402, 33, 12, 13,
- /* 90 */ 14, 15, 16, 12, 13, 14, 15, 16, 413, 425,
- /* 100 */ 415, 508, 39, 40, 104, 512, 513, 107, 14, 73,
- /* 110 */ 74, 75, 76, 77, 20, 79, 80, 81, 82, 83,
+ /* 0 */ 375, 383, 361, 395, 430, 364, 365, 1, 2, 435,
+ /* 10 */ 0, 430, 12, 13, 14, 397, 480, 392, 410, 483,
+ /* 20 */ 20, 20, 22, 8, 9, 407, 401, 12, 13, 14,
+ /* 30 */ 15, 16, 353, 21, 355, 35, 0, 37, 502, 366,
+ /* 40 */ 367, 480, 506, 507, 483, 354, 469, 470, 36, 366,
+ /* 50 */ 38, 39, 40, 20, 480, 366, 367, 483, 367, 386,
+ /* 60 */ 373, 480, 501, 502, 483, 65, 393, 506, 507, 451,
+ /* 70 */ 452, 71, 465, 409, 467, 501, 502, 390, 78, 461,
+ /* 80 */ 506, 507, 501, 502, 409, 398, 395, 506, 507, 8,
+ /* 90 */ 9, 427, 428, 12, 13, 14, 15, 16, 407, 424,
+ /* 100 */ 409, 70, 427, 428, 104, 422, 423, 107, 366, 73,
+ /* 110 */ 74, 75, 76, 77, 108, 79, 80, 81, 82, 83,
/* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
- /* 130 */ 94, 95, 96, 97, 98, 99, 100, 364, 20, 454,
- /* 140 */ 367, 368, 457, 143, 144, 460, 461, 462, 463, 464,
- /* 150 */ 465, 137, 467, 20, 20, 436, 22, 472, 369, 474,
- /* 160 */ 441, 397, 108, 478, 479, 482, 483, 484, 107, 486,
- /* 170 */ 487, 37, 489, 398, 111, 112, 412, 114, 493, 4,
- /* 180 */ 180, 181, 407, 408, 108, 20, 501, 187, 188, 55,
- /* 190 */ 507, 508, 33, 369, 370, 512, 513, 0, 23, 136,
- /* 200 */ 12, 13, 202, 140, 204, 486, 417, 418, 489, 420,
- /* 210 */ 182, 8, 9, 424, 69, 12, 13, 14, 15, 16,
- /* 220 */ 369, 46, 47, 48, 357, 37, 507, 508, 65, 215,
- /* 230 */ 216, 512, 513, 20, 234, 235, 236, 370, 238, 239,
+ /* 130 */ 94, 95, 96, 97, 98, 99, 100, 0, 20, 448,
+ /* 140 */ 22, 107, 451, 143, 144, 454, 455, 456, 457, 458,
+ /* 150 */ 459, 20, 461, 411, 412, 37, 414, 466, 361, 468,
+ /* 160 */ 418, 364, 365, 472, 473, 476, 477, 478, 14, 480,
+ /* 170 */ 481, 161, 483, 55, 20, 165, 395, 395, 487, 480,
+ /* 180 */ 180, 181, 483, 173, 402, 20, 495, 187, 188, 108,
+ /* 190 */ 501, 502, 410, 366, 367, 506, 507, 0, 417, 107,
+ /* 200 */ 419, 502, 202, 107, 204, 506, 507, 70, 394, 194,
+ /* 210 */ 20, 8, 9, 408, 409, 12, 13, 14, 15, 16,
+ /* 220 */ 406, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ /* 230 */ 20, 366, 367, 87, 234, 235, 236, 236, 238, 239,
/* 240 */ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
- /* 250 */ 250, 251, 252, 253, 254, 255, 12, 13, 357, 0,
- /* 260 */ 20, 18, 20, 20, 20, 398, 22, 108, 398, 106,
- /* 270 */ 27, 370, 109, 30, 71, 370, 143, 144, 35, 35,
- /* 280 */ 413, 37, 415, 24, 25, 26, 27, 28, 29, 30,
- /* 290 */ 31, 32, 0, 423, 51, 425, 53, 446, 447, 398,
- /* 300 */ 436, 58, 59, 398, 274, 481, 482, 483, 484, 65,
- /* 310 */ 486, 487, 69, 13, 413, 71, 415, 415, 115, 365,
- /* 320 */ 107, 454, 78, 369, 457, 371, 20, 460, 461, 462,
- /* 330 */ 463, 464, 465, 272, 467, 433, 434, 470, 175, 472,
- /* 340 */ 473, 474, 197, 51, 369, 478, 479, 4, 104, 106,
- /* 350 */ 486, 107, 20, 489, 236, 454, 159, 160, 457, 386,
- /* 360 */ 117, 460, 461, 462, 463, 464, 465, 462, 467, 224,
- /* 370 */ 225, 507, 508, 472, 401, 474, 512, 513, 78, 478,
- /* 380 */ 479, 186, 179, 143, 144, 175, 413, 143, 144, 357,
- /* 390 */ 147, 148, 204, 150, 151, 152, 153, 154, 155, 156,
- /* 400 */ 157, 158, 501, 428, 429, 162, 163, 164, 165, 166,
- /* 410 */ 167, 168, 3, 170, 171, 172, 206, 369, 370, 176,
- /* 420 */ 177, 178, 180, 181, 180, 181, 183, 187, 188, 20,
- /* 430 */ 457, 187, 188, 20, 73, 74, 75, 389, 398, 107,
- /* 440 */ 467, 80, 81, 82, 396, 413, 202, 86, 204, 409,
- /* 450 */ 107, 14, 91, 92, 93, 94, 364, 20, 97, 367,
- /* 460 */ 368, 100, 259, 260, 261, 262, 263, 264, 265, 266,
- /* 470 */ 267, 268, 269, 278, 279, 280, 281, 107, 234, 235,
- /* 480 */ 236, 459, 238, 239, 240, 241, 242, 243, 244, 245,
+ /* 250 */ 250, 251, 252, 253, 254, 255, 12, 13, 56, 57,
+ /* 260 */ 20, 18, 480, 20, 20, 483, 22, 12, 13, 236,
+ /* 270 */ 27, 362, 354, 30, 71, 366, 20, 368, 35, 35,
+ /* 280 */ 415, 37, 65, 501, 502, 367, 138, 362, 506, 507,
+ /* 290 */ 142, 366, 37, 368, 51, 149, 53, 201, 20, 203,
+ /* 300 */ 367, 58, 59, 476, 477, 478, 272, 480, 481, 65,
+ /* 310 */ 354, 366, 69, 395, 299, 71, 104, 107, 115, 173,
+ /* 320 */ 174, 69, 78, 106, 137, 407, 109, 409, 395, 233,
+ /* 330 */ 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
+ /* 340 */ 20, 129, 130, 131, 132, 133, 134, 135, 104, 106,
+ /* 350 */ 20, 107, 136, 137, 138, 139, 140, 141, 142, 211,
+ /* 360 */ 117, 0, 214, 407, 272, 217, 448, 219, 272, 451,
+ /* 370 */ 180, 181, 454, 455, 456, 457, 458, 459, 460, 461,
+ /* 380 */ 462, 463, 179, 143, 144, 440, 441, 143, 144, 456,
+ /* 390 */ 147, 148, 175, 150, 151, 152, 153, 154, 155, 156,
+ /* 400 */ 157, 158, 215, 216, 354, 162, 163, 164, 165, 166,
+ /* 410 */ 167, 168, 3, 170, 171, 172, 395, 366, 367, 176,
+ /* 420 */ 177, 178, 366, 367, 180, 181, 183, 187, 188, 20,
+ /* 430 */ 453, 187, 188, 20, 73, 74, 75, 386, 366, 367,
+ /* 440 */ 419, 80, 81, 82, 393, 14, 202, 86, 204, 197,
+ /* 450 */ 20, 20, 91, 92, 93, 94, 479, 407, 97, 204,
+ /* 460 */ 182, 100, 259, 260, 261, 262, 263, 264, 265, 266,
+ /* 470 */ 267, 268, 269, 143, 144, 70, 224, 225, 234, 235,
+ /* 480 */ 236, 71, 238, 239, 240, 241, 242, 243, 244, 245,
/* 490 */ 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
- /* 500 */ 256, 12, 13, 357, 21, 369, 370, 485, 365, 20,
- /* 510 */ 0, 22, 369, 70, 371, 87, 370, 108, 372, 36,
- /* 520 */ 104, 38, 39, 40, 35, 20, 37, 136, 137, 138,
- /* 530 */ 139, 140, 141, 142, 118, 119, 120, 121, 122, 123,
- /* 540 */ 124, 125, 126, 127, 398, 129, 130, 131, 132, 133,
- /* 550 */ 134, 135, 475, 476, 65, 0, 20, 421, 379, 413,
- /* 560 */ 71, 415, 14, 15, 16, 21, 387, 78, 24, 25,
- /* 570 */ 26, 27, 28, 29, 30, 31, 32, 149, 369, 370,
- /* 580 */ 8, 9, 357, 14, 12, 13, 14, 15, 16, 20,
- /* 590 */ 369, 182, 20, 104, 70, 370, 107, 372, 389, 22,
- /* 600 */ 454, 173, 174, 457, 272, 117, 460, 461, 462, 463,
- /* 610 */ 464, 465, 107, 467, 37, 272, 14, 180, 472, 20,
- /* 620 */ 474, 22, 20, 398, 478, 479, 369, 370, 73, 74,
- /* 630 */ 75, 390, 143, 144, 376, 80, 81, 82, 413, 398,
- /* 640 */ 415, 86, 272, 0, 369, 370, 91, 92, 93, 94,
- /* 650 */ 409, 356, 97, 358, 55, 100, 234, 8, 9, 357,
- /* 660 */ 402, 12, 13, 14, 15, 16, 256, 446, 447, 180,
- /* 670 */ 181, 161, 370, 236, 372, 165, 187, 188, 421, 454,
- /* 680 */ 398, 104, 457, 173, 78, 460, 461, 462, 463, 464,
- /* 690 */ 465, 202, 467, 204, 369, 370, 421, 472, 416, 474,
- /* 700 */ 398, 414, 415, 478, 479, 22, 284, 285, 286, 287,
- /* 710 */ 288, 289, 290, 70, 389, 413, 107, 415, 369, 370,
- /* 720 */ 37, 399, 400, 234, 235, 236, 20, 238, 239, 240,
+ /* 500 */ 256, 12, 13, 354, 20, 383, 22, 20, 3, 20,
+ /* 510 */ 0, 22, 387, 4, 236, 35, 367, 108, 405, 397,
+ /* 520 */ 395, 408, 409, 395, 35, 354, 37, 402, 403, 407,
+ /* 530 */ 402, 51, 476, 477, 478, 410, 480, 481, 410, 55,
+ /* 540 */ 60, 61, 62, 63, 395, 65, 373, 475, 476, 477,
+ /* 550 */ 478, 23, 480, 481, 65, 256, 407, 395, 409, 117,
+ /* 560 */ 71, 73, 74, 75, 402, 33, 186, 78, 80, 81,
+ /* 570 */ 82, 398, 410, 451, 86, 47, 48, 45, 407, 91,
+ /* 580 */ 92, 93, 94, 461, 234, 97, 106, 20, 100, 109,
+ /* 590 */ 256, 182, 258, 104, 107, 182, 107, 448, 366, 367,
+ /* 600 */ 451, 354, 375, 454, 455, 456, 457, 458, 459, 465,
+ /* 610 */ 461, 467, 182, 464, 367, 466, 467, 468, 386, 8,
+ /* 620 */ 9, 472, 473, 12, 13, 14, 15, 16, 401, 383,
+ /* 630 */ 22, 20, 143, 144, 284, 285, 286, 287, 288, 289,
+ /* 640 */ 290, 354, 395, 397, 234, 37, 136, 137, 138, 139,
+ /* 650 */ 140, 141, 142, 407, 407, 175, 409, 0, 278, 279,
+ /* 660 */ 280, 281, 366, 367, 184, 185, 236, 366, 367, 180,
+ /* 670 */ 181, 191, 192, 354, 107, 366, 187, 188, 21, 4,
+ /* 680 */ 0, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ /* 690 */ 210, 202, 376, 204, 407, 448, 382, 451, 451, 385,
+ /* 700 */ 384, 454, 455, 456, 457, 458, 459, 461, 461, 51,
+ /* 710 */ 354, 415, 104, 466, 430, 468, 415, 78, 60, 472,
+ /* 720 */ 473, 63, 64, 234, 235, 236, 407, 238, 239, 240,
/* 730 */ 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
- /* 740 */ 251, 252, 253, 254, 255, 12, 13, 14, 33, 180,
- /* 750 */ 351, 352, 353, 20, 182, 22, 454, 108, 357, 457,
- /* 760 */ 45, 78, 460, 461, 462, 463, 464, 465, 35, 467,
- /* 770 */ 37, 370, 236, 372, 472, 50, 474, 272, 8, 9,
- /* 780 */ 478, 479, 12, 13, 14, 15, 16, 104, 386, 357,
- /* 790 */ 137, 138, 378, 369, 370, 142, 1, 2, 65, 398,
- /* 800 */ 369, 370, 370, 401, 372, 236, 56, 57, 236, 395,
- /* 810 */ 201, 78, 203, 389, 413, 413, 415, 8, 9, 405,
- /* 820 */ 389, 12, 13, 14, 15, 16, 357, 23, 369, 370,
- /* 830 */ 398, 482, 483, 484, 22, 486, 487, 104, 117, 370,
- /* 840 */ 107, 372, 233, 399, 357, 413, 138, 415, 389, 37,
- /* 850 */ 142, 47, 48, 374, 375, 454, 357, 37, 457, 457,
- /* 860 */ 458, 460, 461, 462, 463, 464, 465, 398, 467, 467,
- /* 870 */ 369, 370, 256, 472, 258, 474, 143, 144, 378, 478,
- /* 880 */ 479, 272, 413, 398, 415, 202, 454, 204, 182, 457,
- /* 890 */ 389, 406, 460, 461, 462, 463, 464, 465, 78, 467,
- /* 900 */ 413, 416, 0, 108, 472, 405, 474, 182, 369, 370,
- /* 910 */ 478, 479, 413, 180, 181, 190, 104, 234, 235, 211,
- /* 920 */ 187, 188, 214, 454, 22, 217, 457, 219, 389, 460,
- /* 930 */ 461, 462, 463, 464, 465, 202, 467, 204, 0, 369,
- /* 940 */ 370, 472, 236, 474, 398, 369, 370, 478, 479, 357,
- /* 950 */ 8, 9, 406, 357, 12, 13, 14, 15, 16, 389,
- /* 960 */ 20, 471, 416, 473, 194, 389, 370, 234, 235, 236,
- /* 970 */ 42, 238, 239, 240, 241, 242, 243, 244, 245, 246,
+ /* 740 */ 251, 252, 253, 254, 255, 12, 13, 14, 354, 440,
+ /* 750 */ 441, 366, 367, 20, 391, 22, 430, 137, 138, 272,
+ /* 760 */ 33, 367, 142, 407, 480, 357, 358, 483, 35, 21,
+ /* 770 */ 37, 386, 24, 25, 26, 27, 28, 29, 30, 31,
+ /* 780 */ 32, 354, 107, 274, 387, 501, 502, 366, 367, 395,
+ /* 790 */ 506, 507, 395, 182, 367, 395, 369, 34, 65, 294,
+ /* 800 */ 403, 407, 402, 409, 366, 367, 480, 386, 445, 483,
+ /* 810 */ 410, 78, 8, 9, 395, 387, 12, 13, 14, 15,
+ /* 820 */ 16, 402, 395, 395, 386, 371, 372, 501, 502, 410,
+ /* 830 */ 387, 403, 506, 507, 407, 108, 409, 104, 395, 272,
+ /* 840 */ 107, 42, 448, 366, 367, 451, 403, 236, 454, 455,
+ /* 850 */ 456, 457, 458, 459, 354, 461, 354, 354, 117, 22,
+ /* 860 */ 466, 4, 468, 386, 395, 354, 472, 473, 453, 367,
+ /* 870 */ 366, 367, 403, 354, 37, 448, 143, 144, 451, 0,
+ /* 880 */ 23, 454, 455, 456, 457, 458, 459, 354, 461, 495,
+ /* 890 */ 386, 4, 14, 466, 479, 468, 14, 395, 20, 472,
+ /* 900 */ 473, 436, 20, 46, 47, 48, 19, 407, 228, 407,
+ /* 910 */ 407, 409, 108, 180, 181, 78, 366, 367, 407, 0,
+ /* 920 */ 187, 188, 35, 8, 9, 20, 407, 12, 13, 14,
+ /* 930 */ 15, 16, 14, 15, 16, 202, 386, 204, 51, 22,
+ /* 940 */ 407, 104, 50, 380, 381, 58, 59, 272, 33, 395,
+ /* 950 */ 448, 37, 65, 451, 37, 430, 454, 455, 456, 457,
+ /* 960 */ 458, 459, 396, 461, 410, 371, 372, 234, 235, 236,
+ /* 970 */ 51, 238, 239, 240, 241, 242, 243, 244, 245, 246,
/* 980 */ 247, 248, 249, 250, 251, 252, 253, 254, 255, 12,
- /* 990 */ 13, 357, 0, 0, 398, 369, 370, 20, 471, 22,
- /* 1000 */ 473, 374, 375, 486, 370, 413, 489, 383, 384, 413,
- /* 1010 */ 398, 415, 35, 21, 37, 389, 24, 25, 26, 27,
- /* 1020 */ 28, 29, 30, 31, 32, 508, 22, 398, 416, 512,
- /* 1030 */ 513, 51, 398, 0, 357, 406, 357, 357, 383, 384,
- /* 1040 */ 60, 37, 65, 63, 64, 416, 357, 413, 3, 415,
- /* 1050 */ 454, 357, 459, 457, 390, 78, 460, 461, 462, 463,
- /* 1060 */ 464, 465, 398, 467, 179, 369, 370, 357, 472, 299,
- /* 1070 */ 474, 360, 361, 409, 478, 479, 270, 271, 485, 398,
- /* 1080 */ 20, 104, 78, 486, 107, 389, 489, 357, 454, 408,
- /* 1090 */ 413, 457, 413, 413, 460, 461, 462, 463, 464, 465,
- /* 1100 */ 370, 467, 413, 357, 507, 508, 472, 413, 474, 512,
- /* 1110 */ 513, 357, 478, 479, 470, 486, 20, 473, 489, 0,
- /* 1120 */ 143, 144, 182, 413, 182, 386, 369, 370, 398, 136,
- /* 1130 */ 137, 138, 139, 140, 141, 142, 507, 508, 398, 34,
- /* 1140 */ 401, 512, 513, 413, 259, 415, 389, 357, 369, 370,
- /* 1150 */ 33, 357, 413, 394, 269, 0, 416, 180, 181, 413,
- /* 1160 */ 370, 42, 369, 370, 187, 188, 228, 413, 389, 136,
- /* 1170 */ 137, 138, 139, 140, 141, 142, 236, 22, 0, 202,
- /* 1180 */ 357, 204, 389, 117, 454, 33, 357, 457, 398, 357,
- /* 1190 */ 460, 461, 462, 463, 464, 465, 457, 467, 410, 271,
- /* 1200 */ 22, 413, 472, 413, 474, 415, 467, 413, 478, 479,
- /* 1210 */ 451, 234, 235, 236, 357, 238, 239, 240, 241, 242,
+ /* 990 */ 13, 396, 78, 106, 354, 78, 109, 20, 354, 22,
+ /* 1000 */ 12, 13, 14, 15, 16, 480, 354, 354, 483, 396,
+ /* 1010 */ 508, 509, 35, 395, 37, 136, 137, 138, 139, 140,
+ /* 1020 */ 141, 142, 354, 108, 354, 354, 501, 502, 410, 8,
+ /* 1030 */ 9, 506, 507, 12, 13, 14, 15, 16, 367, 202,
+ /* 1040 */ 369, 204, 65, 179, 366, 367, 20, 407, 354, 366,
+ /* 1050 */ 367, 407, 22, 366, 367, 78, 366, 367, 180, 407,
+ /* 1060 */ 407, 367, 180, 369, 386, 464, 395, 37, 467, 386,
+ /* 1070 */ 271, 234, 235, 386, 182, 407, 386, 407, 407, 117,
+ /* 1080 */ 409, 104, 190, 354, 107, 180, 136, 8, 9, 395,
+ /* 1090 */ 140, 12, 13, 14, 15, 16, 367, 33, 369, 2,
+ /* 1100 */ 0, 407, 396, 409, 404, 8, 9, 407, 354, 12,
+ /* 1110 */ 13, 14, 15, 16, 236, 366, 367, 13, 236, 448,
+ /* 1120 */ 143, 144, 451, 259, 395, 454, 455, 456, 457, 458,
+ /* 1130 */ 459, 169, 461, 269, 104, 386, 407, 466, 409, 468,
+ /* 1140 */ 33, 236, 448, 472, 473, 451, 0, 175, 454, 455,
+ /* 1150 */ 456, 457, 458, 459, 0, 461, 354, 180, 181, 37,
+ /* 1160 */ 466, 407, 468, 37, 187, 188, 472, 473, 22, 366,
+ /* 1170 */ 367, 366, 367, 404, 366, 367, 407, 448, 206, 202,
+ /* 1180 */ 451, 204, 78, 454, 455, 456, 457, 458, 459, 386,
+ /* 1190 */ 461, 386, 430, 2, 386, 466, 42, 468, 33, 8,
+ /* 1200 */ 9, 472, 473, 12, 13, 14, 15, 16, 396, 407,
+ /* 1210 */ 45, 234, 235, 236, 396, 238, 239, 240, 241, 242,
/* 1220 */ 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
- /* 1230 */ 253, 254, 255, 12, 13, 169, 413, 33, 357, 436,
- /* 1240 */ 180, 20, 413, 22, 454, 413, 4, 457, 357, 45,
- /* 1250 */ 460, 461, 462, 463, 464, 465, 35, 467, 37, 369,
- /* 1260 */ 370, 19, 369, 370, 474, 369, 370, 33, 478, 479,
- /* 1270 */ 413, 410, 459, 410, 413, 0, 413, 35, 357, 389,
- /* 1280 */ 391, 110, 389, 394, 113, 389, 65, 110, 33, 486,
- /* 1290 */ 113, 370, 489, 51, 413, 33, 236, 13, 485, 78,
- /* 1300 */ 58, 59, 136, 13, 413, 65, 140, 65, 33, 110,
- /* 1310 */ 507, 508, 113, 0, 71, 512, 513, 110, 18, 398,
- /* 1320 */ 113, 37, 218, 23, 220, 104, 399, 37, 107, 33,
- /* 1330 */ 33, 33, 236, 357, 413, 22, 415, 143, 144, 294,
- /* 1340 */ 40, 41, 108, 436, 44, 399, 370, 33, 106, 109,
- /* 1350 */ 399, 109, 49, 107, 54, 37, 33, 33, 1, 2,
- /* 1360 */ 399, 399, 116, 108, 143, 144, 66, 67, 68, 69,
- /* 1370 */ 108, 33, 33, 33, 398, 454, 33, 33, 457, 442,
- /* 1380 */ 404, 460, 461, 462, 463, 464, 465, 37, 467, 413,
- /* 1390 */ 387, 415, 358, 486, 426, 474, 489, 13, 516, 478,
- /* 1400 */ 479, 180, 181, 33, 108, 108, 108, 107, 187, 188,
- /* 1410 */ 107, 33, 33, 296, 507, 508, 505, 498, 33, 512,
- /* 1420 */ 513, 37, 108, 202, 373, 204, 398, 369, 370, 13,
- /* 1430 */ 454, 108, 108, 457, 33, 386, 460, 461, 462, 463,
- /* 1440 */ 464, 465, 33, 467, 37, 145, 108, 108, 108, 0,
- /* 1450 */ 298, 108, 108, 37, 386, 234, 235, 236, 426, 238,
+ /* 1230 */ 253, 254, 255, 12, 13, 39, 40, 366, 367, 453,
+ /* 1240 */ 0, 20, 480, 22, 33, 483, 366, 367, 380, 381,
+ /* 1250 */ 366, 367, 404, 270, 271, 407, 35, 386, 37, 159,
+ /* 1260 */ 160, 182, 236, 501, 502, 479, 386, 33, 506, 507,
+ /* 1270 */ 386, 388, 110, 33, 391, 113, 354, 110, 110, 13,
+ /* 1280 */ 113, 113, 110, 0, 0, 113, 65, 13, 33, 367,
+ /* 1290 */ 0, 369, 218, 65, 220, 49, 33, 33, 355, 78,
+ /* 1300 */ 143, 144, 396, 37, 37, 22, 22, 111, 112, 33,
+ /* 1310 */ 114, 37, 22, 1, 2, 384, 420, 395, 18, 108,
+ /* 1320 */ 510, 33, 33, 23, 33, 104, 204, 13, 107, 407,
+ /* 1330 */ 204, 409, 136, 499, 354, 33, 140, 109, 492, 33,
+ /* 1340 */ 40, 41, 108, 33, 44, 78, 33, 367, 370, 369,
+ /* 1350 */ 107, 37, 33, 107, 54, 33, 395, 33, 33, 116,
+ /* 1360 */ 296, 13, 383, 108, 143, 144, 66, 67, 68, 69,
+ /* 1370 */ 448, 108, 108, 451, 33, 395, 454, 455, 456, 457,
+ /* 1380 */ 458, 459, 383, 461, 108, 37, 420, 407, 466, 409,
+ /* 1390 */ 468, 0, 365, 420, 472, 473, 108, 108, 498, 108,
+ /* 1400 */ 498, 180, 181, 33, 33, 298, 498, 107, 187, 188,
+ /* 1410 */ 108, 429, 370, 420, 108, 367, 406, 420, 108, 498,
+ /* 1420 */ 420, 108, 437, 202, 482, 204, 503, 108, 448, 474,
+ /* 1430 */ 108, 451, 108, 108, 454, 455, 456, 457, 458, 459,
+ /* 1440 */ 385, 461, 485, 52, 275, 145, 466, 431, 468, 108,
+ /* 1450 */ 51, 450, 472, 473, 42, 234, 235, 236, 449, 238,
/* 1460 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
- /* 1470 */ 249, 250, 251, 252, 253, 254, 255, 234, 108, 357,
- /* 1480 */ 368, 12, 13, 426, 373, 78, 108, 108, 504, 504,
- /* 1490 */ 504, 22, 370, 108, 194, 195, 196, 435, 504, 199,
- /* 1500 */ 426, 52, 370, 412, 35, 357, 37, 443, 426, 108,
- /* 1510 */ 426, 488, 212, 213, 509, 480, 491, 108, 370, 388,
- /* 1520 */ 398, 51, 204, 223, 275, 437, 226, 456, 42, 229,
- /* 1530 */ 230, 231, 232, 233, 65, 413, 455, 415, 20, 357,
- /* 1540 */ 482, 483, 484, 448, 486, 487, 398, 78, 217, 448,
- /* 1550 */ 453, 378, 370, 378, 204, 200, 369, 439, 20, 20,
- /* 1560 */ 370, 413, 357, 415, 45, 422, 370, 422, 179, 419,
- /* 1570 */ 369, 369, 272, 104, 382, 370, 454, 419, 370, 457,
- /* 1580 */ 398, 422, 460, 461, 462, 463, 464, 465, 419, 467,
- /* 1590 */ 105, 419, 103, 381, 369, 413, 474, 415, 102, 380,
- /* 1600 */ 478, 479, 454, 398, 369, 457, 369, 369, 460, 461,
- /* 1610 */ 462, 463, 464, 465, 466, 467, 468, 469, 413, 20,
- /* 1620 */ 415, 362, 50, 366, 366, 362, 378, 448, 378, 436,
- /* 1630 */ 20, 415, 378, 20, 20, 371, 454, 371, 438, 457,
- /* 1640 */ 20, 362, 460, 461, 462, 463, 464, 465, 378, 467,
- /* 1650 */ 378, 429, 378, 221, 378, 369, 378, 413, 398, 454,
- /* 1660 */ 436, 360, 457, 398, 369, 460, 461, 462, 463, 464,
- /* 1670 */ 465, 202, 467, 204, 362, 398, 360, 107, 398, 486,
- /* 1680 */ 398, 398, 489, 357, 502, 503, 398, 398, 452, 398,
- /* 1690 */ 398, 398, 20, 376, 413, 450, 370, 445, 413, 357,
- /* 1700 */ 507, 508, 208, 234, 235, 512, 513, 207, 503, 448,
- /* 1710 */ 486, 376, 370, 489, 447, 444, 369, 248, 249, 250,
- /* 1720 */ 251, 252, 253, 254, 398, 415, 283, 497, 413, 282,
- /* 1730 */ 431, 507, 508, 431, 193, 291, 512, 513, 497, 413,
- /* 1740 */ 398, 415, 437, 293, 292, 437, 300, 500, 276, 496,
- /* 1750 */ 499, 297, 271, 497, 295, 413, 517, 415, 370, 357,
- /* 1760 */ 20, 117, 371, 495, 273, 459, 376, 494, 376, 413,
- /* 1770 */ 185, 413, 370, 413, 413, 413, 431, 431, 427, 510,
- /* 1780 */ 454, 357, 376, 457, 490, 370, 460, 461, 462, 463,
- /* 1790 */ 464, 465, 394, 467, 370, 357, 454, 376, 511, 457,
- /* 1800 */ 398, 492, 460, 461, 462, 463, 464, 465, 370, 467,
- /* 1810 */ 107, 477, 413, 107, 357, 413, 474, 415, 376, 22,
- /* 1820 */ 403, 479, 398, 359, 369, 38, 363, 370, 404, 362,
- /* 1830 */ 449, 392, 432, 440, 400, 432, 398, 413, 377, 415,
- /* 1840 */ 514, 515, 355, 392, 0, 392, 0, 0, 45, 0,
- /* 1850 */ 37, 413, 227, 415, 227, 398, 454, 37, 37, 457,
- /* 1860 */ 37, 404, 460, 461, 462, 463, 464, 465, 0, 467,
- /* 1870 */ 413, 37, 415, 37, 227, 37, 0, 227, 454, 0,
- /* 1880 */ 37, 457, 0, 0, 460, 461, 462, 463, 464, 465,
- /* 1890 */ 37, 467, 454, 357, 22, 457, 0, 37, 460, 461,
- /* 1900 */ 462, 463, 464, 465, 222, 467, 370, 0, 506, 210,
- /* 1910 */ 0, 454, 210, 204, 457, 211, 202, 460, 461, 462,
- /* 1920 */ 463, 464, 465, 1, 467, 0, 0, 0, 198, 197,
- /* 1930 */ 357, 0, 0, 148, 398, 49, 49, 0, 37, 35,
- /* 1940 */ 0, 19, 0, 370, 51, 37, 0, 49, 0, 413,
- /* 1950 */ 45, 415, 0, 515, 0, 51, 0, 35, 49, 0,
- /* 1960 */ 0, 357, 0, 0, 60, 61, 62, 63, 49, 65,
- /* 1970 */ 0, 398, 0, 51, 370, 165, 37, 404, 0, 165,
- /* 1980 */ 0, 0, 60, 61, 62, 63, 413, 65, 415, 0,
- /* 1990 */ 454, 0, 0, 457, 0, 0, 460, 461, 462, 463,
- /* 2000 */ 464, 465, 398, 467, 0, 469, 0, 0, 404, 0,
- /* 2010 */ 106, 0, 0, 109, 0, 0, 0, 413, 0, 415,
- /* 2020 */ 0, 0, 0, 0, 45, 0, 0, 454, 106, 0,
- /* 2030 */ 457, 109, 0, 460, 461, 462, 463, 464, 465, 22,
- /* 2040 */ 467, 357, 0, 0, 0, 148, 0, 147, 0, 146,
- /* 2050 */ 0, 0, 22, 50, 370, 22, 0, 0, 454, 0,
- /* 2060 */ 50, 457, 357, 141, 460, 461, 462, 463, 464, 465,
- /* 2070 */ 65, 467, 37, 65, 0, 370, 0, 37, 357, 175,
- /* 2080 */ 42, 0, 398, 42, 65, 51, 37, 51, 184, 185,
- /* 2090 */ 0, 370, 37, 0, 42, 191, 192, 413, 357, 415,
- /* 2100 */ 37, 0, 33, 398, 51, 45, 184, 42, 14, 0,
- /* 2110 */ 49, 370, 42, 191, 210, 49, 49, 0, 413, 398,
- /* 2120 */ 415, 43, 0, 0, 0, 42, 193, 0, 49, 0,
- /* 2130 */ 0, 0, 210, 0, 413, 37, 415, 51, 454, 398,
- /* 2140 */ 72, 457, 42, 0, 460, 461, 462, 463, 464, 465,
- /* 2150 */ 37, 467, 42, 51, 413, 0, 415, 37, 357, 454,
- /* 2160 */ 42, 0, 457, 51, 0, 460, 461, 462, 463, 464,
- /* 2170 */ 465, 370, 467, 37, 357, 454, 51, 0, 457, 42,
- /* 2180 */ 0, 460, 461, 462, 463, 464, 465, 370, 467, 0,
- /* 2190 */ 0, 0, 115, 113, 357, 454, 37, 22, 457, 398,
- /* 2200 */ 0, 460, 461, 462, 463, 464, 465, 370, 467, 37,
- /* 2210 */ 37, 37, 33, 37, 413, 398, 415, 0, 37, 37,
- /* 2220 */ 37, 37, 37, 37, 22, 33, 22, 0, 22, 0,
- /* 2230 */ 413, 37, 415, 22, 0, 398, 22, 0, 37, 0,
- /* 2240 */ 53, 0, 37, 0, 37, 0, 22, 357, 20, 37,
- /* 2250 */ 413, 107, 415, 37, 108, 454, 37, 0, 457, 107,
- /* 2260 */ 370, 460, 461, 462, 463, 464, 465, 182, 467, 49,
- /* 2270 */ 0, 454, 357, 182, 457, 37, 22, 460, 461, 462,
- /* 2280 */ 463, 464, 465, 0, 467, 370, 22, 205, 398, 182,
- /* 2290 */ 185, 454, 0, 209, 457, 0, 182, 460, 461, 462,
- /* 2300 */ 463, 464, 465, 413, 467, 415, 3, 357, 182, 33,
- /* 2310 */ 189, 108, 37, 398, 277, 107, 107, 189, 108, 37,
- /* 2320 */ 370, 50, 50, 105, 103, 357, 33, 33, 413, 107,
- /* 2330 */ 415, 108, 33, 108, 108, 49, 49, 107, 370, 107,
- /* 2340 */ 107, 33, 107, 357, 454, 3, 33, 457, 398, 277,
- /* 2350 */ 460, 461, 462, 463, 464, 465, 370, 467, 108, 108,
- /* 2360 */ 37, 37, 37, 413, 277, 415, 398, 37, 37, 454,
- /* 2370 */ 37, 108, 457, 108, 270, 460, 461, 462, 463, 464,
- /* 2380 */ 465, 413, 467, 415, 398, 49, 33, 49, 0, 0,
- /* 2390 */ 42, 107, 107, 0, 42, 107, 357, 108, 108, 413,
- /* 2400 */ 49, 415, 33, 107, 454, 107, 257, 457, 107, 370,
- /* 2410 */ 460, 461, 462, 463, 464, 465, 116, 467, 2, 105,
- /* 2420 */ 184, 357, 454, 105, 22, 457, 186, 234, 460, 461,
- /* 2430 */ 462, 463, 464, 465, 370, 467, 108, 398, 117, 107,
- /* 2440 */ 454, 107, 107, 457, 49, 108, 460, 461, 462, 463,
- /* 2450 */ 464, 465, 413, 467, 415, 108, 357, 107, 49, 22,
- /* 2460 */ 22, 107, 398, 108, 107, 22, 22, 108, 37, 370,
- /* 2470 */ 37, 107, 37, 108, 107, 107, 357, 413, 108, 415,
- /* 2480 */ 108, 237, 37, 37, 107, 37, 108, 107, 37, 370,
- /* 2490 */ 108, 107, 357, 454, 128, 33, 457, 398, 107, 460,
- /* 2500 */ 461, 462, 463, 464, 465, 370, 467, 128, 107, 128,
- /* 2510 */ 37, 128, 413, 107, 415, 22, 37, 398, 454, 72,
- /* 2520 */ 71, 457, 37, 37, 460, 461, 462, 463, 464, 465,
- /* 2530 */ 78, 467, 413, 398, 415, 37, 37, 37, 37, 37,
- /* 2540 */ 37, 101, 78, 101, 33, 37, 37, 37, 413, 22,
- /* 2550 */ 415, 37, 357, 454, 37, 37, 457, 37, 78, 460,
- /* 2560 */ 461, 462, 463, 464, 465, 370, 467, 37, 37, 37,
- /* 2570 */ 37, 22, 357, 454, 37, 0, 457, 37, 0, 460,
- /* 2580 */ 461, 462, 463, 464, 465, 370, 467, 51, 357, 454,
- /* 2590 */ 42, 37, 457, 398, 51, 460, 461, 462, 463, 464,
- /* 2600 */ 465, 370, 467, 42, 0, 37, 51, 42, 413, 0,
- /* 2610 */ 415, 37, 42, 398, 51, 0, 37, 37, 0, 22,
- /* 2620 */ 33, 22, 21, 518, 22, 22, 21, 20, 413, 398,
- /* 2630 */ 415, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2640 */ 518, 518, 518, 518, 413, 518, 415, 518, 518, 454,
- /* 2650 */ 518, 518, 457, 518, 518, 460, 461, 462, 463, 464,
- /* 2660 */ 465, 357, 467, 518, 518, 518, 518, 518, 518, 454,
- /* 2670 */ 518, 518, 457, 518, 370, 460, 461, 462, 463, 464,
- /* 2680 */ 465, 518, 467, 518, 518, 454, 357, 518, 457, 518,
- /* 2690 */ 518, 460, 461, 462, 463, 464, 465, 518, 467, 370,
- /* 2700 */ 518, 518, 398, 518, 518, 518, 518, 518, 518, 518,
- /* 2710 */ 518, 518, 518, 518, 518, 518, 518, 413, 518, 415,
- /* 2720 */ 518, 518, 518, 518, 518, 518, 518, 398, 518, 518,
- /* 2730 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2740 */ 518, 518, 413, 518, 415, 518, 518, 518, 518, 518,
- /* 2750 */ 518, 518, 518, 518, 518, 518, 518, 518, 454, 518,
- /* 2760 */ 518, 457, 518, 518, 460, 461, 462, 463, 464, 465,
- /* 2770 */ 518, 467, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2780 */ 518, 518, 518, 454, 518, 518, 457, 518, 518, 460,
- /* 2790 */ 461, 462, 463, 464, 465, 518, 467, 518, 518, 518,
- /* 2800 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2810 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2820 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2830 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2840 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2850 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2860 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2870 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2880 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2890 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2900 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2910 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2920 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2930 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2940 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2950 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2960 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2970 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
- /* 2980 */ 518, 518, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 2990 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3000 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3010 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3020 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3030 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3040 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3050 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3060 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3070 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3080 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3090 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3100 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3110 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3120 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3130 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3140 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 3150 */ 354,
+ /* 1470 */ 249, 250, 251, 252, 253, 254, 255, 20, 108, 108,
+ /* 1480 */ 442, 12, 13, 447, 354, 217, 375, 442, 375, 433,
+ /* 1490 */ 20, 22, 200, 366, 194, 195, 196, 367, 20, 199,
+ /* 1500 */ 367, 45, 416, 367, 35, 416, 37, 354, 179, 413,
+ /* 1510 */ 366, 366, 212, 213, 367, 416, 413, 379, 413, 413,
+ /* 1520 */ 367, 105, 103, 223, 366, 395, 226, 378, 102, 229,
+ /* 1530 */ 230, 231, 232, 233, 65, 20, 351, 407, 377, 409,
+ /* 1540 */ 366, 366, 354, 366, 50, 359, 363, 78, 395, 359,
+ /* 1550 */ 363, 442, 20, 375, 375, 367, 375, 409, 20, 20,
+ /* 1560 */ 407, 368, 409, 432, 375, 368, 20, 375, 366, 375,
+ /* 1570 */ 375, 359, 272, 104, 423, 375, 357, 395, 448, 395,
+ /* 1580 */ 366, 451, 357, 395, 454, 455, 456, 457, 458, 459,
+ /* 1590 */ 359, 461, 107, 395, 395, 407, 466, 409, 468, 395,
+ /* 1600 */ 395, 448, 472, 473, 451, 395, 221, 454, 455, 456,
+ /* 1610 */ 457, 458, 459, 395, 461, 430, 407, 395, 395, 466,
+ /* 1620 */ 435, 468, 395, 407, 407, 472, 473, 373, 20, 208,
+ /* 1630 */ 207, 373, 283, 409, 431, 366, 448, 407, 282, 451,
+ /* 1640 */ 439, 354, 454, 455, 456, 457, 458, 459, 291, 461,
+ /* 1650 */ 442, 444, 446, 438, 367, 491, 468, 425, 425, 193,
+ /* 1660 */ 472, 473, 491, 276, 494, 480, 493, 441, 483, 293,
+ /* 1670 */ 490, 202, 354, 204, 292, 431, 297, 300, 295, 271,
+ /* 1680 */ 20, 505, 395, 367, 117, 367, 501, 502, 453, 368,
+ /* 1690 */ 273, 506, 507, 373, 407, 425, 409, 425, 185, 354,
+ /* 1700 */ 373, 407, 489, 234, 235, 407, 407, 421, 407, 373,
+ /* 1710 */ 407, 491, 367, 395, 391, 373, 107, 248, 249, 250,
+ /* 1720 */ 251, 252, 253, 254, 488, 407, 367, 409, 486, 484,
+ /* 1730 */ 471, 107, 399, 504, 366, 448, 373, 407, 451, 22,
+ /* 1740 */ 395, 454, 455, 456, 457, 458, 459, 38, 461, 511,
+ /* 1750 */ 356, 359, 407, 360, 409, 468, 389, 354, 443, 472,
+ /* 1760 */ 473, 426, 434, 426, 389, 352, 448, 389, 0, 451,
+ /* 1770 */ 367, 374, 454, 455, 456, 457, 458, 459, 0, 461,
+ /* 1780 */ 0, 45, 0, 37, 227, 37, 468, 37, 37, 227,
+ /* 1790 */ 472, 473, 354, 448, 0, 37, 451, 37, 395, 454,
+ /* 1800 */ 455, 456, 457, 458, 459, 367, 461, 227, 37, 0,
+ /* 1810 */ 407, 227, 409, 0, 37, 0, 37, 0, 22, 0,
+ /* 1820 */ 37, 222, 354, 210, 0, 210, 204, 211, 202, 0,
+ /* 1830 */ 0, 0, 198, 395, 0, 367, 197, 0, 0, 148,
+ /* 1840 */ 49, 496, 497, 0, 49, 407, 0, 409, 37, 0,
+ /* 1850 */ 51, 448, 0, 37, 451, 49, 0, 454, 455, 456,
+ /* 1860 */ 457, 458, 459, 395, 461, 45, 0, 0, 400, 0,
+ /* 1870 */ 49, 468, 0, 0, 0, 407, 473, 409, 0, 0,
+ /* 1880 */ 0, 165, 37, 0, 165, 0, 448, 354, 0, 451,
+ /* 1890 */ 0, 0, 454, 455, 456, 457, 458, 459, 45, 461,
+ /* 1900 */ 367, 0, 354, 0, 0, 0, 0, 0, 0, 0,
+ /* 1910 */ 0, 0, 0, 0, 0, 367, 448, 354, 22, 451,
+ /* 1920 */ 0, 0, 454, 455, 456, 457, 458, 459, 395, 461,
+ /* 1930 */ 367, 49, 0, 400, 148, 497, 0, 0, 0, 0,
+ /* 1940 */ 407, 0, 409, 395, 0, 0, 0, 0, 147, 0,
+ /* 1950 */ 146, 0, 0, 22, 0, 407, 37, 409, 395, 65,
+ /* 1960 */ 0, 0, 22, 0, 65, 50, 50, 65, 0, 42,
+ /* 1970 */ 407, 0, 409, 51, 51, 42, 0, 51, 0, 37,
+ /* 1980 */ 37, 448, 0, 33, 451, 37, 14, 454, 455, 456,
+ /* 1990 */ 457, 458, 459, 37, 461, 42, 448, 354, 0, 451,
+ /* 2000 */ 45, 42, 454, 455, 456, 457, 458, 459, 43, 461,
+ /* 2010 */ 367, 448, 42, 49, 451, 354, 49, 454, 455, 456,
+ /* 2020 */ 457, 458, 459, 49, 461, 0, 0, 0, 367, 42,
+ /* 2030 */ 0, 0, 193, 49, 0, 0, 0, 37, 395, 0,
+ /* 2040 */ 354, 72, 0, 400, 51, 42, 37, 51, 500, 42,
+ /* 2050 */ 407, 0, 409, 367, 37, 51, 395, 42, 0, 37,
+ /* 2060 */ 42, 51, 0, 0, 0, 0, 0, 0, 407, 37,
+ /* 2070 */ 409, 0, 509, 115, 22, 113, 22, 37, 37, 0,
+ /* 2080 */ 37, 395, 37, 37, 37, 37, 400, 37, 33, 33,
+ /* 2090 */ 37, 448, 22, 407, 451, 409, 37, 454, 455, 456,
+ /* 2100 */ 457, 458, 459, 0, 461, 37, 22, 0, 22, 448,
+ /* 2110 */ 354, 0, 451, 53, 1, 454, 455, 456, 457, 458,
+ /* 2120 */ 459, 22, 461, 367, 463, 37, 0, 0, 0, 37,
+ /* 2130 */ 0, 37, 19, 0, 448, 20, 22, 451, 37, 37,
+ /* 2140 */ 454, 455, 456, 457, 458, 459, 354, 461, 35, 37,
+ /* 2150 */ 0, 395, 108, 49, 0, 182, 400, 182, 37, 367,
+ /* 2160 */ 22, 0, 22, 407, 51, 409, 209, 182, 107, 0,
+ /* 2170 */ 0, 205, 182, 60, 61, 62, 63, 354, 65, 107,
+ /* 2180 */ 185, 189, 3, 182, 33, 107, 189, 395, 108, 107,
+ /* 2190 */ 367, 108, 37, 37, 277, 50, 107, 50, 105, 407,
+ /* 2200 */ 103, 409, 49, 108, 448, 33, 33, 451, 108, 33,
+ /* 2210 */ 454, 455, 456, 457, 458, 459, 107, 461, 395, 106,
+ /* 2220 */ 49, 33, 109, 107, 107, 3, 108, 107, 33, 37,
+ /* 2230 */ 407, 108, 409, 108, 37, 37, 37, 37, 37, 108,
+ /* 2240 */ 448, 33, 108, 451, 0, 49, 454, 455, 456, 457,
+ /* 2250 */ 458, 459, 354, 461, 141, 49, 277, 277, 270, 0,
+ /* 2260 */ 42, 186, 0, 42, 107, 367, 107, 33, 116, 184,
+ /* 2270 */ 108, 448, 354, 108, 451, 107, 49, 454, 455, 456,
+ /* 2280 */ 457, 458, 459, 105, 461, 367, 105, 107, 354, 107,
+ /* 2290 */ 107, 22, 2, 395, 257, 108, 107, 184, 107, 49,
+ /* 2300 */ 107, 367, 108, 234, 191, 407, 49, 409, 22, 33,
+ /* 2310 */ 108, 107, 107, 395, 237, 108, 107, 37, 108, 37,
+ /* 2320 */ 117, 107, 37, 210, 108, 407, 107, 409, 108, 395,
+ /* 2330 */ 37, 107, 37, 108, 108, 107, 37, 107, 37, 108,
+ /* 2340 */ 107, 407, 37, 409, 107, 354, 448, 107, 107, 451,
+ /* 2350 */ 22, 128, 454, 455, 456, 457, 458, 459, 367, 461,
+ /* 2360 */ 128, 37, 71, 128, 128, 354, 448, 37, 72, 451,
+ /* 2370 */ 37, 37, 454, 455, 456, 457, 458, 459, 367, 461,
+ /* 2380 */ 37, 37, 448, 354, 37, 451, 395, 37, 454, 455,
+ /* 2390 */ 456, 457, 458, 459, 37, 461, 367, 78, 407, 101,
+ /* 2400 */ 409, 78, 33, 354, 101, 37, 395, 37, 37, 22,
+ /* 2410 */ 37, 37, 37, 78, 37, 37, 367, 37, 407, 37,
+ /* 2420 */ 409, 22, 37, 37, 395, 0, 37, 51, 0, 37,
+ /* 2430 */ 42, 0, 51, 42, 37, 42, 407, 0, 409, 448,
+ /* 2440 */ 37, 354, 451, 42, 395, 454, 455, 456, 457, 458,
+ /* 2450 */ 459, 51, 461, 51, 367, 0, 407, 37, 409, 448,
+ /* 2460 */ 37, 0, 451, 22, 21, 454, 455, 456, 457, 458,
+ /* 2470 */ 459, 33, 461, 22, 22, 22, 20, 448, 354, 21,
+ /* 2480 */ 451, 512, 395, 454, 455, 456, 457, 458, 459, 512,
+ /* 2490 */ 461, 367, 512, 512, 407, 512, 409, 448, 354, 512,
+ /* 2500 */ 451, 512, 512, 454, 455, 456, 457, 458, 459, 512,
+ /* 2510 */ 461, 367, 512, 512, 354, 512, 512, 512, 512, 395,
+ /* 2520 */ 512, 512, 512, 512, 512, 512, 512, 367, 512, 512,
+ /* 2530 */ 512, 407, 512, 409, 512, 448, 512, 512, 451, 395,
+ /* 2540 */ 512, 454, 455, 456, 457, 458, 459, 512, 461, 512,
+ /* 2550 */ 512, 407, 512, 409, 512, 395, 512, 512, 512, 512,
+ /* 2560 */ 512, 512, 512, 512, 512, 512, 512, 407, 512, 409,
+ /* 2570 */ 512, 512, 448, 512, 512, 451, 512, 512, 454, 455,
+ /* 2580 */ 456, 457, 458, 459, 512, 461, 512, 512, 512, 512,
+ /* 2590 */ 512, 512, 448, 512, 512, 451, 512, 512, 454, 455,
+ /* 2600 */ 456, 457, 458, 459, 512, 461, 512, 354, 448, 512,
+ /* 2610 */ 512, 451, 512, 512, 454, 455, 456, 457, 458, 459,
+ /* 2620 */ 367, 461, 512, 512, 512, 512, 354, 512, 512, 512,
+ /* 2630 */ 512, 512, 512, 512, 512, 512, 512, 512, 512, 367,
+ /* 2640 */ 512, 512, 512, 354, 512, 512, 512, 512, 395, 512,
+ /* 2650 */ 512, 512, 512, 512, 512, 512, 367, 512, 512, 512,
+ /* 2660 */ 407, 512, 409, 512, 512, 512, 512, 395, 512, 512,
+ /* 2670 */ 512, 512, 512, 512, 512, 512, 512, 512, 512, 407,
+ /* 2680 */ 512, 409, 512, 512, 395, 512, 512, 512, 512, 512,
+ /* 2690 */ 512, 512, 512, 512, 512, 512, 407, 512, 409, 512,
+ /* 2700 */ 354, 448, 512, 512, 451, 512, 512, 454, 455, 456,
+ /* 2710 */ 457, 458, 459, 367, 461, 512, 512, 512, 512, 512,
+ /* 2720 */ 448, 354, 512, 451, 512, 512, 454, 455, 456, 457,
+ /* 2730 */ 458, 459, 512, 461, 367, 512, 512, 448, 354, 512,
+ /* 2740 */ 451, 395, 512, 454, 455, 456, 457, 458, 459, 512,
+ /* 2750 */ 461, 367, 512, 407, 512, 409, 512, 512, 354, 512,
+ /* 2760 */ 512, 512, 395, 512, 512, 512, 512, 512, 512, 512,
+ /* 2770 */ 512, 367, 512, 512, 407, 512, 409, 512, 512, 395,
+ /* 2780 */ 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
+ /* 2790 */ 512, 407, 512, 409, 448, 512, 354, 451, 512, 395,
+ /* 2800 */ 454, 455, 456, 457, 458, 459, 512, 461, 512, 367,
+ /* 2810 */ 512, 407, 512, 409, 512, 448, 512, 512, 451, 512,
+ /* 2820 */ 512, 454, 455, 456, 457, 458, 459, 512, 461, 512,
+ /* 2830 */ 512, 512, 448, 354, 512, 451, 512, 395, 454, 455,
+ /* 2840 */ 456, 457, 458, 459, 512, 461, 367, 512, 512, 407,
+ /* 2850 */ 512, 409, 448, 512, 512, 451, 512, 512, 454, 455,
+ /* 2860 */ 456, 457, 458, 459, 512, 461, 512, 512, 512, 512,
+ /* 2870 */ 512, 512, 512, 512, 395, 512, 512, 512, 512, 512,
+ /* 2880 */ 512, 512, 512, 512, 512, 512, 407, 512, 409, 512,
+ /* 2890 */ 448, 512, 512, 451, 512, 512, 454, 455, 456, 457,
+ /* 2900 */ 458, 459, 512, 461, 512, 512, 512, 512, 512, 512,
+ /* 2910 */ 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
+ /* 2920 */ 512, 512, 512, 512, 512, 512, 512, 448, 512, 512,
+ /* 2930 */ 451, 512, 512, 454, 455, 456, 457, 458, 459, 512,
+ /* 2940 */ 461, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 2950 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 2960 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 2970 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 2980 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 2990 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3000 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3010 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3020 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3030 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3040 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3050 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3060 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3070 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3080 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3090 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3100 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3110 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3120 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3130 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3140 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3150 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3160 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3170 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3180 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3190 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3200 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3210 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3220 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3230 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3240 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3250 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3260 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3270 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3280 */ 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
+ /* 3290 */ 351, 351,
};
-#define YY_SHIFT_COUNT (859)
+#define YY_SHIFT_COUNT (851)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2618)
+#define YY_SHIFT_MAX (2461)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 1300, 0, 244, 0, 489, 489, 489, 489, 489, 489,
/* 10 */ 489, 489, 489, 489, 489, 489, 733, 977, 977, 1221,
/* 20 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977,
/* 30 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977,
/* 40 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977,
- /* 50 */ 977, 332, 505, 609, 213, 61, 370, 61, 61, 213,
- /* 60 */ 213, 61, 1469, 61, 243, 1469, 1469, 343, 61, 18,
- /* 70 */ 240, 165, 165, 175, 175, 240, 242, 133, 94, 94,
- /* 80 */ 118, 165, 165, 165, 165, 165, 165, 165, 165, 165,
- /* 90 */ 165, 165, 306, 413, 165, 165, 443, 18, 165, 306,
- /* 100 */ 165, 18, 165, 165, 18, 165, 165, 18, 165, 18,
- /* 110 */ 18, 18, 165, 524, 203, 203, 416, 361, 544, 683,
- /* 120 */ 683, 683, 683, 683, 683, 683, 683, 683, 683, 683,
- /* 130 */ 683, 683, 683, 683, 683, 683, 683, 683, 63, 409,
- /* 140 */ 242, 133, 750, 750, 820, 28, 28, 28, 643, 616,
- /* 150 */ 616, 300, 820, 443, 488, 18, 18, 410, 18, 18,
- /* 160 */ 606, 18, 606, 606, 721, 1105, 416, 416, 416, 416,
- /* 170 */ 416, 416, 416, 416, 1922, 555, 992, 572, 770, 422,
- /* 180 */ 195, 134, 437, 569, 188, 188, 706, 804, 940, 1004,
- /* 190 */ 1004, 1004, 725, 1004, 1060, 599, 536, 602, 1166, 210,
- /* 200 */ 536, 536, 1096, 806, 928, 1045, 806, 715, 30, 300,
- /* 210 */ 1249, 1470, 1486, 1518, 1331, 443, 1518, 443, 1355, 1538,
- /* 220 */ 1539, 1519, 1539, 1519, 1389, 1538, 1539, 1538, 1519, 1389,
- /* 230 */ 1389, 1389, 1485, 1489, 1538, 1496, 1538, 1538, 1538, 1599,
- /* 240 */ 1572, 1599, 1572, 1518, 443, 443, 1610, 443, 1613, 1614,
- /* 250 */ 443, 1613, 443, 1620, 443, 443, 1538, 443, 1599, 18,
- /* 260 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
- /* 270 */ 1538, 1105, 1105, 1599, 606, 606, 606, 1432, 1570, 1518,
- /* 280 */ 524, 1672, 1494, 1500, 1610, 524, 1249, 1538, 606, 1443,
- /* 290 */ 1447, 1443, 1447, 1444, 1541, 1443, 1450, 1452, 1472, 1249,
- /* 300 */ 1446, 1454, 1459, 1481, 1539, 1740, 1644, 1491, 1613, 524,
- /* 310 */ 524, 1447, 606, 606, 606, 606, 1447, 606, 1585, 524,
- /* 320 */ 721, 524, 1539, 1703, 1706, 606, 1538, 524, 1797, 1787,
- /* 330 */ 1599, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797,
- /* 340 */ 2797, 36, 1904, 259, 1242, 54, 76, 649, 993, 15,
- /* 350 */ 31, 942, 1033, 809, 809, 809, 809, 809, 809, 809,
- /* 360 */ 809, 809, 391, 708, 483, 81, 81, 145, 163, 510,
- /* 370 */ 428, 980, 197, 577, 812, 399, 14, 653, 653, 548,
- /* 380 */ 795, 885, 548, 548, 548, 399, 292, 938, 159, 1119,
- /* 390 */ 1204, 1066, 1275, 1171, 1177, 1199, 1207, 1284, 1290, 902,
- /* 400 */ 1155, 1178, 1313, 1104, 1234, 1255, 1240, 1262, 1296, 1297,
- /* 410 */ 1298, 1194, 1117, 1152, 1314, 1323, 1324, 1338, 1339, 1340,
- /* 420 */ 1357, 1343, 1243, 1344, 1303, 1370, 1378, 1379, 1385, 1401,
- /* 430 */ 1409, 1246, 1318, 1350, 1384, 1416, 1407, 1449, 1844, 1846,
- /* 440 */ 1847, 1803, 1849, 1813, 1625, 1820, 1821, 1823, 1627, 1868,
- /* 450 */ 1834, 1836, 1647, 1838, 1876, 1650, 1879, 1843, 1882, 1853,
- /* 460 */ 1883, 1872, 1896, 1860, 1682, 1907, 1699, 1910, 1702, 1704,
- /* 470 */ 1709, 1714, 1925, 1926, 1927, 1730, 1732, 1931, 1932, 1785,
- /* 480 */ 1886, 1887, 1937, 1901, 1940, 1942, 1908, 1893, 1946, 1898,
- /* 490 */ 1948, 1905, 1952, 1954, 1956, 1909, 1959, 1960, 1962, 1963,
- /* 500 */ 1970, 1972, 1810, 1939, 1978, 1814, 1980, 1981, 1989, 1991,
- /* 510 */ 1992, 1994, 1995, 2004, 2006, 2007, 2009, 2011, 2012, 2014,
- /* 520 */ 2015, 2016, 2018, 2020, 2021, 1919, 2022, 1979, 2023, 2025,
- /* 530 */ 2026, 2029, 2032, 2042, 2043, 2017, 2044, 1897, 2046, 1900,
- /* 540 */ 2048, 1903, 2050, 2051, 2030, 2003, 2033, 2010, 2056, 2005,
- /* 550 */ 2035, 2057, 2008, 2059, 2019, 2074, 2076, 2040, 2034, 2038,
- /* 560 */ 2081, 2049, 2036, 2041, 2090, 2055, 2053, 2052, 2093, 2063,
- /* 570 */ 2101, 2060, 2065, 2069, 2061, 2066, 2094, 2067, 2109, 2078,
- /* 580 */ 2070, 2117, 2122, 2123, 2124, 2083, 1933, 2127, 2061, 2079,
- /* 590 */ 2129, 2130, 2068, 2131, 2133, 2098, 2086, 2100, 2143, 2113,
- /* 600 */ 2102, 2110, 2155, 2120, 2112, 2118, 2161, 2136, 2125, 2137,
- /* 610 */ 2164, 2177, 2180, 2189, 2190, 2191, 2077, 2080, 2159, 2175,
- /* 620 */ 2200, 2172, 2173, 2174, 2176, 2181, 2182, 2183, 2184, 2179,
- /* 630 */ 2192, 2185, 2186, 2202, 2194, 2217, 2204, 2227, 2206, 2229,
- /* 640 */ 2211, 2187, 2234, 2214, 2201, 2237, 2239, 2241, 2205, 2243,
- /* 650 */ 2207, 2245, 2224, 2228, 2212, 2216, 2219, 2146, 2144, 2257,
- /* 660 */ 2085, 2152, 2084, 2061, 2220, 2270, 2091, 2238, 2254, 2283,
- /* 670 */ 2082, 2264, 2107, 2105, 2292, 2295, 2114, 2121, 2126, 2128,
- /* 680 */ 2303, 2276, 2037, 2208, 2203, 2209, 2210, 2275, 2282, 2222,
- /* 690 */ 2271, 2218, 2272, 2221, 2223, 2293, 2294, 2225, 2230, 2232,
- /* 700 */ 2233, 2226, 2299, 2286, 2287, 2235, 2308, 2072, 2250, 2251,
- /* 710 */ 2342, 2313, 2087, 2323, 2324, 2325, 2330, 2331, 2333, 2263,
- /* 720 */ 2265, 2336, 2104, 2353, 2338, 2388, 2389, 2284, 2348, 2285,
- /* 730 */ 2289, 2290, 2288, 2296, 2240, 2298, 2393, 2352, 2236, 2301,
- /* 740 */ 2300, 2061, 2351, 2369, 2314, 2149, 2318, 2416, 2402, 2193,
- /* 750 */ 2332, 2328, 2334, 2337, 2335, 2347, 2395, 2350, 2354, 2409,
- /* 760 */ 2355, 2437, 2244, 2357, 2321, 2438, 2443, 2444, 2359, 2431,
- /* 770 */ 2433, 2364, 2365, 2435, 2367, 2370, 2445, 2368, 2372, 2446,
- /* 780 */ 2377, 2378, 2448, 2380, 2382, 2451, 2384, 2366, 2379, 2381,
- /* 790 */ 2383, 2391, 2462, 2401, 2473, 2406, 2462, 2462, 2493, 2447,
- /* 800 */ 2449, 2479, 2485, 2486, 2498, 2499, 2500, 2501, 2502, 2503,
- /* 810 */ 2452, 2440, 2464, 2442, 2511, 2508, 2509, 2510, 2527, 2514,
- /* 820 */ 2517, 2518, 2480, 2179, 2520, 2192, 2530, 2531, 2532, 2533,
- /* 830 */ 2549, 2537, 2575, 2540, 2536, 2548, 2578, 2554, 2543, 2561,
- /* 840 */ 2604, 2568, 2555, 2565, 2609, 2574, 2563, 2570, 2615, 2579,
- /* 850 */ 2580, 2618, 2597, 2587, 2599, 2601, 2602, 2603, 2605, 2607,
+ /* 50 */ 977, 487, 567, 96, 210, 34, 92, 34, 34, 210,
+ /* 60 */ 210, 34, 1469, 34, 243, 1469, 1469, 675, 34, 131,
+ /* 70 */ 240, 165, 165, 857, 857, 240, 190, 330, 154, 154,
+ /* 80 */ 1, 165, 165, 165, 165, 165, 165, 165, 165, 165,
+ /* 90 */ 165, 165, 256, 320, 165, 165, 31, 131, 165, 256,
+ /* 100 */ 165, 131, 165, 165, 131, 165, 165, 131, 165, 131,
+ /* 110 */ 131, 131, 165, 405, 203, 203, 488, 748, 837, 837,
+ /* 120 */ 837, 837, 837, 837, 837, 837, 837, 837, 837, 837,
+ /* 130 */ 837, 837, 837, 837, 837, 837, 837, 1196, 409, 190,
+ /* 140 */ 330, 202, 202, 914, 413, 413, 413, 137, 334, 334,
+ /* 150 */ 1104, 914, 31, 442, 131, 131, 299, 131, 639, 131,
+ /* 160 */ 639, 639, 741, 763, 212, 212, 212, 212, 212, 212,
+ /* 170 */ 212, 212, 2113, 361, 657, 611, 15, 350, 380, 118,
+ /* 180 */ 878, 882, 255, 255, 278, 528, 430, 917, 917, 917,
+ /* 190 */ 892, 917, 905, 484, 33, 431, 950, 972, 33, 33,
+ /* 200 */ 1026, 983, 799, 505, 983, 532, 509, 1104, 1169, 1399,
+ /* 210 */ 1412, 1457, 1268, 31, 1457, 31, 1292, 1470, 1478, 1456,
+ /* 220 */ 1478, 1456, 1329, 1470, 1478, 1470, 1456, 1329, 1329, 1329,
+ /* 230 */ 1416, 1419, 1470, 1426, 1470, 1470, 1470, 1515, 1494, 1515,
+ /* 240 */ 1494, 1457, 31, 31, 1532, 31, 1538, 1539, 31, 1538,
+ /* 250 */ 31, 1546, 31, 31, 1470, 31, 1515, 131, 131, 131,
+ /* 260 */ 131, 131, 131, 131, 131, 131, 131, 131, 1470, 763,
+ /* 270 */ 763, 1515, 639, 639, 639, 1385, 1485, 1457, 405, 1608,
+ /* 280 */ 1421, 1423, 1532, 405, 1169, 1470, 639, 1349, 1356, 1349,
+ /* 290 */ 1356, 1357, 1466, 1349, 1376, 1382, 1387, 1169, 1377, 1379,
+ /* 300 */ 1383, 1408, 1478, 1660, 1567, 1417, 1538, 405, 405, 1356,
+ /* 310 */ 639, 639, 639, 639, 1356, 639, 1513, 405, 741, 405,
+ /* 320 */ 1478, 1609, 1624, 639, 1470, 405, 1717, 1709, 1515, 2941,
+ /* 330 */ 2941, 2941, 2941, 2941, 2941, 2941, 2941, 2941, 36, 480,
+ /* 340 */ 197, 887, 915, 81, 804, 510, 1097, 1191, 1079, 879,
+ /* 350 */ 1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021, 216,
+ /* 360 */ 148, 12, 988, 988, 252, 217, 10, 146, 658, 1100,
+ /* 370 */ 608, 1030, 187, 620, 620, 918, 6, 864, 918, 918,
+ /* 380 */ 918, 919, 680, 727, 1154, 1165, 962, 1240, 1162, 1167,
+ /* 390 */ 1168, 1172, 1266, 1274, 1146, 1283, 1284, 1290, 1074, 1211,
+ /* 400 */ 1234, 1228, 1255, 1263, 1264, 1276, 1157, 1064, 1107, 1288,
+ /* 410 */ 1289, 1291, 1302, 1306, 1310, 1312, 1313, 410, 1319, 1246,
+ /* 420 */ 1322, 1324, 1325, 1341, 1370, 1371, 1243, 1122, 1126, 1314,
+ /* 430 */ 1348, 1267, 1391, 1768, 1778, 1780, 1736, 1782, 1746, 1557,
+ /* 440 */ 1748, 1750, 1751, 1562, 1794, 1758, 1760, 1580, 1771, 1809,
+ /* 450 */ 1584, 1813, 1777, 1815, 1779, 1817, 1796, 1819, 1783, 1599,
+ /* 460 */ 1834, 1613, 1824, 1615, 1616, 1622, 1626, 1829, 1830, 1831,
+ /* 470 */ 1634, 1639, 1837, 1838, 1691, 1791, 1795, 1843, 1811, 1846,
+ /* 480 */ 1849, 1816, 1799, 1852, 1806, 1856, 1820, 1866, 1867, 1869,
+ /* 490 */ 1821, 1872, 1873, 1874, 1878, 1879, 1880, 1716, 1845, 1883,
+ /* 500 */ 1719, 1885, 1888, 1890, 1891, 1901, 1903, 1904, 1905, 1906,
+ /* 510 */ 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1920, 1921,
+ /* 520 */ 1882, 1932, 1853, 1936, 1937, 1938, 1939, 1941, 1944, 1945,
+ /* 530 */ 1896, 1946, 1786, 1947, 1801, 1949, 1804, 1951, 1952, 1931,
+ /* 540 */ 1915, 1940, 1916, 1954, 1894, 1919, 1960, 1899, 1961, 1902,
+ /* 550 */ 1963, 1968, 1942, 1922, 1927, 1971, 1943, 1923, 1933, 1976,
+ /* 560 */ 1948, 1926, 1953, 1978, 1956, 1982, 1955, 1959, 1950, 1964,
+ /* 570 */ 1967, 1972, 1974, 1998, 1965, 1970, 2025, 2026, 2027, 2039,
+ /* 580 */ 1987, 1839, 2030, 1964, 1984, 2031, 2034, 1969, 2035, 2036,
+ /* 590 */ 2000, 1993, 2003, 2042, 2009, 1996, 2007, 2051, 2017, 2004,
+ /* 600 */ 2015, 2058, 2022, 2010, 2018, 2062, 2063, 2064, 2065, 2066,
+ /* 610 */ 2067, 1958, 1962, 2032, 2052, 2071, 2040, 2041, 2043, 2045,
+ /* 620 */ 2046, 2047, 2048, 2050, 2055, 2056, 2053, 2059, 2054, 2068,
+ /* 630 */ 2079, 2070, 2103, 2084, 2107, 2086, 2060, 2111, 2099, 2088,
+ /* 640 */ 2126, 2127, 2128, 2092, 2130, 2094, 2133, 2114, 2115, 2101,
+ /* 650 */ 2102, 2112, 2044, 2061, 2150, 1973, 2072, 1957, 1964, 2104,
+ /* 660 */ 2154, 1975, 2121, 2138, 2161, 1966, 2140, 1985, 1995, 2169,
+ /* 670 */ 2170, 1990, 1992, 2001, 1997, 2179, 2151, 1917, 2078, 2080,
+ /* 680 */ 2082, 2083, 2155, 2156, 2089, 2145, 2093, 2147, 2097, 2095,
+ /* 690 */ 2172, 2173, 2100, 2109, 2116, 2117, 2118, 2176, 2153, 2171,
+ /* 700 */ 2120, 2188, 1979, 2123, 2125, 2222, 2195, 1980, 2192, 2197,
+ /* 710 */ 2198, 2199, 2200, 2201, 2131, 2134, 2196, 1988, 2208, 2206,
+ /* 720 */ 2244, 2259, 2157, 2218, 2159, 2162, 2165, 2168, 2180, 2075,
+ /* 730 */ 2182, 2262, 2221, 2085, 2183, 2152, 1964, 2227, 2234, 2178,
+ /* 740 */ 2037, 2181, 2290, 2269, 2069, 2189, 2187, 2191, 2194, 2193,
+ /* 750 */ 2202, 2250, 2204, 2205, 2257, 2207, 2286, 2077, 2209, 2203,
+ /* 760 */ 2210, 2280, 2282, 2214, 2216, 2285, 2219, 2220, 2293, 2224,
+ /* 770 */ 2225, 2295, 2228, 2226, 2299, 2230, 2231, 2301, 2233, 2223,
+ /* 780 */ 2232, 2235, 2236, 2237, 2276, 2240, 2305, 2241, 2276, 2276,
+ /* 790 */ 2328, 2296, 2291, 2324, 2330, 2333, 2334, 2343, 2344, 2347,
+ /* 800 */ 2350, 2357, 2319, 2298, 2323, 2303, 2369, 2368, 2370, 2371,
+ /* 810 */ 2387, 2373, 2374, 2375, 2335, 2055, 2377, 2056, 2378, 2380,
+ /* 820 */ 2382, 2385, 2399, 2386, 2425, 2389, 2376, 2388, 2428, 2392,
+ /* 830 */ 2381, 2391, 2431, 2397, 2400, 2393, 2437, 2403, 2402, 2401,
+ /* 840 */ 2455, 2420, 2423, 2461, 2441, 2438, 2451, 2443, 2452, 2453,
+ /* 850 */ 2458, 2456,
};
-#define YY_REDUCE_COUNT (340)
-#define YY_REDUCE_MIN (-432)
-#define YY_REDUCE_MAX (2329)
+#define YY_REDUCE_COUNT (337)
+#define YY_REDUCE_MIN (-464)
+#define YY_REDUCE_MAX (2479)
static const short yy_reduce_ofst[] = {
- /* 0 */ -281, -315, -133, -99, 146, 225, 302, 401, 432, 469,
- /* 10 */ 596, 634, 730, 790, 921, 1122, 1148, 1182, 1326, 1342,
- /* 20 */ 1205, 976, 1424, 1402, 1438, 1457, 1536, 1573, 1604, 1684,
- /* 30 */ 1705, 1721, 1741, 1801, 1817, 1837, 1890, 1915, 1950, 1968,
- /* 40 */ 1986, 2039, 2064, 2099, 2119, 2135, 2195, 2215, 2231, 2304,
- /* 50 */ 2329, -317, 629, -432, -176, -136, 803, 907, 1193, 349,
- /* 60 */ 1058, 1224, 402, 597, -211, -27, 739, -407, 517, -357,
- /* 70 */ -415, -364, 48, -227, 92, -98, -130, -404, -46, 143,
- /* 80 */ -95, -368, 209, 325, 424, 136, 257, 431, 459, 501,
- /* 90 */ 539, 275, -149, -25, 570, 576, 414, -390, 626, 221,
- /* 100 */ 696, -342, 757, 779, 241, 793, 890, 485, 893, -225,
- /* 110 */ 546, 664, 896, -316, 77, 77, 322, 179, 295, 32,
- /* 120 */ 487, 499, 592, 677, 679, 680, 689, 694, 710, 746,
- /* 130 */ 754, 794, 823, 829, 832, 857, 881, 891, -236, 22,
- /* 140 */ -326, 287, 479, 627, 624, 22, 593, 813, 258, 490,
- /* 150 */ 527, -327, 655, 500, 759, 282, 612, 644, 40, 681,
- /* 160 */ 788, 740, 861, 863, 889, 711, -396, 444, 927, 946,
- /* 170 */ 951, 961, 962, 946, 937, 1003, 1034, 968, 882, 911,
- /* 180 */ 919, 1051, 1028, 1028, 1049, 1068, 1032, 1112, 1057, 984,
- /* 190 */ 985, 986, 1062, 994, 1028, 1111, 1074, 1132, 1091, 1064,
- /* 200 */ 1082, 1084, 1028, 1023, 1023, 1005, 1023, 1035, 1025, 1131,
- /* 210 */ 1088, 1071, 1081, 1095, 1097, 1173, 1101, 1175, 1118, 1187,
- /* 220 */ 1190, 1143, 1196, 1145, 1150, 1201, 1208, 1202, 1159, 1158,
- /* 230 */ 1169, 1172, 1192, 1212, 1225, 1219, 1235, 1237, 1238, 1259,
- /* 240 */ 1257, 1263, 1258, 1179, 1248, 1250, 1216, 1254, 1264, 1200,
- /* 250 */ 1270, 1266, 1272, 1222, 1274, 1276, 1286, 1278, 1279, 1260,
- /* 260 */ 1265, 1277, 1280, 1282, 1283, 1288, 1289, 1291, 1292, 1293,
- /* 270 */ 1295, 1301, 1316, 1312, 1244, 1281, 1285, 1236, 1245, 1261,
- /* 280 */ 1317, 1267, 1252, 1271, 1310, 1335, 1305, 1347, 1315, 1230,
- /* 290 */ 1299, 1241, 1302, 1247, 1251, 1256, 1253, 1268, 1273, 1308,
- /* 300 */ 1239, 1287, 1269, 1023, 1388, 1306, 1309, 1294, 1391, 1390,
- /* 310 */ 1392, 1345, 1356, 1358, 1360, 1361, 1346, 1362, 1351, 1406,
- /* 320 */ 1398, 1421, 1415, 1334, 1417, 1399, 1455, 1442, 1464, 1463,
- /* 330 */ 1467, 1393, 1381, 1400, 1403, 1439, 1451, 1434, 1453, 1461,
- /* 340 */ 1487,
+ /* 0 */ 1185, -309, 149, 394, 427, 671, 694, 729, 922, 980,
+ /* 10 */ 247, 1130, 1153, 1188, 1287, 1318, -82, 1345, 502, 1403,
+ /* 20 */ 1438, 1468, 1533, 1548, 1563, 1643, 1661, 1686, 1756, 1792,
+ /* 30 */ 1823, 1898, 1918, 1934, 1991, 2011, 2029, 2049, 2087, 2124,
+ /* 40 */ 2144, 2160, 2253, 2272, 2289, 2346, 2367, 2384, 2404, 2442,
+ /* 50 */ 2479, -311, -218, -426, 72, -419, 284, 326, 525, -173,
+ /* 60 */ 56, 762, -382, -439, -258, 122, 246, -464, -301, 125,
+ /* 70 */ -325, -327, 51, -359, -203, -336, -219, 113, -91, -75,
+ /* 80 */ -67, 385, 421, 438, 477, -135, 296, 232, 504, 550,
+ /* 90 */ 678, 301, -55, -317, 683, 687, -375, 128, 690, 309,
+ /* 100 */ 749, 162, 805, 808, 397, 871, 880, 400, 803, 428,
+ /* 110 */ 419, 443, 884, -313, -423, -423, 316, -321, -44, 50,
+ /* 120 */ 171, 287, 319, 356, 500, 503, 511, 519, 533, 640,
+ /* 130 */ 644, 652, 653, 668, 670, 754, 802, -186, -23, 21,
+ /* 140 */ -195, 454, 594, 563, -23, 415, 786, 173, -393, 144,
+ /* 150 */ 314, 868, 227, 363, -392, 554, 601, 469, 700, 618,
+ /* 160 */ 769, 848, 883, 408, 566, 595, 613, 706, 812, 818,
+ /* 170 */ 906, 812, 465, 931, 943, 896, 810, 834, 846, 978,
+ /* 180 */ 961, 961, 979, 999, 966, 1027, 973, 900, 902, 908,
+ /* 190 */ 982, 921, 961, 1042, 993, 1048, 1010, 985, 997, 1000,
+ /* 200 */ 961, 942, 942, 923, 942, 955, 957, 1055, 1016, 1001,
+ /* 210 */ 1009, 1038, 1036, 1111, 1045, 1113, 1056, 1127, 1133, 1086,
+ /* 220 */ 1136, 1089, 1096, 1144, 1147, 1145, 1099, 1103, 1105, 1106,
+ /* 230 */ 1138, 1149, 1158, 1161, 1174, 1175, 1177, 1186, 1183, 1190,
+ /* 240 */ 1187, 1109, 1178, 1179, 1148, 1181, 1193, 1131, 1189, 1197,
+ /* 250 */ 1192, 1151, 1194, 1195, 1202, 1200, 1212, 1182, 1184, 1198,
+ /* 260 */ 1199, 1204, 1205, 1210, 1218, 1222, 1223, 1227, 1214, 1219,
+ /* 270 */ 1225, 1231, 1209, 1216, 1217, 1206, 1207, 1208, 1254, 1226,
+ /* 280 */ 1201, 1215, 1224, 1258, 1203, 1269, 1230, 1164, 1232, 1171,
+ /* 290 */ 1233, 1170, 1173, 1220, 1180, 1213, 1236, 1244, 1238, 1176,
+ /* 300 */ 1229, 942, 1316, 1235, 1242, 1245, 1321, 1320, 1327, 1270,
+ /* 310 */ 1294, 1298, 1299, 1301, 1272, 1303, 1286, 1336, 1323, 1342,
+ /* 320 */ 1359, 1259, 1333, 1330, 1368, 1363, 1394, 1393, 1392, 1328,
+ /* 330 */ 1315, 1335, 1337, 1367, 1375, 1378, 1397, 1413,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 10 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 20 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 30 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 40 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 50 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 60 */ 1926, 2270, 1926, 1926, 2233, 1926, 1926, 1926, 1926, 1926,
- /* 70 */ 1926, 1926, 1926, 1926, 1926, 1926, 2240, 1926, 1926, 1926,
- /* 80 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 90 */ 1926, 1926, 1926, 1926, 1926, 1926, 2025, 1926, 1926, 1926,
- /* 100 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 110 */ 1926, 1926, 1926, 2023, 2473, 1926, 2582, 1926, 1926, 1926,
- /* 120 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 130 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2485,
- /* 140 */ 1926, 1926, 1997, 1997, 1926, 2485, 2485, 2485, 2023, 2445,
- /* 150 */ 2445, 1926, 1926, 2025, 2308, 1926, 1926, 1926, 1926, 1926,
- /* 160 */ 1926, 1926, 1926, 1926, 2152, 1956, 1926, 1926, 1926, 2176,
- /* 170 */ 1926, 1926, 1926, 1926, 2296, 1926, 1926, 2514, 2576, 1926,
- /* 180 */ 2517, 1926, 1926, 1926, 1926, 1926, 2245, 1926, 2504, 1926,
- /* 190 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2101, 2290,
- /* 200 */ 1926, 1926, 1926, 2477, 2491, 2560, 2478, 2475, 2498, 1926,
- /* 210 */ 2508, 1926, 2333, 1926, 2322, 2025, 1926, 2025, 2283, 2228,
- /* 220 */ 1926, 2238, 1926, 2238, 2235, 1926, 1926, 1926, 2238, 2235,
- /* 230 */ 2235, 2235, 2090, 2086, 1926, 2084, 1926, 1926, 1926, 1926,
- /* 240 */ 1981, 1926, 1981, 1926, 2025, 2025, 1926, 2025, 1926, 1926,
- /* 250 */ 2025, 1926, 2025, 1926, 2025, 2025, 1926, 2025, 1926, 1926,
- /* 260 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 270 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2320, 2306, 1926,
- /* 280 */ 2023, 1926, 2294, 2292, 1926, 2023, 2508, 1926, 1926, 2530,
- /* 290 */ 2525, 2530, 2525, 2544, 2540, 2530, 2549, 2546, 2510, 2508,
- /* 300 */ 2579, 2566, 2562, 2491, 1926, 1926, 2496, 2494, 1926, 2023,
- /* 310 */ 2023, 2525, 1926, 1926, 1926, 1926, 2525, 1926, 1926, 2023,
- /* 320 */ 1926, 2023, 1926, 1926, 2118, 1926, 1926, 2023, 1926, 1965,
- /* 330 */ 1926, 2285, 2311, 2266, 2266, 2155, 2155, 2582, 2155, 2026,
- /* 340 */ 1931, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 350 */ 1926, 1926, 1926, 2543, 2542, 2398, 1926, 2449, 2448, 2447,
- /* 360 */ 2438, 2397, 2114, 1926, 1926, 2396, 2395, 1926, 1926, 1926,
- /* 370 */ 1926, 1926, 1926, 1926, 1926, 2105, 1926, 2257, 2256, 2389,
- /* 380 */ 1926, 1926, 2390, 2388, 2387, 2127, 1926, 1926, 1926, 1926,
- /* 390 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 400 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 410 */ 1926, 1926, 2563, 2567, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 420 */ 2474, 1926, 1926, 1926, 2369, 1926, 1926, 1926, 1926, 1926,
- /* 430 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 440 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 450 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 460 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 470 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2234,
- /* 480 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 490 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 500 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 510 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 520 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 530 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 540 */ 1926, 2249, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 550 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 560 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 570 */ 1926, 1926, 1926, 1970, 2376, 1926, 1926, 1926, 1926, 1926,
- /* 580 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2379, 1926,
- /* 590 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 600 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 610 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 620 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2065,
- /* 630 */ 2064, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 640 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 650 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2380, 1926, 1926,
- /* 660 */ 1926, 1926, 1926, 2371, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 670 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 680 */ 2559, 2511, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 690 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 700 */ 1926, 1926, 1926, 1926, 2369, 1926, 2541, 1926, 1926, 2557,
- /* 710 */ 1926, 2561, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2484,
- /* 720 */ 2480, 1926, 1926, 2476, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 730 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 740 */ 1926, 2368, 1926, 2435, 1926, 1926, 1926, 2469, 1926, 1926,
- /* 750 */ 2420, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 760 */ 2380, 1926, 2383, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 770 */ 1926, 2149, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 780 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2133, 2131, 2130,
- /* 790 */ 2129, 1926, 2162, 1926, 1926, 1926, 2158, 2157, 1926, 1926,
- /* 800 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 810 */ 1926, 1926, 1926, 1926, 2044, 1926, 1926, 1926, 1926, 1926,
- /* 820 */ 1926, 1926, 1926, 2036, 1926, 2035, 1926, 1926, 1926, 1926,
- /* 830 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 840 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926,
- /* 850 */ 1926, 1926, 1926, 1955, 1926, 1926, 1926, 1926, 1926, 1926,
+ /* 0 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 10 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 20 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 30 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 40 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 50 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 60 */ 1905, 2245, 1905, 1905, 2208, 1905, 1905, 1905, 1905, 1905,
+ /* 70 */ 1905, 1905, 1905, 1905, 1905, 1905, 2215, 1905, 1905, 1905,
+ /* 80 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 90 */ 1905, 1905, 1905, 1905, 1905, 1905, 2004, 1905, 1905, 1905,
+ /* 100 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 110 */ 1905, 1905, 1905, 2002, 2448, 1905, 1905, 1905, 1905, 1905,
+ /* 120 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 130 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 2460, 1905,
+ /* 140 */ 1905, 1976, 1976, 1905, 2460, 2460, 2460, 2002, 2420, 2420,
+ /* 150 */ 1905, 1905, 2004, 2283, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 160 */ 1905, 1905, 2127, 1935, 1905, 1905, 1905, 1905, 2151, 1905,
+ /* 170 */ 1905, 1905, 2271, 1905, 1905, 2489, 2551, 1905, 2492, 1905,
+ /* 180 */ 1905, 1905, 1905, 1905, 2220, 1905, 2479, 1905, 1905, 1905,
+ /* 190 */ 1905, 1905, 1905, 1905, 1905, 1905, 2080, 2265, 1905, 1905,
+ /* 200 */ 1905, 2452, 2466, 2535, 2453, 2450, 2473, 1905, 2483, 1905,
+ /* 210 */ 2308, 1905, 2297, 2004, 1905, 2004, 2258, 2203, 1905, 2213,
+ /* 220 */ 1905, 2213, 2210, 1905, 1905, 1905, 2213, 2210, 2210, 2210,
+ /* 230 */ 2069, 2065, 1905, 2063, 1905, 1905, 1905, 1905, 1960, 1905,
+ /* 240 */ 1960, 1905, 2004, 2004, 1905, 2004, 1905, 1905, 2004, 1905,
+ /* 250 */ 2004, 1905, 2004, 2004, 1905, 2004, 1905, 1905, 1905, 1905,
+ /* 260 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 270 */ 1905, 1905, 1905, 1905, 1905, 2295, 2281, 1905, 2002, 1905,
+ /* 280 */ 2269, 2267, 1905, 2002, 2483, 1905, 1905, 2505, 2500, 2505,
+ /* 290 */ 2500, 2519, 2515, 2505, 2524, 2521, 2485, 2483, 2554, 2541,
+ /* 300 */ 2537, 2466, 1905, 1905, 2471, 2469, 1905, 2002, 2002, 2500,
+ /* 310 */ 1905, 1905, 1905, 1905, 2500, 1905, 1905, 2002, 1905, 2002,
+ /* 320 */ 1905, 1905, 2096, 1905, 1905, 2002, 1905, 1944, 1905, 2260,
+ /* 330 */ 2286, 2241, 2241, 2130, 2130, 2130, 2005, 1910, 1905, 1905,
+ /* 340 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 350 */ 2518, 2517, 2373, 1905, 2424, 2423, 2422, 2413, 2372, 2092,
+ /* 360 */ 1905, 1905, 2371, 2370, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 370 */ 1905, 1905, 1905, 2232, 2231, 2364, 1905, 1905, 2365, 2363,
+ /* 380 */ 2362, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 390 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 400 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 2538, 2542, 1905,
+ /* 410 */ 1905, 1905, 1905, 1905, 1905, 2449, 1905, 1905, 1905, 2344,
+ /* 420 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 430 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 440 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 450 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 460 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 470 */ 1905, 1905, 1905, 1905, 2209, 1905, 1905, 1905, 1905, 1905,
+ /* 480 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 490 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 500 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 510 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 520 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 530 */ 1905, 1905, 1905, 1905, 1905, 1905, 2224, 1905, 1905, 1905,
+ /* 540 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 550 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 560 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1949, 2351,
+ /* 570 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 580 */ 1905, 1905, 1905, 2354, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 590 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 600 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 610 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 620 */ 1905, 1905, 1905, 1905, 2044, 2043, 1905, 1905, 1905, 1905,
+ /* 630 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 640 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 650 */ 1905, 1905, 2355, 1905, 1905, 1905, 1905, 1905, 2346, 1905,
+ /* 660 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 670 */ 1905, 1905, 1905, 1905, 1905, 2534, 2486, 1905, 1905, 1905,
+ /* 680 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 690 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 2344,
+ /* 700 */ 1905, 2516, 1905, 1905, 2532, 1905, 2536, 1905, 1905, 1905,
+ /* 710 */ 1905, 1905, 1905, 1905, 2459, 2455, 1905, 1905, 2451, 1905,
+ /* 720 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 730 */ 1905, 1905, 1905, 1905, 1905, 1905, 2343, 1905, 2410, 1905,
+ /* 740 */ 1905, 1905, 2444, 1905, 1905, 2395, 1905, 1905, 1905, 1905,
+ /* 750 */ 1905, 1905, 1905, 1905, 1905, 2355, 1905, 2358, 1905, 1905,
+ /* 760 */ 1905, 1905, 1905, 2124, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 770 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 2108,
+ /* 780 */ 2106, 2105, 2104, 1905, 2137, 1905, 1905, 1905, 2133, 2132,
+ /* 790 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 800 */ 1905, 1905, 1905, 1905, 1905, 1905, 2023, 1905, 1905, 1905,
+ /* 810 */ 1905, 1905, 1905, 1905, 1905, 2015, 1905, 2014, 1905, 1905,
+ /* 820 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 830 */ 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905,
+ /* 840 */ 1905, 1905, 1905, 1905, 1905, 1934, 1905, 1905, 1905, 1905,
+ /* 850 */ 1905, 1905,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1518,7 +1543,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* BWLIMIT => nothing */
0, /* START => nothing */
0, /* TIMESTAMP => nothing */
- 301, /* END => ABORT */
+ 303, /* END => ABORT */
0, /* TABLE => nothing */
0, /* NK_LP => nothing */
0, /* NK_RP => nothing */
@@ -1531,6 +1556,8 @@ static const YYCODETYPE yyFallback[] = {
0, /* NK_EQ => nothing */
0, /* USING => nothing */
0, /* TAGS => nothing */
+ 0, /* PRIMARY => nothing */
+ 303, /* KEY => ABORT */
0, /* BOOL => nothing */
0, /* TINYINT => nothing */
0, /* SMALLINT => nothing */
@@ -1588,7 +1615,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* VNODES => nothing */
0, /* ALIVE => nothing */
0, /* VIEWS => nothing */
- 301, /* VIEW => ABORT */
+ 303, /* VIEW => ABORT */
0, /* COMPACTS => nothing */
0, /* NORMAL => nothing */
0, /* CHILD => nothing */
@@ -1764,9 +1791,6 @@ static const YYCODETYPE yyFallback[] = {
301, /* VALUES => ABORT */
301, /* VARIABLE => ABORT */
301, /* WAL => ABORT */
- 0, /* ENCODE => nothing */
- 0, /* COMPRESS => nothing */
- 0, /* LEVEL => nothing */
};
#endif /* YYFALLBACK */
@@ -2206,173 +2230,167 @@ static const char *const yyTokenName[] = {
/* 348 */ "VALUES",
/* 349 */ "VARIABLE",
/* 350 */ "WAL",
- /* 351 */ "ENCODE",
- /* 352 */ "COMPRESS",
- /* 353 */ "LEVEL",
- /* 354 */ "cmd",
- /* 355 */ "account_options",
- /* 356 */ "alter_account_options",
- /* 357 */ "literal",
- /* 358 */ "alter_account_option",
- /* 359 */ "ip_range_list",
- /* 360 */ "white_list",
- /* 361 */ "white_list_opt",
- /* 362 */ "user_name",
- /* 363 */ "sysinfo_opt",
- /* 364 */ "privileges",
- /* 365 */ "priv_level",
- /* 366 */ "with_opt",
- /* 367 */ "priv_type_list",
- /* 368 */ "priv_type",
- /* 369 */ "db_name",
- /* 370 */ "table_name",
- /* 371 */ "topic_name",
- /* 372 */ "search_condition",
- /* 373 */ "dnode_endpoint",
- /* 374 */ "force_opt",
- /* 375 */ "unsafe_opt",
- /* 376 */ "not_exists_opt",
- /* 377 */ "db_options",
- /* 378 */ "exists_opt",
- /* 379 */ "alter_db_options",
- /* 380 */ "speed_opt",
- /* 381 */ "start_opt",
- /* 382 */ "end_opt",
- /* 383 */ "integer_list",
- /* 384 */ "variable_list",
- /* 385 */ "retention_list",
- /* 386 */ "signed",
- /* 387 */ "alter_db_option",
- /* 388 */ "retention",
- /* 389 */ "full_table_name",
- /* 390 */ "column_def_list",
- /* 391 */ "tags_def_opt",
- /* 392 */ "table_options",
- /* 393 */ "multi_create_clause",
- /* 394 */ "tags_def",
- /* 395 */ "multi_drop_clause",
- /* 396 */ "alter_table_clause",
- /* 397 */ "alter_table_options",
- /* 398 */ "column_name",
- /* 399 */ "type_name",
- /* 400 */ "column_options",
- /* 401 */ "signed_literal",
- /* 402 */ "create_subtable_clause",
- /* 403 */ "specific_cols_opt",
- /* 404 */ "expression_list",
- /* 405 */ "drop_table_clause",
- /* 406 */ "col_name_list",
- /* 407 */ "tag_def_list",
- /* 408 */ "tag_def",
- /* 409 */ "column_def",
- /* 410 */ "duration_list",
- /* 411 */ "rollup_func_list",
- /* 412 */ "alter_table_option",
- /* 413 */ "duration_literal",
- /* 414 */ "rollup_func_name",
- /* 415 */ "function_name",
- /* 416 */ "col_name",
- /* 417 */ "db_kind_opt",
- /* 418 */ "table_kind_db_name_cond_opt",
- /* 419 */ "like_pattern_opt",
- /* 420 */ "db_name_cond_opt",
- /* 421 */ "table_name_cond",
- /* 422 */ "from_db_opt",
- /* 423 */ "tag_list_opt",
- /* 424 */ "table_kind",
- /* 425 */ "tag_item",
- /* 426 */ "column_alias",
- /* 427 */ "index_options",
- /* 428 */ "full_index_name",
- /* 429 */ "index_name",
- /* 430 */ "func_list",
- /* 431 */ "sliding_opt",
- /* 432 */ "sma_stream_opt",
- /* 433 */ "func",
- /* 434 */ "sma_func_name",
- /* 435 */ "with_meta",
- /* 436 */ "query_or_subquery",
- /* 437 */ "where_clause_opt",
- /* 438 */ "cgroup_name",
- /* 439 */ "analyze_opt",
- /* 440 */ "explain_options",
- /* 441 */ "insert_query",
- /* 442 */ "or_replace_opt",
- /* 443 */ "agg_func_opt",
- /* 444 */ "bufsize_opt",
- /* 445 */ "language_opt",
- /* 446 */ "full_view_name",
- /* 447 */ "view_name",
- /* 448 */ "stream_name",
- /* 449 */ "stream_options",
- /* 450 */ "col_list_opt",
- /* 451 */ "tag_def_or_ref_opt",
- /* 452 */ "subtable_opt",
- /* 453 */ "ignore_opt",
- /* 454 */ "expression",
- /* 455 */ "on_vgroup_id",
- /* 456 */ "dnode_list",
- /* 457 */ "literal_func",
- /* 458 */ "literal_list",
- /* 459 */ "table_alias",
- /* 460 */ "expr_or_subquery",
- /* 461 */ "pseudo_column",
- /* 462 */ "column_reference",
- /* 463 */ "function_expression",
- /* 464 */ "case_when_expression",
- /* 465 */ "star_func",
- /* 466 */ "star_func_para_list",
- /* 467 */ "noarg_func",
- /* 468 */ "other_para_list",
- /* 469 */ "star_func_para",
- /* 470 */ "when_then_list",
- /* 471 */ "case_when_else_opt",
- /* 472 */ "common_expression",
- /* 473 */ "when_then_expr",
- /* 474 */ "predicate",
- /* 475 */ "compare_op",
- /* 476 */ "in_op",
- /* 477 */ "in_predicate_value",
- /* 478 */ "boolean_value_expression",
- /* 479 */ "boolean_primary",
- /* 480 */ "from_clause_opt",
- /* 481 */ "table_reference_list",
- /* 482 */ "table_reference",
- /* 483 */ "table_primary",
- /* 484 */ "joined_table",
- /* 485 */ "alias_opt",
- /* 486 */ "subquery",
- /* 487 */ "parenthesized_joined_table",
- /* 488 */ "join_type",
- /* 489 */ "query_specification",
- /* 490 */ "hint_list",
- /* 491 */ "set_quantifier_opt",
- /* 492 */ "tag_mode_opt",
- /* 493 */ "select_list",
- /* 494 */ "partition_by_clause_opt",
- /* 495 */ "range_opt",
- /* 496 */ "every_opt",
- /* 497 */ "fill_opt",
- /* 498 */ "twindow_clause_opt",
- /* 499 */ "group_by_clause_opt",
- /* 500 */ "having_clause_opt",
- /* 501 */ "select_item",
- /* 502 */ "partition_list",
- /* 503 */ "partition_item",
- /* 504 */ "interval_sliding_duration_literal",
- /* 505 */ "fill_mode",
- /* 506 */ "group_by_list",
- /* 507 */ "query_expression",
- /* 508 */ "query_simple",
- /* 509 */ "order_by_clause_opt",
- /* 510 */ "slimit_clause_opt",
- /* 511 */ "limit_clause_opt",
- /* 512 */ "union_query_expression",
- /* 513 */ "query_simple_or_subquery",
- /* 514 */ "sort_specification_list",
- /* 515 */ "sort_specification",
- /* 516 */ "ordering_specification_opt",
- /* 517 */ "null_ordering_opt",
+ /* 351 */ "cmd",
+ /* 352 */ "account_options",
+ /* 353 */ "alter_account_options",
+ /* 354 */ "literal",
+ /* 355 */ "alter_account_option",
+ /* 356 */ "ip_range_list",
+ /* 357 */ "white_list",
+ /* 358 */ "white_list_opt",
+ /* 359 */ "user_name",
+ /* 360 */ "sysinfo_opt",
+ /* 361 */ "privileges",
+ /* 362 */ "priv_level",
+ /* 363 */ "with_opt",
+ /* 364 */ "priv_type_list",
+ /* 365 */ "priv_type",
+ /* 366 */ "db_name",
+ /* 367 */ "table_name",
+ /* 368 */ "topic_name",
+ /* 369 */ "search_condition",
+ /* 370 */ "dnode_endpoint",
+ /* 371 */ "force_opt",
+ /* 372 */ "unsafe_opt",
+ /* 373 */ "not_exists_opt",
+ /* 374 */ "db_options",
+ /* 375 */ "exists_opt",
+ /* 376 */ "alter_db_options",
+ /* 377 */ "speed_opt",
+ /* 378 */ "start_opt",
+ /* 379 */ "end_opt",
+ /* 380 */ "integer_list",
+ /* 381 */ "variable_list",
+ /* 382 */ "retention_list",
+ /* 383 */ "signed",
+ /* 384 */ "alter_db_option",
+ /* 385 */ "retention",
+ /* 386 */ "full_table_name",
+ /* 387 */ "column_def_list",
+ /* 388 */ "tags_def_opt",
+ /* 389 */ "table_options",
+ /* 390 */ "multi_create_clause",
+ /* 391 */ "tags_def",
+ /* 392 */ "multi_drop_clause",
+ /* 393 */ "alter_table_clause",
+ /* 394 */ "alter_table_options",
+ /* 395 */ "column_name",
+ /* 396 */ "type_name",
+ /* 397 */ "signed_literal",
+ /* 398 */ "create_subtable_clause",
+ /* 399 */ "specific_cols_opt",
+ /* 400 */ "expression_list",
+ /* 401 */ "drop_table_clause",
+ /* 402 */ "col_name_list",
+ /* 403 */ "column_def",
+ /* 404 */ "duration_list",
+ /* 405 */ "rollup_func_list",
+ /* 406 */ "alter_table_option",
+ /* 407 */ "duration_literal",
+ /* 408 */ "rollup_func_name",
+ /* 409 */ "function_name",
+ /* 410 */ "col_name",
+ /* 411 */ "db_kind_opt",
+ /* 412 */ "table_kind_db_name_cond_opt",
+ /* 413 */ "like_pattern_opt",
+ /* 414 */ "db_name_cond_opt",
+ /* 415 */ "table_name_cond",
+ /* 416 */ "from_db_opt",
+ /* 417 */ "tag_list_opt",
+ /* 418 */ "table_kind",
+ /* 419 */ "tag_item",
+ /* 420 */ "column_alias",
+ /* 421 */ "index_options",
+ /* 422 */ "full_index_name",
+ /* 423 */ "index_name",
+ /* 424 */ "func_list",
+ /* 425 */ "sliding_opt",
+ /* 426 */ "sma_stream_opt",
+ /* 427 */ "func",
+ /* 428 */ "sma_func_name",
+ /* 429 */ "with_meta",
+ /* 430 */ "query_or_subquery",
+ /* 431 */ "where_clause_opt",
+ /* 432 */ "cgroup_name",
+ /* 433 */ "analyze_opt",
+ /* 434 */ "explain_options",
+ /* 435 */ "insert_query",
+ /* 436 */ "or_replace_opt",
+ /* 437 */ "agg_func_opt",
+ /* 438 */ "bufsize_opt",
+ /* 439 */ "language_opt",
+ /* 440 */ "full_view_name",
+ /* 441 */ "view_name",
+ /* 442 */ "stream_name",
+ /* 443 */ "stream_options",
+ /* 444 */ "col_list_opt",
+ /* 445 */ "tag_def_or_ref_opt",
+ /* 446 */ "subtable_opt",
+ /* 447 */ "ignore_opt",
+ /* 448 */ "expression",
+ /* 449 */ "on_vgroup_id",
+ /* 450 */ "dnode_list",
+ /* 451 */ "literal_func",
+ /* 452 */ "literal_list",
+ /* 453 */ "table_alias",
+ /* 454 */ "expr_or_subquery",
+ /* 455 */ "pseudo_column",
+ /* 456 */ "column_reference",
+ /* 457 */ "function_expression",
+ /* 458 */ "case_when_expression",
+ /* 459 */ "star_func",
+ /* 460 */ "star_func_para_list",
+ /* 461 */ "noarg_func",
+ /* 462 */ "other_para_list",
+ /* 463 */ "star_func_para",
+ /* 464 */ "when_then_list",
+ /* 465 */ "case_when_else_opt",
+ /* 466 */ "common_expression",
+ /* 467 */ "when_then_expr",
+ /* 468 */ "predicate",
+ /* 469 */ "compare_op",
+ /* 470 */ "in_op",
+ /* 471 */ "in_predicate_value",
+ /* 472 */ "boolean_value_expression",
+ /* 473 */ "boolean_primary",
+ /* 474 */ "from_clause_opt",
+ /* 475 */ "table_reference_list",
+ /* 476 */ "table_reference",
+ /* 477 */ "table_primary",
+ /* 478 */ "joined_table",
+ /* 479 */ "alias_opt",
+ /* 480 */ "subquery",
+ /* 481 */ "parenthesized_joined_table",
+ /* 482 */ "join_type",
+ /* 483 */ "query_specification",
+ /* 484 */ "hint_list",
+ /* 485 */ "set_quantifier_opt",
+ /* 486 */ "tag_mode_opt",
+ /* 487 */ "select_list",
+ /* 488 */ "partition_by_clause_opt",
+ /* 489 */ "range_opt",
+ /* 490 */ "every_opt",
+ /* 491 */ "fill_opt",
+ /* 492 */ "twindow_clause_opt",
+ /* 493 */ "group_by_clause_opt",
+ /* 494 */ "having_clause_opt",
+ /* 495 */ "select_item",
+ /* 496 */ "partition_list",
+ /* 497 */ "partition_item",
+ /* 498 */ "interval_sliding_duration_literal",
+ /* 499 */ "fill_mode",
+ /* 500 */ "group_by_list",
+ /* 501 */ "query_expression",
+ /* 502 */ "query_simple",
+ /* 503 */ "order_by_clause_opt",
+ /* 504 */ "slimit_clause_opt",
+ /* 505 */ "limit_clause_opt",
+ /* 506 */ "union_query_expression",
+ /* 507 */ "query_simple_or_subquery",
+ /* 508 */ "sort_specification_list",
+ /* 509 */ "sort_specification",
+ /* 510 */ "ordering_specification_opt",
+ /* 511 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -2556,487 +2574,479 @@ static const char *const yyRuleName[] = {
/* 173 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
/* 174 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
/* 175 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
- /* 176 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options",
- /* 177 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
- /* 178 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
- /* 179 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
- /* 180 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
- /* 181 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
- /* 182 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
- /* 183 */ "multi_create_clause ::= create_subtable_clause",
- /* 184 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
- /* 185 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options",
- /* 186 */ "multi_drop_clause ::= drop_table_clause",
- /* 187 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause",
- /* 188 */ "drop_table_clause ::= exists_opt full_table_name",
- /* 189 */ "specific_cols_opt ::=",
- /* 190 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
- /* 191 */ "full_table_name ::= table_name",
- /* 192 */ "full_table_name ::= db_name NK_DOT table_name",
- /* 193 */ "tag_def_list ::= tag_def",
- /* 194 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def",
- /* 195 */ "tag_def ::= column_name type_name",
- /* 196 */ "column_def_list ::= column_def",
- /* 197 */ "column_def_list ::= column_def_list NK_COMMA column_def",
- /* 198 */ "column_def ::= column_name type_name column_options",
- /* 199 */ "type_name ::= BOOL",
- /* 200 */ "type_name ::= TINYINT",
- /* 201 */ "type_name ::= SMALLINT",
- /* 202 */ "type_name ::= INT",
- /* 203 */ "type_name ::= INTEGER",
- /* 204 */ "type_name ::= BIGINT",
- /* 205 */ "type_name ::= FLOAT",
- /* 206 */ "type_name ::= DOUBLE",
- /* 207 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
- /* 208 */ "type_name ::= TIMESTAMP",
- /* 209 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
- /* 210 */ "type_name ::= TINYINT UNSIGNED",
- /* 211 */ "type_name ::= SMALLINT UNSIGNED",
- /* 212 */ "type_name ::= INT UNSIGNED",
- /* 213 */ "type_name ::= BIGINT UNSIGNED",
- /* 214 */ "type_name ::= JSON",
- /* 215 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
- /* 216 */ "type_name ::= MEDIUMBLOB",
- /* 217 */ "type_name ::= BLOB",
- /* 218 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
- /* 219 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP",
- /* 220 */ "type_name ::= DECIMAL",
- /* 221 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
- /* 222 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 223 */ "tags_def_opt ::=",
- /* 224 */ "tags_def_opt ::= tags_def",
- /* 225 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP",
- /* 226 */ "table_options ::=",
- /* 227 */ "table_options ::= table_options COMMENT NK_STRING",
- /* 228 */ "table_options ::= table_options MAX_DELAY duration_list",
- /* 229 */ "table_options ::= table_options WATERMARK duration_list",
- /* 230 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
- /* 231 */ "table_options ::= table_options TTL NK_INTEGER",
- /* 232 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
- /* 233 */ "table_options ::= table_options DELETE_MARK duration_list",
- /* 234 */ "alter_table_options ::= alter_table_option",
- /* 235 */ "alter_table_options ::= alter_table_options alter_table_option",
- /* 236 */ "alter_table_option ::= COMMENT NK_STRING",
- /* 237 */ "alter_table_option ::= TTL NK_INTEGER",
- /* 238 */ "duration_list ::= duration_literal",
- /* 239 */ "duration_list ::= duration_list NK_COMMA duration_literal",
- /* 240 */ "rollup_func_list ::= rollup_func_name",
- /* 241 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
- /* 242 */ "rollup_func_name ::= function_name",
- /* 243 */ "rollup_func_name ::= FIRST",
- /* 244 */ "rollup_func_name ::= LAST",
- /* 245 */ "col_name_list ::= col_name",
- /* 246 */ "col_name_list ::= col_name_list NK_COMMA col_name",
- /* 247 */ "col_name ::= column_name",
- /* 248 */ "cmd ::= SHOW DNODES",
- /* 249 */ "cmd ::= SHOW USERS",
- /* 250 */ "cmd ::= SHOW USER PRIVILEGES",
- /* 251 */ "cmd ::= SHOW db_kind_opt DATABASES",
- /* 252 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt",
- /* 253 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
- /* 254 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
- /* 255 */ "cmd ::= SHOW MNODES",
- /* 256 */ "cmd ::= SHOW QNODES",
- /* 257 */ "cmd ::= SHOW FUNCTIONS",
- /* 258 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
- /* 259 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name",
- /* 260 */ "cmd ::= SHOW STREAMS",
- /* 261 */ "cmd ::= SHOW ACCOUNTS",
- /* 262 */ "cmd ::= SHOW APPS",
- /* 263 */ "cmd ::= SHOW CONNECTIONS",
- /* 264 */ "cmd ::= SHOW LICENCES",
- /* 265 */ "cmd ::= SHOW GRANTS",
- /* 266 */ "cmd ::= SHOW GRANTS FULL",
- /* 267 */ "cmd ::= SHOW GRANTS LOGS",
- /* 268 */ "cmd ::= SHOW CLUSTER MACHINES",
- /* 269 */ "cmd ::= SHOW CREATE DATABASE db_name",
- /* 270 */ "cmd ::= SHOW CREATE TABLE full_table_name",
- /* 271 */ "cmd ::= SHOW CREATE STABLE full_table_name",
- /* 272 */ "cmd ::= SHOW QUERIES",
- /* 273 */ "cmd ::= SHOW SCORES",
- /* 274 */ "cmd ::= SHOW TOPICS",
- /* 275 */ "cmd ::= SHOW VARIABLES",
- /* 276 */ "cmd ::= SHOW CLUSTER VARIABLES",
- /* 277 */ "cmd ::= SHOW LOCAL VARIABLES",
- /* 278 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
- /* 279 */ "cmd ::= SHOW BNODES",
- /* 280 */ "cmd ::= SHOW SNODES",
- /* 281 */ "cmd ::= SHOW CLUSTER",
- /* 282 */ "cmd ::= SHOW TRANSACTIONS",
- /* 283 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
- /* 284 */ "cmd ::= SHOW CONSUMERS",
- /* 285 */ "cmd ::= SHOW SUBSCRIPTIONS",
- /* 286 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
- /* 287 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name",
- /* 288 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt",
- /* 289 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name",
- /* 290 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER",
- /* 291 */ "cmd ::= SHOW VNODES",
- /* 292 */ "cmd ::= SHOW db_name_cond_opt ALIVE",
- /* 293 */ "cmd ::= SHOW CLUSTER ALIVE",
- /* 294 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt",
- /* 295 */ "cmd ::= SHOW CREATE VIEW full_table_name",
- /* 296 */ "cmd ::= SHOW COMPACTS",
- /* 297 */ "cmd ::= SHOW COMPACT NK_INTEGER",
- /* 298 */ "table_kind_db_name_cond_opt ::=",
- /* 299 */ "table_kind_db_name_cond_opt ::= table_kind",
- /* 300 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT",
- /* 301 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT",
- /* 302 */ "table_kind ::= NORMAL",
- /* 303 */ "table_kind ::= CHILD",
- /* 304 */ "db_name_cond_opt ::=",
- /* 305 */ "db_name_cond_opt ::= db_name NK_DOT",
- /* 306 */ "like_pattern_opt ::=",
- /* 307 */ "like_pattern_opt ::= LIKE NK_STRING",
- /* 308 */ "table_name_cond ::= table_name",
- /* 309 */ "from_db_opt ::=",
- /* 310 */ "from_db_opt ::= FROM db_name",
- /* 311 */ "tag_list_opt ::=",
- /* 312 */ "tag_list_opt ::= tag_item",
- /* 313 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item",
- /* 314 */ "tag_item ::= TBNAME",
- /* 315 */ "tag_item ::= QTAGS",
- /* 316 */ "tag_item ::= column_name",
- /* 317 */ "tag_item ::= column_name column_alias",
- /* 318 */ "tag_item ::= column_name AS column_alias",
- /* 319 */ "db_kind_opt ::=",
- /* 320 */ "db_kind_opt ::= USER",
- /* 321 */ "db_kind_opt ::= SYSTEM",
- /* 322 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options",
- /* 323 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP",
- /* 324 */ "cmd ::= DROP INDEX exists_opt full_index_name",
- /* 325 */ "full_index_name ::= index_name",
- /* 326 */ "full_index_name ::= db_name NK_DOT index_name",
- /* 327 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
- /* 328 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt",
- /* 329 */ "func_list ::= func",
- /* 330 */ "func_list ::= func_list NK_COMMA func",
- /* 331 */ "func ::= sma_func_name NK_LP expression_list NK_RP",
- /* 332 */ "sma_func_name ::= function_name",
- /* 333 */ "sma_func_name ::= COUNT",
- /* 334 */ "sma_func_name ::= FIRST",
- /* 335 */ "sma_func_name ::= LAST",
- /* 336 */ "sma_func_name ::= LAST_ROW",
- /* 337 */ "sma_stream_opt ::=",
- /* 338 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal",
- /* 339 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal",
- /* 340 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal",
- /* 341 */ "with_meta ::= AS",
- /* 342 */ "with_meta ::= WITH META AS",
- /* 343 */ "with_meta ::= ONLY META AS",
- /* 344 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
- /* 345 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name",
- /* 346 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt",
- /* 347 */ "cmd ::= DROP TOPIC exists_opt topic_name",
- /* 348 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
- /* 349 */ "cmd ::= DESC full_table_name",
- /* 350 */ "cmd ::= DESCRIBE full_table_name",
- /* 351 */ "cmd ::= RESET QUERY CACHE",
- /* 352 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
- /* 353 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
- /* 354 */ "analyze_opt ::=",
- /* 355 */ "analyze_opt ::= ANALYZE",
- /* 356 */ "explain_options ::=",
- /* 357 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
- /* 358 */ "explain_options ::= explain_options RATIO NK_FLOAT",
- /* 359 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt",
- /* 360 */ "cmd ::= DROP FUNCTION exists_opt function_name",
- /* 361 */ "agg_func_opt ::=",
- /* 362 */ "agg_func_opt ::= AGGREGATE",
- /* 363 */ "bufsize_opt ::=",
- /* 364 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 365 */ "language_opt ::=",
- /* 366 */ "language_opt ::= LANGUAGE NK_STRING",
- /* 367 */ "or_replace_opt ::=",
- /* 368 */ "or_replace_opt ::= OR REPLACE",
- /* 369 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery",
- /* 370 */ "cmd ::= DROP VIEW exists_opt full_view_name",
- /* 371 */ "full_view_name ::= view_name",
- /* 372 */ "full_view_name ::= db_name NK_DOT view_name",
- /* 373 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery",
- /* 374 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 375 */ "cmd ::= PAUSE STREAM exists_opt stream_name",
- /* 376 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name",
- /* 377 */ "col_list_opt ::=",
- /* 378 */ "col_list_opt ::= NK_LP col_name_list NK_RP",
- /* 379 */ "tag_def_or_ref_opt ::=",
- /* 380 */ "tag_def_or_ref_opt ::= tags_def",
- /* 381 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP",
- /* 382 */ "stream_options ::=",
- /* 383 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 384 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 385 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
- /* 386 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 387 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
- /* 388 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
- /* 389 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
- /* 390 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
- /* 391 */ "subtable_opt ::=",
- /* 392 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
- /* 393 */ "ignore_opt ::=",
- /* 394 */ "ignore_opt ::= IGNORE UNTREATED",
- /* 395 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 396 */ "cmd ::= KILL QUERY NK_STRING",
- /* 397 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 398 */ "cmd ::= KILL COMPACT NK_INTEGER",
- /* 399 */ "cmd ::= BALANCE VGROUP",
- /* 400 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id",
- /* 401 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 402 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 403 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 404 */ "on_vgroup_id ::=",
- /* 405 */ "on_vgroup_id ::= ON NK_INTEGER",
- /* 406 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 407 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 408 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 409 */ "cmd ::= query_or_subquery",
- /* 410 */ "cmd ::= insert_query",
- /* 411 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
- /* 412 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
- /* 413 */ "literal ::= NK_INTEGER",
- /* 414 */ "literal ::= NK_FLOAT",
- /* 415 */ "literal ::= NK_STRING",
- /* 416 */ "literal ::= NK_BOOL",
- /* 417 */ "literal ::= TIMESTAMP NK_STRING",
- /* 418 */ "literal ::= duration_literal",
- /* 419 */ "literal ::= NULL",
- /* 420 */ "literal ::= NK_QUESTION",
- /* 421 */ "duration_literal ::= NK_VARIABLE",
- /* 422 */ "signed ::= NK_INTEGER",
- /* 423 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 424 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 425 */ "signed ::= NK_FLOAT",
- /* 426 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 427 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 428 */ "signed_literal ::= signed",
- /* 429 */ "signed_literal ::= NK_STRING",
- /* 430 */ "signed_literal ::= NK_BOOL",
- /* 431 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 432 */ "signed_literal ::= duration_literal",
- /* 433 */ "signed_literal ::= NULL",
- /* 434 */ "signed_literal ::= literal_func",
- /* 435 */ "signed_literal ::= NK_QUESTION",
- /* 436 */ "literal_list ::= signed_literal",
- /* 437 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 438 */ "db_name ::= NK_ID",
- /* 439 */ "table_name ::= NK_ID",
- /* 440 */ "column_name ::= NK_ID",
- /* 441 */ "function_name ::= NK_ID",
- /* 442 */ "view_name ::= NK_ID",
- /* 443 */ "table_alias ::= NK_ID",
- /* 444 */ "column_alias ::= NK_ID",
- /* 445 */ "column_alias ::= NK_ALIAS",
- /* 446 */ "user_name ::= NK_ID",
- /* 447 */ "topic_name ::= NK_ID",
- /* 448 */ "stream_name ::= NK_ID",
- /* 449 */ "cgroup_name ::= NK_ID",
- /* 450 */ "index_name ::= NK_ID",
- /* 451 */ "expr_or_subquery ::= expression",
- /* 452 */ "expression ::= literal",
- /* 453 */ "expression ::= pseudo_column",
- /* 454 */ "expression ::= column_reference",
- /* 455 */ "expression ::= function_expression",
- /* 456 */ "expression ::= case_when_expression",
- /* 457 */ "expression ::= NK_LP expression NK_RP",
- /* 458 */ "expression ::= NK_PLUS expr_or_subquery",
- /* 459 */ "expression ::= NK_MINUS expr_or_subquery",
- /* 460 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
- /* 461 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
- /* 462 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
- /* 463 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
- /* 464 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
- /* 465 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 466 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
- /* 467 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
- /* 468 */ "expression_list ::= expr_or_subquery",
- /* 469 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
- /* 470 */ "column_reference ::= column_name",
- /* 471 */ "column_reference ::= table_name NK_DOT column_name",
- /* 472 */ "column_reference ::= NK_ALIAS",
- /* 473 */ "column_reference ::= table_name NK_DOT NK_ALIAS",
- /* 474 */ "pseudo_column ::= ROWTS",
- /* 475 */ "pseudo_column ::= TBNAME",
- /* 476 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 477 */ "pseudo_column ::= QSTART",
- /* 478 */ "pseudo_column ::= QEND",
- /* 479 */ "pseudo_column ::= QDURATION",
- /* 480 */ "pseudo_column ::= WSTART",
- /* 481 */ "pseudo_column ::= WEND",
- /* 482 */ "pseudo_column ::= WDURATION",
- /* 483 */ "pseudo_column ::= IROWTS",
- /* 484 */ "pseudo_column ::= ISFILLED",
- /* 485 */ "pseudo_column ::= QTAGS",
- /* 486 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 487 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 488 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
- /* 489 */ "function_expression ::= literal_func",
- /* 490 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 491 */ "literal_func ::= NOW",
- /* 492 */ "noarg_func ::= NOW",
- /* 493 */ "noarg_func ::= TODAY",
- /* 494 */ "noarg_func ::= TIMEZONE",
- /* 495 */ "noarg_func ::= DATABASE",
- /* 496 */ "noarg_func ::= CLIENT_VERSION",
- /* 497 */ "noarg_func ::= SERVER_VERSION",
- /* 498 */ "noarg_func ::= SERVER_STATUS",
- /* 499 */ "noarg_func ::= CURRENT_USER",
- /* 500 */ "noarg_func ::= USER",
- /* 501 */ "star_func ::= COUNT",
- /* 502 */ "star_func ::= FIRST",
- /* 503 */ "star_func ::= LAST",
- /* 504 */ "star_func ::= LAST_ROW",
- /* 505 */ "star_func_para_list ::= NK_STAR",
- /* 506 */ "star_func_para_list ::= other_para_list",
- /* 507 */ "other_para_list ::= star_func_para",
- /* 508 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 509 */ "star_func_para ::= expr_or_subquery",
- /* 510 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 511 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
- /* 512 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
- /* 513 */ "when_then_list ::= when_then_expr",
- /* 514 */ "when_then_list ::= when_then_list when_then_expr",
- /* 515 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
- /* 516 */ "case_when_else_opt ::=",
- /* 517 */ "case_when_else_opt ::= ELSE common_expression",
- /* 518 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
- /* 519 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 520 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 521 */ "predicate ::= expr_or_subquery IS NULL",
- /* 522 */ "predicate ::= expr_or_subquery IS NOT NULL",
- /* 523 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
- /* 524 */ "compare_op ::= NK_LT",
- /* 525 */ "compare_op ::= NK_GT",
- /* 526 */ "compare_op ::= NK_LE",
- /* 527 */ "compare_op ::= NK_GE",
- /* 528 */ "compare_op ::= NK_NE",
- /* 529 */ "compare_op ::= NK_EQ",
- /* 530 */ "compare_op ::= LIKE",
- /* 531 */ "compare_op ::= NOT LIKE",
- /* 532 */ "compare_op ::= MATCH",
- /* 533 */ "compare_op ::= NMATCH",
- /* 534 */ "compare_op ::= CONTAINS",
- /* 535 */ "in_op ::= IN",
- /* 536 */ "in_op ::= NOT IN",
- /* 537 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 538 */ "boolean_value_expression ::= boolean_primary",
- /* 539 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 540 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 541 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 542 */ "boolean_primary ::= predicate",
- /* 543 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 544 */ "common_expression ::= expr_or_subquery",
- /* 545 */ "common_expression ::= boolean_value_expression",
- /* 546 */ "from_clause_opt ::=",
- /* 547 */ "from_clause_opt ::= FROM table_reference_list",
- /* 548 */ "table_reference_list ::= table_reference",
- /* 549 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 550 */ "table_reference ::= table_primary",
- /* 551 */ "table_reference ::= joined_table",
- /* 552 */ "table_primary ::= table_name alias_opt",
- /* 553 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 554 */ "table_primary ::= subquery alias_opt",
- /* 555 */ "table_primary ::= parenthesized_joined_table",
- /* 556 */ "alias_opt ::=",
- /* 557 */ "alias_opt ::= table_alias",
- /* 558 */ "alias_opt ::= AS table_alias",
- /* 559 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 560 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 561 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 562 */ "join_type ::=",
- /* 563 */ "join_type ::= INNER",
- /* 564 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
- /* 565 */ "hint_list ::=",
- /* 566 */ "hint_list ::= NK_HINT",
- /* 567 */ "tag_mode_opt ::=",
- /* 568 */ "tag_mode_opt ::= TAGS",
- /* 569 */ "set_quantifier_opt ::=",
- /* 570 */ "set_quantifier_opt ::= DISTINCT",
- /* 571 */ "set_quantifier_opt ::= ALL",
- /* 572 */ "select_list ::= select_item",
- /* 573 */ "select_list ::= select_list NK_COMMA select_item",
- /* 574 */ "select_item ::= NK_STAR",
- /* 575 */ "select_item ::= common_expression",
- /* 576 */ "select_item ::= common_expression column_alias",
- /* 577 */ "select_item ::= common_expression AS column_alias",
- /* 578 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 579 */ "where_clause_opt ::=",
- /* 580 */ "where_clause_opt ::= WHERE search_condition",
- /* 581 */ "partition_by_clause_opt ::=",
- /* 582 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
- /* 583 */ "partition_list ::= partition_item",
- /* 584 */ "partition_list ::= partition_list NK_COMMA partition_item",
- /* 585 */ "partition_item ::= expr_or_subquery",
- /* 586 */ "partition_item ::= expr_or_subquery column_alias",
- /* 587 */ "partition_item ::= expr_or_subquery AS column_alias",
- /* 588 */ "twindow_clause_opt ::=",
- /* 589 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP",
- /* 590 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
- /* 591 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
- /* 592 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
- /* 593 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
- /* 594 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP",
- /* 595 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 596 */ "sliding_opt ::=",
- /* 597 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
- /* 598 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
- /* 599 */ "interval_sliding_duration_literal ::= NK_STRING",
- /* 600 */ "interval_sliding_duration_literal ::= NK_INTEGER",
- /* 601 */ "fill_opt ::=",
- /* 602 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 603 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
- /* 604 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
- /* 605 */ "fill_mode ::= NONE",
- /* 606 */ "fill_mode ::= PREV",
- /* 607 */ "fill_mode ::= NULL",
- /* 608 */ "fill_mode ::= NULL_F",
- /* 609 */ "fill_mode ::= LINEAR",
- /* 610 */ "fill_mode ::= NEXT",
- /* 611 */ "group_by_clause_opt ::=",
- /* 612 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 613 */ "group_by_list ::= expr_or_subquery",
- /* 614 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
- /* 615 */ "having_clause_opt ::=",
- /* 616 */ "having_clause_opt ::= HAVING search_condition",
- /* 617 */ "range_opt ::=",
- /* 618 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 619 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
- /* 620 */ "every_opt ::=",
- /* 621 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 622 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 623 */ "query_simple ::= query_specification",
- /* 624 */ "query_simple ::= union_query_expression",
- /* 625 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 626 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 627 */ "query_simple_or_subquery ::= query_simple",
- /* 628 */ "query_simple_or_subquery ::= subquery",
- /* 629 */ "query_or_subquery ::= query_expression",
- /* 630 */ "query_or_subquery ::= subquery",
- /* 631 */ "order_by_clause_opt ::=",
- /* 632 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 633 */ "slimit_clause_opt ::=",
- /* 634 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 635 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 636 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 637 */ "limit_clause_opt ::=",
- /* 638 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 639 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 640 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 641 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 642 */ "subquery ::= NK_LP subquery NK_RP",
- /* 643 */ "search_condition ::= common_expression",
- /* 644 */ "sort_specification_list ::= sort_specification",
- /* 645 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 646 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 647 */ "ordering_specification_opt ::=",
- /* 648 */ "ordering_specification_opt ::= ASC",
- /* 649 */ "ordering_specification_opt ::= DESC",
- /* 650 */ "null_ordering_opt ::=",
- /* 651 */ "null_ordering_opt ::= NULLS FIRST",
- /* 652 */ "null_ordering_opt ::= NULLS LAST",
- /* 653 */ "column_options ::=",
- /* 654 */ "column_options ::= column_options ENCODE NK_STRING",
- /* 655 */ "column_options ::= column_options COMPRESS NK_STRING",
- /* 656 */ "column_options ::= column_options LEVEL NK_STRING",
+ /* 176 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
+ /* 177 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
+ /* 178 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
+ /* 179 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
+ /* 180 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
+ /* 181 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
+ /* 182 */ "multi_create_clause ::= create_subtable_clause",
+ /* 183 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
+ /* 184 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options",
+ /* 185 */ "multi_drop_clause ::= drop_table_clause",
+ /* 186 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause",
+ /* 187 */ "drop_table_clause ::= exists_opt full_table_name",
+ /* 188 */ "specific_cols_opt ::=",
+ /* 189 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
+ /* 190 */ "full_table_name ::= table_name",
+ /* 191 */ "full_table_name ::= db_name NK_DOT table_name",
+ /* 192 */ "column_def_list ::= column_def",
+ /* 193 */ "column_def_list ::= column_def_list NK_COMMA column_def",
+ /* 194 */ "column_def ::= column_name type_name",
+ /* 195 */ "type_name ::= BOOL",
+ /* 196 */ "type_name ::= TINYINT",
+ /* 197 */ "type_name ::= SMALLINT",
+ /* 198 */ "type_name ::= INT",
+ /* 199 */ "type_name ::= INTEGER",
+ /* 200 */ "type_name ::= BIGINT",
+ /* 201 */ "type_name ::= FLOAT",
+ /* 202 */ "type_name ::= DOUBLE",
+ /* 203 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
+ /* 204 */ "type_name ::= TIMESTAMP",
+ /* 205 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
+ /* 206 */ "type_name ::= TINYINT UNSIGNED",
+ /* 207 */ "type_name ::= SMALLINT UNSIGNED",
+ /* 208 */ "type_name ::= INT UNSIGNED",
+ /* 209 */ "type_name ::= BIGINT UNSIGNED",
+ /* 210 */ "type_name ::= JSON",
+ /* 211 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
+ /* 212 */ "type_name ::= MEDIUMBLOB",
+ /* 213 */ "type_name ::= BLOB",
+ /* 214 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
+ /* 215 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP",
+ /* 216 */ "type_name ::= DECIMAL",
+ /* 217 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
+ /* 218 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 219 */ "tags_def_opt ::=",
+ /* 220 */ "tags_def_opt ::= tags_def",
+ /* 221 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
+ /* 222 */ "table_options ::=",
+ /* 223 */ "table_options ::= table_options COMMENT NK_STRING",
+ /* 224 */ "table_options ::= table_options MAX_DELAY duration_list",
+ /* 225 */ "table_options ::= table_options WATERMARK duration_list",
+ /* 226 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
+ /* 227 */ "table_options ::= table_options TTL NK_INTEGER",
+ /* 228 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
+ /* 229 */ "table_options ::= table_options DELETE_MARK duration_list",
+ /* 230 */ "alter_table_options ::= alter_table_option",
+ /* 231 */ "alter_table_options ::= alter_table_options alter_table_option",
+ /* 232 */ "alter_table_option ::= COMMENT NK_STRING",
+ /* 233 */ "alter_table_option ::= TTL NK_INTEGER",
+ /* 234 */ "duration_list ::= duration_literal",
+ /* 235 */ "duration_list ::= duration_list NK_COMMA duration_literal",
+ /* 236 */ "rollup_func_list ::= rollup_func_name",
+ /* 237 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
+ /* 238 */ "rollup_func_name ::= function_name",
+ /* 239 */ "rollup_func_name ::= FIRST",
+ /* 240 */ "rollup_func_name ::= LAST",
+ /* 241 */ "col_name_list ::= col_name",
+ /* 242 */ "col_name_list ::= col_name_list NK_COMMA col_name",
+ /* 243 */ "col_name ::= column_name",
+ /* 244 */ "cmd ::= SHOW DNODES",
+ /* 245 */ "cmd ::= SHOW USERS",
+ /* 246 */ "cmd ::= SHOW USER PRIVILEGES",
+ /* 247 */ "cmd ::= SHOW db_kind_opt DATABASES",
+ /* 248 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt",
+ /* 249 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
+ /* 250 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
+ /* 251 */ "cmd ::= SHOW MNODES",
+ /* 252 */ "cmd ::= SHOW QNODES",
+ /* 253 */ "cmd ::= SHOW FUNCTIONS",
+ /* 254 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
+ /* 255 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name",
+ /* 256 */ "cmd ::= SHOW STREAMS",
+ /* 257 */ "cmd ::= SHOW ACCOUNTS",
+ /* 258 */ "cmd ::= SHOW APPS",
+ /* 259 */ "cmd ::= SHOW CONNECTIONS",
+ /* 260 */ "cmd ::= SHOW LICENCES",
+ /* 261 */ "cmd ::= SHOW GRANTS",
+ /* 262 */ "cmd ::= SHOW GRANTS FULL",
+ /* 263 */ "cmd ::= SHOW GRANTS LOGS",
+ /* 264 */ "cmd ::= SHOW CLUSTER MACHINES",
+ /* 265 */ "cmd ::= SHOW CREATE DATABASE db_name",
+ /* 266 */ "cmd ::= SHOW CREATE TABLE full_table_name",
+ /* 267 */ "cmd ::= SHOW CREATE STABLE full_table_name",
+ /* 268 */ "cmd ::= SHOW QUERIES",
+ /* 269 */ "cmd ::= SHOW SCORES",
+ /* 270 */ "cmd ::= SHOW TOPICS",
+ /* 271 */ "cmd ::= SHOW VARIABLES",
+ /* 272 */ "cmd ::= SHOW CLUSTER VARIABLES",
+ /* 273 */ "cmd ::= SHOW LOCAL VARIABLES",
+ /* 274 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
+ /* 275 */ "cmd ::= SHOW BNODES",
+ /* 276 */ "cmd ::= SHOW SNODES",
+ /* 277 */ "cmd ::= SHOW CLUSTER",
+ /* 278 */ "cmd ::= SHOW TRANSACTIONS",
+ /* 279 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
+ /* 280 */ "cmd ::= SHOW CONSUMERS",
+ /* 281 */ "cmd ::= SHOW SUBSCRIPTIONS",
+ /* 282 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
+ /* 283 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name",
+ /* 284 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt",
+ /* 285 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name",
+ /* 286 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER",
+ /* 287 */ "cmd ::= SHOW VNODES",
+ /* 288 */ "cmd ::= SHOW db_name_cond_opt ALIVE",
+ /* 289 */ "cmd ::= SHOW CLUSTER ALIVE",
+ /* 290 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt",
+ /* 291 */ "cmd ::= SHOW CREATE VIEW full_table_name",
+ /* 292 */ "cmd ::= SHOW COMPACTS",
+ /* 293 */ "cmd ::= SHOW COMPACT NK_INTEGER",
+ /* 294 */ "table_kind_db_name_cond_opt ::=",
+ /* 295 */ "table_kind_db_name_cond_opt ::= table_kind",
+ /* 296 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT",
+ /* 297 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT",
+ /* 298 */ "table_kind ::= NORMAL",
+ /* 299 */ "table_kind ::= CHILD",
+ /* 300 */ "db_name_cond_opt ::=",
+ /* 301 */ "db_name_cond_opt ::= db_name NK_DOT",
+ /* 302 */ "like_pattern_opt ::=",
+ /* 303 */ "like_pattern_opt ::= LIKE NK_STRING",
+ /* 304 */ "table_name_cond ::= table_name",
+ /* 305 */ "from_db_opt ::=",
+ /* 306 */ "from_db_opt ::= FROM db_name",
+ /* 307 */ "tag_list_opt ::=",
+ /* 308 */ "tag_list_opt ::= tag_item",
+ /* 309 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item",
+ /* 310 */ "tag_item ::= TBNAME",
+ /* 311 */ "tag_item ::= QTAGS",
+ /* 312 */ "tag_item ::= column_name",
+ /* 313 */ "tag_item ::= column_name column_alias",
+ /* 314 */ "tag_item ::= column_name AS column_alias",
+ /* 315 */ "db_kind_opt ::=",
+ /* 316 */ "db_kind_opt ::= USER",
+ /* 317 */ "db_kind_opt ::= SYSTEM",
+ /* 318 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options",
+ /* 319 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP",
+ /* 320 */ "cmd ::= DROP INDEX exists_opt full_index_name",
+ /* 321 */ "full_index_name ::= index_name",
+ /* 322 */ "full_index_name ::= db_name NK_DOT index_name",
+ /* 323 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
+ /* 324 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt",
+ /* 325 */ "func_list ::= func",
+ /* 326 */ "func_list ::= func_list NK_COMMA func",
+ /* 327 */ "func ::= sma_func_name NK_LP expression_list NK_RP",
+ /* 328 */ "sma_func_name ::= function_name",
+ /* 329 */ "sma_func_name ::= COUNT",
+ /* 330 */ "sma_func_name ::= FIRST",
+ /* 331 */ "sma_func_name ::= LAST",
+ /* 332 */ "sma_func_name ::= LAST_ROW",
+ /* 333 */ "sma_stream_opt ::=",
+ /* 334 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal",
+ /* 335 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal",
+ /* 336 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal",
+ /* 337 */ "with_meta ::= AS",
+ /* 338 */ "with_meta ::= WITH META AS",
+ /* 339 */ "with_meta ::= ONLY META AS",
+ /* 340 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
+ /* 341 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name",
+ /* 342 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt",
+ /* 343 */ "cmd ::= DROP TOPIC exists_opt topic_name",
+ /* 344 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
+ /* 345 */ "cmd ::= DESC full_table_name",
+ /* 346 */ "cmd ::= DESCRIBE full_table_name",
+ /* 347 */ "cmd ::= RESET QUERY CACHE",
+ /* 348 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
+ /* 349 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
+ /* 350 */ "analyze_opt ::=",
+ /* 351 */ "analyze_opt ::= ANALYZE",
+ /* 352 */ "explain_options ::=",
+ /* 353 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
+ /* 354 */ "explain_options ::= explain_options RATIO NK_FLOAT",
+ /* 355 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt",
+ /* 356 */ "cmd ::= DROP FUNCTION exists_opt function_name",
+ /* 357 */ "agg_func_opt ::=",
+ /* 358 */ "agg_func_opt ::= AGGREGATE",
+ /* 359 */ "bufsize_opt ::=",
+ /* 360 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
+ /* 361 */ "language_opt ::=",
+ /* 362 */ "language_opt ::= LANGUAGE NK_STRING",
+ /* 363 */ "or_replace_opt ::=",
+ /* 364 */ "or_replace_opt ::= OR REPLACE",
+ /* 365 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery",
+ /* 366 */ "cmd ::= DROP VIEW exists_opt full_view_name",
+ /* 367 */ "full_view_name ::= view_name",
+ /* 368 */ "full_view_name ::= db_name NK_DOT view_name",
+ /* 369 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery",
+ /* 370 */ "cmd ::= DROP STREAM exists_opt stream_name",
+ /* 371 */ "cmd ::= PAUSE STREAM exists_opt stream_name",
+ /* 372 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name",
+ /* 373 */ "col_list_opt ::=",
+ /* 374 */ "col_list_opt ::= NK_LP col_name_list NK_RP",
+ /* 375 */ "tag_def_or_ref_opt ::=",
+ /* 376 */ "tag_def_or_ref_opt ::= tags_def",
+ /* 377 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP",
+ /* 378 */ "stream_options ::=",
+ /* 379 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 380 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 381 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
+ /* 382 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 383 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
+ /* 384 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
+ /* 385 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
+ /* 386 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
+ /* 387 */ "subtable_opt ::=",
+ /* 388 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
+ /* 389 */ "ignore_opt ::=",
+ /* 390 */ "ignore_opt ::= IGNORE UNTREATED",
+ /* 391 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 392 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 393 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 394 */ "cmd ::= KILL COMPACT NK_INTEGER",
+ /* 395 */ "cmd ::= BALANCE VGROUP",
+ /* 396 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id",
+ /* 397 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 398 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 399 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 400 */ "on_vgroup_id ::=",
+ /* 401 */ "on_vgroup_id ::= ON NK_INTEGER",
+ /* 402 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 403 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 404 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 405 */ "cmd ::= query_or_subquery",
+ /* 406 */ "cmd ::= insert_query",
+ /* 407 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
+ /* 408 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
+ /* 409 */ "literal ::= NK_INTEGER",
+ /* 410 */ "literal ::= NK_FLOAT",
+ /* 411 */ "literal ::= NK_STRING",
+ /* 412 */ "literal ::= NK_BOOL",
+ /* 413 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 414 */ "literal ::= duration_literal",
+ /* 415 */ "literal ::= NULL",
+ /* 416 */ "literal ::= NK_QUESTION",
+ /* 417 */ "duration_literal ::= NK_VARIABLE",
+ /* 418 */ "signed ::= NK_INTEGER",
+ /* 419 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 420 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 421 */ "signed ::= NK_FLOAT",
+ /* 422 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 423 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 424 */ "signed_literal ::= signed",
+ /* 425 */ "signed_literal ::= NK_STRING",
+ /* 426 */ "signed_literal ::= NK_BOOL",
+ /* 427 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 428 */ "signed_literal ::= duration_literal",
+ /* 429 */ "signed_literal ::= NULL",
+ /* 430 */ "signed_literal ::= literal_func",
+ /* 431 */ "signed_literal ::= NK_QUESTION",
+ /* 432 */ "literal_list ::= signed_literal",
+ /* 433 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 434 */ "db_name ::= NK_ID",
+ /* 435 */ "table_name ::= NK_ID",
+ /* 436 */ "column_name ::= NK_ID",
+ /* 437 */ "function_name ::= NK_ID",
+ /* 438 */ "view_name ::= NK_ID",
+ /* 439 */ "table_alias ::= NK_ID",
+ /* 440 */ "column_alias ::= NK_ID",
+ /* 441 */ "column_alias ::= NK_ALIAS",
+ /* 442 */ "user_name ::= NK_ID",
+ /* 443 */ "topic_name ::= NK_ID",
+ /* 444 */ "stream_name ::= NK_ID",
+ /* 445 */ "cgroup_name ::= NK_ID",
+ /* 446 */ "index_name ::= NK_ID",
+ /* 447 */ "expr_or_subquery ::= expression",
+ /* 448 */ "expression ::= literal",
+ /* 449 */ "expression ::= pseudo_column",
+ /* 450 */ "expression ::= column_reference",
+ /* 451 */ "expression ::= function_expression",
+ /* 452 */ "expression ::= case_when_expression",
+ /* 453 */ "expression ::= NK_LP expression NK_RP",
+ /* 454 */ "expression ::= NK_PLUS expr_or_subquery",
+ /* 455 */ "expression ::= NK_MINUS expr_or_subquery",
+ /* 456 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
+ /* 457 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
+ /* 458 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
+ /* 459 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
+ /* 460 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
+ /* 461 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 462 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
+ /* 463 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
+ /* 464 */ "expression_list ::= expr_or_subquery",
+ /* 465 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
+ /* 466 */ "column_reference ::= column_name",
+ /* 467 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 468 */ "column_reference ::= NK_ALIAS",
+ /* 469 */ "column_reference ::= table_name NK_DOT NK_ALIAS",
+ /* 470 */ "pseudo_column ::= ROWTS",
+ /* 471 */ "pseudo_column ::= TBNAME",
+ /* 472 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 473 */ "pseudo_column ::= QSTART",
+ /* 474 */ "pseudo_column ::= QEND",
+ /* 475 */ "pseudo_column ::= QDURATION",
+ /* 476 */ "pseudo_column ::= WSTART",
+ /* 477 */ "pseudo_column ::= WEND",
+ /* 478 */ "pseudo_column ::= WDURATION",
+ /* 479 */ "pseudo_column ::= IROWTS",
+ /* 480 */ "pseudo_column ::= ISFILLED",
+ /* 481 */ "pseudo_column ::= QTAGS",
+ /* 482 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 483 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 484 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
+ /* 485 */ "function_expression ::= literal_func",
+ /* 486 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 487 */ "literal_func ::= NOW",
+ /* 488 */ "noarg_func ::= NOW",
+ /* 489 */ "noarg_func ::= TODAY",
+ /* 490 */ "noarg_func ::= TIMEZONE",
+ /* 491 */ "noarg_func ::= DATABASE",
+ /* 492 */ "noarg_func ::= CLIENT_VERSION",
+ /* 493 */ "noarg_func ::= SERVER_VERSION",
+ /* 494 */ "noarg_func ::= SERVER_STATUS",
+ /* 495 */ "noarg_func ::= CURRENT_USER",
+ /* 496 */ "noarg_func ::= USER",
+ /* 497 */ "star_func ::= COUNT",
+ /* 498 */ "star_func ::= FIRST",
+ /* 499 */ "star_func ::= LAST",
+ /* 500 */ "star_func ::= LAST_ROW",
+ /* 501 */ "star_func_para_list ::= NK_STAR",
+ /* 502 */ "star_func_para_list ::= other_para_list",
+ /* 503 */ "other_para_list ::= star_func_para",
+ /* 504 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 505 */ "star_func_para ::= expr_or_subquery",
+ /* 506 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 507 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 508 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 509 */ "when_then_list ::= when_then_expr",
+ /* 510 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 511 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 512 */ "case_when_else_opt ::=",
+ /* 513 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 514 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 515 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 516 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 517 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 518 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 519 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 520 */ "compare_op ::= NK_LT",
+ /* 521 */ "compare_op ::= NK_GT",
+ /* 522 */ "compare_op ::= NK_LE",
+ /* 523 */ "compare_op ::= NK_GE",
+ /* 524 */ "compare_op ::= NK_NE",
+ /* 525 */ "compare_op ::= NK_EQ",
+ /* 526 */ "compare_op ::= LIKE",
+ /* 527 */ "compare_op ::= NOT LIKE",
+ /* 528 */ "compare_op ::= MATCH",
+ /* 529 */ "compare_op ::= NMATCH",
+ /* 530 */ "compare_op ::= CONTAINS",
+ /* 531 */ "in_op ::= IN",
+ /* 532 */ "in_op ::= NOT IN",
+ /* 533 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 534 */ "boolean_value_expression ::= boolean_primary",
+ /* 535 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 536 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 537 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 538 */ "boolean_primary ::= predicate",
+ /* 539 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 540 */ "common_expression ::= expr_or_subquery",
+ /* 541 */ "common_expression ::= boolean_value_expression",
+ /* 542 */ "from_clause_opt ::=",
+ /* 543 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 544 */ "table_reference_list ::= table_reference",
+ /* 545 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 546 */ "table_reference ::= table_primary",
+ /* 547 */ "table_reference ::= joined_table",
+ /* 548 */ "table_primary ::= table_name alias_opt",
+ /* 549 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 550 */ "table_primary ::= subquery alias_opt",
+ /* 551 */ "table_primary ::= parenthesized_joined_table",
+ /* 552 */ "alias_opt ::=",
+ /* 553 */ "alias_opt ::= table_alias",
+ /* 554 */ "alias_opt ::= AS table_alias",
+ /* 555 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 556 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 557 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 558 */ "join_type ::=",
+ /* 559 */ "join_type ::= INNER",
+ /* 560 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
+ /* 561 */ "hint_list ::=",
+ /* 562 */ "hint_list ::= NK_HINT",
+ /* 563 */ "tag_mode_opt ::=",
+ /* 564 */ "tag_mode_opt ::= TAGS",
+ /* 565 */ "set_quantifier_opt ::=",
+ /* 566 */ "set_quantifier_opt ::= DISTINCT",
+ /* 567 */ "set_quantifier_opt ::= ALL",
+ /* 568 */ "select_list ::= select_item",
+ /* 569 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 570 */ "select_item ::= NK_STAR",
+ /* 571 */ "select_item ::= common_expression",
+ /* 572 */ "select_item ::= common_expression column_alias",
+ /* 573 */ "select_item ::= common_expression AS column_alias",
+ /* 574 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 575 */ "where_clause_opt ::=",
+ /* 576 */ "where_clause_opt ::= WHERE search_condition",
+ /* 577 */ "partition_by_clause_opt ::=",
+ /* 578 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
+ /* 579 */ "partition_list ::= partition_item",
+ /* 580 */ "partition_list ::= partition_list NK_COMMA partition_item",
+ /* 581 */ "partition_item ::= expr_or_subquery",
+ /* 582 */ "partition_item ::= expr_or_subquery column_alias",
+ /* 583 */ "partition_item ::= expr_or_subquery AS column_alias",
+ /* 584 */ "twindow_clause_opt ::=",
+ /* 585 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP",
+ /* 586 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 587 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
+ /* 588 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
+ /* 589 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
+ /* 590 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP",
+ /* 591 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 592 */ "sliding_opt ::=",
+ /* 593 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
+ /* 594 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
+ /* 595 */ "interval_sliding_duration_literal ::= NK_STRING",
+ /* 596 */ "interval_sliding_duration_literal ::= NK_INTEGER",
+ /* 597 */ "fill_opt ::=",
+ /* 598 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 599 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
+ /* 600 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
+ /* 601 */ "fill_mode ::= NONE",
+ /* 602 */ "fill_mode ::= PREV",
+ /* 603 */ "fill_mode ::= NULL",
+ /* 604 */ "fill_mode ::= NULL_F",
+ /* 605 */ "fill_mode ::= LINEAR",
+ /* 606 */ "fill_mode ::= NEXT",
+ /* 607 */ "group_by_clause_opt ::=",
+ /* 608 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 609 */ "group_by_list ::= expr_or_subquery",
+ /* 610 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 611 */ "having_clause_opt ::=",
+ /* 612 */ "having_clause_opt ::= HAVING search_condition",
+ /* 613 */ "range_opt ::=",
+ /* 614 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 615 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
+ /* 616 */ "every_opt ::=",
+ /* 617 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 618 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 619 */ "query_simple ::= query_specification",
+ /* 620 */ "query_simple ::= union_query_expression",
+ /* 621 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 622 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 623 */ "query_simple_or_subquery ::= query_simple",
+ /* 624 */ "query_simple_or_subquery ::= subquery",
+ /* 625 */ "query_or_subquery ::= query_expression",
+ /* 626 */ "query_or_subquery ::= subquery",
+ /* 627 */ "order_by_clause_opt ::=",
+ /* 628 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 629 */ "slimit_clause_opt ::=",
+ /* 630 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 631 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 632 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 633 */ "limit_clause_opt ::=",
+ /* 634 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 635 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 636 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 637 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 638 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 639 */ "search_condition ::= common_expression",
+ /* 640 */ "sort_specification_list ::= sort_specification",
+ /* 641 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 642 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 643 */ "ordering_specification_opt ::=",
+ /* 644 */ "ordering_specification_opt ::= ASC",
+ /* 645 */ "ordering_specification_opt ::= DESC",
+ /* 646 */ "null_ordering_opt ::=",
+ /* 647 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 648 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -3163,270 +3173,236 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 354: /* cmd */
- case 357: /* literal */
- case 366: /* with_opt */
- case 372: /* search_condition */
- case 377: /* db_options */
- case 379: /* alter_db_options */
- case 381: /* start_opt */
- case 382: /* end_opt */
- case 386: /* signed */
- case 388: /* retention */
- case 389: /* full_table_name */
- case 392: /* table_options */
- case 396: /* alter_table_clause */
- case 397: /* alter_table_options */
- case 400: /* column_options */
- case 401: /* signed_literal */
- case 402: /* create_subtable_clause */
- case 405: /* drop_table_clause */
- case 408: /* tag_def */
- case 409: /* column_def */
- case 413: /* duration_literal */
- case 414: /* rollup_func_name */
- case 416: /* col_name */
- case 419: /* like_pattern_opt */
- case 420: /* db_name_cond_opt */
- case 421: /* table_name_cond */
- case 422: /* from_db_opt */
- case 425: /* tag_item */
- case 427: /* index_options */
- case 428: /* full_index_name */
- case 431: /* sliding_opt */
- case 432: /* sma_stream_opt */
- case 433: /* func */
- case 436: /* query_or_subquery */
- case 437: /* where_clause_opt */
- case 440: /* explain_options */
- case 441: /* insert_query */
- case 446: /* full_view_name */
- case 449: /* stream_options */
- case 452: /* subtable_opt */
- case 454: /* expression */
- case 457: /* literal_func */
- case 460: /* expr_or_subquery */
- case 461: /* pseudo_column */
- case 462: /* column_reference */
- case 463: /* function_expression */
- case 464: /* case_when_expression */
- case 469: /* star_func_para */
- case 471: /* case_when_else_opt */
- case 472: /* common_expression */
- case 473: /* when_then_expr */
- case 474: /* predicate */
- case 477: /* in_predicate_value */
- case 478: /* boolean_value_expression */
- case 479: /* boolean_primary */
- case 480: /* from_clause_opt */
- case 481: /* table_reference_list */
- case 482: /* table_reference */
- case 483: /* table_primary */
- case 484: /* joined_table */
- case 486: /* subquery */
- case 487: /* parenthesized_joined_table */
- case 489: /* query_specification */
- case 495: /* range_opt */
- case 496: /* every_opt */
- case 497: /* fill_opt */
- case 498: /* twindow_clause_opt */
- case 500: /* having_clause_opt */
- case 501: /* select_item */
- case 503: /* partition_item */
- case 504: /* interval_sliding_duration_literal */
- case 507: /* query_expression */
- case 508: /* query_simple */
- case 510: /* slimit_clause_opt */
- case 511: /* limit_clause_opt */
- case 512: /* union_query_expression */
- case 513: /* query_simple_or_subquery */
- case 515: /* sort_specification */
+ case 351: /* cmd */
+ case 354: /* literal */
+ case 363: /* with_opt */
+ case 369: /* search_condition */
+ case 374: /* db_options */
+ case 376: /* alter_db_options */
+ case 378: /* start_opt */
+ case 379: /* end_opt */
+ case 383: /* signed */
+ case 385: /* retention */
+ case 386: /* full_table_name */
+ case 389: /* table_options */
+ case 393: /* alter_table_clause */
+ case 394: /* alter_table_options */
+ case 397: /* signed_literal */
+ case 398: /* create_subtable_clause */
+ case 401: /* drop_table_clause */
+ case 403: /* column_def */
+ case 407: /* duration_literal */
+ case 408: /* rollup_func_name */
+ case 410: /* col_name */
+ case 413: /* like_pattern_opt */
+ case 414: /* db_name_cond_opt */
+ case 415: /* table_name_cond */
+ case 416: /* from_db_opt */
+ case 419: /* tag_item */
+ case 421: /* index_options */
+ case 422: /* full_index_name */
+ case 425: /* sliding_opt */
+ case 426: /* sma_stream_opt */
+ case 427: /* func */
+ case 430: /* query_or_subquery */
+ case 431: /* where_clause_opt */
+ case 434: /* explain_options */
+ case 435: /* insert_query */
+ case 440: /* full_view_name */
+ case 443: /* stream_options */
+ case 446: /* subtable_opt */
+ case 448: /* expression */
+ case 451: /* literal_func */
+ case 454: /* expr_or_subquery */
+ case 455: /* pseudo_column */
+ case 456: /* column_reference */
+ case 457: /* function_expression */
+ case 458: /* case_when_expression */
+ case 463: /* star_func_para */
+ case 465: /* case_when_else_opt */
+ case 466: /* common_expression */
+ case 467: /* when_then_expr */
+ case 468: /* predicate */
+ case 471: /* in_predicate_value */
+ case 472: /* boolean_value_expression */
+ case 473: /* boolean_primary */
+ case 474: /* from_clause_opt */
+ case 475: /* table_reference_list */
+ case 476: /* table_reference */
+ case 477: /* table_primary */
+ case 478: /* joined_table */
+ case 480: /* subquery */
+ case 481: /* parenthesized_joined_table */
+ case 483: /* query_specification */
+ case 489: /* range_opt */
+ case 490: /* every_opt */
+ case 491: /* fill_opt */
+ case 492: /* twindow_clause_opt */
+ case 494: /* having_clause_opt */
+ case 495: /* select_item */
+ case 497: /* partition_item */
+ case 498: /* interval_sliding_duration_literal */
+ case 501: /* query_expression */
+ case 502: /* query_simple */
+ case 504: /* slimit_clause_opt */
+ case 505: /* limit_clause_opt */
+ case 506: /* union_query_expression */
+ case 507: /* query_simple_or_subquery */
+ case 509: /* sort_specification */
{
-#line 7 "sql.y"
- nodesDestroyNode((yypminor->yy896));
-#line 3247 "sql.c"
+ nodesDestroyNode((yypminor->yy360));
}
break;
- case 355: /* account_options */
- case 356: /* alter_account_options */
- case 358: /* alter_account_option */
- case 380: /* speed_opt */
- case 435: /* with_meta */
- case 444: /* bufsize_opt */
+ case 352: /* account_options */
+ case 353: /* alter_account_options */
+ case 355: /* alter_account_option */
+ case 377: /* speed_opt */
+ case 429: /* with_meta */
+ case 438: /* bufsize_opt */
{
-#line 54 "sql.y"
-#line 3259 "sql.c"
}
break;
- case 359: /* ip_range_list */
- case 360: /* white_list */
- case 361: /* white_list_opt */
- case 383: /* integer_list */
- case 384: /* variable_list */
- case 385: /* retention_list */
- case 390: /* column_def_list */
- case 391: /* tags_def_opt */
- case 393: /* multi_create_clause */
- case 394: /* tags_def */
- case 395: /* multi_drop_clause */
- case 403: /* specific_cols_opt */
- case 404: /* expression_list */
- case 406: /* col_name_list */
- case 407: /* tag_def_list */
- case 410: /* duration_list */
- case 411: /* rollup_func_list */
- case 423: /* tag_list_opt */
- case 430: /* func_list */
- case 450: /* col_list_opt */
- case 451: /* tag_def_or_ref_opt */
- case 456: /* dnode_list */
- case 458: /* literal_list */
- case 466: /* star_func_para_list */
- case 468: /* other_para_list */
- case 470: /* when_then_list */
- case 490: /* hint_list */
- case 493: /* select_list */
- case 494: /* partition_by_clause_opt */
- case 499: /* group_by_clause_opt */
- case 502: /* partition_list */
- case 506: /* group_by_list */
- case 509: /* order_by_clause_opt */
- case 514: /* sort_specification_list */
+ case 356: /* ip_range_list */
+ case 357: /* white_list */
+ case 358: /* white_list_opt */
+ case 380: /* integer_list */
+ case 381: /* variable_list */
+ case 382: /* retention_list */
+ case 387: /* column_def_list */
+ case 388: /* tags_def_opt */
+ case 390: /* multi_create_clause */
+ case 391: /* tags_def */
+ case 392: /* multi_drop_clause */
+ case 399: /* specific_cols_opt */
+ case 400: /* expression_list */
+ case 402: /* col_name_list */
+ case 404: /* duration_list */
+ case 405: /* rollup_func_list */
+ case 417: /* tag_list_opt */
+ case 424: /* func_list */
+ case 444: /* col_list_opt */
+ case 445: /* tag_def_or_ref_opt */
+ case 450: /* dnode_list */
+ case 452: /* literal_list */
+ case 460: /* star_func_para_list */
+ case 462: /* other_para_list */
+ case 464: /* when_then_list */
+ case 484: /* hint_list */
+ case 487: /* select_list */
+ case 488: /* partition_by_clause_opt */
+ case 493: /* group_by_clause_opt */
+ case 496: /* partition_list */
+ case 500: /* group_by_list */
+ case 503: /* order_by_clause_opt */
+ case 508: /* sort_specification_list */
{
-#line 85 "sql.y"
- nodesDestroyList((yypminor->yy404));
-#line 3299 "sql.c"
+ nodesDestroyList((yypminor->yy536));
}
break;
- case 362: /* user_name */
- case 369: /* db_name */
- case 370: /* table_name */
- case 371: /* topic_name */
- case 373: /* dnode_endpoint */
- case 398: /* column_name */
- case 415: /* function_name */
- case 426: /* column_alias */
- case 429: /* index_name */
- case 434: /* sma_func_name */
- case 438: /* cgroup_name */
- case 445: /* language_opt */
- case 447: /* view_name */
- case 448: /* stream_name */
- case 455: /* on_vgroup_id */
- case 459: /* table_alias */
- case 465: /* star_func */
- case 467: /* noarg_func */
- case 485: /* alias_opt */
+ case 359: /* user_name */
+ case 366: /* db_name */
+ case 367: /* table_name */
+ case 368: /* topic_name */
+ case 370: /* dnode_endpoint */
+ case 395: /* column_name */
+ case 409: /* function_name */
+ case 420: /* column_alias */
+ case 423: /* index_name */
+ case 428: /* sma_func_name */
+ case 432: /* cgroup_name */
+ case 439: /* language_opt */
+ case 441: /* view_name */
+ case 442: /* stream_name */
+ case 449: /* on_vgroup_id */
+ case 453: /* table_alias */
+ case 459: /* star_func */
+ case 461: /* noarg_func */
+ case 479: /* alias_opt */
{
-#line 827 "sql.y"
-#line 3324 "sql.c"
}
break;
- case 363: /* sysinfo_opt */
+ case 360: /* sysinfo_opt */
{
#line 112 "sql.y"
-#line 3331 "sql.c"
}
break;
- case 364: /* privileges */
- case 367: /* priv_type_list */
- case 368: /* priv_type */
+ case 361: /* privileges */
+ case 364: /* priv_type_list */
+ case 365: /* priv_type */
{
-#line 121 "sql.y"
-#line 3340 "sql.c"
}
break;
- case 365: /* priv_level */
+ case 362: /* priv_level */
{
#line 138 "sql.y"
-#line 3347 "sql.c"
}
break;
- case 374: /* force_opt */
- case 375: /* unsafe_opt */
- case 376: /* not_exists_opt */
- case 378: /* exists_opt */
- case 439: /* analyze_opt */
- case 442: /* or_replace_opt */
- case 443: /* agg_func_opt */
- case 453: /* ignore_opt */
- case 491: /* set_quantifier_opt */
- case 492: /* tag_mode_opt */
+ case 371: /* force_opt */
+ case 372: /* unsafe_opt */
+ case 373: /* not_exists_opt */
+ case 375: /* exists_opt */
+ case 433: /* analyze_opt */
+ case 436: /* or_replace_opt */
+ case 437: /* agg_func_opt */
+ case 447: /* ignore_opt */
+ case 485: /* set_quantifier_opt */
+ case 486: /* tag_mode_opt */
{
-#line 167 "sql.y"
-#line 3363 "sql.c"
}
break;
- case 387: /* alter_db_option */
- case 412: /* alter_table_option */
+ case 384: /* alter_db_option */
+ case 406: /* alter_table_option */
{
#line 269 "sql.y"
-#line 3371 "sql.c"
}
break;
- case 399: /* type_name */
+ case 396: /* type_name */
{
-#line 400 "sql.y"
-#line 3378 "sql.c"
}
break;
- case 417: /* db_kind_opt */
- case 424: /* table_kind */
+ case 411: /* db_kind_opt */
+ case 418: /* table_kind */
{
-#line 568 "sql.y"
-#line 3386 "sql.c"
}
break;
- case 418: /* table_kind_db_name_cond_opt */
+ case 412: /* table_kind_db_name_cond_opt */
{
-#line 533 "sql.y"
-#line 3393 "sql.c"
}
break;
- case 475: /* compare_op */
- case 476: /* in_op */
+ case 469: /* compare_op */
+ case 470: /* in_op */
{
-#line 1017 "sql.y"
-#line 3401 "sql.c"
}
break;
- case 488: /* join_type */
+ case 482: /* join_type */
{
-#line 1093 "sql.y"
-#line 3408 "sql.c"
}
break;
- case 505: /* fill_mode */
+ case 499: /* fill_mode */
{
-#line 1188 "sql.y"
-#line 3415 "sql.c"
}
break;
- case 516: /* ordering_specification_opt */
+ case 510: /* ordering_specification_opt */
{
-#line 1273 "sql.y"
-#line 3422 "sql.c"
}
break;
- case 517: /* null_ordering_opt */
+ case 511: /* null_ordering_opt */
{
-#line 1279 "sql.y"
-#line 3429 "sql.c"
}
break;
/********* End destructor definitions *****************************************/
@@ -3715,663 +3691,655 @@ static void yy_shift(
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
** of that rule */
static const YYCODETYPE yyRuleInfoLhs[] = {
- 354, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
- 354, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
- 355, /* (2) account_options ::= */
- 355, /* (3) account_options ::= account_options PPS literal */
- 355, /* (4) account_options ::= account_options TSERIES literal */
- 355, /* (5) account_options ::= account_options STORAGE literal */
- 355, /* (6) account_options ::= account_options STREAMS literal */
- 355, /* (7) account_options ::= account_options QTIME literal */
- 355, /* (8) account_options ::= account_options DBS literal */
- 355, /* (9) account_options ::= account_options USERS literal */
- 355, /* (10) account_options ::= account_options CONNS literal */
- 355, /* (11) account_options ::= account_options STATE literal */
- 356, /* (12) alter_account_options ::= alter_account_option */
- 356, /* (13) alter_account_options ::= alter_account_options alter_account_option */
- 358, /* (14) alter_account_option ::= PASS literal */
- 358, /* (15) alter_account_option ::= PPS literal */
- 358, /* (16) alter_account_option ::= TSERIES literal */
- 358, /* (17) alter_account_option ::= STORAGE literal */
- 358, /* (18) alter_account_option ::= STREAMS literal */
- 358, /* (19) alter_account_option ::= QTIME literal */
- 358, /* (20) alter_account_option ::= DBS literal */
- 358, /* (21) alter_account_option ::= USERS literal */
- 358, /* (22) alter_account_option ::= CONNS literal */
- 358, /* (23) alter_account_option ::= STATE literal */
- 359, /* (24) ip_range_list ::= NK_STRING */
- 359, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
- 360, /* (26) white_list ::= HOST ip_range_list */
- 361, /* (27) white_list_opt ::= */
- 361, /* (28) white_list_opt ::= white_list */
- 354, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */
- 354, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */
- 354, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
- 354, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
- 354, /* (33) cmd ::= ALTER USER user_name ADD white_list */
- 354, /* (34) cmd ::= ALTER USER user_name DROP white_list */
- 354, /* (35) cmd ::= DROP USER user_name */
- 363, /* (36) sysinfo_opt ::= */
- 363, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */
- 354, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
- 354, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
- 364, /* (40) privileges ::= ALL */
- 364, /* (41) privileges ::= priv_type_list */
- 364, /* (42) privileges ::= SUBSCRIBE */
- 367, /* (43) priv_type_list ::= priv_type */
- 367, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- 368, /* (45) priv_type ::= READ */
- 368, /* (46) priv_type ::= WRITE */
- 368, /* (47) priv_type ::= ALTER */
- 365, /* (48) priv_level ::= NK_STAR NK_DOT NK_STAR */
- 365, /* (49) priv_level ::= db_name NK_DOT NK_STAR */
- 365, /* (50) priv_level ::= db_name NK_DOT table_name */
- 365, /* (51) priv_level ::= topic_name */
- 366, /* (52) with_opt ::= */
- 366, /* (53) with_opt ::= WITH search_condition */
- 354, /* (54) cmd ::= CREATE DNODE dnode_endpoint */
- 354, /* (55) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- 354, /* (56) cmd ::= DROP DNODE NK_INTEGER force_opt */
- 354, /* (57) cmd ::= DROP DNODE dnode_endpoint force_opt */
- 354, /* (58) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
- 354, /* (59) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
- 354, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- 354, /* (61) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- 354, /* (62) cmd ::= ALTER ALL DNODES NK_STRING */
- 354, /* (63) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- 354, /* (64) cmd ::= RESTORE DNODE NK_INTEGER */
- 373, /* (65) dnode_endpoint ::= NK_STRING */
- 373, /* (66) dnode_endpoint ::= NK_ID */
- 373, /* (67) dnode_endpoint ::= NK_IPTOKEN */
- 374, /* (68) force_opt ::= */
- 374, /* (69) force_opt ::= FORCE */
- 375, /* (70) unsafe_opt ::= UNSAFE */
- 354, /* (71) cmd ::= ALTER CLUSTER NK_STRING */
- 354, /* (72) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
- 354, /* (73) cmd ::= ALTER LOCAL NK_STRING */
- 354, /* (74) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- 354, /* (75) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- 354, /* (76) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- 354, /* (77) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
- 354, /* (78) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- 354, /* (79) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- 354, /* (80) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- 354, /* (81) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- 354, /* (82) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- 354, /* (83) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- 354, /* (84) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
- 354, /* (85) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
- 354, /* (86) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- 354, /* (87) cmd ::= DROP DATABASE exists_opt db_name */
- 354, /* (88) cmd ::= USE db_name */
- 354, /* (89) cmd ::= ALTER DATABASE db_name alter_db_options */
- 354, /* (90) cmd ::= FLUSH DATABASE db_name */
- 354, /* (91) cmd ::= TRIM DATABASE db_name speed_opt */
- 354, /* (92) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
- 376, /* (93) not_exists_opt ::= IF NOT EXISTS */
- 376, /* (94) not_exists_opt ::= */
- 378, /* (95) exists_opt ::= IF EXISTS */
- 378, /* (96) exists_opt ::= */
- 377, /* (97) db_options ::= */
- 377, /* (98) db_options ::= db_options BUFFER NK_INTEGER */
- 377, /* (99) db_options ::= db_options CACHEMODEL NK_STRING */
- 377, /* (100) db_options ::= db_options CACHESIZE NK_INTEGER */
- 377, /* (101) db_options ::= db_options COMP NK_INTEGER */
- 377, /* (102) db_options ::= db_options DURATION NK_INTEGER */
- 377, /* (103) db_options ::= db_options DURATION NK_VARIABLE */
- 377, /* (104) db_options ::= db_options MAXROWS NK_INTEGER */
- 377, /* (105) db_options ::= db_options MINROWS NK_INTEGER */
- 377, /* (106) db_options ::= db_options KEEP integer_list */
- 377, /* (107) db_options ::= db_options KEEP variable_list */
- 377, /* (108) db_options ::= db_options PAGES NK_INTEGER */
- 377, /* (109) db_options ::= db_options PAGESIZE NK_INTEGER */
- 377, /* (110) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- 377, /* (111) db_options ::= db_options PRECISION NK_STRING */
- 377, /* (112) db_options ::= db_options REPLICA NK_INTEGER */
- 377, /* (113) db_options ::= db_options VGROUPS NK_INTEGER */
- 377, /* (114) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- 377, /* (115) db_options ::= db_options RETENTIONS retention_list */
- 377, /* (116) db_options ::= db_options SCHEMALESS NK_INTEGER */
- 377, /* (117) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- 377, /* (118) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- 377, /* (119) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- 377, /* (120) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- 377, /* (121) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- 377, /* (122) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- 377, /* (123) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- 377, /* (124) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- 377, /* (125) db_options ::= db_options STT_TRIGGER NK_INTEGER */
- 377, /* (126) db_options ::= db_options TABLE_PREFIX signed */
- 377, /* (127) db_options ::= db_options TABLE_SUFFIX signed */
- 377, /* (128) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
- 379, /* (129) alter_db_options ::= alter_db_option */
- 379, /* (130) alter_db_options ::= alter_db_options alter_db_option */
- 387, /* (131) alter_db_option ::= BUFFER NK_INTEGER */
- 387, /* (132) alter_db_option ::= CACHEMODEL NK_STRING */
- 387, /* (133) alter_db_option ::= CACHESIZE NK_INTEGER */
- 387, /* (134) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- 387, /* (135) alter_db_option ::= KEEP integer_list */
- 387, /* (136) alter_db_option ::= KEEP variable_list */
- 387, /* (137) alter_db_option ::= PAGES NK_INTEGER */
- 387, /* (138) alter_db_option ::= REPLICA NK_INTEGER */
- 387, /* (139) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- 387, /* (140) alter_db_option ::= STT_TRIGGER NK_INTEGER */
- 387, /* (141) alter_db_option ::= MINROWS NK_INTEGER */
- 387, /* (142) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
- 387, /* (143) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- 387, /* (144) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
- 387, /* (145) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- 387, /* (146) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
- 383, /* (147) integer_list ::= NK_INTEGER */
- 383, /* (148) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- 384, /* (149) variable_list ::= NK_VARIABLE */
- 384, /* (150) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- 385, /* (151) retention_list ::= retention */
- 385, /* (152) retention_list ::= retention_list NK_COMMA retention */
- 388, /* (153) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- 388, /* (154) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
- 380, /* (155) speed_opt ::= */
- 380, /* (156) speed_opt ::= BWLIMIT NK_INTEGER */
- 381, /* (157) start_opt ::= */
- 381, /* (158) start_opt ::= START WITH NK_INTEGER */
- 381, /* (159) start_opt ::= START WITH NK_STRING */
- 381, /* (160) start_opt ::= START WITH TIMESTAMP NK_STRING */
- 382, /* (161) end_opt ::= */
- 382, /* (162) end_opt ::= END WITH NK_INTEGER */
- 382, /* (163) end_opt ::= END WITH NK_STRING */
- 382, /* (164) end_opt ::= END WITH TIMESTAMP NK_STRING */
- 354, /* (165) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- 354, /* (166) cmd ::= CREATE TABLE multi_create_clause */
- 354, /* (167) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- 354, /* (168) cmd ::= DROP TABLE multi_drop_clause */
- 354, /* (169) cmd ::= DROP STABLE exists_opt full_table_name */
- 354, /* (170) cmd ::= ALTER TABLE alter_table_clause */
- 354, /* (171) cmd ::= ALTER STABLE alter_table_clause */
- 396, /* (172) alter_table_clause ::= full_table_name alter_table_options */
- 396, /* (173) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
- 396, /* (174) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- 396, /* (175) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- 396, /* (176) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
- 396, /* (177) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- 396, /* (178) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- 396, /* (179) alter_table_clause ::= full_table_name DROP TAG column_name */
- 396, /* (180) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- 396, /* (181) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- 396, /* (182) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
- 393, /* (183) multi_create_clause ::= create_subtable_clause */
- 393, /* (184) multi_create_clause ::= multi_create_clause create_subtable_clause */
- 402, /* (185) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
- 395, /* (186) multi_drop_clause ::= drop_table_clause */
- 395, /* (187) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
- 405, /* (188) drop_table_clause ::= exists_opt full_table_name */
- 403, /* (189) specific_cols_opt ::= */
- 403, /* (190) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- 389, /* (191) full_table_name ::= table_name */
- 389, /* (192) full_table_name ::= db_name NK_DOT table_name */
- 407, /* (193) tag_def_list ::= tag_def */
- 407, /* (194) tag_def_list ::= tag_def_list NK_COMMA tag_def */
- 408, /* (195) tag_def ::= column_name type_name */
- 390, /* (196) column_def_list ::= column_def */
- 390, /* (197) column_def_list ::= column_def_list NK_COMMA column_def */
- 409, /* (198) column_def ::= column_name type_name column_options */
- 399, /* (199) type_name ::= BOOL */
- 399, /* (200) type_name ::= TINYINT */
- 399, /* (201) type_name ::= SMALLINT */
- 399, /* (202) type_name ::= INT */
- 399, /* (203) type_name ::= INTEGER */
- 399, /* (204) type_name ::= BIGINT */
- 399, /* (205) type_name ::= FLOAT */
- 399, /* (206) type_name ::= DOUBLE */
- 399, /* (207) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- 399, /* (208) type_name ::= TIMESTAMP */
- 399, /* (209) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- 399, /* (210) type_name ::= TINYINT UNSIGNED */
- 399, /* (211) type_name ::= SMALLINT UNSIGNED */
- 399, /* (212) type_name ::= INT UNSIGNED */
- 399, /* (213) type_name ::= BIGINT UNSIGNED */
- 399, /* (214) type_name ::= JSON */
- 399, /* (215) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- 399, /* (216) type_name ::= MEDIUMBLOB */
- 399, /* (217) type_name ::= BLOB */
- 399, /* (218) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- 399, /* (219) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
- 399, /* (220) type_name ::= DECIMAL */
- 399, /* (221) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- 399, /* (222) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 391, /* (223) tags_def_opt ::= */
- 391, /* (224) tags_def_opt ::= tags_def */
- 394, /* (225) tags_def ::= TAGS NK_LP tag_def_list NK_RP */
- 392, /* (226) table_options ::= */
- 392, /* (227) table_options ::= table_options COMMENT NK_STRING */
- 392, /* (228) table_options ::= table_options MAX_DELAY duration_list */
- 392, /* (229) table_options ::= table_options WATERMARK duration_list */
- 392, /* (230) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- 392, /* (231) table_options ::= table_options TTL NK_INTEGER */
- 392, /* (232) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- 392, /* (233) table_options ::= table_options DELETE_MARK duration_list */
- 397, /* (234) alter_table_options ::= alter_table_option */
- 397, /* (235) alter_table_options ::= alter_table_options alter_table_option */
- 412, /* (236) alter_table_option ::= COMMENT NK_STRING */
- 412, /* (237) alter_table_option ::= TTL NK_INTEGER */
- 410, /* (238) duration_list ::= duration_literal */
- 410, /* (239) duration_list ::= duration_list NK_COMMA duration_literal */
- 411, /* (240) rollup_func_list ::= rollup_func_name */
- 411, /* (241) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- 414, /* (242) rollup_func_name ::= function_name */
- 414, /* (243) rollup_func_name ::= FIRST */
- 414, /* (244) rollup_func_name ::= LAST */
- 406, /* (245) col_name_list ::= col_name */
- 406, /* (246) col_name_list ::= col_name_list NK_COMMA col_name */
- 416, /* (247) col_name ::= column_name */
- 354, /* (248) cmd ::= SHOW DNODES */
- 354, /* (249) cmd ::= SHOW USERS */
- 354, /* (250) cmd ::= SHOW USER PRIVILEGES */
- 354, /* (251) cmd ::= SHOW db_kind_opt DATABASES */
- 354, /* (252) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
- 354, /* (253) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- 354, /* (254) cmd ::= SHOW db_name_cond_opt VGROUPS */
- 354, /* (255) cmd ::= SHOW MNODES */
- 354, /* (256) cmd ::= SHOW QNODES */
- 354, /* (257) cmd ::= SHOW FUNCTIONS */
- 354, /* (258) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- 354, /* (259) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
- 354, /* (260) cmd ::= SHOW STREAMS */
- 354, /* (261) cmd ::= SHOW ACCOUNTS */
- 354, /* (262) cmd ::= SHOW APPS */
- 354, /* (263) cmd ::= SHOW CONNECTIONS */
- 354, /* (264) cmd ::= SHOW LICENCES */
- 354, /* (265) cmd ::= SHOW GRANTS */
- 354, /* (266) cmd ::= SHOW GRANTS FULL */
- 354, /* (267) cmd ::= SHOW GRANTS LOGS */
- 354, /* (268) cmd ::= SHOW CLUSTER MACHINES */
- 354, /* (269) cmd ::= SHOW CREATE DATABASE db_name */
- 354, /* (270) cmd ::= SHOW CREATE TABLE full_table_name */
- 354, /* (271) cmd ::= SHOW CREATE STABLE full_table_name */
- 354, /* (272) cmd ::= SHOW QUERIES */
- 354, /* (273) cmd ::= SHOW SCORES */
- 354, /* (274) cmd ::= SHOW TOPICS */
- 354, /* (275) cmd ::= SHOW VARIABLES */
- 354, /* (276) cmd ::= SHOW CLUSTER VARIABLES */
- 354, /* (277) cmd ::= SHOW LOCAL VARIABLES */
- 354, /* (278) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- 354, /* (279) cmd ::= SHOW BNODES */
- 354, /* (280) cmd ::= SHOW SNODES */
- 354, /* (281) cmd ::= SHOW CLUSTER */
- 354, /* (282) cmd ::= SHOW TRANSACTIONS */
- 354, /* (283) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- 354, /* (284) cmd ::= SHOW CONSUMERS */
- 354, /* (285) cmd ::= SHOW SUBSCRIPTIONS */
- 354, /* (286) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- 354, /* (287) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
- 354, /* (288) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
- 354, /* (289) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
- 354, /* (290) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
- 354, /* (291) cmd ::= SHOW VNODES */
- 354, /* (292) cmd ::= SHOW db_name_cond_opt ALIVE */
- 354, /* (293) cmd ::= SHOW CLUSTER ALIVE */
- 354, /* (294) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
- 354, /* (295) cmd ::= SHOW CREATE VIEW full_table_name */
- 354, /* (296) cmd ::= SHOW COMPACTS */
- 354, /* (297) cmd ::= SHOW COMPACT NK_INTEGER */
- 418, /* (298) table_kind_db_name_cond_opt ::= */
- 418, /* (299) table_kind_db_name_cond_opt ::= table_kind */
- 418, /* (300) table_kind_db_name_cond_opt ::= db_name NK_DOT */
- 418, /* (301) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
- 424, /* (302) table_kind ::= NORMAL */
- 424, /* (303) table_kind ::= CHILD */
- 420, /* (304) db_name_cond_opt ::= */
- 420, /* (305) db_name_cond_opt ::= db_name NK_DOT */
- 419, /* (306) like_pattern_opt ::= */
- 419, /* (307) like_pattern_opt ::= LIKE NK_STRING */
- 421, /* (308) table_name_cond ::= table_name */
- 422, /* (309) from_db_opt ::= */
- 422, /* (310) from_db_opt ::= FROM db_name */
- 423, /* (311) tag_list_opt ::= */
- 423, /* (312) tag_list_opt ::= tag_item */
- 423, /* (313) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
- 425, /* (314) tag_item ::= TBNAME */
- 425, /* (315) tag_item ::= QTAGS */
- 425, /* (316) tag_item ::= column_name */
- 425, /* (317) tag_item ::= column_name column_alias */
- 425, /* (318) tag_item ::= column_name AS column_alias */
- 417, /* (319) db_kind_opt ::= */
- 417, /* (320) db_kind_opt ::= USER */
- 417, /* (321) db_kind_opt ::= SYSTEM */
- 354, /* (322) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
- 354, /* (323) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
- 354, /* (324) cmd ::= DROP INDEX exists_opt full_index_name */
- 428, /* (325) full_index_name ::= index_name */
- 428, /* (326) full_index_name ::= db_name NK_DOT index_name */
- 427, /* (327) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- 427, /* (328) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
- 430, /* (329) func_list ::= func */
- 430, /* (330) func_list ::= func_list NK_COMMA func */
- 433, /* (331) func ::= sma_func_name NK_LP expression_list NK_RP */
- 434, /* (332) sma_func_name ::= function_name */
- 434, /* (333) sma_func_name ::= COUNT */
- 434, /* (334) sma_func_name ::= FIRST */
- 434, /* (335) sma_func_name ::= LAST */
- 434, /* (336) sma_func_name ::= LAST_ROW */
- 432, /* (337) sma_stream_opt ::= */
- 432, /* (338) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- 432, /* (339) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
- 432, /* (340) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
- 435, /* (341) with_meta ::= AS */
- 435, /* (342) with_meta ::= WITH META AS */
- 435, /* (343) with_meta ::= ONLY META AS */
- 354, /* (344) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- 354, /* (345) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
- 354, /* (346) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
- 354, /* (347) cmd ::= DROP TOPIC exists_opt topic_name */
- 354, /* (348) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- 354, /* (349) cmd ::= DESC full_table_name */
- 354, /* (350) cmd ::= DESCRIBE full_table_name */
- 354, /* (351) cmd ::= RESET QUERY CACHE */
- 354, /* (352) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- 354, /* (353) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
- 439, /* (354) analyze_opt ::= */
- 439, /* (355) analyze_opt ::= ANALYZE */
- 440, /* (356) explain_options ::= */
- 440, /* (357) explain_options ::= explain_options VERBOSE NK_BOOL */
- 440, /* (358) explain_options ::= explain_options RATIO NK_FLOAT */
- 354, /* (359) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
- 354, /* (360) cmd ::= DROP FUNCTION exists_opt function_name */
- 443, /* (361) agg_func_opt ::= */
- 443, /* (362) agg_func_opt ::= AGGREGATE */
- 444, /* (363) bufsize_opt ::= */
- 444, /* (364) bufsize_opt ::= BUFSIZE NK_INTEGER */
- 445, /* (365) language_opt ::= */
- 445, /* (366) language_opt ::= LANGUAGE NK_STRING */
- 442, /* (367) or_replace_opt ::= */
- 442, /* (368) or_replace_opt ::= OR REPLACE */
- 354, /* (369) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
- 354, /* (370) cmd ::= DROP VIEW exists_opt full_view_name */
- 446, /* (371) full_view_name ::= view_name */
- 446, /* (372) full_view_name ::= db_name NK_DOT view_name */
- 354, /* (373) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
- 354, /* (374) cmd ::= DROP STREAM exists_opt stream_name */
- 354, /* (375) cmd ::= PAUSE STREAM exists_opt stream_name */
- 354, /* (376) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
- 450, /* (377) col_list_opt ::= */
- 450, /* (378) col_list_opt ::= NK_LP col_name_list NK_RP */
- 451, /* (379) tag_def_or_ref_opt ::= */
- 451, /* (380) tag_def_or_ref_opt ::= tags_def */
- 451, /* (381) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
- 449, /* (382) stream_options ::= */
- 449, /* (383) stream_options ::= stream_options TRIGGER AT_ONCE */
- 449, /* (384) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- 449, /* (385) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- 449, /* (386) stream_options ::= stream_options WATERMARK duration_literal */
- 449, /* (387) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- 449, /* (388) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- 449, /* (389) stream_options ::= stream_options DELETE_MARK duration_literal */
- 449, /* (390) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
- 452, /* (391) subtable_opt ::= */
- 452, /* (392) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- 453, /* (393) ignore_opt ::= */
- 453, /* (394) ignore_opt ::= IGNORE UNTREATED */
- 354, /* (395) cmd ::= KILL CONNECTION NK_INTEGER */
- 354, /* (396) cmd ::= KILL QUERY NK_STRING */
- 354, /* (397) cmd ::= KILL TRANSACTION NK_INTEGER */
- 354, /* (398) cmd ::= KILL COMPACT NK_INTEGER */
- 354, /* (399) cmd ::= BALANCE VGROUP */
- 354, /* (400) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
- 354, /* (401) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- 354, /* (402) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- 354, /* (403) cmd ::= SPLIT VGROUP NK_INTEGER */
- 455, /* (404) on_vgroup_id ::= */
- 455, /* (405) on_vgroup_id ::= ON NK_INTEGER */
- 456, /* (406) dnode_list ::= DNODE NK_INTEGER */
- 456, /* (407) dnode_list ::= dnode_list DNODE NK_INTEGER */
- 354, /* (408) cmd ::= DELETE FROM full_table_name where_clause_opt */
- 354, /* (409) cmd ::= query_or_subquery */
- 354, /* (410) cmd ::= insert_query */
- 441, /* (411) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- 441, /* (412) insert_query ::= INSERT INTO full_table_name query_or_subquery */
- 357, /* (413) literal ::= NK_INTEGER */
- 357, /* (414) literal ::= NK_FLOAT */
- 357, /* (415) literal ::= NK_STRING */
- 357, /* (416) literal ::= NK_BOOL */
- 357, /* (417) literal ::= TIMESTAMP NK_STRING */
- 357, /* (418) literal ::= duration_literal */
- 357, /* (419) literal ::= NULL */
- 357, /* (420) literal ::= NK_QUESTION */
- 413, /* (421) duration_literal ::= NK_VARIABLE */
- 386, /* (422) signed ::= NK_INTEGER */
- 386, /* (423) signed ::= NK_PLUS NK_INTEGER */
- 386, /* (424) signed ::= NK_MINUS NK_INTEGER */
- 386, /* (425) signed ::= NK_FLOAT */
- 386, /* (426) signed ::= NK_PLUS NK_FLOAT */
- 386, /* (427) signed ::= NK_MINUS NK_FLOAT */
- 401, /* (428) signed_literal ::= signed */
- 401, /* (429) signed_literal ::= NK_STRING */
- 401, /* (430) signed_literal ::= NK_BOOL */
- 401, /* (431) signed_literal ::= TIMESTAMP NK_STRING */
- 401, /* (432) signed_literal ::= duration_literal */
- 401, /* (433) signed_literal ::= NULL */
- 401, /* (434) signed_literal ::= literal_func */
- 401, /* (435) signed_literal ::= NK_QUESTION */
- 458, /* (436) literal_list ::= signed_literal */
- 458, /* (437) literal_list ::= literal_list NK_COMMA signed_literal */
- 369, /* (438) db_name ::= NK_ID */
- 370, /* (439) table_name ::= NK_ID */
- 398, /* (440) column_name ::= NK_ID */
- 415, /* (441) function_name ::= NK_ID */
- 447, /* (442) view_name ::= NK_ID */
- 459, /* (443) table_alias ::= NK_ID */
- 426, /* (444) column_alias ::= NK_ID */
- 426, /* (445) column_alias ::= NK_ALIAS */
- 362, /* (446) user_name ::= NK_ID */
- 371, /* (447) topic_name ::= NK_ID */
- 448, /* (448) stream_name ::= NK_ID */
- 438, /* (449) cgroup_name ::= NK_ID */
- 429, /* (450) index_name ::= NK_ID */
- 460, /* (451) expr_or_subquery ::= expression */
- 454, /* (452) expression ::= literal */
- 454, /* (453) expression ::= pseudo_column */
- 454, /* (454) expression ::= column_reference */
- 454, /* (455) expression ::= function_expression */
- 454, /* (456) expression ::= case_when_expression */
- 454, /* (457) expression ::= NK_LP expression NK_RP */
- 454, /* (458) expression ::= NK_PLUS expr_or_subquery */
- 454, /* (459) expression ::= NK_MINUS expr_or_subquery */
- 454, /* (460) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- 454, /* (461) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- 454, /* (462) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- 454, /* (463) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- 454, /* (464) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- 454, /* (465) expression ::= column_reference NK_ARROW NK_STRING */
- 454, /* (466) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- 454, /* (467) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- 404, /* (468) expression_list ::= expr_or_subquery */
- 404, /* (469) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- 462, /* (470) column_reference ::= column_name */
- 462, /* (471) column_reference ::= table_name NK_DOT column_name */
- 462, /* (472) column_reference ::= NK_ALIAS */
- 462, /* (473) column_reference ::= table_name NK_DOT NK_ALIAS */
- 461, /* (474) pseudo_column ::= ROWTS */
- 461, /* (475) pseudo_column ::= TBNAME */
- 461, /* (476) pseudo_column ::= table_name NK_DOT TBNAME */
- 461, /* (477) pseudo_column ::= QSTART */
- 461, /* (478) pseudo_column ::= QEND */
- 461, /* (479) pseudo_column ::= QDURATION */
- 461, /* (480) pseudo_column ::= WSTART */
- 461, /* (481) pseudo_column ::= WEND */
- 461, /* (482) pseudo_column ::= WDURATION */
- 461, /* (483) pseudo_column ::= IROWTS */
- 461, /* (484) pseudo_column ::= ISFILLED */
- 461, /* (485) pseudo_column ::= QTAGS */
- 463, /* (486) function_expression ::= function_name NK_LP expression_list NK_RP */
- 463, /* (487) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- 463, /* (488) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- 463, /* (489) function_expression ::= literal_func */
- 457, /* (490) literal_func ::= noarg_func NK_LP NK_RP */
- 457, /* (491) literal_func ::= NOW */
- 467, /* (492) noarg_func ::= NOW */
- 467, /* (493) noarg_func ::= TODAY */
- 467, /* (494) noarg_func ::= TIMEZONE */
- 467, /* (495) noarg_func ::= DATABASE */
- 467, /* (496) noarg_func ::= CLIENT_VERSION */
- 467, /* (497) noarg_func ::= SERVER_VERSION */
- 467, /* (498) noarg_func ::= SERVER_STATUS */
- 467, /* (499) noarg_func ::= CURRENT_USER */
- 467, /* (500) noarg_func ::= USER */
- 465, /* (501) star_func ::= COUNT */
- 465, /* (502) star_func ::= FIRST */
- 465, /* (503) star_func ::= LAST */
- 465, /* (504) star_func ::= LAST_ROW */
- 466, /* (505) star_func_para_list ::= NK_STAR */
- 466, /* (506) star_func_para_list ::= other_para_list */
- 468, /* (507) other_para_list ::= star_func_para */
- 468, /* (508) other_para_list ::= other_para_list NK_COMMA star_func_para */
- 469, /* (509) star_func_para ::= expr_or_subquery */
- 469, /* (510) star_func_para ::= table_name NK_DOT NK_STAR */
- 464, /* (511) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- 464, /* (512) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- 470, /* (513) when_then_list ::= when_then_expr */
- 470, /* (514) when_then_list ::= when_then_list when_then_expr */
- 473, /* (515) when_then_expr ::= WHEN common_expression THEN common_expression */
- 471, /* (516) case_when_else_opt ::= */
- 471, /* (517) case_when_else_opt ::= ELSE common_expression */
- 474, /* (518) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- 474, /* (519) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- 474, /* (520) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- 474, /* (521) predicate ::= expr_or_subquery IS NULL */
- 474, /* (522) predicate ::= expr_or_subquery IS NOT NULL */
- 474, /* (523) predicate ::= expr_or_subquery in_op in_predicate_value */
- 475, /* (524) compare_op ::= NK_LT */
- 475, /* (525) compare_op ::= NK_GT */
- 475, /* (526) compare_op ::= NK_LE */
- 475, /* (527) compare_op ::= NK_GE */
- 475, /* (528) compare_op ::= NK_NE */
- 475, /* (529) compare_op ::= NK_EQ */
- 475, /* (530) compare_op ::= LIKE */
- 475, /* (531) compare_op ::= NOT LIKE */
- 475, /* (532) compare_op ::= MATCH */
- 475, /* (533) compare_op ::= NMATCH */
- 475, /* (534) compare_op ::= CONTAINS */
- 476, /* (535) in_op ::= IN */
- 476, /* (536) in_op ::= NOT IN */
- 477, /* (537) in_predicate_value ::= NK_LP literal_list NK_RP */
- 478, /* (538) boolean_value_expression ::= boolean_primary */
- 478, /* (539) boolean_value_expression ::= NOT boolean_primary */
- 478, /* (540) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- 478, /* (541) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- 479, /* (542) boolean_primary ::= predicate */
- 479, /* (543) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- 472, /* (544) common_expression ::= expr_or_subquery */
- 472, /* (545) common_expression ::= boolean_value_expression */
- 480, /* (546) from_clause_opt ::= */
- 480, /* (547) from_clause_opt ::= FROM table_reference_list */
- 481, /* (548) table_reference_list ::= table_reference */
- 481, /* (549) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- 482, /* (550) table_reference ::= table_primary */
- 482, /* (551) table_reference ::= joined_table */
- 483, /* (552) table_primary ::= table_name alias_opt */
- 483, /* (553) table_primary ::= db_name NK_DOT table_name alias_opt */
- 483, /* (554) table_primary ::= subquery alias_opt */
- 483, /* (555) table_primary ::= parenthesized_joined_table */
- 485, /* (556) alias_opt ::= */
- 485, /* (557) alias_opt ::= table_alias */
- 485, /* (558) alias_opt ::= AS table_alias */
- 487, /* (559) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- 487, /* (560) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- 484, /* (561) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- 488, /* (562) join_type ::= */
- 488, /* (563) join_type ::= INNER */
- 489, /* (564) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
- 490, /* (565) hint_list ::= */
- 490, /* (566) hint_list ::= NK_HINT */
- 492, /* (567) tag_mode_opt ::= */
- 492, /* (568) tag_mode_opt ::= TAGS */
- 491, /* (569) set_quantifier_opt ::= */
- 491, /* (570) set_quantifier_opt ::= DISTINCT */
- 491, /* (571) set_quantifier_opt ::= ALL */
- 493, /* (572) select_list ::= select_item */
- 493, /* (573) select_list ::= select_list NK_COMMA select_item */
- 501, /* (574) select_item ::= NK_STAR */
- 501, /* (575) select_item ::= common_expression */
- 501, /* (576) select_item ::= common_expression column_alias */
- 501, /* (577) select_item ::= common_expression AS column_alias */
- 501, /* (578) select_item ::= table_name NK_DOT NK_STAR */
- 437, /* (579) where_clause_opt ::= */
- 437, /* (580) where_clause_opt ::= WHERE search_condition */
- 494, /* (581) partition_by_clause_opt ::= */
- 494, /* (582) partition_by_clause_opt ::= PARTITION BY partition_list */
- 502, /* (583) partition_list ::= partition_item */
- 502, /* (584) partition_list ::= partition_list NK_COMMA partition_item */
- 503, /* (585) partition_item ::= expr_or_subquery */
- 503, /* (586) partition_item ::= expr_or_subquery column_alias */
- 503, /* (587) partition_item ::= expr_or_subquery AS column_alias */
- 498, /* (588) twindow_clause_opt ::= */
- 498, /* (589) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
- 498, /* (590) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- 498, /* (591) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- 498, /* (592) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- 498, /* (593) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- 498, /* (594) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
- 498, /* (595) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 431, /* (596) sliding_opt ::= */
- 431, /* (597) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
- 504, /* (598) interval_sliding_duration_literal ::= NK_VARIABLE */
- 504, /* (599) interval_sliding_duration_literal ::= NK_STRING */
- 504, /* (600) interval_sliding_duration_literal ::= NK_INTEGER */
- 497, /* (601) fill_opt ::= */
- 497, /* (602) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- 497, /* (603) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
- 497, /* (604) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
- 505, /* (605) fill_mode ::= NONE */
- 505, /* (606) fill_mode ::= PREV */
- 505, /* (607) fill_mode ::= NULL */
- 505, /* (608) fill_mode ::= NULL_F */
- 505, /* (609) fill_mode ::= LINEAR */
- 505, /* (610) fill_mode ::= NEXT */
- 499, /* (611) group_by_clause_opt ::= */
- 499, /* (612) group_by_clause_opt ::= GROUP BY group_by_list */
- 506, /* (613) group_by_list ::= expr_or_subquery */
- 506, /* (614) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- 500, /* (615) having_clause_opt ::= */
- 500, /* (616) having_clause_opt ::= HAVING search_condition */
- 495, /* (617) range_opt ::= */
- 495, /* (618) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- 495, /* (619) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
- 496, /* (620) every_opt ::= */
- 496, /* (621) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- 507, /* (622) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- 508, /* (623) query_simple ::= query_specification */
- 508, /* (624) query_simple ::= union_query_expression */
- 512, /* (625) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- 512, /* (626) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- 513, /* (627) query_simple_or_subquery ::= query_simple */
- 513, /* (628) query_simple_or_subquery ::= subquery */
- 436, /* (629) query_or_subquery ::= query_expression */
- 436, /* (630) query_or_subquery ::= subquery */
- 509, /* (631) order_by_clause_opt ::= */
- 509, /* (632) order_by_clause_opt ::= ORDER BY sort_specification_list */
- 510, /* (633) slimit_clause_opt ::= */
- 510, /* (634) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- 510, /* (635) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- 510, /* (636) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 511, /* (637) limit_clause_opt ::= */
- 511, /* (638) limit_clause_opt ::= LIMIT NK_INTEGER */
- 511, /* (639) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- 511, /* (640) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 486, /* (641) subquery ::= NK_LP query_expression NK_RP */
- 486, /* (642) subquery ::= NK_LP subquery NK_RP */
- 372, /* (643) search_condition ::= common_expression */
- 514, /* (644) sort_specification_list ::= sort_specification */
- 514, /* (645) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- 515, /* (646) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- 516, /* (647) ordering_specification_opt ::= */
- 516, /* (648) ordering_specification_opt ::= ASC */
- 516, /* (649) ordering_specification_opt ::= DESC */
- 517, /* (650) null_ordering_opt ::= */
- 517, /* (651) null_ordering_opt ::= NULLS FIRST */
- 517, /* (652) null_ordering_opt ::= NULLS LAST */
- 400, /* (653) column_options ::= */
- 400, /* (654) column_options ::= column_options ENCODE NK_STRING */
- 400, /* (655) column_options ::= column_options COMPRESS NK_STRING */
- 400, /* (656) column_options ::= column_options LEVEL NK_STRING */
+ 351, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ 351, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ 352, /* (2) account_options ::= */
+ 352, /* (3) account_options ::= account_options PPS literal */
+ 352, /* (4) account_options ::= account_options TSERIES literal */
+ 352, /* (5) account_options ::= account_options STORAGE literal */
+ 352, /* (6) account_options ::= account_options STREAMS literal */
+ 352, /* (7) account_options ::= account_options QTIME literal */
+ 352, /* (8) account_options ::= account_options DBS literal */
+ 352, /* (9) account_options ::= account_options USERS literal */
+ 352, /* (10) account_options ::= account_options CONNS literal */
+ 352, /* (11) account_options ::= account_options STATE literal */
+ 353, /* (12) alter_account_options ::= alter_account_option */
+ 353, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ 355, /* (14) alter_account_option ::= PASS literal */
+ 355, /* (15) alter_account_option ::= PPS literal */
+ 355, /* (16) alter_account_option ::= TSERIES literal */
+ 355, /* (17) alter_account_option ::= STORAGE literal */
+ 355, /* (18) alter_account_option ::= STREAMS literal */
+ 355, /* (19) alter_account_option ::= QTIME literal */
+ 355, /* (20) alter_account_option ::= DBS literal */
+ 355, /* (21) alter_account_option ::= USERS literal */
+ 355, /* (22) alter_account_option ::= CONNS literal */
+ 355, /* (23) alter_account_option ::= STATE literal */
+ 356, /* (24) ip_range_list ::= NK_STRING */
+ 356, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
+ 357, /* (26) white_list ::= HOST ip_range_list */
+ 358, /* (27) white_list_opt ::= */
+ 358, /* (28) white_list_opt ::= white_list */
+ 351, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */
+ 351, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */
+ 351, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
+ 351, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
+ 351, /* (33) cmd ::= ALTER USER user_name ADD white_list */
+ 351, /* (34) cmd ::= ALTER USER user_name DROP white_list */
+ 351, /* (35) cmd ::= DROP USER user_name */
+ 360, /* (36) sysinfo_opt ::= */
+ 360, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */
+ 351, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
+ 351, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
+ 361, /* (40) privileges ::= ALL */
+ 361, /* (41) privileges ::= priv_type_list */
+ 361, /* (42) privileges ::= SUBSCRIBE */
+ 364, /* (43) priv_type_list ::= priv_type */
+ 364, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ 365, /* (45) priv_type ::= READ */
+ 365, /* (46) priv_type ::= WRITE */
+ 365, /* (47) priv_type ::= ALTER */
+ 362, /* (48) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ 362, /* (49) priv_level ::= db_name NK_DOT NK_STAR */
+ 362, /* (50) priv_level ::= db_name NK_DOT table_name */
+ 362, /* (51) priv_level ::= topic_name */
+ 363, /* (52) with_opt ::= */
+ 363, /* (53) with_opt ::= WITH search_condition */
+ 351, /* (54) cmd ::= CREATE DNODE dnode_endpoint */
+ 351, /* (55) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ 351, /* (56) cmd ::= DROP DNODE NK_INTEGER force_opt */
+ 351, /* (57) cmd ::= DROP DNODE dnode_endpoint force_opt */
+ 351, /* (58) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
+ 351, /* (59) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
+ 351, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ 351, /* (61) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ 351, /* (62) cmd ::= ALTER ALL DNODES NK_STRING */
+ 351, /* (63) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ 351, /* (64) cmd ::= RESTORE DNODE NK_INTEGER */
+ 370, /* (65) dnode_endpoint ::= NK_STRING */
+ 370, /* (66) dnode_endpoint ::= NK_ID */
+ 370, /* (67) dnode_endpoint ::= NK_IPTOKEN */
+ 371, /* (68) force_opt ::= */
+ 371, /* (69) force_opt ::= FORCE */
+ 372, /* (70) unsafe_opt ::= UNSAFE */
+ 351, /* (71) cmd ::= ALTER CLUSTER NK_STRING */
+ 351, /* (72) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
+ 351, /* (73) cmd ::= ALTER LOCAL NK_STRING */
+ 351, /* (74) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ 351, /* (75) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ 351, /* (76) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ 351, /* (77) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
+ 351, /* (78) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ 351, /* (79) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ 351, /* (80) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ 351, /* (81) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ 351, /* (82) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ 351, /* (83) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ 351, /* (84) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
+ 351, /* (85) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
+ 351, /* (86) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ 351, /* (87) cmd ::= DROP DATABASE exists_opt db_name */
+ 351, /* (88) cmd ::= USE db_name */
+ 351, /* (89) cmd ::= ALTER DATABASE db_name alter_db_options */
+ 351, /* (90) cmd ::= FLUSH DATABASE db_name */
+ 351, /* (91) cmd ::= TRIM DATABASE db_name speed_opt */
+ 351, /* (92) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+ 373, /* (93) not_exists_opt ::= IF NOT EXISTS */
+ 373, /* (94) not_exists_opt ::= */
+ 375, /* (95) exists_opt ::= IF EXISTS */
+ 375, /* (96) exists_opt ::= */
+ 374, /* (97) db_options ::= */
+ 374, /* (98) db_options ::= db_options BUFFER NK_INTEGER */
+ 374, /* (99) db_options ::= db_options CACHEMODEL NK_STRING */
+ 374, /* (100) db_options ::= db_options CACHESIZE NK_INTEGER */
+ 374, /* (101) db_options ::= db_options COMP NK_INTEGER */
+ 374, /* (102) db_options ::= db_options DURATION NK_INTEGER */
+ 374, /* (103) db_options ::= db_options DURATION NK_VARIABLE */
+ 374, /* (104) db_options ::= db_options MAXROWS NK_INTEGER */
+ 374, /* (105) db_options ::= db_options MINROWS NK_INTEGER */
+ 374, /* (106) db_options ::= db_options KEEP integer_list */
+ 374, /* (107) db_options ::= db_options KEEP variable_list */
+ 374, /* (108) db_options ::= db_options PAGES NK_INTEGER */
+ 374, /* (109) db_options ::= db_options PAGESIZE NK_INTEGER */
+ 374, /* (110) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ 374, /* (111) db_options ::= db_options PRECISION NK_STRING */
+ 374, /* (112) db_options ::= db_options REPLICA NK_INTEGER */
+ 374, /* (113) db_options ::= db_options VGROUPS NK_INTEGER */
+ 374, /* (114) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ 374, /* (115) db_options ::= db_options RETENTIONS retention_list */
+ 374, /* (116) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ 374, /* (117) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ 374, /* (118) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ 374, /* (119) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ 374, /* (120) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ 374, /* (121) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ 374, /* (122) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ 374, /* (123) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ 374, /* (124) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ 374, /* (125) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ 374, /* (126) db_options ::= db_options TABLE_PREFIX signed */
+ 374, /* (127) db_options ::= db_options TABLE_SUFFIX signed */
+ 374, /* (128) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
+ 376, /* (129) alter_db_options ::= alter_db_option */
+ 376, /* (130) alter_db_options ::= alter_db_options alter_db_option */
+ 384, /* (131) alter_db_option ::= BUFFER NK_INTEGER */
+ 384, /* (132) alter_db_option ::= CACHEMODEL NK_STRING */
+ 384, /* (133) alter_db_option ::= CACHESIZE NK_INTEGER */
+ 384, /* (134) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ 384, /* (135) alter_db_option ::= KEEP integer_list */
+ 384, /* (136) alter_db_option ::= KEEP variable_list */
+ 384, /* (137) alter_db_option ::= PAGES NK_INTEGER */
+ 384, /* (138) alter_db_option ::= REPLICA NK_INTEGER */
+ 384, /* (139) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ 384, /* (140) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ 384, /* (141) alter_db_option ::= MINROWS NK_INTEGER */
+ 384, /* (142) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+ 384, /* (143) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ 384, /* (144) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+ 384, /* (145) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ 384, /* (146) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
+ 380, /* (147) integer_list ::= NK_INTEGER */
+ 380, /* (148) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ 381, /* (149) variable_list ::= NK_VARIABLE */
+ 381, /* (150) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ 382, /* (151) retention_list ::= retention */
+ 382, /* (152) retention_list ::= retention_list NK_COMMA retention */
+ 385, /* (153) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ 385, /* (154) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
+ 377, /* (155) speed_opt ::= */
+ 377, /* (156) speed_opt ::= BWLIMIT NK_INTEGER */
+ 378, /* (157) start_opt ::= */
+ 378, /* (158) start_opt ::= START WITH NK_INTEGER */
+ 378, /* (159) start_opt ::= START WITH NK_STRING */
+ 378, /* (160) start_opt ::= START WITH TIMESTAMP NK_STRING */
+ 379, /* (161) end_opt ::= */
+ 379, /* (162) end_opt ::= END WITH NK_INTEGER */
+ 379, /* (163) end_opt ::= END WITH NK_STRING */
+ 379, /* (164) end_opt ::= END WITH TIMESTAMP NK_STRING */
+ 351, /* (165) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ 351, /* (166) cmd ::= CREATE TABLE multi_create_clause */
+ 351, /* (167) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ 351, /* (168) cmd ::= DROP TABLE multi_drop_clause */
+ 351, /* (169) cmd ::= DROP STABLE exists_opt full_table_name */
+ 351, /* (170) cmd ::= ALTER TABLE alter_table_clause */
+ 351, /* (171) cmd ::= ALTER STABLE alter_table_clause */
+ 393, /* (172) alter_table_clause ::= full_table_name alter_table_options */
+ 393, /* (173) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+ 393, /* (174) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ 393, /* (175) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ 393, /* (176) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ 393, /* (177) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ 393, /* (178) alter_table_clause ::= full_table_name DROP TAG column_name */
+ 393, /* (179) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ 393, /* (180) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ 393, /* (181) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ 390, /* (182) multi_create_clause ::= create_subtable_clause */
+ 390, /* (183) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ 398, /* (184) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
+ 392, /* (185) multi_drop_clause ::= drop_table_clause */
+ 392, /* (186) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
+ 401, /* (187) drop_table_clause ::= exists_opt full_table_name */
+ 399, /* (188) specific_cols_opt ::= */
+ 399, /* (189) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ 386, /* (190) full_table_name ::= table_name */
+ 386, /* (191) full_table_name ::= db_name NK_DOT table_name */
+ 387, /* (192) column_def_list ::= column_def */
+ 387, /* (193) column_def_list ::= column_def_list NK_COMMA column_def */
+ 403, /* (194) column_def ::= column_name type_name */
+ 396, /* (195) type_name ::= BOOL */
+ 396, /* (196) type_name ::= TINYINT */
+ 396, /* (197) type_name ::= SMALLINT */
+ 396, /* (198) type_name ::= INT */
+ 396, /* (199) type_name ::= INTEGER */
+ 396, /* (200) type_name ::= BIGINT */
+ 396, /* (201) type_name ::= FLOAT */
+ 396, /* (202) type_name ::= DOUBLE */
+ 396, /* (203) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ 396, /* (204) type_name ::= TIMESTAMP */
+ 396, /* (205) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ 396, /* (206) type_name ::= TINYINT UNSIGNED */
+ 396, /* (207) type_name ::= SMALLINT UNSIGNED */
+ 396, /* (208) type_name ::= INT UNSIGNED */
+ 396, /* (209) type_name ::= BIGINT UNSIGNED */
+ 396, /* (210) type_name ::= JSON */
+ 396, /* (211) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ 396, /* (212) type_name ::= MEDIUMBLOB */
+ 396, /* (213) type_name ::= BLOB */
+ 396, /* (214) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ 396, /* (215) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+ 396, /* (216) type_name ::= DECIMAL */
+ 396, /* (217) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ 396, /* (218) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 388, /* (219) tags_def_opt ::= */
+ 388, /* (220) tags_def_opt ::= tags_def */
+ 391, /* (221) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ 389, /* (222) table_options ::= */
+ 389, /* (223) table_options ::= table_options COMMENT NK_STRING */
+ 389, /* (224) table_options ::= table_options MAX_DELAY duration_list */
+ 389, /* (225) table_options ::= table_options WATERMARK duration_list */
+ 389, /* (226) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ 389, /* (227) table_options ::= table_options TTL NK_INTEGER */
+ 389, /* (228) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ 389, /* (229) table_options ::= table_options DELETE_MARK duration_list */
+ 394, /* (230) alter_table_options ::= alter_table_option */
+ 394, /* (231) alter_table_options ::= alter_table_options alter_table_option */
+ 406, /* (232) alter_table_option ::= COMMENT NK_STRING */
+ 406, /* (233) alter_table_option ::= TTL NK_INTEGER */
+ 404, /* (234) duration_list ::= duration_literal */
+ 404, /* (235) duration_list ::= duration_list NK_COMMA duration_literal */
+ 405, /* (236) rollup_func_list ::= rollup_func_name */
+ 405, /* (237) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ 408, /* (238) rollup_func_name ::= function_name */
+ 408, /* (239) rollup_func_name ::= FIRST */
+ 408, /* (240) rollup_func_name ::= LAST */
+ 402, /* (241) col_name_list ::= col_name */
+ 402, /* (242) col_name_list ::= col_name_list NK_COMMA col_name */
+ 410, /* (243) col_name ::= column_name */
+ 351, /* (244) cmd ::= SHOW DNODES */
+ 351, /* (245) cmd ::= SHOW USERS */
+ 351, /* (246) cmd ::= SHOW USER PRIVILEGES */
+ 351, /* (247) cmd ::= SHOW db_kind_opt DATABASES */
+ 351, /* (248) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
+ 351, /* (249) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ 351, /* (250) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ 351, /* (251) cmd ::= SHOW MNODES */
+ 351, /* (252) cmd ::= SHOW QNODES */
+ 351, /* (253) cmd ::= SHOW FUNCTIONS */
+ 351, /* (254) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ 351, /* (255) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+ 351, /* (256) cmd ::= SHOW STREAMS */
+ 351, /* (257) cmd ::= SHOW ACCOUNTS */
+ 351, /* (258) cmd ::= SHOW APPS */
+ 351, /* (259) cmd ::= SHOW CONNECTIONS */
+ 351, /* (260) cmd ::= SHOW LICENCES */
+ 351, /* (261) cmd ::= SHOW GRANTS */
+ 351, /* (262) cmd ::= SHOW GRANTS FULL */
+ 351, /* (263) cmd ::= SHOW GRANTS LOGS */
+ 351, /* (264) cmd ::= SHOW CLUSTER MACHINES */
+ 351, /* (265) cmd ::= SHOW CREATE DATABASE db_name */
+ 351, /* (266) cmd ::= SHOW CREATE TABLE full_table_name */
+ 351, /* (267) cmd ::= SHOW CREATE STABLE full_table_name */
+ 351, /* (268) cmd ::= SHOW QUERIES */
+ 351, /* (269) cmd ::= SHOW SCORES */
+ 351, /* (270) cmd ::= SHOW TOPICS */
+ 351, /* (271) cmd ::= SHOW VARIABLES */
+ 351, /* (272) cmd ::= SHOW CLUSTER VARIABLES */
+ 351, /* (273) cmd ::= SHOW LOCAL VARIABLES */
+ 351, /* (274) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ 351, /* (275) cmd ::= SHOW BNODES */
+ 351, /* (276) cmd ::= SHOW SNODES */
+ 351, /* (277) cmd ::= SHOW CLUSTER */
+ 351, /* (278) cmd ::= SHOW TRANSACTIONS */
+ 351, /* (279) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ 351, /* (280) cmd ::= SHOW CONSUMERS */
+ 351, /* (281) cmd ::= SHOW SUBSCRIPTIONS */
+ 351, /* (282) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ 351, /* (283) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+ 351, /* (284) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+ 351, /* (285) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+ 351, /* (286) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
+ 351, /* (287) cmd ::= SHOW VNODES */
+ 351, /* (288) cmd ::= SHOW db_name_cond_opt ALIVE */
+ 351, /* (289) cmd ::= SHOW CLUSTER ALIVE */
+ 351, /* (290) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+ 351, /* (291) cmd ::= SHOW CREATE VIEW full_table_name */
+ 351, /* (292) cmd ::= SHOW COMPACTS */
+ 351, /* (293) cmd ::= SHOW COMPACT NK_INTEGER */
+ 412, /* (294) table_kind_db_name_cond_opt ::= */
+ 412, /* (295) table_kind_db_name_cond_opt ::= table_kind */
+ 412, /* (296) table_kind_db_name_cond_opt ::= db_name NK_DOT */
+ 412, /* (297) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+ 418, /* (298) table_kind ::= NORMAL */
+ 418, /* (299) table_kind ::= CHILD */
+ 414, /* (300) db_name_cond_opt ::= */
+ 414, /* (301) db_name_cond_opt ::= db_name NK_DOT */
+ 413, /* (302) like_pattern_opt ::= */
+ 413, /* (303) like_pattern_opt ::= LIKE NK_STRING */
+ 415, /* (304) table_name_cond ::= table_name */
+ 416, /* (305) from_db_opt ::= */
+ 416, /* (306) from_db_opt ::= FROM db_name */
+ 417, /* (307) tag_list_opt ::= */
+ 417, /* (308) tag_list_opt ::= tag_item */
+ 417, /* (309) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
+ 419, /* (310) tag_item ::= TBNAME */
+ 419, /* (311) tag_item ::= QTAGS */
+ 419, /* (312) tag_item ::= column_name */
+ 419, /* (313) tag_item ::= column_name column_alias */
+ 419, /* (314) tag_item ::= column_name AS column_alias */
+ 411, /* (315) db_kind_opt ::= */
+ 411, /* (316) db_kind_opt ::= USER */
+ 411, /* (317) db_kind_opt ::= SYSTEM */
+ 351, /* (318) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+ 351, /* (319) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+ 351, /* (320) cmd ::= DROP INDEX exists_opt full_index_name */
+ 422, /* (321) full_index_name ::= index_name */
+ 422, /* (322) full_index_name ::= db_name NK_DOT index_name */
+ 421, /* (323) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ 421, /* (324) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
+ 424, /* (325) func_list ::= func */
+ 424, /* (326) func_list ::= func_list NK_COMMA func */
+ 427, /* (327) func ::= sma_func_name NK_LP expression_list NK_RP */
+ 428, /* (328) sma_func_name ::= function_name */
+ 428, /* (329) sma_func_name ::= COUNT */
+ 428, /* (330) sma_func_name ::= FIRST */
+ 428, /* (331) sma_func_name ::= LAST */
+ 428, /* (332) sma_func_name ::= LAST_ROW */
+ 426, /* (333) sma_stream_opt ::= */
+ 426, /* (334) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+ 426, /* (335) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+ 426, /* (336) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+ 429, /* (337) with_meta ::= AS */
+ 429, /* (338) with_meta ::= WITH META AS */
+ 429, /* (339) with_meta ::= ONLY META AS */
+ 351, /* (340) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ 351, /* (341) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+ 351, /* (342) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+ 351, /* (343) cmd ::= DROP TOPIC exists_opt topic_name */
+ 351, /* (344) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ 351, /* (345) cmd ::= DESC full_table_name */
+ 351, /* (346) cmd ::= DESCRIBE full_table_name */
+ 351, /* (347) cmd ::= RESET QUERY CACHE */
+ 351, /* (348) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ 351, /* (349) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
+ 433, /* (350) analyze_opt ::= */
+ 433, /* (351) analyze_opt ::= ANALYZE */
+ 434, /* (352) explain_options ::= */
+ 434, /* (353) explain_options ::= explain_options VERBOSE NK_BOOL */
+ 434, /* (354) explain_options ::= explain_options RATIO NK_FLOAT */
+ 351, /* (355) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+ 351, /* (356) cmd ::= DROP FUNCTION exists_opt function_name */
+ 437, /* (357) agg_func_opt ::= */
+ 437, /* (358) agg_func_opt ::= AGGREGATE */
+ 438, /* (359) bufsize_opt ::= */
+ 438, /* (360) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ 439, /* (361) language_opt ::= */
+ 439, /* (362) language_opt ::= LANGUAGE NK_STRING */
+ 436, /* (363) or_replace_opt ::= */
+ 436, /* (364) or_replace_opt ::= OR REPLACE */
+ 351, /* (365) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+ 351, /* (366) cmd ::= DROP VIEW exists_opt full_view_name */
+ 440, /* (367) full_view_name ::= view_name */
+ 440, /* (368) full_view_name ::= db_name NK_DOT view_name */
+ 351, /* (369) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+ 351, /* (370) cmd ::= DROP STREAM exists_opt stream_name */
+ 351, /* (371) cmd ::= PAUSE STREAM exists_opt stream_name */
+ 351, /* (372) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+ 444, /* (373) col_list_opt ::= */
+ 444, /* (374) col_list_opt ::= NK_LP col_name_list NK_RP */
+ 445, /* (375) tag_def_or_ref_opt ::= */
+ 445, /* (376) tag_def_or_ref_opt ::= tags_def */
+ 445, /* (377) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
+ 443, /* (378) stream_options ::= */
+ 443, /* (379) stream_options ::= stream_options TRIGGER AT_ONCE */
+ 443, /* (380) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ 443, /* (381) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ 443, /* (382) stream_options ::= stream_options WATERMARK duration_literal */
+ 443, /* (383) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ 443, /* (384) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ 443, /* (385) stream_options ::= stream_options DELETE_MARK duration_literal */
+ 443, /* (386) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+ 446, /* (387) subtable_opt ::= */
+ 446, /* (388) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ 447, /* (389) ignore_opt ::= */
+ 447, /* (390) ignore_opt ::= IGNORE UNTREATED */
+ 351, /* (391) cmd ::= KILL CONNECTION NK_INTEGER */
+ 351, /* (392) cmd ::= KILL QUERY NK_STRING */
+ 351, /* (393) cmd ::= KILL TRANSACTION NK_INTEGER */
+ 351, /* (394) cmd ::= KILL COMPACT NK_INTEGER */
+ 351, /* (395) cmd ::= BALANCE VGROUP */
+ 351, /* (396) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+ 351, /* (397) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ 351, /* (398) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ 351, /* (399) cmd ::= SPLIT VGROUP NK_INTEGER */
+ 449, /* (400) on_vgroup_id ::= */
+ 449, /* (401) on_vgroup_id ::= ON NK_INTEGER */
+ 450, /* (402) dnode_list ::= DNODE NK_INTEGER */
+ 450, /* (403) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ 351, /* (404) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ 351, /* (405) cmd ::= query_or_subquery */
+ 351, /* (406) cmd ::= insert_query */
+ 435, /* (407) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ 435, /* (408) insert_query ::= INSERT INTO full_table_name query_or_subquery */
+ 354, /* (409) literal ::= NK_INTEGER */
+ 354, /* (410) literal ::= NK_FLOAT */
+ 354, /* (411) literal ::= NK_STRING */
+ 354, /* (412) literal ::= NK_BOOL */
+ 354, /* (413) literal ::= TIMESTAMP NK_STRING */
+ 354, /* (414) literal ::= duration_literal */
+ 354, /* (415) literal ::= NULL */
+ 354, /* (416) literal ::= NK_QUESTION */
+ 407, /* (417) duration_literal ::= NK_VARIABLE */
+ 383, /* (418) signed ::= NK_INTEGER */
+ 383, /* (419) signed ::= NK_PLUS NK_INTEGER */
+ 383, /* (420) signed ::= NK_MINUS NK_INTEGER */
+ 383, /* (421) signed ::= NK_FLOAT */
+ 383, /* (422) signed ::= NK_PLUS NK_FLOAT */
+ 383, /* (423) signed ::= NK_MINUS NK_FLOAT */
+ 397, /* (424) signed_literal ::= signed */
+ 397, /* (425) signed_literal ::= NK_STRING */
+ 397, /* (426) signed_literal ::= NK_BOOL */
+ 397, /* (427) signed_literal ::= TIMESTAMP NK_STRING */
+ 397, /* (428) signed_literal ::= duration_literal */
+ 397, /* (429) signed_literal ::= NULL */
+ 397, /* (430) signed_literal ::= literal_func */
+ 397, /* (431) signed_literal ::= NK_QUESTION */
+ 452, /* (432) literal_list ::= signed_literal */
+ 452, /* (433) literal_list ::= literal_list NK_COMMA signed_literal */
+ 366, /* (434) db_name ::= NK_ID */
+ 367, /* (435) table_name ::= NK_ID */
+ 395, /* (436) column_name ::= NK_ID */
+ 409, /* (437) function_name ::= NK_ID */
+ 441, /* (438) view_name ::= NK_ID */
+ 453, /* (439) table_alias ::= NK_ID */
+ 420, /* (440) column_alias ::= NK_ID */
+ 420, /* (441) column_alias ::= NK_ALIAS */
+ 359, /* (442) user_name ::= NK_ID */
+ 368, /* (443) topic_name ::= NK_ID */
+ 442, /* (444) stream_name ::= NK_ID */
+ 432, /* (445) cgroup_name ::= NK_ID */
+ 423, /* (446) index_name ::= NK_ID */
+ 454, /* (447) expr_or_subquery ::= expression */
+ 448, /* (448) expression ::= literal */
+ 448, /* (449) expression ::= pseudo_column */
+ 448, /* (450) expression ::= column_reference */
+ 448, /* (451) expression ::= function_expression */
+ 448, /* (452) expression ::= case_when_expression */
+ 448, /* (453) expression ::= NK_LP expression NK_RP */
+ 448, /* (454) expression ::= NK_PLUS expr_or_subquery */
+ 448, /* (455) expression ::= NK_MINUS expr_or_subquery */
+ 448, /* (456) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ 448, /* (457) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ 448, /* (458) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ 448, /* (459) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ 448, /* (460) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ 448, /* (461) expression ::= column_reference NK_ARROW NK_STRING */
+ 448, /* (462) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ 448, /* (463) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ 400, /* (464) expression_list ::= expr_or_subquery */
+ 400, /* (465) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ 456, /* (466) column_reference ::= column_name */
+ 456, /* (467) column_reference ::= table_name NK_DOT column_name */
+ 456, /* (468) column_reference ::= NK_ALIAS */
+ 456, /* (469) column_reference ::= table_name NK_DOT NK_ALIAS */
+ 455, /* (470) pseudo_column ::= ROWTS */
+ 455, /* (471) pseudo_column ::= TBNAME */
+ 455, /* (472) pseudo_column ::= table_name NK_DOT TBNAME */
+ 455, /* (473) pseudo_column ::= QSTART */
+ 455, /* (474) pseudo_column ::= QEND */
+ 455, /* (475) pseudo_column ::= QDURATION */
+ 455, /* (476) pseudo_column ::= WSTART */
+ 455, /* (477) pseudo_column ::= WEND */
+ 455, /* (478) pseudo_column ::= WDURATION */
+ 455, /* (479) pseudo_column ::= IROWTS */
+ 455, /* (480) pseudo_column ::= ISFILLED */
+ 455, /* (481) pseudo_column ::= QTAGS */
+ 457, /* (482) function_expression ::= function_name NK_LP expression_list NK_RP */
+ 457, /* (483) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ 457, /* (484) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ 457, /* (485) function_expression ::= literal_func */
+ 451, /* (486) literal_func ::= noarg_func NK_LP NK_RP */
+ 451, /* (487) literal_func ::= NOW */
+ 461, /* (488) noarg_func ::= NOW */
+ 461, /* (489) noarg_func ::= TODAY */
+ 461, /* (490) noarg_func ::= TIMEZONE */
+ 461, /* (491) noarg_func ::= DATABASE */
+ 461, /* (492) noarg_func ::= CLIENT_VERSION */
+ 461, /* (493) noarg_func ::= SERVER_VERSION */
+ 461, /* (494) noarg_func ::= SERVER_STATUS */
+ 461, /* (495) noarg_func ::= CURRENT_USER */
+ 461, /* (496) noarg_func ::= USER */
+ 459, /* (497) star_func ::= COUNT */
+ 459, /* (498) star_func ::= FIRST */
+ 459, /* (499) star_func ::= LAST */
+ 459, /* (500) star_func ::= LAST_ROW */
+ 460, /* (501) star_func_para_list ::= NK_STAR */
+ 460, /* (502) star_func_para_list ::= other_para_list */
+ 462, /* (503) other_para_list ::= star_func_para */
+ 462, /* (504) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ 463, /* (505) star_func_para ::= expr_or_subquery */
+ 463, /* (506) star_func_para ::= table_name NK_DOT NK_STAR */
+ 458, /* (507) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ 458, /* (508) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ 464, /* (509) when_then_list ::= when_then_expr */
+ 464, /* (510) when_then_list ::= when_then_list when_then_expr */
+ 467, /* (511) when_then_expr ::= WHEN common_expression THEN common_expression */
+ 465, /* (512) case_when_else_opt ::= */
+ 465, /* (513) case_when_else_opt ::= ELSE common_expression */
+ 468, /* (514) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ 468, /* (515) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ 468, /* (516) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ 468, /* (517) predicate ::= expr_or_subquery IS NULL */
+ 468, /* (518) predicate ::= expr_or_subquery IS NOT NULL */
+ 468, /* (519) predicate ::= expr_or_subquery in_op in_predicate_value */
+ 469, /* (520) compare_op ::= NK_LT */
+ 469, /* (521) compare_op ::= NK_GT */
+ 469, /* (522) compare_op ::= NK_LE */
+ 469, /* (523) compare_op ::= NK_GE */
+ 469, /* (524) compare_op ::= NK_NE */
+ 469, /* (525) compare_op ::= NK_EQ */
+ 469, /* (526) compare_op ::= LIKE */
+ 469, /* (527) compare_op ::= NOT LIKE */
+ 469, /* (528) compare_op ::= MATCH */
+ 469, /* (529) compare_op ::= NMATCH */
+ 469, /* (530) compare_op ::= CONTAINS */
+ 470, /* (531) in_op ::= IN */
+ 470, /* (532) in_op ::= NOT IN */
+ 471, /* (533) in_predicate_value ::= NK_LP literal_list NK_RP */
+ 472, /* (534) boolean_value_expression ::= boolean_primary */
+ 472, /* (535) boolean_value_expression ::= NOT boolean_primary */
+ 472, /* (536) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ 472, /* (537) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ 473, /* (538) boolean_primary ::= predicate */
+ 473, /* (539) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ 466, /* (540) common_expression ::= expr_or_subquery */
+ 466, /* (541) common_expression ::= boolean_value_expression */
+ 474, /* (542) from_clause_opt ::= */
+ 474, /* (543) from_clause_opt ::= FROM table_reference_list */
+ 475, /* (544) table_reference_list ::= table_reference */
+ 475, /* (545) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ 476, /* (546) table_reference ::= table_primary */
+ 476, /* (547) table_reference ::= joined_table */
+ 477, /* (548) table_primary ::= table_name alias_opt */
+ 477, /* (549) table_primary ::= db_name NK_DOT table_name alias_opt */
+ 477, /* (550) table_primary ::= subquery alias_opt */
+ 477, /* (551) table_primary ::= parenthesized_joined_table */
+ 479, /* (552) alias_opt ::= */
+ 479, /* (553) alias_opt ::= table_alias */
+ 479, /* (554) alias_opt ::= AS table_alias */
+ 481, /* (555) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ 481, /* (556) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ 478, /* (557) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ 482, /* (558) join_type ::= */
+ 482, /* (559) join_type ::= INNER */
+ 483, /* (560) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ 484, /* (561) hint_list ::= */
+ 484, /* (562) hint_list ::= NK_HINT */
+ 486, /* (563) tag_mode_opt ::= */
+ 486, /* (564) tag_mode_opt ::= TAGS */
+ 485, /* (565) set_quantifier_opt ::= */
+ 485, /* (566) set_quantifier_opt ::= DISTINCT */
+ 485, /* (567) set_quantifier_opt ::= ALL */
+ 487, /* (568) select_list ::= select_item */
+ 487, /* (569) select_list ::= select_list NK_COMMA select_item */
+ 495, /* (570) select_item ::= NK_STAR */
+ 495, /* (571) select_item ::= common_expression */
+ 495, /* (572) select_item ::= common_expression column_alias */
+ 495, /* (573) select_item ::= common_expression AS column_alias */
+ 495, /* (574) select_item ::= table_name NK_DOT NK_STAR */
+ 431, /* (575) where_clause_opt ::= */
+ 431, /* (576) where_clause_opt ::= WHERE search_condition */
+ 488, /* (577) partition_by_clause_opt ::= */
+ 488, /* (578) partition_by_clause_opt ::= PARTITION BY partition_list */
+ 496, /* (579) partition_list ::= partition_item */
+ 496, /* (580) partition_list ::= partition_list NK_COMMA partition_item */
+ 497, /* (581) partition_item ::= expr_or_subquery */
+ 497, /* (582) partition_item ::= expr_or_subquery column_alias */
+ 497, /* (583) partition_item ::= expr_or_subquery AS column_alias */
+ 492, /* (584) twindow_clause_opt ::= */
+ 492, /* (585) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+ 492, /* (586) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ 492, /* (587) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ 492, /* (588) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ 492, /* (589) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ 492, /* (590) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ 492, /* (591) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 425, /* (592) sliding_opt ::= */
+ 425, /* (593) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
+ 498, /* (594) interval_sliding_duration_literal ::= NK_VARIABLE */
+ 498, /* (595) interval_sliding_duration_literal ::= NK_STRING */
+ 498, /* (596) interval_sliding_duration_literal ::= NK_INTEGER */
+ 491, /* (597) fill_opt ::= */
+ 491, /* (598) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ 491, /* (599) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ 491, /* (600) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ 499, /* (601) fill_mode ::= NONE */
+ 499, /* (602) fill_mode ::= PREV */
+ 499, /* (603) fill_mode ::= NULL */
+ 499, /* (604) fill_mode ::= NULL_F */
+ 499, /* (605) fill_mode ::= LINEAR */
+ 499, /* (606) fill_mode ::= NEXT */
+ 493, /* (607) group_by_clause_opt ::= */
+ 493, /* (608) group_by_clause_opt ::= GROUP BY group_by_list */
+ 500, /* (609) group_by_list ::= expr_or_subquery */
+ 500, /* (610) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ 494, /* (611) having_clause_opt ::= */
+ 494, /* (612) having_clause_opt ::= HAVING search_condition */
+ 489, /* (613) range_opt ::= */
+ 489, /* (614) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ 489, /* (615) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ 490, /* (616) every_opt ::= */
+ 490, /* (617) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ 501, /* (618) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ 502, /* (619) query_simple ::= query_specification */
+ 502, /* (620) query_simple ::= union_query_expression */
+ 506, /* (621) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ 506, /* (622) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ 507, /* (623) query_simple_or_subquery ::= query_simple */
+ 507, /* (624) query_simple_or_subquery ::= subquery */
+ 430, /* (625) query_or_subquery ::= query_expression */
+ 430, /* (626) query_or_subquery ::= subquery */
+ 503, /* (627) order_by_clause_opt ::= */
+ 503, /* (628) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ 504, /* (629) slimit_clause_opt ::= */
+ 504, /* (630) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ 504, /* (631) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ 504, /* (632) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 505, /* (633) limit_clause_opt ::= */
+ 505, /* (634) limit_clause_opt ::= LIMIT NK_INTEGER */
+ 505, /* (635) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ 505, /* (636) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 480, /* (637) subquery ::= NK_LP query_expression NK_RP */
+ 480, /* (638) subquery ::= NK_LP subquery NK_RP */
+ 369, /* (639) search_condition ::= common_expression */
+ 508, /* (640) sort_specification_list ::= sort_specification */
+ 508, /* (641) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ 509, /* (642) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ 510, /* (643) ordering_specification_opt ::= */
+ 510, /* (644) ordering_specification_opt ::= ASC */
+ 510, /* (645) ordering_specification_opt ::= DESC */
+ 511, /* (646) null_ordering_opt ::= */
+ 511, /* (647) null_ordering_opt ::= NULLS FIRST */
+ 511, /* (648) null_ordering_opt ::= NULLS LAST */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
@@ -4553,487 +4521,479 @@ static const signed char yyRuleInfoNRhs[] = {
-5, /* (173) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-4, /* (174) alter_table_clause ::= full_table_name DROP COLUMN column_name */
-5, /* (175) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- -5, /* (176) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
- -5, /* (177) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- -5, /* (178) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- -4, /* (179) alter_table_clause ::= full_table_name DROP TAG column_name */
- -5, /* (180) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- -5, /* (181) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- -6, /* (182) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
- -1, /* (183) multi_create_clause ::= create_subtable_clause */
- -2, /* (184) multi_create_clause ::= multi_create_clause create_subtable_clause */
- -10, /* (185) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
- -1, /* (186) multi_drop_clause ::= drop_table_clause */
- -3, /* (187) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
- -2, /* (188) drop_table_clause ::= exists_opt full_table_name */
- 0, /* (189) specific_cols_opt ::= */
- -3, /* (190) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- -1, /* (191) full_table_name ::= table_name */
- -3, /* (192) full_table_name ::= db_name NK_DOT table_name */
- -1, /* (193) tag_def_list ::= tag_def */
- -3, /* (194) tag_def_list ::= tag_def_list NK_COMMA tag_def */
- -2, /* (195) tag_def ::= column_name type_name */
- -1, /* (196) column_def_list ::= column_def */
- -3, /* (197) column_def_list ::= column_def_list NK_COMMA column_def */
- -3, /* (198) column_def ::= column_name type_name column_options */
- -1, /* (199) type_name ::= BOOL */
- -1, /* (200) type_name ::= TINYINT */
- -1, /* (201) type_name ::= SMALLINT */
- -1, /* (202) type_name ::= INT */
- -1, /* (203) type_name ::= INTEGER */
- -1, /* (204) type_name ::= BIGINT */
- -1, /* (205) type_name ::= FLOAT */
- -1, /* (206) type_name ::= DOUBLE */
- -4, /* (207) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- -1, /* (208) type_name ::= TIMESTAMP */
- -4, /* (209) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- -2, /* (210) type_name ::= TINYINT UNSIGNED */
- -2, /* (211) type_name ::= SMALLINT UNSIGNED */
- -2, /* (212) type_name ::= INT UNSIGNED */
- -2, /* (213) type_name ::= BIGINT UNSIGNED */
- -1, /* (214) type_name ::= JSON */
- -4, /* (215) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- -1, /* (216) type_name ::= MEDIUMBLOB */
- -1, /* (217) type_name ::= BLOB */
- -4, /* (218) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- -4, /* (219) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
- -1, /* (220) type_name ::= DECIMAL */
- -4, /* (221) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- -6, /* (222) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 0, /* (223) tags_def_opt ::= */
- -1, /* (224) tags_def_opt ::= tags_def */
- -4, /* (225) tags_def ::= TAGS NK_LP tag_def_list NK_RP */
- 0, /* (226) table_options ::= */
- -3, /* (227) table_options ::= table_options COMMENT NK_STRING */
- -3, /* (228) table_options ::= table_options MAX_DELAY duration_list */
- -3, /* (229) table_options ::= table_options WATERMARK duration_list */
- -5, /* (230) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- -3, /* (231) table_options ::= table_options TTL NK_INTEGER */
- -5, /* (232) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- -3, /* (233) table_options ::= table_options DELETE_MARK duration_list */
- -1, /* (234) alter_table_options ::= alter_table_option */
- -2, /* (235) alter_table_options ::= alter_table_options alter_table_option */
- -2, /* (236) alter_table_option ::= COMMENT NK_STRING */
- -2, /* (237) alter_table_option ::= TTL NK_INTEGER */
- -1, /* (238) duration_list ::= duration_literal */
- -3, /* (239) duration_list ::= duration_list NK_COMMA duration_literal */
- -1, /* (240) rollup_func_list ::= rollup_func_name */
- -3, /* (241) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- -1, /* (242) rollup_func_name ::= function_name */
- -1, /* (243) rollup_func_name ::= FIRST */
- -1, /* (244) rollup_func_name ::= LAST */
- -1, /* (245) col_name_list ::= col_name */
- -3, /* (246) col_name_list ::= col_name_list NK_COMMA col_name */
- -1, /* (247) col_name ::= column_name */
- -2, /* (248) cmd ::= SHOW DNODES */
- -2, /* (249) cmd ::= SHOW USERS */
- -3, /* (250) cmd ::= SHOW USER PRIVILEGES */
- -3, /* (251) cmd ::= SHOW db_kind_opt DATABASES */
- -4, /* (252) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
- -4, /* (253) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- -3, /* (254) cmd ::= SHOW db_name_cond_opt VGROUPS */
- -2, /* (255) cmd ::= SHOW MNODES */
- -2, /* (256) cmd ::= SHOW QNODES */
- -2, /* (257) cmd ::= SHOW FUNCTIONS */
- -5, /* (258) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- -6, /* (259) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
- -2, /* (260) cmd ::= SHOW STREAMS */
- -2, /* (261) cmd ::= SHOW ACCOUNTS */
- -2, /* (262) cmd ::= SHOW APPS */
- -2, /* (263) cmd ::= SHOW CONNECTIONS */
- -2, /* (264) cmd ::= SHOW LICENCES */
- -2, /* (265) cmd ::= SHOW GRANTS */
- -3, /* (266) cmd ::= SHOW GRANTS FULL */
- -3, /* (267) cmd ::= SHOW GRANTS LOGS */
- -3, /* (268) cmd ::= SHOW CLUSTER MACHINES */
- -4, /* (269) cmd ::= SHOW CREATE DATABASE db_name */
- -4, /* (270) cmd ::= SHOW CREATE TABLE full_table_name */
- -4, /* (271) cmd ::= SHOW CREATE STABLE full_table_name */
- -2, /* (272) cmd ::= SHOW QUERIES */
- -2, /* (273) cmd ::= SHOW SCORES */
- -2, /* (274) cmd ::= SHOW TOPICS */
- -2, /* (275) cmd ::= SHOW VARIABLES */
- -3, /* (276) cmd ::= SHOW CLUSTER VARIABLES */
- -3, /* (277) cmd ::= SHOW LOCAL VARIABLES */
- -5, /* (278) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- -2, /* (279) cmd ::= SHOW BNODES */
- -2, /* (280) cmd ::= SHOW SNODES */
- -2, /* (281) cmd ::= SHOW CLUSTER */
- -2, /* (282) cmd ::= SHOW TRANSACTIONS */
- -4, /* (283) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- -2, /* (284) cmd ::= SHOW CONSUMERS */
- -2, /* (285) cmd ::= SHOW SUBSCRIPTIONS */
- -5, /* (286) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- -6, /* (287) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
- -7, /* (288) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
- -8, /* (289) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
- -5, /* (290) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
- -2, /* (291) cmd ::= SHOW VNODES */
- -3, /* (292) cmd ::= SHOW db_name_cond_opt ALIVE */
- -3, /* (293) cmd ::= SHOW CLUSTER ALIVE */
- -4, /* (294) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
- -4, /* (295) cmd ::= SHOW CREATE VIEW full_table_name */
- -2, /* (296) cmd ::= SHOW COMPACTS */
- -3, /* (297) cmd ::= SHOW COMPACT NK_INTEGER */
- 0, /* (298) table_kind_db_name_cond_opt ::= */
- -1, /* (299) table_kind_db_name_cond_opt ::= table_kind */
- -2, /* (300) table_kind_db_name_cond_opt ::= db_name NK_DOT */
- -3, /* (301) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
- -1, /* (302) table_kind ::= NORMAL */
- -1, /* (303) table_kind ::= CHILD */
- 0, /* (304) db_name_cond_opt ::= */
- -2, /* (305) db_name_cond_opt ::= db_name NK_DOT */
- 0, /* (306) like_pattern_opt ::= */
- -2, /* (307) like_pattern_opt ::= LIKE NK_STRING */
- -1, /* (308) table_name_cond ::= table_name */
- 0, /* (309) from_db_opt ::= */
- -2, /* (310) from_db_opt ::= FROM db_name */
- 0, /* (311) tag_list_opt ::= */
- -1, /* (312) tag_list_opt ::= tag_item */
- -3, /* (313) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
- -1, /* (314) tag_item ::= TBNAME */
- -1, /* (315) tag_item ::= QTAGS */
- -1, /* (316) tag_item ::= column_name */
- -2, /* (317) tag_item ::= column_name column_alias */
- -3, /* (318) tag_item ::= column_name AS column_alias */
- 0, /* (319) db_kind_opt ::= */
- -1, /* (320) db_kind_opt ::= USER */
- -1, /* (321) db_kind_opt ::= SYSTEM */
- -8, /* (322) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
- -9, /* (323) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
- -4, /* (324) cmd ::= DROP INDEX exists_opt full_index_name */
- -1, /* (325) full_index_name ::= index_name */
- -3, /* (326) full_index_name ::= db_name NK_DOT index_name */
- -10, /* (327) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- -12, /* (328) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
- -1, /* (329) func_list ::= func */
- -3, /* (330) func_list ::= func_list NK_COMMA func */
- -4, /* (331) func ::= sma_func_name NK_LP expression_list NK_RP */
- -1, /* (332) sma_func_name ::= function_name */
- -1, /* (333) sma_func_name ::= COUNT */
- -1, /* (334) sma_func_name ::= FIRST */
- -1, /* (335) sma_func_name ::= LAST */
- -1, /* (336) sma_func_name ::= LAST_ROW */
- 0, /* (337) sma_stream_opt ::= */
- -3, /* (338) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- -3, /* (339) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
- -3, /* (340) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
- -1, /* (341) with_meta ::= AS */
- -3, /* (342) with_meta ::= WITH META AS */
- -3, /* (343) with_meta ::= ONLY META AS */
- -6, /* (344) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- -7, /* (345) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
- -8, /* (346) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
- -4, /* (347) cmd ::= DROP TOPIC exists_opt topic_name */
- -7, /* (348) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- -2, /* (349) cmd ::= DESC full_table_name */
- -2, /* (350) cmd ::= DESCRIBE full_table_name */
- -3, /* (351) cmd ::= RESET QUERY CACHE */
- -4, /* (352) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- -4, /* (353) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
- 0, /* (354) analyze_opt ::= */
- -1, /* (355) analyze_opt ::= ANALYZE */
- 0, /* (356) explain_options ::= */
- -3, /* (357) explain_options ::= explain_options VERBOSE NK_BOOL */
- -3, /* (358) explain_options ::= explain_options RATIO NK_FLOAT */
- -12, /* (359) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
- -4, /* (360) cmd ::= DROP FUNCTION exists_opt function_name */
- 0, /* (361) agg_func_opt ::= */
- -1, /* (362) agg_func_opt ::= AGGREGATE */
- 0, /* (363) bufsize_opt ::= */
- -2, /* (364) bufsize_opt ::= BUFSIZE NK_INTEGER */
- 0, /* (365) language_opt ::= */
- -2, /* (366) language_opt ::= LANGUAGE NK_STRING */
- 0, /* (367) or_replace_opt ::= */
- -2, /* (368) or_replace_opt ::= OR REPLACE */
- -6, /* (369) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
- -4, /* (370) cmd ::= DROP VIEW exists_opt full_view_name */
- -1, /* (371) full_view_name ::= view_name */
- -3, /* (372) full_view_name ::= db_name NK_DOT view_name */
- -12, /* (373) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
- -4, /* (374) cmd ::= DROP STREAM exists_opt stream_name */
- -4, /* (375) cmd ::= PAUSE STREAM exists_opt stream_name */
- -5, /* (376) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
- 0, /* (377) col_list_opt ::= */
- -3, /* (378) col_list_opt ::= NK_LP col_name_list NK_RP */
- 0, /* (379) tag_def_or_ref_opt ::= */
- -1, /* (380) tag_def_or_ref_opt ::= tags_def */
- -4, /* (381) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
- 0, /* (382) stream_options ::= */
- -3, /* (383) stream_options ::= stream_options TRIGGER AT_ONCE */
- -3, /* (384) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- -4, /* (385) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- -3, /* (386) stream_options ::= stream_options WATERMARK duration_literal */
- -4, /* (387) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- -3, /* (388) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- -3, /* (389) stream_options ::= stream_options DELETE_MARK duration_literal */
- -4, /* (390) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
- 0, /* (391) subtable_opt ::= */
- -4, /* (392) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- 0, /* (393) ignore_opt ::= */
- -2, /* (394) ignore_opt ::= IGNORE UNTREATED */
- -3, /* (395) cmd ::= KILL CONNECTION NK_INTEGER */
- -3, /* (396) cmd ::= KILL QUERY NK_STRING */
- -3, /* (397) cmd ::= KILL TRANSACTION NK_INTEGER */
- -3, /* (398) cmd ::= KILL COMPACT NK_INTEGER */
- -2, /* (399) cmd ::= BALANCE VGROUP */
- -4, /* (400) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
- -4, /* (401) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- -4, /* (402) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- -3, /* (403) cmd ::= SPLIT VGROUP NK_INTEGER */
- 0, /* (404) on_vgroup_id ::= */
- -2, /* (405) on_vgroup_id ::= ON NK_INTEGER */
- -2, /* (406) dnode_list ::= DNODE NK_INTEGER */
- -3, /* (407) dnode_list ::= dnode_list DNODE NK_INTEGER */
- -4, /* (408) cmd ::= DELETE FROM full_table_name where_clause_opt */
- -1, /* (409) cmd ::= query_or_subquery */
- -1, /* (410) cmd ::= insert_query */
- -7, /* (411) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- -4, /* (412) insert_query ::= INSERT INTO full_table_name query_or_subquery */
- -1, /* (413) literal ::= NK_INTEGER */
- -1, /* (414) literal ::= NK_FLOAT */
- -1, /* (415) literal ::= NK_STRING */
- -1, /* (416) literal ::= NK_BOOL */
- -2, /* (417) literal ::= TIMESTAMP NK_STRING */
- -1, /* (418) literal ::= duration_literal */
- -1, /* (419) literal ::= NULL */
- -1, /* (420) literal ::= NK_QUESTION */
- -1, /* (421) duration_literal ::= NK_VARIABLE */
- -1, /* (422) signed ::= NK_INTEGER */
- -2, /* (423) signed ::= NK_PLUS NK_INTEGER */
- -2, /* (424) signed ::= NK_MINUS NK_INTEGER */
- -1, /* (425) signed ::= NK_FLOAT */
- -2, /* (426) signed ::= NK_PLUS NK_FLOAT */
- -2, /* (427) signed ::= NK_MINUS NK_FLOAT */
- -1, /* (428) signed_literal ::= signed */
- -1, /* (429) signed_literal ::= NK_STRING */
- -1, /* (430) signed_literal ::= NK_BOOL */
- -2, /* (431) signed_literal ::= TIMESTAMP NK_STRING */
- -1, /* (432) signed_literal ::= duration_literal */
- -1, /* (433) signed_literal ::= NULL */
- -1, /* (434) signed_literal ::= literal_func */
- -1, /* (435) signed_literal ::= NK_QUESTION */
- -1, /* (436) literal_list ::= signed_literal */
- -3, /* (437) literal_list ::= literal_list NK_COMMA signed_literal */
- -1, /* (438) db_name ::= NK_ID */
- -1, /* (439) table_name ::= NK_ID */
- -1, /* (440) column_name ::= NK_ID */
- -1, /* (441) function_name ::= NK_ID */
- -1, /* (442) view_name ::= NK_ID */
- -1, /* (443) table_alias ::= NK_ID */
- -1, /* (444) column_alias ::= NK_ID */
- -1, /* (445) column_alias ::= NK_ALIAS */
- -1, /* (446) user_name ::= NK_ID */
- -1, /* (447) topic_name ::= NK_ID */
- -1, /* (448) stream_name ::= NK_ID */
- -1, /* (449) cgroup_name ::= NK_ID */
- -1, /* (450) index_name ::= NK_ID */
- -1, /* (451) expr_or_subquery ::= expression */
- -1, /* (452) expression ::= literal */
- -1, /* (453) expression ::= pseudo_column */
- -1, /* (454) expression ::= column_reference */
- -1, /* (455) expression ::= function_expression */
- -1, /* (456) expression ::= case_when_expression */
- -3, /* (457) expression ::= NK_LP expression NK_RP */
- -2, /* (458) expression ::= NK_PLUS expr_or_subquery */
- -2, /* (459) expression ::= NK_MINUS expr_or_subquery */
- -3, /* (460) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- -3, /* (461) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- -3, /* (462) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- -3, /* (463) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- -3, /* (464) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- -3, /* (465) expression ::= column_reference NK_ARROW NK_STRING */
- -3, /* (466) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- -3, /* (467) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- -1, /* (468) expression_list ::= expr_or_subquery */
- -3, /* (469) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- -1, /* (470) column_reference ::= column_name */
- -3, /* (471) column_reference ::= table_name NK_DOT column_name */
- -1, /* (472) column_reference ::= NK_ALIAS */
- -3, /* (473) column_reference ::= table_name NK_DOT NK_ALIAS */
- -1, /* (474) pseudo_column ::= ROWTS */
- -1, /* (475) pseudo_column ::= TBNAME */
- -3, /* (476) pseudo_column ::= table_name NK_DOT TBNAME */
- -1, /* (477) pseudo_column ::= QSTART */
- -1, /* (478) pseudo_column ::= QEND */
- -1, /* (479) pseudo_column ::= QDURATION */
- -1, /* (480) pseudo_column ::= WSTART */
- -1, /* (481) pseudo_column ::= WEND */
- -1, /* (482) pseudo_column ::= WDURATION */
- -1, /* (483) pseudo_column ::= IROWTS */
- -1, /* (484) pseudo_column ::= ISFILLED */
- -1, /* (485) pseudo_column ::= QTAGS */
- -4, /* (486) function_expression ::= function_name NK_LP expression_list NK_RP */
- -4, /* (487) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- -6, /* (488) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- -1, /* (489) function_expression ::= literal_func */
- -3, /* (490) literal_func ::= noarg_func NK_LP NK_RP */
- -1, /* (491) literal_func ::= NOW */
- -1, /* (492) noarg_func ::= NOW */
- -1, /* (493) noarg_func ::= TODAY */
- -1, /* (494) noarg_func ::= TIMEZONE */
- -1, /* (495) noarg_func ::= DATABASE */
- -1, /* (496) noarg_func ::= CLIENT_VERSION */
- -1, /* (497) noarg_func ::= SERVER_VERSION */
- -1, /* (498) noarg_func ::= SERVER_STATUS */
- -1, /* (499) noarg_func ::= CURRENT_USER */
- -1, /* (500) noarg_func ::= USER */
- -1, /* (501) star_func ::= COUNT */
- -1, /* (502) star_func ::= FIRST */
- -1, /* (503) star_func ::= LAST */
- -1, /* (504) star_func ::= LAST_ROW */
- -1, /* (505) star_func_para_list ::= NK_STAR */
- -1, /* (506) star_func_para_list ::= other_para_list */
- -1, /* (507) other_para_list ::= star_func_para */
- -3, /* (508) other_para_list ::= other_para_list NK_COMMA star_func_para */
- -1, /* (509) star_func_para ::= expr_or_subquery */
- -3, /* (510) star_func_para ::= table_name NK_DOT NK_STAR */
- -4, /* (511) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- -5, /* (512) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- -1, /* (513) when_then_list ::= when_then_expr */
- -2, /* (514) when_then_list ::= when_then_list when_then_expr */
- -4, /* (515) when_then_expr ::= WHEN common_expression THEN common_expression */
- 0, /* (516) case_when_else_opt ::= */
- -2, /* (517) case_when_else_opt ::= ELSE common_expression */
- -3, /* (518) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- -5, /* (519) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- -6, /* (520) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- -3, /* (521) predicate ::= expr_or_subquery IS NULL */
- -4, /* (522) predicate ::= expr_or_subquery IS NOT NULL */
- -3, /* (523) predicate ::= expr_or_subquery in_op in_predicate_value */
- -1, /* (524) compare_op ::= NK_LT */
- -1, /* (525) compare_op ::= NK_GT */
- -1, /* (526) compare_op ::= NK_LE */
- -1, /* (527) compare_op ::= NK_GE */
- -1, /* (528) compare_op ::= NK_NE */
- -1, /* (529) compare_op ::= NK_EQ */
- -1, /* (530) compare_op ::= LIKE */
- -2, /* (531) compare_op ::= NOT LIKE */
- -1, /* (532) compare_op ::= MATCH */
- -1, /* (533) compare_op ::= NMATCH */
- -1, /* (534) compare_op ::= CONTAINS */
- -1, /* (535) in_op ::= IN */
- -2, /* (536) in_op ::= NOT IN */
- -3, /* (537) in_predicate_value ::= NK_LP literal_list NK_RP */
- -1, /* (538) boolean_value_expression ::= boolean_primary */
- -2, /* (539) boolean_value_expression ::= NOT boolean_primary */
- -3, /* (540) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- -3, /* (541) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- -1, /* (542) boolean_primary ::= predicate */
- -3, /* (543) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- -1, /* (544) common_expression ::= expr_or_subquery */
- -1, /* (545) common_expression ::= boolean_value_expression */
- 0, /* (546) from_clause_opt ::= */
- -2, /* (547) from_clause_opt ::= FROM table_reference_list */
- -1, /* (548) table_reference_list ::= table_reference */
- -3, /* (549) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- -1, /* (550) table_reference ::= table_primary */
- -1, /* (551) table_reference ::= joined_table */
- -2, /* (552) table_primary ::= table_name alias_opt */
- -4, /* (553) table_primary ::= db_name NK_DOT table_name alias_opt */
- -2, /* (554) table_primary ::= subquery alias_opt */
- -1, /* (555) table_primary ::= parenthesized_joined_table */
- 0, /* (556) alias_opt ::= */
- -1, /* (557) alias_opt ::= table_alias */
- -2, /* (558) alias_opt ::= AS table_alias */
- -3, /* (559) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- -3, /* (560) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- -6, /* (561) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- 0, /* (562) join_type ::= */
- -1, /* (563) join_type ::= INNER */
- -14, /* (564) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
- 0, /* (565) hint_list ::= */
- -1, /* (566) hint_list ::= NK_HINT */
- 0, /* (567) tag_mode_opt ::= */
- -1, /* (568) tag_mode_opt ::= TAGS */
- 0, /* (569) set_quantifier_opt ::= */
- -1, /* (570) set_quantifier_opt ::= DISTINCT */
- -1, /* (571) set_quantifier_opt ::= ALL */
- -1, /* (572) select_list ::= select_item */
- -3, /* (573) select_list ::= select_list NK_COMMA select_item */
- -1, /* (574) select_item ::= NK_STAR */
- -1, /* (575) select_item ::= common_expression */
- -2, /* (576) select_item ::= common_expression column_alias */
- -3, /* (577) select_item ::= common_expression AS column_alias */
- -3, /* (578) select_item ::= table_name NK_DOT NK_STAR */
- 0, /* (579) where_clause_opt ::= */
- -2, /* (580) where_clause_opt ::= WHERE search_condition */
- 0, /* (581) partition_by_clause_opt ::= */
- -3, /* (582) partition_by_clause_opt ::= PARTITION BY partition_list */
- -1, /* (583) partition_list ::= partition_item */
- -3, /* (584) partition_list ::= partition_list NK_COMMA partition_item */
- -1, /* (585) partition_item ::= expr_or_subquery */
- -2, /* (586) partition_item ::= expr_or_subquery column_alias */
- -3, /* (587) partition_item ::= expr_or_subquery AS column_alias */
- 0, /* (588) twindow_clause_opt ::= */
- -6, /* (589) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
- -4, /* (590) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- -6, /* (591) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- -8, /* (592) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- -7, /* (593) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- -4, /* (594) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
- -6, /* (595) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 0, /* (596) sliding_opt ::= */
- -4, /* (597) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
- -1, /* (598) interval_sliding_duration_literal ::= NK_VARIABLE */
- -1, /* (599) interval_sliding_duration_literal ::= NK_STRING */
- -1, /* (600) interval_sliding_duration_literal ::= NK_INTEGER */
- 0, /* (601) fill_opt ::= */
- -4, /* (602) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- -6, /* (603) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
- -6, /* (604) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
- -1, /* (605) fill_mode ::= NONE */
- -1, /* (606) fill_mode ::= PREV */
- -1, /* (607) fill_mode ::= NULL */
- -1, /* (608) fill_mode ::= NULL_F */
- -1, /* (609) fill_mode ::= LINEAR */
- -1, /* (610) fill_mode ::= NEXT */
- 0, /* (611) group_by_clause_opt ::= */
- -3, /* (612) group_by_clause_opt ::= GROUP BY group_by_list */
- -1, /* (613) group_by_list ::= expr_or_subquery */
- -3, /* (614) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- 0, /* (615) having_clause_opt ::= */
- -2, /* (616) having_clause_opt ::= HAVING search_condition */
- 0, /* (617) range_opt ::= */
- -6, /* (618) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- -4, /* (619) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
- 0, /* (620) every_opt ::= */
- -4, /* (621) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- -4, /* (622) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- -1, /* (623) query_simple ::= query_specification */
- -1, /* (624) query_simple ::= union_query_expression */
- -4, /* (625) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- -3, /* (626) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- -1, /* (627) query_simple_or_subquery ::= query_simple */
- -1, /* (628) query_simple_or_subquery ::= subquery */
- -1, /* (629) query_or_subquery ::= query_expression */
- -1, /* (630) query_or_subquery ::= subquery */
- 0, /* (631) order_by_clause_opt ::= */
- -3, /* (632) order_by_clause_opt ::= ORDER BY sort_specification_list */
- 0, /* (633) slimit_clause_opt ::= */
- -2, /* (634) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- -4, /* (635) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- -4, /* (636) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 0, /* (637) limit_clause_opt ::= */
- -2, /* (638) limit_clause_opt ::= LIMIT NK_INTEGER */
- -4, /* (639) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- -4, /* (640) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- -3, /* (641) subquery ::= NK_LP query_expression NK_RP */
- -3, /* (642) subquery ::= NK_LP subquery NK_RP */
- -1, /* (643) search_condition ::= common_expression */
- -1, /* (644) sort_specification_list ::= sort_specification */
- -3, /* (645) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- -3, /* (646) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- 0, /* (647) ordering_specification_opt ::= */
- -1, /* (648) ordering_specification_opt ::= ASC */
- -1, /* (649) ordering_specification_opt ::= DESC */
- 0, /* (650) null_ordering_opt ::= */
- -2, /* (651) null_ordering_opt ::= NULLS FIRST */
- -2, /* (652) null_ordering_opt ::= NULLS LAST */
- 0, /* (653) column_options ::= */
- -3, /* (654) column_options ::= column_options ENCODE NK_STRING */
- -3, /* (655) column_options ::= column_options COMPRESS NK_STRING */
- -3, /* (656) column_options ::= column_options LEVEL NK_STRING */
+ -5, /* (176) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ -5, /* (177) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ -4, /* (178) alter_table_clause ::= full_table_name DROP TAG column_name */
+ -5, /* (179) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ -5, /* (180) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ -6, /* (181) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ -1, /* (182) multi_create_clause ::= create_subtable_clause */
+ -2, /* (183) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ -10, /* (184) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
+ -1, /* (185) multi_drop_clause ::= drop_table_clause */
+ -3, /* (186) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
+ -2, /* (187) drop_table_clause ::= exists_opt full_table_name */
+ 0, /* (188) specific_cols_opt ::= */
+ -3, /* (189) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ -1, /* (190) full_table_name ::= table_name */
+ -3, /* (191) full_table_name ::= db_name NK_DOT table_name */
+ -1, /* (192) column_def_list ::= column_def */
+ -3, /* (193) column_def_list ::= column_def_list NK_COMMA column_def */
+ -2, /* (194) column_def ::= column_name type_name */
+ -1, /* (195) type_name ::= BOOL */
+ -1, /* (196) type_name ::= TINYINT */
+ -1, /* (197) type_name ::= SMALLINT */
+ -1, /* (198) type_name ::= INT */
+ -1, /* (199) type_name ::= INTEGER */
+ -1, /* (200) type_name ::= BIGINT */
+ -1, /* (201) type_name ::= FLOAT */
+ -1, /* (202) type_name ::= DOUBLE */
+ -4, /* (203) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ -1, /* (204) type_name ::= TIMESTAMP */
+ -4, /* (205) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ -2, /* (206) type_name ::= TINYINT UNSIGNED */
+ -2, /* (207) type_name ::= SMALLINT UNSIGNED */
+ -2, /* (208) type_name ::= INT UNSIGNED */
+ -2, /* (209) type_name ::= BIGINT UNSIGNED */
+ -1, /* (210) type_name ::= JSON */
+ -4, /* (211) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ -1, /* (212) type_name ::= MEDIUMBLOB */
+ -1, /* (213) type_name ::= BLOB */
+ -4, /* (214) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ -4, /* (215) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+ -1, /* (216) type_name ::= DECIMAL */
+ -4, /* (217) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ -6, /* (218) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 0, /* (219) tags_def_opt ::= */
+ -1, /* (220) tags_def_opt ::= tags_def */
+ -4, /* (221) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ 0, /* (222) table_options ::= */
+ -3, /* (223) table_options ::= table_options COMMENT NK_STRING */
+ -3, /* (224) table_options ::= table_options MAX_DELAY duration_list */
+ -3, /* (225) table_options ::= table_options WATERMARK duration_list */
+ -5, /* (226) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ -3, /* (227) table_options ::= table_options TTL NK_INTEGER */
+ -5, /* (228) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ -3, /* (229) table_options ::= table_options DELETE_MARK duration_list */
+ -1, /* (230) alter_table_options ::= alter_table_option */
+ -2, /* (231) alter_table_options ::= alter_table_options alter_table_option */
+ -2, /* (232) alter_table_option ::= COMMENT NK_STRING */
+ -2, /* (233) alter_table_option ::= TTL NK_INTEGER */
+ -1, /* (234) duration_list ::= duration_literal */
+ -3, /* (235) duration_list ::= duration_list NK_COMMA duration_literal */
+ -1, /* (236) rollup_func_list ::= rollup_func_name */
+ -3, /* (237) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ -1, /* (238) rollup_func_name ::= function_name */
+ -1, /* (239) rollup_func_name ::= FIRST */
+ -1, /* (240) rollup_func_name ::= LAST */
+ -1, /* (241) col_name_list ::= col_name */
+ -3, /* (242) col_name_list ::= col_name_list NK_COMMA col_name */
+ -1, /* (243) col_name ::= column_name */
+ -2, /* (244) cmd ::= SHOW DNODES */
+ -2, /* (245) cmd ::= SHOW USERS */
+ -3, /* (246) cmd ::= SHOW USER PRIVILEGES */
+ -3, /* (247) cmd ::= SHOW db_kind_opt DATABASES */
+ -4, /* (248) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
+ -4, /* (249) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ -3, /* (250) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ -2, /* (251) cmd ::= SHOW MNODES */
+ -2, /* (252) cmd ::= SHOW QNODES */
+ -2, /* (253) cmd ::= SHOW FUNCTIONS */
+ -5, /* (254) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ -6, /* (255) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+ -2, /* (256) cmd ::= SHOW STREAMS */
+ -2, /* (257) cmd ::= SHOW ACCOUNTS */
+ -2, /* (258) cmd ::= SHOW APPS */
+ -2, /* (259) cmd ::= SHOW CONNECTIONS */
+ -2, /* (260) cmd ::= SHOW LICENCES */
+ -2, /* (261) cmd ::= SHOW GRANTS */
+ -3, /* (262) cmd ::= SHOW GRANTS FULL */
+ -3, /* (263) cmd ::= SHOW GRANTS LOGS */
+ -3, /* (264) cmd ::= SHOW CLUSTER MACHINES */
+ -4, /* (265) cmd ::= SHOW CREATE DATABASE db_name */
+ -4, /* (266) cmd ::= SHOW CREATE TABLE full_table_name */
+ -4, /* (267) cmd ::= SHOW CREATE STABLE full_table_name */
+ -2, /* (268) cmd ::= SHOW QUERIES */
+ -2, /* (269) cmd ::= SHOW SCORES */
+ -2, /* (270) cmd ::= SHOW TOPICS */
+ -2, /* (271) cmd ::= SHOW VARIABLES */
+ -3, /* (272) cmd ::= SHOW CLUSTER VARIABLES */
+ -3, /* (273) cmd ::= SHOW LOCAL VARIABLES */
+ -5, /* (274) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ -2, /* (275) cmd ::= SHOW BNODES */
+ -2, /* (276) cmd ::= SHOW SNODES */
+ -2, /* (277) cmd ::= SHOW CLUSTER */
+ -2, /* (278) cmd ::= SHOW TRANSACTIONS */
+ -4, /* (279) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ -2, /* (280) cmd ::= SHOW CONSUMERS */
+ -2, /* (281) cmd ::= SHOW SUBSCRIPTIONS */
+ -5, /* (282) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ -6, /* (283) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+ -7, /* (284) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+ -8, /* (285) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+ -5, /* (286) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
+ -2, /* (287) cmd ::= SHOW VNODES */
+ -3, /* (288) cmd ::= SHOW db_name_cond_opt ALIVE */
+ -3, /* (289) cmd ::= SHOW CLUSTER ALIVE */
+ -4, /* (290) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+ -4, /* (291) cmd ::= SHOW CREATE VIEW full_table_name */
+ -2, /* (292) cmd ::= SHOW COMPACTS */
+ -3, /* (293) cmd ::= SHOW COMPACT NK_INTEGER */
+ 0, /* (294) table_kind_db_name_cond_opt ::= */
+ -1, /* (295) table_kind_db_name_cond_opt ::= table_kind */
+ -2, /* (296) table_kind_db_name_cond_opt ::= db_name NK_DOT */
+ -3, /* (297) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+ -1, /* (298) table_kind ::= NORMAL */
+ -1, /* (299) table_kind ::= CHILD */
+ 0, /* (300) db_name_cond_opt ::= */
+ -2, /* (301) db_name_cond_opt ::= db_name NK_DOT */
+ 0, /* (302) like_pattern_opt ::= */
+ -2, /* (303) like_pattern_opt ::= LIKE NK_STRING */
+ -1, /* (304) table_name_cond ::= table_name */
+ 0, /* (305) from_db_opt ::= */
+ -2, /* (306) from_db_opt ::= FROM db_name */
+ 0, /* (307) tag_list_opt ::= */
+ -1, /* (308) tag_list_opt ::= tag_item */
+ -3, /* (309) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
+ -1, /* (310) tag_item ::= TBNAME */
+ -1, /* (311) tag_item ::= QTAGS */
+ -1, /* (312) tag_item ::= column_name */
+ -2, /* (313) tag_item ::= column_name column_alias */
+ -3, /* (314) tag_item ::= column_name AS column_alias */
+ 0, /* (315) db_kind_opt ::= */
+ -1, /* (316) db_kind_opt ::= USER */
+ -1, /* (317) db_kind_opt ::= SYSTEM */
+ -8, /* (318) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+ -9, /* (319) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+ -4, /* (320) cmd ::= DROP INDEX exists_opt full_index_name */
+ -1, /* (321) full_index_name ::= index_name */
+ -3, /* (322) full_index_name ::= db_name NK_DOT index_name */
+ -10, /* (323) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ -12, /* (324) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
+ -1, /* (325) func_list ::= func */
+ -3, /* (326) func_list ::= func_list NK_COMMA func */
+ -4, /* (327) func ::= sma_func_name NK_LP expression_list NK_RP */
+ -1, /* (328) sma_func_name ::= function_name */
+ -1, /* (329) sma_func_name ::= COUNT */
+ -1, /* (330) sma_func_name ::= FIRST */
+ -1, /* (331) sma_func_name ::= LAST */
+ -1, /* (332) sma_func_name ::= LAST_ROW */
+ 0, /* (333) sma_stream_opt ::= */
+ -3, /* (334) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+ -3, /* (335) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+ -3, /* (336) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+ -1, /* (337) with_meta ::= AS */
+ -3, /* (338) with_meta ::= WITH META AS */
+ -3, /* (339) with_meta ::= ONLY META AS */
+ -6, /* (340) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ -7, /* (341) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+ -8, /* (342) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+ -4, /* (343) cmd ::= DROP TOPIC exists_opt topic_name */
+ -7, /* (344) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ -2, /* (345) cmd ::= DESC full_table_name */
+ -2, /* (346) cmd ::= DESCRIBE full_table_name */
+ -3, /* (347) cmd ::= RESET QUERY CACHE */
+ -4, /* (348) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ -4, /* (349) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
+ 0, /* (350) analyze_opt ::= */
+ -1, /* (351) analyze_opt ::= ANALYZE */
+ 0, /* (352) explain_options ::= */
+ -3, /* (353) explain_options ::= explain_options VERBOSE NK_BOOL */
+ -3, /* (354) explain_options ::= explain_options RATIO NK_FLOAT */
+ -12, /* (355) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+ -4, /* (356) cmd ::= DROP FUNCTION exists_opt function_name */
+ 0, /* (357) agg_func_opt ::= */
+ -1, /* (358) agg_func_opt ::= AGGREGATE */
+ 0, /* (359) bufsize_opt ::= */
+ -2, /* (360) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ 0, /* (361) language_opt ::= */
+ -2, /* (362) language_opt ::= LANGUAGE NK_STRING */
+ 0, /* (363) or_replace_opt ::= */
+ -2, /* (364) or_replace_opt ::= OR REPLACE */
+ -6, /* (365) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+ -4, /* (366) cmd ::= DROP VIEW exists_opt full_view_name */
+ -1, /* (367) full_view_name ::= view_name */
+ -3, /* (368) full_view_name ::= db_name NK_DOT view_name */
+ -12, /* (369) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+ -4, /* (370) cmd ::= DROP STREAM exists_opt stream_name */
+ -4, /* (371) cmd ::= PAUSE STREAM exists_opt stream_name */
+ -5, /* (372) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+ 0, /* (373) col_list_opt ::= */
+ -3, /* (374) col_list_opt ::= NK_LP col_name_list NK_RP */
+ 0, /* (375) tag_def_or_ref_opt ::= */
+ -1, /* (376) tag_def_or_ref_opt ::= tags_def */
+ -4, /* (377) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
+ 0, /* (378) stream_options ::= */
+ -3, /* (379) stream_options ::= stream_options TRIGGER AT_ONCE */
+ -3, /* (380) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ -4, /* (381) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ -3, /* (382) stream_options ::= stream_options WATERMARK duration_literal */
+ -4, /* (383) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ -3, /* (384) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ -3, /* (385) stream_options ::= stream_options DELETE_MARK duration_literal */
+ -4, /* (386) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+ 0, /* (387) subtable_opt ::= */
+ -4, /* (388) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ 0, /* (389) ignore_opt ::= */
+ -2, /* (390) ignore_opt ::= IGNORE UNTREATED */
+ -3, /* (391) cmd ::= KILL CONNECTION NK_INTEGER */
+ -3, /* (392) cmd ::= KILL QUERY NK_STRING */
+ -3, /* (393) cmd ::= KILL TRANSACTION NK_INTEGER */
+ -3, /* (394) cmd ::= KILL COMPACT NK_INTEGER */
+ -2, /* (395) cmd ::= BALANCE VGROUP */
+ -4, /* (396) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+ -4, /* (397) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ -4, /* (398) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ -3, /* (399) cmd ::= SPLIT VGROUP NK_INTEGER */
+ 0, /* (400) on_vgroup_id ::= */
+ -2, /* (401) on_vgroup_id ::= ON NK_INTEGER */
+ -2, /* (402) dnode_list ::= DNODE NK_INTEGER */
+ -3, /* (403) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ -4, /* (404) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ -1, /* (405) cmd ::= query_or_subquery */
+ -1, /* (406) cmd ::= insert_query */
+ -7, /* (407) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ -4, /* (408) insert_query ::= INSERT INTO full_table_name query_or_subquery */
+ -1, /* (409) literal ::= NK_INTEGER */
+ -1, /* (410) literal ::= NK_FLOAT */
+ -1, /* (411) literal ::= NK_STRING */
+ -1, /* (412) literal ::= NK_BOOL */
+ -2, /* (413) literal ::= TIMESTAMP NK_STRING */
+ -1, /* (414) literal ::= duration_literal */
+ -1, /* (415) literal ::= NULL */
+ -1, /* (416) literal ::= NK_QUESTION */
+ -1, /* (417) duration_literal ::= NK_VARIABLE */
+ -1, /* (418) signed ::= NK_INTEGER */
+ -2, /* (419) signed ::= NK_PLUS NK_INTEGER */
+ -2, /* (420) signed ::= NK_MINUS NK_INTEGER */
+ -1, /* (421) signed ::= NK_FLOAT */
+ -2, /* (422) signed ::= NK_PLUS NK_FLOAT */
+ -2, /* (423) signed ::= NK_MINUS NK_FLOAT */
+ -1, /* (424) signed_literal ::= signed */
+ -1, /* (425) signed_literal ::= NK_STRING */
+ -1, /* (426) signed_literal ::= NK_BOOL */
+ -2, /* (427) signed_literal ::= TIMESTAMP NK_STRING */
+ -1, /* (428) signed_literal ::= duration_literal */
+ -1, /* (429) signed_literal ::= NULL */
+ -1, /* (430) signed_literal ::= literal_func */
+ -1, /* (431) signed_literal ::= NK_QUESTION */
+ -1, /* (432) literal_list ::= signed_literal */
+ -3, /* (433) literal_list ::= literal_list NK_COMMA signed_literal */
+ -1, /* (434) db_name ::= NK_ID */
+ -1, /* (435) table_name ::= NK_ID */
+ -1, /* (436) column_name ::= NK_ID */
+ -1, /* (437) function_name ::= NK_ID */
+ -1, /* (438) view_name ::= NK_ID */
+ -1, /* (439) table_alias ::= NK_ID */
+ -1, /* (440) column_alias ::= NK_ID */
+ -1, /* (441) column_alias ::= NK_ALIAS */
+ -1, /* (442) user_name ::= NK_ID */
+ -1, /* (443) topic_name ::= NK_ID */
+ -1, /* (444) stream_name ::= NK_ID */
+ -1, /* (445) cgroup_name ::= NK_ID */
+ -1, /* (446) index_name ::= NK_ID */
+ -1, /* (447) expr_or_subquery ::= expression */
+ -1, /* (448) expression ::= literal */
+ -1, /* (449) expression ::= pseudo_column */
+ -1, /* (450) expression ::= column_reference */
+ -1, /* (451) expression ::= function_expression */
+ -1, /* (452) expression ::= case_when_expression */
+ -3, /* (453) expression ::= NK_LP expression NK_RP */
+ -2, /* (454) expression ::= NK_PLUS expr_or_subquery */
+ -2, /* (455) expression ::= NK_MINUS expr_or_subquery */
+ -3, /* (456) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ -3, /* (457) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ -3, /* (458) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ -3, /* (459) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ -3, /* (460) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ -3, /* (461) expression ::= column_reference NK_ARROW NK_STRING */
+ -3, /* (462) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ -3, /* (463) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ -1, /* (464) expression_list ::= expr_or_subquery */
+ -3, /* (465) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ -1, /* (466) column_reference ::= column_name */
+ -3, /* (467) column_reference ::= table_name NK_DOT column_name */
+ -1, /* (468) column_reference ::= NK_ALIAS */
+ -3, /* (469) column_reference ::= table_name NK_DOT NK_ALIAS */
+ -1, /* (470) pseudo_column ::= ROWTS */
+ -1, /* (471) pseudo_column ::= TBNAME */
+ -3, /* (472) pseudo_column ::= table_name NK_DOT TBNAME */
+ -1, /* (473) pseudo_column ::= QSTART */
+ -1, /* (474) pseudo_column ::= QEND */
+ -1, /* (475) pseudo_column ::= QDURATION */
+ -1, /* (476) pseudo_column ::= WSTART */
+ -1, /* (477) pseudo_column ::= WEND */
+ -1, /* (478) pseudo_column ::= WDURATION */
+ -1, /* (479) pseudo_column ::= IROWTS */
+ -1, /* (480) pseudo_column ::= ISFILLED */
+ -1, /* (481) pseudo_column ::= QTAGS */
+ -4, /* (482) function_expression ::= function_name NK_LP expression_list NK_RP */
+ -4, /* (483) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ -6, /* (484) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ -1, /* (485) function_expression ::= literal_func */
+ -3, /* (486) literal_func ::= noarg_func NK_LP NK_RP */
+ -1, /* (487) literal_func ::= NOW */
+ -1, /* (488) noarg_func ::= NOW */
+ -1, /* (489) noarg_func ::= TODAY */
+ -1, /* (490) noarg_func ::= TIMEZONE */
+ -1, /* (491) noarg_func ::= DATABASE */
+ -1, /* (492) noarg_func ::= CLIENT_VERSION */
+ -1, /* (493) noarg_func ::= SERVER_VERSION */
+ -1, /* (494) noarg_func ::= SERVER_STATUS */
+ -1, /* (495) noarg_func ::= CURRENT_USER */
+ -1, /* (496) noarg_func ::= USER */
+ -1, /* (497) star_func ::= COUNT */
+ -1, /* (498) star_func ::= FIRST */
+ -1, /* (499) star_func ::= LAST */
+ -1, /* (500) star_func ::= LAST_ROW */
+ -1, /* (501) star_func_para_list ::= NK_STAR */
+ -1, /* (502) star_func_para_list ::= other_para_list */
+ -1, /* (503) other_para_list ::= star_func_para */
+ -3, /* (504) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ -1, /* (505) star_func_para ::= expr_or_subquery */
+ -3, /* (506) star_func_para ::= table_name NK_DOT NK_STAR */
+ -4, /* (507) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ -5, /* (508) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ -1, /* (509) when_then_list ::= when_then_expr */
+ -2, /* (510) when_then_list ::= when_then_list when_then_expr */
+ -4, /* (511) when_then_expr ::= WHEN common_expression THEN common_expression */
+ 0, /* (512) case_when_else_opt ::= */
+ -2, /* (513) case_when_else_opt ::= ELSE common_expression */
+ -3, /* (514) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ -5, /* (515) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ -6, /* (516) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ -3, /* (517) predicate ::= expr_or_subquery IS NULL */
+ -4, /* (518) predicate ::= expr_or_subquery IS NOT NULL */
+ -3, /* (519) predicate ::= expr_or_subquery in_op in_predicate_value */
+ -1, /* (520) compare_op ::= NK_LT */
+ -1, /* (521) compare_op ::= NK_GT */
+ -1, /* (522) compare_op ::= NK_LE */
+ -1, /* (523) compare_op ::= NK_GE */
+ -1, /* (524) compare_op ::= NK_NE */
+ -1, /* (525) compare_op ::= NK_EQ */
+ -1, /* (526) compare_op ::= LIKE */
+ -2, /* (527) compare_op ::= NOT LIKE */
+ -1, /* (528) compare_op ::= MATCH */
+ -1, /* (529) compare_op ::= NMATCH */
+ -1, /* (530) compare_op ::= CONTAINS */
+ -1, /* (531) in_op ::= IN */
+ -2, /* (532) in_op ::= NOT IN */
+ -3, /* (533) in_predicate_value ::= NK_LP literal_list NK_RP */
+ -1, /* (534) boolean_value_expression ::= boolean_primary */
+ -2, /* (535) boolean_value_expression ::= NOT boolean_primary */
+ -3, /* (536) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ -3, /* (537) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ -1, /* (538) boolean_primary ::= predicate */
+ -3, /* (539) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ -1, /* (540) common_expression ::= expr_or_subquery */
+ -1, /* (541) common_expression ::= boolean_value_expression */
+ 0, /* (542) from_clause_opt ::= */
+ -2, /* (543) from_clause_opt ::= FROM table_reference_list */
+ -1, /* (544) table_reference_list ::= table_reference */
+ -3, /* (545) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ -1, /* (546) table_reference ::= table_primary */
+ -1, /* (547) table_reference ::= joined_table */
+ -2, /* (548) table_primary ::= table_name alias_opt */
+ -4, /* (549) table_primary ::= db_name NK_DOT table_name alias_opt */
+ -2, /* (550) table_primary ::= subquery alias_opt */
+ -1, /* (551) table_primary ::= parenthesized_joined_table */
+ 0, /* (552) alias_opt ::= */
+ -1, /* (553) alias_opt ::= table_alias */
+ -2, /* (554) alias_opt ::= AS table_alias */
+ -3, /* (555) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ -3, /* (556) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ -6, /* (557) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ 0, /* (558) join_type ::= */
+ -1, /* (559) join_type ::= INNER */
+ -14, /* (560) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ 0, /* (561) hint_list ::= */
+ -1, /* (562) hint_list ::= NK_HINT */
+ 0, /* (563) tag_mode_opt ::= */
+ -1, /* (564) tag_mode_opt ::= TAGS */
+ 0, /* (565) set_quantifier_opt ::= */
+ -1, /* (566) set_quantifier_opt ::= DISTINCT */
+ -1, /* (567) set_quantifier_opt ::= ALL */
+ -1, /* (568) select_list ::= select_item */
+ -3, /* (569) select_list ::= select_list NK_COMMA select_item */
+ -1, /* (570) select_item ::= NK_STAR */
+ -1, /* (571) select_item ::= common_expression */
+ -2, /* (572) select_item ::= common_expression column_alias */
+ -3, /* (573) select_item ::= common_expression AS column_alias */
+ -3, /* (574) select_item ::= table_name NK_DOT NK_STAR */
+ 0, /* (575) where_clause_opt ::= */
+ -2, /* (576) where_clause_opt ::= WHERE search_condition */
+ 0, /* (577) partition_by_clause_opt ::= */
+ -3, /* (578) partition_by_clause_opt ::= PARTITION BY partition_list */
+ -1, /* (579) partition_list ::= partition_item */
+ -3, /* (580) partition_list ::= partition_list NK_COMMA partition_item */
+ -1, /* (581) partition_item ::= expr_or_subquery */
+ -2, /* (582) partition_item ::= expr_or_subquery column_alias */
+ -3, /* (583) partition_item ::= expr_or_subquery AS column_alias */
+ 0, /* (584) twindow_clause_opt ::= */
+ -6, /* (585) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+ -4, /* (586) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ -6, /* (587) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ -8, /* (588) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ -7, /* (589) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ -4, /* (590) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ -6, /* (591) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 0, /* (592) sliding_opt ::= */
+ -4, /* (593) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
+ -1, /* (594) interval_sliding_duration_literal ::= NK_VARIABLE */
+ -1, /* (595) interval_sliding_duration_literal ::= NK_STRING */
+ -1, /* (596) interval_sliding_duration_literal ::= NK_INTEGER */
+ 0, /* (597) fill_opt ::= */
+ -4, /* (598) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ -6, /* (599) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ -6, /* (600) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ -1, /* (601) fill_mode ::= NONE */
+ -1, /* (602) fill_mode ::= PREV */
+ -1, /* (603) fill_mode ::= NULL */
+ -1, /* (604) fill_mode ::= NULL_F */
+ -1, /* (605) fill_mode ::= LINEAR */
+ -1, /* (606) fill_mode ::= NEXT */
+ 0, /* (607) group_by_clause_opt ::= */
+ -3, /* (608) group_by_clause_opt ::= GROUP BY group_by_list */
+ -1, /* (609) group_by_list ::= expr_or_subquery */
+ -3, /* (610) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ 0, /* (611) having_clause_opt ::= */
+ -2, /* (612) having_clause_opt ::= HAVING search_condition */
+ 0, /* (613) range_opt ::= */
+ -6, /* (614) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ -4, /* (615) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ 0, /* (616) every_opt ::= */
+ -4, /* (617) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ -4, /* (618) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ -1, /* (619) query_simple ::= query_specification */
+ -1, /* (620) query_simple ::= union_query_expression */
+ -4, /* (621) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ -3, /* (622) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ -1, /* (623) query_simple_or_subquery ::= query_simple */
+ -1, /* (624) query_simple_or_subquery ::= subquery */
+ -1, /* (625) query_or_subquery ::= query_expression */
+ -1, /* (626) query_or_subquery ::= subquery */
+ 0, /* (627) order_by_clause_opt ::= */
+ -3, /* (628) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ 0, /* (629) slimit_clause_opt ::= */
+ -2, /* (630) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ -4, /* (631) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ -4, /* (632) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 0, /* (633) limit_clause_opt ::= */
+ -2, /* (634) limit_clause_opt ::= LIMIT NK_INTEGER */
+ -4, /* (635) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ -4, /* (636) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ -3, /* (637) subquery ::= NK_LP query_expression NK_RP */
+ -3, /* (638) subquery ::= NK_LP subquery NK_RP */
+ -1, /* (639) search_condition ::= common_expression */
+ -1, /* (640) sort_specification_list ::= sort_specification */
+ -3, /* (641) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ -3, /* (642) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ 0, /* (643) ordering_specification_opt ::= */
+ -1, /* (644) ordering_specification_opt ::= ASC */
+ -1, /* (645) ordering_specification_opt ::= DESC */
+ 0, /* (646) null_ordering_opt ::= */
+ -2, /* (647) null_ordering_opt ::= NULLS FIRST */
+ -2, /* (648) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -5078,19 +5038,16 @@ static YYACTIONTYPE yy_reduce(
case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
#line 50 "sql.y"
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 5081 "sql.c"
- yy_destructor(yypParser,355,&yymsp[0].minor);
+ yy_destructor(yypParser,352,&yymsp[0].minor);
break;
case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
#line 51 "sql.y"
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 5087 "sql.c"
- yy_destructor(yypParser,356,&yymsp[0].minor);
+ yy_destructor(yypParser,353,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
#line 55 "sql.y"
{ }
-#line 5093 "sql.c"
break;
case 3: /* account_options ::= account_options PPS literal */
case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4);
@@ -5101,26 +5058,20 @@ static YYACTIONTYPE yy_reduce(
case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9);
case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10);
case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11);
-{ yy_destructor(yypParser,355,&yymsp[-2].minor);
-#line 56 "sql.y"
+{ yy_destructor(yypParser,352,&yymsp[-2].minor);
{ }
-#line 5107 "sql.c"
- yy_destructor(yypParser,357,&yymsp[0].minor);
+ yy_destructor(yypParser,354,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,358,&yymsp[0].minor);
-#line 68 "sql.y"
+{ yy_destructor(yypParser,355,&yymsp[0].minor);
{ }
-#line 5115 "sql.c"
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,356,&yymsp[-1].minor);
-#line 69 "sql.y"
+{ yy_destructor(yypParser,353,&yymsp[-1].minor);
{ }
-#line 5122 "sql.c"
- yy_destructor(yypParser,358,&yymsp[0].minor);
+ yy_destructor(yypParser,355,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -5135,2703 +5086,1816 @@ static YYACTIONTYPE yy_reduce(
case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23);
#line 73 "sql.y"
{ }
-#line 5138 "sql.c"
- yy_destructor(yypParser,357,&yymsp[0].minor);
+ yy_destructor(yypParser,354,&yymsp[0].minor);
break;
case 24: /* ip_range_list ::= NK_STRING */
-#line 86 "sql.y"
-{ yylhsminor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
-#line 5144 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+{ yylhsminor.yy536 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
-#line 87 "sql.y"
-{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
-#line 5150 "sql.c"
- yymsp[-2].minor.yy404 = yylhsminor.yy404;
+{ yylhsminor.yy536 = addNodeToList(pCxt, yymsp[-2].minor.yy536, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy536 = yylhsminor.yy536;
break;
case 26: /* white_list ::= HOST ip_range_list */
-#line 91 "sql.y"
-{ yymsp[-1].minor.yy404 = yymsp[0].minor.yy404; }
-#line 5156 "sql.c"
+{ yymsp[-1].minor.yy536 = yymsp[0].minor.yy536; }
break;
case 27: /* white_list_opt ::= */
- case 189: /* specific_cols_opt ::= */ yytestcase(yyruleno==189);
- case 223: /* tags_def_opt ::= */ yytestcase(yyruleno==223);
- case 311: /* tag_list_opt ::= */ yytestcase(yyruleno==311);
- case 377: /* col_list_opt ::= */ yytestcase(yyruleno==377);
- case 379: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==379);
- case 581: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==581);
- case 611: /* group_by_clause_opt ::= */ yytestcase(yyruleno==611);
- case 631: /* order_by_clause_opt ::= */ yytestcase(yyruleno==631);
-#line 95 "sql.y"
-{ yymsp[1].minor.yy404 = NULL; }
-#line 5169 "sql.c"
+ case 188: /* specific_cols_opt ::= */ yytestcase(yyruleno==188);
+ case 219: /* tags_def_opt ::= */ yytestcase(yyruleno==219);
+ case 307: /* tag_list_opt ::= */ yytestcase(yyruleno==307);
+ case 373: /* col_list_opt ::= */ yytestcase(yyruleno==373);
+ case 375: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==375);
+ case 577: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==577);
+ case 607: /* group_by_clause_opt ::= */ yytestcase(yyruleno==607);
+ case 627: /* order_by_clause_opt ::= */ yytestcase(yyruleno==627);
+{ yymsp[1].minor.yy536 = NULL; }
break;
case 28: /* white_list_opt ::= white_list */
- case 224: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==224);
- case 380: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==380);
- case 506: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==506);
-#line 96 "sql.y"
-{ yylhsminor.yy404 = yymsp[0].minor.yy404; }
-#line 5177 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+ case 220: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==220);
+ case 376: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==376);
+ case 502: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==502);
+{ yylhsminor.yy536 = yymsp[0].minor.yy536; }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */
#line 100 "sql.y"
{
- pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy701, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy915);
- pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy404);
+ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy929, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy695);
+ pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy536);
}
-#line 5186 "sql.c"
break;
case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-#line 104 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
-#line 5191 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy929, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
break;
case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
-#line 105 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
-#line 5196 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy929, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
break;
case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
-#line 106 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
-#line 5201 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy929, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 33: /* cmd ::= ALTER USER user_name ADD white_list */
-#line 107 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy404); }
-#line 5206 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy929, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy536); }
break;
case 34: /* cmd ::= ALTER USER user_name DROP white_list */
-#line 108 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy404); }
-#line 5211 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy929, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy536); }
break;
case 35: /* cmd ::= DROP USER user_name */
-#line 109 "sql.y"
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy701); }
-#line 5216 "sql.c"
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy929); }
break;
case 36: /* sysinfo_opt ::= */
-#line 113 "sql.y"
-{ yymsp[1].minor.yy915 = 1; }
-#line 5221 "sql.c"
+{ yymsp[1].minor.yy695 = 1; }
break;
case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-#line 114 "sql.y"
-{ yymsp[-1].minor.yy915 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
-#line 5226 "sql.c"
+{ yymsp[-1].minor.yy695 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
-#line 117 "sql.y"
-{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy949, &yymsp[-3].minor.yy21, &yymsp[0].minor.yy701, yymsp[-2].minor.yy896); }
-#line 5231 "sql.c"
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy221, &yymsp[-3].minor.yy57, &yymsp[0].minor.yy929, yymsp[-2].minor.yy360); }
break;
case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
-#line 118 "sql.y"
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy949, &yymsp[-3].minor.yy21, &yymsp[0].minor.yy701, yymsp[-2].minor.yy896); }
-#line 5236 "sql.c"
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy221, &yymsp[-3].minor.yy57, &yymsp[0].minor.yy929, yymsp[-2].minor.yy360); }
break;
case 40: /* privileges ::= ALL */
-#line 122 "sql.y"
-{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_ALL; }
-#line 5241 "sql.c"
+{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_ALL; }
break;
case 41: /* privileges ::= priv_type_list */
case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43);
-#line 123 "sql.y"
-{ yylhsminor.yy949 = yymsp[0].minor.yy949; }
-#line 5247 "sql.c"
- yymsp[0].minor.yy949 = yylhsminor.yy949;
+{ yylhsminor.yy221 = yymsp[0].minor.yy221; }
+ yymsp[0].minor.yy221 = yylhsminor.yy221;
break;
case 42: /* privileges ::= SUBSCRIBE */
-#line 124 "sql.y"
-{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_SUBSCRIBE; }
-#line 5253 "sql.c"
+{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_SUBSCRIBE; }
break;
case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-#line 129 "sql.y"
-{ yylhsminor.yy949 = yymsp[-2].minor.yy949 | yymsp[0].minor.yy949; }
-#line 5258 "sql.c"
- yymsp[-2].minor.yy949 = yylhsminor.yy949;
+{ yylhsminor.yy221 = yymsp[-2].minor.yy221 | yymsp[0].minor.yy221; }
+ yymsp[-2].minor.yy221 = yylhsminor.yy221;
break;
case 45: /* priv_type ::= READ */
-#line 133 "sql.y"
-{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_READ; }
-#line 5264 "sql.c"
+{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_READ; }
break;
case 46: /* priv_type ::= WRITE */
-#line 134 "sql.y"
-{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_WRITE; }
-#line 5269 "sql.c"
+{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_WRITE; }
break;
case 47: /* priv_type ::= ALTER */
-#line 135 "sql.y"
-{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_ALTER; }
-#line 5274 "sql.c"
+{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_ALTER; }
break;
case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-#line 139 "sql.y"
-{ yylhsminor.yy21.first = yymsp[-2].minor.yy0; yylhsminor.yy21.second = yymsp[0].minor.yy0; }
-#line 5279 "sql.c"
- yymsp[-2].minor.yy21 = yylhsminor.yy21;
+{ yylhsminor.yy57.first = yymsp[-2].minor.yy0; yylhsminor.yy57.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy57 = yylhsminor.yy57;
break;
case 49: /* priv_level ::= db_name NK_DOT NK_STAR */
-#line 140 "sql.y"
-{ yylhsminor.yy21.first = yymsp[-2].minor.yy701; yylhsminor.yy21.second = yymsp[0].minor.yy0; }
-#line 5285 "sql.c"
- yymsp[-2].minor.yy21 = yylhsminor.yy21;
+{ yylhsminor.yy57.first = yymsp[-2].minor.yy929; yylhsminor.yy57.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy57 = yylhsminor.yy57;
break;
case 50: /* priv_level ::= db_name NK_DOT table_name */
-#line 141 "sql.y"
-{ yylhsminor.yy21.first = yymsp[-2].minor.yy701; yylhsminor.yy21.second = yymsp[0].minor.yy701; }
-#line 5291 "sql.c"
- yymsp[-2].minor.yy21 = yylhsminor.yy21;
+{ yylhsminor.yy57.first = yymsp[-2].minor.yy929; yylhsminor.yy57.second = yymsp[0].minor.yy929; }
+ yymsp[-2].minor.yy57 = yylhsminor.yy57;
break;
case 51: /* priv_level ::= topic_name */
-#line 142 "sql.y"
-{ yylhsminor.yy21.first = yymsp[0].minor.yy701; yylhsminor.yy21.second = nil_token; }
-#line 5297 "sql.c"
- yymsp[0].minor.yy21 = yylhsminor.yy21;
+{ yylhsminor.yy57.first = yymsp[0].minor.yy929; yylhsminor.yy57.second = nil_token; }
+ yymsp[0].minor.yy57 = yylhsminor.yy57;
break;
case 52: /* with_opt ::= */
case 157: /* start_opt ::= */ yytestcase(yyruleno==157);
case 161: /* end_opt ::= */ yytestcase(yyruleno==161);
- case 306: /* like_pattern_opt ::= */ yytestcase(yyruleno==306);
- case 391: /* subtable_opt ::= */ yytestcase(yyruleno==391);
- case 516: /* case_when_else_opt ::= */ yytestcase(yyruleno==516);
- case 546: /* from_clause_opt ::= */ yytestcase(yyruleno==546);
- case 579: /* where_clause_opt ::= */ yytestcase(yyruleno==579);
- case 588: /* twindow_clause_opt ::= */ yytestcase(yyruleno==588);
- case 596: /* sliding_opt ::= */ yytestcase(yyruleno==596);
- case 601: /* fill_opt ::= */ yytestcase(yyruleno==601);
- case 615: /* having_clause_opt ::= */ yytestcase(yyruleno==615);
- case 617: /* range_opt ::= */ yytestcase(yyruleno==617);
- case 620: /* every_opt ::= */ yytestcase(yyruleno==620);
- case 633: /* slimit_clause_opt ::= */ yytestcase(yyruleno==633);
- case 637: /* limit_clause_opt ::= */ yytestcase(yyruleno==637);
-#line 144 "sql.y"
-{ yymsp[1].minor.yy896 = NULL; }
-#line 5318 "sql.c"
+ case 302: /* like_pattern_opt ::= */ yytestcase(yyruleno==302);
+ case 387: /* subtable_opt ::= */ yytestcase(yyruleno==387);
+ case 512: /* case_when_else_opt ::= */ yytestcase(yyruleno==512);
+ case 542: /* from_clause_opt ::= */ yytestcase(yyruleno==542);
+ case 575: /* where_clause_opt ::= */ yytestcase(yyruleno==575);
+ case 584: /* twindow_clause_opt ::= */ yytestcase(yyruleno==584);
+ case 592: /* sliding_opt ::= */ yytestcase(yyruleno==592);
+ case 597: /* fill_opt ::= */ yytestcase(yyruleno==597);
+ case 611: /* having_clause_opt ::= */ yytestcase(yyruleno==611);
+ case 613: /* range_opt ::= */ yytestcase(yyruleno==613);
+ case 616: /* every_opt ::= */ yytestcase(yyruleno==616);
+ case 629: /* slimit_clause_opt ::= */ yytestcase(yyruleno==629);
+ case 633: /* limit_clause_opt ::= */ yytestcase(yyruleno==633);
+{ yymsp[1].minor.yy360 = NULL; }
break;
case 53: /* with_opt ::= WITH search_condition */
- case 547: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==547);
- case 580: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==580);
- case 616: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==616);
-#line 145 "sql.y"
-{ yymsp[-1].minor.yy896 = yymsp[0].minor.yy896; }
-#line 5326 "sql.c"
+ case 543: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==543);
+ case 576: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==576);
+ case 612: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==612);
+{ yymsp[-1].minor.yy360 = yymsp[0].minor.yy360; }
break;
case 54: /* cmd ::= CREATE DNODE dnode_endpoint */
-#line 148 "sql.y"
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy701, NULL); }
-#line 5331 "sql.c"
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy929, NULL); }
break;
case 55: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-#line 149 "sql.y"
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0); }
-#line 5336 "sql.c"
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy0); }
break;
case 56: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
-#line 150 "sql.y"
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy733, false); }
-#line 5341 "sql.c"
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy345, false); }
break;
case 57: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
-#line 151 "sql.y"
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy701, yymsp[0].minor.yy733, false); }
-#line 5346 "sql.c"
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy929, yymsp[0].minor.yy345, false); }
break;
case 58: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
-#line 152 "sql.y"
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy733); }
-#line 5351 "sql.c"
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy345); }
break;
case 59: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
-#line 153 "sql.y"
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy701, false, yymsp[0].minor.yy733); }
-#line 5356 "sql.c"
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy929, false, yymsp[0].minor.yy345); }
break;
case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
#line 154 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
-#line 5361 "sql.c"
break;
case 61: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
#line 155 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5366 "sql.c"
break;
case 62: /* cmd ::= ALTER ALL DNODES NK_STRING */
#line 156 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); }
-#line 5371 "sql.c"
break;
case 63: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
#line 157 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5376 "sql.c"
break;
case 64: /* cmd ::= RESTORE DNODE NK_INTEGER */
#line 158 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5381 "sql.c"
break;
case 65: /* dnode_endpoint ::= NK_STRING */
case 66: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==66);
case 67: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==67);
- case 333: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==333);
- case 334: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==334);
- case 335: /* sma_func_name ::= LAST */ yytestcase(yyruleno==335);
- case 336: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==336);
- case 438: /* db_name ::= NK_ID */ yytestcase(yyruleno==438);
- case 439: /* table_name ::= NK_ID */ yytestcase(yyruleno==439);
- case 440: /* column_name ::= NK_ID */ yytestcase(yyruleno==440);
- case 441: /* function_name ::= NK_ID */ yytestcase(yyruleno==441);
- case 442: /* view_name ::= NK_ID */ yytestcase(yyruleno==442);
- case 443: /* table_alias ::= NK_ID */ yytestcase(yyruleno==443);
- case 444: /* column_alias ::= NK_ID */ yytestcase(yyruleno==444);
- case 445: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==445);
- case 446: /* user_name ::= NK_ID */ yytestcase(yyruleno==446);
- case 447: /* topic_name ::= NK_ID */ yytestcase(yyruleno==447);
- case 448: /* stream_name ::= NK_ID */ yytestcase(yyruleno==448);
- case 449: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==449);
- case 450: /* index_name ::= NK_ID */ yytestcase(yyruleno==450);
- case 492: /* noarg_func ::= NOW */ yytestcase(yyruleno==492);
- case 493: /* noarg_func ::= TODAY */ yytestcase(yyruleno==493);
- case 494: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==494);
- case 495: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==495);
- case 496: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==496);
- case 497: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==497);
- case 498: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==498);
- case 499: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==499);
- case 500: /* noarg_func ::= USER */ yytestcase(yyruleno==500);
- case 501: /* star_func ::= COUNT */ yytestcase(yyruleno==501);
- case 502: /* star_func ::= FIRST */ yytestcase(yyruleno==502);
- case 503: /* star_func ::= LAST */ yytestcase(yyruleno==503);
- case 504: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==504);
-#line 162 "sql.y"
-{ yylhsminor.yy701 = yymsp[0].minor.yy0; }
-#line 5418 "sql.c"
- yymsp[0].minor.yy701 = yylhsminor.yy701;
+ case 329: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==329);
+ case 330: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==330);
+ case 331: /* sma_func_name ::= LAST */ yytestcase(yyruleno==331);
+ case 332: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==332);
+ case 434: /* db_name ::= NK_ID */ yytestcase(yyruleno==434);
+ case 435: /* table_name ::= NK_ID */ yytestcase(yyruleno==435);
+ case 436: /* column_name ::= NK_ID */ yytestcase(yyruleno==436);
+ case 437: /* function_name ::= NK_ID */ yytestcase(yyruleno==437);
+ case 438: /* view_name ::= NK_ID */ yytestcase(yyruleno==438);
+ case 439: /* table_alias ::= NK_ID */ yytestcase(yyruleno==439);
+ case 440: /* column_alias ::= NK_ID */ yytestcase(yyruleno==440);
+ case 441: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==441);
+ case 442: /* user_name ::= NK_ID */ yytestcase(yyruleno==442);
+ case 443: /* topic_name ::= NK_ID */ yytestcase(yyruleno==443);
+ case 444: /* stream_name ::= NK_ID */ yytestcase(yyruleno==444);
+ case 445: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==445);
+ case 446: /* index_name ::= NK_ID */ yytestcase(yyruleno==446);
+ case 488: /* noarg_func ::= NOW */ yytestcase(yyruleno==488);
+ case 489: /* noarg_func ::= TODAY */ yytestcase(yyruleno==489);
+ case 490: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==490);
+ case 491: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==491);
+ case 492: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==492);
+ case 493: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==493);
+ case 494: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==494);
+ case 495: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==495);
+ case 496: /* noarg_func ::= USER */ yytestcase(yyruleno==496);
+ case 497: /* star_func ::= COUNT */ yytestcase(yyruleno==497);
+ case 498: /* star_func ::= FIRST */ yytestcase(yyruleno==498);
+ case 499: /* star_func ::= LAST */ yytestcase(yyruleno==499);
+ case 500: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==500);
+{ yylhsminor.yy929 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy929 = yylhsminor.yy929;
break;
case 68: /* force_opt ::= */
case 94: /* not_exists_opt ::= */ yytestcase(yyruleno==94);
case 96: /* exists_opt ::= */ yytestcase(yyruleno==96);
- case 354: /* analyze_opt ::= */ yytestcase(yyruleno==354);
- case 361: /* agg_func_opt ::= */ yytestcase(yyruleno==361);
- case 367: /* or_replace_opt ::= */ yytestcase(yyruleno==367);
- case 393: /* ignore_opt ::= */ yytestcase(yyruleno==393);
- case 567: /* tag_mode_opt ::= */ yytestcase(yyruleno==567);
- case 569: /* set_quantifier_opt ::= */ yytestcase(yyruleno==569);
-#line 168 "sql.y"
-{ yymsp[1].minor.yy733 = false; }
-#line 5432 "sql.c"
+ case 350: /* analyze_opt ::= */ yytestcase(yyruleno==350);
+ case 357: /* agg_func_opt ::= */ yytestcase(yyruleno==357);
+ case 363: /* or_replace_opt ::= */ yytestcase(yyruleno==363);
+ case 389: /* ignore_opt ::= */ yytestcase(yyruleno==389);
+ case 563: /* tag_mode_opt ::= */ yytestcase(yyruleno==563);
+ case 565: /* set_quantifier_opt ::= */ yytestcase(yyruleno==565);
+{ yymsp[1].minor.yy345 = false; }
break;
case 69: /* force_opt ::= FORCE */
case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70);
- case 355: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==355);
- case 362: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==362);
- case 568: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==568);
- case 570: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==570);
-#line 169 "sql.y"
-{ yymsp[0].minor.yy733 = true; }
-#line 5442 "sql.c"
+ case 351: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==351);
+ case 358: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==358);
+ case 564: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==564);
+ case 566: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==566);
+{ yymsp[0].minor.yy345 = true; }
break;
case 71: /* cmd ::= ALTER CLUSTER NK_STRING */
#line 176 "sql.y"
{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 5447 "sql.c"
break;
case 72: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
#line 177 "sql.y"
{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5452 "sql.c"
break;
case 73: /* cmd ::= ALTER LOCAL NK_STRING */
#line 180 "sql.y"
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 5457 "sql.c"
break;
case 74: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
#line 181 "sql.y"
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5462 "sql.c"
break;
case 75: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
#line 184 "sql.y"
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5467 "sql.c"
break;
case 76: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
#line 185 "sql.y"
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5472 "sql.c"
break;
case 77: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
#line 186 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5477 "sql.c"
break;
case 78: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
#line 189 "sql.y"
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5482 "sql.c"
break;
case 79: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
#line 190 "sql.y"
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5487 "sql.c"
break;
case 80: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
#line 193 "sql.y"
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5492 "sql.c"
break;
case 81: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
#line 194 "sql.y"
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5497 "sql.c"
break;
case 82: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
#line 197 "sql.y"
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5502 "sql.c"
break;
case 83: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
#line 198 "sql.y"
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5507 "sql.c"
break;
case 84: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
#line 199 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5512 "sql.c"
break;
case 85: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
#line 202 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5517 "sql.c"
break;
case 86: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-#line 205 "sql.y"
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy733, &yymsp[-1].minor.yy701, yymsp[0].minor.yy896); }
-#line 5522 "sql.c"
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy345, &yymsp[-1].minor.yy929, yymsp[0].minor.yy360); }
break;
case 87: /* cmd ::= DROP DATABASE exists_opt db_name */
-#line 206 "sql.y"
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); }
-#line 5527 "sql.c"
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy345, &yymsp[0].minor.yy929); }
break;
case 88: /* cmd ::= USE db_name */
-#line 207 "sql.y"
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy701); }
-#line 5532 "sql.c"
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy929); }
break;
case 89: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-#line 208 "sql.y"
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy701, yymsp[0].minor.yy896); }
-#line 5537 "sql.c"
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy929, yymsp[0].minor.yy360); }
break;
case 90: /* cmd ::= FLUSH DATABASE db_name */
-#line 209 "sql.y"
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy701); }
-#line 5542 "sql.c"
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy929); }
break;
case 91: /* cmd ::= TRIM DATABASE db_name speed_opt */
-#line 210 "sql.y"
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy701, yymsp[0].minor.yy396); }
-#line 5547 "sql.c"
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy929, yymsp[0].minor.yy580); }
break;
case 92: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
-#line 211 "sql.y"
-{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy701, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); }
-#line 5552 "sql.c"
+{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy929, yymsp[-1].minor.yy360, yymsp[0].minor.yy360); }
break;
case 93: /* not_exists_opt ::= IF NOT EXISTS */
-#line 215 "sql.y"
-{ yymsp[-2].minor.yy733 = true; }
-#line 5557 "sql.c"
+{ yymsp[-2].minor.yy345 = true; }
break;
case 95: /* exists_opt ::= IF EXISTS */
- case 368: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==368);
- case 394: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==394);
-#line 220 "sql.y"
-{ yymsp[-1].minor.yy733 = true; }
-#line 5564 "sql.c"
+ case 364: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==364);
+ case 390: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==390);
+{ yymsp[-1].minor.yy345 = true; }
break;
case 97: /* db_options ::= */
-#line 223 "sql.y"
-{ yymsp[1].minor.yy896 = createDefaultDatabaseOptions(pCxt); }
-#line 5569 "sql.c"
+{ yymsp[1].minor.yy360 = createDefaultDatabaseOptions(pCxt); }
break;
case 98: /* db_options ::= db_options BUFFER NK_INTEGER */
-#line 224 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
-#line 5574 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 99: /* db_options ::= db_options CACHEMODEL NK_STRING */
-#line 225 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
-#line 5580 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 100: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-#line 226 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
-#line 5586 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 101: /* db_options ::= db_options COMP NK_INTEGER */
-#line 227 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
-#line 5592 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 102: /* db_options ::= db_options DURATION NK_INTEGER */
case 103: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==103);
-#line 228 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
-#line 5599 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 104: /* db_options ::= db_options MAXROWS NK_INTEGER */
-#line 230 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
-#line 5605 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 105: /* db_options ::= db_options MINROWS NK_INTEGER */
-#line 231 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
-#line 5611 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 106: /* db_options ::= db_options KEEP integer_list */
case 107: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==107);
-#line 232 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_KEEP, yymsp[0].minor.yy404); }
-#line 5618 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_KEEP, yymsp[0].minor.yy536); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 108: /* db_options ::= db_options PAGES NK_INTEGER */
-#line 234 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
-#line 5624 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 109: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-#line 235 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
-#line 5630 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 110: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-#line 236 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
-#line 5636 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 111: /* db_options ::= db_options PRECISION NK_STRING */
-#line 237 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
-#line 5642 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 112: /* db_options ::= db_options REPLICA NK_INTEGER */
-#line 238 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
-#line 5648 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 113: /* db_options ::= db_options VGROUPS NK_INTEGER */
-#line 240 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
-#line 5654 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 114: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-#line 241 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
-#line 5660 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 115: /* db_options ::= db_options RETENTIONS retention_list */
-#line 242 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_RETENTIONS, yymsp[0].minor.yy404); }
-#line 5666 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_RETENTIONS, yymsp[0].minor.yy536); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 116: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-#line 243 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
-#line 5672 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 117: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-#line 244 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
-#line 5678 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 118: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-#line 245 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
-#line 5684 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 119: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-#line 246 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
-#line 5690 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 120: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
#line 247 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-3].minor.yy896, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-3].minor.yy360, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
-#line 5700 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
case 121: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-#line 252 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
-#line 5706 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 122: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
#line 253 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-3].minor.yy896, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-3].minor.yy360, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
-#line 5716 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
case 123: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-#line 258 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
-#line 5722 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 124: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-#line 259 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
-#line 5728 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 125: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-#line 260 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
-#line 5734 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 126: /* db_options ::= db_options TABLE_PREFIX signed */
-#line 261 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy896); }
-#line 5740 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy360); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 127: /* db_options ::= db_options TABLE_SUFFIX signed */
-#line 262 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy896); }
-#line 5746 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy360); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 128: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
-#line 263 "sql.y"
-{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
-#line 5752 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setDatabaseOption(pCxt, yymsp[-2].minor.yy360, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 129: /* alter_db_options ::= alter_db_option */
-#line 265 "sql.y"
-{ yylhsminor.yy896 = createAlterDatabaseOptions(pCxt); yylhsminor.yy896 = setAlterDatabaseOption(pCxt, yylhsminor.yy896, &yymsp[0].minor.yy529); }
-#line 5758 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = createAlterDatabaseOptions(pCxt); yylhsminor.yy360 = setAlterDatabaseOption(pCxt, yylhsminor.yy360, &yymsp[0].minor.yy797); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
case 130: /* alter_db_options ::= alter_db_options alter_db_option */
-#line 266 "sql.y"
-{ yylhsminor.yy896 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy896, &yymsp[0].minor.yy529); }
-#line 5764 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy360, &yymsp[0].minor.yy797); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
case 131: /* alter_db_option ::= BUFFER NK_INTEGER */
-#line 270 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5770 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 132: /* alter_db_option ::= CACHEMODEL NK_STRING */
-#line 271 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5775 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 133: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-#line 272 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5780 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 134: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-#line 273 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5785 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 135: /* alter_db_option ::= KEEP integer_list */
case 136: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==136);
-#line 274 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_KEEP; yymsp[-1].minor.yy529.pList = yymsp[0].minor.yy404; }
-#line 5791 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_KEEP; yymsp[-1].minor.yy797.pList = yymsp[0].minor.yy536; }
break;
case 137: /* alter_db_option ::= PAGES NK_INTEGER */
-#line 276 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_PAGES; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5796 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_PAGES; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 138: /* alter_db_option ::= REPLICA NK_INTEGER */
-#line 277 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5801 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 139: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-#line 279 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5806 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_WAL; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 140: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-#line 280 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5811 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 141: /* alter_db_option ::= MINROWS NK_INTEGER */
-#line 281 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5816 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 142: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
-#line 282 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5821 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 143: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
#line 283 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yymsp[-2].minor.yy529.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy529.val = t;
+ yymsp[-2].minor.yy797.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy797.val = t;
}
-#line 5830 "sql.c"
break;
case 144: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
-#line 288 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5835 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 145: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
#line 289 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yymsp[-2].minor.yy529.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy529.val = t;
+ yymsp[-2].minor.yy797.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy797.val = t;
}
-#line 5844 "sql.c"
break;
case 146: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
-#line 294 "sql.y"
-{ yymsp[-1].minor.yy529.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 5849 "sql.c"
+{ yymsp[-1].minor.yy797.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
case 147: /* integer_list ::= NK_INTEGER */
-#line 298 "sql.y"
-{ yylhsminor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 5854 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+{ yylhsminor.yy536 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
case 148: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 407: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==407);
-#line 299 "sql.y"
-{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 5861 "sql.c"
- yymsp[-2].minor.yy404 = yylhsminor.yy404;
+ case 403: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==403);
+{ yylhsminor.yy536 = addNodeToList(pCxt, yymsp[-2].minor.yy536, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy536 = yylhsminor.yy536;
break;
case 149: /* variable_list ::= NK_VARIABLE */
-#line 303 "sql.y"
-{ yylhsminor.yy404 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5867 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+{ yylhsminor.yy536 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
case 150: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-#line 304 "sql.y"
-{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5873 "sql.c"
- yymsp[-2].minor.yy404 = yylhsminor.yy404;
+{ yylhsminor.yy536 = addNodeToList(pCxt, yymsp[-2].minor.yy536, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy536 = yylhsminor.yy536;
break;
case 151: /* retention_list ::= retention */
- case 183: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==183);
- case 186: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==186);
- case 193: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==193);
- case 196: /* column_def_list ::= column_def */ yytestcase(yyruleno==196);
- case 240: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==240);
- case 245: /* col_name_list ::= col_name */ yytestcase(yyruleno==245);
- case 312: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==312);
- case 329: /* func_list ::= func */ yytestcase(yyruleno==329);
- case 436: /* literal_list ::= signed_literal */ yytestcase(yyruleno==436);
- case 507: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==507);
- case 513: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==513);
- case 572: /* select_list ::= select_item */ yytestcase(yyruleno==572);
- case 583: /* partition_list ::= partition_item */ yytestcase(yyruleno==583);
- case 644: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==644);
-#line 308 "sql.y"
-{ yylhsminor.yy404 = createNodeList(pCxt, yymsp[0].minor.yy896); }
-#line 5893 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+ case 182: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==182);
+ case 185: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==185);
+ case 192: /* column_def_list ::= column_def */ yytestcase(yyruleno==192);
+ case 236: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==236);
+ case 241: /* col_name_list ::= col_name */ yytestcase(yyruleno==241);
+ case 308: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==308);
+ case 325: /* func_list ::= func */ yytestcase(yyruleno==325);
+ case 432: /* literal_list ::= signed_literal */ yytestcase(yyruleno==432);
+ case 503: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==503);
+ case 509: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==509);
+ case 568: /* select_list ::= select_item */ yytestcase(yyruleno==568);
+ case 579: /* partition_list ::= partition_item */ yytestcase(yyruleno==579);
+ case 640: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==640);
+{ yylhsminor.yy536 = createNodeList(pCxt, yymsp[0].minor.yy360); }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
case 152: /* retention_list ::= retention_list NK_COMMA retention */
- case 187: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==187);
- case 194: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==194);
- case 197: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==197);
- case 241: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==241);
- case 246: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==246);
- case 313: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==313);
- case 330: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==330);
- case 437: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==437);
- case 508: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==508);
- case 573: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==573);
- case 584: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==584);
- case 645: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==645);
-#line 309 "sql.y"
-{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, yymsp[0].minor.yy896); }
-#line 5911 "sql.c"
- yymsp[-2].minor.yy404 = yylhsminor.yy404;
+ case 186: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==186);
+ case 193: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==193);
+ case 237: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==237);
+ case 242: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==242);
+ case 309: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==309);
+ case 326: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==326);
+ case 433: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==433);
+ case 504: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==504);
+ case 569: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==569);
+ case 580: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==580);
+ case 641: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==641);
+{ yylhsminor.yy536 = addNodeToList(pCxt, yymsp[-2].minor.yy536, yymsp[0].minor.yy360); }
+ yymsp[-2].minor.yy536 = yylhsminor.yy536;
break;
case 153: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
case 154: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==154);
-#line 311 "sql.y"
-{ yylhsminor.yy896 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5918 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
case 155: /* speed_opt ::= */
- case 363: /* bufsize_opt ::= */ yytestcase(yyruleno==363);
-#line 316 "sql.y"
-{ yymsp[1].minor.yy396 = 0; }
-#line 5925 "sql.c"
+ case 359: /* bufsize_opt ::= */ yytestcase(yyruleno==359);
+{ yymsp[1].minor.yy580 = 0; }
break;
case 156: /* speed_opt ::= BWLIMIT NK_INTEGER */
- case 364: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==364);
-#line 317 "sql.y"
-{ yymsp[-1].minor.yy396 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
-#line 5931 "sql.c"
+ case 360: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==360);
+{ yymsp[-1].minor.yy580 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 158: /* start_opt ::= START WITH NK_INTEGER */
case 162: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==162);
-#line 320 "sql.y"
-{ yymsp[-2].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
-#line 5937 "sql.c"
+{ yymsp[-2].minor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
break;
case 159: /* start_opt ::= START WITH NK_STRING */
case 163: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==163);
-#line 321 "sql.y"
-{ yymsp[-2].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 5943 "sql.c"
+{ yymsp[-2].minor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
case 160: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
case 164: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==164);
-#line 322 "sql.y"
-{ yymsp[-3].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 5949 "sql.c"
+{ yymsp[-3].minor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
case 165: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 167: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==167);
-#line 331 "sql.y"
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy733, yymsp[-5].minor.yy896, yymsp[-3].minor.yy404, yymsp[-1].minor.yy404, yymsp[0].minor.yy896); }
-#line 5955 "sql.c"
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy345, yymsp[-5].minor.yy360, yymsp[-3].minor.yy536, yymsp[-1].minor.yy536, yymsp[0].minor.yy360); }
break;
case 166: /* cmd ::= CREATE TABLE multi_create_clause */
-#line 332 "sql.y"
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy404); }
-#line 5960 "sql.c"
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy536); }
break;
case 168: /* cmd ::= DROP TABLE multi_drop_clause */
-#line 335 "sql.y"
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy404); }
-#line 5965 "sql.c"
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy536); }
break;
case 169: /* cmd ::= DROP STABLE exists_opt full_table_name */
-#line 336 "sql.y"
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy733, yymsp[0].minor.yy896); }
-#line 5970 "sql.c"
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy345, yymsp[0].minor.yy360); }
break;
case 170: /* cmd ::= ALTER TABLE alter_table_clause */
- case 409: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==409);
- case 410: /* cmd ::= insert_query */ yytestcase(yyruleno==410);
-#line 338 "sql.y"
-{ pCxt->pRootNode = yymsp[0].minor.yy896; }
-#line 5977 "sql.c"
+ case 405: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==405);
+ case 406: /* cmd ::= insert_query */ yytestcase(yyruleno==406);
+{ pCxt->pRootNode = yymsp[0].minor.yy360; }
break;
case 171: /* cmd ::= ALTER STABLE alter_table_clause */
-#line 339 "sql.y"
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy896); }
-#line 5982 "sql.c"
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy360); }
break;
case 172: /* alter_table_clause ::= full_table_name alter_table_options */
-#line 341 "sql.y"
-{ yylhsminor.yy896 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); }
-#line 5987 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy360, yymsp[0].minor.yy360); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
case 173: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-#line 343 "sql.y"
-{ yylhsminor.yy896 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504); }
-#line 5993 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy360, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy929, yymsp[0].minor.yy912); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
case 174: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-#line 344 "sql.y"
-{ yylhsminor.yy896 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy896, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy701); }
-#line 5999 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy360, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy929); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
case 175: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-#line 346 "sql.y"
-{ yylhsminor.yy896 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504); }
-#line 6005 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+{ yylhsminor.yy360 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy360, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy929, yymsp[0].minor.yy912); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 176: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
-#line 348 "sql.y"
-{ yylhsminor.yy896 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy701, yymsp[0].minor.yy896); }
-#line 6011 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ case 176: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+{ yylhsminor.yy360 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy360, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy929, &yymsp[0].minor.yy929); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 177: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-#line 350 "sql.y"
-{ yylhsminor.yy896 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy701, &yymsp[0].minor.yy701); }
-#line 6017 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ case 177: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+{ yylhsminor.yy360 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy360, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy929, yymsp[0].minor.yy912); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 178: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-#line 352 "sql.y"
-{ yylhsminor.yy896 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504); }
-#line 6023 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ case 178: /* alter_table_clause ::= full_table_name DROP TAG column_name */
+{ yylhsminor.yy360 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy360, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy929); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 179: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-#line 353 "sql.y"
-{ yylhsminor.yy896 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy896, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy701); }
-#line 6029 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 179: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+{ yylhsminor.yy360 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy360, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy929, yymsp[0].minor.yy912); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 180: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-#line 355 "sql.y"
-{ yylhsminor.yy896 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504); }
-#line 6035 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ case 180: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+{ yylhsminor.yy360 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy360, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy929, &yymsp[0].minor.yy929); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 181: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-#line 357 "sql.y"
-{ yylhsminor.yy896 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy701, &yymsp[0].minor.yy701); }
-#line 6041 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ case 181: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+{ yylhsminor.yy360 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy360, &yymsp[-2].minor.yy929, yymsp[0].minor.yy360); }
+ yymsp[-5].minor.yy360 = yylhsminor.yy360;
break;
- case 182: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-#line 359 "sql.y"
-{ yylhsminor.yy896 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy896, &yymsp[-2].minor.yy701, yymsp[0].minor.yy896); }
-#line 6047 "sql.c"
- yymsp[-5].minor.yy896 = yylhsminor.yy896;
+ case 183: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
+ case 510: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==510);
+{ yylhsminor.yy536 = addNodeToList(pCxt, yymsp[-1].minor.yy536, yymsp[0].minor.yy360); }
+ yymsp[-1].minor.yy536 = yylhsminor.yy536;
break;
- case 184: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
- case 514: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==514);
-#line 364 "sql.y"
-{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-1].minor.yy404, yymsp[0].minor.yy896); }
-#line 6054 "sql.c"
- yymsp[-1].minor.yy404 = yylhsminor.yy404;
+ case 184: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
+{ yylhsminor.yy360 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy345, yymsp[-8].minor.yy360, yymsp[-6].minor.yy360, yymsp[-5].minor.yy536, yymsp[-2].minor.yy536, yymsp[0].minor.yy360); }
+ yymsp[-9].minor.yy360 = yylhsminor.yy360;
break;
- case 185: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
-#line 368 "sql.y"
-{ yylhsminor.yy896 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy733, yymsp[-8].minor.yy896, yymsp[-6].minor.yy896, yymsp[-5].minor.yy404, yymsp[-2].minor.yy404, yymsp[0].minor.yy896); }
-#line 6060 "sql.c"
- yymsp[-9].minor.yy896 = yylhsminor.yy896;
+ case 187: /* drop_table_clause ::= exists_opt full_table_name */
+{ yylhsminor.yy360 = createDropTableClause(pCxt, yymsp[-1].minor.yy345, yymsp[0].minor.yy360); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 188: /* drop_table_clause ::= exists_opt full_table_name */
-#line 375 "sql.y"
-{ yylhsminor.yy896 = createDropTableClause(pCxt, yymsp[-1].minor.yy733, yymsp[0].minor.yy896); }
-#line 6066 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 189: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ case 374: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==374);
+{ yymsp[-2].minor.yy536 = yymsp[-1].minor.yy536; }
break;
- case 190: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
- case 378: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==378);
-#line 380 "sql.y"
-{ yymsp[-2].minor.yy404 = yymsp[-1].minor.yy404; }
-#line 6073 "sql.c"
+ case 190: /* full_table_name ::= table_name */
+{ yylhsminor.yy360 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy929, NULL); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 191: /* full_table_name ::= table_name */
-#line 382 "sql.y"
-{ yylhsminor.yy896 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy701, NULL); }
-#line 6078 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 191: /* full_table_name ::= db_name NK_DOT table_name */
+{ yylhsminor.yy360 = createRealTableNode(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy929, NULL); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 192: /* full_table_name ::= db_name NK_DOT table_name */
-#line 383 "sql.y"
-{ yylhsminor.yy896 = createRealTableNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701, NULL); }
-#line 6084 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 194: /* column_def ::= column_name type_name */
+{ yylhsminor.yy360 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy929, yymsp[0].minor.yy912, NULL); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 195: /* tag_def ::= column_name type_name */
-#line 389 "sql.y"
-{ yylhsminor.yy896 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504, NULL); }
-#line 6090 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 195: /* type_name ::= BOOL */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
- case 198: /* column_def ::= column_name type_name column_options */
-#line 397 "sql.y"
-{ yylhsminor.yy896 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy701, yymsp[-1].minor.yy504, yymsp[0].minor.yy896); }
-#line 6096 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 196: /* type_name ::= TINYINT */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
- case 199: /* type_name ::= BOOL */
-#line 401 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BOOL); }
-#line 6102 "sql.c"
+ case 197: /* type_name ::= SMALLINT */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
- case 200: /* type_name ::= TINYINT */
-#line 402 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_TINYINT); }
-#line 6107 "sql.c"
+ case 198: /* type_name ::= INT */
+ case 199: /* type_name ::= INTEGER */ yytestcase(yyruleno==199);
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_INT); }
break;
- case 201: /* type_name ::= SMALLINT */
-#line 403 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
-#line 6112 "sql.c"
+ case 200: /* type_name ::= BIGINT */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
- case 202: /* type_name ::= INT */
- case 203: /* type_name ::= INTEGER */ yytestcase(yyruleno==203);
-#line 404 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_INT); }
-#line 6118 "sql.c"
+ case 201: /* type_name ::= FLOAT */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
- case 204: /* type_name ::= BIGINT */
-#line 406 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BIGINT); }
-#line 6123 "sql.c"
+ case 202: /* type_name ::= DOUBLE */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
- case 205: /* type_name ::= FLOAT */
-#line 407 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_FLOAT); }
-#line 6128 "sql.c"
+ case 203: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy912 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
- case 206: /* type_name ::= DOUBLE */
-#line 408 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
-#line 6133 "sql.c"
+ case 204: /* type_name ::= TIMESTAMP */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
- case 207: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-#line 409 "sql.y"
-{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
-#line 6138 "sql.c"
+ case 205: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy912 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
- case 208: /* type_name ::= TIMESTAMP */
-#line 410 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
-#line 6143 "sql.c"
+ case 206: /* type_name ::= TINYINT UNSIGNED */
+{ yymsp[-1].minor.yy912 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
- case 209: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-#line 411 "sql.y"
-{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
-#line 6148 "sql.c"
+ case 207: /* type_name ::= SMALLINT UNSIGNED */
+{ yymsp[-1].minor.yy912 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
- case 210: /* type_name ::= TINYINT UNSIGNED */
-#line 412 "sql.y"
-{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
-#line 6153 "sql.c"
+ case 208: /* type_name ::= INT UNSIGNED */
+{ yymsp[-1].minor.yy912 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
- case 211: /* type_name ::= SMALLINT UNSIGNED */
-#line 413 "sql.y"
-{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
-#line 6158 "sql.c"
+ case 209: /* type_name ::= BIGINT UNSIGNED */
+{ yymsp[-1].minor.yy912 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
- case 212: /* type_name ::= INT UNSIGNED */
-#line 414 "sql.y"
-{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UINT); }
-#line 6163 "sql.c"
+ case 210: /* type_name ::= JSON */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
- case 213: /* type_name ::= BIGINT UNSIGNED */
-#line 415 "sql.y"
-{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
-#line 6168 "sql.c"
+ case 211: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy912 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
- case 214: /* type_name ::= JSON */
-#line 416 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_JSON); }
-#line 6173 "sql.c"
+ case 212: /* type_name ::= MEDIUMBLOB */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
- case 215: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-#line 417 "sql.y"
-{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
-#line 6178 "sql.c"
+ case 213: /* type_name ::= BLOB */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
- case 216: /* type_name ::= MEDIUMBLOB */
-#line 418 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
-#line 6183 "sql.c"
+ case 214: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy912 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
- case 217: /* type_name ::= BLOB */
-#line 419 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BLOB); }
-#line 6188 "sql.c"
+ case 215: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy912 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
break;
- case 218: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-#line 420 "sql.y"
-{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
-#line 6193 "sql.c"
+ case 216: /* type_name ::= DECIMAL */
+{ yymsp[0].minor.yy912 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 219: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
-#line 421 "sql.y"
-{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
-#line 6198 "sql.c"
+ case 217: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy912 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 220: /* type_name ::= DECIMAL */
-#line 422 "sql.y"
-{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 6203 "sql.c"
+ case 218: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy912 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 221: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-#line 423 "sql.y"
-{ yymsp[-3].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 6208 "sql.c"
+ case 221: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ case 377: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==377);
+{ yymsp[-3].minor.yy536 = yymsp[-1].minor.yy536; }
break;
- case 222: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-#line 424 "sql.y"
-{ yymsp[-5].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 6213 "sql.c"
+ case 222: /* table_options ::= */
+{ yymsp[1].minor.yy360 = createDefaultTableOptions(pCxt); }
break;
- case 225: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */
- case 381: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==381);
-#line 433 "sql.y"
-{ yymsp[-3].minor.yy404 = yymsp[-1].minor.yy404; }
-#line 6219 "sql.c"
+ case 223: /* table_options ::= table_options COMMENT NK_STRING */
+{ yylhsminor.yy360 = setTableOption(pCxt, yymsp[-2].minor.yy360, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 226: /* table_options ::= */
-#line 435 "sql.y"
-{ yymsp[1].minor.yy896 = createDefaultTableOptions(pCxt); }
-#line 6224 "sql.c"
+ case 224: /* table_options ::= table_options MAX_DELAY duration_list */
+{ yylhsminor.yy360 = setTableOption(pCxt, yymsp[-2].minor.yy360, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy536); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 227: /* table_options ::= table_options COMMENT NK_STRING */
-#line 436 "sql.y"
-{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
-#line 6229 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 225: /* table_options ::= table_options WATERMARK duration_list */
+{ yylhsminor.yy360 = setTableOption(pCxt, yymsp[-2].minor.yy360, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy536); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 228: /* table_options ::= table_options MAX_DELAY duration_list */
-#line 437 "sql.y"
-{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy404); }
-#line 6235 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 226: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+{ yylhsminor.yy360 = setTableOption(pCxt, yymsp[-4].minor.yy360, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy536); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 229: /* table_options ::= table_options WATERMARK duration_list */
-#line 438 "sql.y"
-{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy404); }
-#line 6241 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 227: /* table_options ::= table_options TTL NK_INTEGER */
+{ yylhsminor.yy360 = setTableOption(pCxt, yymsp[-2].minor.yy360, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 230: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-#line 439 "sql.y"
-{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-4].minor.yy896, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy404); }
-#line 6247 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ case 228: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+{ yylhsminor.yy360 = setTableOption(pCxt, yymsp[-4].minor.yy360, TABLE_OPTION_SMA, yymsp[-1].minor.yy536); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 231: /* table_options ::= table_options TTL NK_INTEGER */
-#line 440 "sql.y"
-{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
-#line 6253 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 229: /* table_options ::= table_options DELETE_MARK duration_list */
+{ yylhsminor.yy360 = setTableOption(pCxt, yymsp[-2].minor.yy360, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy536); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 232: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-#line 441 "sql.y"
-{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-4].minor.yy896, TABLE_OPTION_SMA, yymsp[-1].minor.yy404); }
-#line 6259 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ case 230: /* alter_table_options ::= alter_table_option */
+{ yylhsminor.yy360 = createAlterTableOptions(pCxt); yylhsminor.yy360 = setTableOption(pCxt, yylhsminor.yy360, yymsp[0].minor.yy797.type, &yymsp[0].minor.yy797.val); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 233: /* table_options ::= table_options DELETE_MARK duration_list */
-#line 442 "sql.y"
-{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy404); }
-#line 6265 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 231: /* alter_table_options ::= alter_table_options alter_table_option */
+{ yylhsminor.yy360 = setTableOption(pCxt, yymsp[-1].minor.yy360, yymsp[0].minor.yy797.type, &yymsp[0].minor.yy797.val); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 234: /* alter_table_options ::= alter_table_option */
-#line 444 "sql.y"
-{ yylhsminor.yy896 = createAlterTableOptions(pCxt); yylhsminor.yy896 = setTableOption(pCxt, yylhsminor.yy896, yymsp[0].minor.yy529.type, &yymsp[0].minor.yy529.val); }
-#line 6271 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 232: /* alter_table_option ::= COMMENT NK_STRING */
+{ yymsp[-1].minor.yy797.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
- case 235: /* alter_table_options ::= alter_table_options alter_table_option */
-#line 445 "sql.y"
-{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-1].minor.yy896, yymsp[0].minor.yy529.type, &yymsp[0].minor.yy529.val); }
-#line 6277 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 233: /* alter_table_option ::= TTL NK_INTEGER */
+{ yymsp[-1].minor.yy797.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy797.val = yymsp[0].minor.yy0; }
break;
- case 236: /* alter_table_option ::= COMMENT NK_STRING */
-#line 449 "sql.y"
-{ yymsp[-1].minor.yy529.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 6283 "sql.c"
+ case 234: /* duration_list ::= duration_literal */
+ case 464: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==464);
+{ yylhsminor.yy536 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy360)); }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
- case 237: /* alter_table_option ::= TTL NK_INTEGER */
-#line 450 "sql.y"
-{ yymsp[-1].minor.yy529.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
-#line 6288 "sql.c"
+ case 235: /* duration_list ::= duration_list NK_COMMA duration_literal */
+ case 465: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==465);
+{ yylhsminor.yy536 = addNodeToList(pCxt, yymsp[-2].minor.yy536, releaseRawExprNode(pCxt, yymsp[0].minor.yy360)); }
+ yymsp[-2].minor.yy536 = yylhsminor.yy536;
break;
- case 238: /* duration_list ::= duration_literal */
- case 468: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==468);
-#line 454 "sql.y"
-{ yylhsminor.yy404 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); }
-#line 6294 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+ case 238: /* rollup_func_name ::= function_name */
+{ yylhsminor.yy360 = createFunctionNode(pCxt, &yymsp[0].minor.yy929, NULL); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 239: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 469: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==469);
-#line 455 "sql.y"
-{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); }
-#line 6301 "sql.c"
- yymsp[-2].minor.yy404 = yylhsminor.yy404;
+ case 239: /* rollup_func_name ::= FIRST */
+ case 240: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==240);
+ case 311: /* tag_item ::= QTAGS */ yytestcase(yyruleno==311);
+{ yylhsminor.yy360 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 242: /* rollup_func_name ::= function_name */
-#line 462 "sql.y"
-{ yylhsminor.yy896 = createFunctionNode(pCxt, &yymsp[0].minor.yy701, NULL); }
-#line 6307 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 243: /* col_name ::= column_name */
+ case 312: /* tag_item ::= column_name */ yytestcase(yyruleno==312);
+{ yylhsminor.yy360 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy929); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 243: /* rollup_func_name ::= FIRST */
- case 244: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==244);
- case 315: /* tag_item ::= QTAGS */ yytestcase(yyruleno==315);
-#line 463 "sql.y"
-{ yylhsminor.yy896 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 6315 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
- break;
- case 247: /* col_name ::= column_name */
- case 316: /* tag_item ::= column_name */ yytestcase(yyruleno==316);
-#line 471 "sql.y"
-{ yylhsminor.yy896 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy701); }
-#line 6322 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
- break;
- case 248: /* cmd ::= SHOW DNODES */
-#line 474 "sql.y"
+ case 244: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
-#line 6328 "sql.c"
break;
- case 249: /* cmd ::= SHOW USERS */
-#line 475 "sql.y"
+ case 245: /* cmd ::= SHOW USERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
-#line 6333 "sql.c"
break;
- case 250: /* cmd ::= SHOW USER PRIVILEGES */
-#line 476 "sql.y"
+ case 246: /* cmd ::= SHOW USER PRIVILEGES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
-#line 6338 "sql.c"
break;
- case 251: /* cmd ::= SHOW db_kind_opt DATABASES */
-#line 477 "sql.y"
+ case 247: /* cmd ::= SHOW db_kind_opt DATABASES */
{
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
- setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy705);
+ setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy321);
}
-#line 6346 "sql.c"
break;
- case 252: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
-#line 481 "sql.y"
+ case 248: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
{
- pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy989, yymsp[0].minor.yy896, OP_TYPE_LIKE);
+ pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy1005, yymsp[0].minor.yy360, OP_TYPE_LIKE);
}
-#line 6353 "sql.c"
break;
- case 253: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-#line 484 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy896, yymsp[0].minor.yy896, OP_TYPE_LIKE); }
-#line 6358 "sql.c"
+ case 249: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy360, yymsp[0].minor.yy360, OP_TYPE_LIKE); }
break;
- case 254: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-#line 485 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy896, NULL, OP_TYPE_LIKE); }
-#line 6363 "sql.c"
+ case 250: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy360, NULL, OP_TYPE_LIKE); }
break;
- case 255: /* cmd ::= SHOW MNODES */
-#line 486 "sql.y"
+ case 251: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
-#line 6368 "sql.c"
break;
- case 256: /* cmd ::= SHOW QNODES */
-#line 488 "sql.y"
+ case 252: /* cmd ::= SHOW QNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
-#line 6373 "sql.c"
break;
- case 257: /* cmd ::= SHOW FUNCTIONS */
-#line 489 "sql.y"
+ case 253: /* cmd ::= SHOW FUNCTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
-#line 6378 "sql.c"
break;
- case 258: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-#line 490 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy896, yymsp[-1].minor.yy896, OP_TYPE_EQUAL); }
-#line 6383 "sql.c"
+ case 254: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy360, yymsp[-1].minor.yy360, OP_TYPE_EQUAL); }
break;
- case 259: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
-#line 491 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy701), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701), OP_TYPE_EQUAL); }
-#line 6388 "sql.c"
+ case 255: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy929), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy929), OP_TYPE_EQUAL); }
break;
- case 260: /* cmd ::= SHOW STREAMS */
-#line 492 "sql.y"
+ case 256: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
-#line 6393 "sql.c"
break;
- case 261: /* cmd ::= SHOW ACCOUNTS */
-#line 493 "sql.y"
+ case 257: /* cmd ::= SHOW ACCOUNTS */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 6398 "sql.c"
break;
- case 262: /* cmd ::= SHOW APPS */
-#line 494 "sql.y"
+ case 258: /* cmd ::= SHOW APPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); }
-#line 6403 "sql.c"
break;
- case 263: /* cmd ::= SHOW CONNECTIONS */
-#line 495 "sql.y"
+ case 259: /* cmd ::= SHOW CONNECTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
-#line 6408 "sql.c"
break;
- case 264: /* cmd ::= SHOW LICENCES */
- case 265: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==265);
-#line 496 "sql.y"
+ case 260: /* cmd ::= SHOW LICENCES */
+ case 261: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==261);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
-#line 6414 "sql.c"
break;
- case 266: /* cmd ::= SHOW GRANTS FULL */
-#line 498 "sql.y"
+ case 262: /* cmd ::= SHOW GRANTS FULL */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); }
-#line 6419 "sql.c"
break;
- case 267: /* cmd ::= SHOW GRANTS LOGS */
-#line 499 "sql.y"
+ case 263: /* cmd ::= SHOW GRANTS LOGS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); }
-#line 6424 "sql.c"
break;
- case 268: /* cmd ::= SHOW CLUSTER MACHINES */
-#line 500 "sql.y"
+ case 264: /* cmd ::= SHOW CLUSTER MACHINES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); }
-#line 6429 "sql.c"
break;
- case 269: /* cmd ::= SHOW CREATE DATABASE db_name */
-#line 501 "sql.y"
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy701); }
-#line 6434 "sql.c"
+ case 265: /* cmd ::= SHOW CREATE DATABASE db_name */
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy929); }
break;
- case 270: /* cmd ::= SHOW CREATE TABLE full_table_name */
-#line 502 "sql.y"
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy896); }
-#line 6439 "sql.c"
+ case 266: /* cmd ::= SHOW CREATE TABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy360); }
break;
- case 271: /* cmd ::= SHOW CREATE STABLE full_table_name */
-#line 503 "sql.y"
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy896); }
-#line 6444 "sql.c"
+ case 267: /* cmd ::= SHOW CREATE STABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy360); }
break;
- case 272: /* cmd ::= SHOW QUERIES */
-#line 504 "sql.y"
+ case 268: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
-#line 6449 "sql.c"
break;
- case 273: /* cmd ::= SHOW SCORES */
-#line 505 "sql.y"
+ case 269: /* cmd ::= SHOW SCORES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
-#line 6454 "sql.c"
break;
- case 274: /* cmd ::= SHOW TOPICS */
-#line 506 "sql.y"
+ case 270: /* cmd ::= SHOW TOPICS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
-#line 6459 "sql.c"
break;
- case 275: /* cmd ::= SHOW VARIABLES */
- case 276: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==276);
-#line 507 "sql.y"
+ case 271: /* cmd ::= SHOW VARIABLES */
+ case 272: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==272);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
-#line 6465 "sql.c"
break;
- case 277: /* cmd ::= SHOW LOCAL VARIABLES */
-#line 509 "sql.y"
+ case 273: /* cmd ::= SHOW LOCAL VARIABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
-#line 6470 "sql.c"
break;
- case 278: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
-#line 510 "sql.y"
-{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy896); }
-#line 6475 "sql.c"
+ case 274: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy360); }
break;
- case 279: /* cmd ::= SHOW BNODES */
-#line 511 "sql.y"
+ case 275: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
-#line 6480 "sql.c"
break;
- case 280: /* cmd ::= SHOW SNODES */
-#line 512 "sql.y"
+ case 276: /* cmd ::= SHOW SNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
-#line 6485 "sql.c"
break;
- case 281: /* cmd ::= SHOW CLUSTER */
-#line 513 "sql.y"
+ case 277: /* cmd ::= SHOW CLUSTER */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
-#line 6490 "sql.c"
break;
- case 282: /* cmd ::= SHOW TRANSACTIONS */
-#line 514 "sql.y"
+ case 278: /* cmd ::= SHOW TRANSACTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
-#line 6495 "sql.c"
break;
- case 283: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-#line 515 "sql.y"
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy896); }
-#line 6500 "sql.c"
+ case 279: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy360); }
break;
- case 284: /* cmd ::= SHOW CONSUMERS */
-#line 516 "sql.y"
+ case 280: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
-#line 6505 "sql.c"
break;
- case 285: /* cmd ::= SHOW SUBSCRIPTIONS */
-#line 517 "sql.y"
+ case 281: /* cmd ::= SHOW SUBSCRIPTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
-#line 6510 "sql.c"
break;
- case 286: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-#line 518 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy896, yymsp[-1].minor.yy896, OP_TYPE_EQUAL); }
-#line 6515 "sql.c"
+ case 282: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy360, yymsp[-1].minor.yy360, OP_TYPE_EQUAL); }
break;
- case 287: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
-#line 519 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy701), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701), OP_TYPE_EQUAL); }
-#line 6520 "sql.c"
+ case 283: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy929), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy929), OP_TYPE_EQUAL); }
break;
- case 288: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
-#line 520 "sql.y"
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy896, yymsp[0].minor.yy896, yymsp[-3].minor.yy404); }
-#line 6525 "sql.c"
+ case 284: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy360, yymsp[0].minor.yy360, yymsp[-3].minor.yy536); }
break;
- case 289: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
-#line 521 "sql.y"
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy701), yymsp[-4].minor.yy404); }
-#line 6530 "sql.c"
+ case 285: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy929), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy929), yymsp[-4].minor.yy536); }
break;
- case 290: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
-#line 522 "sql.y"
+ case 286: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
-#line 6535 "sql.c"
break;
- case 291: /* cmd ::= SHOW VNODES */
-#line 523 "sql.y"
+ case 287: /* cmd ::= SHOW VNODES */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); }
-#line 6540 "sql.c"
break;
- case 292: /* cmd ::= SHOW db_name_cond_opt ALIVE */
-#line 525 "sql.y"
-{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy896, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
-#line 6545 "sql.c"
+ case 288: /* cmd ::= SHOW db_name_cond_opt ALIVE */
+{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy360, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
break;
- case 293: /* cmd ::= SHOW CLUSTER ALIVE */
-#line 526 "sql.y"
+ case 289: /* cmd ::= SHOW CLUSTER ALIVE */
{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
-#line 6550 "sql.c"
break;
- case 294: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
-#line 527 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy896, yymsp[0].minor.yy896, OP_TYPE_LIKE); }
-#line 6555 "sql.c"
+ case 290: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy360, yymsp[0].minor.yy360, OP_TYPE_LIKE); }
break;
- case 295: /* cmd ::= SHOW CREATE VIEW full_table_name */
-#line 528 "sql.y"
-{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy896); }
-#line 6560 "sql.c"
+ case 291: /* cmd ::= SHOW CREATE VIEW full_table_name */
+{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy360); }
break;
- case 296: /* cmd ::= SHOW COMPACTS */
-#line 529 "sql.y"
+ case 292: /* cmd ::= SHOW COMPACTS */
{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); }
-#line 6565 "sql.c"
break;
- case 297: /* cmd ::= SHOW COMPACT NK_INTEGER */
-#line 530 "sql.y"
+ case 293: /* cmd ::= SHOW COMPACT NK_INTEGER */
{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 6570 "sql.c"
break;
- case 298: /* table_kind_db_name_cond_opt ::= */
-#line 534 "sql.y"
-{ yymsp[1].minor.yy989.kind = SHOW_KIND_ALL; yymsp[1].minor.yy989.dbName = nil_token; }
-#line 6575 "sql.c"
+ case 294: /* table_kind_db_name_cond_opt ::= */
+{ yymsp[1].minor.yy1005.kind = SHOW_KIND_ALL; yymsp[1].minor.yy1005.dbName = nil_token; }
break;
- case 299: /* table_kind_db_name_cond_opt ::= table_kind */
-#line 535 "sql.y"
-{ yylhsminor.yy989.kind = yymsp[0].minor.yy705; yylhsminor.yy989.dbName = nil_token; }
-#line 6580 "sql.c"
- yymsp[0].minor.yy989 = yylhsminor.yy989;
+ case 295: /* table_kind_db_name_cond_opt ::= table_kind */
+{ yylhsminor.yy1005.kind = yymsp[0].minor.yy321; yylhsminor.yy1005.dbName = nil_token; }
+ yymsp[0].minor.yy1005 = yylhsminor.yy1005;
break;
- case 300: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */
-#line 536 "sql.y"
-{ yylhsminor.yy989.kind = SHOW_KIND_ALL; yylhsminor.yy989.dbName = yymsp[-1].minor.yy701; }
-#line 6586 "sql.c"
- yymsp[-1].minor.yy989 = yylhsminor.yy989;
+ case 296: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy1005.kind = SHOW_KIND_ALL; yylhsminor.yy1005.dbName = yymsp[-1].minor.yy929; }
+ yymsp[-1].minor.yy1005 = yylhsminor.yy1005;
break;
- case 301: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
-#line 537 "sql.y"
-{ yylhsminor.yy989.kind = yymsp[-2].minor.yy705; yylhsminor.yy989.dbName = yymsp[-1].minor.yy701; }
-#line 6592 "sql.c"
- yymsp[-2].minor.yy989 = yylhsminor.yy989;
+ case 297: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+{ yylhsminor.yy1005.kind = yymsp[-2].minor.yy321; yylhsminor.yy1005.dbName = yymsp[-1].minor.yy929; }
+ yymsp[-2].minor.yy1005 = yylhsminor.yy1005;
break;
- case 302: /* table_kind ::= NORMAL */
-#line 541 "sql.y"
-{ yymsp[0].minor.yy705 = SHOW_KIND_TABLES_NORMAL; }
-#line 6598 "sql.c"
+ case 298: /* table_kind ::= NORMAL */
+{ yymsp[0].minor.yy321 = SHOW_KIND_TABLES_NORMAL; }
break;
- case 303: /* table_kind ::= CHILD */
-#line 542 "sql.y"
-{ yymsp[0].minor.yy705 = SHOW_KIND_TABLES_CHILD; }
-#line 6603 "sql.c"
+ case 299: /* table_kind ::= CHILD */
+{ yymsp[0].minor.yy321 = SHOW_KIND_TABLES_CHILD; }
break;
- case 304: /* db_name_cond_opt ::= */
- case 309: /* from_db_opt ::= */ yytestcase(yyruleno==309);
-#line 544 "sql.y"
-{ yymsp[1].minor.yy896 = createDefaultDatabaseCondValue(pCxt); }
-#line 6609 "sql.c"
+ case 300: /* db_name_cond_opt ::= */
+ case 305: /* from_db_opt ::= */ yytestcase(yyruleno==305);
+{ yymsp[1].minor.yy360 = createDefaultDatabaseCondValue(pCxt); }
break;
- case 305: /* db_name_cond_opt ::= db_name NK_DOT */
-#line 545 "sql.y"
-{ yylhsminor.yy896 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy701); }
-#line 6614 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 301: /* db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy360 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy929); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 307: /* like_pattern_opt ::= LIKE NK_STRING */
-#line 548 "sql.y"
-{ yymsp[-1].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
-#line 6620 "sql.c"
+ case 303: /* like_pattern_opt ::= LIKE NK_STRING */
+{ yymsp[-1].minor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
- case 308: /* table_name_cond ::= table_name */
-#line 550 "sql.y"
-{ yylhsminor.yy896 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701); }
-#line 6625 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 304: /* table_name_cond ::= table_name */
+{ yylhsminor.yy360 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy929); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 310: /* from_db_opt ::= FROM db_name */
-#line 553 "sql.y"
-{ yymsp[-1].minor.yy896 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701); }
-#line 6631 "sql.c"
+ case 306: /* from_db_opt ::= FROM db_name */
+{ yymsp[-1].minor.yy360 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy929); }
break;
- case 314: /* tag_item ::= TBNAME */
-#line 561 "sql.y"
-{ yylhsminor.yy896 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
-#line 6636 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 310: /* tag_item ::= TBNAME */
+{ yylhsminor.yy360 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 317: /* tag_item ::= column_name column_alias */
-#line 564 "sql.y"
-{ yylhsminor.yy896 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy701), &yymsp[0].minor.yy701); }
-#line 6642 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 313: /* tag_item ::= column_name column_alias */
+{ yylhsminor.yy360 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy929), &yymsp[0].minor.yy929); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 318: /* tag_item ::= column_name AS column_alias */
-#line 565 "sql.y"
-{ yylhsminor.yy896 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy701), &yymsp[0].minor.yy701); }
-#line 6648 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 314: /* tag_item ::= column_name AS column_alias */
+{ yylhsminor.yy360 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy929), &yymsp[0].minor.yy929); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 319: /* db_kind_opt ::= */
-#line 569 "sql.y"
-{ yymsp[1].minor.yy705 = SHOW_KIND_ALL; }
-#line 6654 "sql.c"
+ case 315: /* db_kind_opt ::= */
+{ yymsp[1].minor.yy321 = SHOW_KIND_ALL; }
break;
- case 320: /* db_kind_opt ::= USER */
-#line 570 "sql.y"
-{ yymsp[0].minor.yy705 = SHOW_KIND_DATABASES_USER; }
-#line 6659 "sql.c"
+ case 316: /* db_kind_opt ::= USER */
+{ yymsp[0].minor.yy321 = SHOW_KIND_DATABASES_USER; }
break;
- case 321: /* db_kind_opt ::= SYSTEM */
-#line 571 "sql.y"
-{ yymsp[0].minor.yy705 = SHOW_KIND_DATABASES_SYSTEM; }
-#line 6664 "sql.c"
+ case 317: /* db_kind_opt ::= SYSTEM */
+{ yymsp[0].minor.yy321 = SHOW_KIND_DATABASES_SYSTEM; }
break;
- case 322: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
-#line 575 "sql.y"
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy733, yymsp[-3].minor.yy896, yymsp[-1].minor.yy896, NULL, yymsp[0].minor.yy896); }
-#line 6669 "sql.c"
+ case 318: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy345, yymsp[-3].minor.yy360, yymsp[-1].minor.yy360, NULL, yymsp[0].minor.yy360); }
break;
- case 323: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
-#line 577 "sql.y"
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy733, yymsp[-5].minor.yy896, yymsp[-3].minor.yy896, yymsp[-1].minor.yy404, NULL); }
-#line 6674 "sql.c"
+ case 319: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy345, yymsp[-5].minor.yy360, yymsp[-3].minor.yy360, yymsp[-1].minor.yy536, NULL); }
break;
- case 324: /* cmd ::= DROP INDEX exists_opt full_index_name */
-#line 578 "sql.y"
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy733, yymsp[0].minor.yy896); }
-#line 6679 "sql.c"
+ case 320: /* cmd ::= DROP INDEX exists_opt full_index_name */
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy345, yymsp[0].minor.yy360); }
break;
- case 325: /* full_index_name ::= index_name */
-#line 580 "sql.y"
-{ yylhsminor.yy896 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy701); }
-#line 6684 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 321: /* full_index_name ::= index_name */
+{ yylhsminor.yy360 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy929); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 326: /* full_index_name ::= db_name NK_DOT index_name */
-#line 581 "sql.y"
-{ yylhsminor.yy896 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701); }
-#line 6690 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 322: /* full_index_name ::= db_name NK_DOT index_name */
+{ yylhsminor.yy360 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy929); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 327: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-#line 584 "sql.y"
-{ yymsp[-9].minor.yy896 = createIndexOption(pCxt, yymsp[-7].minor.yy404, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), NULL, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); }
-#line 6696 "sql.c"
+ case 323: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+{ yymsp[-9].minor.yy360 = createIndexOption(pCxt, yymsp[-7].minor.yy536, releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), NULL, yymsp[-1].minor.yy360, yymsp[0].minor.yy360); }
break;
- case 328: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
-#line 587 "sql.y"
-{ yymsp[-11].minor.yy896 = createIndexOption(pCxt, yymsp[-9].minor.yy404, releaseRawExprNode(pCxt, yymsp[-5].minor.yy896), releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), yymsp[-1].minor.yy896, yymsp[0].minor.yy896); }
-#line 6701 "sql.c"
+ case 324: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
+{ yymsp[-11].minor.yy360 = createIndexOption(pCxt, yymsp[-9].minor.yy536, releaseRawExprNode(pCxt, yymsp[-5].minor.yy360), releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), yymsp[-1].minor.yy360, yymsp[0].minor.yy360); }
break;
- case 331: /* func ::= sma_func_name NK_LP expression_list NK_RP */
-#line 594 "sql.y"
-{ yylhsminor.yy896 = createFunctionNode(pCxt, &yymsp[-3].minor.yy701, yymsp[-1].minor.yy404); }
-#line 6706 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 327: /* func ::= sma_func_name NK_LP expression_list NK_RP */
+{ yylhsminor.yy360 = createFunctionNode(pCxt, &yymsp[-3].minor.yy929, yymsp[-1].minor.yy536); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 332: /* sma_func_name ::= function_name */
- case 557: /* alias_opt ::= table_alias */ yytestcase(yyruleno==557);
-#line 598 "sql.y"
-{ yylhsminor.yy701 = yymsp[0].minor.yy701; }
-#line 6713 "sql.c"
- yymsp[0].minor.yy701 = yylhsminor.yy701;
+ case 328: /* sma_func_name ::= function_name */
+ case 553: /* alias_opt ::= table_alias */ yytestcase(yyruleno==553);
+{ yylhsminor.yy929 = yymsp[0].minor.yy929; }
+ yymsp[0].minor.yy929 = yylhsminor.yy929;
break;
- case 337: /* sma_stream_opt ::= */
- case 382: /* stream_options ::= */ yytestcase(yyruleno==382);
-#line 604 "sql.y"
-{ yymsp[1].minor.yy896 = createStreamOptions(pCxt); }
-#line 6720 "sql.c"
+ case 333: /* sma_stream_opt ::= */
+ case 378: /* stream_options ::= */ yytestcase(yyruleno==378);
+{ yymsp[1].minor.yy360 = createStreamOptions(pCxt); }
break;
- case 338: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
-#line 605 "sql.y"
-{ ((SStreamOptions*)yymsp[-2].minor.yy896)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); yylhsminor.yy896 = yymsp[-2].minor.yy896; }
-#line 6725 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 334: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy360)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy360); yylhsminor.yy360 = yymsp[-2].minor.yy360; }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 339: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
-#line 606 "sql.y"
-{ ((SStreamOptions*)yymsp[-2].minor.yy896)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); yylhsminor.yy896 = yymsp[-2].minor.yy896; }
-#line 6731 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 335: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy360)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy360); yylhsminor.yy360 = yymsp[-2].minor.yy360; }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 340: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
-#line 607 "sql.y"
-{ ((SStreamOptions*)yymsp[-2].minor.yy896)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); yylhsminor.yy896 = yymsp[-2].minor.yy896; }
-#line 6737 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 336: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy360)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy360); yylhsminor.yy360 = yymsp[-2].minor.yy360; }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 341: /* with_meta ::= AS */
-#line 612 "sql.y"
-{ yymsp[0].minor.yy396 = 0; }
-#line 6743 "sql.c"
+ case 337: /* with_meta ::= AS */
+{ yymsp[0].minor.yy580 = 0; }
break;
- case 342: /* with_meta ::= WITH META AS */
-#line 613 "sql.y"
-{ yymsp[-2].minor.yy396 = 1; }
-#line 6748 "sql.c"
+ case 338: /* with_meta ::= WITH META AS */
+{ yymsp[-2].minor.yy580 = 1; }
break;
- case 343: /* with_meta ::= ONLY META AS */
-#line 614 "sql.y"
-{ yymsp[-2].minor.yy396 = 2; }
-#line 6753 "sql.c"
+ case 339: /* with_meta ::= ONLY META AS */
+{ yymsp[-2].minor.yy580 = 2; }
break;
- case 344: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-#line 616 "sql.y"
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy733, &yymsp[-2].minor.yy701, yymsp[0].minor.yy896); }
-#line 6758 "sql.c"
+ case 340: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy345, &yymsp[-2].minor.yy929, yymsp[0].minor.yy360); }
break;
- case 345: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
-#line 618 "sql.y"
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy733, &yymsp[-3].minor.yy701, &yymsp[0].minor.yy701, yymsp[-2].minor.yy396); }
-#line 6763 "sql.c"
+ case 341: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy345, &yymsp[-3].minor.yy929, &yymsp[0].minor.yy929, yymsp[-2].minor.yy580); }
break;
- case 346: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
-#line 620 "sql.y"
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy733, &yymsp[-4].minor.yy701, yymsp[-1].minor.yy896, yymsp[-3].minor.yy396, yymsp[0].minor.yy896); }
-#line 6768 "sql.c"
+ case 342: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy345, &yymsp[-4].minor.yy929, yymsp[-1].minor.yy360, yymsp[-3].minor.yy580, yymsp[0].minor.yy360); }
break;
- case 347: /* cmd ::= DROP TOPIC exists_opt topic_name */
-#line 622 "sql.y"
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); }
-#line 6773 "sql.c"
+ case 343: /* cmd ::= DROP TOPIC exists_opt topic_name */
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy345, &yymsp[0].minor.yy929); }
break;
- case 348: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-#line 623 "sql.y"
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy733, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701); }
-#line 6778 "sql.c"
+ case 344: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy345, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy929); }
break;
- case 349: /* cmd ::= DESC full_table_name */
- case 350: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==350);
-#line 626 "sql.y"
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy896); }
-#line 6784 "sql.c"
+ case 345: /* cmd ::= DESC full_table_name */
+ case 346: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==346);
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy360); }
break;
- case 351: /* cmd ::= RESET QUERY CACHE */
-#line 630 "sql.y"
+ case 347: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
-#line 6789 "sql.c"
break;
- case 352: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- case 353: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==353);
-#line 633 "sql.y"
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy733, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); }
-#line 6795 "sql.c"
+ case 348: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ case 349: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==349);
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy345, yymsp[-1].minor.yy360, yymsp[0].minor.yy360); }
break;
- case 356: /* explain_options ::= */
-#line 641 "sql.y"
-{ yymsp[1].minor.yy896 = createDefaultExplainOptions(pCxt); }
-#line 6800 "sql.c"
+ case 352: /* explain_options ::= */
+{ yymsp[1].minor.yy360 = createDefaultExplainOptions(pCxt); }
break;
- case 357: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-#line 642 "sql.y"
-{ yylhsminor.yy896 = setExplainVerbose(pCxt, yymsp[-2].minor.yy896, &yymsp[0].minor.yy0); }
-#line 6805 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 353: /* explain_options ::= explain_options VERBOSE NK_BOOL */
+{ yylhsminor.yy360 = setExplainVerbose(pCxt, yymsp[-2].minor.yy360, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 358: /* explain_options ::= explain_options RATIO NK_FLOAT */
-#line 643 "sql.y"
-{ yylhsminor.yy896 = setExplainRatio(pCxt, yymsp[-2].minor.yy896, &yymsp[0].minor.yy0); }
-#line 6811 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 354: /* explain_options ::= explain_options RATIO NK_FLOAT */
+{ yylhsminor.yy360 = setExplainRatio(pCxt, yymsp[-2].minor.yy360, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 359: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
-#line 648 "sql.y"
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy733, yymsp[-9].minor.yy733, &yymsp[-6].minor.yy701, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy504, yymsp[-1].minor.yy396, &yymsp[0].minor.yy701, yymsp[-10].minor.yy733); }
-#line 6817 "sql.c"
+ case 355: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy345, yymsp[-9].minor.yy345, &yymsp[-6].minor.yy929, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy912, yymsp[-1].minor.yy580, &yymsp[0].minor.yy929, yymsp[-10].minor.yy345); }
break;
- case 360: /* cmd ::= DROP FUNCTION exists_opt function_name */
-#line 649 "sql.y"
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); }
-#line 6822 "sql.c"
+ case 356: /* cmd ::= DROP FUNCTION exists_opt function_name */
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy345, &yymsp[0].minor.yy929); }
break;
- case 365: /* language_opt ::= */
- case 404: /* on_vgroup_id ::= */ yytestcase(yyruleno==404);
-#line 663 "sql.y"
-{ yymsp[1].minor.yy701 = nil_token; }
-#line 6828 "sql.c"
+ case 361: /* language_opt ::= */
+ case 400: /* on_vgroup_id ::= */ yytestcase(yyruleno==400);
+{ yymsp[1].minor.yy929 = nil_token; }
break;
- case 366: /* language_opt ::= LANGUAGE NK_STRING */
- case 405: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==405);
-#line 664 "sql.y"
-{ yymsp[-1].minor.yy701 = yymsp[0].minor.yy0; }
-#line 6834 "sql.c"
+ case 362: /* language_opt ::= LANGUAGE NK_STRING */
+ case 401: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==401);
+{ yymsp[-1].minor.yy929 = yymsp[0].minor.yy0; }
break;
- case 369: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
-#line 673 "sql.y"
-{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy733, yymsp[-2].minor.yy896, &yymsp[-1].minor.yy0, yymsp[0].minor.yy896); }
-#line 6839 "sql.c"
+ case 365: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy345, yymsp[-2].minor.yy360, &yymsp[-1].minor.yy0, yymsp[0].minor.yy360); }
break;
- case 370: /* cmd ::= DROP VIEW exists_opt full_view_name */
-#line 674 "sql.y"
-{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy733, yymsp[0].minor.yy896); }
-#line 6844 "sql.c"
+ case 366: /* cmd ::= DROP VIEW exists_opt full_view_name */
+{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy345, yymsp[0].minor.yy360); }
break;
- case 371: /* full_view_name ::= view_name */
-#line 676 "sql.y"
-{ yylhsminor.yy896 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy701); }
-#line 6849 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 367: /* full_view_name ::= view_name */
+{ yylhsminor.yy360 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy929); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 372: /* full_view_name ::= db_name NK_DOT view_name */
-#line 677 "sql.y"
-{ yylhsminor.yy896 = createViewNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701); }
-#line 6855 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 368: /* full_view_name ::= db_name NK_DOT view_name */
+{ yylhsminor.yy360 = createViewNode(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy929); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 373: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
-#line 682 "sql.y"
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy733, &yymsp[-8].minor.yy701, yymsp[-5].minor.yy896, yymsp[-7].minor.yy896, yymsp[-3].minor.yy404, yymsp[-2].minor.yy896, yymsp[0].minor.yy896, yymsp[-4].minor.yy404); }
-#line 6861 "sql.c"
+ case 369: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy345, &yymsp[-8].minor.yy929, yymsp[-5].minor.yy360, yymsp[-7].minor.yy360, yymsp[-3].minor.yy536, yymsp[-2].minor.yy360, yymsp[0].minor.yy360, yymsp[-4].minor.yy536); }
break;
- case 374: /* cmd ::= DROP STREAM exists_opt stream_name */
-#line 683 "sql.y"
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); }
-#line 6866 "sql.c"
+ case 370: /* cmd ::= DROP STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy345, &yymsp[0].minor.yy929); }
break;
- case 375: /* cmd ::= PAUSE STREAM exists_opt stream_name */
-#line 684 "sql.y"
-{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); }
-#line 6871 "sql.c"
+ case 371: /* cmd ::= PAUSE STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy345, &yymsp[0].minor.yy929); }
break;
- case 376: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
-#line 685 "sql.y"
-{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy733, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); }
-#line 6876 "sql.c"
+ case 372: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy345, yymsp[-1].minor.yy345, &yymsp[0].minor.yy929); }
break;
- case 383: /* stream_options ::= stream_options TRIGGER AT_ONCE */
- case 384: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==384);
-#line 699 "sql.y"
-{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-2].minor.yy896, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6882 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 379: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+ case 380: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==380);
+{ yylhsminor.yy360 = setStreamOptions(pCxt, yymsp[-2].minor.yy360, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 385: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-#line 701 "sql.y"
-{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-3].minor.yy896, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); }
-#line 6888 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 381: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+{ yylhsminor.yy360 = setStreamOptions(pCxt, yymsp[-3].minor.yy360, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy360)); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 386: /* stream_options ::= stream_options WATERMARK duration_literal */
-#line 702 "sql.y"
-{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-2].minor.yy896, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); }
-#line 6894 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 382: /* stream_options ::= stream_options WATERMARK duration_literal */
+{ yylhsminor.yy360 = setStreamOptions(pCxt, yymsp[-2].minor.yy360, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy360)); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 387: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-#line 703 "sql.y"
-{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-3].minor.yy896, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6900 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 383: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+{ yylhsminor.yy360 = setStreamOptions(pCxt, yymsp[-3].minor.yy360, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 388: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
-#line 704 "sql.y"
-{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-2].minor.yy896, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6906 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 384: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+{ yylhsminor.yy360 = setStreamOptions(pCxt, yymsp[-2].minor.yy360, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 389: /* stream_options ::= stream_options DELETE_MARK duration_literal */
-#line 705 "sql.y"
-{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-2].minor.yy896, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); }
-#line 6912 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 385: /* stream_options ::= stream_options DELETE_MARK duration_literal */
+{ yylhsminor.yy360 = setStreamOptions(pCxt, yymsp[-2].minor.yy360, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy360)); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 390: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
-#line 706 "sql.y"
-{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-3].minor.yy896, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6918 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 386: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+{ yylhsminor.yy360 = setStreamOptions(pCxt, yymsp[-3].minor.yy360, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 392: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- case 597: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==597);
- case 621: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==621);
-#line 709 "sql.y"
-{ yymsp[-3].minor.yy896 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy896); }
-#line 6926 "sql.c"
+ case 388: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ case 593: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==593);
+ case 617: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==617);
+{ yymsp[-3].minor.yy360 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy360); }
break;
- case 395: /* cmd ::= KILL CONNECTION NK_INTEGER */
-#line 717 "sql.y"
+ case 391: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
-#line 6931 "sql.c"
break;
- case 396: /* cmd ::= KILL QUERY NK_STRING */
-#line 718 "sql.y"
+ case 392: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
-#line 6936 "sql.c"
break;
- case 397: /* cmd ::= KILL TRANSACTION NK_INTEGER */
-#line 719 "sql.y"
+ case 393: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
-#line 6941 "sql.c"
break;
- case 398: /* cmd ::= KILL COMPACT NK_INTEGER */
-#line 720 "sql.y"
+ case 394: /* cmd ::= KILL COMPACT NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); }
-#line 6946 "sql.c"
break;
- case 399: /* cmd ::= BALANCE VGROUP */
-#line 723 "sql.y"
+ case 395: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
-#line 6951 "sql.c"
break;
- case 400: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
-#line 724 "sql.y"
-{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy701); }
-#line 6956 "sql.c"
+ case 396: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy929); }
break;
- case 401: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
-#line 725 "sql.y"
+ case 397: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 6961 "sql.c"
break;
- case 402: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-#line 726 "sql.y"
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy404); }
-#line 6966 "sql.c"
+ case 398: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy536); }
break;
- case 403: /* cmd ::= SPLIT VGROUP NK_INTEGER */
-#line 727 "sql.y"
+ case 399: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
-#line 6971 "sql.c"
break;
- case 406: /* dnode_list ::= DNODE NK_INTEGER */
-#line 736 "sql.y"
-{ yymsp[-1].minor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 6976 "sql.c"
+ case 402: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy536 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
- case 408: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-#line 743 "sql.y"
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); }
-#line 6981 "sql.c"
+ case 404: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy360, yymsp[0].minor.yy360); }
break;
- case 411: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-#line 752 "sql.y"
-{ yymsp[-6].minor.yy896 = createInsertStmt(pCxt, yymsp[-4].minor.yy896, yymsp[-2].minor.yy404, yymsp[0].minor.yy896); }
-#line 6986 "sql.c"
+ case 407: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+{ yymsp[-6].minor.yy360 = createInsertStmt(pCxt, yymsp[-4].minor.yy360, yymsp[-2].minor.yy536, yymsp[0].minor.yy360); }
break;
- case 412: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
-#line 753 "sql.y"
-{ yymsp[-3].minor.yy896 = createInsertStmt(pCxt, yymsp[-1].minor.yy896, NULL, yymsp[0].minor.yy896); }
-#line 6991 "sql.c"
+ case 408: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
+{ yymsp[-3].minor.yy360 = createInsertStmt(pCxt, yymsp[-1].minor.yy360, NULL, yymsp[0].minor.yy360); }
break;
- case 413: /* literal ::= NK_INTEGER */
-#line 756 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
-#line 6996 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 409: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 414: /* literal ::= NK_FLOAT */
-#line 757 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
-#line 7002 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 410: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 415: /* literal ::= NK_STRING */
-#line 758 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
-#line 7008 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 411: /* literal ::= NK_STRING */
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 416: /* literal ::= NK_BOOL */
-#line 759 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
-#line 7014 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 412: /* literal ::= NK_BOOL */
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 417: /* literal ::= TIMESTAMP NK_STRING */
-#line 760 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
-#line 7020 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 413: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 418: /* literal ::= duration_literal */
- case 428: /* signed_literal ::= signed */ yytestcase(yyruleno==428);
- case 451: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==451);
- case 452: /* expression ::= literal */ yytestcase(yyruleno==452);
- case 454: /* expression ::= column_reference */ yytestcase(yyruleno==454);
- case 455: /* expression ::= function_expression */ yytestcase(yyruleno==455);
- case 456: /* expression ::= case_when_expression */ yytestcase(yyruleno==456);
- case 489: /* function_expression ::= literal_func */ yytestcase(yyruleno==489);
- case 538: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==538);
- case 542: /* boolean_primary ::= predicate */ yytestcase(yyruleno==542);
- case 544: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==544);
- case 545: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==545);
- case 548: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==548);
- case 550: /* table_reference ::= table_primary */ yytestcase(yyruleno==550);
- case 551: /* table_reference ::= joined_table */ yytestcase(yyruleno==551);
- case 555: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==555);
- case 623: /* query_simple ::= query_specification */ yytestcase(yyruleno==623);
- case 624: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==624);
- case 627: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==627);
- case 629: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==629);
-#line 761 "sql.y"
-{ yylhsminor.yy896 = yymsp[0].minor.yy896; }
-#line 7045 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 414: /* literal ::= duration_literal */
+ case 424: /* signed_literal ::= signed */ yytestcase(yyruleno==424);
+ case 447: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==447);
+ case 448: /* expression ::= literal */ yytestcase(yyruleno==448);
+ case 450: /* expression ::= column_reference */ yytestcase(yyruleno==450);
+ case 451: /* expression ::= function_expression */ yytestcase(yyruleno==451);
+ case 452: /* expression ::= case_when_expression */ yytestcase(yyruleno==452);
+ case 485: /* function_expression ::= literal_func */ yytestcase(yyruleno==485);
+ case 534: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==534);
+ case 538: /* boolean_primary ::= predicate */ yytestcase(yyruleno==538);
+ case 540: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==540);
+ case 541: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==541);
+ case 544: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==544);
+ case 546: /* table_reference ::= table_primary */ yytestcase(yyruleno==546);
+ case 547: /* table_reference ::= joined_table */ yytestcase(yyruleno==547);
+ case 551: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==551);
+ case 619: /* query_simple ::= query_specification */ yytestcase(yyruleno==619);
+ case 620: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==620);
+ case 623: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==623);
+ case 625: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==625);
+{ yylhsminor.yy360 = yymsp[0].minor.yy360; }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 419: /* literal ::= NULL */
-#line 762 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
-#line 7051 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 415: /* literal ::= NULL */
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 420: /* literal ::= NK_QUESTION */
-#line 763 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 7057 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 416: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 421: /* duration_literal ::= NK_VARIABLE */
- case 598: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==598);
- case 599: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==599);
- case 600: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==600);
-#line 765 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 7066 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 417: /* duration_literal ::= NK_VARIABLE */
+ case 594: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==594);
+ case 595: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==595);
+ case 596: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==596);
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 422: /* signed ::= NK_INTEGER */
-#line 767 "sql.y"
-{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
-#line 7072 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 418: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 423: /* signed ::= NK_PLUS NK_INTEGER */
-#line 768 "sql.y"
-{ yymsp[-1].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
-#line 7078 "sql.c"
+ case 419: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
- case 424: /* signed ::= NK_MINUS NK_INTEGER */
-#line 769 "sql.y"
+ case 420: /* signed ::= NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
-#line 7087 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 425: /* signed ::= NK_FLOAT */
-#line 774 "sql.y"
-{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
-#line 7093 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 421: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 426: /* signed ::= NK_PLUS NK_FLOAT */
-#line 775 "sql.y"
-{ yymsp[-1].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
-#line 7099 "sql.c"
+ case 422: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 427: /* signed ::= NK_MINUS NK_FLOAT */
-#line 776 "sql.y"
+ case 423: /* signed ::= NK_MINUS NK_FLOAT */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
-#line 7108 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 429: /* signed_literal ::= NK_STRING */
-#line 783 "sql.y"
-{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
-#line 7114 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 425: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 430: /* signed_literal ::= NK_BOOL */
-#line 784 "sql.y"
-{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
-#line 7120 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 426: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 431: /* signed_literal ::= TIMESTAMP NK_STRING */
-#line 785 "sql.y"
-{ yymsp[-1].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 7126 "sql.c"
+ case 427: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 432: /* signed_literal ::= duration_literal */
- case 434: /* signed_literal ::= literal_func */ yytestcase(yyruleno==434);
- case 509: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==509);
- case 575: /* select_item ::= common_expression */ yytestcase(yyruleno==575);
- case 585: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==585);
- case 628: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==628);
- case 630: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==630);
- case 643: /* search_condition ::= common_expression */ yytestcase(yyruleno==643);
-#line 786 "sql.y"
-{ yylhsminor.yy896 = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); }
-#line 7138 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 428: /* signed_literal ::= duration_literal */
+ case 430: /* signed_literal ::= literal_func */ yytestcase(yyruleno==430);
+ case 505: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==505);
+ case 571: /* select_item ::= common_expression */ yytestcase(yyruleno==571);
+ case 581: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==581);
+ case 624: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==624);
+ case 626: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==626);
+ case 639: /* search_condition ::= common_expression */ yytestcase(yyruleno==639);
+{ yylhsminor.yy360 = releaseRawExprNode(pCxt, yymsp[0].minor.yy360); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 433: /* signed_literal ::= NULL */
-#line 787 "sql.y"
-{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
-#line 7144 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 429: /* signed_literal ::= NULL */
+{ yylhsminor.yy360 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 435: /* signed_literal ::= NK_QUESTION */
-#line 789 "sql.y"
-{ yylhsminor.yy896 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
-#line 7150 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 431: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy360 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 453: /* expression ::= pseudo_column */
-#line 851 "sql.y"
-{ yylhsminor.yy896 = yymsp[0].minor.yy896; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy896, true); }
-#line 7156 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 449: /* expression ::= pseudo_column */
+{ yylhsminor.yy360 = yymsp[0].minor.yy360; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy360, true); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 457: /* expression ::= NK_LP expression NK_RP */
- case 543: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==543);
- case 642: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==642);
-#line 855 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); }
-#line 7164 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 453: /* expression ::= NK_LP expression NK_RP */
+ case 539: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==539);
+ case 638: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==638);
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy360)); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 458: /* expression ::= NK_PLUS expr_or_subquery */
-#line 856 "sql.y"
+ case 454: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy896));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy360));
}
-#line 7173 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 459: /* expression ::= NK_MINUS expr_or_subquery */
-#line 860 "sql.y"
+ case 455: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy896), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy360), NULL));
}
-#line 7182 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 460: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
-#line 864 "sql.y"
+ case 456: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7192 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 461: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
-#line 869 "sql.y"
+ case 457: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7202 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 462: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
-#line 874 "sql.y"
+ case 458: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7212 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 463: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
-#line 879 "sql.y"
+ case 459: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7222 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 464: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
-#line 884 "sql.y"
+ case 460: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7232 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 465: /* expression ::= column_reference NK_ARROW NK_STRING */
-#line 889 "sql.y"
+ case 461: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
-#line 7241 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 466: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
-#line 893 "sql.y"
+ case 462: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7251 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 467: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
-#line 898 "sql.y"
+ case 463: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7261 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 470: /* column_reference ::= column_name */
-#line 909 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy701, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy701)); }
-#line 7267 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 466: /* column_reference ::= column_name */
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy929, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy929)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 471: /* column_reference ::= table_name NK_DOT column_name */
-#line 910 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701, createColumnNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701)); }
-#line 7273 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 467: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy929, createColumnNode(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy929)); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 472: /* column_reference ::= NK_ALIAS */
-#line 911 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
-#line 7279 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 468: /* column_reference ::= NK_ALIAS */
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 473: /* column_reference ::= table_name NK_DOT NK_ALIAS */
-#line 912 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0)); }
-#line 7285 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 469: /* column_reference ::= table_name NK_DOT NK_ALIAS */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 474: /* pseudo_column ::= ROWTS */
- case 475: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==475);
- case 477: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==477);
- case 478: /* pseudo_column ::= QEND */ yytestcase(yyruleno==478);
- case 479: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==479);
- case 480: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==480);
- case 481: /* pseudo_column ::= WEND */ yytestcase(yyruleno==481);
- case 482: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==482);
- case 483: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==483);
- case 484: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==484);
- case 485: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==485);
- case 491: /* literal_func ::= NOW */ yytestcase(yyruleno==491);
-#line 914 "sql.y"
-{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
-#line 7302 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 470: /* pseudo_column ::= ROWTS */
+ case 471: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==471);
+ case 473: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==473);
+ case 474: /* pseudo_column ::= QEND */ yytestcase(yyruleno==474);
+ case 475: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==475);
+ case 476: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==476);
+ case 477: /* pseudo_column ::= WEND */ yytestcase(yyruleno==477);
+ case 478: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==478);
+ case 479: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==479);
+ case 480: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==480);
+ case 481: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==481);
+ case 487: /* literal_func ::= NOW */ yytestcase(yyruleno==487);
+{ yylhsminor.yy360 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 476: /* pseudo_column ::= table_name NK_DOT TBNAME */
-#line 916 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy701)))); }
-#line 7308 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 472: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy929)))); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 486: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 487: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==487);
-#line 927 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy701, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy701, yymsp[-1].minor.yy404)); }
-#line 7315 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 482: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 483: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==483);
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy929, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy929, yymsp[-1].minor.yy536)); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 488: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
-#line 930 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), yymsp[-1].minor.yy504)); }
-#line 7321 "sql.c"
- yymsp[-5].minor.yy896 = yylhsminor.yy896;
+ case 484: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), yymsp[-1].minor.yy912)); }
+ yymsp[-5].minor.yy360 = yylhsminor.yy360;
break;
- case 490: /* literal_func ::= noarg_func NK_LP NK_RP */
-#line 933 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy701, NULL)); }
-#line 7327 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 486: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy929, NULL)); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 505: /* star_func_para_list ::= NK_STAR */
-#line 957 "sql.y"
-{ yylhsminor.yy404 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
-#line 7333 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+ case 501: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy536 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
- case 510: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 578: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==578);
-#line 966 "sql.y"
-{ yylhsminor.yy896 = createColumnNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0); }
-#line 7340 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 506: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 574: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==574);
+{ yylhsminor.yy360 = createColumnNode(pCxt, &yymsp[-2].minor.yy929, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 511: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
-#line 969 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy404, yymsp[-1].minor.yy896)); }
-#line 7346 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 507: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy536, yymsp[-1].minor.yy360)); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 512: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
-#line 971 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), yymsp[-2].minor.yy404, yymsp[-1].minor.yy896)); }
-#line 7352 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ case 508: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), yymsp[-2].minor.yy536, yymsp[-1].minor.yy360)); }
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 515: /* when_then_expr ::= WHEN common_expression THEN common_expression */
-#line 978 "sql.y"
-{ yymsp[-3].minor.yy896 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); }
-#line 7358 "sql.c"
+ case 511: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+{ yymsp[-3].minor.yy360 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)); }
break;
- case 517: /* case_when_else_opt ::= ELSE common_expression */
-#line 981 "sql.y"
-{ yymsp[-1].minor.yy896 = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); }
-#line 7363 "sql.c"
+ case 513: /* case_when_else_opt ::= ELSE common_expression */
+{ yymsp[-1].minor.yy360 = releaseRawExprNode(pCxt, yymsp[0].minor.yy360); }
break;
- case 518: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
- case 523: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==523);
-#line 984 "sql.y"
+ case 514: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 519: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==519);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy884, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy252, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7373 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 519: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
-#line 991 "sql.y"
+ case 515: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy896), releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy360), releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7383 "sql.c"
- yymsp[-4].minor.yy896 = yylhsminor.yy896;
+ yymsp[-4].minor.yy360 = yylhsminor.yy360;
break;
- case 520: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
-#line 997 "sql.y"
+ case 516: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy896), releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy360), releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7393 "sql.c"
- yymsp[-5].minor.yy896 = yylhsminor.yy896;
+ yymsp[-5].minor.yy360 = yylhsminor.yy360;
break;
- case 521: /* predicate ::= expr_or_subquery IS NULL */
-#line 1002 "sql.y"
+ case 517: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), NULL));
}
-#line 7402 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 522: /* predicate ::= expr_or_subquery IS NOT NULL */
-#line 1006 "sql.y"
+ case 518: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), NULL));
}
-#line 7411 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 524: /* compare_op ::= NK_LT */
-#line 1018 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_LOWER_THAN; }
-#line 7417 "sql.c"
+ case 520: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy252 = OP_TYPE_LOWER_THAN; }
break;
- case 525: /* compare_op ::= NK_GT */
-#line 1019 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_GREATER_THAN; }
-#line 7422 "sql.c"
+ case 521: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy252 = OP_TYPE_GREATER_THAN; }
break;
- case 526: /* compare_op ::= NK_LE */
-#line 1020 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_LOWER_EQUAL; }
-#line 7427 "sql.c"
+ case 522: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy252 = OP_TYPE_LOWER_EQUAL; }
break;
- case 527: /* compare_op ::= NK_GE */
-#line 1021 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_GREATER_EQUAL; }
-#line 7432 "sql.c"
+ case 523: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy252 = OP_TYPE_GREATER_EQUAL; }
break;
- case 528: /* compare_op ::= NK_NE */
-#line 1022 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_NOT_EQUAL; }
-#line 7437 "sql.c"
+ case 524: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy252 = OP_TYPE_NOT_EQUAL; }
break;
- case 529: /* compare_op ::= NK_EQ */
-#line 1023 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_EQUAL; }
-#line 7442 "sql.c"
+ case 525: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy252 = OP_TYPE_EQUAL; }
break;
- case 530: /* compare_op ::= LIKE */
-#line 1024 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_LIKE; }
-#line 7447 "sql.c"
+ case 526: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy252 = OP_TYPE_LIKE; }
break;
- case 531: /* compare_op ::= NOT LIKE */
-#line 1025 "sql.y"
-{ yymsp[-1].minor.yy884 = OP_TYPE_NOT_LIKE; }
-#line 7452 "sql.c"
+ case 527: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy252 = OP_TYPE_NOT_LIKE; }
break;
- case 532: /* compare_op ::= MATCH */
-#line 1026 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_MATCH; }
-#line 7457 "sql.c"
+ case 528: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy252 = OP_TYPE_MATCH; }
break;
- case 533: /* compare_op ::= NMATCH */
-#line 1027 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_NMATCH; }
-#line 7462 "sql.c"
+ case 529: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy252 = OP_TYPE_NMATCH; }
break;
- case 534: /* compare_op ::= CONTAINS */
-#line 1028 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_JSON_CONTAINS; }
-#line 7467 "sql.c"
+ case 530: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy252 = OP_TYPE_JSON_CONTAINS; }
break;
- case 535: /* in_op ::= IN */
-#line 1032 "sql.y"
-{ yymsp[0].minor.yy884 = OP_TYPE_IN; }
-#line 7472 "sql.c"
+ case 531: /* in_op ::= IN */
+{ yymsp[0].minor.yy252 = OP_TYPE_IN; }
break;
- case 536: /* in_op ::= NOT IN */
-#line 1033 "sql.y"
-{ yymsp[-1].minor.yy884 = OP_TYPE_NOT_IN; }
-#line 7477 "sql.c"
+ case 532: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy252 = OP_TYPE_NOT_IN; }
break;
- case 537: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-#line 1035 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); }
-#line 7482 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 533: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy536)); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 539: /* boolean_value_expression ::= NOT boolean_primary */
-#line 1039 "sql.y"
+ case 535: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy896), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy360), NULL));
}
-#line 7491 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 540: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
-#line 1044 "sql.y"
+ case 536: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7501 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 541: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
-#line 1050 "sql.y"
+ case 537: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896);
- yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy360);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy360);
+ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), releaseRawExprNode(pCxt, yymsp[0].minor.yy360)));
}
-#line 7511 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 549: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-#line 1068 "sql.y"
-{ yylhsminor.yy896 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy896, yymsp[0].minor.yy896, NULL); }
-#line 7517 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 545: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy360 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy360, yymsp[0].minor.yy360, NULL); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 552: /* table_primary ::= table_name alias_opt */
-#line 1074 "sql.y"
-{ yylhsminor.yy896 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy701, &yymsp[0].minor.yy701); }
-#line 7523 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 548: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy360 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy929, &yymsp[0].minor.yy929); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 553: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-#line 1075 "sql.y"
-{ yylhsminor.yy896 = createRealTableNode(pCxt, &yymsp[-3].minor.yy701, &yymsp[-1].minor.yy701, &yymsp[0].minor.yy701); }
-#line 7529 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 549: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy360 = createRealTableNode(pCxt, &yymsp[-3].minor.yy929, &yymsp[-1].minor.yy929, &yymsp[0].minor.yy929); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 554: /* table_primary ::= subquery alias_opt */
-#line 1076 "sql.y"
-{ yylhsminor.yy896 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896), &yymsp[0].minor.yy701); }
-#line 7535 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 550: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy360 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy360), &yymsp[0].minor.yy929); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 556: /* alias_opt ::= */
-#line 1081 "sql.y"
-{ yymsp[1].minor.yy701 = nil_token; }
-#line 7541 "sql.c"
+ case 552: /* alias_opt ::= */
+{ yymsp[1].minor.yy929 = nil_token; }
break;
- case 558: /* alias_opt ::= AS table_alias */
-#line 1083 "sql.y"
-{ yymsp[-1].minor.yy701 = yymsp[0].minor.yy701; }
-#line 7546 "sql.c"
+ case 554: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy929 = yymsp[0].minor.yy929; }
break;
- case 559: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 560: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==560);
-#line 1085 "sql.y"
-{ yymsp[-2].minor.yy896 = yymsp[-1].minor.yy896; }
-#line 7552 "sql.c"
+ case 555: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 556: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==556);
+{ yymsp[-2].minor.yy360 = yymsp[-1].minor.yy360; }
break;
- case 561: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-#line 1090 "sql.y"
-{ yylhsminor.yy896 = createJoinTableNode(pCxt, yymsp[-4].minor.yy680, yymsp[-5].minor.yy896, yymsp[-2].minor.yy896, yymsp[0].minor.yy896); }
-#line 7557 "sql.c"
- yymsp[-5].minor.yy896 = yylhsminor.yy896;
+ case 557: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy360 = createJoinTableNode(pCxt, yymsp[-4].minor.yy596, yymsp[-5].minor.yy360, yymsp[-2].minor.yy360, yymsp[0].minor.yy360); }
+ yymsp[-5].minor.yy360 = yylhsminor.yy360;
break;
- case 562: /* join_type ::= */
-#line 1094 "sql.y"
-{ yymsp[1].minor.yy680 = JOIN_TYPE_INNER; }
-#line 7563 "sql.c"
+ case 558: /* join_type ::= */
+{ yymsp[1].minor.yy596 = JOIN_TYPE_INNER; }
break;
- case 563: /* join_type ::= INNER */
-#line 1095 "sql.y"
-{ yymsp[0].minor.yy680 = JOIN_TYPE_INNER; }
-#line 7568 "sql.c"
+ case 559: /* join_type ::= INNER */
+{ yymsp[0].minor.yy596 = JOIN_TYPE_INNER; }
break;
- case 564: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
-#line 1101 "sql.y"
+ case 560: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
{
- yymsp[-13].minor.yy896 = createSelectStmt(pCxt, yymsp[-11].minor.yy733, yymsp[-9].minor.yy404, yymsp[-8].minor.yy896, yymsp[-12].minor.yy404);
- yymsp[-13].minor.yy896 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy896, yymsp[-10].minor.yy733);
- yymsp[-13].minor.yy896 = addWhereClause(pCxt, yymsp[-13].minor.yy896, yymsp[-7].minor.yy896);
- yymsp[-13].minor.yy896 = addPartitionByClause(pCxt, yymsp[-13].minor.yy896, yymsp[-6].minor.yy404);
- yymsp[-13].minor.yy896 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy896, yymsp[-2].minor.yy896);
- yymsp[-13].minor.yy896 = addGroupByClause(pCxt, yymsp[-13].minor.yy896, yymsp[-1].minor.yy404);
- yymsp[-13].minor.yy896 = addHavingClause(pCxt, yymsp[-13].minor.yy896, yymsp[0].minor.yy896);
- yymsp[-13].minor.yy896 = addRangeClause(pCxt, yymsp[-13].minor.yy896, yymsp[-5].minor.yy896);
- yymsp[-13].minor.yy896 = addEveryClause(pCxt, yymsp[-13].minor.yy896, yymsp[-4].minor.yy896);
- yymsp[-13].minor.yy896 = addFillClause(pCxt, yymsp[-13].minor.yy896, yymsp[-3].minor.yy896);
+ yymsp[-13].minor.yy360 = createSelectStmt(pCxt, yymsp[-11].minor.yy345, yymsp[-9].minor.yy536, yymsp[-8].minor.yy360, yymsp[-12].minor.yy536);
+ yymsp[-13].minor.yy360 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy360, yymsp[-10].minor.yy345);
+ yymsp[-13].minor.yy360 = addWhereClause(pCxt, yymsp[-13].minor.yy360, yymsp[-7].minor.yy360);
+ yymsp[-13].minor.yy360 = addPartitionByClause(pCxt, yymsp[-13].minor.yy360, yymsp[-6].minor.yy536);
+ yymsp[-13].minor.yy360 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy360, yymsp[-2].minor.yy360);
+ yymsp[-13].minor.yy360 = addGroupByClause(pCxt, yymsp[-13].minor.yy360, yymsp[-1].minor.yy536);
+ yymsp[-13].minor.yy360 = addHavingClause(pCxt, yymsp[-13].minor.yy360, yymsp[0].minor.yy360);
+ yymsp[-13].minor.yy360 = addRangeClause(pCxt, yymsp[-13].minor.yy360, yymsp[-5].minor.yy360);
+ yymsp[-13].minor.yy360 = addEveryClause(pCxt, yymsp[-13].minor.yy360, yymsp[-4].minor.yy360);
+ yymsp[-13].minor.yy360 = addFillClause(pCxt, yymsp[-13].minor.yy360, yymsp[-3].minor.yy360);
}
-#line 7584 "sql.c"
break;
- case 565: /* hint_list ::= */
-#line 1116 "sql.y"
-{ yymsp[1].minor.yy404 = createHintNodeList(pCxt, NULL); }
-#line 7589 "sql.c"
+ case 561: /* hint_list ::= */
+{ yymsp[1].minor.yy536 = createHintNodeList(pCxt, NULL); }
break;
- case 566: /* hint_list ::= NK_HINT */
-#line 1117 "sql.y"
-{ yylhsminor.yy404 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
-#line 7594 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+ case 562: /* hint_list ::= NK_HINT */
+{ yylhsminor.yy536 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
- case 571: /* set_quantifier_opt ::= ALL */
-#line 1128 "sql.y"
-{ yymsp[0].minor.yy733 = false; }
-#line 7600 "sql.c"
+ case 567: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy345 = false; }
break;
- case 574: /* select_item ::= NK_STAR */
-#line 1135 "sql.y"
-{ yylhsminor.yy896 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
-#line 7605 "sql.c"
- yymsp[0].minor.yy896 = yylhsminor.yy896;
+ case 570: /* select_item ::= NK_STAR */
+{ yylhsminor.yy360 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy360 = yylhsminor.yy360;
break;
- case 576: /* select_item ::= common_expression column_alias */
- case 586: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==586);
-#line 1137 "sql.y"
-{ yylhsminor.yy896 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896), &yymsp[0].minor.yy701); }
-#line 7612 "sql.c"
- yymsp[-1].minor.yy896 = yylhsminor.yy896;
+ case 572: /* select_item ::= common_expression column_alias */
+ case 582: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==582);
+{ yylhsminor.yy360 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy360), &yymsp[0].minor.yy929); }
+ yymsp[-1].minor.yy360 = yylhsminor.yy360;
break;
- case 577: /* select_item ::= common_expression AS column_alias */
- case 587: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==587);
-#line 1138 "sql.y"
-{ yylhsminor.yy896 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), &yymsp[0].minor.yy701); }
-#line 7619 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 573: /* select_item ::= common_expression AS column_alias */
+ case 583: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==583);
+{ yylhsminor.yy360 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), &yymsp[0].minor.yy929); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 582: /* partition_by_clause_opt ::= PARTITION BY partition_list */
- case 612: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==612);
- case 632: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==632);
-#line 1147 "sql.y"
-{ yymsp[-2].minor.yy404 = yymsp[0].minor.yy404; }
-#line 7627 "sql.c"
+ case 578: /* partition_by_clause_opt ::= PARTITION BY partition_list */
+ case 608: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==608);
+ case 628: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==628);
+{ yymsp[-2].minor.yy536 = yymsp[0].minor.yy536; }
break;
- case 589: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
-#line 1160 "sql.y"
-{ yymsp[-5].minor.yy896 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); }
-#line 7632 "sql.c"
+ case 585: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+{ yymsp[-5].minor.yy360 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), releaseRawExprNode(pCxt, yymsp[-1].minor.yy360)); }
break;
- case 590: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
-#line 1161 "sql.y"
-{ yymsp[-3].minor.yy896 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); }
-#line 7637 "sql.c"
+ case 586: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy360 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy360)); }
break;
- case 591: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
-#line 1163 "sql.y"
-{ yymsp[-5].minor.yy896 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), NULL, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); }
-#line 7642 "sql.c"
+ case 587: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy360 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), NULL, yymsp[-1].minor.yy360, yymsp[0].minor.yy360); }
break;
- case 592: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
-#line 1167 "sql.y"
-{ yymsp[-7].minor.yy896 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy896), releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), yymsp[-1].minor.yy896, yymsp[0].minor.yy896); }
-#line 7647 "sql.c"
+ case 588: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy360 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy360), releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), yymsp[-1].minor.yy360, yymsp[0].minor.yy360); }
break;
- case 593: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
-#line 1169 "sql.y"
-{ yymsp[-6].minor.yy896 = createEventWindowNode(pCxt, yymsp[-3].minor.yy896, yymsp[0].minor.yy896); }
-#line 7652 "sql.c"
+ case 589: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+{ yymsp[-6].minor.yy360 = createEventWindowNode(pCxt, yymsp[-3].minor.yy360, yymsp[0].minor.yy360); }
break;
- case 594: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
-#line 1171 "sql.y"
-{ yymsp[-3].minor.yy896 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); }
-#line 7657 "sql.c"
+ case 590: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy360 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- case 595: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-#line 1173 "sql.y"
-{ yymsp[-5].minor.yy896 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); }
-#line 7662 "sql.c"
+ case 591: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy360 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- case 602: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-#line 1183 "sql.y"
-{ yymsp[-3].minor.yy896 = createFillNode(pCxt, yymsp[-1].minor.yy466, NULL); }
-#line 7667 "sql.c"
+ case 598: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy360 = createFillNode(pCxt, yymsp[-1].minor.yy358, NULL); }
break;
- case 603: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
-#line 1184 "sql.y"
-{ yymsp[-5].minor.yy896 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); }
-#line 7672 "sql.c"
+ case 599: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+{ yymsp[-5].minor.yy360 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy536)); }
break;
- case 604: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
-#line 1185 "sql.y"
-{ yymsp[-5].minor.yy896 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); }
-#line 7677 "sql.c"
+ case 600: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+{ yymsp[-5].minor.yy360 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy536)); }
break;
- case 605: /* fill_mode ::= NONE */
-#line 1189 "sql.y"
-{ yymsp[0].minor.yy466 = FILL_MODE_NONE; }
-#line 7682 "sql.c"
+ case 601: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy358 = FILL_MODE_NONE; }
break;
- case 606: /* fill_mode ::= PREV */
-#line 1190 "sql.y"
-{ yymsp[0].minor.yy466 = FILL_MODE_PREV; }
-#line 7687 "sql.c"
+ case 602: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy358 = FILL_MODE_PREV; }
break;
- case 607: /* fill_mode ::= NULL */
-#line 1191 "sql.y"
-{ yymsp[0].minor.yy466 = FILL_MODE_NULL; }
-#line 7692 "sql.c"
+ case 603: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy358 = FILL_MODE_NULL; }
break;
- case 608: /* fill_mode ::= NULL_F */
-#line 1192 "sql.y"
-{ yymsp[0].minor.yy466 = FILL_MODE_NULL_F; }
-#line 7697 "sql.c"
+ case 604: /* fill_mode ::= NULL_F */
+{ yymsp[0].minor.yy358 = FILL_MODE_NULL_F; }
break;
- case 609: /* fill_mode ::= LINEAR */
-#line 1193 "sql.y"
-{ yymsp[0].minor.yy466 = FILL_MODE_LINEAR; }
-#line 7702 "sql.c"
+ case 605: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy358 = FILL_MODE_LINEAR; }
break;
- case 610: /* fill_mode ::= NEXT */
-#line 1194 "sql.y"
-{ yymsp[0].minor.yy466 = FILL_MODE_NEXT; }
-#line 7707 "sql.c"
+ case 606: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy358 = FILL_MODE_NEXT; }
break;
- case 613: /* group_by_list ::= expr_or_subquery */
-#line 1203 "sql.y"
-{ yylhsminor.yy404 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); }
-#line 7712 "sql.c"
- yymsp[0].minor.yy404 = yylhsminor.yy404;
+ case 609: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy536 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy360))); }
+ yymsp[0].minor.yy536 = yylhsminor.yy536;
break;
- case 614: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
-#line 1204 "sql.y"
-{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); }
-#line 7718 "sql.c"
- yymsp[-2].minor.yy404 = yylhsminor.yy404;
+ case 610: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy536 = addNodeToList(pCxt, yymsp[-2].minor.yy536, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy360))); }
+ yymsp[-2].minor.yy536 = yylhsminor.yy536;
break;
- case 618: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
-#line 1211 "sql.y"
-{ yymsp[-5].minor.yy896 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); }
-#line 7724 "sql.c"
+ case 614: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy360 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy360), releaseRawExprNode(pCxt, yymsp[-1].minor.yy360)); }
break;
- case 619: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
-#line 1213 "sql.y"
-{ yymsp[-3].minor.yy896 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); }
-#line 7729 "sql.c"
+ case 615: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy360 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy360)); }
break;
- case 622: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
-#line 1220 "sql.y"
+ case 618: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy896 = addOrderByClause(pCxt, yymsp[-3].minor.yy896, yymsp[-2].minor.yy404);
- yylhsminor.yy896 = addSlimitClause(pCxt, yylhsminor.yy896, yymsp[-1].minor.yy896);
- yylhsminor.yy896 = addLimitClause(pCxt, yylhsminor.yy896, yymsp[0].minor.yy896);
+ yylhsminor.yy360 = addOrderByClause(pCxt, yymsp[-3].minor.yy360, yymsp[-2].minor.yy536);
+ yylhsminor.yy360 = addSlimitClause(pCxt, yylhsminor.yy360, yymsp[-1].minor.yy360);
+ yylhsminor.yy360 = addLimitClause(pCxt, yylhsminor.yy360, yymsp[0].minor.yy360);
}
-#line 7738 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 625: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-#line 1230 "sql.y"
-{ yylhsminor.yy896 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy896, yymsp[0].minor.yy896); }
-#line 7744 "sql.c"
- yymsp[-3].minor.yy896 = yylhsminor.yy896;
+ case 621: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy360 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy360, yymsp[0].minor.yy360); }
+ yymsp[-3].minor.yy360 = yylhsminor.yy360;
break;
- case 626: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-#line 1232 "sql.y"
-{ yylhsminor.yy896 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy896, yymsp[0].minor.yy896); }
-#line 7750 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 622: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy360 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy360, yymsp[0].minor.yy360); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 634: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 638: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==638);
-#line 1246 "sql.y"
-{ yymsp[-1].minor.yy896 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 7757 "sql.c"
+ case 630: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 634: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==634);
+{ yymsp[-1].minor.yy360 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 635: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 639: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==639);
-#line 1247 "sql.y"
-{ yymsp[-3].minor.yy896 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
-#line 7763 "sql.c"
+ case 631: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 635: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==635);
+{ yymsp[-3].minor.yy360 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 636: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 640: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==640);
-#line 1248 "sql.y"
-{ yymsp[-3].minor.yy896 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
-#line 7769 "sql.c"
+ case 632: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 636: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==636);
+{ yymsp[-3].minor.yy360 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 641: /* subquery ::= NK_LP query_expression NK_RP */
-#line 1256 "sql.y"
-{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy896); }
-#line 7774 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 637: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy360 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy360); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 646: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
-#line 1270 "sql.y"
-{ yylhsminor.yy896 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), yymsp[-1].minor.yy918, yymsp[0].minor.yy669); }
-#line 7780 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 642: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy360 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy360), yymsp[-1].minor.yy642, yymsp[0].minor.yy585); }
+ yymsp[-2].minor.yy360 = yylhsminor.yy360;
break;
- case 647: /* ordering_specification_opt ::= */
-#line 1274 "sql.y"
-{ yymsp[1].minor.yy918 = ORDER_ASC; }
-#line 7786 "sql.c"
+ case 643: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy642 = ORDER_ASC; }
break;
- case 648: /* ordering_specification_opt ::= ASC */
-#line 1275 "sql.y"
-{ yymsp[0].minor.yy918 = ORDER_ASC; }
-#line 7791 "sql.c"
+ case 644: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy642 = ORDER_ASC; }
break;
- case 649: /* ordering_specification_opt ::= DESC */
-#line 1276 "sql.y"
-{ yymsp[0].minor.yy918 = ORDER_DESC; }
-#line 7796 "sql.c"
+ case 645: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy642 = ORDER_DESC; }
break;
- case 650: /* null_ordering_opt ::= */
-#line 1280 "sql.y"
-{ yymsp[1].minor.yy669 = NULL_ORDER_DEFAULT; }
-#line 7801 "sql.c"
+ case 646: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy585 = NULL_ORDER_DEFAULT; }
break;
- case 651: /* null_ordering_opt ::= NULLS FIRST */
-#line 1281 "sql.y"
-{ yymsp[-1].minor.yy669 = NULL_ORDER_FIRST; }
-#line 7806 "sql.c"
+ case 647: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy585 = NULL_ORDER_FIRST; }
break;
- case 652: /* null_ordering_opt ::= NULLS LAST */
-#line 1282 "sql.y"
-{ yymsp[-1].minor.yy669 = NULL_ORDER_LAST; }
-#line 7811 "sql.c"
- break;
- case 653: /* column_options ::= */
-#line 1288 "sql.y"
-{ yymsp[1].minor.yy896 = createDefaultColumnOptions(pCxt); }
-#line 7816 "sql.c"
- break;
- case 654: /* column_options ::= column_options ENCODE NK_STRING */
-#line 1289 "sql.y"
-{assert(strlen(yymsp[0].minor.yy0.z) != 0); yylhsminor.yy896 = setColumnOptions(pCxt, yymsp[-2].minor.yy896, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); }
-#line 7821 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
- break;
- case 655: /* column_options ::= column_options COMPRESS NK_STRING */
-#line 1290 "sql.y"
-{ yylhsminor.yy896 = setColumnOptions(pCxt, yymsp[-2].minor.yy896, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); }
-#line 7827 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
- break;
- case 656: /* column_options ::= column_options LEVEL NK_STRING */
-#line 1291 "sql.y"
-{ yylhsminor.yy896 = setColumnOptions(pCxt, yymsp[-2].minor.yy896, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); }
-#line 7833 "sql.c"
- yymsp[-2].minor.yy896 = yylhsminor.yy896;
+ case 648: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy585 = NULL_ORDER_LAST; }
break;
default:
break;
@@ -7904,7 +6968,6 @@ static void yy_syntax_error(
} else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z);
}
-#line 7907 "sql.c"
/************ End %syntax_error code ******************************************/
ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
diff --git a/source/libs/planner/inc/planInt.h b/source/libs/planner/inc/planInt.h
index fcccdcf23e..3f1cb0fbd3 100644
--- a/source/libs/planner/inc/planInt.h
+++ b/source/libs/planner/inc/planInt.h
@@ -47,7 +47,8 @@ int32_t validateQueryPlan(SPlanContext* pCxt, SQueryPlan* pPlan);
bool getBatchScanOptionFromHint(SNodeList* pList);
bool getSortForGroupOptHint(SNodeList* pList);
-bool getparaTablesSortOptHint(SNodeList* pList);
+bool getParaTablesSortOptHint(SNodeList* pList);
+bool getSmallDataTsSortOptHint(SNodeList* pList);
bool getOptHint(SNodeList* pList, EHintOption hint);
SLogicNode* getLogicNodeRootNode(SLogicNode* pCurr);
int32_t collectTableAliasFromNodes(SNode* pNode, SSHashObj** ppRes);
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index 0f5ddf926d..c34d8ac64f 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -502,7 +502,8 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
} else {
nodesDestroyNode((SNode*)pScan);
}
- pScan->paraTablesSort = getparaTablesSortOptHint(pSelect->pHint);
+ pScan->paraTablesSort = getParaTablesSortOptHint(pSelect->pHint);
+ pScan->smallDataTsSort = getSmallDataTsSortOptHint(pSelect->pHint);
pCxt->hasScan = true;
return code;
@@ -1016,10 +1017,6 @@ static int32_t createWindowLogicNodeByCount(SLogicPlanContext* pCxt, SCountWindo
return TSDB_CODE_OUT_OF_MEMORY;
}
- if (!pCxt->pPlanCxt->streamQuery && tsDisableCount) {
- return TSDB_CODE_FAILED;
- }
-
pWindow->winType = WINDOW_TYPE_COUNT;
pWindow->node.groupAction = getGroupAction(pCxt, pSelect);
pWindow->node.requireDataOrder =
diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c
index baef39144c..8748cc7c17 100644
--- a/source/libs/planner/src/planPhysiCreater.c
+++ b/source/libs/planner/src/planPhysiCreater.c
@@ -527,7 +527,10 @@ static int32_t createSimpleScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSub
if (NULL == pScan) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
+
+ if (pScanLogicNode->pVgroupList) {
+ vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
+ }
return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, pScan, pPhyNode);
}
@@ -538,8 +541,9 @@ static int32_t createTagScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubpla
if (NULL == pScan) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
-
+ if (pScanLogicNode->pVgroupList) {
+ vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
+ }
pScan->onlyMetaCtbIdx = pScanLogicNode->onlyMetaCtbIdx;
return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pScan, pPhyNode);
@@ -563,8 +567,9 @@ static int32_t createLastRowScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSu
pScan->groupSort = pScanLogicNode->groupSort;
pScan->ignoreNull = pScanLogicNode->igLastNull;
- vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
-
+ if (pScanLogicNode->pVgroupList) {
+ vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
+ }
int32_t code = createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pScan, pPhyNode);
if (TSDB_CODE_SUCCESS == code && pScanLogicNode->pFuncTypes != NULL) {
@@ -609,8 +614,9 @@ static int32_t createTableCountScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
}
pScan->groupSort = pScanLogicNode->groupSort;
- vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
-
+ if (pScanLogicNode->pVgroupList) {
+ vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
+ }
return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pScan, pPhyNode);
}
@@ -652,6 +658,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp
pTableScan->filesetDelimited = pScanLogicNode->filesetDelimited;
pTableScan->needCountEmptyTable = pScanLogicNode->isCountByTag;
pTableScan->paraTablesSort = pScanLogicNode->paraTablesSort;
+ pTableScan->smallDataTsSort = pScanLogicNode->smallDataTsSort;
int32_t code = createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode);
if (TSDB_CODE_SUCCESS == code) {
@@ -680,7 +687,9 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
if (0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_TABLES) ||
0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_TAGS) ||
0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_COLS)) {
- vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
+ if (pScanLogicNode->pVgroupList) {
+ vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
+ }
} else {
pSubplan->execNode.nodeId = MNODE_HANDLE;
pSubplan->execNode.epSet = pCxt->pPlanCxt->mgmtEpSet;
@@ -2216,11 +2225,12 @@ static int32_t createQueryInserter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNod
pInserter->stableId = pModify->stableId;
pInserter->tableType = pModify->tableType;
strcpy(pInserter->tableName, pModify->tableName);
- pInserter->vgId = pModify->pVgroupList->vgroups[0].vgId;
- pInserter->epSet = pModify->pVgroupList->vgroups[0].epSet;
pInserter->explain = (QUERY_NODE_EXPLAIN_STMT == nodeType(pCxt->pPlanCxt->pAstRoot) ? true : false);
- vgroupInfoToNodeAddr(pModify->pVgroupList->vgroups, &pSubplan->execNode);
-
+ if (pModify->pVgroupList) {
+ pInserter->vgId = pModify->pVgroupList->vgroups[0].vgId;
+ pInserter->epSet = pModify->pVgroupList->vgroups[0].epSet;
+ vgroupInfoToNodeAddr(pModify->pVgroupList->vgroups, &pSubplan->execNode);
+ }
int32_t code = setListSlotId(pCxt, pSubplan->pNode->pOutputDataBlockDesc->dataBlockId, -1, pModify->pInsertCols,
&pInserter->pCols);
if (TSDB_CODE_SUCCESS == code) {
diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c
index d9a7475f59..34be489333 100644
--- a/source/libs/planner/src/planSpliter.c
+++ b/source/libs/planner/src/planSpliter.c
@@ -274,7 +274,7 @@ static bool stbSplNeedSplitWindow(bool streamQuery, SLogicNode* pNode) {
}
}
- if (WINDOW_TYPE_STATE == pWindow->winType) {
+ if (WINDOW_TYPE_STATE == pWindow->winType || WINDOW_TYPE_COUNT == pWindow->winType) {
if (!streamQuery) {
return stbSplHasMultiTbScan(streamQuery, pNode);
} else {
@@ -1320,7 +1320,11 @@ static int32_t stbSplSplitScanNodeWithPartTags(SSplitContext* pCxt, SStableSplit
SLogicNode* pSplitNode = NULL;
int32_t code = stbSplGetSplitNodeForScan(pInfo, &pSplitNode);
if (TSDB_CODE_SUCCESS == code) {
- code = stbSplCreateMergeNode(pCxt, pInfo->pSubplan, pSplitNode, NULL, pSplitNode, true, true);
+ bool needSort = true;
+ if (QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pSplitNode) && !pSplitNode->pLimit && !pSplitNode->pSlimit) {
+ needSort = !((SProjectLogicNode*)pSplitNode)->ignoreGroupId;
+ }
+ code = stbSplCreateMergeNode(pCxt, pInfo->pSubplan, pSplitNode, NULL, pSplitNode, needSort, needSort);
}
if (TSDB_CODE_SUCCESS == code) {
code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren,
diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c
index f31bf23bc9..a6109cdacb 100644
--- a/source/libs/planner/src/planUtil.c
+++ b/source/libs/planner/src/planUtil.c
@@ -466,7 +466,7 @@ bool getOptHint(SNodeList* pList, EHintOption hint) {
return false;
}
-bool getparaTablesSortOptHint(SNodeList* pList) {
+bool getParaTablesSortOptHint(SNodeList* pList) {
if (!pList) return false;
SNode* pNode;
FOREACH(pNode, pList) {
@@ -478,6 +478,18 @@ bool getparaTablesSortOptHint(SNodeList* pList) {
return false;
}
+bool getSmallDataTsSortOptHint(SNodeList* pList) {
+ if (!pList) return false;
+ SNode* pNode;
+ FOREACH(pNode, pList) {
+ SHintNode* pHint = (SHintNode*)pNode;
+ if (pHint->option == HINT_SMALLDATA_TS_SORT) {
+ return true;
+ }
+ }
+ return false;
+}
+
int32_t collectTableAliasFromNodes(SNode* pNode, SSHashObj** ppRes) {
int32_t code = TSDB_CODE_SUCCESS;
SLogicNode* pCurr = (SLogicNode*)pNode;
diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c
index 66ec460861..faa90dcbf8 100644
--- a/source/libs/qworker/src/qwMsg.c
+++ b/source/libs/qworker/src/qwMsg.c
@@ -715,6 +715,7 @@ int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SD
uint64_t tId = req.taskId;
int64_t rId = 0;
int32_t eId = -1;
+ pRes->source = req.source;
SQWMsg qwMsg = {.node = node, .msg = req.msg, .msgLen = req.phyLen, .connInfo = pMsg->info};
QW_SCH_TASK_DLOG("processDelete start, node:%p, handle:%p, sql:%s", node, pMsg->info.handle, req.sql);
diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h
index 1aa21e73a3..d129b0024f 100644
--- a/source/libs/scheduler/inc/schInt.h
+++ b/source/libs/scheduler/inc/schInt.h
@@ -304,6 +304,7 @@ typedef struct SSchJob {
SSchResInfo userRes;
char *sql;
SQueryProfileSummary summary;
+ int8_t source;
} SSchJob;
typedef struct SSchTaskCtx {
diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c
index e50ec64d54..48aab63ba3 100644
--- a/source/libs/scheduler/src/schJob.c
+++ b/source/libs/scheduler/src/schJob.c
@@ -746,6 +746,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
pJob->chkKillParam = pReq->chkKillParam;
pJob->userRes.execFp = pReq->execFp;
pJob->userRes.cbParam = pReq->cbParam;
+ pJob->source = pReq->source;
if (pReq->pNodeList == NULL || taosArrayGetSize(pReq->pNodeList) <= 0) {
qDebug("QID:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId);
diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c
index 1c0b31109e..aa33d6f2fc 100644
--- a/source/libs/scheduler/src/schRemote.c
+++ b/source/libs/scheduler/src/schRemote.c
@@ -892,7 +892,7 @@ int32_t schCloneCallbackParam(SSchCallbackParamHeader *pSrc, SSchCallbackParamHe
int32_t schCloneSMsgSendInfo(void *src, void **dst) {
SMsgSendInfo *pSrc = src;
int32_t code = 0;
- SMsgSendInfo *pDst = taosMemoryMalloc(sizeof(*pSrc));
+ SMsgSendInfo *pDst = taosMemoryCalloc(1, sizeof(*pSrc));
if (NULL == pDst) {
qError("malloc SMsgSendInfo for rpcCtx failed, len:%d", (int32_t)sizeof(*pSrc));
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
@@ -940,6 +940,10 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery
SCH_ERR_JRET(schGenerateCallBackInfo(pJob, pTask, msg, msgSize, msgType, trans, isHb, &pMsgSendInfo));
SCH_ERR_JRET(schUpdateSendTargetInfo(pMsgSendInfo, addr, pTask));
+ if (isHb && persistHandle && trans->pHandle == 0) {
+ trans->pHandle = rpcAllocHandle();
+ }
+
if (pJob && pTask) {
SCH_TASK_DLOG("start to send %s msg to node[%d,%s,%d], pTrans:%p, pHandle:%p", TMSG_INFO(msgType), addr->nodeId,
epSet->eps[epSet->inUse].fqdn, epSet->eps[epSet->inUse].port, trans->pTrans, trans->pHandle);
@@ -1086,6 +1090,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
req.sqlLen = strlen(pJob->sql);
req.sql = (char *)pJob->sql;
req.msg = pTask->msg;
+ req.source = pJob->source;
msgSize = tSerializeSVDeleteReq(NULL, 0, &req);
msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) {
diff --git a/source/libs/stream/inc/streamBackendRocksdb.h b/source/libs/stream/inc/streamBackendRocksdb.h
index 03f70604b7..1dc1db8e9c 100644
--- a/source/libs/stream/inc/streamBackendRocksdb.h
+++ b/source/libs/stream/inc/streamBackendRocksdb.h
@@ -17,10 +17,14 @@
#define _STREAM_BACKEDN_ROCKSDB_H_
#include "rocksdb/c.h"
-//#include "streamInt.h"
+// #include "streamInt.h"
#include "streamState.h"
#include "tcommon.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct SCfComparator {
rocksdb_comparator_t** comp;
int32_t numOfComp;
@@ -244,11 +248,6 @@ int32_t streamBackendDelInUseChkp(void* arg, int64_t chkpId);
int32_t taskDbBuildSnap(void* arg, SArray* pSnap);
-// int32_t streamDefaultIter_rocksdb(SStreamState* pState, const void* start, const void* end, SArray* result);
-
-// STaskDbWrapper* taskDbOpen(char* path, char* key, int64_t chkpId);
-// void taskDbDestroy(void* pDb, bool flush);
-
int32_t taskDbDoCheckpoint(void* arg, int64_t chkpId);
SBkdMgt* bkdMgtCreate(char* path);
@@ -258,4 +257,10 @@ int32_t bkdMgtDumpTo(SBkdMgt* bm, char* taskId, char* dname);
void bkdMgtDestroy(SBkdMgt* bm);
int32_t taskDbGenChkpUploadData(void* arg, void* bkdMgt, int64_t chkpId, int8_t type, char** path, SArray* list);
-#endif
\ No newline at end of file
+
+uint32_t nextPow2(uint32_t x);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h
index 87f63b48ed..d0055d5400 100644
--- a/source/libs/stream/inc/streamInt.h
+++ b/source/libs/stream/inc/streamInt.h
@@ -99,6 +99,7 @@ void streamRetryDispatchData(SStreamTask* pTask, int64_t waitDuration);
int32_t streamDispatchStreamBlock(SStreamTask* pTask);
void destroyDispatchMsg(SStreamDispatchReq* pReq, int32_t numOfVgroups);
int32_t getNumOfDispatchBranch(SStreamTask* pTask);
+void clearBufferedDispatchMsg(SStreamTask* pTask);
int32_t streamProcessCheckpointBlock(SStreamTask* pTask, SStreamDataBlock* pBlock);
SStreamDataBlock* createStreamBlockFromDispatchMsg(const SStreamDispatchReq* pReq, int32_t blockType, int32_t srcVg);
diff --git a/source/libs/stream/inc/streamsm.h b/source/libs/stream/inc/streamsm.h
index 22e1c4497b..47e0ce1b55 100644
--- a/source/libs/stream/inc/streamsm.h
+++ b/source/libs/stream/inc/streamsm.h
@@ -26,21 +26,21 @@ extern "C" {
typedef int32_t (*__state_trans_fn)(SStreamTask*);
typedef int32_t (*__state_trans_succ_fn)(SStreamTask*);
-typedef struct SAttachedEventInfo {
+typedef struct SFutureHandleEventInfo {
ETaskStatus status; // required status that this event can be handled
EStreamTaskEvent event; // the delayed handled event
void* pParam;
- void* pFn;
-} SAttachedEventInfo;
+ __state_trans_user_fn callBackFn;
+} SFutureHandleEventInfo;
typedef struct STaskStateTrans {
- bool autoInvokeEndFn;
- SStreamTaskState state;
- EStreamTaskEvent event;
- SStreamTaskState next;
- __state_trans_fn pAction;
- __state_trans_succ_fn pSuccAction;
- SAttachedEventInfo attachEvent;
+ bool autoInvokeEndFn;
+ SStreamTaskState state;
+ EStreamTaskEvent event;
+ SStreamTaskState next;
+ __state_trans_fn pAction;
+ __state_trans_succ_fn pSuccAction;
+ SFutureHandleEventInfo attachEvent;
} STaskStateTrans;
struct SStreamTaskSM {
diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c
index f173157da6..5dafad8951 100644
--- a/source/libs/stream/src/streamBackendRocksdb.c
+++ b/source/libs/stream/src/streamBackendRocksdb.c
@@ -906,6 +906,7 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) {
return 0;
}
+#ifdef BUILD_NO_CALL
static int32_t chkpIdComp(const void* a, const void* b) {
int64_t x = *(int64_t*)a;
int64_t y = *(int64_t*)b;
@@ -964,6 +965,7 @@ int32_t streamBackendLoadCheckpointInfo(void* arg) {
taosMemoryFree(chkpPath);
return 0;
}
+#endif
#ifdef BUILD_NO_CALL
int32_t chkpGetAllDbCfHandle(SStreamMeta* pMeta, rocksdb_column_family_handle_t*** ppHandle, SArray* refs) {
@@ -2788,7 +2790,6 @@ SStreamStateCur* streamStateSeekToLast_rocksdb(SStreamState* pState) {
STREAM_STATE_DEL_ROCKSDB(pState, "state", &maxStateKey);
return pCur;
}
-#ifdef BUILD_NO_CALL
SStreamStateCur* streamStateGetCur_rocksdb(SStreamState* pState, const SWinKey* key) {
stDebug("streamStateGetCur_rocksdb");
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
@@ -2838,7 +2839,6 @@ int32_t streamStateFuncDel_rocksdb(SStreamState* pState, const STupleKey* key) {
STREAM_STATE_DEL_ROCKSDB(pState, "func", key);
return 0;
}
-#endif
// session cf
int32_t streamStateSessionPut_rocksdb(SStreamState* pState, const SSessionKey* key, const void* value, int32_t vLen) {
@@ -3432,7 +3432,6 @@ int32_t streamStateStateAddIfNotExist_rocksdb(SStreamState* pState, SSessionKey*
SSessionKey tmpKey = *key;
int32_t valSize = *pVLen;
void* tmp = taosMemoryMalloc(valSize);
- // tdbRealloc(NULL, valSize);
if (!tmp) {
return -1;
}
@@ -3506,13 +3505,11 @@ int32_t streamStateGetParName_rocksdb(SStreamState* pState, int64_t groupId, voi
return code;
}
-#ifdef BUILD_NO_CALL
int32_t streamDefaultPut_rocksdb(SStreamState* pState, const void* key, void* pVal, int32_t pVLen) {
int code = 0;
STREAM_STATE_PUT_ROCKSDB(pState, "default", key, pVal, pVLen);
return code;
}
-#endif
int32_t streamDefaultGet_rocksdb(SStreamState* pState, const void* key, void** pVal, int32_t* pVLen) {
int code = 0;
STREAM_STATE_GET_ROCKSDB(pState, "default", key, pVal, pVLen);
@@ -3535,10 +3532,10 @@ int32_t streamDefaultIterGet_rocksdb(SStreamState* pState, const void* start, co
if (pIter == NULL) {
return -1;
}
-
+ size_t klen = 0;
rocksdb_iter_seek(pIter, start, strlen(start));
while (rocksdb_iter_valid(pIter)) {
- const char* key = rocksdb_iter_key(pIter, NULL);
+ const char* key = rocksdb_iter_key(pIter, &klen);
int32_t vlen = 0;
const char* vval = rocksdb_iter_value(pIter, (size_t*)&vlen);
char* val = NULL;
@@ -3700,6 +3697,8 @@ uint32_t nextPow2(uint32_t x) {
x = x | (x >> 16);
return x + 1;
}
+
+#ifdef BUILD_NO_CALL
int32_t copyFiles(const char* src, const char* dst) {
int32_t code = 0;
// opt later, just hard link
@@ -3739,6 +3738,7 @@ _err:
taosCloseDir(&pDir);
return code >= 0 ? 0 : -1;
}
+#endif
int32_t isBkdDataMeta(char* name, int32_t len) {
const char* pCurrent = "CURRENT";
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 78b914c3db..dc790b5b2d 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -315,6 +315,16 @@ int32_t getNumOfDispatchBranch(SStreamTask* pTask) {
: taosArrayGetSize(pTask->outputInfo.shuffleDispatcher.dbInfo.pVgroupInfos);
}
+void clearBufferedDispatchMsg(SStreamTask* pTask) {
+ SDispatchMsgInfo* pMsgInfo = &pTask->msgInfo;
+ if (pMsgInfo->pData != NULL) {
+ destroyDispatchMsg(pMsgInfo->pData, getNumOfDispatchBranch(pTask));
+ }
+
+ pMsgInfo->pData = NULL;
+ pMsgInfo->dispatchMsgType = 0;
+}
+
static int32_t doBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* pData) {
int32_t code = 0;
int32_t numOfBlocks = taosArrayGetSize(pData->blocks);
@@ -678,8 +688,7 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
// todo deal with only partially success dispatch case
atomic_store_32(&pTask->outputInfo.shuffleDispatcher.waitingRspCnt, 0);
if (terrno == TSDB_CODE_APP_IS_STOPPING) { // in case of this error, do not retry anymore
- destroyDispatchMsg(pTask->msgInfo.pData, getNumOfDispatchBranch(pTask));
- pTask->msgInfo.pData = NULL;
+ clearBufferedDispatchMsg(pTask);
return code;
}
@@ -740,6 +749,8 @@ int32_t streamTaskSendCheckpointSourceRsp(SStreamTask* pTask) {
int32_t streamAddBlockIntoDispatchMsg(const SSDataBlock* pBlock, SStreamDispatchReq* pReq) {
int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock);
+ ASSERT(dataStrLen > 0);
+
void* buf = taosMemoryCalloc(1, dataStrLen);
if (buf == NULL) return -1;
@@ -936,15 +947,12 @@ void streamClearChkptReadyMsg(SStreamTask* pTask) {
// this message has been sent successfully, let's try next one.
static int32_t handleDispatchSuccessRsp(SStreamTask* pTask, int32_t downstreamId) {
stDebug("s-task:%s destroy dispatch msg:%p", pTask->id.idStr, pTask->msgInfo.pData);
- destroyDispatchMsg(pTask->msgInfo.pData, getNumOfDispatchBranch(pTask));
-
bool delayDispatch = (pTask->msgInfo.dispatchMsgType == STREAM_INPUT__CHECKPOINT_TRIGGER);
if (delayDispatch) {
pTask->chkInfo.dispatchCheckpointTrigger = true;
}
- pTask->msgInfo.pData = NULL;
- pTask->msgInfo.dispatchMsgType = 0;
+ clearBufferedDispatchMsg(pTask);
int64_t el = taosGetTimestampMs() - pTask->msgInfo.startTs;
@@ -1084,7 +1092,7 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
} else { // this message has been sent successfully, let's try next one.
pTask->msgInfo.retryCount = 0;
- // transtate msg has been sent to downstream successfully. let's transfer the fill-history task state
+ // trans-state msg has been sent to downstream successfully. let's transfer the fill-history task state
if (pTask->msgInfo.dispatchMsgType == STREAM_INPUT__TRANS_STATE) {
stDebug("s-task:%s dispatch transtate msgId:%d to downstream successfully, start to transfer state", id, msgId);
ASSERT(pTask->info.fillHistory == 1);
@@ -1093,6 +1101,8 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
if (code != TSDB_CODE_SUCCESS) { // todo: do nothing if error happens
}
+ clearBufferedDispatchMsg(pTask);
+
// now ready for next data output
atomic_store_8(&pTask->outputq.status, TASK_OUTPUT_STATUS__NORMAL);
} else {
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index bac6022834..cb51d90fba 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -353,7 +353,8 @@ int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) {
if (pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE) {
ASSERT(status == TASK_STATUS__HALT || status == TASK_STATUS__DROPPING || status == TASK_STATUS__STOP);
} else {
- ASSERT(status == TASK_STATUS__READY || status == TASK_STATUS__DROPPING || status == TASK_STATUS__STOP);
+ ASSERT(status == TASK_STATUS__READY || status == TASK_STATUS__PAUSE || status == TASK_STATUS__DROPPING ||
+ status == TASK_STATUS__STOP);
int32_t code = streamTaskHandleEvent(pStreamTask->status.pSM, TASK_EVENT_HALT);
if (code != TSDB_CODE_SUCCESS) {
stError("s-task:%s halt stream task:%s failed, code:%s not transfer state to stream task", id,
@@ -410,6 +411,12 @@ int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) {
return TSDB_CODE_SUCCESS;
}
+static int32_t haltCallback(SStreamTask* pTask, void* param) {
+ streamTaskOpenAllUpstreamInput(pTask);
+ streamTaskSendCheckpointReq(pTask);
+ return TSDB_CODE_SUCCESS;
+}
+
int32_t streamTransferStateToStreamTask(SStreamTask* pTask) {
int32_t code = TSDB_CODE_SUCCESS;
SStreamMeta* pMeta = pTask->pMeta;
@@ -419,11 +426,12 @@ int32_t streamTransferStateToStreamTask(SStreamTask* pTask) {
int32_t level = pTask->info.taskLevel;
if (level == TASK_LEVEL__AGG || level == TASK_LEVEL__SOURCE) { // do transfer task operator states.
code = streamDoTransferStateToStreamTask(pTask);
- } else { // no state transfer for sink tasks, and drop fill-history task, followed by opening inputQ of sink task.
+ } else {
+ // no state transfer for sink tasks, and drop fill-history task, followed by opening inputQ of sink task.
SStreamTask* pStreamTask = streamMetaAcquireTask(pMeta, pTask->streamTaskId.streamId, pTask->streamTaskId.taskId);
if (pStreamTask != NULL) {
// halt the related stream sink task
- code = streamTaskHandleEvent(pStreamTask->status.pSM, TASK_EVENT_HALT);
+ code = streamTaskHandleEventAsync(pStreamTask->status.pSM, TASK_EVENT_HALT, haltCallback, NULL);
if (code != TSDB_CODE_SUCCESS) {
stError("s-task:%s halt stream task:%s failed, code:%s not transfer state to stream task", pTask->id.idStr,
pStreamTask->id.idStr, tstrerror(code));
@@ -432,9 +440,6 @@ int32_t streamTransferStateToStreamTask(SStreamTask* pTask) {
} else {
stDebug("s-task:%s halt by related fill-history task:%s", pStreamTask->id.idStr, pTask->id.idStr);
}
-
- streamTaskOpenAllUpstreamInput(pStreamTask);
- streamTaskSendCheckpointReq(pStreamTask);
streamMetaReleaseTask(pMeta, pStreamTask);
}
}
diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c
index b35f401cb9..a072ee1f6f 100644
--- a/source/libs/stream/src/streamMeta.c
+++ b/source/libs/stream/src/streamMeta.c
@@ -70,7 +70,7 @@ static void streamMetaEnvInit() {
streamTimerInit();
}
-void streamMetaInit() { taosThreadOnce(&streamMetaModuleInit, streamMetaEnvInit);}
+void streamMetaInit() { taosThreadOnce(&streamMetaModuleInit, streamMetaEnvInit); }
void streamMetaCleanup() {
taosCloseRef(streamBackendId);
@@ -669,6 +669,13 @@ static void doRemoveIdFromList(SStreamMeta* pMeta, int32_t num, SStreamTaskId* i
}
}
+static int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask, void* param) {
+ if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
+ streamTaskSendCheckpointSourceRsp(pTask);
+ }
+ return 0;
+}
+
int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId) {
SStreamTask* pTask = NULL;
@@ -687,7 +694,7 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t
}
// handle the dropping event
- streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_DROPPING);
+ streamTaskHandleEventAsync(pTask->status.pSM, TASK_EVENT_DROPPING, streamTaskSendTransSuccessMsg, NULL);
} else {
stDebug("vgId:%d failed to find the task:0x%x, it may be dropped already", pMeta->vgId, taskId);
streamMetaWUnLock(pMeta);
@@ -1104,14 +1111,14 @@ static int32_t metaHeartbeatToMnodeImpl(SStreamMeta* pMeta) {
.inputQUsed = SIZE_IN_MiB(streamQueueGetItemSize((*pTask)->inputq.queue)),
};
- entry.inputRate = entry.inputQUsed * 100.0 / (2*STREAM_TASK_QUEUE_CAPACITY_IN_SIZE);
+ entry.inputRate = entry.inputQUsed * 100.0 / (2 * STREAM_TASK_QUEUE_CAPACITY_IN_SIZE);
if ((*pTask)->info.taskLevel == TASK_LEVEL__SINK) {
entry.sinkQuota = (*pTask)->outputInfo.pTokenBucket->quotaRate;
entry.sinkDataSize = SIZE_IN_MiB((*pTask)->execInfo.sink.dataSize);
}
if ((*pTask)->chkInfo.checkpointingId != 0) {
- entry.checkpointFailed = ((*pTask)->chkInfo.failedId >= (*pTask)->chkInfo.checkpointingId)? 1:0;
+ entry.checkpointFailed = ((*pTask)->chkInfo.failedId >= (*pTask)->chkInfo.checkpointingId) ? 1 : 0;
entry.checkpointId = (*pTask)->chkInfo.checkpointingId;
entry.chkpointTransId = (*pTask)->chkInfo.transId;
@@ -1172,7 +1179,7 @@ static int32_t metaHeartbeatToMnodeImpl(SStreamMeta* pMeta) {
stDebug("vgId:%d no tasks and no mnd epset, not send stream hb to mnode", pMeta->vgId);
}
- _end:
+_end:
streamMetaClearHbMsg(&hbMsg);
return TSDB_CODE_SUCCESS;
}
@@ -1304,28 +1311,28 @@ void streamMetaResetStartInfo(STaskStartInfo* pStartInfo) {
}
void streamMetaRLock(SStreamMeta* pMeta) {
-// stTrace("vgId:%d meta-rlock", pMeta->vgId);
+ // stTrace("vgId:%d meta-rlock", pMeta->vgId);
taosThreadRwlockRdlock(&pMeta->lock);
}
void streamMetaRUnLock(SStreamMeta* pMeta) {
-// stTrace("vgId:%d meta-runlock", pMeta->vgId);
+ // stTrace("vgId:%d meta-runlock", pMeta->vgId);
int32_t code = taosThreadRwlockUnlock(&pMeta->lock);
if (code != TSDB_CODE_SUCCESS) {
stError("vgId:%d meta-runlock failed, code:%d", pMeta->vgId, code);
} else {
-// stTrace("vgId:%d meta-runlock completed", pMeta->vgId);
+ // stTrace("vgId:%d meta-runlock completed", pMeta->vgId);
}
}
void streamMetaWLock(SStreamMeta* pMeta) {
-// stTrace("vgId:%d meta-wlock", pMeta->vgId);
+ // stTrace("vgId:%d meta-wlock", pMeta->vgId);
taosThreadRwlockWrlock(&pMeta->lock);
-// stTrace("vgId:%d meta-wlock completed", pMeta->vgId);
+ // stTrace("vgId:%d meta-wlock completed", pMeta->vgId);
}
void streamMetaWUnLock(SStreamMeta* pMeta) {
-// stTrace("vgId:%d meta-wunlock", pMeta->vgId);
+ // stTrace("vgId:%d meta-wunlock", pMeta->vgId);
taosThreadRwlockUnlock(&pMeta->lock);
}
@@ -1395,7 +1402,7 @@ void streamMetaUpdateStageRole(SStreamMeta* pMeta, int64_t stage, bool isLeader)
pMeta->sendMsgBeforeClosing = true;
}
- pMeta->role = (isLeader)? NODE_ROLE_LEADER:NODE_ROLE_FOLLOWER;
+ pMeta->role = (isLeader) ? NODE_ROLE_LEADER : NODE_ROLE_FOLLOWER;
streamMetaWUnLock(pMeta);
if (isLeader) {
@@ -1531,8 +1538,8 @@ int32_t streamMetaStopAllTasks(SStreamMeta* pMeta) {
bool streamMetaAllTasksReady(const SStreamMeta* pMeta) {
int32_t num = taosArrayGetSize(pMeta->pTaskList);
- for(int32_t i = 0; i < num; ++i) {
- STaskId* pTaskId = taosArrayGet(pMeta->pTaskList, i);
+ for (int32_t i = 0; i < num; ++i) {
+ STaskId* pTaskId = taosArrayGet(pMeta->pTaskList, i);
SStreamTask** ppTask = taosHashGet(pMeta->pTasksMap, pTaskId, sizeof(*pTaskId));
if (ppTask == NULL) {
continue;
@@ -1633,7 +1640,7 @@ int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int3
pStartInfo->elapsedTime = (pStartInfo->startTs != 0) ? pStartInfo->readyTs - pStartInfo->startTs : 0;
stDebug("vgId:%d all %d task(s) check downstream completed, last completed task:0x%x (succ:%d) startTs:%" PRId64
- ", readyTs:%" PRId64 " total elapsed time:%.2fs",
+ ", readyTs:%" PRId64 " total elapsed time:%.2fs",
pMeta->vgId, numOfTotal, taskId, ready, pStartInfo->startTs, pStartInfo->readyTs,
pStartInfo->elapsedTime / 1000.0);
diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c
index 3d0241df75..723f04c499 100644
--- a/source/libs/stream/src/streamSessionState.c
+++ b/source/libs/stream/src/streamSessionState.c
@@ -156,6 +156,7 @@ int32_t getSessionWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey,
(*pVal) = pPos;
SSessionKey* pDestWinKey = (SSessionKey*)pPos->pKey;
pPos->beUsed = true;
+ pPos->beFlushed = false;
*pKey = *pDestWinKey;
goto _end;
}
@@ -167,6 +168,7 @@ int32_t getSessionWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey,
(*pVal) = pPos;
SSessionKey* pDestWinKey = (SSessionKey*)pPos->pKey;
pPos->beUsed = true;
+ pPos->beFlushed = false;
*pKey = *pDestWinKey;
goto _end;
}
@@ -380,6 +382,14 @@ static SStreamStateCur* seekKeyCurrentPrev_buff(SStreamFileState* pFileState, co
(*pWins) = pWinStates;
}
+ if (size > 0 && index == -1) {
+ SRowBuffPos* pPos = taosArrayGetP(pWinStates, 0);
+ SSessionKey* pWin = (SSessionKey*)pPos->pKey;
+ if (pWinKey->win.skey == pWin->win.skey) {
+ index = 0;
+ }
+ }
+
if (index >= 0) {
pCur = createSessionStateCursor(pFileState);
pCur->buffIndex = index;
@@ -387,6 +397,7 @@ static SStreamStateCur* seekKeyCurrentPrev_buff(SStreamFileState* pFileState, co
*pIndex = index;
}
}
+
return pCur;
}
@@ -666,6 +677,7 @@ int32_t getStateWinResultBuff(SStreamFileState* pFileState, SSessionKey* key, ch
(*pVal) = pPos;
SSessionKey* pDestWinKey = (SSessionKey*)pPos->pKey;
pPos->beUsed = true;
+ pPos->beFlushed = false;
*key = *pDestWinKey;
goto _end;
}
@@ -679,6 +691,7 @@ int32_t getStateWinResultBuff(SStreamFileState* pFileState, SSessionKey* key, ch
(*pVal) = pPos;
SSessionKey* pDestWinKey = (SSessionKey*)pPos->pKey;
pPos->beUsed = true;
+ pPos->beFlushed = false;
*key = *pDestWinKey;
goto _end;
}
@@ -771,6 +784,7 @@ int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, C
(*pVal) = pPos;
SSessionKey* pDestWinKey = (SSessionKey*)pPos->pKey;
pPos->beUsed = true;
+ pPos->beFlushed = false;
*pWinKey = *pDestWinKey;
goto _end;
}
@@ -799,6 +813,7 @@ int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, C
(*pVal) = pPos;
SSessionKey* pDestWinKey = (SSessionKey*)pPos->pKey;
pPos->beUsed = true;
+ pPos->beFlushed = false;
*pWinKey = *pDestWinKey;
goto _end;
}
diff --git a/source/libs/stream/src/streamStart.c b/source/libs/stream/src/streamStart.c
index 6112a208c6..cb340ade32 100644
--- a/source/libs/stream/src/streamStart.c
+++ b/source/libs/stream/src/streamStart.c
@@ -385,7 +385,7 @@ int32_t streamTaskOnScanhistoryTaskReady(SStreamTask* pTask) {
void doProcessDownstreamReadyRsp(SStreamTask* pTask) {
EStreamTaskEvent event = (pTask->info.fillHistory == 0) ? TASK_EVENT_INIT : TASK_EVENT_INIT_SCANHIST;
- streamTaskOnHandleEventSuccess(pTask->status.pSM, event);
+ streamTaskOnHandleEventSuccess(pTask->status.pSM, event, NULL, NULL);
int64_t initTs = pTask->execInfo.init;
int64_t startTs = pTask->execInfo.start;
diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c
index 9639921c77..45a9a68d3d 100644
--- a/source/libs/stream/src/streamTask.c
+++ b/source/libs/stream/src/streamTask.c
@@ -39,7 +39,7 @@ static int32_t doUpdateTaskEpset(SStreamTask* pTask, int32_t nodeId, SEpSet* pEp
stDebug("s-task:0x%x (vgId:%d) self node epset is updated %s", pTask->id.taskId, nodeId, buf);
}
- // check for the dispath info and the upstream task info
+ // check for the dispatch info and the upstream task info
int32_t level = pTask->info.taskLevel;
if (level == TASK_LEVEL__SOURCE) {
streamTaskUpdateDownstreamInfo(pTask, nodeId, pEpSet);
@@ -412,9 +412,7 @@ void tFreeStreamTask(SStreamTask* pTask) {
pTask->pReadyMsgList = taosArrayDestroy(pTask->pReadyMsgList);
if (pTask->msgInfo.pData != NULL) {
- destroyDispatchMsg(pTask->msgInfo.pData, getNumOfDispatchBranch(pTask));
- pTask->msgInfo.pData = NULL;
- pTask->msgInfo.dispatchMsgType = 0;
+ clearBufferedDispatchMsg(pTask);
}
if (pTask->outputInfo.type == TASK_OUTPUT__TABLE) {
@@ -624,6 +622,7 @@ void streamTaskSetFixedDownstreamInfo(SStreamTask* pTask, const SStreamTask* pDo
void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet) {
char buf[512] = {0};
EPSET_TO_STR(pEpSet, buf);
+ int32_t id = pTask->id.taskId;
int8_t type = pTask->outputInfo.type;
if (type == TASK_OUTPUT__SHUFFLE_DISPATCH) {
@@ -635,8 +634,8 @@ void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SE
if (pVgInfo->vgId == nodeId) {
epsetAssign(&pVgInfo->epSet, pEpSet);
- stDebug("s-task:0x%x update the dispatch info, task:0x%x(nodeId:%d) newEpset:%s", pTask->id.taskId,
- pVgInfo->taskId, nodeId, buf);
+ stDebug("s-task:0x%x update the dispatch info, task:0x%x(nodeId:%d) newEpset:%s", id, pVgInfo->taskId, nodeId,
+ buf);
break;
}
}
@@ -644,11 +643,9 @@ void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SE
STaskDispatcherFixed* pDispatcher = &pTask->outputInfo.fixedDispatcher;
if (pDispatcher->nodeId == nodeId) {
epsetAssign(&pDispatcher->epSet, pEpSet);
- stDebug("s-task:0x%x update the dispatch info, task:0x%x(nodeId:%d) newEpSet:%s", pTask->id.taskId,
- pDispatcher->taskId, nodeId, buf);
+ stDebug("s-task:0x%x update the dispatch info, task:0x%x(nodeId:%d) newEpset:%s", id, pDispatcher->taskId, nodeId,
+ buf);
}
- } else {
- // do nothing
}
}
@@ -766,21 +763,13 @@ int8_t streamTaskSetSchedStatusInactive(SStreamTask* pTask) {
return status;
}
-int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t resetRelHalt, bool metaLock) {
- if (pTask == NULL) {
- return TSDB_CODE_SUCCESS;
- }
-
+int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t resetRelHalt) {
SStreamMeta* pMeta = pTask->pMeta;
STaskId sTaskId = {.streamId = pTask->streamTaskId.streamId, .taskId = pTask->streamTaskId.taskId};
if (pTask->info.fillHistory == 0) {
return TSDB_CODE_SUCCESS;
}
- if (metaLock) {
- streamMetaWLock(pMeta);
- }
-
SStreamTask** ppStreamTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &sTaskId, sizeof(sTaskId));
if (ppStreamTask != NULL) {
stDebug("s-task:%s clear the related stream task:0x%x attr to fill-history task", pTask->id.idStr,
@@ -798,10 +787,6 @@ int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t resetRelHalt, bool
taosThreadMutexUnlock(&(*ppStreamTask)->lock);
}
- if (metaLock) {
- streamMetaWUnLock(pMeta);
- }
-
return TSDB_CODE_SUCCESS;
}
@@ -869,8 +854,8 @@ void streamTaskStatusCopy(STaskStatusEntry* pDst, const STaskStatusEntry* pSrc)
pDst->chkpointTransId = pSrc->chkpointTransId;
}
-void streamTaskPause(SStreamMeta* pMeta, SStreamTask* pTask) {
- streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_PAUSE);
+static int32_t taskPauseCallback(SStreamTask* pTask, void* param) {
+ SStreamMeta* pMeta = pTask->pMeta;
int32_t num = atomic_add_fetch_32(&pMeta->numOfPausedTasks, 1);
stInfo("vgId:%d s-task:%s pause stream task. pause task num:%d", pMeta->vgId, pTask->id.idStr, num);
@@ -882,24 +867,24 @@ void streamTaskPause(SStreamMeta* pMeta, SStreamTask* pTask) {
}
stDebug("vgId:%d s-task:%s set pause flag and pause task", pMeta->vgId, pTask->id.idStr);
+ return TSDB_CODE_SUCCESS;
+}
+
+void streamTaskPause(SStreamMeta* pMeta, SStreamTask* pTask) {
+ streamTaskHandleEventAsync(pTask->status.pSM, TASK_EVENT_PAUSE, taskPauseCallback, NULL);
}
void streamTaskResume(SStreamTask* pTask) {
SStreamTaskState prevState = *streamTaskGetStatus(pTask);
- SStreamMeta* pMeta = pTask->pMeta;
- if (prevState.state == TASK_STATUS__PAUSE || prevState.state == TASK_STATUS__HALT) {
- streamTaskRestoreStatus(pTask);
-
- char* pNew = streamTaskGetStatus(pTask)->name;
- if (prevState.state == TASK_STATUS__PAUSE) {
- int32_t num = atomic_sub_fetch_32(&pMeta->numOfPausedTasks, 1);
- stInfo("s-task:%s status:%s resume from %s, paused task(s):%d", pTask->id.idStr, pNew, prevState.name, num);
- } else {
- stInfo("s-task:%s status:%s resume from %s", pTask->id.idStr, pNew, prevState.name);
- }
+ SStreamMeta* pMeta = pTask->pMeta;
+ int32_t code = streamTaskRestoreStatus(pTask);
+ if (code == TSDB_CODE_SUCCESS) {
+ char* pNew = streamTaskGetStatus(pTask)->name;
+ int32_t num = atomic_sub_fetch_32(&pMeta->numOfPausedTasks, 1);
+ stInfo("s-task:%s status:%s resume from %s, paused task(s):%d", pTask->id.idStr, pNew, prevState.name, num);
} else {
- stDebug("s-task:%s status:%s not in pause/halt status, no need to resume", pTask->id.idStr, prevState.name);
+ stInfo("s-task:%s status:%s no need to resume, paused task(s):%d", pTask->id.idStr, prevState.name, pMeta->numOfPausedTasks);
}
}
diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c
index 83e71c42bc..6aa215586a 100644
--- a/source/libs/stream/src/streamTaskSm.c
+++ b/source/libs/stream/src/streamTaskSm.c
@@ -59,20 +59,23 @@ static int32_t streamTaskInitStatus(SStreamTask* pTask);
static int32_t streamTaskKeepCurrentVerInWal(SStreamTask* pTask);
static int32_t initStateTransferTable();
static void doInitStateTransferTable(void);
-static int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask);
static STaskStateTrans createStateTransform(ETaskStatus current, ETaskStatus next, EStreamTaskEvent event,
__state_trans_fn fn, __state_trans_succ_fn succFn,
- SAttachedEventInfo* pEventInfo, bool autoInvoke);
+ SFutureHandleEventInfo* pEventInfo);
static int32_t dummyFn(SStreamTask* UNUSED_PARAM(p)) { return TSDB_CODE_SUCCESS; }
-static int32_t attachEvent(SStreamTask* pTask, SAttachedEventInfo* pEvtInfo) {
+static int32_t attachWaitedEvent(SStreamTask* pTask, SFutureHandleEventInfo* pEvtInfo) {
char* p = streamTaskGetStatus(pTask)->name;
stDebug("s-task:%s status:%s attach event:%s required status:%s, since not allowed to handle it", pTask->id.idStr, p,
GET_EVT_NAME(pEvtInfo->event), StreamTaskStatusList[pEvtInfo->status].name);
- taosArrayPush(pTask->status.pSM->pWaitingEventList, pEvtInfo);
+
+ SArray* pList = pTask->status.pSM->pWaitingEventList;
+ taosArrayPush(pList, pEvtInfo);
+
+ stDebug("s-task:%s add into waiting list, total waiting events:%d", pTask->id.idStr, (int32_t)taosArrayGetSize(pList));
return 0;
}
@@ -85,18 +88,6 @@ int32_t streamTaskInitStatus(SStreamTask* pTask) {
return 0;
}
-static int32_t streamTaskDoCheckpoint(SStreamTask* pTask) {
- stDebug("s-task:%s start to do checkpoint", pTask->id.idStr);
- return 0;
-}
-
-int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask) {
- if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
- streamTaskSendCheckpointSourceRsp(pTask);
- }
- return 0;
-}
-
int32_t streamTaskKeepCurrentVerInWal(SStreamTask* pTask) {
if (!HAS_RELATED_FILLHISTORY_TASK(pTask)) {
stError("s-task:%s no related fill-history task, since it may have been dropped already", pTask->id.idStr);
@@ -170,9 +161,11 @@ static int32_t doHandleWaitingEvent(SStreamTaskSM* pSM, const char* pEventName,
stDebug("s-task:%s handle event:%s completed, elapsed time:%" PRId64 "ms state:%s -> %s", pTask->id.idStr,
pEventName, el, pSM->prev.state.name, pSM->current.name);
- SAttachedEventInfo* pEvtInfo = taosArrayGet(pSM->pWaitingEventList, 0);
+ ASSERT(taosArrayGetSize(pSM->pWaitingEventList) == 1);
- // OK, let's handle the attached event, since the task has reached the required status now
+ SFutureHandleEventInfo* pEvtInfo = taosArrayGet(pSM->pWaitingEventList, 0);
+
+ // OK, let's handle the waiting event, since the task has reached the required status now
if (pSM->current.state == pEvtInfo->status) {
stDebug("s-task:%s handle the event:%s in waiting list, state:%s", pTask->id.idStr,
GET_EVT_NAME(pEvtInfo->event), pSM->current.name);
@@ -189,7 +182,7 @@ static int32_t doHandleWaitingEvent(SStreamTaskSM* pSM, const char* pEventName,
code = pNextTrans->pAction(pSM->pTask);
if (pNextTrans->autoInvokeEndFn) {
- return streamTaskOnHandleEventSuccess(pSM, pNextTrans->event);
+ return streamTaskOnHandleEventSuccess(pSM, pNextTrans->event, pEvtInfo->callBackFn, pEvtInfo->pParam);
} else {
return code;
}
@@ -203,30 +196,61 @@ static int32_t doHandleWaitingEvent(SStreamTaskSM* pSM, const char* pEventName,
return code;
}
-void streamTaskRestoreStatus(SStreamTask* pTask) {
+static int32_t removeEventInWaitingList(SStreamTask* pTask, EStreamTaskEvent event) {
SStreamTaskSM* pSM = pTask->status.pSM;
+ bool removed = false;
taosThreadMutexLock(&pTask->lock);
- ASSERT(pSM->pActiveTrans == NULL);
- ASSERT(pSM->current.state == TASK_STATUS__PAUSE || pSM->current.state == TASK_STATUS__HALT);
+ int32_t num = taosArrayGetSize(pSM->pWaitingEventList);
+ for (int32_t i = 0; i < num; ++i) {
+ SFutureHandleEventInfo* pInfo = taosArrayGet(pSM->pWaitingEventList, i);
+ if (pInfo->event == event) {
+ taosArrayRemove(pSM->pWaitingEventList, i);
+ stDebug("s-task:%s pause event in waiting list not be handled yet, remove it from waiting list, remaining:%d",
+ pTask->id.idStr, pInfo->event);
+ removed = true;
+ break;
+ }
+ }
- SStreamTaskState state = pSM->current;
- pSM->current = pSM->prev.state;
-
- pSM->prev.state = state;
- pSM->prev.evt = 0;
-
- pSM->startTs = taosGetTimestampMs();
-
- if (taosArrayGetSize(pSM->pWaitingEventList) > 0) {
- stDebug("s-task:%s restore status, %s -> %s, and then handle waiting event", pTask->id.idStr, pSM->prev.state.name, pSM->current.name);
- doHandleWaitingEvent(pSM, "restore-pause/halt", pTask);
- } else {
- stDebug("s-task:%s restore status, %s -> %s", pTask->id.idStr, pSM->prev.state.name, pSM->current.name);
+ if (!removed) {
+ stDebug("s-task:%s failed to remove event:%s in waiting list", pTask->id.idStr, StreamTaskEventList[event].name);
}
taosThreadMutexUnlock(&pTask->lock);
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t streamTaskRestoreStatus(SStreamTask* pTask) {
+ SStreamTaskSM* pSM = pTask->status.pSM;
+ int32_t code = 0;
+
+ taosThreadMutexLock(&pTask->lock);
+
+ if (pSM->current.state == TASK_STATUS__PAUSE && pSM->pActiveTrans == NULL) {
+ SStreamTaskState state = pSM->current;
+ pSM->current = pSM->prev.state;
+
+ pSM->prev.state = state;
+ pSM->prev.evt = 0;
+
+ pSM->startTs = taosGetTimestampMs();
+
+ if (taosArrayGetSize(pSM->pWaitingEventList) > 0) {
+ stDebug("s-task:%s restore status, %s -> %s, and then handle waiting event", pTask->id.idStr,
+ pSM->prev.state.name, pSM->current.name);
+ doHandleWaitingEvent(pSM, "restore-pause/halt", pTask);
+ } else {
+ stDebug("s-task:%s restore status, %s -> %s", pTask->id.idStr, pSM->prev.state.name, pSM->current.name);
+ }
+ } else {
+ removeEventInWaitingList(pTask, TASK_EVENT_PAUSE);
+ code = -1; // failed to restore the status
+ }
+
+ taosThreadMutexUnlock(&pTask->lock);
+ return code;
}
SStreamTaskSM* streamCreateStateMachine(SStreamTask* pTask) {
@@ -242,7 +266,7 @@ SStreamTaskSM* streamCreateStateMachine(SStreamTask* pTask) {
}
pSM->pTask = pTask;
- pSM->pWaitingEventList = taosArrayInit(4, sizeof(SAttachedEventInfo));
+ pSM->pWaitingEventList = taosArrayInit(4, sizeof(SFutureHandleEventInfo));
if (pSM->pWaitingEventList == NULL) {
taosMemoryFree(pSM);
@@ -273,7 +297,7 @@ static int32_t doHandleEvent(SStreamTaskSM* pSM, EStreamTaskEvent event, STaskSt
const char* id = pTask->id.idStr;
if (pTrans->attachEvent.event != 0) {
- attachEvent(pTask, &pTrans->attachEvent);
+ attachWaitedEvent(pTask, &pTrans->attachEvent);
taosThreadMutexUnlock(&pTask->lock);
while (1) {
@@ -303,7 +327,32 @@ static int32_t doHandleEvent(SStreamTaskSM* pSM, EStreamTaskEvent event, STaskSt
// todo handle error code;
if (pTrans->autoInvokeEndFn) {
- streamTaskOnHandleEventSuccess(pSM, event);
+ streamTaskOnHandleEventSuccess(pSM, event, NULL, NULL);
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t doHandleEventAsync(SStreamTaskSM* pSM, EStreamTaskEvent event, STaskStateTrans* pTrans, __state_trans_user_fn callbackFn, void* param) {
+ SStreamTask* pTask = pSM->pTask;
+ if (pTrans->attachEvent.event != 0) {
+ SFutureHandleEventInfo info = pTrans->attachEvent;
+ info.pParam = param;
+ info.callBackFn = callbackFn;
+
+ attachWaitedEvent(pTask, &info);
+ taosThreadMutexUnlock(&pTask->lock);
+ } else { // override current active trans
+ pSM->pActiveTrans = pTrans;
+ pSM->startTs = taosGetTimestampMs();
+ taosThreadMutexUnlock(&pTask->lock);
+
+ int32_t code = pTrans->pAction(pTask);
+ // todo handle error code;
+
+ if (pTrans->autoInvokeEndFn) {
+ streamTaskOnHandleEventSuccess(pSM, event, callbackFn, param);
}
}
@@ -349,6 +398,45 @@ int32_t streamTaskHandleEvent(SStreamTaskSM* pSM, EStreamTaskEvent event) {
return code;
}
+int32_t streamTaskHandleEventAsync(SStreamTaskSM* pSM, EStreamTaskEvent event, __state_trans_user_fn callbackFn, void* param) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ SStreamTask* pTask = pSM->pTask;
+ STaskStateTrans* pTrans = NULL;
+
+ while (1) {
+ taosThreadMutexLock(&pTask->lock);
+
+ if (pSM->pActiveTrans != NULL && pSM->pActiveTrans->autoInvokeEndFn) {
+ EStreamTaskEvent evt = pSM->pActiveTrans->event;
+ taosThreadMutexUnlock(&pTask->lock);
+
+ stDebug("s-task:%s status:%s handling event:%s by some other thread, wait for 100ms and check if completed",
+ pTask->id.idStr, pSM->current.name, GET_EVT_NAME(evt));
+ taosMsleep(100);
+ } else {
+ // no active event trans exists, handle this event directly
+ pTrans = streamTaskFindTransform(pSM->current.state, event);
+ if (pTrans == NULL) {
+ stDebug("s-task:%s failed to handle event:%s, status:%s", pTask->id.idStr, GET_EVT_NAME(event), pSM->current.name);
+ taosThreadMutexUnlock(&pTask->lock);
+ return TSDB_CODE_STREAM_INVALID_STATETRANS;
+ }
+
+ if (pSM->pActiveTrans != NULL) {
+ // currently in some state transfer procedure, not auto invoke transfer, quit from this procedure
+ stDebug("s-task:%s event:%s handle procedure quit, status %s -> %s failed, handle event %s now",
+ pTask->id.idStr, GET_EVT_NAME(pSM->pActiveTrans->event), pSM->current.name,
+ pSM->pActiveTrans->next.name, GET_EVT_NAME(event));
+ }
+
+ code = doHandleEventAsync(pSM, event, pTrans, callbackFn, param);
+ break;
+ }
+ }
+
+ return code;
+}
+
static void keepPrevInfo(SStreamTaskSM* pSM) {
STaskStateTrans* pTrans = pSM->pActiveTrans;
@@ -356,8 +444,9 @@ static void keepPrevInfo(SStreamTaskSM* pSM) {
pSM->prev.evt = pTrans->event;
}
-int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent event) {
+int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent event, __state_trans_user_fn callbackFn, void* param) {
SStreamTask* pTask = pSM->pTask;
+ const char* id = pTask->id.idStr;
// do update the task status
taosThreadMutexLock(&pTask->lock);
@@ -369,16 +458,16 @@ int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent even
s == TASK_STATUS__UNINIT || s == TASK_STATUS__READY);
// the pSM->prev.evt may be 0, so print string is not appropriate.
- stDebug("s-task:%s event:%s handled failed, current status:%s, trigger event:%s", pTask->id.idStr,
- GET_EVT_NAME(event), pSM->current.name, GET_EVT_NAME(pSM->prev.evt));
+ stDebug("s-task:%s event:%s handled failed, current status:%s, trigger event:%s", id, GET_EVT_NAME(event),
+ pSM->current.name, GET_EVT_NAME(pSM->prev.evt));
taosThreadMutexUnlock(&pTask->lock);
return TSDB_CODE_STREAM_INVALID_STATETRANS;
}
if (pTrans->event != event) {
- stWarn("s-task:%s handle event:%s failed, current status:%s, active trans evt:%s", pTask->id.idStr,
- GET_EVT_NAME(event), pSM->current.name, GET_EVT_NAME(pTrans->event));
+ stWarn("s-task:%s handle event:%s failed, current status:%s, active trans evt:%s", id, GET_EVT_NAME(event),
+ pSM->current.name, GET_EVT_NAME(pTrans->event));
taosThreadMutexUnlock(&pTask->lock);
return TSDB_CODE_STREAM_INVALID_STATETRANS;
}
@@ -388,16 +477,31 @@ int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent even
pSM->current = pTrans->next;
pSM->pActiveTrans = NULL;
+ // todo remove it
// on success callback, add into lock if necessary, or maybe we should add an option for this?
pTrans->pSuccAction(pTask);
+ taosThreadMutexUnlock(&pTask->lock);
+
+ // todo: add parameter to control lock
+ // after handling the callback function assigned by invoker, go on handling the waiting tasks
+ if (callbackFn != NULL) {
+ stDebug("s-task:%s start to handle user-specified callback fn for event:%s", id, GET_EVT_NAME(pTrans->event));
+ callbackFn(pSM->pTask, param);
+
+ stDebug("s-task:%s handle user-specified callback fn for event:%s completed", id, GET_EVT_NAME(pTrans->event));
+ }
+
+ taosThreadMutexLock(&pTask->lock);
+
+ // tasks in waiting list
if (taosArrayGetSize(pSM->pWaitingEventList) > 0) {
doHandleWaitingEvent(pSM, GET_EVT_NAME(pTrans->event), pTask);
} else {
taosThreadMutexUnlock(&pTask->lock);
int64_t el = (taosGetTimestampMs() - pSM->startTs);
- stDebug("s-task:%s handle event:%s completed, elapsed time:%" PRId64 "ms state:%s -> %s", pTask->id.idStr,
+ stDebug("s-task:%s handle event:%s completed, elapsed time:%" PRId64 "ms state:%s -> %s", id,
GET_EVT_NAME(pTrans->event), el, pSM->prev.state.name, pSM->current.name);
}
@@ -453,7 +557,7 @@ void streamTaskSetStatusReady(SStreamTask* pTask) {
}
STaskStateTrans createStateTransform(ETaskStatus current, ETaskStatus next, EStreamTaskEvent event, __state_trans_fn fn,
- __state_trans_succ_fn succFn, SAttachedEventInfo* pEventInfo, bool autoInvoke) {
+ __state_trans_succ_fn succFn, SFutureHandleEventInfo* pEventInfo) {
STaskStateTrans trans = {0};
trans.state = StreamTaskStatusList[current];
trans.next = StreamTaskStatusList[next];
@@ -468,7 +572,7 @@ STaskStateTrans createStateTransform(ETaskStatus current, ETaskStatus next, EStr
trans.pAction = (fn != NULL) ? fn : dummyFn;
trans.pSuccAction = (succFn != NULL) ? succFn : dummyFn;
- trans.autoInvokeEndFn = autoInvoke;
+ trans.autoInvokeEndFn = (fn == NULL);
return trans;
}
@@ -482,93 +586,93 @@ void doInitStateTransferTable(void) {
streamTaskSMTrans = taosArrayInit(8, sizeof(STaskStateTrans));
// initialization event handle
- STaskStateTrans trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__READY, TASK_EVENT_INIT, streamTaskInitStatus, streamTaskOnNormalTaskReady, false, false);
+ STaskStateTrans trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__READY, TASK_EVENT_INIT, streamTaskInitStatus, streamTaskOnNormalTaskReady, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__SCAN_HISTORY, TASK_EVENT_INIT_SCANHIST, streamTaskInitStatus, streamTaskOnScanhistoryTaskReady, false, false);
+ trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__SCAN_HISTORY, TASK_EVENT_INIT_SCANHIST, streamTaskInitStatus, streamTaskOnScanhistoryTaskReady, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
// scan-history related event
- trans = createStateTransform(TASK_STATUS__SCAN_HISTORY, TASK_STATUS__READY, TASK_EVENT_SCANHIST_DONE, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__SCAN_HISTORY, TASK_STATUS__READY, TASK_EVENT_SCANHIST_DONE, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
// halt stream task, from other task status
- trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__HALT, TASK_EVENT_HALT, NULL, streamTaskKeepCurrentVerInWal, NULL, true);
+ trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__HALT, TASK_EVENT_HALT, NULL, streamTaskKeepCurrentVerInWal, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__HALT, TASK_EVENT_HALT, NULL, streamTaskKeepCurrentVerInWal, NULL, true);
+ trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__HALT, TASK_EVENT_HALT, NULL, streamTaskKeepCurrentVerInWal, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- SAttachedEventInfo info = {.status = TASK_STATUS__READY, .event = TASK_EVENT_HALT};
+ SFutureHandleEventInfo info = {.status = TASK_STATUS__READY, .event = TASK_EVENT_HALT};
- trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__HALT, TASK_EVENT_HALT, NULL, streamTaskKeepCurrentVerInWal, &info, true);
+ trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__HALT, TASK_EVENT_HALT, NULL, streamTaskKeepCurrentVerInWal, &info);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__HALT, TASK_EVENT_HALT, NULL, streamTaskKeepCurrentVerInWal, NULL, true);
+ trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__HALT, TASK_EVENT_HALT, NULL, streamTaskKeepCurrentVerInWal, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
// checkpoint related event
- trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__CK, TASK_EVENT_GEN_CHECKPOINT, NULL, streamTaskDoCheckpoint, NULL, true);
+ trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__CK, TASK_EVENT_GEN_CHECKPOINT, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__CK, TASK_EVENT_GEN_CHECKPOINT, NULL, streamTaskDoCheckpoint, NULL, true);
+ trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__CK, TASK_EVENT_GEN_CHECKPOINT, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__READY, TASK_EVENT_CHECKPOINT_DONE, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__READY, TASK_EVENT_CHECKPOINT_DONE, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
// pause & resume related event handle
- trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__SCAN_HISTORY, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__SCAN_HISTORY, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- info = (SAttachedEventInfo){.status = TASK_STATUS__READY, .event = TASK_EVENT_PAUSE};
- trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, &info, true);
+ info = (SFutureHandleEventInfo){.status = TASK_STATUS__READY, .event = TASK_EVENT_PAUSE};
+ trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, &info);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, &info, true);
+ trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, &info);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__PAUSE, TASK_EVENT_PAUSE, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__STOP, TASK_STATUS__STOP, TASK_EVENT_PAUSE, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__STOP, TASK_STATUS__STOP, TASK_EVENT_PAUSE, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__DROPPING, TASK_STATUS__DROPPING, TASK_EVENT_PAUSE, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__DROPPING, TASK_STATUS__DROPPING, TASK_EVENT_PAUSE, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
// resume is completed by restore status of state-machine
// stop related event
- trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__DROPPING, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__DROPPING, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__STOP, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__STOP, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__SCAN_HISTORY, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__SCAN_HISTORY, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__STOP, TASK_EVENT_STOP, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
// dropping related event
- trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__DROPPING, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__DROPPING, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__UNINIT, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__STOP, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__STOP, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__SCAN_HISTORY, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__SCAN_HISTORY, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
- trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, streamTaskSendTransSuccessMsg, NULL, NULL, true);
+ trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL);
taosArrayPush(streamTaskSMTrans, &trans);
}
//clang-format on
\ No newline at end of file
diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c
index 454ed4297c..764bf6e026 100644
--- a/source/libs/stream/src/streamUpdate.c
+++ b/source/libs/stream/src/streamUpdate.c
@@ -22,7 +22,7 @@
#define DEFAULT_MAP_CAPACITY 131072
#define DEFAULT_MAP_SIZE (DEFAULT_MAP_CAPACITY * 100)
#define ROWS_PER_MILLISECOND 1
-#define MAX_NUM_SCALABLE_BF 100000
+#define MAX_NUM_SCALABLE_BF 64
#define MIN_NUM_SCALABLE_BF 10
#define DEFAULT_PREADD_BUCKET 1
#define MAX_INTERVAL MILLISECOND_PER_MINUTE
@@ -81,7 +81,9 @@ static int64_t adjustInterval(int64_t interval, int32_t precision) {
static int64_t adjustWatermark(int64_t adjInterval, int64_t originInt, int64_t watermark) {
if (watermark <= adjInterval) {
watermark = TMAX(originInt / adjInterval, 1) * adjInterval;
- } else if (watermark > MAX_NUM_SCALABLE_BF * adjInterval) {
+ }
+
+ if (watermark > MAX_NUM_SCALABLE_BF * adjInterval) {
watermark = MAX_NUM_SCALABLE_BF * adjInterval;
}
return watermark;
diff --git a/source/libs/stream/test/CMakeLists.txt b/source/libs/stream/test/CMakeLists.txt
index c90e05bcf6..c472207b27 100644
--- a/source/libs/stream/test/CMakeLists.txt
+++ b/source/libs/stream/test/CMakeLists.txt
@@ -1,40 +1,104 @@
-MESSAGE(STATUS "build stream unit test")
-
-# GoogleTest requires at least C++11
-SET(CMAKE_CXX_STANDARD 11)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
# bloomFilterTest
-ADD_EXECUTABLE(streamUpdateTest "tstreamUpdateTest.cpp")
-TARGET_LINK_LIBRARIES(streamUpdateTest
- PUBLIC os util common gtest gtest_main stream executor index
+#TARGET_LINK_LIBRARIES(streamUpdateTest
+ #PUBLIC os util common gtest gtest_main stream executor index
+ #)
+
+#TARGET_INCLUDE_DIRECTORIES(
+ #streamUpdateTest
+ #PUBLIC "${TD_SOURCE_DIR}/include/libs/stream/"
+ #PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
+#)
+
+#ADD_EXECUTABLE(checkpointTest checkpointTest.cpp)
+#TARGET_LINK_LIBRARIES(
+ #checkpointTest
+ #PUBLIC os common gtest stream executor qcom index transport util
+#)
+
+#TARGET_INCLUDE_DIRECTORIES(
+ #checkpointTest
+ #PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
+#)
+
+#add_executable(backendTest "")
+
+#target_sources(backendTest
+ #PRIVATE
+ #"backendTest.cpp"
+#)
+
+#TARGET_LINK_LIBRARIES(
+ #backendTest
+ #PUBLIC rocksdb
+ #PUBLIC os common gtest stream executor qcom index transport util
+#)
+
+#TARGET_INCLUDE_DIRECTORIES(
+ #backendTest
+ #PUBLIC "${TD_SOURCE_DIR}/include/libs/stream/"
+ #PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
+#)
+
+#add_test(
+ #NAME streamUpdateTest
+ #COMMAND streamUpdateTest
+#)
+
+#add_test(
+ #NAME checkpointTest
+ #COMMAND checkpointTest
+#)
+#add_test(
+ #NAME backendTest
+ #COMMAND backendTest
+#)
+
+
+#add_executable(backendTest "")
+
+#target_sources(backendTest
+ #PUBLIC
+ #"backendTest.cpp"
+#)
+
+#target_include_directories(
+ #backendTest
+ #PUBLIC "${TD_SOURCE_DIR}/include/libs/stream/"
+ #PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
+#)
+
+#target_link_libraries(
+ #backendTest
+ #PUBLIC rocksdb
+ #PUBLIC os common gtest stream executor qcom index transport util
+#)
+
+
+MESSAGE(STATUS "build parser unit test")
+
+IF(NOT TD_DARWIN)
+ # GoogleTest requires at least C++11
+ SET(CMAKE_CXX_STANDARD 11)
+ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
+
+ ADD_EXECUTABLE(backendTest ${SOURCE_LIST})
+ TARGET_LINK_LIBRARIES(
+ backendTest
+ PUBLIC rocksdb
+ PUBLIC os common gtest stream executor qcom index transport util vnode
)
-TARGET_INCLUDE_DIRECTORIES(
- streamUpdateTest
- PUBLIC "${TD_SOURCE_DIR}/include/libs/stream/"
- PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
-)
+ TARGET_INCLUDE_DIRECTORIES(
+ backendTest
+ PUBLIC "${TD_SOURCE_DIR}/include/libs/stream/"
+ PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
+ )
-ADD_EXECUTABLE(checkpointTest checkpointTest.cpp)
-TARGET_LINK_LIBRARIES(
- checkpointTest
- PUBLIC os common gtest stream executor qcom index transport util
-)
-
-TARGET_INCLUDE_DIRECTORIES(
- checkpointTest
- PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
-)
-
-add_test(
- NAME streamUpdateTest
- COMMAND streamUpdateTest
-)
-
-add_test(
- NAME checkpointTest
- COMMAND checkpointTest
-)
\ No newline at end of file
+ ADD_TEST(
+ NAME backendTest
+ COMMAND backendTest
+ )
+ENDIF ()
\ No newline at end of file
diff --git a/source/libs/stream/test/backendTest.cpp b/source/libs/stream/test/backendTest.cpp
new file mode 100644
index 0000000000..c9b981e5f9
--- /dev/null
+++ b/source/libs/stream/test/backendTest.cpp
@@ -0,0 +1,461 @@
+#include
+
+#include
+#include
+#include
+#include
+#include "streamBackendRocksdb.h"
+#include "streamSnapshot.h"
+#include "streamState.h"
+#include "tstream.h"
+#include "tstreamFileState.h"
+#include "tstreamUpdate.h"
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wwrite-strings"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wformat"
+#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
+#pragma GCC diagnostic ignored "-Wpointer-arith"
+
+class BackendEnv : public ::testing::Test {
+ protected:
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+};
+
+void *backendCreate() {
+ const char *streamPath = "/tmp";
+ void * p = NULL;
+
+ // char *absPath = NULL;
+ // // SBackendWrapper *p = (SBackendWrapper *)streamBackendInit(streamPath, -1, 2);
+ // STaskDbWrapper *p = taskDbOpen((char *)streamPath, (char *)"stream-backend", -1);
+ // ASSERT(p != NULL);
+ return p;
+}
+
+SStreamState *stateCreate(const char *path) {
+ SStreamTask *pTask = (SStreamTask *)taosMemoryCalloc(1, sizeof(SStreamTask));
+ pTask->ver = 1024;
+ pTask->id.streamId = 1023;
+ pTask->id.taskId = 1111111;
+ SStreamMeta *pMeta = streamMetaOpen((path), NULL, NULL, 0, 0, NULL);
+ pTask->pMeta = pMeta;
+
+ SStreamState *p = streamStateOpen((char *)path, pTask, true, 32, 32 * 1024);
+ ASSERT(p != NULL);
+ return p;
+}
+void *backendOpen() {
+ streamMetaInit();
+ const char * path = "/tmp/backend";
+ SStreamState *p = stateCreate(path);
+ ASSERT(p != NULL);
+
+ // write bacth
+ // default/state/fill/sess/func/parname/partag
+ int32_t size = 100;
+ std::vector tsArray;
+ for (int32_t i = 0; i < size; i++) {
+ int64_t ts = taosGetTimestampMs();
+ SWinKey key; // = {.groupId = (uint64_t)(i), .ts = ts};
+ key.groupId = (uint64_t)(i);
+ key.ts = ts;
+ const char *val = "value data";
+ int32_t vlen = strlen(val);
+ streamStatePut_rocksdb(p, &key, (char *)val, vlen);
+
+ tsArray.push_back(ts);
+ }
+ for (int32_t i = 0; i < size; i++) {
+ int64_t ts = tsArray[i];
+ SWinKey key = {0}; //{.groupId = (uint64_t)(i), .ts = ts};
+ key.groupId = (uint64_t)(i);
+ key.ts = ts;
+
+ const char *val = "value data";
+ int32_t len = 0;
+ char * newVal = NULL;
+ streamStateGet_rocksdb(p, &key, (void **)&newVal, &len);
+ ASSERT(len == strlen(val));
+ }
+ int64_t ts = tsArray[0];
+ SWinKey key = {0}; // {.groupId = (uint64_t)(0), .ts = ts};
+ key.groupId = (uint64_t)(0);
+ key.ts = ts;
+
+ streamStateDel_rocksdb(p, &key);
+
+ streamStateClear_rocksdb(p);
+
+ for (int i = 0; i < size; i++) {
+ int64_t ts = tsArray[i];
+ SWinKey key = {0}; //{.groupId = (uint64_t)(i), .ts = ts};
+ key.groupId = (uint64_t)(i);
+ key.ts = ts;
+
+ const char *val = "value data";
+ int32_t len = 0;
+ char * newVal = NULL;
+ int32_t code = streamStateGet_rocksdb(p, &key, (void **)&newVal, &len);
+ ASSERT(code != 0);
+ }
+ tsArray.clear();
+
+ for (int i = 0; i < size; i++) {
+ int64_t ts = taosGetTimestampMs();
+ tsArray.push_back(ts);
+
+ SWinKey key = {0}; //{.groupId = (uint64_t)(i), .ts = ts};
+ key.groupId = (uint64_t)(i);
+ key.ts = ts;
+
+ const char *val = "value data";
+ int32_t vlen = strlen(val);
+ streamStatePut_rocksdb(p, &key, (char *)val, vlen);
+ }
+
+ SWinKey winkey;
+ int32_t code = streamStateGetFirst_rocksdb(p, &key);
+ ASSERT(code == 0);
+ ASSERT(key.ts == tsArray[0]);
+
+ SStreamStateCur *pCurr = streamStateSeekToLast_rocksdb(p);
+ ASSERT(pCurr != NULL);
+ streamStateFreeCur(pCurr);
+
+ winkey.groupId = 0;
+ winkey.ts = tsArray[0];
+ char * val = NULL;
+ int32_t len = 0;
+
+ pCurr = streamStateSeekKeyNext_rocksdb(p, &winkey);
+ ASSERT(pCurr != NULL);
+
+ streamStateFreeCur(pCurr);
+
+ tsArray.clear();
+ for (int i = 0; i < size; i++) {
+ int64_t ts = taosGetTimestampMs();
+ tsArray.push_back(ts);
+ STupleKey key = {0};
+ key.groupId = (uint64_t)(0); //= {.groupId = (uint64_t)(0), .ts = ts, .exprIdx = i};
+ key.ts = ts;
+ key.exprIdx = i;
+
+ const char *val = "Value";
+ int32_t len = strlen(val);
+ streamStateFuncPut_rocksdb(p, &key, val, len);
+ }
+ for (int i = 0; i < size; i++) {
+ STupleKey key = {0}; //{.groupId = (uint64_t)(0), .ts = tsArray[i], .exprIdx = i};
+ key.groupId = (uint64_t)(0);
+ key.ts = tsArray[i];
+ key.exprIdx = i;
+
+ char * val = NULL;
+ int32_t len = 0;
+ streamStateFuncGet_rocksdb(p, &key, (void **)&val, &len);
+ ASSERT(len == strlen("Value"));
+ }
+ for (int i = 0; i < size; i++) {
+ STupleKey key = {0}; //{.groupId = (uint64_t)(0), .ts = tsArray[i], .exprIdx = i};
+ key.groupId = (uint64_t)(0);
+ key.ts = tsArray[i];
+ key.exprIdx = i;
+
+ char * val = NULL;
+ int32_t len = 0;
+ streamStateFuncDel_rocksdb(p, &key);
+ }
+
+ // session put
+ tsArray.clear();
+
+ for (int i = 0; i < size; i++) {
+ SSessionKey key = {0}; //{.win = {.skey = i, .ekey = i}, .groupId = (uint64_t)(0)};
+ key.win.skey = i;
+ key.win.ekey = i;
+ key.groupId = (uint64_t)(0);
+ tsArray.push_back(i);
+
+ const char *val = "Value";
+ int32_t len = strlen(val);
+ streamStateSessionPut_rocksdb(p, &key, val, len);
+
+ char *pval = NULL;
+ ASSERT(0 == streamStateSessionGet_rocksdb(p, &key, (void **)&pval, &len));
+ ASSERT(strncmp(pval, val, len) == 0);
+ }
+
+ for (int i = 0; i < size; i++) {
+ SSessionKey key = {0}; //{.win = {.skey = tsArray[i], .ekey = tsArray[i]}, .groupId = (uint64_t)(0)};
+ key.win.skey = tsArray[i];
+ key.win.ekey = tsArray[i];
+ key.groupId = (uint64_t)(0);
+
+ const char *val = "Value";
+ int32_t len = strlen(val);
+
+ char *pval = NULL;
+ ASSERT(0 == streamStateSessionGet_rocksdb(p, &key, (void **)&pval, &len));
+ ASSERT(strncmp(pval, val, len) == 0);
+ taosMemoryFreeClear(pval);
+ }
+
+ pCurr = streamStateSessionSeekToLast_rocksdb(p, 0);
+ ASSERT(pCurr != NULL);
+
+ {
+ SSessionKey key;
+ memset(&key, 0, sizeof(key));
+ char * val = NULL;
+ int32_t vlen = 0;
+ code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen);
+ ASSERT(code == 0);
+ pCurr = streamStateSessionSeekKeyPrev_rocksdb(p, &key);
+
+ code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen);
+ ASSERT(code == 0);
+
+ ASSERT(key.groupId == 0 && key.win.ekey == tsArray[tsArray.size() - 2]);
+
+ pCurr = streamStateSessionSeekKeyNext_rocksdb(p, &key);
+ code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen);
+ ASSERT(code == 0);
+ ASSERT(vlen == strlen("Value"));
+ ASSERT(key.groupId == 0 && key.win.skey == tsArray[tsArray.size() - 1]);
+
+ ASSERT(0 == streamStateSessionAddIfNotExist_rocksdb(p, &key, 10, (void **)&val, &len));
+
+ ASSERT(0 ==
+ streamStateStateAddIfNotExist_rocksdb(p, &key, (char *)"key", strlen("key"), NULL, (void **)&val, &len));
+ }
+ for (int i = 0; i < size; i++) {
+ SSessionKey key = {0}; //{.win = {.skey = tsArray[i], .ekey = tsArray[i]}, .groupId = (uint64_t)(0)};
+ key.win.skey = tsArray[i];
+ key.win.ekey = tsArray[i];
+ key.groupId = (uint64_t)(0);
+
+ const char *val = "Value";
+ int32_t len = strlen(val);
+
+ char *pval = NULL;
+ ASSERT(0 == streamStateSessionDel_rocksdb(p, &key));
+ }
+
+ for (int i = 0; i < size; i++) {
+ SWinKey key = {0}; // {.groupId = (uint64_t)(i), .ts = tsArray[i]};
+ key.groupId = (uint64_t)(i);
+ key.ts = tsArray[i];
+ const char *val = "Value";
+ int32_t vlen = strlen(val);
+ ASSERT(streamStateFillPut_rocksdb(p, &key, val, vlen) == 0);
+ }
+ for (int i = 0; i < size; i++) {
+ SWinKey key = {0}; // {.groupId = (uint64_t)(i), .ts = tsArray[i]};
+ key.groupId = (uint64_t)(i);
+ key.ts = tsArray[i];
+ char * val = NULL;
+ int32_t vlen = 0;
+ ASSERT(streamStateFillGet_rocksdb(p, &key, (void **)&val, &vlen) == 0);
+ taosMemoryFreeClear(val);
+ }
+ {
+ SWinKey key = {0}; //{.groupId = (uint64_t)(0), .ts = tsArray[0]};
+ key.groupId = (uint64_t)(0);
+ key.ts = tsArray[0];
+ SStreamStateCur *pCurr = streamStateFillGetCur_rocksdb(p, &key);
+ ASSERT(pCurr != NULL);
+
+ char * val = NULL;
+ int32_t vlen = 0;
+ ASSERT(0 == streamStateFillGetKVByCur_rocksdb(pCurr, &key, (const void **)&val, &vlen));
+ ASSERT(vlen == strlen("Value"));
+ streamStateFreeCur(pCurr);
+
+ pCurr = streamStateFillSeekKeyNext_rocksdb(p, &key);
+ ASSERT(0 == streamStateFillGetKVByCur_rocksdb(pCurr, &key, (const void **)&val, &vlen));
+ ASSERT(vlen == strlen("Value") && key.groupId == 1 && key.ts == tsArray[1]);
+
+ key.groupId = 1;
+ key.ts = tsArray[1];
+
+ pCurr = streamStateFillSeekKeyPrev_rocksdb(p, &key);
+ ASSERT(pCurr != NULL);
+ ASSERT(0 == streamStateFillGetKVByCur_rocksdb(pCurr, &key, (const void **)&val, &vlen));
+
+ ASSERT(vlen == strlen("Value") && key.groupId == 0 && key.ts == tsArray[0]);
+ }
+
+ for (int i = 0; i < size - 1; i++) {
+ SWinKey key = {0}; // {.groupId = (uint64_t)(i), .ts = tsArray[i]};
+ key.groupId = (uint64_t)(i);
+ key.ts = tsArray[i];
+ char * val = NULL;
+ int32_t vlen = 0;
+ ASSERT(streamStateFillDel_rocksdb(p, &key) == 0);
+ taosMemoryFreeClear(val);
+ }
+ streamStateSessionClear_rocksdb(p);
+
+ for (int i = 0; i < size; i++) {
+ char tbname[TSDB_TABLE_NAME_LEN] = {0};
+ sprintf(tbname, "%s_%d", "tbname", i);
+ ASSERT(0 == streamStatePutParName_rocksdb(p, i, tbname));
+ }
+ for (int i = 0; i < size; i++) {
+ char *val = NULL;
+ ASSERT(0 == streamStateGetParName_rocksdb(p, i, (void **)&val));
+ ASSERT(strncmp(val, "tbname", strlen("tbname")) == 0);
+ taosMemoryFree(val);
+ }
+
+ for (int i = 0; i < size; i++) {
+ char tbname[TSDB_TABLE_NAME_LEN] = {0};
+ sprintf(tbname, "%s_%d", "tbname", i);
+ ASSERT(0 == streamStatePutParName_rocksdb(p, i, tbname));
+ }
+ for (int i = 0; i < size; i++) {
+ char *val = NULL;
+ ASSERT(0 == streamStateGetParName_rocksdb(p, i, (void **)&val));
+ ASSERT(strncmp(val, "tbname", strlen("tbname")) == 0);
+ taosMemoryFree(val);
+ }
+ for (int i = 0; i < size; i++) {
+ char key[128] = {0};
+ sprintf(key, "tbname_%d", i);
+ char val[128] = {0};
+ sprintf(val, "val_%d", i);
+ code = streamDefaultPut_rocksdb(p, key, val, strlen(val));
+ ASSERT(code == 0);
+ }
+ for (int i = 0; i < size; i++) {
+ char key[128] = {0};
+ sprintf(key, "tbname_%d", i);
+
+ char * val = NULL;
+ int32_t len = 0;
+ code = streamDefaultGet_rocksdb(p, key, (void **)&val, &len);
+ ASSERT(code == 0);
+ }
+ SArray *result = taosArrayInit(8, sizeof(void *));
+ streamDefaultIterGet_rocksdb(p, "tbname", "tbname_99", result);
+ ASSERT(taosArrayGetSize(result) >= 0);
+
+ return p;
+ // streamStateClose((SStreamState *)p, true);
+}
+TEST_F(BackendEnv, checkOpen) {
+ SStreamState *p = (SStreamState *)backendOpen();
+ int64_t tsStart = taosGetTimestampMs();
+ {
+ void * pBatch = streamStateCreateBatch();
+ int32_t size = 0;
+ for (int i = 0; i < size; i++) {
+ char key[128] = {0};
+ sprintf(key, "key_%d", i);
+ char val[128] = {0};
+ sprintf(val, "val_%d", i);
+ streamStatePutBatch(p, "default", (rocksdb_writebatch_t *)pBatch, (void *)key, (void *)val,
+ (int32_t)(strlen(val)), tsStart + 100000);
+ }
+ streamStatePutBatch_rocksdb(p, pBatch);
+ streamStateDestroyBatch(pBatch);
+ }
+ {
+ void * pBatch = streamStateCreateBatch();
+ int32_t size = 0;
+ char valBuf[256] = {0};
+ for (int i = 0; i < size; i++) {
+ char key[128] = {0};
+ sprintf(key, "key_%d", i);
+ char val[128] = {0};
+ sprintf(val, "val_%d", i);
+ streamStatePutBatchOptimize(p, 0, (rocksdb_writebatch_t *)pBatch, (void *)key, (void *)val,
+ (int32_t)(strlen(val)), tsStart + 100000, (void *)valBuf);
+ }
+ streamStatePutBatch_rocksdb(p, pBatch);
+ streamStateDestroyBatch(pBatch);
+ }
+ // do checkpoint 2
+ taskDbDoCheckpoint(p->pTdbState->pOwner->pBackend, 2);
+ {
+ void * pBatch = streamStateCreateBatch();
+ int32_t size = 0;
+ char valBuf[256] = {0};
+ for (int i = 0; i < size; i++) {
+ char key[128] = {0};
+ sprintf(key, "key_%d", i);
+ char val[128] = {0};
+ sprintf(val, "val_%d", i);
+ streamStatePutBatchOptimize(p, 0, (rocksdb_writebatch_t *)pBatch, (void *)key, (void *)val,
+ (int32_t)(strlen(val)), tsStart + 100000, (void *)valBuf);
+ }
+ streamStatePutBatch_rocksdb(p, pBatch);
+ streamStateDestroyBatch(pBatch);
+ }
+
+ taskDbDoCheckpoint(p->pTdbState->pOwner->pBackend, 3);
+
+ const char *path = "/tmp/backend/stream";
+ const char *dump = "/tmp/backend/stream/dump";
+ // taosMkDir(dump);
+ taosMulMkDir(dump);
+ SBkdMgt *mgt = bkdMgtCreate((char *)path);
+ SArray * result = taosArrayInit(4, sizeof(void *));
+ bkdMgtGetDelta(mgt, p->pTdbState->idstr, 3, result, (char *)dump);
+
+ taskDbDoCheckpoint(p->pTdbState->pOwner->pBackend, 4);
+
+ taosArrayClear(result);
+ bkdMgtGetDelta(mgt, p->pTdbState->idstr, 4, result, (char *)dump);
+ bkdMgtDestroy(mgt);
+ streamStateClose((SStreamState *)p, true);
+ // {
+ // taosRemoveDir("/tmp/backend");
+ // const char * path = "/tmp/backend";
+ // SStreamState *p = stateCreate(path);
+ // }
+ taosRemoveDir(path);
+ // streamStateClose((SStreamState *)p, true);
+}
+
+TEST_F(BackendEnv, backendChkp) { const char *path = "/tmp"; }
+
+typedef struct BdKV {
+ uint32_t k;
+ uint32_t v;
+} BdKV;
+
+BdKV kvDict[] = {{0, 2}, {1, 2}, {15, 16}, {31, 32}, {56, 64}, {100, 128},
+ {200, 256}, {500, 512}, {1000, 1024}, {2000, 2048}, {3000, 4096}};
+
+TEST_F(BackendEnv, backendUtil) {
+ for (int i = 0; i < sizeof(kvDict) / sizeof(kvDict[0]); i++) {
+ ASSERT_EQ(nextPow2((uint32_t)(kvDict[i].k)), kvDict[i].v);
+ }
+}
+TEST_F(BackendEnv, oldBackendInit) {
+ const char *path = "/tmp/backend1";
+ taosMulMkDir(path);
+ {
+ SBackendWrapper *p = (SBackendWrapper *)streamBackendInit(path, 10, 10);
+ streamBackendCleanup((void *)p);
+ }
+ {
+ SBackendWrapper *p = (SBackendWrapper *)streamBackendInit(path, 10, 10);
+ streamBackendCleanup((void *)p);
+ }
+
+ taosRemoveDir(path);
+}
+
+int main(int argc, char **argv) {
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/source/libs/stream/test/checkpointTest.cpp b/source/libs/stream/test/checkpointTest.cpp
index 0dc2cc13f5..0caad479e5 100644
--- a/source/libs/stream/test/checkpointTest.cpp
+++ b/source/libs/stream/test/checkpointTest.cpp
@@ -25,46 +25,49 @@
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wsign-compare"
+// tsSnodeAddress = "";
+// tsS3StreamEnabled = 0;
+
+#include "cos.h"
#include "rsync.h"
#include "streamInt.h"
-#include "cos.h"
-int main(int argc, char **argv) {
- testing::InitGoogleTest(&argc, argv);
+// int main(int argc, char **argv) {
+// testing::InitGoogleTest(&argc, argv);
- if (taosInitCfg("/etc/taos/", NULL, NULL, NULL, NULL, 0) != 0) {
- printf("error");
- }
- if (s3Init() < 0) {
- return -1;
- }
- strcpy(tsSnodeAddress, "127.0.0.1");
- int ret = RUN_ALL_TESTS();
- s3CleanUp();
- return ret;
-}
+// if (taosInitCfg("/etc/taos/", NULL, NULL, NULL, NULL, 0) != 0) {
+// printf("error");
+// }
+// if (s3Init() < 0) {
+// return -1;
+// }
+// strcpy(tsSnodeAddress, "127.0.0.1");
+// int ret = RUN_ALL_TESTS();
+// s3CleanUp();
+// return ret;
+// }
TEST(testCase, checkpointUpload_Test) {
- stopRsync();
- startRsync();
+ // stopRsync();
+ // startRsync();
taosSsleep(5);
char* id = "2013892036";
- uploadCheckpoint(id, "/root/offset/");
+ // uploadCheckpoint(id, "/root/offset/");
}
TEST(testCase, checkpointDownload_Test) {
char* id = "2013892036";
- downloadCheckpoint(id, "/root/offset/download/");
+ // downloadCheckpoint(id, "/root/offset/download/");
}
TEST(testCase, checkpointDelete_Test) {
char* id = "2013892036";
- deleteCheckpoint(id);
+ // deleteCheckpoint(id);
}
TEST(testCase, checkpointDeleteFile_Test) {
char* id = "2013892036";
- deleteCheckpointFile(id, "offset-ver0");
+ // deleteCheckpointFile(id, "offset-ver0");
}
diff --git a/source/libs/stream/test/tstreamUpdateTest.cpp b/source/libs/stream/test/tstreamUpdateTest.cpp
index 1b999e5fb0..59171876ff 100644
--- a/source/libs/stream/test/tstreamUpdateTest.cpp
+++ b/source/libs/stream/test/tstreamUpdateTest.cpp
@@ -14,10 +14,7 @@ class StreamStateEnv : public ::testing::Test {
streamMetaInit();
backend = streamBackendInit(path, 0, 0);
}
- virtual void TearDown() {
- streamMetaCleanup();
- // indexClose(index);
- }
+ virtual void TearDown() { streamMetaCleanup(); }
const char *path = TD_TMP_DIR_PATH "stream";
void *backend;
@@ -50,6 +47,14 @@ bool equalSBF(SScalableBf *left, SScalableBf *right) {
}
TEST(TD_STREAM_UPDATE_TEST, update) {
+ const char *streamPath = "/tmp";
+
+ char *absPath = NULL;
+ void *p = NULL;
+ // SBackendWrapper *p = streamBackendInit(streamPath, -1, 2);
+ // p = taskDbOpen((char *)streamPath, (char *)"test", -1);
+ p = bkdMgtCreate((char *)streamPath);
+
// const int64_t interval = 20 * 1000;
// const int64_t watermark = 10 * 60 * 1000;
// SUpdateInfo *pSU = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark);
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index e06ea70f70..7ff6116137 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -1343,7 +1343,7 @@ ESyncStrategy syncNodeStrategy(SSyncNode* pSyncNode) { return pSyncNode->raftCfg
int32_t syncNodeStartPingTimer(SSyncNode* pSyncNode) {
int32_t ret = 0;
if (syncIsInit()) {
- taosTmrReset(pSyncNode->FpPingTimerCB, pSyncNode->pingTimerMS, pSyncNode, syncEnv()->pTimerManager,
+ taosTmrReset(pSyncNode->FpPingTimerCB, pSyncNode->pingTimerMS, (void*)pSyncNode->rid, syncEnv()->pTimerManager,
&pSyncNode->pPingTimer);
atomic_store_64(&pSyncNode->pingTimerLogicClock, pSyncNode->pingTimerLogicClockUser);
} else {
@@ -1415,8 +1415,8 @@ void syncNodeResetElectTimer(SSyncNode* pSyncNode) {
static int32_t syncNodeDoStartHeartbeatTimer(SSyncNode* pSyncNode) {
int32_t ret = 0;
if (syncIsInit()) {
- taosTmrReset(pSyncNode->FpHeartbeatTimerCB, pSyncNode->heartbeatTimerMS, pSyncNode, syncEnv()->pTimerManager,
- &pSyncNode->pHeartbeatTimer);
+ taosTmrReset(pSyncNode->FpHeartbeatTimerCB, pSyncNode->heartbeatTimerMS, (void*)pSyncNode->rid,
+ syncEnv()->pTimerManager, &pSyncNode->pHeartbeatTimer);
atomic_store_64(&pSyncNode->heartbeatTimerLogicClock, pSyncNode->heartbeatTimerLogicClockUser);
} else {
sError("vgId:%d, start heartbeat timer error, sync env is stop", pSyncNode->vgId);
@@ -2153,7 +2153,11 @@ int32_t syncNodeGetPreIndexTerm(SSyncNode* pSyncNode, SyncIndex index, SyncIndex
static void syncNodeEqPingTimer(void* param, void* tmrId) {
if (!syncIsInit()) return;
- SSyncNode* pNode = param;
+ int64_t rid = (int64_t)param;
+ SSyncNode* pNode = syncNodeAcquire(rid);
+
+ if (pNode == NULL) return;
+
if (atomic_load_64(&pNode->pingTimerLogicClockUser) <= atomic_load_64(&pNode->pingTimerLogicClock)) {
SRpcMsg rpcMsg = {0};
int32_t code = syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_PING, atomic_load_64(&pNode->pingTimerLogicClock),
@@ -2173,7 +2177,8 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
}
_out:
- taosTmrReset(syncNodeEqPingTimer, pNode->pingTimerMS, pNode, syncEnv()->pTimerManager, &pNode->pPingTimer);
+ taosTmrReset(syncNodeEqPingTimer, pNode->pingTimerMS, (void*)pNode->rid, syncEnv()->pTimerManager,
+ &pNode->pPingTimer);
}
}
@@ -2224,7 +2229,11 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
if (!syncIsInit()) return;
- SSyncNode* pNode = param;
+ int64_t rid = (int64_t)param;
+ SSyncNode* pNode = syncNodeAcquire(rid);
+
+ if (pNode == NULL) return;
+
if (pNode->totalReplicaNum > 1) {
if (atomic_load_64(&pNode->heartbeatTimerLogicClockUser) <= atomic_load_64(&pNode->heartbeatTimerLogicClock)) {
SRpcMsg rpcMsg = {0};
@@ -2245,7 +2254,7 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
}
_out:
- taosTmrReset(syncNodeEqHeartbeatTimer, pNode->heartbeatTimerMS, pNode, syncEnv()->pTimerManager,
+ taosTmrReset(syncNodeEqHeartbeatTimer, pNode->heartbeatTimerMS, (void*)pNode->rid, syncEnv()->pTimerManager,
&pNode->pHeartbeatTimer);
} else {
@@ -3385,4 +3394,4 @@ bool syncNodeCanChange(SSyncNode* pSyncNode) {
return true;
}
-#endif
\ No newline at end of file
+#endif
diff --git a/source/libs/tdb/src/db/tdbPCache.c b/source/libs/tdb/src/db/tdbPCache.c
index 3ee65f11dd..455128e6ec 100644
--- a/source/libs/tdb/src/db/tdbPCache.c
+++ b/source/libs/tdb/src/db/tdbPCache.c
@@ -316,7 +316,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn)
}
// 3. Try to Recycle a page
- if (!pPage && !pCache->lru.pLruPrev->isAnchor) {
+ if (!pPageH && !pPage && !pCache->lru.pLruPrev->isAnchor) {
pPage = pCache->lru.pLruPrev;
tdbPCacheRemovePageFromHash(pCache, pPage);
tdbPCachePinPage(pCache, pPage);
diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h
index 5b18d56d70..c010e31320 100644
--- a/source/libs/transport/inc/transComm.h
+++ b/source/libs/transport/inc/transComm.h
@@ -256,21 +256,21 @@ void transAsyncPoolDestroy(SAsyncPool* pool);
int transAsyncSend(SAsyncPool* pool, queue* mq);
bool transAsyncPoolIsEmpty(SAsyncPool* pool);
-#define TRANS_DESTROY_ASYNC_POOL_MSG(pool, msgType, freeFunc) \
- do { \
- for (int i = 0; i < pool->nAsync; i++) { \
- uv_async_t* async = &(pool->asyncs[i]); \
- SAsyncItem* item = async->data; \
- while (!QUEUE_IS_EMPTY(&item->qmsg)) { \
- tTrace("destroy msg in async pool "); \
- queue* h = QUEUE_HEAD(&item->qmsg); \
- QUEUE_REMOVE(h); \
- msgType* msg = QUEUE_DATA(h, msgType, q); \
- if (msg != NULL) { \
- freeFunc(msg); \
- } \
- } \
- } \
+#define TRANS_DESTROY_ASYNC_POOL_MSG(pool, msgType, freeFunc, param) \
+ do { \
+ for (int i = 0; i < pool->nAsync; i++) { \
+ uv_async_t* async = &(pool->asyncs[i]); \
+ SAsyncItem* item = async->data; \
+ while (!QUEUE_IS_EMPTY(&item->qmsg)) { \
+ tTrace("destroy msg in async pool "); \
+ queue* h = QUEUE_HEAD(&item->qmsg); \
+ QUEUE_REMOVE(h); \
+ msgType* msg = QUEUE_DATA(h, msgType, q); \
+ if (msg != NULL) { \
+ freeFunc(msg, param); \
+ } \
+ } \
+ } \
} while (0)
#define ASYNC_CHECK_HANDLE(exh1, id) \
diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c
index 6de10cbb9e..c4ca39c323 100644
--- a/source/libs/transport/src/thttp.c
+++ b/source/libs/transport/src/thttp.c
@@ -191,6 +191,15 @@ static void httpDestroyMsg(SHttpMsg* msg) {
taosMemoryFree(msg->cont);
taosMemoryFree(msg);
}
+static void httpDestroyMsgWrapper(void* cont, void* param) {
+ httpDestroyMsg((SHttpMsg*)cont);
+ // if (msg == NULL) return;
+
+ // taosMemoryFree(msg->server);
+ // taosMemoryFree(msg->uri);
+ // taosMemoryFree(msg->cont);
+ // taosMemoryFree(msg);
+}
static void httpMayDiscardMsg(SHttpModule* http, SAsyncItem* item) {
SHttpMsg *msg = NULL, *quitMsg = NULL;
@@ -554,7 +563,7 @@ void transHttpEnvDestroy() {
httpSendQuit();
taosThreadJoin(load->thread, NULL);
- TRANS_DESTROY_ASYNC_POOL_MSG(load->asyncPool, SHttpMsg, httpDestroyMsg);
+ TRANS_DESTROY_ASYNC_POOL_MSG(load->asyncPool, SHttpMsg, httpDestroyMsgWrapper, NULL);
transAsyncPoolDestroy(load->asyncPool);
uv_loop_close(load->loop);
taosMemoryFree(load->loop);
diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c
index e937d2e65e..ac45f1eef6 100644
--- a/source/libs/transport/src/transCli.c
+++ b/source/libs/transport/src/transCli.c
@@ -219,6 +219,8 @@ static void (*cliAsyncHandle[])(SCliMsg* pMsg, SCliThrd* pThrd) = {cliHandleReq,
/// NULL,cliHandleUpdate};
static FORCE_INLINE void destroyCmsg(void* cmsg);
+
+static FORCE_INLINE void destroyCmsgWrapper(void* arg, void* param);
static FORCE_INLINE void destroyCmsgAndAhandle(void* cmsg);
static FORCE_INLINE int cliRBChoseIdx(STrans* pTransInst);
static FORCE_INLINE void transDestroyConnCtx(STransConnCtx* ctx);
@@ -320,7 +322,7 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
if (msg != NULL && msg->ctx != NULL && msg->ctx->ahandle != (void*)0x9527) {
if (conn->ctx.freeFunc != NULL && msg->ctx->ahandle != NULL) {
conn->ctx.freeFunc(msg->ctx->ahandle);
- } else if (msg->ctx->ahandle != NULL && pThrd->destroyAhandleFp != NULL) {
+ } else if (msg->msg.info.notFreeAhandle == 0 && msg->ctx->ahandle != NULL && pThrd->destroyAhandleFp != NULL) {
tDebug("%s conn %p destroy unfinished ahandle %p", CONN_GET_INST_LABEL(conn), conn, msg->ctx->ahandle);
pThrd->destroyAhandleFp(msg->ctx->ahandle);
}
@@ -582,8 +584,8 @@ void* destroyConnPool(SCliThrd* pThrd) {
static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) {
void* pool = pThrd->pool;
- SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key) + 1);
STrans* pTranInst = pThrd->pTransInst;
+ SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key) + 1);
if (plist == NULL) {
SConnList list = {0};
taosHashPut((SHashObj*)pool, key, strlen(key) + 1, (void*)&list, sizeof(list));
@@ -865,17 +867,18 @@ static void cliDestroyConn(SCliConn* conn, bool clear) {
QUEUE_INIT(&conn->q);
conn->broken = true;
+ if (conn->list == NULL) {
+ conn->list = taosHashGet((SHashObj*)pThrd->pool, conn->dstAddr, strlen(conn->dstAddr));
+ }
- if (conn->list != NULL) {
- SConnList* connList = conn->list;
- connList->list->numOfConn--;
- connList->size--;
- } else {
- if (pThrd->pool) {
- SConnList* connList = taosHashGet((SHashObj*)pThrd->pool, conn->dstAddr, strlen(conn->dstAddr) + 1);
- if (connList != NULL) connList->list->numOfConn--;
+ if (conn->list) {
+ SConnList* list = conn->list;
+ list->list->numOfConn--;
+ if (conn->status == ConnInPool) {
+ list->size--;
}
}
+
conn->list = NULL;
pThrd->newConnCount--;
@@ -1963,7 +1966,17 @@ static FORCE_INLINE void destroyCmsg(void* arg) {
transFreeMsg(pMsg->msg.pCont);
taosMemoryFree(pMsg);
}
-
+static FORCE_INLINE void destroyCmsgWrapper(void* arg, void* param) {
+ SCliMsg* pMsg = arg;
+ if (pMsg == NULL) {
+ return;
+ }
+ if (param != NULL) {
+ SCliThrd* pThrd = param;
+ if (pThrd->destroyAhandleFp) (*pThrd->destroyAhandleFp)(pMsg->msg.info.ahandle);
+ }
+ destroyCmsg(pMsg);
+}
static FORCE_INLINE void destroyCmsgAndAhandle(void* param) {
if (param == NULL) return;
@@ -2057,7 +2070,7 @@ static void destroyThrdObj(SCliThrd* pThrd) {
taosThreadJoin(pThrd->thread, NULL);
CLI_RELEASE_UV(pThrd->loop);
taosThreadMutexDestroy(&pThrd->msgMtx);
- TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SCliMsg, destroyCmsg);
+ TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SCliMsg, destroyCmsgWrapper, (void*)pThrd);
transAsyncPoolDestroy(pThrd->asyncPool);
transDQDestroy(pThrd->delayQueue, destroyCmsgAndAhandle);
diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c
index b324ca5f91..f47a688e6f 100644
--- a/source/libs/transport/src/transSvr.c
+++ b/source/libs/transport/src/transSvr.c
@@ -527,6 +527,10 @@ void uvOnSendCb(uv_write_t* req, int status) {
if (!transQueueEmpty(&conn->srvMsgs)) {
msg = (SSvrMsg*)transQueueGet(&conn->srvMsgs, 0);
if (msg->type == Register && conn->status == ConnAcquire) {
+ if (conn->regArg.init) {
+ transFreeMsg(conn->regArg.msg.pCont);
+ conn->regArg.init = 0;
+ }
conn->regArg.notifyCount = 0;
conn->regArg.init = 1;
conn->regArg.msg = msg->msg;
@@ -671,7 +675,8 @@ static FORCE_INLINE void destroySmsg(SSvrMsg* smsg) {
transFreeMsg(smsg->msg.pCont);
taosMemoryFree(smsg);
}
-static void destroyAllConn(SWorkThrd* pThrd) {
+static FORCE_INLINE void destroySmsgWrapper(void* smsg, void* param) { destroySmsg((SSvrMsg*)smsg); }
+static void destroyAllConn(SWorkThrd* pThrd) {
tTrace("thread %p destroy all conn ", pThrd);
while (!QUEUE_IS_EMPTY(&pThrd->conn)) {
queue* h = QUEUE_HEAD(&pThrd->conn);
@@ -1349,6 +1354,11 @@ void uvHandleRegister(SSvrMsg* msg, SWorkThrd* thrd) {
return;
}
transQueuePop(&conn->srvMsgs);
+
+ if (conn->regArg.init) {
+ transFreeMsg(conn->regArg.msg.pCont);
+ conn->regArg.init = 0;
+ }
conn->regArg.notifyCount = 0;
conn->regArg.init = 1;
conn->regArg.msg = msg->msg;
@@ -1394,7 +1404,7 @@ void destroyWorkThrd(SWorkThrd* pThrd) {
}
taosThreadJoin(pThrd->thread, NULL);
SRV_RELEASE_UV(pThrd->loop);
- TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SSvrMsg, destroySmsg);
+ TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SSvrMsg, destroySmsgWrapper, NULL);
transAsyncPoolDestroy(pThrd->asyncPool);
uvWhiteListDestroy(pThrd->pWhiteList);
diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c
index e6491639dc..bdd43fe9fa 100644
--- a/source/os/src/osFile.c
+++ b/source/os/src/osFile.c
@@ -1404,3 +1404,35 @@ int32_t taosLinkFile(char *src, char *dst) {
#endif
return 0;
}
+
+FILE* taosOpenCFile(const char* filename, const char* mode) {
+ return fopen(filename, mode);
+}
+
+int taosSeekCFile(FILE* file, int64_t offset, int whence) {
+#ifdef WINDOWS
+ return _fseeki64(file, offset, whence);
+#else
+ return fseeko(file, offset, whence);
+#endif
+}
+
+size_t taosReadFromCFile(void *buffer, size_t size, size_t count, FILE *stream ) {
+ return fread(buffer, size, count, stream);
+}
+
+size_t taosWriteToCFile(const void* ptr, size_t size, size_t nitems, FILE* stream) {
+ return fwrite(ptr, size, nitems, stream);
+}
+
+int taosCloseCFile(FILE *f) {
+ return fclose(f);
+}
+
+int taosSetAutoDelFile(char* path) {
+#ifdef WINDOWS
+ return SetFileAttributes(path, FILE_ATTRIBUTE_TEMPORARY);
+#else
+ return unlink(path);
+#endif
+}
\ No newline at end of file
diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c
index 88eb51d500..d9686d77f8 100644
--- a/source/util/src/tarray.c
+++ b/source/util/src/tarray.c
@@ -89,12 +89,14 @@ static int32_t taosArrayResize(SArray* pArray) {
int32_t taosArrayEnsureCap(SArray* pArray, size_t newCap) {
if (newCap > pArray->capacity) {
float factor = BOUNDARY_BIG_FACTOR;
- if(newCap * pArray->elemSize > BOUNDARY_SIZE){
+ if (newCap * pArray->elemSize > BOUNDARY_SIZE) {
factor = BOUNDARY_SMALL_FACTOR;
}
+
size_t tsize = (pArray->capacity * factor);
while (newCap > tsize) {
- tsize = (tsize * factor);
+ size_t newSize = (tsize * factor);
+ tsize = (newSize == tsize) ? (tsize + 2) : newSize;
}
pArray->pData = taosMemoryRealloc(pArray->pData, tsize * pArray->elemSize);
diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c
index ad3c766510..8fdc2654c5 100644
--- a/source/util/src/tconfig.c
+++ b/source/util/src/tconfig.c
@@ -449,6 +449,15 @@ static int32_t cfgAddItem(SConfig *pCfg, SConfigItem *pItem, const char *name) {
return -1;
}
+ int size = pCfg->array->size;
+ for (int32_t i = 0; i < size; ++i) {
+ SConfigItem *existItem = taosArrayGet(pCfg->array, i);
+ if (existItem != NULL && strcmp(existItem->name, pItem->name) == 0) {
+ taosMemoryFree(pItem->name);
+ return TSDB_CODE_INVALID_CFG;
+ }
+ }
+
int32_t len = strlen(name);
char lowcaseName[CFG_NAME_MAX_LEN + 1] = {0};
strntolower(lowcaseName, name, TMIN(CFG_NAME_MAX_LEN, len));
@@ -457,6 +466,7 @@ static int32_t cfgAddItem(SConfig *pCfg, SConfigItem *pItem, const char *name) {
if (pItem->dtype == CFG_DTYPE_STRING) {
taosMemoryFree(pItem->str);
}
+
taosMemoryFree(pItem->name);
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
diff --git a/source/util/src/terror.c b/source/util/src/terror.c
index b9aef1f0d9..39a312eb2c 100644
--- a/source/util/src/terror.c
+++ b/source/util/src/terror.c
@@ -333,6 +333,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_VIEW_NOT_EXIST, "view not exists in db
//mnode-compact
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_COMPACT_ID, "Invalid compact id")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_COMPACT_DETAIL_NOT_EXIST, "compact detail doesn't exist")
// dnode
TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_OFFLINE, "Dnode is offline")
@@ -618,12 +619,14 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC, "System table not al
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED, "System table not allowed")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VARBINARY, "Invalidate varbinary value")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_IP_RANGE, "Invalid IPV4 address ranges")
-TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Invalid stream query")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VIEW_QUERY, "Invalid view query type")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COL_QUERY_MISMATCH, "Columns number mismatch with query result")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VIEW_CONFLICT_WITH_TABLE, "View name is conflict with table")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_SUPPORT_MULTI_RESULT, "Operator not supported multi result")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY, "tag can not be primary key")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SECOND_COL_PK, "primary key must be second column")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
//planner
TAOS_DEFINE_ERROR(TSDB_CODE_PLAN_INTERNAL_ERROR, "Planner internal error")
diff --git a/source/util/src/tqueue.c b/source/util/src/tqueue.c
index 2cc13be6ba..7a4eb09b99 100644
--- a/source/util/src/tqueue.c
+++ b/source/util/src/tqueue.c
@@ -21,6 +21,40 @@
int64_t tsRpcQueueMemoryAllowed = 0;
int64_t tsRpcQueueMemoryUsed = 0;
+struct STaosQueue {
+ STaosQnode *head;
+ STaosQnode *tail;
+ STaosQueue *next; // for queue set
+ STaosQset *qset; // for queue set
+ void *ahandle; // for queue set
+ FItem itemFp;
+ FItems itemsFp;
+ TdThreadMutex mutex;
+ int64_t memOfItems;
+ int32_t numOfItems;
+ int64_t threadId;
+ int64_t memLimit;
+ int64_t itemLimit;
+};
+
+struct STaosQset {
+ STaosQueue *head;
+ STaosQueue *current;
+ TdThreadMutex mutex;
+ tsem_t sem;
+ int32_t numOfQueues;
+ int32_t numOfItems;
+};
+
+struct STaosQall {
+ STaosQnode *current;
+ STaosQnode *start;
+ int32_t numOfItems;
+ int64_t memOfItems;
+ int32_t unAccessedNumOfItems;
+ int64_t unAccessMemOfItems;
+};
+
void taosSetQueueMemoryCapacity(STaosQueue *queue, int64_t cap) { queue->memLimit = cap; }
void taosSetQueueCapacity(STaosQueue *queue, int64_t size) { queue->itemLimit = size; }
@@ -497,6 +531,12 @@ int64_t taosQallUnAccessedMemSize(STaosQall *qall) { return qall->unAccessMemOfI
void taosResetQitems(STaosQall *qall) { qall->current = qall->start; }
int32_t taosGetQueueNumber(STaosQset *qset) { return qset->numOfQueues; }
+void taosQueueSetThreadId(STaosQueue* pQueue, int64_t threadId) {
+ pQueue->threadId = threadId;
+}
+
+int64_t taosQueueGetThreadId(STaosQueue *pQueue) { return pQueue->threadId; }
+
#if 0
void taosResetQsetThread(STaosQset *qset, void *pItem) {
diff --git a/source/util/src/tscalablebf.c b/source/util/src/tscalablebf.c
index 3b4975b701..7af794546b 100644
--- a/source/util/src/tscalablebf.c
+++ b/source/util/src/tscalablebf.c
@@ -20,6 +20,9 @@
#define DEFAULT_GROWTH 2
#define DEFAULT_TIGHTENING_RATIO 0.5
+#define DEFAULT_MAX_BLOOMFILTERS 4
+#define SBF_INVALID -1
+#define SBF_VALID 0
static SBloomFilter *tScalableBfAddFilter(SScalableBf *pSBf, uint64_t expectedEntries, double errorRate);
@@ -32,6 +35,8 @@ SScalableBf *tScalableBfInit(uint64_t expectedEntries, double errorRate) {
if (pSBf == NULL) {
return NULL;
}
+ pSBf->maxBloomFilters = DEFAULT_MAX_BLOOMFILTERS;
+ pSBf->status = SBF_VALID;
pSBf->numBits = 0;
pSBf->bfArray = taosArrayInit(defaultSize, sizeof(void *));
if (tScalableBfAddFilter(pSBf, expectedEntries, errorRate * DEFAULT_TIGHTENING_RATIO) == NULL) {
@@ -45,6 +50,9 @@ SScalableBf *tScalableBfInit(uint64_t expectedEntries, double errorRate) {
}
int32_t tScalableBfPutNoCheck(SScalableBf *pSBf, const void *keyBuf, uint32_t len) {
+ if (pSBf->status == SBF_INVALID) {
+ return TSDB_CODE_FAILED;
+ }
int32_t size = taosArrayGetSize(pSBf->bfArray);
SBloomFilter *pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1);
ASSERT(pNormalBf);
@@ -52,6 +60,7 @@ int32_t tScalableBfPutNoCheck(SScalableBf *pSBf, const void *keyBuf, uint32_t le
pNormalBf = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth,
pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO);
if (pNormalBf == NULL) {
+ pSBf->status = SBF_INVALID;
return TSDB_CODE_OUT_OF_MEMORY;
}
}
@@ -59,6 +68,9 @@ int32_t tScalableBfPutNoCheck(SScalableBf *pSBf, const void *keyBuf, uint32_t le
}
int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len) {
+ if (pSBf->status == SBF_INVALID) {
+ return TSDB_CODE_FAILED;
+ }
uint64_t h1 = (uint64_t)pSBf->hashFn1(keyBuf, len);
uint64_t h2 = (uint64_t)pSBf->hashFn2(keyBuf, len);
int32_t size = taosArrayGetSize(pSBf->bfArray);
@@ -74,6 +86,7 @@ int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len) {
pNormalBf = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth,
pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO);
if (pNormalBf == NULL) {
+ pSBf->status = SBF_INVALID;
return TSDB_CODE_OUT_OF_MEMORY;
}
}
@@ -81,6 +94,9 @@ int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len) {
}
int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf, uint32_t len) {
+ if (pSBf->status == SBF_INVALID) {
+ return TSDB_CODE_FAILED;
+ }
uint64_t h1 = (uint64_t)pSBf->hashFn1(keyBuf, len);
uint64_t h2 = (uint64_t)pSBf->hashFn2(keyBuf, len);
int32_t size = taosArrayGetSize(pSBf->bfArray);
@@ -93,6 +109,10 @@ int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf, uint32
}
static SBloomFilter *tScalableBfAddFilter(SScalableBf *pSBf, uint64_t expectedEntries, double errorRate) {
+ if (taosArrayGetSize(pSBf->bfArray) >= pSBf->maxBloomFilters) {
+ return NULL;
+ }
+
SBloomFilter *pNormalBf = tBloomFilterInit(expectedEntries, errorRate);
if (pNormalBf == NULL) {
return NULL;
@@ -128,6 +148,8 @@ int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder *pEncoder) {
}
if (tEncodeU32(pEncoder, pSBf->growth) < 0) return -1;
if (tEncodeU64(pEncoder, pSBf->numBits) < 0) return -1;
+ if (tEncodeU32(pEncoder, pSBf->maxBloomFilters) < 0) return -1;
+ if (tEncodeI8(pEncoder, pSBf->status) < 0) return -1;
return 0;
}
@@ -150,6 +172,8 @@ SScalableBf *tScalableBfDecode(SDecoder *pDecoder) {
}
if (tDecodeU32(pDecoder, &pSBf->growth) < 0) goto _error;
if (tDecodeU64(pDecoder, &pSBf->numBits) < 0) goto _error;
+ if (tDecodeU32(pDecoder, &pSBf->maxBloomFilters) < 0) goto _error;
+ if (tDecodeI8(pDecoder, &pSBf->status) < 0) goto _error;
return pSBf;
_error:
diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c
index 3e591c7d7f..138d4bc1f4 100644
--- a/source/util/src/tworker.c
+++ b/source/util/src/tworker.c
@@ -417,9 +417,9 @@ _OVER:
return NULL;
} else {
while (worker->pid <= 0) taosMsleep(10);
- queue->threadId = worker->pid;
- uInfo("worker:%s, queue:%p is allocated, ahandle:%p thread:%08" PRId64, pool->name, queue, ahandle,
- queue->threadId);
+
+ taosQueueSetThreadId(queue, worker->pid);
+ uInfo("worker:%s, queue:%p is allocated, ahandle:%p thread:%08" PRId64, pool->name, queue, ahandle, worker->pid);
return queue;
}
}
diff --git a/source/util/test/CMakeLists.txt b/source/util/test/CMakeLists.txt
index 3514c578e9..d6bd8d6537 100644
--- a/source/util/test/CMakeLists.txt
+++ b/source/util/test/CMakeLists.txt
@@ -108,3 +108,11 @@ add_test(
NAME tbaseCodecTest
COMMAND tbaseCodecTest
)
+
+# bufferTest
+add_executable(bufferTest "bufferTest.cpp")
+target_link_libraries(bufferTest os util gtest_main)
+add_test(
+ NAME bufferTest
+ COMMAND bufferTest
+)
\ No newline at end of file
diff --git a/source/util/test/bufferTest.cpp b/source/util/test/bufferTest.cpp
new file mode 100644
index 0000000000..4e152b783b
--- /dev/null
+++ b/source/util/test/bufferTest.cpp
@@ -0,0 +1,371 @@
+#include
+
+#include "tbuffer.h"
+
+typedef struct {
+ int8_t value1;
+ int32_t value2;
+ int64_t value3;
+} STestStruct;
+
+TEST(BufferTest, simpleTest1) {
+ SBuffer buffer;
+
+ tBufferInit(&buffer);
+
+ GTEST_ASSERT_EQ(tBufferGetSize(&buffer), 0);
+ GTEST_ASSERT_EQ(tBufferGetData(&buffer), nullptr);
+
+ tBufferDestroy(&buffer);
+}
+
+TEST(BufferTest, forwardWriteAndRead) {
+ int32_t code = 0;
+ bool forward = true;
+ SBuffer buffer;
+
+ tBufferInit(&buffer);
+ taosSeedRand(taosGetTimestampSec());
+
+ // write
+ /* fix-len struct */
+ STestStruct testStruct = {1, 2};
+ GTEST_ASSERT_EQ(tBufferPut(&buffer, &testStruct, sizeof(STestStruct)), 0);
+
+ /* int8_t */
+ int8_t i8 = taosRand() % UINT8_MAX - INT8_MAX;
+ GTEST_ASSERT_EQ(tBufferPutI8(&buffer, i8), 0);
+
+ /* int16_t */
+ int8_t i16 = taosRand() % UINT16_MAX - INT16_MAX;
+ GTEST_ASSERT_EQ(tBufferPutI16(&buffer, i16), 0);
+
+ /* int32_t */
+ int8_t i32 = taosRand();
+ GTEST_ASSERT_EQ(tBufferPutI32(&buffer, i32), 0);
+
+ /* int64_t */
+ int64_t i64 = taosRand();
+ GTEST_ASSERT_EQ(tBufferPutI64(&buffer, i64), 0);
+
+ /* uint8_t */
+ uint8_t u8 = taosRand() % UINT8_MAX;
+ GTEST_ASSERT_EQ(tBufferPutU8(&buffer, u8), 0);
+
+ /* uint16_t */
+ uint16_t u16 = taosRand() % UINT16_MAX;
+ GTEST_ASSERT_EQ(tBufferPutU16(&buffer, u16), 0);
+
+ /* uint32_t */
+ uint32_t u32 = taosRand();
+ GTEST_ASSERT_EQ(tBufferPutU32(&buffer, u32), 0);
+
+ /* uint64_t */
+ uint64_t u64 = taosRand();
+ GTEST_ASSERT_EQ(tBufferPutU64(&buffer, u64), 0);
+
+ /* float */
+ float f = (float)taosRand() / (float)taosRand();
+ GTEST_ASSERT_EQ(tBufferPutF32(&buffer, f), 0);
+
+ /* double */
+ double d = (double)taosRand() / (double)taosRand();
+ GTEST_ASSERT_EQ(tBufferPutF64(&buffer, d), 0);
+
+ /* binary */
+ uint8_t binary[10];
+ for (int32_t i = 0; i < sizeof(binary); ++i) {
+ binary[i] = taosRand() % UINT8_MAX;
+ }
+ GTEST_ASSERT_EQ(tBufferPutBinary(&buffer, binary, sizeof(binary)), 0);
+
+ /* cstr */
+ const char *cstr = "hello world";
+ GTEST_ASSERT_EQ(tBufferPutCStr(&buffer, cstr), 0);
+
+ /* uint16v_t */
+ uint16_t u16v[] = {0, 127, 128, 129, 16384, 16385, 16386, UINT16_MAX};
+ for (int32_t i = 0; i < sizeof(u16v) / sizeof(u16v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferPutU16v(&buffer, u16v[i]), 0);
+ }
+
+ /* uint32v_t */
+ uint32_t u32v[] = {0, 127, 128, 129, 16384, 16385, 16386, (1 << 21) - 1,
+ (1 << 21), (1 << 21) + 1, (1 << 28) - 1, (1 << 28), (1 << 28) + 1, UINT32_MAX};
+ for (int32_t i = 0; i < sizeof(u32v) / sizeof(u32v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferPutU32v(&buffer, u32v[i]), 0);
+ }
+
+ /* uint64v_t */
+ uint64_t u64v[] = {0, // 0
+ (1ul << (7 * 1)) - 1,
+ (1ul << (7 * 1)),
+ (1ul << (7 * 1)) + 1,
+ (1ul << (7 * 2)) - 1,
+ (1ul << (7 * 2)),
+ (1ul << (7 * 2)) + 1,
+ (1ul << (7 * 3)) - 1,
+ (1ul << (7 * 3)),
+ (1ul << (7 * 3)) + 1,
+ (1ul << (7 * 4)) - 1,
+ (1ul << (7 * 4)),
+ (1ul << (7 * 4)) + 1,
+ (1ul << (7 * 5)) - 1,
+ (1ul << (7 * 5)),
+ (1ul << (7 * 5)) + 1,
+ (1ul << (7 * 6)) - 1,
+ (1ul << (7 * 6)),
+ (1ul << (7 * 6)) + 1,
+ (1ul << (7 * 7)) - 1,
+ (1ul << (7 * 7)),
+ (1ul << (7 * 7)) + 1,
+ (1ul << (7 * 8)) - 1,
+ (1ul << (7 * 8)),
+ (1ul << (7 * 8)) + 1,
+ (1ul << (7 * 9)) - 1,
+ (1ul << (7 * 9)),
+ (1ul << (7 * 9)) + 1,
+ UINT64_MAX};
+ for (int32_t i = 0; i < sizeof(u64v) / sizeof(u64v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferPutU64v(&buffer, u64v[i]), 0);
+ }
+
+ /* int16v_t */
+ int16_t i16v[] = {
+ INT16_MIN, //
+ -((1 << (7 * 1)) - 1),
+ -((1 << (7 * 1))),
+ -((1 << (7 * 1)) + 1),
+ -((1 << (7 * 2)) - 1),
+ -((1 << (7 * 2))),
+ -((1 << (7 * 2)) + 1),
+ (1 << (7 * 0)) - 1,
+ (1 << (7 * 0)),
+ (1 << (7 * 0)) + 1,
+ (1 << (7 * 1)) - 1,
+ (1 << (7 * 1)),
+ (1 << (7 * 1)) + 1,
+ (1 << (7 * 2)) - 1,
+ (1 << (7 * 2)),
+ (1 << (7 * 2)) + 1,
+ INT16_MAX,
+ };
+ for (int32_t i = 0; i < sizeof(i16v) / sizeof(i16v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferPutI16v(&buffer, i16v[i]), 0);
+ }
+
+ /* int32v_t */
+ int32_t i32v[] = {
+ INT32_MIN, //
+ -((1 << (7 * 1)) - 1),
+ -((1 << (7 * 1))),
+ -((1 << (7 * 1)) + 1),
+ -((1 << (7 * 2)) - 1),
+ -((1 << (7 * 2))),
+ -((1 << (7 * 2)) + 1),
+ -((1 << (7 * 3)) - 1),
+ -((1 << (7 * 3))),
+ -((1 << (7 * 3)) + 1),
+ -((1 << (7 * 4)) - 1),
+ -((1 << (7 * 4))),
+ -((1 << (7 * 4)) + 1),
+ (1 << (7 * 0)) - 1,
+ (1 << (7 * 0)),
+ (1 << (7 * 0)) + 1,
+ (1 << (7 * 1)) - 1,
+ (1 << (7 * 1)),
+ (1 << (7 * 1)) + 1,
+ (1 << (7 * 2)) - 1,
+ (1 << (7 * 2)),
+ (1 << (7 * 2)) + 1,
+ (1 << (7 * 3)) - 1,
+ (1 << (7 * 3)),
+ (1 << (7 * 3)) + 1,
+ (1 << (7 * 4)) - 1,
+ (1 << (7 * 4)),
+ (1 << (7 * 4)) + 1,
+ INT32_MAX,
+ };
+ for (int32_t i = 0; i < sizeof(i32v) / sizeof(i32v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferPutI32v(&buffer, i32v[i]), 0);
+ }
+
+ /* int64v_t */
+ int64_t i64v[] = {
+ INT64_MIN, //
+ -((1l << (7 * 1)) - 1),
+ -((1l << (7 * 1))),
+ -((1l << (7 * 1)) + 1),
+ -((1l << (7 * 2)) - 1),
+ -((1l << (7 * 2))),
+ -((1l << (7 * 2)) + 1),
+ -((1l << (7 * 3)) - 1),
+ -((1l << (7 * 3))),
+ -((1l << (7 * 3)) + 1),
+ -((1l << (7 * 4)) - 1),
+ -((1l << (7 * 4))),
+ -((1l << (7 * 4)) + 1),
+ -((1l << (7 * 5)) - 1),
+ -((1l << (7 * 5))),
+ -((1l << (7 * 5)) + 1),
+ -((1l << (7 * 6)) - 1),
+ -((1l << (7 * 6))),
+ -((1l << (7 * 6)) + 1),
+ -((1l << (7 * 7)) - 1),
+ -((1l << (7 * 7))),
+ -((1l << (7 * 7)) + 1),
+ -((1l << (7 * 8)) - 1),
+ -((1l << (7 * 8))),
+ -((1l << (7 * 8)) + 1),
+ -((1l << (7 * 9)) + 1),
+ ((1l << (7 * 1)) - 1),
+ ((1l << (7 * 1))),
+ ((1l << (7 * 1)) + 1),
+ ((1l << (7 * 2)) - 1),
+ ((1l << (7 * 2))),
+ ((1l << (7 * 2)) + 1),
+ ((1l << (7 * 3)) - 1),
+ ((1l << (7 * 3))),
+ ((1l << (7 * 3)) + 1),
+ ((1l << (7 * 4)) - 1),
+ ((1l << (7 * 4))),
+ ((1l << (7 * 4)) + 1),
+ ((1l << (7 * 5)) - 1),
+ ((1l << (7 * 5))),
+ ((1l << (7 * 5)) + 1),
+ ((1l << (7 * 6)) - 1),
+ ((1l << (7 * 6))),
+ ((1l << (7 * 6)) + 1),
+ ((1l << (7 * 7)) - 1),
+ ((1l << (7 * 7))),
+ ((1l << (7 * 7)) + 1),
+ ((1l << (7 * 8)) - 1),
+ ((1l << (7 * 8))),
+ ((1l << (7 * 8)) + 1),
+ ((1l << (7 * 9)) + 1),
+ INT64_MAX,
+ };
+ for (int32_t i = 0; i < sizeof(i64v) / sizeof(i64v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferPutI64v(&buffer, i64v[i]), 0);
+ }
+
+ // read
+ SBufferReader reader;
+ tBufferReaderInit(&reader, 0, &buffer);
+
+ /* fix-len struct */
+ STestStruct testStruct2 = {1, 2};
+ GTEST_ASSERT_EQ(tBufferGet(&reader, sizeof(STestStruct), &testStruct2), 0);
+ GTEST_ASSERT_EQ(testStruct.value1, testStruct2.value1);
+ GTEST_ASSERT_EQ(testStruct.value2, testStruct2.value2);
+ GTEST_ASSERT_EQ(testStruct.value3, testStruct2.value3);
+
+ /* int8_t */
+ int8_t i8_2 = 97;
+ GTEST_ASSERT_EQ(tBufferGetI8(&reader, &i8_2), 0);
+ GTEST_ASSERT_EQ(i8, i8_2);
+
+ /* int16_t */
+ int16_t i16_2;
+ GTEST_ASSERT_EQ(tBufferGetI16(&reader, &i16_2), 0);
+ GTEST_ASSERT_EQ(i16, i16_2);
+
+ /* int32_t */
+ int32_t i32_2;
+ GTEST_ASSERT_EQ(tBufferGetI32(&reader, &i32_2), 0);
+ GTEST_ASSERT_EQ(i32, i32_2);
+
+ /* int64_t */
+ int64_t i64_2;
+ GTEST_ASSERT_EQ(tBufferGetI64(&reader, &i64_2), 0);
+ GTEST_ASSERT_EQ(i64, i64_2);
+
+ /* uint8_t */
+ uint8_t u8_2;
+ GTEST_ASSERT_EQ(tBufferGetU8(&reader, &u8_2), 0);
+ GTEST_ASSERT_EQ(u8, u8_2);
+
+ /* uint16_t */
+ uint16_t u16_2;
+ GTEST_ASSERT_EQ(tBufferGetU16(&reader, &u16_2), 0);
+ GTEST_ASSERT_EQ(u16, u16_2);
+
+ /* uint32_t */
+ uint32_t u32_2;
+ GTEST_ASSERT_EQ(tBufferGetU32(&reader, &u32_2), 0);
+ GTEST_ASSERT_EQ(u32, u32_2);
+
+ /* uint64_t */
+ uint64_t u64_2;
+ GTEST_ASSERT_EQ(tBufferGetU64(&reader, &u64_2), 0);
+ GTEST_ASSERT_EQ(u64, u64_2);
+
+ /* float */
+ float f_2;
+ GTEST_ASSERT_EQ(tBufferGetF32(&reader, &f_2), 0);
+ GTEST_ASSERT_EQ(f, f_2);
+
+ /* double */
+ double d_2;
+ GTEST_ASSERT_EQ(tBufferGetF64(&reader, &d_2), 0);
+ GTEST_ASSERT_EQ(d, d_2);
+
+ /* binary */
+ const void *binary2;
+ uint32_t binarySize;
+ GTEST_ASSERT_EQ(tBufferGetBinary(&reader, &binary2, &binarySize), 0);
+ GTEST_ASSERT_EQ(memcmp(binary, binary2, sizeof(binary)), 0);
+ GTEST_ASSERT_EQ(binarySize, sizeof(binary));
+
+ /* cstr */
+ const char *cstr2;
+ GTEST_ASSERT_EQ(tBufferGetCStr(&reader, &cstr2), 0);
+ GTEST_ASSERT_EQ(strcmp(cstr, cstr2), 0);
+
+ /* uint16v_t */
+ uint16_t u16v2[sizeof(u16v) / sizeof(u16v[0])];
+ for (int32_t i = 0; i < sizeof(u16v) / sizeof(u16v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferGetU16v(&reader, &u16v2[i]), 0);
+ GTEST_ASSERT_EQ(u16v[i], u16v2[i]);
+ }
+
+ /* uint32v_t */
+ uint32_t u32v2[sizeof(u32v) / sizeof(u32v[0])];
+ for (int32_t i = 0; i < sizeof(u32v) / sizeof(u32v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferGetU32v(&reader, &u32v2[i]), 0);
+ GTEST_ASSERT_EQ(u32v[i], u32v2[i]);
+ }
+
+ /* uint64v_t */
+ uint64_t u64v2[sizeof(u64v) / sizeof(u64v[0])];
+ for (int32_t i = 0; i < sizeof(u64v) / sizeof(u64v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferGetU64v(&reader, &u64v2[i]), 0);
+ GTEST_ASSERT_EQ(u64v[i], u64v2[i]);
+ }
+
+ /* int16v_t */
+ int16_t i16v2[sizeof(i16v) / sizeof(i16v[0])];
+ for (int32_t i = 0; i < sizeof(i16v) / sizeof(i16v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferGetI16v(&reader, &i16v2[i]), 0);
+ GTEST_ASSERT_EQ(i16v[i], i16v2[i]);
+ }
+
+ /* int32v_t */
+ int32_t i32v2[sizeof(i32v) / sizeof(i32v[0])];
+ for (int32_t i = 0; i < sizeof(i32v) / sizeof(i32v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferGetI32v(&reader, &i32v2[i]), 0);
+ GTEST_ASSERT_EQ(i32v[i], i32v2[i]);
+ }
+
+ /* int64v_t */
+ int64_t i64v2[sizeof(i64v) / sizeof(i64v[0])];
+ for (int32_t i = 0; i < sizeof(i64v) / sizeof(i64v[0]); ++i) {
+ GTEST_ASSERT_EQ(tBufferGetI64v(&reader, &i64v2[i]), 0);
+ GTEST_ASSERT_EQ(i64v[i], i64v2[i]);
+ }
+
+ tBufferReaderDestroy(&reader);
+
+ // clear
+ tBufferDestroy(&buffer);
+}
diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task
index bdccf33c32..a2348bdedd 100644
--- a/tests/parallel_test/cases.task
+++ b/tests/parallel_test/cases.task
@@ -115,7 +115,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/ins_topics_test.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqMaxTopic.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqParamsTest.py
-,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqParamsTest.py -R
+#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqParamsTest.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqClientConsLog.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqMaxGroupIds.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsumeDiscontinuousData.py
@@ -238,7 +238,8 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -N 5
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -i True
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -n 3 -i True
-,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform.py -N 2 -n 1
+,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-db-removewal.py -N 2 -n 1
+,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb-removewal.py -N 6 -n 3
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 2 -n 1
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 6 -n 3
#,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-db.py -N 6 -n 3
@@ -1085,6 +1086,7 @@
,,y,script,./test.sh -f tsim/parser/join_multivnode.sim
,,y,script,./test.sh -f tsim/parser/join.sim
,,y,script,./test.sh -f tsim/parser/last_cache.sim
+,,y,script,./test.sh -f tsim/parser/last_both.sim
,,y,script,./test.sh -f tsim/parser/last_groupby.sim
,,y,script,./test.sh -f tsim/parser/lastrow.sim
,,y,script,./test.sh -f tsim/parser/lastrow2.sim
@@ -1211,6 +1213,7 @@
,,y,script,./test.sh -f tsim/stream/deleteState.sim
,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim
,,y,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim
+,,y,script,./test.sh -f tsim/stream/distributeMultiLevelInterval0.sim
,,y,script,./test.sh -f tsim/stream/distributeSession0.sim
,,y,script,./test.sh -f tsim/stream/drop_stream.sim
,,y,script,./test.sh -f tsim/stream/event0.sim
diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh
index 3b3d275a07..c6bd78336c 100755
--- a/tests/script/sh/deploy.sh
+++ b/tests/script/sh/deploy.sh
@@ -113,11 +113,11 @@ echo "firstEp ${HOSTNAME}:7100" >> $TAOS_CFG
echo "secondEp ${HOSTNAME}:7200" >> $TAOS_CFG
echo "fqdn ${HOSTNAME}" >> $TAOS_CFG
echo "serverPort ${NODE}" >> $TAOS_CFG
-echo "supportVnodes 1024" >> $TAOS_CFG
+echo "supportVnodes 1024" >> $TAOS_CFG
echo "statusInterval 1" >> $TAOS_CFG
echo "dataDir $DATA_DIR" >> $TAOS_CFG
echo "logDir $LOG_DIR" >> $TAOS_CFG
-echo "debugFlag 0" >> $TAOS_CFG
+echo "debugFlag 135" >> $TAOS_CFG
echo "tmrDebugFlag 131" >> $TAOS_CFG
echo "uDebugFlag 143" >> $TAOS_CFG
echo "rpcDebugFlag 143" >> $TAOS_CFG
@@ -143,4 +143,5 @@ echo "asyncLog 0" >> $TAOS_CFG
echo "locale en_US.UTF-8" >> $TAOS_CFG
echo "telemetryReporting 0" >> $TAOS_CFG
echo "querySmaOptimize 1" >> $TAOS_CFG
+echo "checkpointInterval 60" >> $TAOS_CFG
echo " " >> $TAOS_CFG
diff --git a/tests/script/sh/stop_dnodes.sh b/tests/script/sh/stop_dnodes.sh
index c63d6daf8a..b447a7325e 100755
--- a/tests/script/sh/stop_dnodes.sh
+++ b/tests/script/sh/stop_dnodes.sh
@@ -15,42 +15,42 @@ fi
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
while [ -n "$PID" ]; do
- echo kill -9 $PID
- #pkill -9 taosd
- kill -9 $PID
+ echo kill -15 $PID
+ #pkill -15 taosd
+ kill -15 $PID
echo "Killing taosd processes"
if [ "$OS_TYPE" != "Darwin" ]; then
fuser -k -n tcp 6030
else
- lsof -nti:6030 | xargs kill -9
+ lsof -nti:6030 | xargs kill -15
fi
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
done
PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'`
while [ -n "$PID" ]; do
- echo kill -9 $PID
+ echo kill -15 $PID
#pkill -9 taos
- kill -9 $PID
+ kill -15 $PID
echo "Killing taos processes"
if [ "$OS_TYPE" != "Darwin" ]; then
fuser -k -n tcp 6030
else
- lsof -nti:6030 | xargs kill -9
+ lsof -nti:6030 | xargs kill -15
fi
PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'`
done
PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'`
while [ -n "$PID" ]; do
- echo kill -9 $PID
- #pkill -9 tmq_sim
- kill -9 $PID
+ echo kill -15 $PID
+ #pkill -15 tmq_sim
+ kill -15 $PID
echo "Killing tmq_sim processes"
if [ "$OS_TYPE" != "Darwin" ]; then
fuser -k -n tcp 6030
else
- lsof -nti:6030 | xargs kill -9
+ lsof -nti:6030 | xargs kill -15
fi
PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'`
-done
+done
\ No newline at end of file
diff --git a/tests/script/tsim/parser/last_both.sim b/tests/script/tsim/parser/last_both.sim
new file mode 100644
index 0000000000..e01a966744
--- /dev/null
+++ b/tests/script/tsim/parser/last_both.sim
@@ -0,0 +1,150 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sql connect
+
+print ======================== dnode1 start
+$db = testdb
+sql drop database if exists $db
+sql create database $db cachemodel 'none' minrows 10 stt_trigger 1
+sql use $db
+
+sql create stable st2 (ts timestamp, f1 int, f2 double, f3 binary(10), f4 timestamp) tags (id int)
+sql create table tb1 using st2 tags (1);
+sql create table tb2 using st2 tags (2);
+sql create table tb3 using st2 tags (3);
+sql create table tb4 using st2 tags (4);
+sql create table tb5 using st2 tags (1);
+sql create table tb6 using st2 tags (2);
+sql create table tb7 using st2 tags (3);
+sql create table tb8 using st2 tags (4);
+sql create table tb9 using st2 tags (5);
+sql create table tba using st2 tags (5);
+sql create table tbb using st2 tags (5);
+sql create table tbc using st2 tags (5);
+sql create table tbd using st2 tags (5);
+sql create table tbe using st2 tags (5);
+sql create table tbf using st2 tags (5);
+
+sql insert into tb9 values ("2021-05-09 10:12:26.000",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.001",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.002",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.003",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.004",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.005",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.006",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.007",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.008",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.009",28, 29, '30', -1005)
+sql delete from tb9 where ts = "2021-05-09 10:12:26.000"
+sql flush database $db
+
+sql insert into tb1 values ("2021-05-09 10:10:10", 1, 2.0, '3', -1000)
+sql insert into tb1 values ("2021-05-10 10:10:11", 4, 5.0, NULL, -2000)
+sql insert into tb1 values ("2021-05-12 10:10:12", 6,NULL, NULL, -3000)
+
+sql insert into tb2 values ("2021-05-09 10:11:13",-1,-2.0,'-3', -1001)
+sql insert into tb2 values ("2021-05-10 10:11:14",-4,-5.0, NULL, -2001)
+sql insert into tb2 values ("2021-05-11 10:11:15",-6, -7, '-8', -3001)
+
+sql insert into tb3 values ("2021-05-09 10:12:17", 7, 8.0, '9' , -1002)
+sql insert into tb3 values ("2021-05-09 10:12:17",10,11.0, NULL, -2002)
+sql insert into tb3 values ("2021-05-09 10:12:18",12,NULL, NULL, -3002)
+
+sql insert into tb4 values ("2021-05-09 10:12:19",13,14.0,'15' , -1003)
+sql insert into tb4 values ("2021-05-10 10:12:20",16,17.0, NULL, -2003)
+sql insert into tb4 values ("2021-05-11 10:12:21",18,NULL, NULL, -3003)
+
+sql insert into tb5 values ("2021-05-09 10:12:22",19, 20, '21', -1004)
+sql insert into tb6 values ("2021-05-11 10:12:23",22, 23, NULL, -2004)
+sql insert into tb7 values ("2021-05-10 10:12:24",24,NULL, '25', -3004)
+sql insert into tb8 values ("2021-05-11 10:12:25",26,NULL, '27', -4004)
+
+sql insert into tba values ("2021-05-10 10:12:27",31, 32, NULL, -2005)
+sql insert into tbb values ("2021-05-10 10:12:28",33,NULL, '35', -3005)
+sql insert into tbc values ("2021-05-11 10:12:29",36, 37, NULL, -4005)
+sql insert into tbd values ("2021-05-11 10:12:29",NULL,NULL,NULL,NULL )
+
+sql drop table tbf;
+sql alter table st2 add column c1 int;
+sql alter table st2 drop column c1;
+
+run tsim/parser/last_both_query.sim
+
+sql flush database $db
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
+system sh/exec.sh -n dnode1 -s start
+
+run tsim/parser/last_both_query.sim
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
+system sh/exec.sh -n dnode1 -s start
+
+sql drop database if exists $db
+sql create database $db minrows 10 stt_trigger 1
+sql use $db
+
+sql create stable st2 (ts timestamp, f1 int, f2 double, f3 binary(10), f4 timestamp) tags (id int)
+sql create table tb1 using st2 tags (1);
+sql create table tb2 using st2 tags (2);
+sql create table tb3 using st2 tags (3);
+sql create table tb4 using st2 tags (4);
+sql create table tb5 using st2 tags (1);
+sql create table tb6 using st2 tags (2);
+sql create table tb7 using st2 tags (3);
+sql create table tb8 using st2 tags (4);
+sql create table tb9 using st2 tags (5);
+sql create table tba using st2 tags (5);
+sql create table tbb using st2 tags (5);
+sql create table tbc using st2 tags (5);
+sql create table tbd using st2 tags (5);
+sql create table tbe using st2 tags (5);
+sql create table tbf using st2 tags (5);
+
+sql insert into tb9 values ("2021-05-09 10:12:26.000",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.001",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.002",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.003",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.004",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.005",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.006",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.007",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.008",28, 29, '30', -1005)
+sql insert into tb9 values ("2021-05-09 10:12:26.009",28, 29, '30', -1005)
+sql delete from tb9 where ts = "2021-05-09 10:12:26.000"
+sql flush database $db
+
+sql insert into tb1 values ("2021-05-09 10:10:10", 1, 2.0, '3', -1000)
+sql insert into tb1 values ("2021-05-10 10:10:11", 4, 5.0, NULL, -2000)
+sql insert into tb1 values ("2021-05-12 10:10:12", 6,NULL, NULL, -3000)
+
+sql insert into tb2 values ("2021-05-09 10:11:13",-1,-2.0,'-3', -1001)
+sql insert into tb2 values ("2021-05-10 10:11:14",-4,-5.0, NULL, -2001)
+sql insert into tb2 values ("2021-05-11 10:11:15",-6, -7, '-8', -3001)
+
+sql insert into tb3 values ("2021-05-09 10:12:17", 7, 8.0, '9' , -1002)
+sql insert into tb3 values ("2021-05-09 10:12:17",10,11.0, NULL, -2002)
+sql insert into tb3 values ("2021-05-09 10:12:18",12,NULL, NULL, -3002)
+
+sql insert into tb4 values ("2021-05-09 10:12:19",13,14.0,'15' , -1003)
+sql insert into tb4 values ("2021-05-10 10:12:20",16,17.0, NULL, -2003)
+sql insert into tb4 values ("2021-05-11 10:12:21",18,NULL, NULL, -3003)
+
+sql insert into tb5 values ("2021-05-09 10:12:22",19, 20, '21', -1004)
+sql insert into tb6 values ("2021-05-11 10:12:23",22, 23, NULL, -2004)
+sql insert into tb7 values ("2021-05-10 10:12:24",24,NULL, '25', -3004)
+sql insert into tb8 values ("2021-05-11 10:12:25",26,NULL, '27', -4004)
+
+sql insert into tba values ("2021-05-10 10:12:27",31, 32, NULL, -2005)
+sql insert into tbb values ("2021-05-10 10:12:28",33,NULL, '35', -3005)
+sql insert into tbc values ("2021-05-11 10:12:29",36, 37, NULL, -4005)
+sql insert into tbd values ("2021-05-11 10:12:29",NULL,NULL,NULL,NULL )
+
+sql drop table tbf
+sql alter database $db cachemodel 'both'
+sql alter database $db cachesize 2
+sleep 11000
+
+run tsim/parser/last_both_query.sim
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/last_both_query.sim b/tests/script/tsim/parser/last_both_query.sim
new file mode 100644
index 0000000000..5f86412199
--- /dev/null
+++ b/tests/script/tsim/parser/last_both_query.sim
@@ -0,0 +1,496 @@
+
+sql connect
+
+$db = testdb
+sql use $db
+print "test tb1"
+
+sql select last(ts) from tb1
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-12 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+
+sql select last(f1) from tb1
+if $rows != 1 then
+ return -1
+endi
+if $data00 != 6 then
+ print $data00
+ return -1
+endi
+
+sql select last(*) from tb1
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-12 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != 6 then
+ return -1
+endi
+if $data02 != 5.000000000 then
+ print $data02
+ return -1
+endi
+if $data03 != 3 then
+ print expect 3, actual: $data03
+ return -1
+endi
+if $data04 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+
+sql select last(tb1.*,ts,f4) from tb1
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-12 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != 6 then
+ return -1
+endi
+if $data02 != 5.000000000 then
+ print $data02
+ return -1
+endi
+if $data03 != 3 then
+ return -1
+endi
+if $data04 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+if $data05 != @21-05-12 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+if $data06 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+
+print "test tb2"
+sql select last(ts) from tb2
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-11 10:11:15.000@ then
+ print $data00
+ return -1
+endi
+
+sql select last(f1) from tb2
+if $rows != 1 then
+ return -1
+endi
+if $data00 != -6 then
+ print $data00
+ return -1
+endi
+
+sql select last(*) from tb2
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-11 10:11:15.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != -6 then
+ return -1
+endi
+if $data02 != -7.000000000 then
+ print $data02
+ return -1
+endi
+if $data03 != -8 then
+ return -1
+endi
+if $data04 != @70-01-01 07:59:56.999@ then
+ if $data04 != @70-01-01 07:59:57.-01@ then
+ return -1
+ endi
+endi
+
+sql select last(tb2.*,ts,f4) from tb2
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-11 10:11:15.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != -6 then
+ return -1
+endi
+if $data02 != -7.000000000 then
+ print $data02
+ return -1
+endi
+if $data03 != -8 then
+ return -1
+endi
+if $data04 != @70-01-01 07:59:56.999@ then
+ if $data04 != @70-01-01 07:59:57.-01@ then
+ return -1
+ endi
+endi
+if $data05 != @21-05-11 10:11:15.000@ then
+ print $data00
+ return -1
+endi
+if $data06 != @70-01-01 07:59:56.999@ then
+ if $data04 != @70-01-01 07:59:57.-01@ then
+ return -1
+ endi
+endi
+
+print "test tbd"
+sql select last(*) from tbd
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-11 10:12:29.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != NULL then
+ return -1
+endi
+if $data02 != NULL then
+ print $data02
+ return -1
+endi
+if $data03 != NULL then
+ return -1
+endi
+if $data04 != NULL then
+ return -1
+endi
+
+print "test tbe"
+sql select last(*) from tbe
+if $rows != 0 then
+ return -1
+endi
+
+print "test stable"
+sql select last(ts) from st2
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-12 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+
+sql select last(f1) from st2
+if $rows != 1 then
+ return -1
+endi
+if $data00 != 6 then
+ print $data00
+ return -1
+endi
+
+sql select last(*) from st2
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-12 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != 6 then
+ return -1
+endi
+if $data02 != 37.000000000 then
+ print expect 37.000000000 actual: $data02
+ return -1
+endi
+if $data03 != 27 then
+ return -1
+endi
+if $data04 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+
+
+sql select last(st2.*,ts,f4) from st2
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-12 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != 6 then
+ return -1
+endi
+if $data02 != 37.000000000 then
+ print expect 37.000000000, acutal: $data02
+ return -1
+endi
+if $data03 != 27 then
+ return -1
+endi
+if $data04 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+if $data05 != @21-05-12 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+if $data06 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+
+sql select last(*), id from st2 group by id order by id
+print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
+print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
+print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
+print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39
+print ===> $data40 $data41 $data42 $data43 $data44 $data45 $data46 $data47 $data48 $data49
+
+if $rows != 5 then
+ return -1
+endi
+if $data00 != @21-05-12 10:10:12.000@ then
+ return -1
+endi
+if $data01 != 6 then
+ return -1
+endi
+if $data02 != 5.000000000 then
+ print $data02
+ return -1
+endi
+if $data03 != 21 then
+ return -1
+endi
+if $data04 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data10 != @21-05-11 10:12:23.000@ then
+ return -1
+endi
+if $data11 != 22 then
+ return -1
+endi
+if $data12 != 23.000000000 then
+ print $data02
+ return -1
+endi
+if $data13 != -8 then
+ return -1
+endi
+if $data14 != @70-01-01 07:59:58.-04@ then
+ return -1
+endi
+if $data15 != 2 then
+ return -1
+endi
+if $data20 != @21-05-10 10:12:24.000@ then
+ return -1
+endi
+if $data21 != 24 then
+ return -1
+endi
+if $data22 != 11.000000000 then
+ print expect 11.000000000 actual: $data22
+ return -1
+endi
+if $data23 != 25 then
+ return -1
+endi
+if $data24 != @70-01-01 07:59:57.-04@ then =
+ return -1
+endi
+if $data25 != 3 then
+ return -1
+endi
+if $data30 != @21-05-11 10:12:25.000@ then
+ return -1
+endi
+if $data31 != 26 then
+ return -1
+endi
+if $data32 != 17.000000000 then
+ print $data02
+ return -1
+endi
+if $data33 != 27 then
+ return -1
+endi
+if $data34 != @70-01-01 07:59:56.-04@ then
+ return -1
+endi
+if $data35 != 4 then
+ return -1
+endi
+if $data40 != @21-05-11 10:12:29.000@ then
+ return -1
+endi
+if $data41 != 36 then
+ return -1
+endi
+if $data42 != 37.000000000 then
+ print $data02
+ return -1
+endi
+if $data43 != 35 then
+ return -1
+endi
+if $data44 != @70-01-01 07:59:56.-05@ then
+ return -1
+endi
+if $data45 != 5 then
+ return -1
+endi
+
+sql select last_row(*), id from st2 group by id order by id
+print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
+print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
+print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
+print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39
+print ===> $data40 $data41 $data42 $data43 $data44 $data45 $data46 $data47 $data48 $data49
+
+if $rows != 5 then
+ return -1
+endi
+if $data00 != @21-05-12 10:10:12.000@ then
+ return -1
+endi
+if $data01 != 6 then
+ return -1
+endi
+if $data02 != NULL then
+ print $data02
+ return -1
+endi
+if $data03 != NULL then
+ return -1
+endi
+if $data04 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data10 != @21-05-11 10:12:23.000@ then
+ return -1
+endi
+if $data11 != 22 then
+ return -1
+endi
+if $data12 != 23.000000000 then
+ print $data02
+ return -1
+endi
+if $data13 != NULL then
+ return -1
+endi
+if $data14 != @70-01-01 07:59:58.-04@ then
+ return -1
+endi
+if $data15 != 2 then
+ return -1
+endi
+if $data20 != @21-05-10 10:12:24.000@ then
+ return -1
+endi
+if $data21 != 24 then
+ return -1
+endi
+if $data22 != NULL then
+ print expect NULL actual: $data22
+ return -1
+endi
+if $data23 != 25 then
+ return -1
+endi
+if $data24 != @70-01-01 07:59:57.-04@ then =
+ return -1
+endi
+if $data25 != 3 then
+ return -1
+endi
+if $data30 != @21-05-11 10:12:25.000@ then
+ return -1
+endi
+if $data31 != 26 then
+ return -1
+endi
+if $data32 != NULL then
+ print $data02
+ return -1
+endi
+if $data33 != 27 then
+ return -1
+endi
+if $data34 != @70-01-01 07:59:56.-04@ then
+ return -1
+endi
+if $data35 != 4 then
+ return -1
+endi
+if $data40 != @21-05-11 10:12:29.000@ then
+ return -1
+endi
+#if $data41 != NULL then
+# return -1
+#endi
+#if $data42 != NULL then
+# print $data02
+# return -1
+#endi
+if $data43 != NULL then
+ return -1
+endi
+#if $data44 != NULL then
+# return -1
+#endi
+if $data45 != 5 then
+ return -1
+endi
+
+print "test tbn"
+sql create table if not exists tbn (ts timestamp, f1 int, f2 double, f3 binary(10), f4 timestamp)
+sql insert into tbn values ("2021-05-09 10:10:10", 1, 2.0, '3', -1000)
+sql insert into tbn values ("2021-05-10 10:10:11", 4, 5.0, NULL, -2000)
+sql insert into tbn values ("2021-05-12 10:10:12", 6,NULL, NULL, -3000)
+sql insert into tbn values ("2021-05-13 10:10:12", NULL,NULL, NULL,NULL)
+
+sql select last(*) from tbn;
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @21-05-13 10:10:12.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != 6 then
+ return -1
+endi
+if $data02 != 5.000000000 then
+ print $data02
+ return -1
+endi
+if $data03 != 3 then
+ return -1
+endi
+if $data04 != @70-01-01 07:59:57.000@ then
+ return -1
+endi
+
+sql alter table tbn add column c1 int;
+sql alter table tbn drop column c1;
diff --git a/tests/script/tsim/parser/last_cache_query.sim b/tests/script/tsim/parser/last_cache_query.sim
index 6cd5309590..30196e0b62 100644
--- a/tests/script/tsim/parser/last_cache_query.sim
+++ b/tests/script/tsim/parser/last_cache_query.sim
@@ -386,3 +386,5 @@ if $data04 != @70-01-01 07:59:57.000@ then
return -1
endi
+sql alter table tbn add column c1 int;
+sql alter table tbn drop column c1;
diff --git a/tests/script/tsim/query/interval.sim b/tests/script/tsim/query/interval.sim
index 135fcc8591..7f950ea69c 100644
--- a/tests/script/tsim/query/interval.sim
+++ b/tests/script/tsim/query/interval.sim
@@ -226,4 +226,135 @@ print =============== clear
# return -1
#endi
+print ================= step12
+
+sql create database test2 vgroups 4;
+sql use test2;
+sql create stable stb (ts timestamp, c1 int) tags (t1 int);
+sql create table t1 using stb tags (1);
+sql create table t2 using stb tags (2);
+sql create table t3 using stb tags (3);
+sql create table t4 using stb tags (4);
+sql create table t5 using stb tags (4);
+sql create table t6 using stb tags (4);
+sql insert into t1 values ("2024-03-01 14:29:07.051", 11);
+sql insert into t2 values ("2024-03-01 14:29:07.051", 21);
+sql insert into t3 values ("2024-03-01 14:29:07.051", 31);
+sql insert into t4 values ("2024-03-01 14:29:07.051", 41);
+sql insert into t5 values ("2024-03-01 14:29:07.051", 51);
+sql insert into t6 values ("2024-03-01 14:29:07.051", 61);
+sql insert into t1 values ("2024-03-01 14:30:07.051", 12);
+sql insert into t2 values ("2024-03-01 14:30:07.051", 22);
+sql insert into t3 values ("2024-03-01 14:30:07.051", 32);
+sql insert into t4 values ("2024-03-01 14:30:07.051", 42);
+sql insert into t5 values ("2024-03-01 14:30:07.051", 52);
+sql insert into t6 values ("2024-03-01 14:30:07.051", 62);
+sql insert into t1 values ("2024-03-01 14:31:07.051", 13);
+sql insert into t2 values ("2024-03-01 14:31:07.051", 23);
+sql insert into t3 values ("2024-03-01 14:31:07.051", 33);
+sql insert into t4 values ("2024-03-01 14:31:07.051", 43);
+sql insert into t5 values ("2024-03-01 14:31:07.051", 53);
+sql insert into t6 values ("2024-03-01 14:31:07.051", 63);
+sql insert into t1 values ("2024-03-01 14:32:07.051", 14);
+sql insert into t2 values ("2024-03-01 14:32:07.051", 24);
+sql insert into t3 values ("2024-03-01 14:32:07.051", 34);
+sql insert into t4 values ("2024-03-01 14:32:07.051", 44);
+sql insert into t5 values ("2024-03-01 14:32:07.051", 54);
+sql insert into t6 values ("2024-03-01 14:32:07.051", 64);
+sql insert into t1 values ("2024-03-01 14:33:07.051", 15);
+sql insert into t2 values ("2024-03-01 14:33:07.051", 25);
+sql insert into t3 values ("2024-03-01 14:33:07.051", 35);
+sql insert into t4 values ("2024-03-01 14:33:07.051", 45);
+sql insert into t5 values ("2024-03-01 14:33:07.051", 55);
+sql insert into t6 values ("2024-03-01 14:33:07.051", 65);
+sql insert into t1 values ("2024-03-01 14:34:07.051", 16);
+sql insert into t2 values ("2024-03-01 14:34:07.051", 26);
+sql insert into t3 values ("2024-03-01 14:34:07.051", 36);
+sql insert into t4 values ("2024-03-01 14:34:07.051", 46);
+sql insert into t5 values ("2024-03-01 14:34:07.051", 56);
+sql insert into t6 values ("2024-03-01 14:34:07.051", 66);
+
+sleep 300
+
+sql select _wstart, count(*) from (select * from stb partition by tbname) interval(2s);
+
+print $data00,$data01
+print $data10,$data11
+print $data20,$data21
+print $data30,$data31
+print $data40,$data41
+print $data50,$data51
+print $data60,$data61
+print $data70,$data71
+
+if $rows != 6 then
+ print $rows
+ return -1
+endi
+
+if $data01 != 6 then
+ print $data01
+endi
+
+if $data11 != 6 then
+ print $data11
+endi
+
+if $data21 != 6 then
+ print $data21
+endi
+
+if $data31 != 6 then
+ print $data31
+endi
+
+if $data41 != 6 then
+ print $data41
+endi
+
+if $data51 != 6 then
+ print $data51
+endi
+
+
+sql select _wstart, count(*) from (select * from stb partition by tbname slimit 2) interval(2s);
+
+print $data00,$data01
+print $data10,$data11
+print $data20,$data21
+print $data30,$data31
+print $data40,$data41
+print $data50,$data51
+print $data60,$data61
+print $data70,$data71
+
+if $rows != 6 then
+ print $rows then
+ return -1
+endi
+
+if $data01 != 2 then
+ print $data01
+endi
+
+if $data11 != 2 then
+ print $data11
+endi
+
+if $data21 != 2 then
+ print $data21
+endi
+
+if $data31 != 2 then
+ print $data31
+endi
+
+if $data41 != 2 then
+ print $data41
+endi
+
+if $data51 != 2 then
+ print $data51
+endi
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/query_count0.sim b/tests/script/tsim/query/query_count0.sim
index b7c629e538..5b95d4fad7 100644
--- a/tests/script/tsim/query/query_count0.sim
+++ b/tests/script/tsim/query/query_count0.sim
@@ -9,8 +9,6 @@ print =============== create database
sql create database test vgroups 1;
sql use test;
-sql alter local 'disableCount' '0' ;
-
sql create table t1(ts timestamp, a int, b int , c int, d double);
sql insert into t1 values(1648791213000,0,1,1,1.0);
diff --git a/tests/script/tsim/query/query_count1.sim b/tests/script/tsim/query/query_count1.sim
index 0c40303e57..043b604263 100644
--- a/tests/script/tsim/query/query_count1.sim
+++ b/tests/script/tsim/query/query_count1.sim
@@ -9,8 +9,6 @@ print =============== create database
sql create database test vgroups 4;
sql use test;
-sql alter local 'disableCount' '0' ;
-
sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(2,2,2);
@@ -81,5 +79,27 @@ if $data22 != 4 then
goto loop3
endi
+
+print step2
+print =============== create database
+sql create database test1 vgroups 1;
+sql use test1;
+
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+#2~INT32_MAX
+sql_error select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(-1);
+sql_error select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(0);
+sql_error select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(1);
+sql_error select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(2147483648);
+sql_error select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(10, 0);
+sql_error select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(10, -1);
+sql_error select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(10, 11);
+
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(2147483647);
+
print query_count0 end
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/query_count_sliding0.sim b/tests/script/tsim/query/query_count_sliding0.sim
index 13a6c94451..464aec6b97 100644
--- a/tests/script/tsim/query/query_count_sliding0.sim
+++ b/tests/script/tsim/query/query_count_sliding0.sim
@@ -9,8 +9,6 @@ print =============== create database
sql create database test vgroups 1;
sql use test;
-sql alter local 'disableCount' '0' ;
-
sql create table t1(ts timestamp, a int, b int , c int, d double);
sql insert into t1 values(1648791213000,0,1,1,1.0);
diff --git a/tests/script/tsim/stream/distributeMultiLevelInterval0.sim b/tests/script/tsim/stream/distributeMultiLevelInterval0.sim
new file mode 100644
index 0000000000..784ab7f4a5
--- /dev/null
+++ b/tests/script/tsim/stream/distributeMultiLevelInterval0.sim
@@ -0,0 +1,267 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+
+system sh/cfg.sh -n dnode1 -c streamAggCnt -v 2
+
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+
+
+print ===== step1
+sql drop stream if exists streams1;
+sql drop database if exists test;
+sql create database test vgroups 4;
+sql use test;
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table ts1 using st tags(1,1,1);
+sql create table ts2 using st tags(2,2,2);
+sql create table ts3 using st tags(3,2,2);
+sql create table ts4 using st tags(4,2,2);
+sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 watermark 1d into streamt1 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4 from st interval(10s);
+
+sleep 1000
+
+sql insert into ts1 values(1648791213000,1,1,3,4.1);
+sql insert into ts1 values(1648791223000,2,2,3,1.1);
+sql insert into ts1 values(1648791233000,3,3,3,2.1);
+sql insert into ts1 values(1648791243000,4,4,3,3.1);
+
+sql insert into ts2 values(1648791213000,1,5,3,4.1);
+sql insert into ts2 values(1648791223000,2,6,3,1.1);
+sql insert into ts2 values(1648791233000,3,7,3,2.1);
+sql insert into ts2 values(1648791243000,4,8,3,3.1);
+
+
+$loop_count = 0
+loop0:
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 1000
+print 2 select * from streamt1;
+sql select * from streamt1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+
+if $rows != 4 then
+ print =====rows=$rows
+ goto loop0
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop0
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop0
+endi
+
+if $data21 != 2 then
+ print =====data21=$data21
+ goto loop0
+endi
+
+if $data31 != 2 then
+ print =====data31=$data31
+ goto loop0
+endi
+
+
+sql insert into ts1 values(1648791213000,1,9,3,4.1);
+
+$loop_count = 0
+loop1:
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 1000
+print 2 select * from streamt1;
+sql select * from streamt1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+
+if $rows != 4 then
+ print =====rows=$rows
+ goto loop1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop1
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop1
+endi
+
+if $data21 != 2 then
+ print =====data21=$data21
+ goto loop1
+endi
+
+if $data31 != 2 then
+ print =====data31=$data31
+ goto loop1
+endi
+
+sql delete from ts2 where ts = 1648791243000 ;
+
+$loop_count = 0
+loop2:
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 1000
+print 2 select * from streamt1;
+sql select * from streamt1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+
+if $rows != 4 then
+ print =====rows=$rows
+ goto loop2
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop2
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop2
+endi
+
+if $data21 != 2 then
+ print =====data21=$data21
+ goto loop2
+endi
+
+if $data31 != 1 then
+ print =====data31=$data31
+ goto loop2
+endi
+
+sql delete from ts2 where ts = 1648791223000 ;
+
+$loop_count = 0
+loop3:
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 1000
+print 2 select * from streamt1;
+sql select * from streamt1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+
+if $rows != 4 then
+ print =====rows=$rows
+ goto loop3
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop3
+endi
+
+if $data11 != 1 then
+ print =====data11=$data11
+ goto loop3
+endi
+
+if $data21 != 2 then
+ print =====data21=$data21
+ goto loop3
+endi
+
+if $data31 != 1 then
+ print =====data31=$data31
+ goto loop3
+endi
+
+
+sql insert into ts1 values(1648791233001,3,9,3,2.1);
+
+$loop_count = 0
+loop4:
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 1000
+print 2 select * from streamt1;
+sql select * from streamt1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+
+if $rows != 4 then
+ print =====rows=$rows
+ goto loop4
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop4
+endi
+
+if $data11 != 1 then
+ print =====data11=$data11
+ goto loop4
+endi
+
+if $data21 != 3 then
+ print =====data21=$data21
+ goto loop4
+endi
+
+if $data31 != 1 then
+ print =====data31=$data31
+ goto loop4
+endi
+
+sql select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5, avg(d) from st interval(10s);
+
+
+print ===== over
+
+system sh/stop_dnodes.sh
diff --git a/tests/script/tsim/stream/pauseAndResume.sim b/tests/script/tsim/stream/pauseAndResume.sim
index 5eb9eef010..be89d8e235 100644
--- a/tests/script/tsim/stream/pauseAndResume.sim
+++ b/tests/script/tsim/stream/pauseAndResume.sim
@@ -8,16 +8,19 @@ sql connect
print ===== step1
sql drop stream if exists streams1;
sql drop database if exists test;
-sql create database test vgroups 10;
+sql create database test vgroups 3;
sql use test;
sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
sql create table ts3 using st tags(3,2,2);
sql create table ts4 using st tags(4,2,2);
+
sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 watermark 1d into streamt1 as select _wstart, count(*) c1, sum(a) c3 from st interval(10s);
sleep 2000
+sql_error create stream stream1_same_dst into streamt1 as select _wstart, count(*) c1, sum(a) c3 from st interval(10s);
+
sql pause stream streams1;
sql insert into ts1 values(1648791213001,1,12,3,1.0);
@@ -102,6 +105,11 @@ if $data11 != 4 then
goto loop1
endi
+print ===== idle for 70 sec for checkpoint gen
+sleep 70000
+
+print ===== idle 60 sec completed , continue
+
print ===== step 1 over
print ===== step2
@@ -113,6 +121,12 @@ sql create table t1(ts timestamp, a int, b int , c int, d double);
sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 watermark 1d into streamt2 as select _wstart, count(*) c1, sum(a) c3 from t1 interval(10s);
+# duplicate stream
+sql_error create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 watermark 1d into streamt2 as select _wstart, count(*) c1, sum(a) c3 from t1 interval(10s);
+sql create stream if not exists streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 watermark 1d into streamt2 as select _wstart, count(*) c1, sum(a) c3 from t1 interval(10s);
+
+sleep 1000
+
sql pause stream streams2;
sql insert into t1 values(1648791213001,1,12,3,1.0);
@@ -237,8 +251,9 @@ print ===== step 2 over
print ===== step3
sql drop stream if exists streams3;
sql drop database if exists test3;
-sql create database test3 vgroups 10;
+sql create database test3 vgroups 3;
sql use test3;
+
sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
diff --git a/tests/script/tsim/stream/state0.sim b/tests/script/tsim/stream/state0.sim
index 0d96d0841b..37081ad1ae 100644
--- a/tests/script/tsim/stream/state0.sim
+++ b/tests/script/tsim/stream/state0.sim
@@ -21,6 +21,8 @@ print create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0
sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a);
+sleep 1000
+
sql insert into t1 values(1648791213000,1,2,3,1.0,1);
sql insert into t1 values(1648791213000,1,2,3,1.0,2);
$loop_count = 0
@@ -457,6 +459,8 @@ print create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0
sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a);
+sleep 1000
+
sql insert into t1 values(1648791212000,2,2,3,1.0,1);
sql insert into t1 values(1648791213000,1,2,3,1.0,1);
sql insert into t1 values(1648791213000,1,2,4,1.0,2);
@@ -504,6 +508,9 @@ sql create table t1(ts timestamp, a int, b int , c int, d double, id int);
print create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a);
sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a);
+
+sleep 1000
+
sql insert into t1 values(1648791212000,1,2,3,1.0,1);
sql insert into t1 values(1648791213000,2,2,3,1.0,1);
sql insert into t1 values(1648791214000,3,2,4,1.0,2);
@@ -557,6 +564,8 @@ print create stream if not exists streams4 trigger window_close IGNORE EXPIRED 0
sql create stream if not exists streams4 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1);
+sleep 1000
+
sql insert into t1 (ts, c1) values (1668073288209, 11);
sql insert into t1 (ts, c1) values (1668073288210, 11);
sql insert into t1 (ts, c1) values (1668073288211, 11);
@@ -745,6 +754,9 @@ sql create table b (c timestamp, d int, e int , f int, g double);
print create stream streams0 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a);
sql create stream streams0 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a);
+
+sleep 1000
+
sql insert into b values(1648791213000,NULL,NULL,NULL,NULL);
sql select * from streamt order by c1, c2, c3;
diff --git a/tests/system-test/0-others/com_alltypedata.json b/tests/system-test/0-others/com_alltypedata.json
index 0e6d8e3a07..1499ca7670 100644
--- a/tests/system-test/0-others/com_alltypedata.json
+++ b/tests/system-test/0-others/com_alltypedata.json
@@ -22,7 +22,7 @@
"vgroups": 2,
"replica": 1,
"precision": "ms",
- "stt_trigger": 8,
+ "stt_trigger": 1,
"minRows": 100,
"maxRows": 4096
},
diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py
index c936cf1ae4..8163177a3b 100644
--- a/tests/system-test/0-others/compatibility.py
+++ b/tests/system-test/0-others/compatibility.py
@@ -1,11 +1,13 @@
from urllib.parse import uses_relative
import taos
+import taosws
import sys
import os
import time
import platform
import inspect
from taos.tmq import Consumer
+from taos.tmq import *
from pathlib import Path
from util.log import *
@@ -17,7 +19,7 @@ from util.dnodes import TDDnode
from util.cluster import *
import subprocess
-BASEVERSION = "3.0.2.3"
+BASEVERSION = "3.2.0.0"
class TDTestCase:
def caseDescription(self):
f'''
@@ -30,7 +32,7 @@ class TDTestCase:
self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor())
- self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 300 stt_trigger 4; ;use deldata;
+ self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 300 stt_trigger 1; ;use deldata;
create table deldata.stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int);
create table deldata.ct1 using deldata.stb1 tags ( 1 );
insert into deldata.ct1 values ( now()-0s, 0, 0, 0, 0, 0.0, 0.0, 0, 'binary0', 'nchar0', now()+0a ) ( now()-10s, 1, 11111, 111, 11, 1.11, 11.11, 1, 'binary1', 'nchar1', now()+1a ) ( now()-20s, 2, 22222, 222, 22, 2.22, 22.22, 0, 'binary2', 'nchar2', now()+2a ) ( now()-30s, 3, 33333, 333, 33, 3.33, 33.33, 1, 'binary3', 'nchar3', now()+3a );
@@ -104,8 +106,19 @@ class TDTestCase:
print(f"{packageName} has been exists")
os.system(f" cd {packagePath} && tar xvf {packageName} && cd {packageTPath} && ./install.sh -e no " )
tdDnodes.stop(1)
- print(f"start taosd: rm -rf {dataPath}/* && nohup taosd -c {cPath} & ")
- os.system(f"rm -rf {dataPath}/* && nohup taosd -c {cPath} & " )
+ print(f"start taosd: rm -rf {dataPath}/* && nohup /usr/bin/taosd -c {cPath} & ")
+ os.system(f"rm -rf {dataPath}/* && nohup /usr/bin/taosd -c {cPath} & " )
+ os.system(f"killall taosadapter" )
+ os.system(f"cp /etc/taos/taosadapter.toml {cPath}/taosadapter.toml " )
+ taosadapter_cfg = cPath + "/taosadapter.toml"
+ taosadapter_log_path = cPath + "/../log/"
+ print(f"taosadapter_cfg:{taosadapter_cfg},taosadapter_log_path:{taosadapter_log_path} ")
+ self.alter_string_in_file(taosadapter_cfg,"#path = \"/var/log/taos\"",f"path = \"{taosadapter_log_path}\"")
+ self.alter_string_in_file(taosadapter_cfg,"taosConfigDir = \"\"",f"taosConfigDir = \"{cPath}\"")
+ print("/usr/bin/taosadapter --version")
+ os.system(f" /usr/bin/taosadapter --version" )
+ print(f" LD_LIBRARY_PATH=/usr/lib -c {taosadapter_cfg} 2>&1 & ")
+ os.system(f" LD_LIBRARY_PATH=/usr/lib /usr/bin/taosadapter -c {taosadapter_cfg} 2>&1 & " )
sleep(5)
@@ -116,7 +129,24 @@ class TDTestCase:
def is_list_same_as_ordered_list(self,unordered_list, ordered_list):
sorted_list = sorted(unordered_list)
return sorted_list == ordered_list
-
+
+ def alter_string_in_file(self,file,old_str,new_str):
+ """
+ replace str in file
+ :param file
+ :param old_str
+ :param new_str
+ :return:
+ """
+ file_data = ""
+ with open(file, "r", encoding="utf-8") as f:
+ for line in f:
+ if old_str in line:
+ line = line.replace(old_str,new_str)
+ file_data += line
+ with open(file,"w",encoding="utf-8") as f:
+ f.write(file_data)
+
def run(self):
scriptsPath = os.path.dirname(os.path.realpath(__file__))
distro_id = distro.id()
@@ -131,7 +161,7 @@ class TDTestCase:
dbname = "test"
stb = f"{dbname}.meters"
self.installTaosd(bPath,cPath)
- os.system("echo 'debugFlag 143' > /etc/taos/taos.cfg ")
+ # os.system(f"echo 'debugFlag 143' >> {cPath}/taos.cfg ")
tableNumbers=100
recordNumbers1=100
recordNumbers2=1000
@@ -163,11 +193,46 @@ class TDTestCase:
# os.system(f"LD_LIBRARY_PATH=/usr/lib taos -s 'use test;create stream current_stream into current_stream_output_stb as select _wstart as `start`, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);' ")
# os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;create stream power_stream into power_stream_output_stb as select ts, concat_ws(\\".\\", location, tbname) as meter_location, current*voltage*cos(phase) as active_power, current*voltage*sin(phase) as reactive_power from meters partition by tbname;" ')
# os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show streams;" ')
- os.system(f"sed -i 's/\/etc\/taos/{cPath}/' 0-others/tmqBasic.json ")
+ self.alter_string_in_file("0-others/tmqBasic.json", "/etc/taos/", cPath)
# os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/tmqBasic.json -y ")
os.system('LD_LIBRARY_PATH=/usr/lib taos -s "create topic if not exists tmq_test_topic as select current,voltage,phase from test.meters where voltage <= 106 and current <= 5;" ')
os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show topics;" ')
+ os.system(f" /usr/bin/taosadapter --version " )
+ consumer_dict = {
+ "group.id": "g1",
+ "td.connect.user": "root",
+ "td.connect.pass": "taosdata",
+ "auto.offset.reset": "earliest",
+ }
+ consumer = taosws.Consumer(conf={"group.id": "local", "td.connect.websocket.scheme": "ws"})
+ try:
+ consumer.subscribe(["tmq_test_topic"])
+ except TmqError:
+ tdLog.exit(f"subscribe error")
+
+ while True:
+ message = consumer.poll(timeout=1.0)
+ if message:
+ print("message")
+ id = message.vgroup()
+ topic = message.topic()
+ database = message.database()
+
+ for block in message:
+ nrows = block.nrows()
+ ncols = block.ncols()
+ for row in block:
+ print(row)
+ values = block.fetchall()
+ print(nrows, ncols)
+
+ consumer.commit(message)
+ else:
+ print("break")
+ break
+
+ consumer.close()
tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ")
os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y")
os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database db4096 '")
@@ -184,7 +249,8 @@ class TDTestCase:
os.system("pkill taosd") # make sure all the data are saved in disk.
self.checkProcessPid("taosd")
-
+ os.system("pkill taosadapter") # make sure all the data are saved in disk.
+ self.checkProcessPid("taosadapter")
tdLog.printNoPrefix("==========step2:update new version ")
self.buildTaosd(bPath)
@@ -193,6 +259,7 @@ class TDTestCase:
tdsql=tdCom.newTdSql()
print(tdsql)
cmd = f" LD_LIBRARY_PATH=/usr/lib taos -h localhost ;"
+ print(os.system(cmd))
if os.system(cmd) == 0:
raise Exception("failed to execute system command. cmd: %s" % cmd)
diff --git a/tests/system-test/7-tmq/tmqParamsTest.py b/tests/system-test/7-tmq/tmqParamsTest.py
index 82a5d42b47..b25f23ef11 100644
--- a/tests/system-test/7-tmq/tmqParamsTest.py
+++ b/tests/system-test/7-tmq/tmqParamsTest.py
@@ -164,7 +164,7 @@ class TDTestCase:
offset_value_list = list(map(lambda x: (x[-2].replace("wal:", "").replace("earliest", "0").replace("latest", "0").replace(offset_value, "0")), subscription_info))
offset_value_list1 = list(map(lambda x: int(x.split("/")[0]), offset_value_list))
offset_value_list2 = list(map(lambda x: int(x.split("/")[1]), offset_value_list))
- tdSql.checkEqual(offset_value_list1 == offset_value_list2, True)
+ tdSql.checkEqual(offset_value_list1 <= offset_value_list2, True)
tdSql.checkEqual(sum(offset_value_list1) >= 0, True)
rows_value_list = list(map(lambda x: int(x[-1]), subscription_info))
tdSql.checkEqual(sum(rows_value_list), expected_res)
@@ -187,4 +187,4 @@ class TDTestCase:
event = threading.Event()
tdCases.addLinux(__file__, TDTestCase())
-tdCases.addWindows(__file__, TDTestCase())
\ No newline at end of file
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/7-tmq/tmqVnodeTransform.py b/tests/system-test/7-tmq/tmqVnodeTransform-db-removewal.py
similarity index 78%
rename from tests/system-test/7-tmq/tmqVnodeTransform.py
rename to tests/system-test/7-tmq/tmqVnodeTransform-db-removewal.py
index c2b002ead6..a853489c3f 100644
--- a/tests/system-test/7-tmq/tmqVnodeTransform.py
+++ b/tests/system-test/7-tmq/tmqVnodeTransform-db-removewal.py
@@ -122,135 +122,7 @@ class TDTestCase:
tdLog.debug(f"redistributeSql:{redistributeSql}")
tdSql.query(redistributeSql)
tdLog.debug("redistributeSql ok")
-
- def tmqCase1(self):
- tdLog.printNoPrefix("======== test case 1: ")
- paraDict = {'dbName': 'dbt',
- 'dropFlag': 1,
- 'event': '',
- 'vgroups': 1,
- 'stbName': 'stb',
- 'colPrefix': 'c',
- 'tagPrefix': 't',
- 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
- 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
- 'ctbPrefix': 'ctb',
- 'ctbStartIdx': 0,
- 'ctbNum': 10,
- 'rowsPerTbl': 1000,
- 'batchNum': 10,
- 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
- 'pollDelay': 60,
- 'showMsg': 1,
- 'showRow': 1,
- 'snapshot': 0}
-
- paraDict['vgroups'] = self.vgroups
- paraDict['ctbNum'] = self.ctbNum
- paraDict['rowsPerTbl'] = self.rowsPerTbl
-
- topicNameList = ['topic1']
- # expectRowsList = []
- tmqCom.initConsumerTable()
-
- tdLog.info("create topics from stb with filter")
- queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName'])
- # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName'])
- sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
- tdLog.info("create topic sql: %s"%sqlString)
- tdSql.execute(sqlString)
- # tdSql.query(queryString)
- # expectRowsList.append(tdSql.getRows())
-
- # init consume info, and start tmq_sim, then check consume result
- tdLog.info("insert consume info to consume processor")
- consumerId = 0
- expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2
- topicList = topicNameList[0]
- ifcheckdata = 1
- ifManualCommit = 1
- keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
- tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
-
- tdLog.info("start consume processor")
- tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
- tdLog.info("wait the consume result")
-
- tdLog.info("create ctb1")
- tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
- ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
- tdLog.info("insert data")
- pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict)
-
- tmqCom.getStartConsumeNotifyFromTmqsim()
- tmqCom.getStartCommitNotifyFromTmqsim()
-
- #restart dnode & remove wal
- self.restartAndRemoveWal()
-
- # redistribute vgroup
- self.redistributeVgroups();
-
- tdLog.info("create ctb2")
- paraDict['ctbPrefix'] = "ctbn"
- tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
- ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
- tdLog.info("insert data")
- pInsertThread1 = tmqCom.asyncInsertDataByInterlace(paraDict)
- pInsertThread.join()
- pInsertThread1.join()
-
- expectRows = 1
- resultList = tmqCom.selectConsumeResult(expectRows)
-
- if expectrowcnt / 2 > resultList[0]:
- tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt / 2, resultList[0]))
- tdLog.exit("%d tmq consume rows error!"%consumerId)
-
- # tmqCom.checkFileContent(consumerId, queryString)
-
- time.sleep(10)
- for i in range(len(topicNameList)):
- tdSql.query("drop topic %s"%topicNameList[i])
-
- tdLog.printNoPrefix("======== test case 1 end ...... ")
-
- def tmqCase2(self):
- tdLog.printNoPrefix("======== test case 2: ")
- paraDict = {'dbName':'dbt'}
-
- ntbName = "ntb"
-
- topicNameList = ['topic2']
- tmqCom.initConsumerTable()
-
- sqlString = "create table %s.%s(ts timestamp, i nchar(8))" %(paraDict['dbName'], ntbName)
- tdLog.info("create nomal table sql: %s"%sqlString)
- tdSql.execute(sqlString)
-
- tdLog.info("create topics from nomal table")
- queryString = "select * from %s.%s"%(paraDict['dbName'], ntbName)
- sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
- tdLog.info("create topic sql: %s"%sqlString)
- tdSql.execute(sqlString)
- tdSql.query("flush database %s"%(paraDict['dbName']))
- #restart dnode & remove wal
- self.restartAndRemoveWal()
-
- # redistribute vgroup
- self.redistributeVgroups();
-
- sqlString = "alter table %s.%s modify column i nchar(16)" %(paraDict['dbName'], ntbName)
- tdLog.info("alter table sql: %s"%sqlString)
- tdSql.error(sqlString)
- expectRows = 0
- resultList = tmqCom.selectConsumeResult(expectRows)
- time.sleep(1)
- for i in range(len(topicNameList)):
- tdSql.query("drop topic %s"%topicNameList[i])
-
- tdLog.printNoPrefix("======== test case 2 end ...... ")
-
+
def tmqCase3(self):
tdLog.printNoPrefix("======== test case 3: ")
paraDict = {'dbName': 'dbt',
@@ -330,12 +202,90 @@ class TDTestCase:
tdLog.printNoPrefix("======== test case 3 end ...... ")
+ def tmqCaseDbname(self):
+ tdLog.printNoPrefix("======== test case 4 subscrib Dbname start: ")
+ paraDict = {'dbName': 'dbt',
+ 'dropFlag': 1,
+ 'event': '',
+ 'vgroups': 1,
+ 'stbName': 'stbn',
+ 'colPrefix': 'c',
+ 'tagPrefix': 't',
+ 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
+ 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
+ 'ctbPrefix': 'ctb',
+ 'ctbStartIdx': 0,
+ 'ctbNum': 10,
+ 'rowsPerTbl': 1000,
+ 'batchNum': 10,
+ 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
+ 'pollDelay': 10,
+ 'showMsg': 1,
+ 'showRow': 1,
+ 'snapshot': 0}
+
+ paraDict['vgroups'] = self.vgroups
+ paraDict['ctbNum'] = self.ctbNum
+ paraDict['rowsPerTbl'] = self.rowsPerTbl
+
+ topicNameList = ['topic4']
+ tmqCom.initConsumerTable()
+
+ tdLog.info("create stb")
+ tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
+
+ tdLog.info("create ctb")
+ tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
+ ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
+ tdLog.info("insert data")
+ tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],
+ ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
+ startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
+
+ tdLog.info("create topics from database ")
+ queryString = "database %s "%(paraDict['dbName'])
+ sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
+ tdLog.info("create topic sql: %s"%sqlString)
+ tdSql.execute(sqlString)
+
+ # init consume info, and start tmq_sim, then check consume result
+ tdLog.info("insert consume info to consume processor")
+ consumerId = 0
+ expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"]
+ topicList = topicNameList[0]
+ ifcheckdata = 1
+ ifManualCommit = 1
+ keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
+ tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
+
+ tdLog.info("start consume processor")
+ tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
+ tdLog.info("wait the consume result")
+
+ time.sleep(1)
+ # restart dnode & remove wal
+ self.restartAndRemoveWal()
+
+ # redistribute vgroup
+ self.redistributeVgroups()
+
+ tdLog.info("start consume processor")
+ tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
+ tdLog.info("wait the consume result")
+ expectRows = 2
+ resultList = tmqCom.selectConsumeResult(expectRows)
+
+ time.sleep(6)
+ for i in range(len(topicNameList)):
+ tdSql.query("drop topic %s"%topicNameList[i])
+
+ tdLog.printNoPrefix("======== test case 4 subscrib Dbname end ...... ")
+
def run(self):
- self.prepareTestEnv()
- self.tmqCase1()
- self.tmqCase2()
self.prepareTestEnv()
self.tmqCase3()
+ self.prepareTestEnv()
+ self.tmqCaseDbname()
def stop(self):
tdSql.close()
diff --git a/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py b/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py
new file mode 100644
index 0000000000..40879d5c66
--- /dev/null
+++ b/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py
@@ -0,0 +1,266 @@
+
+import taos
+import sys
+import time
+import socket
+import os
+import threading
+import math
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+from util.dnodes import *
+from util.common import *
+from util.cluster import *
+sys.path.append("./7-tmq")
+from tmqCommon import *
+
+class TDTestCase:
+ def __init__(self):
+ self.vgroups = 1
+ self.ctbNum = 10
+ self.rowsPerTbl = 1000
+
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor(), True)
+
+ def getDataPath(self):
+ selfPath = tdCom.getBuildPath()
+
+ return selfPath + '/../sim/dnode%d/data/vnode/vnode%d/wal/*';
+
+ def prepareTestEnv(self):
+ tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
+ paraDict = {'dbName': 'dbt',
+ 'dropFlag': 1,
+ 'event': '',
+ 'vgroups': 1,
+ 'stbName': 'stb',
+ 'colPrefix': 'c',
+ 'tagPrefix': 't',
+ 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
+ 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
+ 'ctbPrefix': 'ctb',
+ 'ctbStartIdx': 0,
+ 'ctbNum': 10,
+ 'rowsPerTbl': 1000,
+ 'batchNum': 10,
+ 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
+ 'pollDelay': 60,
+ 'showMsg': 1,
+ 'showRow': 1,
+ 'snapshot': 0}
+
+ paraDict['vgroups'] = self.vgroups
+ paraDict['ctbNum'] = self.ctbNum
+ paraDict['rowsPerTbl'] = self.rowsPerTbl
+
+ tdCom.drop_all_db()
+ tmqCom.initConsumerTable()
+ tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], wal_retention_period=36000,vgroups=paraDict["vgroups"],replica=self.replicaVar)
+ tdLog.info("create stb")
+ tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
+ # tdLog.info("create ctb")
+ # tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
+ # ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
+ # tdLog.info("insert data")
+ # tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],
+ # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
+ # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
+
+ # tdLog.info("restart taosd to ensure that the data falls into the disk")
+ # tdDnodes.stop(1)
+ # tdDnodes.start(1)
+ # tdSql.query("flush database %s"%(paraDict['dbName']))
+ return
+
+ def restartAndRemoveWal(self):
+ tdDnodes = cluster.dnodes
+ tdSql.query("select * from information_schema.ins_vnodes")
+ for result in tdSql.queryResult:
+ if result[2] == 'dbt':
+ tdLog.debug("dnode is %d"%(result[0]))
+ dnodeId = result[0]
+ vnodeId = result[1]
+
+ tdDnodes[dnodeId - 1].stoptaosd()
+ time.sleep(1)
+ dataPath = self.getDataPath()
+ dataPath = dataPath%(dnodeId,vnodeId)
+ os.system('rm -rf ' + dataPath)
+ tdLog.debug("dataPath:%s"%dataPath)
+ tdDnodes[dnodeId - 1].starttaosd()
+ time.sleep(1)
+ break
+ tdLog.debug("restart dnode ok")
+
+ def redistributeVgroups(self):
+ dnodesList = []
+ tdSql.query("show dnodes")
+ for result in tdSql.queryResult:
+ dnodesList.append(result[0])
+ print("dnodeList:",dnodesList)
+ tdSql.query("select * from information_schema.ins_vnodes")
+ vnodeId = 0
+ for result in tdSql.queryResult:
+ if result[2] == 'dbt':
+ tdLog.debug("dnode is %d"%(result[0]))
+ dnodesList.remove(result[0])
+ vnodeId = result[1]
+ print("its all data",dnodesList)
+ # if self.replicaVar == 1:
+ # redistributeSql = "redistribute vgroup %d dnode %d" %(vnodeId, dnodesList[0])
+ # else:
+ redistributeSql = f"redistribute vgroup {vnodeId} "
+ for vgdnode in dnodesList:
+ redistributeSql += f"dnode {vgdnode} "
+ print(redistributeSql)
+
+ tdLog.debug(f"redistributeSql:{redistributeSql}")
+ tdSql.query(redistributeSql)
+ tdLog.debug("redistributeSql ok")
+
+ def tmqCase1(self):
+ tdLog.printNoPrefix("======== test case 1: ")
+ paraDict = {'dbName': 'dbt',
+ 'dropFlag': 1,
+ 'event': '',
+ 'vgroups': 1,
+ 'stbName': 'stb',
+ 'colPrefix': 'c',
+ 'tagPrefix': 't',
+ 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
+ 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
+ 'ctbPrefix': 'ctb',
+ 'ctbStartIdx': 0,
+ 'ctbNum': 10,
+ 'rowsPerTbl': 1000,
+ 'batchNum': 10,
+ 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
+ 'pollDelay': 60,
+ 'showMsg': 1,
+ 'showRow': 1,
+ 'snapshot': 0}
+
+ paraDict['vgroups'] = self.vgroups
+ paraDict['ctbNum'] = self.ctbNum
+ paraDict['rowsPerTbl'] = self.rowsPerTbl
+
+ topicNameList = ['topic1']
+ # expectRowsList = []
+ tmqCom.initConsumerTable()
+
+ tdLog.info("create topics from stb with filter")
+ queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName'])
+ # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName'])
+ sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
+ tdLog.info("create topic sql: %s"%sqlString)
+ tdSql.execute(sqlString)
+ # tdSql.query(queryString)
+ # expectRowsList.append(tdSql.getRows())
+
+ # init consume info, and start tmq_sim, then check consume result
+ tdLog.info("insert consume info to consume processor")
+ consumerId = 0
+ expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2
+ topicList = topicNameList[0]
+ ifcheckdata = 1
+ ifManualCommit = 1
+ keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
+ tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
+
+ tdLog.info("start consume processor")
+ tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
+ tdLog.info("wait the consume result")
+
+ tdLog.info("create ctb1")
+ tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
+ ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
+ tdLog.info("insert data")
+ pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict)
+
+ tmqCom.getStartConsumeNotifyFromTmqsim()
+ tmqCom.getStartCommitNotifyFromTmqsim()
+
+ #restart dnode & remove wal
+ self.restartAndRemoveWal()
+
+ # redistribute vgroup
+ self.redistributeVgroups();
+
+ tdLog.info("create ctb2")
+ paraDict['ctbPrefix'] = "ctbn"
+ tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
+ ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
+ tdLog.info("insert data")
+ pInsertThread1 = tmqCom.asyncInsertDataByInterlace(paraDict)
+ pInsertThread.join()
+ pInsertThread1.join()
+
+ expectRows = 1
+ resultList = tmqCom.selectConsumeResult(expectRows)
+
+ if expectrowcnt / 2 > resultList[0]:
+ tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt / 2, resultList[0]))
+ tdLog.exit("%d tmq consume rows error!"%consumerId)
+
+ # tmqCom.checkFileContent(consumerId, queryString)
+
+ time.sleep(10)
+ for i in range(len(topicNameList)):
+ tdSql.query("drop topic %s"%topicNameList[i])
+
+ tdLog.printNoPrefix("======== test case 1 end ...... ")
+
+ def tmqCase2(self):
+ tdLog.printNoPrefix("======== test case 2: ")
+ paraDict = {'dbName':'dbt'}
+
+ ntbName = "ntb"
+
+ topicNameList = ['topic2']
+ tmqCom.initConsumerTable()
+
+ sqlString = "create table %s.%s(ts timestamp, i nchar(8))" %(paraDict['dbName'], ntbName)
+ tdLog.info("create nomal table sql: %s"%sqlString)
+ tdSql.execute(sqlString)
+
+ tdLog.info("create topics from nomal table")
+ queryString = "select * from %s.%s"%(paraDict['dbName'], ntbName)
+ sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
+ tdLog.info("create topic sql: %s"%sqlString)
+ tdSql.execute(sqlString)
+ tdSql.query("flush database %s"%(paraDict['dbName']))
+ #restart dnode & remove wal
+ self.restartAndRemoveWal()
+
+ # redistribute vgroup
+ self.redistributeVgroups();
+
+ sqlString = "alter table %s.%s modify column i nchar(16)" %(paraDict['dbName'], ntbName)
+ tdLog.info("alter table sql: %s"%sqlString)
+ tdSql.error(sqlString)
+ expectRows = 0
+ resultList = tmqCom.selectConsumeResult(expectRows)
+ time.sleep(1)
+ for i in range(len(topicNameList)):
+ tdSql.query("drop topic %s"%topicNameList[i])
+
+ tdLog.printNoPrefix("======== test case 2 end ...... ")
+
+ def run(self):
+ self.prepareTestEnv()
+ self.tmqCase1()
+ self.tmqCase2()
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+event = threading.Event()
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py
index c547385d70..0330454b73 100644
--- a/tests/system-test/7-tmq/tmq_taosx.py
+++ b/tests/system-test/7-tmq/tmq_taosx.py
@@ -359,8 +359,101 @@ class TDTestCase:
finally:
consumer.close()
+ def consume_TS_4540_Test(self):
+ tdSql.execute(f'create database if not exists test')
+ tdSql.execute(f'use test')
+ tdSql.execute(f'CREATE STABLE `test`.`b` ( `time` TIMESTAMP , `task_id` NCHAR(1000) ) TAGS( `key` NCHAR(1000))')
+ tdSql.execute(f"insert into `test`.b1 using `test`.`b`(`key`) tags('1') (time, task_id) values ('2024-03-04 12:50:01.000', '32') `test`.b2 using `test`.`b`(`key`) tags('2') (time, task_id) values ('2024-03-04 12:50:01.000', '43') `test`.b3 using `test`.`b`(`key`) tags('3') (time, task_id) values ('2024-03-04 12:50:01.000', '123456')")
+
+ tdSql.execute(f'create topic tt as select tbname,task_id,`key` from b')
+
+ consumer_dict = {
+ "group.id": "g1",
+ "td.connect.user": "root",
+ "td.connect.pass": "taosdata",
+ "auto.offset.reset": "earliest",
+ }
+ consumer = Consumer(consumer_dict)
+
+ try:
+ consumer.subscribe(["tt"])
+ except TmqError:
+ tdLog.exit(f"subscribe error")
+
+ try:
+ while True:
+ res = consumer.poll(1)
+ if not res:
+ break
+ val = res.value()
+ if val is None:
+ continue
+ for block in val:
+ data = block.fetchall()
+ print(data)
+ if data != [('b1', '32', '1')] and data != [('b2', '43', '2')] and data != [('b3', '123456', '3')]:
+ tdLog.exit(f"index = 0 table b1 error")
+
+ finally:
+ consumer.close()
+
+ def consume_ts_4544(self):
+ tdSql.execute(f'create database if not exists d1')
+ tdSql.execute(f'use d1')
+ tdSql.execute(f'create table stt(ts timestamp, i int) tags(t int)')
+ tdSql.execute(f'insert into tt1 using stt tags(1) values(now, 1) (now+1s, 2)')
+ tdSql.execute(f'insert into tt2 using stt tags(2) values(now, 1) (now+1s, 2)')
+ tdSql.execute(f'insert into tt3 using stt tags(3) values(now, 1) (now+1s, 2)')
+ tdSql.execute(f'insert into tt1 using stt tags(1) values(now+5s, 11) (now+10s, 12)')
+
+ tdSql.execute(f'create topic topic_in as select * from stt where tbname in ("tt2")')
+
+ consumer_dict = {
+ "group.id": "g1",
+ "td.connect.user": "root",
+ "td.connect.pass": "taosdata",
+ "auto.offset.reset": "earliest",
+ }
+ consumer = Consumer(consumer_dict)
+
+ try:
+ consumer.subscribe(["topic_in"])
+ except TmqError:
+ tdLog.exit(f"subscribe error")
+
+ consumer.close()
+
+ def consume_ts_4551(self):
+ tdSql.execute(f'use d1')
+
+ tdSql.execute(f'create topic topic_stable as stable stt where tbname like "t%"')
+ consumer_dict = {
+ "group.id": "g1",
+ "td.connect.user": "root",
+ "td.connect.pass": "taosdata",
+ "auto.offset.reset": "earliest",
+ }
+ consumer = Consumer(consumer_dict)
+
+ try:
+ consumer.subscribe(["topic_stable"])
+ except TmqError:
+ tdLog.exit(f"subscribe error")
+
+ try:
+ while True:
+ res = consumer.poll(1)
+ if not res:
+ break
+ finally:
+ consumer.close()
+ print("consume_ts_4551 ok")
+
def run(self):
self.consumeTest()
+ self.consume_ts_4544()
+ self.consume_ts_4551()
+ self.consume_TS_4540_Test()
tdSql.prepare()
self.checkWal1VgroupOnlyMeta()
diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c
index 23424cea98..995d3d04ec 100644
--- a/tools/shell/src/shellEngine.c
+++ b/tools/shell/src/shellEngine.c
@@ -75,7 +75,7 @@ bool shellIsEmptyCommand(const char *cmd) {
int32_t shellRunSingleCommand(char *command) {
shellCmdkilled = false;
-
+
if (shellIsEmptyCommand(command)) {
return 0;
}
@@ -1019,7 +1019,7 @@ void shellReadHistory() {
char *line = taosMemoryMalloc(TSDB_MAX_ALLOWED_SQL_LEN + 1);
int32_t read_size = 0;
- while ((read_size = taosGetsFile(pFile, TSDB_MAX_ALLOWED_SQL_LEN, line)) != -1) {
+ while ((read_size = taosGetsFile(pFile, TSDB_MAX_ALLOWED_SQL_LEN, line)) > 0) {
line[read_size - 1] = '\0';
taosMemoryFree(pHistory->hist[pHistory->hend]);
pHistory->hist[pHistory->hend] = taosStrdup(line);
@@ -1315,7 +1315,7 @@ int32_t shellExecute() {
shellSetConn(shell.conn, runOnce);
shellReadHistory();
- if(shell.args.is_bi_mode) {
+ if(shell.args.is_bi_mode) {
// need set bi mode
printf("Set BI mode is true.\n");
#ifndef WEBSOCKET
diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c
index 2c334eb67b..01619decc5 100644
--- a/utils/test/c/sml_test.c
+++ b/utils/test/c/sml_test.c
@@ -1018,7 +1018,7 @@ int sml_escape_Test() {
ASSERT(numFields == 5);
ASSERT(strncmp(fields[1].name, "inode\"i,= s_used", sizeof("inode\"i,= s_used") - 1) == 0);
ASSERT(strncmp(fields[2].name, "total", sizeof("total") - 1) == 0);
- ASSERT(strncmp(fields[3].name, "inode\"i,= s_f\\\\ree", sizeof("inode\"i,= s_f\\\\ree") - 1) == 0);
+ ASSERT(strncmp(fields[3].name, "inode\"i,= s_f\\ree", sizeof("inode\"i,= s_f\\ree") - 1) == 0);
ASSERT(strncmp(fields[4].name, "dev\"i,= ce", sizeof("dev\"i,= ce") - 1) == 0);
TAOS_ROW row = NULL;
@@ -1044,6 +1044,88 @@ int sml_escape_Test() {
return code;
}
+// test field with end of escape
+int sml_escape1_Test() {
+ TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
+
+ TAOS_RES *pRes = taos_query(taos, "create database if not exists db_escape");
+ taos_free_result(pRes);
+
+ pRes = taos_query(taos, "use db_escape");
+ taos_free_result(pRes);
+
+ const char *sql[] = {
+ "stab,t1\\=1 c1=3,c2=\"32fw\" 1661943970000000000",
+ "stab,t1=1\\ c1=3,c2=\"32fw\" 1661943980000000000",
+ "stab,t1=1 c1\\=3,c2=\"32fw\" 1661943990000000000",
+ };
+ for(int i = 0; i < sizeof(sql) / sizeof(sql[0]); i++){
+ pRes = taos_schemaless_insert(taos, (char**)&sql[i], 1, TSDB_SML_LINE_PROTOCOL, 0);
+ int code = taos_errno(pRes);
+ ASSERT(code);
+ }
+
+ const char *sql1[] = {
+ "stab\\,t1=1 c1=3,c2=\"32fw\" 1661943960000000000",
+ "stab\\\\,t1=1 c1=3,c2=\"32fw\" 1661943960000000000",
+ "stab,t1\\\\=1 c1=3,c2=\"32fw\" 1661943970000000000",
+ "stab,t1=1\\\\ c1=3,c2=\"32fw\" 1661943980000000000",
+ "stab,t1=1 c1\\\\=3,c2=\"32fw\" 1661943990000000000",
+ };
+ pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, 0);
+ printf("%s result:%s, rows:%d\n", __FUNCTION__, taos_errstr(pRes), taos_affected_rows(pRes));
+ int code = taos_errno(pRes);
+ ASSERT(!code);
+ ASSERT(taos_affected_rows(pRes) == 5);
+ taos_free_result(pRes);
+
+ pRes = taos_query(taos, "select * from stab"); //check stable name
+ ASSERT(pRes);
+ int fieldNum = taos_field_count(pRes);
+ ASSERT(fieldNum == 6);
+ printf("fieldNum:%d\n", fieldNum);
+
+ int numFields = taos_num_fields(pRes);
+ TAOS_FIELD *fields = taos_fetch_fields(pRes);
+ ASSERT(numFields == 6);
+ ASSERT(strncmp(fields[1].name, "c1", sizeof("c1") - 1) == 0);
+ ASSERT(strncmp(fields[2].name, "c2", sizeof("c2") - 1) == 0);
+ ASSERT(strncmp(fields[3].name, "c1\\", sizeof("c1\\") - 1) == 0);
+ ASSERT(strncmp(fields[4].name, "t1\\", sizeof("t1\\") - 1) == 0);
+ ASSERT(strncmp(fields[5].name, "t1", sizeof("t1") - 1) == 0);
+
+ TAOS_ROW row = NULL;
+ int32_t rowIndex = 0;
+ while ((row = taos_fetch_row(pRes)) != NULL) {
+ int64_t ts = *(int64_t *)row[0];
+
+ if (ts == 1661943970000) {
+ ASSERT(*(double *)row[1] == 3);
+ ASSERT(strncmp(row[2], "32fw", sizeof("32fw") - 1) == 0);
+ ASSERT(row[3] == NULL);
+ ASSERT(strncmp(row[4], "1", sizeof("1") - 1) == 0);
+ ASSERT(row[5] == NULL);
+ }else if (ts == 1661943980000) {
+ ASSERT(*(double *)row[1] == 3);
+ ASSERT(strncmp(row[2], "32fw", sizeof("32fw") - 1) == 0);
+ ASSERT(row[3] == NULL);
+ ASSERT(row[4] == NULL);
+ ASSERT(strncmp(row[5], "1\\", sizeof("1\\") - 1) == 0);
+ }else if (ts == 1661943990000) {
+ ASSERT(row[1] == NULL);
+ ASSERT(strncmp(row[2], "32fw", sizeof("32fw") - 1) == 0);
+ ASSERT(*(double *)row[3] == 3);
+ ASSERT(row[4] == NULL);
+ ASSERT(strncmp(row[5], "1", sizeof("1") - 1) == 0);
+ }
+ rowIndex++;
+ }
+ taos_free_result(pRes);
+ taos_close(taos);
+
+ return code;
+}
+
int sml_19221_Test() {
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
@@ -1775,17 +1857,14 @@ int main(int argc, char *argv[]) {
ASSERT(ret);
ret = sml_escape_Test();
ASSERT(!ret);
+ ret = sml_escape1_Test();
+ ASSERT(!ret);
ret = sml_ts3116_Test();
ASSERT(!ret);
ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file
ASSERT(!ret);
ret = sml_ts3303_Test();
ASSERT(!ret);
-
- // for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){
- // printf("str:%s \t %d\n", str[i], smlCalTypeSum(str[i], strlen(str[i])));
- // }
- // int ret = 0;
ret = sml_ttl_Test();
ASSERT(!ret);
ret = sml_ts2164_Test();
diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c
index 2257089f06..5012e50bab 100644
--- a/utils/test/c/tmq_taosx_ci.c
+++ b/utils/test/c/tmq_taosx_ci.c
@@ -574,6 +574,7 @@ tmq_t* build_consumer() {
tmq_conf_set(conf, "msg.with.table.name", "true");
tmq_conf_set(conf, "enable.auto.commit", "true");
tmq_conf_set(conf, "auto.offset.reset", "earliest");
+ tmq_conf_set(conf, "msg.consume.excluded", "1");
if (g_conf.snapShot) {
tmq_conf_set(conf, "experimental.snapshot.enable", "true");