Merge branch '3.0' into fix/3_liaohj
This commit is contained in:
commit
65e4048f5d
|
@ -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
|
||||
|
|
|
@ -8,7 +8,7 @@ title: 流式计算
|
|||
|
||||
TDengine 3.0 的流式计算引擎提供了实时处理写入的数据流的能力,使用 SQL 定义实时流变换,当数据被写入流的源表后,数据会被以定义的方式自动处理,并根据定义的触发模式向目的表推送结果。它提供了替代复杂流处理系统的轻量级解决方案,并能够在高吞吐的数据写入的情况下,提供毫秒级的计算结果延迟。
|
||||
|
||||
流式计算可以包含数据过滤,标量函数计算(含UDF),以及窗口聚合(支持滑动窗口、会话窗口与状态窗口),可以以超级表、子表、普通表为源表,写入到目的超级表。在创建流时,目的超级表将被自动创建,随后新插入的数据会被流定义的方式处理并写入其中,通过 partition by 子句,可以以表名或标签划分 partition,不同的 partition 将写入到目的超级表的不同子表。
|
||||
流式计算可以包含数据过滤,标量函数计算(含UDF),以及窗口聚合(支持滑动窗口、会话窗口、状态窗口、事件窗口与计数窗口),可以以超级表、子表、普通表为源表,写入到目的超级表。在创建流时,目的超级表将被自动创建,随后新插入的数据会被流定义的方式处理并写入其中,通过 partition by 子句,可以以表名或标签划分 partition,不同的 partition 将写入到目的超级表的不同子表。
|
||||
|
||||
TDengine 的流式计算能够支持分布在多个 vnode 中的超级表聚合;还能够处理乱序数据的写入:它提供了 watermark 机制以度量容忍数据乱序的程度,并提供了 ignore expired 配置项以决定乱序数据的处理策略——丢弃或者重新计算。
|
||||
|
||||
|
|
|
@ -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;
|
||||
```
|
||||
|
||||
## 列表
|
||||
|
|
|
@ -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)。
|
||||
|
|
|
@ -30,7 +30,7 @@ subquery: SELECT select_list
|
|||
[window_clause]
|
||||
```
|
||||
|
||||
支持会话窗口、状态窗口与滑动窗口,其中,会话窗口与状态窗口搭配超级表时必须与partition by tbname一起使用
|
||||
支持会话窗口、状态窗口、滑动窗口、事件窗口和计数窗口,其中,状态窗口、事件窗口和计数窗口搭配超级表时必须与partition by tbname一起使用
|
||||
|
||||
stb_name 是保存计算结果的超级表的表名,如果该超级表不存在,会自动创建;如果已存在,则检查列的schema信息。详见 写入已存在的超级表
|
||||
|
||||
|
@ -60,7 +60,11 @@ COUNT_WINDOW 是计数窗口,按固定的数据行数来划分窗口。 count_va
|
|||
|
||||
窗口的定义与时序数据特色查询中的定义完全相同,详见 [TDengine 特色查询](../distinguished)
|
||||
|
||||
例如,如下语句创建流式计算,同时自动创建名为 avg_vol 的超级表,此流计算以一分钟为时间窗口、30 秒为前向增量统计这些电表的平均电压,并将来自 meters 表的数据的计算结果写入 avg_vol 表,不同 partition 的数据会分别创建子表并写入不同子表。
|
||||
例如,如下语句创建流式计算。第一个流计算,自动创建名为 avg_vol 的超级表,以一分钟为时间窗口、30 秒为前向增量统计这些电表的平均电压,并将来自 meters 表的数据的计算结果写入 avg_vol 表,不同 partition 的数据会分别创建子表并写入不同子表。
|
||||
|
||||
第二个流计算,自动创建名为 streamt0 的超级表,将数据按时间戳的顺序,以 voltage < 0 作为窗口的开始条件,voltage > 9作为窗口的结束条件,划分窗口做聚合运算,并将来自 meters 表的数据的计算结果写入 streamt0 表,不同 partition 的数据会分别创建子表并写入不同子表。
|
||||
|
||||
第三个流计算,自动创建名为 streamt1 的超级表,将数据按时间戳的顺序,以10条数据为一组,划分窗口做聚合运算,并将来自 meters 表的数据的计算结果写入 streamt1 表,不同 partition 的数据会分别创建子表并写入不同子表。
|
||||
|
||||
```sql
|
||||
CREATE STREAM avg_vol_s INTO avg_vol AS
|
||||
|
|
|
@ -2820,8 +2820,10 @@ typedef struct {
|
|||
char* tagName;
|
||||
int8_t isNull;
|
||||
int8_t tagType;
|
||||
int8_t tagFree;
|
||||
uint32_t nTagVal;
|
||||
uint8_t* pTagVal;
|
||||
SArray* pTagArray;
|
||||
// TSDB_ALTER_TABLE_UPDATE_OPTIONS
|
||||
int8_t updateTTL;
|
||||
int32_t newTTL;
|
||||
|
@ -3919,11 +3921,11 @@ int32_t tSerializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
|
|||
int32_t tDeserializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
|
||||
int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
|
||||
int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
|
||||
int32_t tDeatroySMqHbReq(SMqHbReq* pReq);
|
||||
void tDestroySMqHbReq(SMqHbReq* pReq);
|
||||
|
||||
int32_t tSerializeSMqHbRsp(void* buf, int32_t bufLen, SMqHbRsp* pRsp);
|
||||
int32_t tDeserializeSMqHbRsp(void* buf, int32_t bufLen, SMqHbRsp* pRsp);
|
||||
int32_t tDeatroySMqHbRsp(SMqHbRsp* pRsp);
|
||||
void tDestroySMqHbRsp(SMqHbRsp* pRsp);
|
||||
|
||||
int32_t tSerializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq);
|
||||
int32_t tDeserializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq);
|
||||
|
|
|
@ -250,137 +250,139 @@
|
|||
#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_NK_BIN 234
|
||||
#define TK_NK_HEX 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_KEY 333
|
||||
#define TK_MODULES 334
|
||||
#define TK_NK_BITNOT 335
|
||||
#define TK_NK_SEMI 336
|
||||
#define TK_NOTNULL 337
|
||||
#define TK_OF 338
|
||||
#define TK_PLUS 339
|
||||
#define TK_PRIVILEGE 340
|
||||
#define TK_RAISE 341
|
||||
#define TK_RESTRICT 342
|
||||
#define TK_ROW 343
|
||||
#define TK_SEMI 344
|
||||
#define TK_STAR 345
|
||||
#define TK_STATEMENT 346
|
||||
#define TK_STRICT 347
|
||||
#define TK_STRING 348
|
||||
#define TK_TIMES 349
|
||||
#define TK_VALUES 350
|
||||
#define TK_VARIABLE 351
|
||||
#define TK_WAL 352
|
||||
|
||||
|
||||
#define TK_NK_SPACE 600
|
||||
#define TK_NK_COMMENT 601
|
||||
#define TK_NK_ILLEGAL 602
|
||||
#define TK_NK_HEX 603 // hex number 0x123
|
||||
// #define TK_NK_HEX 603 // hex number 0x123
|
||||
#define TK_NK_OCT 604 // oct number
|
||||
#define TK_NK_BIN 605 // bin format data 0b111
|
||||
// #define TK_NK_BIN 605 // bin format data 0b111
|
||||
#define TK_BATCH_SCAN 606
|
||||
#define TK_NO_BATCH_SCAN 607
|
||||
#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
|
||||
|
||||
|
|
|
@ -44,6 +44,11 @@ int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double *value);
|
|||
int32_t toInteger(const char *z, int32_t n, int32_t base, int64_t *value);
|
||||
int32_t toUInteger(const char *z, int32_t n, int32_t base, uint64_t *value);
|
||||
|
||||
/**
|
||||
* non floating point integers
|
||||
*/
|
||||
int32_t toIntegerPure(const char *z, int32_t n, int32_t base, int64_t *value);
|
||||
|
||||
void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type);
|
||||
|
||||
void taosVariantDestroy(SVariant *pV);
|
||||
|
|
|
@ -224,10 +224,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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -62,6 +62,7 @@ typedef struct SRpcHandleInfo {
|
|||
|
||||
SRpcConnInfo conn;
|
||||
int8_t forbiddenIp;
|
||||
int8_t notFreeAhandle;
|
||||
|
||||
} SRpcHandleInfo;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -298,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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -1721,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;
|
||||
|
@ -2180,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);
|
||||
|
@ -2618,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;
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -779,7 +779,7 @@ int32_t tmqHbCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
taosWUnLockLatch(&tmq->lock);
|
||||
taosReleaseRef(tmqMgmt.rsetId, refId);
|
||||
}
|
||||
tDeatroySMqHbRsp(&rsp);
|
||||
tDestroySMqHbRsp(&rsp);
|
||||
taosMemoryFree(pMsg->pData);
|
||||
taosMemoryFree(pMsg->pEpSet);
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ void tmqSendHbReq(void* param, void* tmrId) {
|
|||
asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo);
|
||||
|
||||
OVER:
|
||||
tDeatroySMqHbReq(&req);
|
||||
tDestroySMqHbReq(&req);
|
||||
taosTmrReset(tmqSendHbReq, DEFAULT_HEARTBEAT_INTERVAL, param, tmqMgmt.timer, &tmq->hbLiveTimer);
|
||||
taosReleaseRef(tmqMgmt.rsetId, refId);
|
||||
}
|
||||
|
@ -2628,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;
|
||||
|
|
|
@ -268,7 +268,7 @@ bool tsDisableStream = false;
|
|||
int64_t tsStreamBufferSize = 128 * 1024 * 1024;
|
||||
bool tsFilterScalarMode = false;
|
||||
int tsResolveFQDNRetryTime = 100; // seconds
|
||||
int tsStreamAggCnt = 1000;
|
||||
int tsStreamAggCnt = 100000;
|
||||
|
||||
char tsS3Endpoint[TSDB_FQDN_LEN] = "<endpoint>";
|
||||
char tsS3AccessKey[TSDB_FQDN_LEN] = "<accesskey>";
|
||||
|
@ -502,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;
|
||||
|
@ -538,8 +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, "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;
|
||||
}
|
||||
|
||||
|
@ -600,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)
|
||||
|
@ -691,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;
|
||||
|
@ -707,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;
|
||||
|
@ -814,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;
|
||||
}
|
||||
|
@ -1353,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) {
|
||||
|
@ -1379,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);
|
||||
|
@ -1626,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;
|
||||
}
|
||||
|
|
|
@ -6201,9 +6201,8 @@ int32_t tDeserializeSMqAskEpReq(void *buf, int32_t bufLen, SMqAskEpReq *pReq) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tDeatroySMqHbRsp(SMqHbRsp *pRsp) {
|
||||
void tDestroySMqHbRsp(SMqHbRsp *pRsp) {
|
||||
taosArrayDestroy(pRsp->topicPrivileges);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) {
|
||||
|
@ -6250,13 +6249,12 @@ int32_t tDeserializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tDeatroySMqHbReq(SMqHbReq *pReq) {
|
||||
void tDestroySMqHbReq(SMqHbReq *pReq) {
|
||||
for (int i = 0; i < taosArrayGetSize(pReq->topics); i++) {
|
||||
TopicOffsetRows *vgs = taosArrayGet(pReq->topics, i);
|
||||
if (vgs) taosArrayDestroy(vgs->offsetRows);
|
||||
}
|
||||
taosArrayDestroy(pReq->topics);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) {
|
||||
|
|
|
@ -34,7 +34,7 @@ const int32_t TYPE_BYTES[21] = {
|
|||
INT_BYTES, // TSDB_DATA_TYPE_UINT
|
||||
sizeof(uint64_t), // TSDB_DATA_TYPE_UBIGINT
|
||||
TSDB_MAX_JSON_TAG_LEN, // TSDB_DATA_TYPE_JSON
|
||||
TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_VARBINARY: placeholder, not implemented
|
||||
sizeof(VarDataOffsetT), // TSDB_DATA_TYPE_VARBINARY
|
||||
TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_DECIMAL: placeholder, not implemented
|
||||
TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_BLOB: placeholder, not implemented
|
||||
TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_MEDIUMBLOB: placeholder, not implemented
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "ttokendef.h"
|
||||
#include "tvariant.h"
|
||||
|
||||
int32_t parseBinaryUInteger(const char *z, int32_t n, uint64_t *value) {
|
||||
static int32_t parseBinaryUInteger(const char *z, int32_t n, uint64_t *value) {
|
||||
// skip head 0b
|
||||
const char *p = z + 2;
|
||||
int32_t l = n - 2;
|
||||
|
@ -45,7 +45,7 @@ int32_t parseBinaryUInteger(const char *z, int32_t n, uint64_t *value) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint64_t *value) {
|
||||
static int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint64_t *value, bool parseFloat) {
|
||||
// parse sign
|
||||
bool has_sign = false;
|
||||
if (z[0] == '-') {
|
||||
|
@ -65,8 +65,7 @@ int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint64_t *v
|
|||
}
|
||||
|
||||
errno = 0;
|
||||
char *endPtr = NULL;
|
||||
bool parsed = false;
|
||||
char *endPtr = NULL;
|
||||
if (z[0] == '0' && n > 2) {
|
||||
if (z[1] == 'b' || z[1] == 'B') {
|
||||
// paring as binary
|
||||
|
@ -76,44 +75,87 @@ int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint64_t *v
|
|||
if (z[1] == 'x' || z[1] == 'X') {
|
||||
// parsing as hex
|
||||
*value = taosStr2UInt64(z, &endPtr, 16);
|
||||
parsed = true;
|
||||
if (errno == ERANGE || errno == EINVAL || endPtr - z != n) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (!parsed) {
|
||||
if (parseFloat) {
|
||||
// parsing as double
|
||||
double val = taosStr2Double(z, &endPtr);
|
||||
if (errno == ERANGE || errno == EINVAL || endPtr - z != n) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
if (val > UINT64_MAX) {
|
||||
errno = ERANGE;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
*value = round(val);
|
||||
}
|
||||
|
||||
if (errno == ERANGE || errno == EINVAL || endPtr - z != n) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double* value) {
|
||||
if (n == 0) {
|
||||
*value = 0;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double *value) {
|
||||
if (n == 0) {
|
||||
errno = EINVAL;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
char* endPtr = NULL;
|
||||
*value = taosStr2Double(z, &endPtr);
|
||||
char *endPtr = NULL;
|
||||
*value = taosStr2Double(z, &endPtr); // 0x already converted here
|
||||
if (errno == ERANGE || errno == EINVAL) return TSDB_CODE_FAILED;
|
||||
if (endPtr - z == n) return TSDB_CODE_SUCCESS;
|
||||
|
||||
if (errno == ERANGE || errno == EINVAL) {
|
||||
return TSDB_CODE_FAILED;
|
||||
if (type == TK_NK_BIN || type == TK_NK_STRING) {
|
||||
bool is_neg = false;
|
||||
uint64_t uv = 0;
|
||||
if (TSDB_CODE_SUCCESS == parseSignAndUInteger(z, n, &is_neg, &uv, false)) {
|
||||
*value = is_neg ? -(double)uv : uv;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (endPtr - z != n) {
|
||||
return TSDB_CODE_FAILED;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
int32_t toIntegerPure(const char *z, int32_t n, int32_t base, int64_t *value) {
|
||||
errno = 0;
|
||||
|
||||
char *endPtr = NULL;
|
||||
*value = taosStr2Int64(z, &endPtr, base);
|
||||
if (endPtr - z == n) {
|
||||
if (errno == ERANGE || errno == EINVAL) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
bool is_neg = false;
|
||||
uint64_t uv = 0;
|
||||
int32_t code = parseSignAndUInteger(z, n, &is_neg, &uv, false); // support 0b/0x
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
if (is_neg) {
|
||||
if (uv > 1ull + INT64_MAX) {
|
||||
*value = INT64_MIN;
|
||||
return TSDB_CODE_FAILED;
|
||||
} else {
|
||||
*value = -(int64_t)uv;
|
||||
}
|
||||
} else {
|
||||
if (uv > INT64_MAX) {
|
||||
*value = INT64_MAX;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
*value = uv;
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) {
|
||||
|
@ -144,8 +186,8 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) {
|
|||
}
|
||||
|
||||
if (n == 0) {
|
||||
*value = 0;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
errno = EINVAL;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
// 1. try to parse as integer
|
||||
|
@ -190,7 +232,7 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) {
|
|||
// 2. parse as other
|
||||
bool is_neg = false;
|
||||
uint64_t uv = 0;
|
||||
int32_t code = parseSignAndUInteger(z, n, &is_neg, &uv);
|
||||
int32_t code = parseSignAndUInteger(z, n, &is_neg, &uv, true);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
// truncate into int64
|
||||
if (is_neg) {
|
||||
|
@ -198,7 +240,7 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) {
|
|||
*value = INT64_MIN;
|
||||
return TSDB_CODE_FAILED;
|
||||
} else {
|
||||
*value = -uv;
|
||||
*value = -(int64_t)uv;
|
||||
}
|
||||
} else {
|
||||
if (uv > INT64_MAX) {
|
||||
|
@ -216,9 +258,6 @@ int32_t toUIntegerEx(const char *z, int32_t n, uint32_t type, uint64_t *value) {
|
|||
errno = 0;
|
||||
char *endPtr = NULL;
|
||||
const char *p = z;
|
||||
while (*p == ' ') {
|
||||
p++;
|
||||
}
|
||||
switch (type) {
|
||||
case TK_NK_INTEGER: {
|
||||
*value = taosStr2UInt64(p, &endPtr, 10);
|
||||
|
@ -246,24 +285,22 @@ int32_t toUIntegerEx(const char *z, int32_t n, uint32_t type, uint64_t *value) {
|
|||
}
|
||||
|
||||
if (n == 0) {
|
||||
*value = 0;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
errno = EINVAL;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
// 1. parse as integer
|
||||
*value = taosStr2UInt64(p, &endPtr, 10);
|
||||
if (*p == '-' && *value) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
if (endPtr - z == n) {
|
||||
if (errno == ERANGE || errno == EINVAL) {
|
||||
if (errno == ERANGE || errno == EINVAL || (*p == '-' && *value)) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else if (errno == 0 && *endPtr == '.') {
|
||||
const char *s = endPtr + 1;
|
||||
const char *end = z + n;
|
||||
bool pure = true;
|
||||
bool pure = true;
|
||||
while (s < end) {
|
||||
if (*s < '0' || *s > '9') {
|
||||
pure = false;
|
||||
|
@ -275,13 +312,16 @@ int32_t toUIntegerEx(const char *z, int32_t n, uint32_t type, uint64_t *value) {
|
|||
if (endPtr + 1 < end && endPtr[1] > '4' && *value < UINT64_MAX) {
|
||||
(*value)++;
|
||||
}
|
||||
if (*p == '-' && *value) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. parse as other
|
||||
bool is_neg = false;
|
||||
int32_t code = parseSignAndUInteger(z, n, &is_neg, value);
|
||||
int32_t code = parseSignAndUInteger(z, n, &is_neg, value, true);
|
||||
if (is_neg) {
|
||||
if (TSDB_CODE_SUCCESS == code && 0 == *value) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -24,27 +24,22 @@ extern "C" {
|
|||
|
||||
enum {
|
||||
MQ_CONSUMER_STATUS_REBALANCE = 1,
|
||||
// MQ_CONSUMER_STATUS__MODIFY_IN_REB, // this value is not used anymore
|
||||
MQ_CONSUMER_STATUS_READY,
|
||||
MQ_CONSUMER_STATUS_LOST,
|
||||
// MQ_CONSUMER_STATUS__LOST_IN_REB, // this value is not used anymore
|
||||
// MQ_CONSUMER_STATUS__LOST_REBD,
|
||||
};\
|
||||
};
|
||||
|
||||
int32_t mndInitConsumer(SMnode *pMnode);
|
||||
void mndCleanupConsumer(SMnode *pMnode);
|
||||
void mndDropConsumerFromSdb(SMnode *pMnode, int64_t consumerId, SRpcHandleInfo* info);
|
||||
void mndSendConsumerMsg(SMnode *pMnode, int64_t consumerId, uint16_t msgType, SRpcHandleInfo* info);
|
||||
|
||||
SMqConsumerObj *mndAcquireConsumer(SMnode *pMnode, int64_t consumerId);
|
||||
void mndReleaseConsumer(SMnode *pMnode, SMqConsumerObj *pConsumer);
|
||||
|
||||
SMqConsumerObj *mndCreateConsumer(int64_t consumerId, const char *cgroup);
|
||||
|
||||
SSdbRaw *mndConsumerActionEncode(SMqConsumerObj *pConsumer);
|
||||
SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw);
|
||||
|
||||
int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer);
|
||||
int32_t mndSetConsumerDropLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer);
|
||||
int32_t mndSetConsumerCommitLogs(STrans *pTrans, SMqConsumerObj *pConsumer);
|
||||
int32_t mndSetConsumerDropLogs(STrans *pTrans, SMqConsumerObj *pConsumer);
|
||||
|
||||
const char *mndConsumerStatusName(int status);
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@ typedef enum {
|
|||
CONSUMER_REMOVE_REB, // remove after rebalance
|
||||
CONSUMER_UPDATE_REC, // update after recover
|
||||
CONSUMER_UPDATE_SUB, // update after subscribe req
|
||||
CONSUMER_INSERT_SUB,
|
||||
} ECsmUpdateType;
|
||||
|
||||
typedef struct {
|
||||
|
@ -556,8 +557,9 @@ typedef struct {
|
|||
int32_t resetOffsetCfg;
|
||||
} SMqConsumerObj;
|
||||
|
||||
SMqConsumerObj* tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_LEN]);
|
||||
void tDeleteSMqConsumerObj(SMqConsumerObj* pConsumer, bool isDeleted);
|
||||
SMqConsumerObj *tNewSMqConsumerObj(int64_t consumerId, char *cgroup, int8_t updateType, char *topic, SCMSubscribeReq *subscribe);
|
||||
void tClearSMqConsumerObj(SMqConsumerObj* pConsumer);
|
||||
void tDeleteSMqConsumerObj(SMqConsumerObj* pConsumer);
|
||||
int32_t tEncodeSMqConsumerObj(void** buf, const SMqConsumerObj* pConsumer);
|
||||
void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer, int8_t sver);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ SMqSubscribeObj *mndAcquireSubscribe(SMnode *pMnode, const char *CGroup, const c
|
|||
SMqSubscribeObj *mndAcquireSubscribeByKey(SMnode *pMnode, const char *key);
|
||||
void mndReleaseSubscribe(SMnode *pMnode, SMqSubscribeObj *pSub);
|
||||
|
||||
int32_t mndMakeSubscribeKey(char *key, const char *cgroup, const char *topicName);
|
||||
void mndMakeSubscribeKey(char *key, const char *cgroup, const char *topicName);
|
||||
|
||||
int32_t mndDropSubByTopic(SMnode *pMnode, STrans *pTrans, const char *topic);
|
||||
int32_t mndSetDropSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj *pSub);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -249,7 +249,9 @@ void *tDecodeSMqVgEp(const void *buf, SMqVgEp *pVgEp, int8_t sver) {
|
|||
return (void *)buf;
|
||||
}
|
||||
|
||||
SMqConsumerObj *tNewSMqConsumerObj(int64_t consumerId, char *cgroup) {
|
||||
static void *topicNameDup(void *p) { return taosStrdup((char *)p); }
|
||||
|
||||
SMqConsumerObj *tNewSMqConsumerObj(int64_t consumerId, char *cgroup, int8_t updateType, char *topic, SCMSubscribeReq *subscribe) {
|
||||
SMqConsumerObj *pConsumer = taosMemoryCalloc(1, sizeof(SMqConsumerObj));
|
||||
if (pConsumer == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -264,36 +266,64 @@ SMqConsumerObj *tNewSMqConsumerObj(int64_t consumerId, char *cgroup) {
|
|||
pConsumer->hbStatus = 0;
|
||||
|
||||
taosInitRWLatch(&pConsumer->lock);
|
||||
pConsumer->createTime = taosGetTimestampMs();
|
||||
pConsumer->updateType = updateType;
|
||||
|
||||
pConsumer->currentTopics = taosArrayInit(0, sizeof(void *));
|
||||
pConsumer->rebNewTopics = taosArrayInit(0, sizeof(void *));
|
||||
pConsumer->rebRemovedTopics = taosArrayInit(0, sizeof(void *));
|
||||
pConsumer->assignedTopics = taosArrayInit(0, sizeof(void *));
|
||||
if (updateType == CONSUMER_ADD_REB){
|
||||
pConsumer->rebNewTopics = taosArrayInit(0, sizeof(void *));
|
||||
if(pConsumer->rebNewTopics == NULL){
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto END;
|
||||
}
|
||||
|
||||
if (pConsumer->currentTopics == NULL || pConsumer->rebNewTopics == NULL || pConsumer->rebRemovedTopics == NULL ||
|
||||
pConsumer->assignedTopics == NULL) {
|
||||
taosArrayDestroy(pConsumer->currentTopics);
|
||||
taosArrayDestroy(pConsumer->rebNewTopics);
|
||||
taosArrayDestroy(pConsumer->rebRemovedTopics);
|
||||
taosArrayDestroy(pConsumer->assignedTopics);
|
||||
taosMemoryFree(pConsumer);
|
||||
return NULL;
|
||||
char* topicTmp = taosStrdup(topic);
|
||||
taosArrayPush(pConsumer->rebNewTopics, &topicTmp);
|
||||
}else if (updateType == CONSUMER_REMOVE_REB) {
|
||||
pConsumer->rebRemovedTopics = taosArrayInit(0, sizeof(void *));
|
||||
if(pConsumer->rebRemovedTopics == NULL){
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto END;
|
||||
}
|
||||
char* topicTmp = taosStrdup(topic);
|
||||
taosArrayPush(pConsumer->rebRemovedTopics, &topicTmp);
|
||||
}else if (updateType == CONSUMER_INSERT_SUB){
|
||||
tstrncpy(pConsumer->clientId, subscribe->clientId, tListLen(pConsumer->clientId));
|
||||
pConsumer->withTbName = subscribe->withTbName;
|
||||
pConsumer->autoCommit = subscribe->autoCommit;
|
||||
pConsumer->autoCommitInterval = subscribe->autoCommitInterval;
|
||||
pConsumer->resetOffsetCfg = subscribe->resetOffsetCfg;
|
||||
|
||||
|
||||
pConsumer->rebNewTopics = taosArrayDup(subscribe->topicNames, topicNameDup);
|
||||
if (pConsumer->rebNewTopics == NULL){
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto END;
|
||||
}
|
||||
pConsumer->assignedTopics = subscribe->topicNames;
|
||||
subscribe->topicNames = NULL;
|
||||
}else if (updateType == CONSUMER_UPDATE_SUB){
|
||||
pConsumer->assignedTopics = subscribe->topicNames;
|
||||
subscribe->topicNames = NULL;
|
||||
}
|
||||
|
||||
pConsumer->createTime = taosGetTimestampMs();
|
||||
|
||||
return pConsumer;
|
||||
|
||||
END:
|
||||
tDeleteSMqConsumerObj(pConsumer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void tDeleteSMqConsumerObj(SMqConsumerObj *pConsumer, bool delete) {
|
||||
void tClearSMqConsumerObj(SMqConsumerObj *pConsumer) {
|
||||
if (pConsumer == NULL) return;
|
||||
taosArrayDestroyP(pConsumer->currentTopics, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pConsumer->rebNewTopics, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pConsumer->rebRemovedTopics, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pConsumer->assignedTopics, (FDelete)taosMemoryFree);
|
||||
if (delete) {
|
||||
taosMemoryFree(pConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
void tDeleteSMqConsumerObj(SMqConsumerObj *pConsumer) {
|
||||
tClearSMqConsumerObj(pConsumer);
|
||||
taosMemoryFree(pConsumer);
|
||||
}
|
||||
|
||||
int32_t tEncodeSMqConsumerObj(void **buf, const SMqConsumerObj *pConsumer) {
|
||||
|
@ -548,6 +578,7 @@ SMqSubscribeObj *tCloneSubscribeObj(const SMqSubscribeObj *pSub) {
|
|||
}
|
||||
|
||||
void tDeleteSubscribeObj(SMqSubscribeObj *pSub) {
|
||||
if (pSub == NULL) return;
|
||||
void *pIter = NULL;
|
||||
while (1) {
|
||||
pIter = taosHashIterate(pSub->consumerHash, pIter);
|
||||
|
|
|
@ -597,6 +597,7 @@ static int32_t mndSetUpdateIdxStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb
|
|||
taosRUnLockLatch(&pOld->lock);
|
||||
|
||||
pNew->pTags = NULL;
|
||||
pNew->pColumns = NULL;
|
||||
pNew->updateTime = taosGetTimestampMs();
|
||||
pNew->lock = 0;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -353,6 +353,66 @@ static int32_t extractTopicTbInfo(SNode *pAst, SMqTopicObj *pTopic) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t sendCheckInfoToVnode(STrans *pTrans, SMnode *pMnode, SMqTopicObj *topicObj){
|
||||
STqCheckInfo info;
|
||||
memcpy(info.topic, topicObj->name, TSDB_TOPIC_FNAME_LEN);
|
||||
info.ntbUid = topicObj->ntbUid;
|
||||
info.colIdList = topicObj->ntbColIds;
|
||||
// broadcast forbid alter info
|
||||
void *pIter = NULL;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SVgObj *pVgroup = NULL;
|
||||
int32_t code = 0;
|
||||
void *buf = NULL;
|
||||
|
||||
while (1) {
|
||||
// iterate vg
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
if (pIter == NULL) break;
|
||||
if (!mndVgroupInDb(pVgroup, topicObj->dbUid)) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
// encoder check alter info
|
||||
int32_t len;
|
||||
tEncodeSize(tEncodeSTqCheckInfo, &info, len, code);
|
||||
if (code != 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto END;
|
||||
}
|
||||
buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
|
||||
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, abuf, len);
|
||||
code = tEncodeSTqCheckInfo(&encoder, &info);
|
||||
if (code < 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto END;
|
||||
}
|
||||
tEncoderClear(&encoder);
|
||||
((SMsgHead *)buf)->vgId = htonl(pVgroup->vgId);
|
||||
// add redo action
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
action.pCont = buf;
|
||||
action.contLen = sizeof(SMsgHead) + len;
|
||||
action.msgType = TDMT_VND_TMQ_ADD_CHECKINFO;
|
||||
code = mndTransAppendRedoAction(pTrans, &action);
|
||||
if (code != 0) {
|
||||
goto END;
|
||||
}
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
buf = NULL;
|
||||
}
|
||||
|
||||
END:
|
||||
taosMemoryFree(buf);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *pCreate, SDbObj *pDb,
|
||||
const char *userName) {
|
||||
mInfo("start to create topic:%s", pCreate->name);
|
||||
|
@ -396,13 +456,6 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
|
|||
topicObj.withMeta = pCreate->withMeta;
|
||||
|
||||
if (pCreate->subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||
if (pCreate->withMeta) {
|
||||
terrno = TSDB_CODE_MND_INVALID_TOPIC_OPTION;
|
||||
mError("topic:%s, failed to create since %s", pCreate->name, terrstr());
|
||||
code = terrno;
|
||||
goto _OUT;
|
||||
}
|
||||
|
||||
topicObj.ast = taosStrdup(pCreate->ast);
|
||||
topicObj.astLen = strlen(pCreate->ast) + 1;
|
||||
|
||||
|
@ -474,59 +527,9 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
|
|||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
|
||||
|
||||
if (topicObj.ntbUid != 0) {
|
||||
STqCheckInfo info;
|
||||
memcpy(info.topic, topicObj.name, TSDB_TOPIC_FNAME_LEN);
|
||||
info.ntbUid = topicObj.ntbUid;
|
||||
info.colIdList = topicObj.ntbColIds;
|
||||
// broadcast forbid alter info
|
||||
void *pIter = NULL;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SVgObj *pVgroup = NULL;
|
||||
while (1) {
|
||||
// iterate vg
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
if (pIter == NULL) break;
|
||||
if (!mndVgroupInDb(pVgroup, topicObj.dbUid)) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
// encoder check alter info
|
||||
int32_t len;
|
||||
tEncodeSize(tEncodeSTqCheckInfo, &info, len, code);
|
||||
if (code < 0) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
goto _OUT;
|
||||
}
|
||||
void *buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
|
||||
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, abuf, len);
|
||||
if (tEncodeSTqCheckInfo(&encoder, &info) < 0) {
|
||||
taosMemoryFree(buf);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
code = -1;
|
||||
goto _OUT;
|
||||
}
|
||||
tEncoderClear(&encoder);
|
||||
((SMsgHead *)buf)->vgId = htonl(pVgroup->vgId);
|
||||
// add redo action
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
action.pCont = buf;
|
||||
action.contLen = sizeof(SMsgHead) + len;
|
||||
action.msgType = TDMT_VND_TMQ_ADD_CHECKINFO;
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
taosMemoryFree(buf);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
code = -1;
|
||||
goto _OUT;
|
||||
}
|
||||
buf = NULL;
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
code = sendCheckInfoToVnode(pTrans, pMnode, &topicObj);
|
||||
if (code != 0){
|
||||
goto _OUT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -653,9 +656,104 @@ _OVER:
|
|||
return code;
|
||||
}
|
||||
|
||||
static bool checkTopic(SArray *topics, char *topicName){
|
||||
int32_t sz = taosArrayGetSize(topics);
|
||||
for (int32_t i = 0; i < sz; i++) {
|
||||
char *name = taosArrayGetP(topics, i);
|
||||
if (strcmp(name, topicName) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int32_t mndDropConsumerByTopic(SMnode *pMnode, STrans *pTrans, char *topicName){
|
||||
int32_t code = 0;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *pIter = NULL;
|
||||
SMqConsumerObj *pConsumer = NULL;
|
||||
while (1) {
|
||||
pIter = sdbFetch(pSdb, SDB_CONSUMER, pIter, (void **)&pConsumer);
|
||||
if (pIter == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
bool found = checkTopic(pConsumer->assignedTopics, topicName);
|
||||
if (found){
|
||||
if (pConsumer->status == MQ_CONSUMER_STATUS_LOST) {
|
||||
code = mndSetConsumerDropLogs(pTrans, pConsumer);
|
||||
if (code != 0) {
|
||||
goto end;
|
||||
}
|
||||
sdbRelease(pSdb, pConsumer);
|
||||
continue;
|
||||
}
|
||||
mError("topic:%s, failed to drop since subscribed by consumer:0x%" PRIx64 ", in consumer group %s",
|
||||
topicName, pConsumer->consumerId, pConsumer->cgroup);
|
||||
code = TSDB_CODE_MND_TOPIC_SUBSCRIBED;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (checkTopic(pConsumer->rebNewTopics, topicName) || checkTopic(pConsumer->rebRemovedTopics, topicName)) {
|
||||
code = TSDB_CODE_MND_TOPIC_SUBSCRIBED;
|
||||
mError("topic:%s, failed to drop since subscribed by consumer:%" PRId64 ", in consumer group %s (reb new)",
|
||||
topicName, pConsumer->consumerId, pConsumer->cgroup);
|
||||
goto end;
|
||||
}
|
||||
sdbRelease(pSdb, pConsumer);
|
||||
}
|
||||
|
||||
end:
|
||||
sdbRelease(pSdb, pConsumer);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndDropCheckInfoByTopic(SMnode *pMnode, STrans *pTrans, SMqTopicObj *pTopic){
|
||||
// broadcast to all vnode
|
||||
void *pIter = NULL;
|
||||
SVgObj *pVgroup = NULL;
|
||||
int32_t code = 0;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *buf = NULL;
|
||||
while (1) {
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
if (pIter == NULL) break;
|
||||
if (!mndVgroupInDb(pVgroup, pTopic->dbUid)) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
buf = taosMemoryCalloc(1, sizeof(SMsgHead) + TSDB_TOPIC_FNAME_LEN);
|
||||
if (buf == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
|
||||
((SMsgHead *)buf)->vgId = htonl(pVgroup->vgId);
|
||||
memcpy(abuf, pTopic->name, TSDB_TOPIC_FNAME_LEN);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
action.pCont = buf;
|
||||
action.contLen = sizeof(SMsgHead) + TSDB_TOPIC_FNAME_LEN;
|
||||
action.msgType = TDMT_VND_TMQ_DEL_CHECKINFO;
|
||||
code = mndTransAppendRedoAction(pTrans, &action);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(buf);
|
||||
goto end;
|
||||
}
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
}
|
||||
|
||||
end:
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SMDropTopicReq dropReq = {0};
|
||||
int32_t code = 0;
|
||||
SMqTopicObj *pTopic = NULL;
|
||||
|
@ -705,68 +803,9 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
|
|||
goto end;
|
||||
}
|
||||
|
||||
void *pIter = NULL;
|
||||
SMqConsumerObj *pConsumer;
|
||||
while (1) {
|
||||
pIter = sdbFetch(pSdb, SDB_CONSUMER, pIter, (void **)&pConsumer);
|
||||
if (pIter == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
int32_t sz = taosArrayGetSize(pConsumer->assignedTopics);
|
||||
for (int32_t i = 0; i < sz; i++) {
|
||||
char *name = taosArrayGetP(pConsumer->assignedTopics, i);
|
||||
if (strcmp(name, pTopic->name) == 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found){
|
||||
if (pConsumer->status == MQ_CONSUMER_STATUS_LOST) {
|
||||
mndDropConsumerFromSdb(pMnode, pConsumer->consumerId, &pReq->info);
|
||||
mndReleaseConsumer(pMnode, pConsumer);
|
||||
continue;
|
||||
}
|
||||
|
||||
mndReleaseConsumer(pMnode, pConsumer);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
terrno = TSDB_CODE_MND_TOPIC_SUBSCRIBED;
|
||||
mError("topic:%s, failed to drop since subscribed by consumer:0x%" PRIx64 ", in consumer group %s",
|
||||
dropReq.name, pConsumer->consumerId, pConsumer->cgroup);
|
||||
code = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
sz = taosArrayGetSize(pConsumer->rebNewTopics);
|
||||
for (int32_t i = 0; i < sz; i++) {
|
||||
char *name = taosArrayGetP(pConsumer->rebNewTopics, i);
|
||||
if (strcmp(name, pTopic->name) == 0) {
|
||||
mndReleaseConsumer(pMnode, pConsumer);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
terrno = TSDB_CODE_MND_TOPIC_SUBSCRIBED;
|
||||
mError("topic:%s, failed to drop since subscribed by consumer:%" PRId64 ", in consumer group %s (reb new)",
|
||||
dropReq.name, pConsumer->consumerId, pConsumer->cgroup);
|
||||
code = -1;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
sz = taosArrayGetSize(pConsumer->rebRemovedTopics);
|
||||
for (int32_t i = 0; i < sz; i++) {
|
||||
char *name = taosArrayGetP(pConsumer->rebRemovedTopics, i);
|
||||
if (strcmp(name, pTopic->name) == 0) {
|
||||
mndReleaseConsumer(pMnode, pConsumer);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
terrno = TSDB_CODE_MND_TOPIC_SUBSCRIBED;
|
||||
mError("topic:%s, failed to drop since subscribed by consumer:%" PRId64 ", in consumer group %s (reb remove)",
|
||||
dropReq.name, pConsumer->consumerId, pConsumer->cgroup);
|
||||
code = -1;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pConsumer);
|
||||
code = mndDropConsumerByTopic(pMnode, pTrans, dropReq.name);
|
||||
if (code != 0) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
code = mndDropSubByTopic(pMnode, pTrans, dropReq.name);
|
||||
|
@ -776,36 +815,9 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
|
|||
}
|
||||
|
||||
if (pTopic->ntbUid != 0) {
|
||||
// broadcast to all vnode
|
||||
pIter = NULL;
|
||||
SVgObj *pVgroup = NULL;
|
||||
|
||||
while (1) {
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
if (pIter == NULL) break;
|
||||
if (!mndVgroupInDb(pVgroup, pTopic->dbUid)) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
void *buf = taosMemoryCalloc(1, sizeof(SMsgHead) + TSDB_TOPIC_FNAME_LEN);
|
||||
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
|
||||
((SMsgHead *)buf)->vgId = htonl(pVgroup->vgId);
|
||||
memcpy(abuf, pTopic->name, TSDB_TOPIC_FNAME_LEN);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
action.pCont = buf;
|
||||
action.contLen = sizeof(SMsgHead) + TSDB_TOPIC_FNAME_LEN;
|
||||
action.msgType = TDMT_VND_TMQ_DEL_CHECKINFO;
|
||||
code = mndTransAppendRedoAction(pTrans, &action);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(buf);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
goto end;
|
||||
}
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
code = mndDropCheckInfoByTopic(pMnode, pTrans, pTopic);
|
||||
if (code != 0) {
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -822,7 +834,6 @@ end:
|
|||
|
||||
SName name = {0};
|
||||
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
//reuse this function for topic
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, "dropTopic", name.dbname, name.tname, dropReq.sql, dropReq.sqlLen);
|
||||
|
||||
|
|
|
@ -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,9 +1255,9 @@ 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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -88,10 +88,6 @@ int32_t tqMetaOpen(STQ* pTq) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
// if (tqMetaRestoreHandle(pTq) < 0) {
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
if (tqMetaRestoreCheckInfo(pTq) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -167,32 +163,30 @@ int32_t tqMetaRestoreCheckInfo(STQ* pTq) {
|
|||
void* pVal = NULL;
|
||||
int vLen = 0;
|
||||
SDecoder decoder;
|
||||
int32_t code = 0;
|
||||
|
||||
tdbTbcMoveToFirst(pCur);
|
||||
|
||||
while (tdbTbcNext(pCur, &pKey, &kLen, &pVal, &vLen) == 0) {
|
||||
STqCheckInfo info;
|
||||
tDecoderInit(&decoder, (uint8_t*)pVal, vLen);
|
||||
if (tDecodeSTqCheckInfo(&decoder, &info) < 0) {
|
||||
code = tDecodeSTqCheckInfo(&decoder, &info);
|
||||
if (code != 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tdbFree(pKey);
|
||||
tdbFree(pVal);
|
||||
tdbTbcClose(pCur);
|
||||
return -1;
|
||||
goto END;
|
||||
}
|
||||
tDecoderClear(&decoder);
|
||||
if (taosHashPut(pTq->pCheckInfo, info.topic, strlen(info.topic), &info, sizeof(STqCheckInfo)) < 0) {
|
||||
code = taosHashPut(pTq->pCheckInfo, info.topic, strlen(info.topic), &info, sizeof(STqCheckInfo));
|
||||
if (code != 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tdbFree(pKey);
|
||||
tdbFree(pVal);
|
||||
tdbTbcClose(pCur);
|
||||
return -1;
|
||||
goto END;
|
||||
}
|
||||
}
|
||||
END:
|
||||
tdbFree(pKey);
|
||||
tdbFree(pVal);
|
||||
tdbTbcClose(pCur);
|
||||
return 0;
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -680,20 +666,19 @@ int32_t tqRetrieveDataBlock(STqReader* pReader, SSDataBlock** pRes, const char*
|
|||
int32_t targetIdx = 0;
|
||||
int32_t sourceIdx = 0;
|
||||
while (targetIdx < colActual) {
|
||||
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, targetIdx);
|
||||
|
||||
if (sourceIdx >= numOfCols) {
|
||||
tqError("tqRetrieveDataBlock sourceIdx:%d >= numOfCols:%d", sourceIdx, numOfCols);
|
||||
return -1;
|
||||
tqError("lostdata tqRetrieveDataBlock sourceIdx:%d >= numOfCols:%d", sourceIdx, numOfCols);
|
||||
colDataSetNNULL(pColData, 0, numOfRows);
|
||||
targetIdx++;
|
||||
continue;
|
||||
}
|
||||
|
||||
SColData* pCol = taosArrayGet(pCols, sourceIdx);
|
||||
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, targetIdx);
|
||||
SColVal colVal;
|
||||
|
||||
if (pCol->nVal != numOfRows) {
|
||||
tqError("tqRetrieveDataBlock pCol->nVal:%d != numOfRows:%d", pCol->nVal, numOfRows);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tqTrace("lostdata colActual:%d, sourceIdx:%d, targetIdx:%d, numOfCols:%d, source cid:%d, dst cid:%d", colActual, sourceIdx, targetIdx, numOfCols, pCol->cid, pColData->info.colId);
|
||||
if (pCol->cid < pColData->info.colId) {
|
||||
sourceIdx++;
|
||||
} else if (pCol->cid == pColData->info.colId) {
|
||||
|
@ -707,7 +692,7 @@ int32_t tqRetrieveDataBlock(STqReader* pReader, SSDataBlock** pRes, const char*
|
|||
sourceIdx++;
|
||||
targetIdx++;
|
||||
} else {
|
||||
colDataSetNNULL(pColData, 0, pCol->nVal);
|
||||
colDataSetNNULL(pColData, 0, numOfRows);
|
||||
targetIdx++;
|
||||
}
|
||||
}
|
||||
|
@ -726,9 +711,6 @@ int32_t tqRetrieveDataBlock(STqReader* pReader, SSDataBlock** pRes, const char*
|
|||
SColVal colVal;
|
||||
tRowGet(pRow, pTSchema, sourceIdx, &colVal);
|
||||
if (colVal.cid < pColData->info.colId) {
|
||||
// tqDebug("colIndex:%d column id:%d in row, ignore, the required colId:%d, total cols in
|
||||
// schema:%d",
|
||||
// sourceIdx, colVal.cid, pColData->info.colId, pTSchema->numOfCols);
|
||||
sourceIdx++;
|
||||
continue;
|
||||
} else if (colVal.cid == pColData->info.colId) {
|
||||
|
|
|
@ -929,6 +929,7 @@ static int32_t tqProcessTaskResumeImpl(void* handle, SStreamTask* pTask, int64_t
|
|||
}
|
||||
|
||||
if (level == TASK_LEVEL__SOURCE && pTask->info.fillHistory && status == TASK_STATUS__SCAN_HISTORY) {
|
||||
pTask->hTaskInfo.operatorOpen = false;
|
||||
streamStartScanHistoryAsync(pTask, igUntreated);
|
||||
} else if (level == TASK_LEVEL__SOURCE && (streamQueueGetNumOfItems(pTask->inputq.queue) == 0)) {
|
||||
tqScanWalAsync((STQ*)handle, false);
|
||||
|
|
|
@ -584,13 +584,30 @@ struct STsdbSnapWriter {
|
|||
|
||||
// APIs
|
||||
static int32_t tsdbSnapWriteTimeSeriesRow(STsdbSnapWriter* writer, SRowInfo* row) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
TABLEID tbid = {0};
|
||||
SMetaInfo info;
|
||||
|
||||
while (writer->ctx->hasData) {
|
||||
SRowInfo* row1 = tsdbIterMergerGetData(writer->ctx->dataIterMerger);
|
||||
if (row1 == NULL) {
|
||||
writer->ctx->hasData = false;
|
||||
SRowInfo* row1;
|
||||
for (;;) {
|
||||
row1 = tsdbIterMergerGetData(writer->ctx->dataIterMerger);
|
||||
if (row1 == NULL) {
|
||||
writer->ctx->hasData = false;
|
||||
} else if (row1->uid != tbid.uid) {
|
||||
tbid.suid = row1->suid;
|
||||
tbid.uid = row1->uid;
|
||||
if (metaGetInfo(writer->tsdb->pVnode->pMeta, tbid.uid, &info, NULL) != 0) {
|
||||
code = tsdbIterMergerSkipTableData(writer->ctx->dataIterMerger, &tbid);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (writer->ctx->hasData == false) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -3,7 +3,7 @@ aux_source_directory(src EXECUTOR_SRC)
|
|||
add_library(executor STATIC ${EXECUTOR_SRC})
|
||||
|
||||
target_link_libraries(executor
|
||||
PRIVATE os util common function parser planner qcom scalar nodes index wal tdb
|
||||
PRIVATE os util common function parser planner qcom scalar nodes index wal tdb geometry
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
|
|
|
@ -353,6 +353,8 @@ typedef struct STableMergeScanInfo {
|
|||
bool rtnNextDurationBlocks;
|
||||
int32_t nextDurationBlocksIdx;
|
||||
|
||||
bool bSortRowId;
|
||||
|
||||
STmsSubTablesMergeInfo* pSubTablesMergeInfo;
|
||||
} STableMergeScanInfo;
|
||||
|
||||
|
@ -600,6 +602,8 @@ typedef struct SStreamIntervalOperatorInfo {
|
|||
bool recvPullover;
|
||||
SSDataBlock* pMidPulloverRes;
|
||||
bool clearState;
|
||||
SArray* pMidPullDatas;
|
||||
int32_t midDelIndex;
|
||||
} SStreamIntervalOperatorInfo;
|
||||
|
||||
typedef struct SDataGroupInfo {
|
||||
|
|
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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: {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -2084,6 +2084,8 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
|
|||
blockDataCleanup(pInfo->pRes);
|
||||
STimeWindow defaultWindow = {.skey = INT64_MIN, .ekey = INT64_MAX};
|
||||
setBlockIntoRes(pInfo, pRes, &defaultWindow, true);
|
||||
qDebug("doQueueScan after filter get data from log %" PRId64 " rows, version:%" PRId64, pInfo->pRes->info.rows,
|
||||
pTaskInfo->streamInfo.currentOffset.version);
|
||||
if (pInfo->pRes->info.rows > 0) {
|
||||
return pInfo->pRes;
|
||||
}
|
||||
|
@ -2269,6 +2271,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;
|
||||
}
|
||||
|
||||
|
@ -3870,6 +3873,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);
|
||||
|
@ -3956,7 +3960,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;
|
||||
}
|
||||
|
||||
|
@ -4008,9 +4014,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);
|
||||
|
@ -4047,6 +4060,7 @@ void stopDurationForGroupTableMergeScan(SOperatorInfo* pOperator) {
|
|||
|
||||
tsortDestroySortHandle(pInfo->pSortHandle);
|
||||
pInfo->pSortHandle = NULL;
|
||||
|
||||
}
|
||||
|
||||
int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
|
||||
|
@ -4131,8 +4145,7 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock*
|
|||
if (pTupleHandle == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
appendOneRowToDataBlock(pResBlock, pTupleHandle);
|
||||
tsortAppendTupleToBlock(pInfo->pSortHandle, pResBlock, pTupleHandle);
|
||||
if (pResBlock->info.rows >= capacity) {
|
||||
break;
|
||||
}
|
||||
|
@ -4199,7 +4212,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);
|
||||
|
@ -4334,6 +4350,11 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
|
|||
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);
|
||||
|
@ -4342,6 +4363,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
|
||||
|
|
|
@ -99,6 +99,11 @@ int32_t getEndCondIndex(bool* pEnd, int32_t start, int32_t rows) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int32_t reuseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI) {
|
||||
pAPI->streamStateReleaseBuf(pState, pPos, true);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupId, bool* pStart, bool* pEnd, int32_t index, int32_t rows, SEventWindowInfo* pCurWin, SSessionKey* pNextWinKey) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t size = pAggSup->resultRowSize;
|
||||
|
@ -143,6 +148,7 @@ void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupI
|
|||
pCurWin->winInfo.isOutput = false;
|
||||
|
||||
_end:
|
||||
reuseOutputBuf(pAggSup->pState, pCurWin->winInfo.pStatePos, &pAggSup->stateStore);
|
||||
pAggSup->stateStore.streamStateCurNext(pAggSup->pState, pCur);
|
||||
pNextWinKey->groupId = groupId;
|
||||
code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, pNextWinKey, NULL, 0);
|
||||
|
@ -341,6 +347,7 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl
|
|||
}
|
||||
|
||||
if (isWindowIncomplete(&curWin)) {
|
||||
releaseOutputBuf(pAggSup->pState, curWin.winInfo.pStatePos, &pAggSup->stateStore);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -221,7 +221,7 @@ static bool doDeleteWindow(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId)
|
|||
static int32_t getChildIndex(SSDataBlock* pBlock) { return pBlock->info.childId; }
|
||||
|
||||
static void doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, SSDataBlock* pBlock, SArray* pUpWins,
|
||||
SSHashObj* pUpdatedMap) {
|
||||
SSHashObj* pUpdatedMap, SHashObj* pInvalidWins) {
|
||||
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
|
||||
SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
|
||||
TSKEY* startTsCols = (TSKEY*)pStartTsCol->pData;
|
||||
|
@ -255,10 +255,15 @@ static void doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, SSDa
|
|||
void* chIds = taosHashGet(pInfo->pPullDataMap, &winRes, sizeof(SWinKey));
|
||||
if (chIds) {
|
||||
int32_t childId = getChildIndex(pBlock);
|
||||
if (pInvalidWins) {
|
||||
qDebug("===stream===save mid delete window:%" PRId64 ",groupId:%" PRId64 ",chId:%d", winRes.ts, winRes.groupId, childId);
|
||||
taosHashPut(pInvalidWins, &winRes, sizeof(SWinKey), NULL, 0);
|
||||
}
|
||||
|
||||
SArray* chArray = *(void**)chIds;
|
||||
int32_t index = taosArraySearchIdx(chArray, &childId, compareInt32Val, TD_EQ);
|
||||
if (index != -1) {
|
||||
qDebug("===stream===try push delete window%" PRId64 "chId:%d ,continue", win.skey, childId);
|
||||
qDebug("===stream===try push delete window:%" PRId64 ",groupId:%" PRId64 ",chId:%d ,continue", win.skey, winGpId, childId);
|
||||
getNextTimeWindow(pInterval, &win, TSDB_ORDER_ASC);
|
||||
continue;
|
||||
}
|
||||
|
@ -413,6 +418,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) {
|
|||
blockDataDestroy(pInfo->pMidRetriveRes);
|
||||
blockDataDestroy(pInfo->pMidPulloverRes);
|
||||
pInfo->stateStore.streamFileStateDestroy(pInfo->pState->pFileState);
|
||||
taosArrayDestroy(pInfo->pMidPullDatas);
|
||||
|
||||
if (pInfo->pState->dump == 1) {
|
||||
taosMemoryFreeClear(pInfo->pState->pTdbState->pOwner);
|
||||
|
@ -642,9 +648,12 @@ static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFina
|
|||
.calWin.skey = nextWin.skey,
|
||||
.calWin.ekey = nextWin.skey};
|
||||
// add pull data request
|
||||
if (savePullWindow(&pull, pPullWins) == TSDB_CODE_SUCCESS) {
|
||||
qDebug("===stream===prepare final retrive for delete window:%" PRId64 ",groupId%" PRId64 ", size:%d", winRes.ts, winRes.groupId, numOfCh);
|
||||
if (IS_MID_INTERVAL_OP(pOperator)) {
|
||||
SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)pOperator->info;
|
||||
taosArrayPush(pInfo->pMidPullDatas, &winRes);
|
||||
} else if (savePullWindow(&pull, pPullWins) == TSDB_CODE_SUCCESS) {
|
||||
addPullWindow(pMap, &winRes, numOfCh);
|
||||
qDebug("===stream===prepare final retrive for delete %" PRId64 ", size:%d", winRes.ts, numOfCh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1191,11 +1200,6 @@ static SSDataBlock* buildIntervalResult(SOperatorInfo* pOperator) {
|
|||
return pInfo->binfo.pRes;
|
||||
}
|
||||
|
||||
if (pInfo->recvPullover) {
|
||||
pInfo->recvPullover = false;
|
||||
printDataBlock(pInfo->pMidPulloverRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
|
||||
return pInfo->pMidPulloverRes;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1273,16 +1277,8 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
|||
|
||||
while (1) {
|
||||
if (isTaskKilled(pTaskInfo)) {
|
||||
if (pInfo->pUpdated != NULL) {
|
||||
pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated);
|
||||
}
|
||||
|
||||
if (pInfo->pUpdatedMap != NULL) {
|
||||
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);
|
||||
|
@ -1301,7 +1297,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
|||
} else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
||||
pBlock->info.type == STREAM_CLEAR) {
|
||||
SArray* delWins = taosArrayInit(8, sizeof(SWinKey));
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap);
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap, NULL);
|
||||
if (IS_FINAL_INTERVAL_OP(pOperator)) {
|
||||
int32_t chId = getChildIndex(pBlock);
|
||||
addRetriveWindow(delWins, pInfo, chId);
|
||||
|
@ -1337,7 +1333,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
|||
pInfo->recvRetrive = true;
|
||||
copyDataBlock(pInfo->pMidRetriveRes, pBlock);
|
||||
pInfo->pMidRetriveRes->info.type = STREAM_MID_RETRIEVE;
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, NULL, pInfo->pUpdatedMap);
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, NULL, pInfo->pUpdatedMap, NULL);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
|
@ -1565,8 +1561,10 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
|
|||
pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT);
|
||||
pInfo->recvRetrive = false;
|
||||
pInfo->pMidRetriveRes = createSpecialDataBlock(STREAM_MID_RETRIEVE);
|
||||
pInfo->recvPullover = false;
|
||||
pInfo->pMidPulloverRes = createSpecialDataBlock(STREAM_MID_RETRIEVE);
|
||||
pInfo->clearState = false;
|
||||
pInfo->pMidPullDatas = taosArrayInit(4, sizeof(SWinKey));
|
||||
|
||||
pOperator->operatorType = pPhyNode->type;
|
||||
if (!IS_FINAL_INTERVAL_OP(pOperator) || numOfChild == 0) {
|
||||
|
@ -1845,11 +1843,6 @@ int32_t releaseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t reuseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI) {
|
||||
pAPI->streamStateReleaseBuf(pState, pPos, true);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void removeSessionResult(SStreamAggSupporter* pAggSup, SSHashObj* pHashMap, SSHashObj* pResMap, SSessionKey* pKey) {
|
||||
SSessionKey key = {0};
|
||||
getSessionHashKey(pKey, &key);
|
||||
|
@ -2495,7 +2488,7 @@ void getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins) {
|
|||
return;
|
||||
}
|
||||
SResultWindowInfo* pWinInfo = taosArrayGet(pAllWins, size - 1);
|
||||
SSessionKey* pSeKey = pWinInfo->pStatePos->pKey;
|
||||
SSessionKey* pSeKey = &pWinInfo->sessionWin;
|
||||
taosArrayPush(pMaxWins, pSeKey);
|
||||
if (pSeKey->groupId == 0) {
|
||||
return;
|
||||
|
@ -2503,7 +2496,7 @@ void getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins) {
|
|||
uint64_t preGpId = pSeKey->groupId;
|
||||
for (int32_t i = size - 2; i >= 0; i--) {
|
||||
pWinInfo = taosArrayGet(pAllWins, i);
|
||||
pSeKey = pWinInfo->pStatePos->pKey;
|
||||
pSeKey = &pWinInfo->sessionWin;
|
||||
if (preGpId != pSeKey->groupId) {
|
||||
taosArrayPush(pMaxWins, pSeKey);
|
||||
preGpId = pSeKey->groupId;
|
||||
|
@ -3979,7 +3972,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
|
|||
|
||||
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
||||
pBlock->info.type == STREAM_CLEAR) {
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, pInfo->pDelWins, pInfo->pUpdatedMap);
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, pInfo->pDelWins, pInfo->pUpdatedMap, NULL);
|
||||
continue;
|
||||
} else if (pBlock->info.type == STREAM_GET_ALL) {
|
||||
pInfo->recvGetAll = true;
|
||||
|
@ -4272,6 +4265,34 @@ static void addMidRetriveWindow(SArray* wins, SHashObj* pMidPullMap, int32_t num
|
|||
}
|
||||
}
|
||||
|
||||
static SSDataBlock* buildMidIntervalResult(SOperatorInfo* pOperator) {
|
||||
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
uint16_t opType = pOperator->operatorType;
|
||||
|
||||
if (pInfo->recvPullover) {
|
||||
pInfo->recvPullover = false;
|
||||
printDataBlock(pInfo->pMidPulloverRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
|
||||
return pInfo->pMidPulloverRes;
|
||||
}
|
||||
|
||||
qDebug("===stream=== build mid interval result");
|
||||
doBuildDeleteResult(pInfo, pInfo->pMidPullDatas, &pInfo->midDelIndex, pInfo->pDelRes);
|
||||
if (pInfo->pDelRes->info.rows != 0) {
|
||||
// process the rest of the data
|
||||
printDataBlock(pInfo->pDelRes, getStreamOpName(opType), GET_TASKID(pTaskInfo));
|
||||
return pInfo->pDelRes;
|
||||
}
|
||||
|
||||
if (pInfo->recvRetrive) {
|
||||
pInfo->recvRetrive = false;
|
||||
printDataBlock(pInfo->pMidRetriveRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
|
||||
return pInfo->pMidRetriveRes;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) {
|
||||
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
|
@ -4300,10 +4321,9 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) {
|
|||
return resBlock;
|
||||
}
|
||||
|
||||
if (pInfo->recvRetrive) {
|
||||
pInfo->recvRetrive = false;
|
||||
printDataBlock(pInfo->pMidRetriveRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
|
||||
return pInfo->pMidRetriveRes;
|
||||
resBlock = buildMidIntervalResult(pOperator);
|
||||
if (resBlock != NULL) {
|
||||
return resBlock;
|
||||
}
|
||||
|
||||
if (pInfo->clearState) {
|
||||
|
@ -4323,16 +4343,8 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) {
|
|||
|
||||
while (1) {
|
||||
if (isTaskKilled(pTaskInfo)) {
|
||||
if (pInfo->pUpdated != NULL) {
|
||||
pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated);
|
||||
}
|
||||
|
||||
if (pInfo->pUpdatedMap != NULL) {
|
||||
tSimpleHashCleanup(pInfo->pUpdatedMap);
|
||||
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);
|
||||
|
@ -4351,7 +4363,7 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) {
|
|||
} else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
||||
pBlock->info.type == STREAM_CLEAR) {
|
||||
SArray* delWins = taosArrayInit(8, sizeof(SWinKey));
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap);
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap, pInfo->pFinalPullDataMap);
|
||||
removeResults(delWins, pInfo->pUpdatedMap);
|
||||
taosArrayAddAll(pInfo->pDelWins, delWins);
|
||||
taosArrayDestroy(delWins);
|
||||
|
@ -4387,7 +4399,7 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) {
|
|||
continue;
|
||||
} else if (pBlock->info.type == STREAM_MID_RETRIEVE) {
|
||||
SArray* delWins = taosArrayInit(8, sizeof(SWinKey));
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap);
|
||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap, NULL);
|
||||
addMidRetriveWindow(delWins, pInfo->pPullDataMap, pInfo->numOfChild);
|
||||
taosArrayDestroy(delWins);
|
||||
pInfo->recvRetrive = true;
|
||||
|
@ -4432,10 +4444,9 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) {
|
|||
return resBlock;
|
||||
}
|
||||
|
||||
if (pInfo->recvRetrive) {
|
||||
pInfo->recvRetrive = false;
|
||||
printDataBlock(pInfo->pMidRetriveRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
|
||||
return pInfo->pMidRetriveRes;
|
||||
resBlock = buildMidIntervalResult(pOperator);
|
||||
if (resBlock != NULL) {
|
||||
return resBlock;
|
||||
}
|
||||
|
||||
if (pInfo->clearState) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "executorInt.h"
|
||||
#include "geosWrapper.h"
|
||||
#include "filter.h"
|
||||
#include "functionMgt.h"
|
||||
#include "querynodes.h"
|
||||
|
@ -811,6 +812,8 @@ int32_t convertTagDataToStr(char* str, int type, void* buf, int32_t bufSize, int
|
|||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_BINARY:
|
||||
case TSDB_DATA_TYPE_VARBINARY:
|
||||
case TSDB_DATA_TYPE_GEOMETRY:
|
||||
if (bufSize < 0) {
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
|
@ -854,6 +857,30 @@ int32_t convertTagDataToStr(char* str, int type, void* buf, int32_t bufSize, int
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t sysTableGetGeomText(char* iGeom, int32_t nGeom, char** output, int32_t* nOutput) {
|
||||
int32_t code = 0;
|
||||
char* outputWKT = NULL;
|
||||
|
||||
if (nGeom == 0) {
|
||||
if (!(*output = strdup(""))) code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
*nOutput = 0;
|
||||
return code;
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != (code = initCtxAsText()) ||
|
||||
TSDB_CODE_SUCCESS != (code = doAsText(iGeom, nGeom, &outputWKT))) {
|
||||
qError("geo text for systable failed:%s", getThreadLocalGeosCtx()->errMsg);
|
||||
*output = NULL;
|
||||
*nOutput = 0;
|
||||
return code;
|
||||
}
|
||||
|
||||
*output = outputWKT;
|
||||
*nOutput = strlen(outputWKT);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, SMetaReader* smrSuperTable,
|
||||
SMetaReader* smrChildTable, const char* dbname, const char* tableName,
|
||||
int32_t* pNumOfRows, const SSDataBlock* dataBlock) {
|
||||
|
@ -889,13 +916,13 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo,
|
|||
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 4);
|
||||
char tagTypeStr[VARSTR_HEADER_SIZE + 32];
|
||||
int tagTypeLen = sprintf(varDataVal(tagTypeStr), "%s", tDataTypes[tagType].name);
|
||||
if (tagType == TSDB_DATA_TYPE_VARCHAR) {
|
||||
tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)",
|
||||
(int32_t)((*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE));
|
||||
} else if (tagType == TSDB_DATA_TYPE_NCHAR) {
|
||||
if (tagType == TSDB_DATA_TYPE_NCHAR) {
|
||||
tagTypeLen += sprintf(
|
||||
varDataVal(tagTypeStr) + tagTypeLen, "(%d)",
|
||||
(int32_t)(((*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
|
||||
} else if (IS_VAR_DATA_TYPE(tagType)) {
|
||||
tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)",
|
||||
(int32_t)((*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE));
|
||||
}
|
||||
varDataSetLen(tagTypeStr, tagTypeLen);
|
||||
colDataSetVal(pColInfoData, numOfRows, (char*)tagTypeStr, false);
|
||||
|
@ -910,7 +937,13 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo,
|
|||
} else {
|
||||
bool exist = tTagGet((STag*)smrChildTable->me.ctbEntry.pTags, &tagVal);
|
||||
if (exist) {
|
||||
if (IS_VAR_DATA_TYPE(tagType)) {
|
||||
if (tagType == TSDB_DATA_TYPE_GEOMETRY) {
|
||||
sysTableGetGeomText(tagVal.pData, tagVal.nData, &tagData, &tagLen);
|
||||
} else if (tagType == TSDB_DATA_TYPE_VARBINARY) {
|
||||
if (taosAscii2Hex(tagVal.pData, tagVal.nData, (void**)&tagData, &tagLen) < 0) {
|
||||
qError("varbinary for systable failed since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
}
|
||||
} else if (IS_VAR_DATA_TYPE(tagType)) {
|
||||
tagData = (char*)tagVal.pData;
|
||||
tagLen = tagVal.nData;
|
||||
} else {
|
||||
|
@ -940,6 +973,7 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo,
|
|||
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 5);
|
||||
colDataSetVal(pColInfoData, numOfRows, tagVarChar,
|
||||
(tagData == NULL) || (tagType == TSDB_DATA_TYPE_JSON && tTagIsJsonNull(tagData)));
|
||||
if (tagType == TSDB_DATA_TYPE_GEOMETRY || tagType == TSDB_DATA_TYPE_VARBINARY) taosMemoryFreeClear(tagData);
|
||||
taosMemoryFree(tagVarChar);
|
||||
++numOfRows;
|
||||
}
|
||||
|
|
|
@ -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,6 +1636,9 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
|
|||
}
|
||||
taosArrayDestroy(aExtSrc);
|
||||
tSimpleHashCleanup(mTableNumRows);
|
||||
if (pHandle->bSortByRowId) {
|
||||
tsortFinalizeRegions(pHandle);
|
||||
}
|
||||
pHandle->type = SORT_SINGLESOURCE_SORT;
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -199,6 +199,7 @@ int32_t doAsText(const unsigned char *inputGeom, size_t size, char **outputWKT)
|
|||
|
||||
wkt = GEOSWKTWriter_write_r(geosCtx->handle, geosCtx->WKTWriter, geom);
|
||||
if (wkt == NULL) {
|
||||
code = TSDB_CODE_MSG_DECODE_ERROR;
|
||||
goto _exit;
|
||||
}
|
||||
*outputWKT = wkt;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -699,6 +699,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;
|
||||
|
@ -749,6 +750,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;
|
||||
}
|
||||
|
||||
|
@ -800,7 +804,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;
|
||||
}
|
||||
|
@ -1896,6 +1903,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;
|
||||
|
@ -1973,6 +1981,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;
|
||||
}
|
||||
|
||||
|
@ -2052,6 +2063,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,8 @@ SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode
|
|||
|
||||
SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName);
|
||||
SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral);
|
||||
SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pNode);
|
||||
SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pLeft, SNode *pRight);
|
||||
SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||
SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral);
|
||||
SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||
|
|
|
@ -24,6 +24,15 @@ extern "C" {
|
|||
|
||||
#include "ttokendef.h"
|
||||
|
||||
#define IS_TRUE_STR(s, n) \
|
||||
(n == 4 && (*(s) == 't' || *(s) == 'T') && (*((s) + 1) == 'r' || *((s) + 1) == 'R') && \
|
||||
(*((s) + 2) == 'u' || *((s) + 2) == 'U') && (*((s) + 3) == 'e' || *((s) + 3) == 'E'))
|
||||
|
||||
#define IS_FALSE_STR(s, n) \
|
||||
(n == 5 && (*(s) == 'f' || *(s) == 'F') && (*((s) + 1) == 'a' || *((s) + 1) == 'A') && \
|
||||
(*((s) + 2) == 'l' || *((s) + 2) == 'L') && (*((s) + 3) == 's' || *((s) + 3) == 'S') && \
|
||||
(*((s) + 4) == 'e' || *((s) + 4) == 'E'))
|
||||
|
||||
// used to denote the minimum unite in sql parsing
|
||||
typedef struct SToken {
|
||||
uint32_t n;
|
||||
|
|
|
@ -23,6 +23,7 @@ extern "C" {
|
|||
#include "catalog.h"
|
||||
#include "os.h"
|
||||
#include "parser.h"
|
||||
#include "parToken.h"
|
||||
#include "query.h"
|
||||
|
||||
#define parserFatal(param, ...) qFatal("PARSER: " param, ##__VA_ARGS__)
|
||||
|
@ -35,6 +36,45 @@ extern "C" {
|
|||
#define ROWTS_PSEUDO_COLUMN_NAME "_rowts"
|
||||
#define C0_PSEUDO_COLUMN_NAME "_c0"
|
||||
|
||||
#define IS_NOW_STR(s, n) \
|
||||
((*(s) == 'n' || *(s) == 'N') && (*((s) + 1) == 'o' || *((s) + 1) == 'O') && \
|
||||
(*((s) + 2) == 'w' || *((s) + 2) == 'W') && (n == 3 || (n == 5 && *((s) + 3) == '(' && *((s) + 4) == ')')))
|
||||
|
||||
#define IS_TODAY_STR(s, n) \
|
||||
((*(s) == 't' || *(s) == 'T') && (*((s) + 1) == 'o' || *((s) + 1) == 'O') && \
|
||||
(*((s) + 2) == 'd' || *((s) + 2) == 'D') && (*((s) + 3) == 'a' || *((s) + 3) == 'A') && \
|
||||
(*((s) + 4) == 'y' || *((s) + 4) == 'Y') && (n == 5 || (n == 7 && *((s) + 5) == '(' && *((s) + 6) == ')')))
|
||||
|
||||
#define IS_NULL_STR(s, n) \
|
||||
(n == 4 && (*(s) == 'N' || *(s) == 'n') && (*((s) + 1) == 'U' || *((s) + 1) == 'u') && \
|
||||
(*((s) + 2) == 'L' || *((s) + 2) == 'l') && (*((s) + 3) == 'L' || *((s) + 3) == 'l'))
|
||||
|
||||
#define NEXT_TOKEN_WITH_PREV(pSql, token) \
|
||||
do { \
|
||||
int32_t index = 0; \
|
||||
token = tStrGetToken(pSql, &index, true, NULL); \
|
||||
pSql += index; \
|
||||
} while (0)
|
||||
|
||||
#define NEXT_TOKEN_WITH_PREV_EXT(pSql, token, pIgnoreComma) \
|
||||
do { \
|
||||
int32_t index = 0; \
|
||||
token = tStrGetToken(pSql, &index, true, pIgnoreComma); \
|
||||
pSql += index; \
|
||||
} while (0)
|
||||
|
||||
#define NEXT_TOKEN_KEEP_SQL(pSql, token, index) \
|
||||
do { \
|
||||
token = tStrGetToken(pSql, &index, false, NULL); \
|
||||
} while (0)
|
||||
|
||||
#define NEXT_VALID_TOKEN(pSql, token) \
|
||||
do { \
|
||||
(token).n = tGetToken(pSql, &(token).type); \
|
||||
(token).z = (char*)pSql; \
|
||||
pSql += (token).n; \
|
||||
} while (TK_NK_SPACE == (token).type)
|
||||
|
||||
typedef struct SMsgBuf {
|
||||
int32_t len;
|
||||
char* buf;
|
||||
|
@ -89,6 +129,9 @@ int32_t getTableTypeFromTableNode(SNode *pTable);
|
|||
|
||||
int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen);
|
||||
int32_t getVnodeSysTableTargetName(int32_t acctId, SNode* pWhere, SName* pName);
|
||||
int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type);
|
||||
int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SSchema* pTagSchema, SToken* pToken,
|
||||
SArray* pTagName, SArray* pTagVals, STag** pTag);
|
||||
|
||||
int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalogReq);
|
||||
int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMetaData, SParseMetaCache* pMetaCache);
|
||||
|
|
|
@ -354,7 +354,7 @@ alter_table_clause(A) ::=
|
|||
alter_table_clause(A) ::=
|
||||
full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); }
|
||||
alter_table_clause(A) ::=
|
||||
full_table_name(B) SET TAG column_name(C) NK_EQ signed_literal(D). { A = createAlterTableSetTag(pCxt, B, &C, D); }
|
||||
full_table_name(B) SET TAG column_name(C) NK_EQ tags_literal(D). { A = createAlterTableSetTag(pCxt, B, &C, D); }
|
||||
|
||||
%type multi_create_clause { SNodeList* }
|
||||
%destructor multi_create_clause { nodesDestroyList($$); }
|
||||
|
@ -363,7 +363,7 @@ multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C).
|
|||
|
||||
create_subtable_clause(A) ::=
|
||||
not_exists_opt(B) full_table_name(C) USING full_table_name(D)
|
||||
specific_cols_opt(E) TAGS NK_LP expression_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); }
|
||||
specific_cols_opt(E) TAGS NK_LP tags_literal_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); }
|
||||
|
||||
%type multi_drop_clause { SNodeList* }
|
||||
%destructor multi_drop_clause { nodesDestroyList($$); }
|
||||
|
@ -744,6 +744,76 @@ insert_query(A) ::= INSERT INTO full_table_name(D)
|
|||
NK_LP col_name_list(B) NK_RP query_or_subquery(C). { A = createInsertStmt(pCxt, D, B, C); }
|
||||
insert_query(A) ::= INSERT INTO full_table_name(C) query_or_subquery(B). { A = createInsertStmt(pCxt, C, NULL, B); }
|
||||
|
||||
/************************************************ tags_literal *************************************************************/
|
||||
tags_literal(A) ::= NK_INTEGER(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); }
|
||||
tags_literal(A) ::= NK_PLUS(B) NK_INTEGER(C). {
|
||||
SToken t = B;
|
||||
t.n = (C.z + C.n) - B.z;
|
||||
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
|
||||
}
|
||||
tags_literal(A) ::= NK_MINUS(B) NK_INTEGER(C). {
|
||||
SToken t = B;
|
||||
t.n = (C.z + C.n) - B.z;
|
||||
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
|
||||
}
|
||||
tags_literal(A) ::= NK_FLOAT(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B, NULL); }
|
||||
tags_literal(A) ::= NK_PLUS(B) NK_FLOAT(C). {
|
||||
SToken t = B;
|
||||
t.n = (C.z + C.n) - B.z;
|
||||
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
|
||||
}
|
||||
tags_literal(A) ::= NK_MINUS(B) NK_FLOAT(C). {
|
||||
SToken t = B;
|
||||
t.n = (C.z + C.n) - B.z;
|
||||
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
|
||||
}
|
||||
|
||||
tags_literal(A) ::= NK_BIN(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); }
|
||||
tags_literal(A) ::= NK_PLUS(B) NK_BIN(C). {
|
||||
SToken t = B;
|
||||
t.n = (C.z + C.n) - B.z;
|
||||
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
|
||||
}
|
||||
tags_literal(A) ::= NK_MINUS(B) NK_BIN(C). {
|
||||
SToken t = B;
|
||||
t.n = (C.z + C.n) - B.z;
|
||||
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
|
||||
}
|
||||
tags_literal(A) ::= NK_HEX(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); }
|
||||
tags_literal(A) ::= NK_PLUS(B) NK_HEX(C). {
|
||||
SToken t = B;
|
||||
t.n = (C.z + C.n) - B.z;
|
||||
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
|
||||
}
|
||||
tags_literal(A) ::= NK_MINUS(B) NK_HEX(C). {
|
||||
SToken t = B;
|
||||
t.n = (C.z + C.n) - B.z;
|
||||
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
|
||||
}
|
||||
|
||||
tags_literal(A) ::= NK_STRING(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B, NULL); }
|
||||
tags_literal(A) ::= NK_BOOL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B, NULL); }
|
||||
tags_literal(A) ::= NULL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B, NULL); }
|
||||
|
||||
tags_literal(A) ::= literal_func(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, B); }
|
||||
tags_literal(A) ::= literal_func(B) NK_PLUS duration_literal(C). {
|
||||
SToken l = getTokenFromRawExprNode(pCxt, B);
|
||||
SToken r = getTokenFromRawExprNode(pCxt, C);
|
||||
l.n = (r.z + r.n) - l.z;
|
||||
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, B, C);
|
||||
}
|
||||
tags_literal(A) ::= literal_func(B) NK_MINUS duration_literal(C). {
|
||||
SToken l = getTokenFromRawExprNode(pCxt, B);
|
||||
SToken r = getTokenFromRawExprNode(pCxt, C);
|
||||
l.n = (r.z + r.n) - l.z;
|
||||
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, B, C);
|
||||
}
|
||||
|
||||
%type tags_literal_list { SNodeList* }
|
||||
%destructor tags_literal_list { nodesDestroyList($$); }
|
||||
tags_literal_list(A) ::= tags_literal(B). { A = createNodeList(pCxt, B); }
|
||||
tags_literal_list(A) ::= tags_literal_list(B) NK_COMMA tags_literal(C). { A = addNodeToList(pCxt, B, C); }
|
||||
|
||||
/************************************************ literal *************************************************************/
|
||||
literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B)); }
|
||||
literal(A) ::= NK_FLOAT(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B)); }
|
||||
|
@ -924,6 +994,7 @@ function_expression(A) ::= literal_func(B).
|
|||
|
||||
literal_func(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
|
||||
literal_func(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
|
||||
literal_func(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
|
||||
|
||||
%type noarg_func { SToken }
|
||||
%destructor noarg_func { }
|
||||
|
|
|
@ -371,6 +371,80 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken*
|
|||
return (SNode*)val;
|
||||
}
|
||||
|
||||
SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pNode) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
SValueNode* val = NULL;
|
||||
|
||||
if (!(val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE))) {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY, "Out of memory");
|
||||
goto _exit;
|
||||
}
|
||||
if (pLiteral) {
|
||||
val->literal = strndup(pLiteral->z, pLiteral->n);
|
||||
} else if (pNode) {
|
||||
SRawExprNode* pRawExpr = (SRawExprNode*)pNode;
|
||||
if (!nodesIsExprNode(pRawExpr->pNode)) {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, pRawExpr->p);
|
||||
goto _exit;
|
||||
}
|
||||
val->literal = strndup(pRawExpr->p, pRawExpr->n);
|
||||
} else {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTERNAL_ERROR, "Invalid parameters");
|
||||
goto _exit;
|
||||
}
|
||||
if (!val->literal) {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY, "Out of memory");
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
val->node.resType.type = dataType;
|
||||
val->node.resType.bytes = IS_VAR_DATA_TYPE(dataType) ? strlen(val->literal) : tDataTypes[dataType].bytes;
|
||||
if (TSDB_DATA_TYPE_TIMESTAMP == dataType) {
|
||||
val->node.resType.precision = TSDB_TIME_PRECISION_MILLI;
|
||||
}
|
||||
_exit:
|
||||
nodesDestroyNode(pNode);
|
||||
if (pCxt->errCode != 0) {
|
||||
nodesDestroyNode((SNode*)val);
|
||||
return NULL;
|
||||
}
|
||||
return (SNode*)val;
|
||||
}
|
||||
|
||||
SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pLeft,
|
||||
SNode* pRight) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
SValueNode* val = NULL;
|
||||
|
||||
if (!(val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE))) {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY, "Out of memory");
|
||||
goto _exit;
|
||||
}
|
||||
if (pLiteral) {
|
||||
if (!(val->literal = strndup(pLiteral->z, pLiteral->n))) {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY, "Out of memory");
|
||||
goto _exit;
|
||||
}
|
||||
} else {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTERNAL_ERROR, "Invalid parameters");
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
val->node.resType.type = dataType;
|
||||
val->node.resType.bytes = IS_VAR_DATA_TYPE(dataType) ? strlen(val->literal) : tDataTypes[dataType].bytes;
|
||||
if (TSDB_DATA_TYPE_TIMESTAMP == dataType) {
|
||||
val->node.resType.precision = TSDB_TIME_PRECISION_MILLI;
|
||||
}
|
||||
_exit:
|
||||
nodesDestroyNode(pLeft);
|
||||
nodesDestroyNode(pRight);
|
||||
if (pCxt->errCode != 0) {
|
||||
nodesDestroyNode((SNode*)val);
|
||||
return NULL;
|
||||
}
|
||||
return (SNode*)val;
|
||||
}
|
||||
|
||||
static bool hasHint(SNodeList* pHintList, EHintOption hint) {
|
||||
if (!pHintList) return false;
|
||||
SNode* pNode;
|
||||
|
@ -404,6 +478,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 +567,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) {
|
||||
|
|
|
@ -72,9 +72,7 @@ int32_t parse(SParseContext* pParseCxt, SQuery** pQuery) {
|
|||
cxt.errCode = TSDB_CODE_PAR_SYNTAX_ERROR;
|
||||
goto abort_parse;
|
||||
}
|
||||
case TK_NK_HEX:
|
||||
case TK_NK_OCT:
|
||||
case TK_NK_BIN: {
|
||||
case TK_NK_OCT: {
|
||||
snprintf(cxt.pQueryCxt->pMsg, cxt.pQueryCxt->msgLen, "unsupported token: \"%s\"", t0.z);
|
||||
cxt.errCode = TSDB_CODE_PAR_SYNTAX_ERROR;
|
||||
goto abort_parse;
|
||||
|
|
|
@ -20,32 +20,6 @@
|
|||
#include "ttime.h"
|
||||
#include "geosWrapper.h"
|
||||
|
||||
#define NEXT_TOKEN_WITH_PREV(pSql, token) \
|
||||
do { \
|
||||
int32_t index = 0; \
|
||||
token = tStrGetToken(pSql, &index, true, NULL); \
|
||||
pSql += index; \
|
||||
} while (0)
|
||||
|
||||
#define NEXT_TOKEN_WITH_PREV_EXT(pSql, token, pIgnoreComma) \
|
||||
do { \
|
||||
int32_t index = 0; \
|
||||
token = tStrGetToken(pSql, &index, true, pIgnoreComma); \
|
||||
pSql += index; \
|
||||
} while (0)
|
||||
|
||||
#define NEXT_TOKEN_KEEP_SQL(pSql, token, index) \
|
||||
do { \
|
||||
token = tStrGetToken(pSql, &index, false, NULL); \
|
||||
} while (0)
|
||||
|
||||
#define NEXT_VALID_TOKEN(pSql, token) \
|
||||
do { \
|
||||
(token).n = tGetToken(pSql, &(token).type); \
|
||||
(token).z = (char*)pSql; \
|
||||
pSql += (token).n; \
|
||||
} while (TK_NK_SPACE == (token).type)
|
||||
|
||||
typedef struct SInsertParseContext {
|
||||
SParseContext* pComCxt;
|
||||
SMsgBuf msg;
|
||||
|
@ -63,13 +37,9 @@ typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void* value, int32_t
|
|||
static uint8_t TRUE_VALUE = (uint8_t)TSDB_TRUE;
|
||||
static uint8_t FALSE_VALUE = (uint8_t)TSDB_FALSE;
|
||||
|
||||
static bool isNullStr(SToken* pToken) {
|
||||
return ((pToken->type == TK_NK_STRING) && (strlen(TSDB_DATA_NULL_STR_L) == pToken->n) &&
|
||||
(strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0));
|
||||
}
|
||||
|
||||
static bool isNullValue(int8_t dataType, SToken* pToken) {
|
||||
return TK_NULL == pToken->type || (!IS_STR_DATA_TYPE(dataType) && isNullStr(pToken));
|
||||
static FORCE_INLINE bool isNullValue(int8_t dataType, SToken* pToken) {
|
||||
return TK_NULL == pToken->type ||
|
||||
(TK_NK_STRING == pToken->type && !IS_STR_DATA_TYPE(dataType) && IS_NULL_STR(pToken->z, pToken->n));
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t toDouble(SToken* pToken, double* value, char** endPtr) {
|
||||
|
@ -268,7 +238,8 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, E
|
|||
return code;
|
||||
}
|
||||
|
||||
static int parseTimestampOrInterval(const char** end, SToken* pToken, int16_t timePrec, int64_t* ts, int64_t* interval, SMsgBuf* pMsgBuf, bool* isTs) {
|
||||
static int parseTimestampOrInterval(const char** end, SToken* pToken, int16_t timePrec, int64_t* ts, int64_t* interval,
|
||||
SMsgBuf* pMsgBuf, bool* isTs) {
|
||||
if (pToken->type == TK_NOW) {
|
||||
*isTs = true;
|
||||
*ts = taosGetTimestamp(timePrec);
|
||||
|
@ -289,7 +260,21 @@ static int parseTimestampOrInterval(const char** end, SToken* pToken, int16_t ti
|
|||
} else { // parse the RFC-3339/ISO-8601 timestamp format string
|
||||
*isTs = true;
|
||||
if (taosParseTime(pToken->z, ts, pToken->n, timePrec, tsDaylight) != TSDB_CODE_SUCCESS) {
|
||||
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z);
|
||||
if ((pToken->n == 0) ||
|
||||
(pToken->type != TK_NK_STRING && pToken->type != TK_NK_HEX && pToken->type != TK_NK_BIN)) {
|
||||
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z);
|
||||
}
|
||||
if (IS_NOW_STR(pToken->z, pToken->n)) {
|
||||
*isTs = true;
|
||||
*ts = taosGetTimestamp(timePrec);
|
||||
} else if (IS_TODAY_STR(pToken->z, pToken->n)) {
|
||||
*isTs = true;
|
||||
*ts = taosGetTimestampToday(timePrec);
|
||||
} else if (TSDB_CODE_SUCCESS == toIntegerPure(pToken->z, pToken->n, 10, ts)) {
|
||||
*isTs = true;
|
||||
} else {
|
||||
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,10 +298,22 @@ static int parseTime(const char** end, SToken* pToken, int16_t timePrec, int64_t
|
|||
|
||||
for (int k = pToken->n; pToken->z[k] != '\0'; k++) {
|
||||
if (pToken->z[k] == ' ' || pToken->z[k] == '\t') continue;
|
||||
if (pToken->z[k] == '(' && pToken->z[k + 1] == ')') { // for insert NOW()/TODAY()
|
||||
*end = pTokenEnd = &pToken->z[k + 2];
|
||||
k++;
|
||||
continue;
|
||||
if (pToken->z[k] == '(') { // for insert NOW()/TODAY()
|
||||
if (pToken->z[k + 1] == ')') {
|
||||
*end = pTokenEnd = &pToken->z[k + 2];
|
||||
++k;
|
||||
continue;
|
||||
} else {
|
||||
char nc = pToken->z[k + 1];
|
||||
while (nc == ' ' || nc == '\t' || nc == '\n' || nc == '\r' || nc == '\f') {
|
||||
nc = pToken->z[(++k) + 1];
|
||||
}
|
||||
if (nc == ')') {
|
||||
*end = pTokenEnd = &pToken->z[k + 2];
|
||||
++k;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pToken->z[k] == ',') {
|
||||
*end = pTokenEnd;
|
||||
|
@ -491,10 +488,12 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
|
|||
switch (pSchema->type) {
|
||||
case TSDB_DATA_TYPE_BOOL: {
|
||||
if ((pToken->type == TK_NK_BOOL || pToken->type == TK_NK_STRING) && (pToken->n != 0)) {
|
||||
if (strncmp(pToken->z, "true", pToken->n) == 0) {
|
||||
if (IS_TRUE_STR(pToken->z, pToken->n)) {
|
||||
*(int8_t*)(&val->i64) = TRUE_VALUE;
|
||||
} else if (strncmp(pToken->z, "false", pToken->n) == 0) {
|
||||
} else if (IS_FALSE_STR(pToken->z, pToken->n)) {
|
||||
*(int8_t*)(&val->i64) = FALSE_VALUE;
|
||||
} else if (TSDB_CODE_SUCCESS == toDoubleEx(pToken->z, pToken->n, pToken->type, (double*)&iv)) {
|
||||
*(int8_t*)(&val->i64) = (*(double*)&iv == 0 ? FALSE_VALUE : TRUE_VALUE);
|
||||
} else {
|
||||
return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z);
|
||||
}
|
||||
|
@ -502,6 +501,9 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
|
|||
*(int8_t*)(&val->i64) = ((taosStr2Int64(pToken->z, NULL, 10) == 0) ? FALSE_VALUE : TRUE_VALUE);
|
||||
} else if (pToken->type == TK_NK_FLOAT) {
|
||||
*(int8_t*)(&val->i64) = ((taosStr2Double(pToken->z, NULL) == 0) ? FALSE_VALUE : TRUE_VALUE);
|
||||
} else if ((pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN) &&
|
||||
(TSDB_CODE_SUCCESS == toDoubleEx(pToken->z, pToken->n, pToken->type, (double*)&iv))) {
|
||||
*(int8_t*)(&val->i64) = (*(double*)&iv == 0 ? FALSE_VALUE : TRUE_VALUE);
|
||||
} else {
|
||||
return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z);
|
||||
}
|
||||
|
@ -709,30 +711,29 @@ static int32_t parseBoundTagsClause(SInsertParseContext* pCxt, SVnodeModifyOpStm
|
|||
return parseBoundColumns(pCxt, &pStmt->pSql, BOUND_TAGS, pStmt->pTableMeta, &pCxt->tags);
|
||||
}
|
||||
|
||||
static int32_t parseTagValue(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, const char** ppSql, SSchema* pTagSchema, SToken* pToken,
|
||||
SArray* pTagName, SArray* pTagVals, STag** pTag) {
|
||||
int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SSchema* pTagSchema, SToken* pToken,
|
||||
SArray* pTagName, SArray* pTagVals, STag** pTag) {
|
||||
bool isNull = isNullValue(pTagSchema->type, pToken);
|
||||
if (!isNull) {
|
||||
if (!isNull && pTagName) {
|
||||
taosArrayPush(pTagName, pTagSchema->name);
|
||||
}
|
||||
|
||||
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||
if (pToken->n > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "json string too long than 4095", pToken->z);
|
||||
return buildSyntaxErrMsg(pMsgBuf, "json string too long than 4095", pToken->z);
|
||||
}
|
||||
|
||||
if (isNull) {
|
||||
return tTagNew(pTagVals, 1, true, pTag);
|
||||
} else {
|
||||
return parseJsontoTagData(pToken->z, pTagVals, pTag, &pCxt->msg);
|
||||
return parseJsontoTagData(pToken->z, pTagVals, pTag, pMsgBuf);
|
||||
}
|
||||
}
|
||||
|
||||
if (isNull) return 0;
|
||||
|
||||
STagVal val = {0};
|
||||
int32_t code =
|
||||
parseTagToken(ppSql, pToken, pTagSchema, pStmt->pTableMeta->tableInfo.precision, &val, &pCxt->msg);
|
||||
int32_t code = parseTagToken(pSql, pToken, pTagSchema, precision, &val, pMsgBuf);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
taosArrayPush(pTagVals, &val);
|
||||
}
|
||||
|
@ -755,7 +756,7 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) {
|
||||
int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) {
|
||||
if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER &&
|
||||
pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL &&
|
||||
pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT &&
|
||||
|
@ -911,12 +912,20 @@ static int32_t checkSubtablePrivilege(SArray* pTagVals, SArray* pTagName, SNode*
|
|||
static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SSchema* pSchema = getTableTagSchema(pStmt->pTableMeta);
|
||||
SArray* pTagVals = taosArrayInit(pCxt->tags.numOfBound, sizeof(STagVal));
|
||||
SArray* pTagName = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
||||
SArray* pTagVals = NULL;
|
||||
SArray* pTagName = NULL;
|
||||
uint8_t precision = pStmt->pTableMeta->tableInfo.precision;
|
||||
SToken token;
|
||||
bool isParseBindParam = false;
|
||||
bool isJson = false;
|
||||
STag* pTag = NULL;
|
||||
|
||||
if (!(pTagVals = taosArrayInit(pCxt->tags.numOfBound, sizeof(STagVal))) ||
|
||||
!(pTagName = taosArrayInit(pCxt->tags.numOfBound, TSDB_COL_NAME_LEN))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
for (int i = 0; TSDB_CODE_SUCCESS == code && i < pCxt->tags.numOfBound; ++i) {
|
||||
NEXT_TOKEN_WITH_PREV(pStmt->pSql, token);
|
||||
|
||||
|
@ -938,11 +947,11 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt
|
|||
SSchema* pTagSchema = &pSchema[pCxt->tags.pColIndex[i]];
|
||||
isJson = pTagSchema->type == TSDB_DATA_TYPE_JSON;
|
||||
code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
|
||||
if (TK_NK_VARIABLE == token.type) {
|
||||
if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
|
||||
code = buildSyntaxErrMsg(&pCxt->msg, "not expected tags values ", token.z);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = parseTagValue(pCxt, pStmt, &pStmt->pSql, pTagSchema, &token, pTagName, pTagVals, &pTag);
|
||||
code = parseTagValue(&pCxt->msg, &pStmt->pSql, precision, pTagSchema, &token, pTagName, pTagVals, &pTag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -959,8 +968,9 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt
|
|||
pTag = NULL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < taosArrayGetSize(pTagVals); ++i) {
|
||||
STagVal* p = (STagVal*)taosArrayGet(pTagVals, i);
|
||||
_exit:
|
||||
for (int32_t i = 0; i < TARRAY_SIZE(pTagVals); ++i) {
|
||||
STagVal* p = (STagVal*)TARRAY_GET_ELEM(pTagVals, i);
|
||||
if (IS_VAR_DATA_TYPE(p->type)) {
|
||||
taosMemoryFreeClear(p->pData);
|
||||
}
|
||||
|
@ -1425,10 +1435,12 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
switch (pSchema->type) {
|
||||
case TSDB_DATA_TYPE_BOOL: {
|
||||
if ((pToken->type == TK_NK_BOOL || pToken->type == TK_NK_STRING) && (pToken->n != 0)) {
|
||||
if (strncmp(pToken->z, "true", pToken->n) == 0) {
|
||||
if (IS_TRUE_STR(pToken->z, pToken->n)) {
|
||||
pVal->value.val = TRUE_VALUE;
|
||||
} else if (strncmp(pToken->z, "false", pToken->n) == 0) {
|
||||
} else if (IS_FALSE_STR(pToken->z, pToken->n)) {
|
||||
pVal->value.val = FALSE_VALUE;
|
||||
} else if (TSDB_CODE_SUCCESS == toDoubleEx(pToken->z, pToken->n, pToken->type, (double*)&pVal->value.val)) {
|
||||
*(int8_t*)(&pVal->value.val) = (*(double*)&pVal->value.val == 0 ? FALSE_VALUE : TRUE_VALUE);
|
||||
} else {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "invalid bool data", pToken->z);
|
||||
}
|
||||
|
@ -1436,6 +1448,9 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
pVal->value.val = ((taosStr2Int64(pToken->z, NULL, 10) == 0) ? FALSE_VALUE : TRUE_VALUE);
|
||||
} else if (pToken->type == TK_NK_FLOAT) {
|
||||
pVal->value.val = ((taosStr2Double(pToken->z, NULL) == 0) ? FALSE_VALUE : TRUE_VALUE);
|
||||
} else if ((pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN) &&
|
||||
(TSDB_CODE_SUCCESS == toDoubleEx(pToken->z, pToken->n, pToken->type, (double*)&pVal->value.val))) {
|
||||
*(int8_t*)(&pVal->value.val) = (*(double*)&pVal->value.val == 0 ? FALSE_VALUE : TRUE_VALUE);
|
||||
} else {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "invalid bool data", pToken->z);
|
||||
}
|
||||
|
@ -1510,7 +1525,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
double dv;
|
||||
double dv;
|
||||
int32_t code = toDoubleEx(pToken->z, pToken->n, pToken->type, &dv);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "illegal float data", pToken->z);
|
||||
|
@ -1523,7 +1538,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
double dv;
|
||||
double dv;
|
||||
int32_t code = toDoubleEx(pToken->z, pToken->n, pToken->type, &dv);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "illegal float data", pToken->z);
|
||||
|
@ -1549,7 +1564,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
}
|
||||
case TSDB_DATA_TYPE_VARBINARY: {
|
||||
int32_t code = parseVarbinary(pToken, &pVal->value.pData, &pVal->value.nData, pSchema->bytes);
|
||||
if(code != TSDB_CODE_SUCCESS){
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return generateSyntaxErrMsg(&pCxt->msg, code, pSchema->name);
|
||||
}
|
||||
break;
|
||||
|
@ -1587,9 +1602,9 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_GEOMETRY: {
|
||||
int32_t code = TSDB_CODE_FAILED;
|
||||
unsigned char *output = NULL;
|
||||
size_t size = 0;
|
||||
int32_t code = TSDB_CODE_FAILED;
|
||||
unsigned char* output = NULL;
|
||||
size_t size = 0;
|
||||
|
||||
code = parseGeometry(pToken, &output, &size);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
|
@ -1598,13 +1613,11 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
// Too long values will raise the invalid sql error message
|
||||
else if (size + VARSTR_HEADER_SIZE > pSchema->bytes) {
|
||||
code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pVal->value.pData = taosMemoryMalloc(size);
|
||||
if (NULL == pVal->value.pData) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
memcpy(pVal->value.pData, output, size);
|
||||
pVal->value.nData = size;
|
||||
}
|
||||
|
@ -1639,18 +1652,14 @@ static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, STo
|
|||
return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp should not be null", pToken->z);
|
||||
}
|
||||
|
||||
if (TK_NK_VARIABLE == pToken->type && pSchema->type != TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "invalid values", pToken->z);
|
||||
}
|
||||
pVal->flag = CV_FLAG_NULL;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code && IS_NUMERIC_TYPE(pSchema->type) && pToken->n == 0) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "invalid numeric data", pToken->z);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (pToken->n == 0 && IS_NUMERIC_TYPE(pSchema->type)) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "invalid numeric data", pToken->z);
|
||||
}
|
||||
code = parseValueTokenImpl(pCxt, pSql, pToken, pSchema, timePrec, pVal);
|
||||
}
|
||||
|
||||
|
@ -1728,18 +1737,19 @@ static int32_t processCtbTagsAfterCtbName(SInsertParseContext* pCxt, SVnodeModif
|
|||
const SToken* tagTokens, SSchema* const* tagSchemas,
|
||||
int numOfTagTokens) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
uint8_t precision = pStmt->pTableMeta->tableInfo.precision;
|
||||
|
||||
if (code == TSDB_CODE_SUCCESS && ctbFirst) {
|
||||
for (int32_t i = 0; code == TSDB_CODE_SUCCESS && i < numOfTagTokens; ++i) {
|
||||
SToken* pTagToken = (SToken*)(tagTokens + i);
|
||||
SSchema* pTagSchema = tagSchemas[i];
|
||||
code = checkAndTrimValue(pTagToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
|
||||
if (TK_NK_VARIABLE == pTagToken->type) {
|
||||
if (code == TSDB_CODE_SUCCESS && TK_NK_VARIABLE == pTagToken->type) {
|
||||
code = buildInvalidOperationMsg(&pCxt->msg, "not expected tag");
|
||||
}
|
||||
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
code = parseTagValue(pCxt, pStmt, NULL, pTagSchema, pTagToken, pStbRowsCxt->aTagNames, pStbRowsCxt->aTagVals,
|
||||
code = parseTagValue(&pCxt->msg, NULL, precision, pTagSchema, pTagToken, pStbRowsCxt->aTagNames, pStbRowsCxt->aTagVals,
|
||||
&pStbRowsCxt->pTag);
|
||||
}
|
||||
}
|
||||
|
@ -1759,11 +1769,12 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
const SBoundColInfo* pCols, const SSchema* pSchemas,
|
||||
SToken* tagTokens, SSchema** tagSchemas, int* pNumOfTagTokens, bool* bFoundTbName) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SArray* pTagNames = pStbRowsCxt->aTagNames;
|
||||
SArray* pTagVals = pStbRowsCxt->aTagVals;
|
||||
bool canParseTagsAfter = !pStbRowsCxt->pTagCond && !pStbRowsCxt->hasTimestampTag;
|
||||
SArray* pTagNames = pStbRowsCxt->aTagNames;
|
||||
SArray* pTagVals = pStbRowsCxt->aTagVals;
|
||||
bool canParseTagsAfter = !pStbRowsCxt->pTagCond && !pStbRowsCxt->hasTimestampTag;
|
||||
int32_t numOfCols = getNumOfColumns(pStbRowsCxt->pStbMeta);
|
||||
int32_t tbnameIdx = getTbnameSchemaIndex(pStbRowsCxt->pStbMeta);
|
||||
uint8_t precision = getTableInfo(pStbRowsCxt->pStbMeta).precision;
|
||||
for (int i = 0; i < pCols->numOfBound && (code) == TSDB_CODE_SUCCESS; ++i) {
|
||||
const char* pTmpSql = *ppSql;
|
||||
bool ignoreComma = false;
|
||||
|
@ -1781,7 +1792,7 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
if (pCols->pColIndex[i] < numOfCols) {
|
||||
const SSchema* pSchema = &pSchemas[pCols->pColIndex[i]];
|
||||
SColVal* pVal = taosArrayGet(pStbRowsCxt->aColVals, pCols->pColIndex[i]);
|
||||
code = parseValueToken(pCxt, ppSql, pToken, (SSchema*)pSchema, getTableInfo(pStbRowsCxt->pStbMeta).precision, pVal);
|
||||
code = parseValueToken(pCxt, ppSql, pToken, (SSchema*)pSchema, precision, pVal);
|
||||
if (TK_NK_VARIABLE == pToken->type) {
|
||||
code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value");
|
||||
}
|
||||
|
@ -1793,11 +1804,11 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
++(*pNumOfTagTokens);
|
||||
} else {
|
||||
code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
|
||||
if (TK_NK_VARIABLE == pToken->type) {
|
||||
if (code == TSDB_CODE_SUCCESS && TK_NK_VARIABLE == pToken->type) {
|
||||
code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value");
|
||||
}
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
code = parseTagValue(pCxt, pStmt, ppSql, (SSchema*)pTagSchema, pToken, pTagNames, pTagVals, &pStbRowsCxt->pTag);
|
||||
code = parseTagValue(&pCxt->msg, ppSql, precision, (SSchema*)pTagSchema, pToken, pTagNames, pTagVals, &pStbRowsCxt->pTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,6 +213,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},
|
||||
|
@ -656,7 +657,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
|
|||
*tokenId = TK_NK_ALIAS; // must be alias
|
||||
return i;
|
||||
}
|
||||
if ((i == 4 && strncasecmp(z, "true", 4) == 0) || (i == 5 && strncasecmp(z, "false", 5) == 0)) {
|
||||
if (IS_TRUE_STR(z, i) || IS_FALSE_STR(z, i)) {
|
||||
*tokenId = TK_NK_BOOL;
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -1517,12 +1517,13 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
|
|||
|
||||
void* data = NULL;
|
||||
uint32_t size = 0;
|
||||
bool isHexChar = isHex(pVal->literal, strlen(pVal->literal));
|
||||
uint32_t vlen = strlen(pVal->literal);
|
||||
bool isHexChar = isHex(pVal->literal, vlen);
|
||||
if (isHexChar) {
|
||||
if (!isValidateHex(pVal->literal, strlen(pVal->literal))) {
|
||||
if (!isValidateHex(pVal->literal, vlen)) {
|
||||
return TSDB_CODE_PAR_INVALID_VARBINARY;
|
||||
}
|
||||
if (taosHex2Ascii(pVal->literal, strlen(pVal->literal), &data, &size) < 0) {
|
||||
if (taosHex2Ascii(pVal->literal, vlen, &data, &size) < 0) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
} else {
|
||||
|
@ -1546,14 +1547,15 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
|
|||
}
|
||||
case TSDB_DATA_TYPE_VARCHAR:
|
||||
case TSDB_DATA_TYPE_GEOMETRY: {
|
||||
if (strict && (pVal->node.resType.bytes > targetDt.bytes - VARSTR_HEADER_SIZE)) {
|
||||
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal);
|
||||
int32_t vlen = IS_VAR_DATA_TYPE(pVal->node.resType.type) ? pVal->node.resType.bytes : strlen(pVal->literal);
|
||||
if (strict && (vlen > targetDt.bytes - VARSTR_HEADER_SIZE)) {
|
||||
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_VALUE_TOO_LONG, pVal->literal);
|
||||
}
|
||||
pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1);
|
||||
int32_t len = TMIN(targetDt.bytes - VARSTR_HEADER_SIZE, vlen);
|
||||
pVal->datum.p = taosMemoryCalloc(1, len + VARSTR_HEADER_SIZE + 1);
|
||||
if (NULL == pVal->datum.p) {
|
||||
return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
int32_t len = TMIN(targetDt.bytes - VARSTR_HEADER_SIZE, pVal->node.resType.bytes);
|
||||
varDataSetLen(pVal->datum.p, len);
|
||||
strncpy(varDataVal(pVal->datum.p), pVal->literal, len);
|
||||
break;
|
||||
|
@ -10024,75 +10026,6 @@ static int32_t createCastFuncForTag(STranslateContext* pCxt, SNode* pNode, SData
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t createTagValFromExpr(STranslateContext* pCxt, SDataType targetDt, SNode* pNode, SValueNode** pVal) {
|
||||
SNode* pCast = NULL;
|
||||
int32_t code = createCastFuncForTag(pCxt, pNode, targetDt, &pCast);
|
||||
SNode* pNew = NULL;
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = scalarCalculateConstants(pCast, &pNew);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pCast = pNew;
|
||||
if (QUERY_NODE_VALUE != nodeType(pCast)) {
|
||||
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pNode)->aliasName);
|
||||
}
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
*pVal = (SValueNode*)pCast;
|
||||
} else {
|
||||
nodesDestroyNode(pCast);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t createTagValFromVal(STranslateContext* pCxt, SDataType targetDt, SNode* pNode, SValueNode** pVal) {
|
||||
SValueNode* pTempVal = (SValueNode*)nodesCloneNode(pNode);
|
||||
if (NULL == pTempVal) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
if (DEAL_RES_ERROR == translateValueImpl(pCxt, pTempVal, targetDt, true)) {
|
||||
nodesDestroyNode((SNode*)pTempVal);
|
||||
return pCxt->errCode;
|
||||
}
|
||||
*pVal = pTempVal;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* pSchema, SNode* pNode,
|
||||
SValueNode** pVal) {
|
||||
if (QUERY_NODE_VALUE == nodeType(pNode)) {
|
||||
return createTagValFromVal(pCxt, schemaToDataType(precision, pSchema), pNode, pVal);
|
||||
} else {
|
||||
return createTagValFromExpr(pCxt, schemaToDataType(precision, pSchema), pNode, pVal);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t buildJsonTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SValueNode* pVal, SArray* pTagArray,
|
||||
STag** ppTag) {
|
||||
if (pVal->literal && strlen(pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) {
|
||||
return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pVal->literal);
|
||||
}
|
||||
|
||||
return parseJsontoTagData(pVal->literal, pTagArray, ppTag, &pCxt->msgBuf);
|
||||
}
|
||||
|
||||
static int32_t buildNormalTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SValueNode* pVal, SArray* pTagArray) {
|
||||
if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) {
|
||||
void* nodeVal = nodesGetValueFromNode(pVal);
|
||||
STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type};
|
||||
// strcpy(val.colName, pTagSchema->name);
|
||||
if (IS_VAR_DATA_TYPE(pTagSchema->type)) {
|
||||
val.pData = varDataVal(nodeVal);
|
||||
val.nData = varDataLen(nodeVal);
|
||||
} else {
|
||||
memcpy(&val.i64, nodeVal, pTagSchema->bytes);
|
||||
}
|
||||
taosArrayPush(pTagArray, &val);
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableClause* pStmt, STableMeta* pSuperTableMeta,
|
||||
STag** ppTag, SArray* tagName) {
|
||||
int32_t numOfTags = getNumOfTags(pSuperTableMeta);
|
||||
|
@ -10108,42 +10041,56 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla
|
|||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
bool isJson = false;
|
||||
SNodeList* pVals = NULL;
|
||||
SNode * pTag = NULL, *pNode = NULL;
|
||||
FORBOTH(pTag, pStmt->pSpecificTags, pNode, pStmt->pValsOfTags) {
|
||||
SColumnNode* pCol = (SColumnNode*)pTag;
|
||||
SSchema* pSchema = getTagSchema(pSuperTableMeta, pCol->colName);
|
||||
if (NULL == pSchema) {
|
||||
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, pCol->colName);
|
||||
}
|
||||
SValueNode* pVal = NULL;
|
||||
bool isJson = false;
|
||||
SNode * pTagNode = NULL, *pNode = NULL;
|
||||
uint8_t precision = pSuperTableMeta->tableInfo.precision;
|
||||
SToken token;
|
||||
char tokenBuf[TSDB_MAX_TAGS_LEN];
|
||||
const char* tagStr = NULL;
|
||||
FORBOTH(pTagNode, pStmt->pSpecificTags, pNode, pStmt->pValsOfTags) {
|
||||
tagStr = ((SValueNode*)pNode)->literal;
|
||||
NEXT_TOKEN_WITH_PREV(tagStr, token);
|
||||
|
||||
SSchema* pSchema = NULL;
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = createTagVal(pCxt, pSuperTableMeta->tableInfo.precision, pSchema, pNode, &pVal);
|
||||
if ((pSchema = getTagSchema(pSuperTableMeta, ((SColumnNode*)pTagNode)->colName))) {
|
||||
code = checkAndTrimValue(&token, tokenBuf, &pCxt->msgBuf, pSchema->type);
|
||||
if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
|
||||
code = TSDB_CODE_TSC_SQL_SYNTAX_ERROR;
|
||||
}
|
||||
} else {
|
||||
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, ((SColumnNode*)pTagNode)->colName);
|
||||
}
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (pSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||
isJson = true;
|
||||
code = buildJsonTagVal(pCxt, pSchema, pVal, pTagArray, ppTag);
|
||||
taosArrayPush(tagName, pCol->colName);
|
||||
} else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) {
|
||||
code = buildNormalTagVal(pCxt, pSchema, pVal, pTagArray);
|
||||
taosArrayPush(tagName, pCol->colName);
|
||||
}
|
||||
code = parseTagValue(&pCxt->msgBuf, &tagStr, precision, pSchema, &token, tagName, pTagArray, ppTag);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
NEXT_VALID_TOKEN(tagStr, token);
|
||||
if (token.n != 0) {
|
||||
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
|
||||
}
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = nodesListMakeAppend(&pVals, (SNode*)pVal);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code && !isJson) {
|
||||
code = tTagNew(pTagArray, 1, false, ppTag);
|
||||
}
|
||||
|
||||
nodesDestroyList(pVals);
|
||||
for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) {
|
||||
STagVal* p = (STagVal*)taosArrayGet(pTagArray, i);
|
||||
if (IS_VAR_DATA_TYPE(p->type)) {
|
||||
taosMemoryFreeClear(p->pData);
|
||||
}
|
||||
}
|
||||
taosArrayDestroy(pTagArray);
|
||||
return code;
|
||||
}
|
||||
|
@ -10161,51 +10108,52 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
|
|||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
bool isJson = false;
|
||||
int32_t index = 0;
|
||||
SSchema* pTagSchemas = getTableTagSchema(pSuperTableMeta);
|
||||
SNodeList* pVals = NULL;
|
||||
SNode* pNode;
|
||||
bool isJson = false;
|
||||
SNode* pNode;
|
||||
uint8_t precision = pSuperTableMeta->tableInfo.precision;
|
||||
SSchema* pTagSchema = getTableTagSchema(pSuperTableMeta);
|
||||
SToken token;
|
||||
char tokenBuf[TSDB_MAX_TAGS_LEN];
|
||||
const char* tagStr = NULL;
|
||||
FOREACH(pNode, pStmt->pValsOfTags) {
|
||||
SValueNode* pVal = NULL;
|
||||
SSchema* pTagSchema = pTagSchemas + index;
|
||||
code = createTagVal(pCxt, pSuperTableMeta->tableInfo.precision, pTagSchema, pNode, &pVal);
|
||||
tagStr = ((SValueNode*)pNode)->literal;
|
||||
NEXT_TOKEN_WITH_PREV(tagStr, token);
|
||||
|
||||
code = checkAndTrimValue(&token, tokenBuf, &pCxt->msgBuf, pTagSchema->type);
|
||||
if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
|
||||
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||
isJson = true;
|
||||
code = buildJsonTagVal(pCxt, pTagSchema, pVal, pTagArray, ppTag);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesDestroyNode((SNode*)pVal);
|
||||
}
|
||||
taosArrayPush(tagName, pTagSchema->name);
|
||||
} else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) {
|
||||
char* tmpVal = nodesGetValueFromNode(pVal);
|
||||
STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type};
|
||||
// strcpy(val.colName, pTagSchema->name);
|
||||
if (IS_VAR_DATA_TYPE(pTagSchema->type)) {
|
||||
val.pData = varDataVal(tmpVal);
|
||||
val.nData = varDataLen(tmpVal);
|
||||
} else {
|
||||
memcpy(&val.i64, tmpVal, pTagSchema->bytes);
|
||||
}
|
||||
taosArrayPush(pTagArray, &val);
|
||||
taosArrayPush(tagName, pTagSchema->name);
|
||||
}
|
||||
code = parseTagValue(&pCxt->msgBuf, &tagStr, precision, pTagSchema, &token, tagName, pTagArray, ppTag);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
NEXT_VALID_TOKEN(tagStr, token);
|
||||
if (token.n != 0) {
|
||||
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
|
||||
}
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = nodesListMakeAppend(&pVals, (SNode*)pVal);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
break;
|
||||
}
|
||||
++index;
|
||||
++pTagSchema;
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code && !isJson) {
|
||||
code = tTagNew(pTagArray, 1, false, ppTag);
|
||||
}
|
||||
|
||||
nodesDestroyList(pVals);
|
||||
for (int32_t i = 0; i < TARRAY_SIZE(pTagArray); ++i) {
|
||||
STagVal* p = (STagVal*)TARRAY_GET_ELEM(pTagArray, i);
|
||||
if (IS_VAR_DATA_TYPE(p->type)) {
|
||||
taosMemoryFreeClear(p->pData);
|
||||
}
|
||||
}
|
||||
taosArrayDestroy(pTagArray);
|
||||
return code;
|
||||
}
|
||||
|
@ -10466,58 +10414,68 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
|
|||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Invalid tag name: %s",
|
||||
pStmt->colName);
|
||||
}
|
||||
|
||||
pReq->tagName = taosStrdup(pStmt->colName);
|
||||
if (NULL == pReq->tagName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
pReq->pTagArray = taosArrayInit(1, sizeof(STagVal));
|
||||
if (NULL == pReq->pTagArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
pReq->colId = pSchema->colId;
|
||||
pReq->tagType = pSchema->type;
|
||||
|
||||
SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema);
|
||||
int32_t code = 0;
|
||||
|
||||
if (QUERY_NODE_VALUE != pStmt->pVal->node.type) {
|
||||
SValueNode* pVal = NULL;
|
||||
pCxt->errCode = createTagValFromExpr(pCxt, targetDt, (SNode*)pStmt->pVal, &pVal);
|
||||
if (pCxt->errCode) {
|
||||
return pCxt->errCode;
|
||||
}
|
||||
|
||||
nodesDestroyNode((SNode*)pStmt->pVal);
|
||||
pStmt->pVal = pVal;
|
||||
} else if (DEAL_RES_ERROR == translateValueImpl(pCxt, pStmt->pVal, targetDt, true)) {
|
||||
return pCxt->errCode;
|
||||
}
|
||||
|
||||
pReq->tagType = targetDt.type;
|
||||
if (targetDt.type == TSDB_DATA_TYPE_JSON) {
|
||||
if (pStmt->pVal->literal &&
|
||||
strlen(pStmt->pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) {
|
||||
return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pStmt->pVal->literal);
|
||||
}
|
||||
SArray* pTagVals = taosArrayInit(1, sizeof(STagVal));
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
STag* pTag = NULL;
|
||||
code = parseJsontoTagData(pStmt->pVal->literal, pTagVals, &pTag, &pCxt->msgBuf);
|
||||
taosArrayDestroy(pTagVals);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
pReq->nTagVal = pTag->len;
|
||||
pReq->pTagVal = (uint8_t*)pTag;
|
||||
pStmt->pVal->datum.p = (char*)pTag; // for free
|
||||
} else {
|
||||
pReq->isNull = pStmt->pVal->isNull;
|
||||
pReq->nTagVal = pStmt->pVal->node.resType.bytes;
|
||||
pReq->pTagVal = nodesGetValueFromNode(pStmt->pVal);
|
||||
|
||||
// data and length are seperated for new tag format STagVal
|
||||
if (IS_VAR_DATA_TYPE(pStmt->pVal->node.resType.type)) {
|
||||
pReq->nTagVal = varDataLen(pReq->pTagVal);
|
||||
pReq->pTagVal = varDataVal(pReq->pTagVal);
|
||||
STag* pTag = NULL;
|
||||
SToken token;
|
||||
char tokenBuf[TSDB_MAX_TAGS_LEN];
|
||||
const char* tagStr = pStmt->pVal->literal;
|
||||
NEXT_TOKEN_WITH_PREV(tagStr, token);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = checkAndTrimValue(&token, tokenBuf, &pCxt->msgBuf, pSchema->type);
|
||||
if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
|
||||
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
|
||||
}
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = parseTagValue(&pCxt->msgBuf, &tagStr, pTableMeta->tableInfo.precision, pSchema, &token, NULL,
|
||||
pReq->pTagArray, &pTag);
|
||||
if (pSchema->type == TSDB_DATA_TYPE_JSON && token.type == TK_NULL && code == TSDB_CODE_SUCCESS) {
|
||||
pReq->tagFree = true;
|
||||
}
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code && tagStr) {
|
||||
NEXT_VALID_TOKEN(tagStr, token);
|
||||
if (token.n != 0) {
|
||||
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
|
||||
}
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (pSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||
pReq->nTagVal = pTag->len;
|
||||
pReq->pTagVal = (uint8_t*)pTag;
|
||||
pStmt->pVal->datum.p = (char*)pTag; // for free
|
||||
} else {
|
||||
STagVal* pTagVal = taosArrayGet(pReq->pTagArray, 0);
|
||||
if (pTagVal) {
|
||||
pReq->isNull = false;
|
||||
if (IS_VAR_DATA_TYPE(pSchema->type)) {
|
||||
pReq->nTagVal = pTagVal->nData;
|
||||
pReq->pTagVal = pTagVal->pData;
|
||||
} else {
|
||||
pReq->nTagVal = pSchema->bytes;
|
||||
pReq->pTagVal = (uint8_t*)&pTagVal->i64;
|
||||
}
|
||||
} else {
|
||||
pReq->isNull = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
||||
|
@ -10741,6 +10699,14 @@ static void destoryAlterTbReq(SVAlterTbReq* pReq) {
|
|||
taosMemoryFree(pReq->colNewName);
|
||||
taosMemoryFree(pReq->tagName);
|
||||
taosMemoryFree(pReq->newComment);
|
||||
for (int i = 0; i < taosArrayGetSize(pReq->pTagArray); ++i) {
|
||||
STagVal* p = (STagVal*)taosArrayGet(pReq->pTagArray, i);
|
||||
if (IS_VAR_DATA_TYPE(p->type)) {
|
||||
taosMemoryFreeClear(p->pData);
|
||||
}
|
||||
}
|
||||
taosArrayDestroy(pReq->pTagArray);
|
||||
if(pReq->tagFree) tTagFree((STag*)pReq->pTagVal);
|
||||
}
|
||||
|
||||
static int32_t rewriteAlterTableImpl(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
||||
|
|
|
@ -355,7 +355,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi
|
|||
SHashObj* keyHash = NULL;
|
||||
int32_t size = 0;
|
||||
// set json NULL data
|
||||
if (!json || strtrim((char*)json) == 0 || strcasecmp(json, TSDB_DATA_NULL_STR_L) == 0) {
|
||||
if (!json || strcasecmp(json, TSDB_DATA_NULL_STR_L) == 0 || strtrim((char*)json) == 0) {
|
||||
retCode = TSDB_CODE_SUCCESS;
|
||||
goto end;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -784,7 +784,7 @@ TEST_F(ParserInitialATest, alterTableSemanticCheck) {
|
|||
run("ALTER TABLE st1s1 DROP TAG tag1", TSDB_CODE_PAR_INVALID_ALTER_TABLE);
|
||||
run("ALTER TABLE st1s1 MODIFY TAG tag2 VARCHAR(30)", TSDB_CODE_PAR_INVALID_ALTER_TABLE);
|
||||
run("ALTER TABLE st1s1 RENAME TAG tag1 tag11", TSDB_CODE_PAR_INVALID_ALTER_TABLE);
|
||||
run("ALTER TABLE st1s1 SET TAG tag2 = '123456789012345678901'", TSDB_CODE_PAR_WRONG_VALUE_TYPE);
|
||||
run("ALTER TABLE st1s1 SET TAG tag2 = '123456789012345678901'", TSDB_CODE_PAR_VALUE_TOO_LONG);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -353,7 +353,8 @@ int32_t streamTransferStateDoPrepare(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,
|
||||
|
|
|
@ -310,7 +310,7 @@ int32_t allocSessioncWinBuffByNextPosition(SStreamFileState* pFileState, SStream
|
|||
int32_t size = taosArrayGetSize(pWinStates);
|
||||
if (pCur->buffIndex >= 0) {
|
||||
if (pCur->buffIndex >= size) {
|
||||
pNewPos = insertNewSessionWindow(pFileState, pWinStates, pWinKey, size);
|
||||
pNewPos = addNewSessionWindow(pFileState, pWinStates, pWinKey);
|
||||
goto _end;
|
||||
}
|
||||
pNewPos = insertNewSessionWindow(pFileState, pWinStates, pWinKey, pCur->buffIndex);
|
||||
|
@ -327,12 +327,12 @@ int32_t allocSessioncWinBuffByNextPosition(SStreamFileState* pFileState, SStream
|
|||
}
|
||||
}
|
||||
pNewPos = getNewRowPosForWrite(pFileState);
|
||||
memcpy(pNewPos->pKey, pWinKey, sizeof(SSessionKey));
|
||||
pNewPos->needFree = true;
|
||||
pNewPos->beFlushed = true;
|
||||
}
|
||||
|
||||
_end:
|
||||
memcpy(pNewPos->pKey, pWinKey, sizeof(SSessionKey));
|
||||
(*ppVal) = pNewPos;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -322,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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -485,7 +485,7 @@ bool isHex(const char* z, uint32_t n){
|
|||
}
|
||||
|
||||
bool isValidateHex(const char* z, uint32_t n){
|
||||
if(n % 2 != 0) return false;
|
||||
if((n & 1) != 0) return false;
|
||||
for(size_t i = HEX_PREFIX_LEN; i < n; i++){
|
||||
if(isxdigit(z[i]) == 0){
|
||||
return false;
|
||||
|
@ -494,13 +494,16 @@ bool isValidateHex(const char* z, uint32_t n){
|
|||
return true;
|
||||
}
|
||||
|
||||
int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){
|
||||
n -= HEX_PREFIX_LEN; // remove 0x
|
||||
int32_t taosHex2Ascii(const char *z, uint32_t n, void **data, uint32_t *size) {
|
||||
n -= HEX_PREFIX_LEN; // remove 0x
|
||||
z += HEX_PREFIX_LEN;
|
||||
*size = n / HEX_PREFIX_LEN;
|
||||
if(*size == 0) return 0;
|
||||
uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1);
|
||||
if(tmp == NULL) return -1;
|
||||
if (*size == 0) {
|
||||
if (!(*data = taosStrdup(""))) return -1;
|
||||
return 0;
|
||||
}
|
||||
uint8_t *tmp = (uint8_t *)taosMemoryCalloc(*size, 1);
|
||||
if (tmp == NULL) return -1;
|
||||
int8_t num = 0;
|
||||
uint8_t *byte = tmp + *size - 1;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -613,7 +613,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_GET_META_ERROR, "Fail to get table i
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS, "Not unique table/alias")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC, "System table not allowed")
|
||||
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_VARBINARY, "Invalid 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")
|
||||
|
|
|
@ -229,6 +229,7 @@
|
|||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_taosx.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts4563.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_replay.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqSeekAndCommit.py
|
||||
,,n,system-test,python3 ./test.py -f 7-tmq/tmq_offset.py
|
||||
|
@ -327,6 +328,7 @@
|
|||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/db_tb_name_check.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/InsertFuturets.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_wide_column.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_column_value.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_benchmark.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -R
|
||||
|
@ -1056,6 +1058,13 @@
|
|||
,,y,script,./test.sh -f tsim/parser/columnValue_smallint.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_tinyint.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_unsign.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_uint.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_timestamp.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_varchar.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_nchar.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_varbinary.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_json.sim
|
||||
,,y,script,./test.sh -f tsim/parser/columnValue_geometry.sim
|
||||
,,y,script,./test.sh -f tsim/parser/condition.sim
|
||||
,,y,script,./test.sh -f tsim/parser/condition_scl.sim
|
||||
,,y,script,./test.sh -f tsim/parser/constCol.sim
|
||||
|
|
|
@ -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 135" >> $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
|
||||
|
|
|
@ -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
|
|
@ -28,10 +28,26 @@ if $data05 != NULL then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error create table st_bigint_2 using mt_bigint tags ('NULL')
|
||||
sql_error create table st_bigint_3 using mt_bigint tags ('NULL')
|
||||
sql_error create table st_bigint_4 using mt_bigint tags ("NULL")
|
||||
sql_error create table st_bigint_5 using mt_bigint tags ("NULL")
|
||||
sql create table st_bigint_2 using mt_bigint tags ('NULL')
|
||||
sql show tags from st_bigint_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_3 using mt_bigint tags ('NULL')
|
||||
sql show tags from st_bigint_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_4 using mt_bigint tags ("NULL")
|
||||
sql show tags from st_bigint_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_5 using mt_bigint tags ("NULL")
|
||||
sql show tags from st_bigint_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_bigint_6 using mt_bigint tags (-9223372036854775807)
|
||||
sql show tags from st_bigint_6
|
||||
|
@ -97,6 +113,39 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_bigint_2 values (now, NULL)
|
||||
sql select * from st_bigint_2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_3 values (now, NULL)
|
||||
sql select * from st_bigint_3
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_4 values (now, NULL)
|
||||
sql select * from st_bigint_4
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_5 values (now, NULL)
|
||||
sql select * from st_bigint_5
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_bigint_6 values (now, 9223372036854775807)
|
||||
sql select * from st_bigint_6
|
||||
if $rows != 1 then
|
||||
|
@ -348,7 +397,7 @@ sql_error create table st_bigint_e0 using mt_bigint tags ("123abc")
|
|||
sql_error create table st_bigint_e0 using mt_bigint tags (abc)
|
||||
sql_error create table st_bigint_e0 using mt_bigint tags ("abc")
|
||||
sql_error create table st_bigint_e0 using mt_bigint tags (" ")
|
||||
sql create table st_bigint_e0_error using mt_bigint tags ('')
|
||||
sql_error create table st_bigint_e0_error using mt_bigint tags ('')
|
||||
|
||||
sql create table st_bigint_e0 using mt_bigint tags (123)
|
||||
sql create table st_bigint_e1 using mt_bigint tags (123)
|
||||
|
@ -401,7 +450,7 @@ sql_error insert into st_bigint_e20 using mt_bigint tags ("123abc") values (now,
|
|||
sql_error insert into st_bigint_e22 using mt_bigint tags (abc) values (now, -033)
|
||||
sql_error insert into st_bigint_e23 using mt_bigint tags ("abc") values (now, -033)
|
||||
sql_error insert into st_bigint_e24 using mt_bigint tags (" ") values (now, -033)
|
||||
sql insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033)
|
||||
sql_error insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_bigint_e13 using mt_bigint tags (033) values (now, 00062)
|
||||
sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, 00062)
|
||||
|
@ -417,15 +466,17 @@ sql insert into st_bigint_e23 using mt_bigint tags (033) values (now, 00062)
|
|||
sql insert into st_bigint_e24 using mt_bigint tags (033) values (now, 00062)
|
||||
sql insert into st_bigint_e25 using mt_bigint tags (033) values (now, 00062)
|
||||
|
||||
#sql alter table st_bigint_e13 set tag tagname=9223372036854775808
|
||||
#sql_error alter table st_bigint_e14 set tag tagname=-9223372036854775808
|
||||
#sql alter table st_bigint_e15 set tag tagname=92233720368547758080
|
||||
#sql_error alter table st_bigint_e16 set tag tagname=-92233720368547758080
|
||||
#sql_error alter table st_bigint_e19 set tag tagname=123abc
|
||||
#sql_error alter table st_bigint_e20 set tag tagname="123abc"
|
||||
#sql_error alter table st_bigint_e22 set tag tagname=abc
|
||||
#sql_error alter table st_bigint_e23 set tag tagname="abc"
|
||||
#sql_error alter table st_bigint_e24 set tag tagname=" "
|
||||
#sql_error alter table st_bigint_e25 set tag tagname=''
|
||||
sql_error alter table st_bigint_e13 set tag tagname=9223372036854775808
|
||||
sql alter table st_bigint_e13 set tag tagname=9223372036854775807
|
||||
sql_error alter table st_bigint_e14 set tag tagname=-9223372036854775809
|
||||
sql alter table st_bigint_e14 set tag tagname=-9223372036854775808
|
||||
sql_error alter table st_bigint_e15 set tag tagname=92233720368547758080
|
||||
sql_error alter table st_bigint_e16 set tag tagname=-92233720368547758080
|
||||
sql_error alter table st_bigint_e19 set tag tagname=123abc
|
||||
sql_error alter table st_bigint_e20 set tag tagname="123abc"
|
||||
sql_error alter table st_bigint_e22 set tag tagname=abc
|
||||
sql_error alter table st_bigint_e23 set tag tagname="abc"
|
||||
sql_error alter table st_bigint_e24 set tag tagname=" "
|
||||
sql_error alter table st_bigint_e25 set tag tagname=''
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -31,26 +31,26 @@ if $data05 != NULL then
|
|||
endi
|
||||
sql create table st_bool_2 using mt_bool tags ('NULL')
|
||||
sql show tags from st_bool_2
|
||||
if $data05 != false then
|
||||
print ==3== expect: false, actually: $data05
|
||||
if $data05 != NULL then
|
||||
print ==3== expect: NULL, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_3 using mt_bool tags ('NULL')
|
||||
sql show tags from st_bool_3
|
||||
if $data05 != false then
|
||||
print ==4== expect: false, actually: $data05
|
||||
if $data05 != NULL then
|
||||
print ==4== expect: NULL, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_4 using mt_bool tags ("NULL")
|
||||
sql show tags from st_bool_4
|
||||
if $data05 != false then
|
||||
print ==5== expect: false, actually: $data05
|
||||
if $data05 != NULL then
|
||||
print ==5== expect: NULL, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_5 using mt_bool tags ("NULL")
|
||||
sql show tags from st_bool_5
|
||||
if $data05 != false then
|
||||
print ==6== expect: false, actually: $data05
|
||||
if $data05 != NULL then
|
||||
print ==6== expect: NULL, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_6 using mt_bool tags ("true")
|
||||
|
@ -113,16 +113,94 @@ if $data05 != true then
|
|||
print ==16== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_15_0 using mt_bool tags (+300)
|
||||
sql show tags from st_bool_15_0
|
||||
sql create table st_bool_16 using mt_bool tags (+300)
|
||||
sql show tags from st_bool_16
|
||||
if $data05 != true then
|
||||
print ==16== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_15_1 using mt_bool tags (-8.03)
|
||||
sql show tags from st_bool_15_1
|
||||
sql create table st_bool_17 using mt_bool tags (-8.03)
|
||||
sql show tags from st_bool_17
|
||||
if $data05 != true then
|
||||
print ==16== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_18 using mt_bool tags ("-8.03")
|
||||
sql show tags from st_bool_18
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_19 using mt_bool tags ("+300")
|
||||
sql show tags from st_bool_19
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_20 using mt_bool tags ("-8e+2")
|
||||
sql show tags from st_bool_20
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_21 using mt_bool tags ("0x01")
|
||||
sql show tags from st_bool_21
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_22 using mt_bool tags ("0b01")
|
||||
sql show tags from st_bool_22
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_23 using mt_bool tags ("+0x01")
|
||||
sql show tags from st_bool_23
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_24 using mt_bool tags ("-0b00")
|
||||
sql show tags from st_bool_24
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_26 using mt_bool tags ("-0.11e-30")
|
||||
sql show tags from st_bool_26
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_27 using mt_bool tags ("-1.0e-307")
|
||||
sql show tags from st_bool_27
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_28 using mt_bool tags ( -1e-1 )
|
||||
sql show tags from st_bool_28
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_29 using mt_bool tags (-0.11e-30)
|
||||
sql show tags from st_bool_29
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_30 using mt_bool tags (-1.1e-307)
|
||||
sql show tags from st_bool_30
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_31 using mt_bool tags ( 0x01)
|
||||
sql show tags from st_bool_31
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_32 using mt_bool tags (0b01 )
|
||||
sql show tags from st_bool_32
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_33 using mt_bool tags (+0x01)
|
||||
sql show tags from st_bool_33
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_34 using mt_bool tags ( -0b00 )
|
||||
sql show tags from st_bool_34
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -271,8 +349,8 @@ if $data01 != 1 then
|
|||
print ==32== expect: true, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_15_0 values (now, +300)
|
||||
sql select * from st_bool_15_0
|
||||
sql insert into st_bool_16 values (now, +300)
|
||||
sql select * from st_bool_16
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -280,8 +358,8 @@ if $data01 != 1 then
|
|||
print ==32== expect: true, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_15_1 values (now, -3.15)
|
||||
sql select * from st_bool_15_1
|
||||
sql insert into st_bool_17 values (now, -3.15)
|
||||
sql select * from st_bool_17
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -289,304 +367,529 @@ if $data01 != 1 then
|
|||
print ==32== expect: true, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_18 values(now,"-8.03")
|
||||
sql select * from st_bool_18
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_19 values(now,"+300")
|
||||
sql select * from st_bool_19
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_20 values(now,"-8e+2")
|
||||
sql select * from st_bool_20
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_21 values(now,"0x01")
|
||||
sql select * from st_bool_21
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_22 values(now,"0b01")
|
||||
sql select * from st_bool_22
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_23 values(now,"+0x01")
|
||||
sql select * from st_bool_23
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_24 values(now,"-0b00")
|
||||
sql select * from st_bool_24
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_26 values(now,"-0.11e-30")
|
||||
sql select * from st_bool_26
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_27 values(now,"-1.0e-307")
|
||||
sql select * from st_bool_27
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_28 values(now, -1e-1 )
|
||||
sql select * from st_bool_28
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_29 values(now,-0.11e-30)
|
||||
sql select * from st_bool_29
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_30 values(now,-1.1e-307)
|
||||
sql select * from st_bool_30
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_31 values(now, 0x01)
|
||||
sql select * from st_bool_31
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_32 values(now,0b01 )
|
||||
sql select * from st_bool_32
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_33 values(now,+0x01)
|
||||
sql select * from st_bool_33
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_34 values(now, -0b00 )
|
||||
sql select * from st_bool_34
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_bool_16 using mt_bool tags (NULL) values (now, NULL)
|
||||
sql show create table st_bool_16
|
||||
sql show tags from st_bool_16
|
||||
sql insert into st_bool_116 using mt_bool tags (NULL) values (now, NULL)
|
||||
sql show create table st_bool_116
|
||||
sql show tags from st_bool_116
|
||||
if $data05 != NULL then
|
||||
print ==33== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_16
|
||||
sql select * from st_bool_116
|
||||
if $data01 != NULL then
|
||||
print ==34== expect: NULL, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_bool_17 using mt_bool tags (NULL) values (now, NULL)
|
||||
sql show tags from st_bool_17
|
||||
sql insert into st_bool_117 using mt_bool tags (NULL) values (now, NULL)
|
||||
sql show tags from st_bool_117
|
||||
if $data05 != NULL then
|
||||
print ==35== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_17
|
||||
sql select * from st_bool_117
|
||||
if $data01 != NULL then
|
||||
print ==36== expect: NULL, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_18 using mt_bool tags ('NULL') values (now, 'NULL')
|
||||
sql show tags from st_bool_18
|
||||
sql insert into st_bool_118 using mt_bool tags ('NULL') values (now, 'NULL')
|
||||
sql show tags from st_bool_118
|
||||
if $data05 != NULL then
|
||||
print ==37== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_18
|
||||
sql select * from st_bool_118
|
||||
if $data01 != NULL then
|
||||
print ==38== expect: NULL, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_19 using mt_bool tags ('NULL') values (now, 'NULL')
|
||||
sql show tags from st_bool_19
|
||||
sql insert into st_bool_119 using mt_bool tags ('NULL') values (now, 'NULL')
|
||||
sql show tags from st_bool_119
|
||||
if $data05 != NULL then
|
||||
print ==39== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_19
|
||||
sql select * from st_bool_119
|
||||
if $data01 != NULL then
|
||||
print ==40== expect: NULL, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_20 using mt_bool tags ("NULL") values (now, "NULL")
|
||||
sql show tags from st_bool_20
|
||||
sql insert into st_bool_120 using mt_bool tags ("NULL") values (now, "NULL")
|
||||
sql show tags from st_bool_120
|
||||
if $data05 != NULL then
|
||||
print ==41== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_20
|
||||
sql select * from st_bool_120
|
||||
if $data01 != NULL then
|
||||
print ==42== expect: NULL, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_21 using mt_bool tags ("NULL") values (now, "NULL")
|
||||
sql show tags from st_bool_21
|
||||
sql insert into st_bool_121 using mt_bool tags ("NULL") values (now, "NULL")
|
||||
sql show tags from st_bool_121
|
||||
if $data05 != NULL then
|
||||
print ==43== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_21
|
||||
sql select * from st_bool_121
|
||||
if $data01 != NULL then
|
||||
print ==44== expect: NULL, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_22 using mt_bool tags ("true") values (now, "true")
|
||||
sql show tags from st_bool_22
|
||||
sql insert into st_bool_122 using mt_bool tags ("true") values (now, "true")
|
||||
sql show tags from st_bool_122
|
||||
if $data05 != true then
|
||||
print ==45== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_22
|
||||
sql select * from st_bool_122
|
||||
if $data01 != 1 then
|
||||
print ==46== expect: 1, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_23 using mt_bool tags ('true') values (now, 'true')
|
||||
sql show tags from st_bool_23
|
||||
sql insert into st_bool_123 using mt_bool tags ('true') values (now, 'true')
|
||||
sql show tags from st_bool_123
|
||||
if $data05 != true then
|
||||
print ==47== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_23
|
||||
sql select * from st_bool_123
|
||||
if $data01 != 1 then
|
||||
print ==48== expect: 1, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_24 using mt_bool tags (true) values (now, true)
|
||||
sql show tags from st_bool_24
|
||||
sql insert into st_bool_124 using mt_bool tags (true) values (now, true)
|
||||
sql show tags from st_bool_124
|
||||
if $data05 != true then
|
||||
print ==49== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_24
|
||||
sql select * from st_bool_124
|
||||
if $data01 != 1 then
|
||||
print ==50== expect: 1, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_25 using mt_bool tags ("false") values (now, "false")
|
||||
sql show tags from st_bool_25
|
||||
sql insert into st_bool_125 using mt_bool tags ("false") values (now, "false")
|
||||
sql show tags from st_bool_125
|
||||
if $data05 != false then
|
||||
print ==51== expect: 0, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_25
|
||||
sql select * from st_bool_125
|
||||
if $data01 != 0 then
|
||||
print ==52== expect: 0, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_26 using mt_bool tags ('false') values (now, 'false')
|
||||
sql show tags from st_bool_26
|
||||
sql insert into st_bool_126 using mt_bool tags ('false') values (now, 'false')
|
||||
sql show tags from st_bool_126
|
||||
if $data05 != false then
|
||||
print ==53== expect: 0, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_26
|
||||
sql select * from st_bool_126
|
||||
if $data01 != 0 then
|
||||
print ==54== expect: 0, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_27 using mt_bool tags (false) values (now, false)
|
||||
sql show tags from st_bool_27
|
||||
sql insert into st_bool_127 using mt_bool tags (false) values (now, false)
|
||||
sql show tags from st_bool_127
|
||||
if $data05 != false then
|
||||
print ==55== expect: 0, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_27
|
||||
sql select * from st_bool_127
|
||||
if $data01 != 0 then
|
||||
print ==56== expect: 0, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_28 using mt_bool tags (0) values (now, 0)
|
||||
sql show tags from st_bool_28
|
||||
sql insert into st_bool_128 using mt_bool tags (0) values (now, 0)
|
||||
sql show tags from st_bool_128
|
||||
if $data05 != false then
|
||||
print ==57== expect: 0, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_28
|
||||
sql select * from st_bool_128
|
||||
if $data01 != 0 then
|
||||
print ==58== expect: 0, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_29 using mt_bool tags (1) values (now, 1)
|
||||
sql show tags from st_bool_29
|
||||
sql insert into st_bool_129 using mt_bool tags (1) values (now, 1)
|
||||
sql show tags from st_bool_129
|
||||
if $data05 != true then
|
||||
print ==59== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_29
|
||||
sql select * from st_bool_129
|
||||
if $data01 != 1 then
|
||||
print ==60== expect: 1, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_30 using mt_bool tags (6.9) values (now, 6.9)
|
||||
sql show tags from st_bool_30
|
||||
sql insert into st_bool_130 using mt_bool tags (6.9) values (now, 6.9)
|
||||
sql show tags from st_bool_130
|
||||
if $data05 != true then
|
||||
print ==61== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_30
|
||||
sql select * from st_bool_130
|
||||
if $data01 != 1 then
|
||||
print ==62== expect: 1, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_31 using mt_bool tags (-3) values (now, -3)
|
||||
sql show tags from st_bool_31
|
||||
sql insert into st_bool_131 using mt_bool tags (-3) values (now, -3)
|
||||
sql show tags from st_bool_131
|
||||
if $data05 != true then
|
||||
print ==63== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_31
|
||||
sql select * from st_bool_131
|
||||
if $data01 != 1 then
|
||||
print ==64== expect: 1, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_32 using mt_bool tags (+300) values (now, +300)
|
||||
sql show tags from st_bool_32
|
||||
sql insert into st_bool_132 using mt_bool tags (+300) values (now, +300)
|
||||
sql show tags from st_bool_132
|
||||
if $data05 != true then
|
||||
print ==63== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_32
|
||||
sql select * from st_bool_132
|
||||
if $data01 != 1 then
|
||||
print ==64== expect: 1, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_33 using mt_bool tags (+30.890) values (now, +30.890)
|
||||
sql show tags from st_bool_33
|
||||
sql insert into st_bool_133 using mt_bool tags (+30.890) values (now, +30.890)
|
||||
sql show tags from st_bool_133
|
||||
if $data05 != true then
|
||||
print ==63== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_33
|
||||
sql select * from st_bool_133
|
||||
if $data01 != 1 then
|
||||
print ==64== expect: 1, actually: $data01
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sql insert into st_bool_218 using mt_bool tags ("-8.03") values (now,"-8.03")
|
||||
sql show tags from st_bool_218
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_218
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_219 using mt_bool tags ("+300") values (now,"+300")
|
||||
sql show tags from st_bool_219
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_219
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_220 using mt_bool tags ("-8e+2") values (now,"-8e+2")
|
||||
sql show tags from st_bool_220
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_220
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_221 using mt_bool tags ("0x01") values (now,"0x01")
|
||||
sql show tags from st_bool_221
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_221
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_222 using mt_bool tags ("0b01") values (now,"0b01")
|
||||
sql show tags from st_bool_222
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_222
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_223 using mt_bool tags ("+0x01") values (now,"+0x01")
|
||||
sql show tags from st_bool_223
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_223
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_224 using mt_bool tags ("-0b00") values (now,"-0b00")
|
||||
sql show tags from st_bool_224
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_224
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_226 using mt_bool tags ("-0.11e-30") values (now,"-0.11e-30")
|
||||
sql show tags from st_bool_226
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_226
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_227 using mt_bool tags ("-1.0e-307") values (now,"-1.0e-307")
|
||||
sql show tags from st_bool_227
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_227
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_228 using mt_bool tags ( -1e-1 ) values (now, -1e-1 )
|
||||
sql show tags from st_bool_228
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_228
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_229 using mt_bool tags (-0.11e-30) values (now,-0.11e-30)
|
||||
sql show tags from st_bool_229
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_229
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_230 using mt_bool tags (-1.1e-307) values (now,-1.1e-307)
|
||||
sql show tags from st_bool_230
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_230
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_231 using mt_bool tags ( 0x01) values (now, 0x01)
|
||||
sql show tags from st_bool_231
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_231
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_232 using mt_bool tags (0b01 ) values (now, 0b01)
|
||||
sql show tags from st_bool_232
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_232
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_233 using mt_bool tags (+0x01) values (now,+0x01)
|
||||
sql show tags from st_bool_233
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bool_234 using mt_bool tags ( -0b00 ) values (now, -0b00)
|
||||
sql show tags from st_bool_234
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bool_234
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 03: alter tag values
|
||||
#sql alter table st_bool_0 set tag tagname=true
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=NULL
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=false
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != false then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=NULL
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname='true'
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname='NULL'
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname='false'
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != false then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname='NULL'
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname="true"
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname="NULL"
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname="false"
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != false then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname="NULL"
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=1
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != false then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=6.9
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=-3
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
sql alter table st_bool_16 set tag tagname=+300
|
||||
sql show tags from st_bool_16
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_17 set tag tagname=-8.03
|
||||
sql show tags from st_bool_17
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_18 set tag tagname="-8.03"
|
||||
sql show tags from st_bool_18
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_19 set tag tagname="+300"
|
||||
sql show tags from st_bool_19
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_20 set tag tagname="-8e+2"
|
||||
sql show tags from st_bool_20
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_21 set tag tagname="0x01"
|
||||
sql show tags from st_bool_21
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_22 set tag tagname="0b01"
|
||||
sql show tags from st_bool_22
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_23 set tag tagname="+0x01"
|
||||
sql show tags from st_bool_23
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_24 set tag tagname="-0b00"
|
||||
sql show tags from st_bool_24
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_26 set tag tagname="-0.11e-30"
|
||||
sql show tags from st_bool_26
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_27 set tag tagname="-1.0e-307"
|
||||
sql show tags from st_bool_27
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_28 set tag tagname= -1e-1
|
||||
sql show tags from st_bool_28
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_29 set tag tagname=-0.11e-30
|
||||
sql show tags from st_bool_29
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_30 set tag tagname=-1.1e-307
|
||||
sql show tags from st_bool_30
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_31 set tag tagname= 0x01
|
||||
sql show tags from st_bool_31
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_32 set tag tagname=0b01
|
||||
sql show tags from st_bool_32
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_33 set tag tagname=+0x01
|
||||
sql show tags from st_bool_33
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_bool_34 set tag tagname= -0b00
|
||||
sql show tags from st_bool_34
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
|
||||
# case 04: illegal input
|
||||
sql_error create table st_bool_e0 using mt_bool tags (123abc)
|
||||
sql create table st_bool_e1 using mt_bool tags ("123abc")
|
||||
sql_error create table st_bool_e1 using mt_bool tags ("123abc")
|
||||
sql create table st_bool_e2 using mt_bool tags ("123")
|
||||
sql_error create table st_bool_e3 using mt_bool tags (abc)
|
||||
sql create table st_bool_e4 using mt_bool tags ("abc")
|
||||
sql create table st_bool_e5 using mt_bool tags (" ")
|
||||
sql create table st_bool_e6 using mt_bool tags ('')
|
||||
sql_error create table st_bool_e4 using mt_bool tags ("abc")
|
||||
sql_error create table st_bool_e5 using mt_bool tags (" ")
|
||||
sql_error create table st_bool_e6 using mt_bool tags ('')
|
||||
|
||||
sql create table st_bool_f0 using mt_bool tags (true)
|
||||
sql create table st_bool_f1 using mt_bool tags (true)
|
||||
|
@ -598,7 +901,7 @@ sql create table st_bool_f6 using mt_bool tags (true)
|
|||
|
||||
sql_error insert into st_bool_g0 values (now, 123abc)
|
||||
sql_error insert into st_bool_g1 values (now, "123abc")
|
||||
sql_error insert into st_bool_g2 values (now, "123")
|
||||
sql insert into st_bool_f2 values (now, "123")
|
||||
sql_error insert into st_bool_g3 values (now, abc)
|
||||
sql_error insert into st_bool_g4 values (now, "abc")
|
||||
sql_error insert into st_bool_g5 values (now, " ")
|
||||
|
@ -606,7 +909,7 @@ sql_error insert into st_bool_g6 values (now, '')
|
|||
|
||||
sql_error insert into st_bool_h0 using mt_bool tags (123abc) values (now, 1)
|
||||
sql_error insert into st_bool_h1 using mt_bool tags ("123abc") values (now, 1)
|
||||
sql_error insert into st_bool_h2 using mt_bool tags ("123") values (now, 1)
|
||||
sql insert into st_bool_h2 using mt_bool tags ("123") values (now, 1)
|
||||
sql_error insert into st_bool_h3 using mt_bool tags (abc) values (now, 1)
|
||||
sql_error insert into st_bool_h4 using mt_bool tags ("abc") values (now, 1)
|
||||
sql_error insert into st_bool_h5 using mt_bool tags (" ") values (now, 1)
|
||||
|
@ -614,7 +917,7 @@ sql_error insert into st_bool_h6 using mt_bool tags ('') values (now, 1)
|
|||
|
||||
sql_error insert into st_bool_h0 using mt_bool tags (1) values (now, 123abc)
|
||||
sql_error insert into st_bool_h1 using mt_bool tags (1) values (now, "123abc")
|
||||
sql_error insert into st_bool_h2 using mt_bool tags (1) values (now, "123")
|
||||
sql insert into st_bool_h2 using mt_bool tags (1) values (now, "123")
|
||||
sql_error insert into st_bool_h3 using mt_bool tags (1) values (now, abc)
|
||||
sql_error insert into st_bool_h4 using mt_bool tags (1) values (now, "abc")
|
||||
sql_error insert into st_bool_h5 using mt_bool tags (1) values (now, " ")
|
||||
|
@ -629,11 +932,11 @@ sql insert into st_bool_i5 using mt_bool tags (1) values (now, 1)
|
|||
sql insert into st_bool_i6 using mt_bool tags (1) values (now, 1)
|
||||
|
||||
sql_error alter table st_bool_i0 set tag tagname=123abc
|
||||
sql alter table st_bool_i1 set tag tagname="123abc"
|
||||
sql alter table st_bool_i2 set tag tagname="123"
|
||||
sql_error alter table st_bool_i1 set tag tagname="123abc"
|
||||
sql alter table st_bool_i2 set tag tagname="123"
|
||||
sql_error alter table st_bool_i3 set tag tagname=abc
|
||||
sql alter table st_bool_i4 set tag tagname="abc"
|
||||
sql alter table st_bool_i5 set tag tagname=" "
|
||||
sql alter table st_bool_i6 set tag tagname=''
|
||||
sql_error alter table st_bool_i4 set tag tagname="abc"
|
||||
sql_error alter table st_bool_i5 set tag tagname=" "
|
||||
sql_error alter table st_bool_i6 set tag tagname=''
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -28,22 +28,22 @@ if $data05 != NULL then
|
|||
endi
|
||||
sql create table st_double_2 using mt_double tags ('NULL')
|
||||
sql show tags from st_double_2
|
||||
if $data05 != 0.000000000 then
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_3 using mt_double tags ('NULL')
|
||||
sql show tags from st_double_3
|
||||
if $data05 != 0.000000000 then
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_4 using mt_double tags ("NULL")
|
||||
sql show tags from st_double_4
|
||||
if $data05 != 0.000000000 then
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_5 using mt_double tags ("NULL")
|
||||
sql show tags from st_double_5
|
||||
if $data05 != 0.000000000 then
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_6 using mt_double tags (-123.321)
|
||||
|
@ -148,6 +148,46 @@ sql show tags from st_double_16_0
|
|||
#if $data05 != 0.001500000 then
|
||||
# return -1
|
||||
#endi
|
||||
sql create table st_double_100 using mt_double tags ("0x01")
|
||||
sql show tags from st_double_100
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_101 using mt_double tags ("0b01")
|
||||
sql show tags from st_double_101
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_102 using mt_double tags ("+0x01")
|
||||
sql show tags from st_double_102
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_103 using mt_double tags ("-0b01")
|
||||
sql show tags from st_double_103
|
||||
if $data05 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_200 using mt_double tags ( 0x01)
|
||||
sql show tags from st_double_200
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_201 using mt_double tags (0b01 )
|
||||
sql show tags from st_double_201
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_202 using mt_double tags (+0x01)
|
||||
sql show tags from st_double_202
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_203 using mt_double tags ( -0b01 )
|
||||
sql show tags from st_double_203
|
||||
if $data05 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_double_0 values (now, NULL )
|
||||
|
@ -274,6 +314,70 @@ endi
|
|||
#if $data01 != -56 then
|
||||
# return -1
|
||||
#endi
|
||||
sql insert into st_double_100 values(now, "0x01")
|
||||
sql select * from st_double_100
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_101 values(now, "0b01")
|
||||
sql select * from st_double_101
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_102 values(now, "+0x01")
|
||||
sql select * from st_double_102
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_103 values(now, "-0b01")
|
||||
sql select * from st_double_103
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_200 values(now, 0x01)
|
||||
sql select * from st_double_200
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_201 values(now, 0b01 )
|
||||
sql select * from st_double_201
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_202 values(now, +0x01)
|
||||
sql select * from st_double_202
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_203 values(now, -0b01 )
|
||||
sql select * from st_double_203
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_double_16 using mt_double tags (NULL ) values (now, NULL )
|
||||
|
@ -394,6 +498,78 @@ sql select * from st_double_28
|
|||
#if $data01 != -56 then
|
||||
# return -1
|
||||
#endi
|
||||
sql insert into st_double_100 using mt_double tags ("0x01") values (now, "0x01")
|
||||
sql show tags from st_double_100
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_100
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_101 using mt_double tags ("0b01") values (now, "0b01")
|
||||
sql show tags from st_double_101
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_101
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_102 using mt_double tags ("+0x01") values (now, "+0x01")
|
||||
sql show tags from st_double_102
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_102
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_103 using mt_double tags ("-0b01") values (now, "-0b01")
|
||||
sql show tags from st_double_103
|
||||
if $data05 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_103
|
||||
if $data01 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_200 using mt_double tags ( 0x01) values (now, 0x01)
|
||||
sql show tags from st_double_200
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_200
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_201 using mt_double tags (0b01 ) values (now, 0b01)
|
||||
sql show tags from st_double_201
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_201
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_202 using mt_double tags (+0x01) values (now, +0x01)
|
||||
sql show tags from st_double_202
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_202
|
||||
if $data01 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_double_203 using mt_double tags ( -0b01 ) values (now, -0b01)
|
||||
sql show tags from st_double_203
|
||||
if $data05 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_203
|
||||
if $data01 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
### case 03: alter tag values
|
||||
#sql alter table st_double_0 set tag tagname=1.7976931348623157e+308
|
||||
|
@ -436,6 +612,46 @@ sql select * from st_double_28
|
|||
##if $data05 != -63 then
|
||||
## return -1
|
||||
##endi
|
||||
sql alter table st_double_100 set tag tagname="0x01"
|
||||
sql show tags from st_double_100
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_double_101 set tag tagname="0b01"
|
||||
sql show tags from st_double_101
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_double_102 set tag tagname="+0x01"
|
||||
sql show tags from st_double_102
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_double_103 set tag tagname="-0b01"
|
||||
sql show tags from st_double_103
|
||||
if $data05 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_double_200 set tag tagname= 0x01
|
||||
sql show tags from st_double_200
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_double_201 set tag tagname=0b01
|
||||
sql show tags from st_double_201
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_double_202 set tag tagname=+0x01
|
||||
sql show tags from st_double_202
|
||||
if $data05 != 1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_double_203 set tag tagname= -0b01
|
||||
sql show tags from st_double_203
|
||||
if $data05 != -1.000000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_double_e0 using mt_double tags (1.8976931348623157e+308)
|
||||
|
@ -445,11 +661,11 @@ sql_error create table st_double_e0 using mt_double tags (-31.7976931348623157e+
|
|||
#sql_error create table st_double_e0 using mt_double tags (12.80) truncate integer part
|
||||
#sql_error create table st_double_e0 using mt_double tags (-11.80)
|
||||
sql_error create table st_double_e0 using mt_double tags (123abc)
|
||||
sql create table st_double_e0_1 using mt_double tags ("123abc")
|
||||
sql_error create table st_double_e0_1 using mt_double tags ("123abc")
|
||||
sql_error create table st_double_e0 using mt_double tags (abc)
|
||||
sql create table st_double_e0_2 using mt_double tags ("abc")
|
||||
sql create table st_double_e0_3 using mt_double tags (" ")
|
||||
sql create table st_double_e0_4 using mt_double tags ('')
|
||||
sql_error create table st_double_e0_2 using mt_double tags ("abc")
|
||||
sql_error create table st_double_e0_3 using mt_double tags (" ")
|
||||
sql_error create table st_double_e0_4 using mt_double tags ('')
|
||||
|
||||
sql create table st_double_e0 using mt_double tags (123)
|
||||
sql create table st_double_e1 using mt_double tags (123)
|
||||
|
@ -502,7 +718,8 @@ sql_error insert into st_double_e20 using mt_double tags ("123abc") values (now,
|
|||
sql_error insert into st_double_e22 using mt_double tags (abc) values (now, -033)
|
||||
sql_error insert into st_double_e23 using mt_double tags ("abc") values (now, -033)
|
||||
sql_error insert into st_double_e24 using mt_double tags (" ") values (now, -033)
|
||||
sql insert into st_double_e25 using mt_double tags ('') values (now, -033)
|
||||
sql_error insert into st_double_e25 using mt_double tags ('') values (now, -033)
|
||||
sql insert into st_double_e20 using mt_double tags ("123") values (now, -033)
|
||||
|
||||
sql insert into st_double_e13 using mt_double tags (033) values (now, 00062)
|
||||
sql insert into st_double_e14 using mt_double tags (033) values (now, 00062)
|
||||
|
@ -523,10 +740,11 @@ sql_error alter table st_double_e14 set tag tagname=-1.8976931348623157e+308
|
|||
sql_error alter table st_double_e15 set tag tagname=131.7976931348623157e+308
|
||||
sql_error alter table st_double_e16 set tag tagname=-131.7976931348623157e+308
|
||||
sql_error alter table st_double_e19 set tag tagname=123abc
|
||||
sql alter table st_double_e20 set tag tagname="123abc"
|
||||
sql_error alter table st_double_e20 set tag tagname="123abc"
|
||||
sql_error alter table st_double_e22 set tag tagname=abc
|
||||
sql alter table st_double_e23 set tag tagname="abc"
|
||||
sql alter table st_double_e24 set tag tagname=" "
|
||||
sql alter table st_double_e25 set tag tagname=''
|
||||
sql_error alter table st_double_e23 set tag tagname="abc"
|
||||
sql_error alter table st_double_e24 set tag tagname=" "
|
||||
sql_error alter table st_double_e25 set tag tagname=''
|
||||
sql alter table st_double_e25 set tag tagname='123'
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -29,22 +29,22 @@ if $data05 != NULL then
|
|||
endi
|
||||
sql create table st_float_2 using mt_float tags ('NULL')
|
||||
sql show tags from st_float_2
|
||||
if $data05 != 0.00000 then
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_3 using mt_float tags ('NULL')
|
||||
sql show tags from st_float_3
|
||||
if $data05 != 0.00000 then
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_4 using mt_float tags ("NULL")
|
||||
sql show tags from st_float_4
|
||||
if $data05 != 0.00000 then
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_5 using mt_float tags ("NULL")
|
||||
sql show tags from st_float_5
|
||||
if $data05 != 0.00000 then
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_6 using mt_float tags (-123.321)
|
||||
|
@ -156,16 +156,62 @@ if $data05 != 0.00150 then
|
|||
print expect 0.00150, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
#sql create table st_float_15_0 using mt_float tags (3.40282347e+38)
|
||||
#sql show tags from st_float_15_0
|
||||
#if $data05 != 0.001500 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql create table st_float_16_0 using mt_float tags (-3.40282347e+38)
|
||||
#sql show tags from st_float_16_0
|
||||
#if $data05 != 0.001500 then
|
||||
# return -1
|
||||
#endi
|
||||
sql create table st_float_15_0 using mt_float tags (3.40282346638528859811704183484516925e+38)
|
||||
sql show tags from st_float_15_0
|
||||
if $data05 < 340282346638528859811704183484516925000 then
|
||||
return -1
|
||||
endi
|
||||
if $data05 > 340282346638528859811704183484516925900 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_16_0 using mt_float tags (-3.40282346638528859811704183484516925e+38)
|
||||
sql show tags from st_float_16_0
|
||||
if $data05 < -340282346638528859811704183484516925900 then
|
||||
return -1
|
||||
endi
|
||||
if $data05 > -340282346638528859811704183484516925000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_100 using mt_float tags ("0x01")
|
||||
sql show tags from st_float_100
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_101 using mt_float tags ("0b01")
|
||||
sql show tags from st_float_101
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_102 using mt_float tags ("+0x01")
|
||||
sql show tags from st_float_102
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_103 using mt_float tags ("-0b01")
|
||||
sql show tags from st_float_103
|
||||
if $data05 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_200 using mt_float tags ( 0x01)
|
||||
sql show tags from st_float_200
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_201 using mt_float tags (0b01 )
|
||||
sql show tags from st_float_201
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_202 using mt_float tags (+0x01)
|
||||
sql show tags from st_float_202
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_203 using mt_float tags ( -0b01 )
|
||||
sql show tags from st_float_203
|
||||
if $data05 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_float_0 values (now, NULL)
|
||||
|
@ -216,6 +262,70 @@ endi
|
|||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_100 values(now, "0x01")
|
||||
sql select * from st_float_100
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_101 values(now, "0b01")
|
||||
sql select * from st_float_101
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_102 values(now, "+0x01")
|
||||
sql select * from st_float_102
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_103 values(now, "-0b01")
|
||||
sql select * from st_float_103
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_200 values(now, 0x01)
|
||||
sql select * from st_float_200
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_201 values(now, 0b01 )
|
||||
sql select * from st_float_201
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_202 values(now, +0x01)
|
||||
sql select * from st_float_202
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_203 values(now, -0b01 )
|
||||
sql select * from st_float_203
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error insert into st_float_6 values (now, 3.40282347e+38)
|
||||
sql_error insert into st_float_6 values (now, -3.40282347e+38)
|
||||
|
@ -425,6 +535,78 @@ sql select * from st_float_28
|
|||
if $data01 != -5.60000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_100 using mt_float tags ("0x01") values (now, "0x01")
|
||||
sql show tags from st_float_100
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_100
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_101 using mt_float tags ("0b01") values (now, "0b01")
|
||||
sql show tags from st_float_101
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_101
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_102 using mt_float tags ("+0x01") values (now, "+0x01")
|
||||
sql show tags from st_float_102
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_102
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_103 using mt_float tags ("-0b01") values (now, "-0b01")
|
||||
sql show tags from st_float_103
|
||||
if $data05 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_103
|
||||
if $data01 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_200 using mt_float tags ( 0x01) values (now, 0x01)
|
||||
sql show tags from st_float_200
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_200
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_201 using mt_float tags (0b01 ) values (now, 0b01)
|
||||
sql show tags from st_float_201
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_201
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_202 using mt_float tags (+0x01) values (now, +0x01)
|
||||
sql show tags from st_float_202
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_202
|
||||
if $data01 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_float_203 using mt_float tags ( -0b01 ) values (now, -0b01)
|
||||
sql show tags from st_float_203
|
||||
if $data05 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_203
|
||||
if $data01 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
### case 03: alter tag values
|
||||
sql alter table st_float_0 set tag tagname=340282346638528859811704183484516925440.00000
|
||||
|
@ -468,6 +650,46 @@ sql show tags from st_float_0
|
|||
if $data05 != -63.58200 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_100 set tag tagname="0x01"
|
||||
sql show tags from st_float_100
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_101 set tag tagname="0b01"
|
||||
sql show tags from st_float_101
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_102 set tag tagname="+0x01"
|
||||
sql show tags from st_float_102
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_103 set tag tagname="-0b01"
|
||||
sql show tags from st_float_103
|
||||
if $data05 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_200 set tag tagname= 0x01
|
||||
sql show tags from st_float_200
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_201 set tag tagname=0b01
|
||||
sql show tags from st_float_201
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_202 set tag tagname=+0x01
|
||||
sql show tags from st_float_202
|
||||
if $data05 != 1.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_203 set tag tagname= -0b01
|
||||
sql show tags from st_float_203
|
||||
if $data05 != -1.00000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_float_e0 using mt_float tags (3.50282347e+38)
|
||||
|
@ -477,11 +699,11 @@ sql_error create table st_float_e0 using mt_float tags (-333.40282347e+38)
|
|||
#sql_error create table st_float_e0 using mt_float tags (12.80) truncate integer part
|
||||
#sql_error create table st_float_e0 using mt_float tags (-11.80)
|
||||
sql_error create table st_float_e0 using mt_float tags (123abc)
|
||||
sql create table st_float_e0_1 using mt_float tags ("123abc")
|
||||
sql_error create table st_float_e0_1 using mt_float tags ("123abc")
|
||||
sql_error create table st_float_e0 using mt_float tags (abc)
|
||||
sql create table st_float_e0_2 using mt_float tags ("abc")
|
||||
sql create table st_float_e0_3 using mt_float tags (" ")
|
||||
sql create table st_float_e0_4 using mt_float tags ('')
|
||||
sql_error create table st_float_e0_2 using mt_float tags ("abc")
|
||||
sql_error create table st_float_e0_3 using mt_float tags (" ")
|
||||
sql_error create table st_float_e0_4 using mt_float tags ('')
|
||||
|
||||
sql create table st_float_e0 using mt_float tags (123)
|
||||
sql create table st_float_e1 using mt_float tags (123)
|
||||
|
@ -534,7 +756,7 @@ sql_error insert into st_float_e20 using mt_float tags ("123abc") values (now, -
|
|||
sql_error insert into st_float_e22 using mt_float tags (abc) values (now, -033)
|
||||
sql_error insert into st_float_e23 using mt_float tags ("abc") values (now, -033)
|
||||
sql_error insert into st_float_e24 using mt_float tags (" ") values (now, -033)
|
||||
sql insert into st_float_e25_3 using mt_float tags ('') values (now, -033)
|
||||
sql_error insert into st_float_e25_3 using mt_float tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_float_e13 using mt_float tags (033) values (now, 00062)
|
||||
sql insert into st_float_e14 using mt_float tags (033) values (now, 00062)
|
||||
|
@ -555,10 +777,10 @@ sql_error alter table st_float_e14 set tag tagname=-3.50282347e+38
|
|||
sql_error alter table st_float_e15 set tag tagname=13.40282347e+38
|
||||
sql_error alter table st_float_e16 set tag tagname=-13.40282347e+38
|
||||
sql_error alter table st_float_e19 set tag tagname=123abc
|
||||
sql alter table st_float_e20 set tag tagname="123abc"
|
||||
sql_error alter table st_float_e20 set tag tagname="123abc"
|
||||
sql_error alter table st_float_e22 set tag tagname=abc
|
||||
sql alter table st_float_e23 set tag tagname="abc"
|
||||
sql alter table st_float_e24 set tag tagname=" "
|
||||
sql alter table st_float_e25 set tag tagname=''
|
||||
sql_error alter table st_float_e23 set tag tagname="abc"
|
||||
sql_error alter table st_float_e24 set tag tagname=" "
|
||||
sql_error alter table st_float_e25 set tag tagname=''
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -0,0 +1,277 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
||||
######## case 0: geometry
|
||||
print ========== geometry
|
||||
sql create table mt_geometry (ts timestamp, c geometry(128)) tags(tagname geometry(128))
|
||||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_geometry_0 using mt_geometry tags(NULL)
|
||||
sql show tags from st_geometry_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_geometry_1 using mt_geometry tags(NULL)
|
||||
sql show tags from st_geometry_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_geometry_2 using mt_geometry tags('NULL')
|
||||
sql show tags from st_geometry_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_geometry_3 using mt_geometry tags('NULL')
|
||||
sql show tags from st_geometry_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_geometry_4 using mt_geometry tags("NULL")
|
||||
sql show tags from st_geometry_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_geometry_5 using mt_geometry tags("NULL")
|
||||
sql show tags from st_geometry_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_geometry_6 using mt_geometry tags("POINT(1.0 1.0)")
|
||||
sql show tags from st_geometry_6
|
||||
if $data05 != @POINT (1.000000 1.000000)@ then
|
||||
print $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_geometry_7 using mt_geometry tags(" LINESTRING(1.0 1.0, 2.0 2.0)")
|
||||
sql show tags from st_geometry_7
|
||||
if $data05 != @LINESTRING (1.000000 1.000000, 2.000000 2.000000)@ then
|
||||
print $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_geometry_8 using mt_geometry tags("POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))")
|
||||
sql show tags from st_geometry_8
|
||||
if $data05 != @POLYGON ((1.000000 1.000000, -2.000000 2.000000, 1.000000 1.000000))@ then
|
||||
print $data05
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_geometry_0 values(now, NULL)
|
||||
sql select *from st_geometry_0
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_1 values(now, NULL)
|
||||
sql select *from st_geometry_1
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_2 values(now, 'NULL')
|
||||
sql select *from st_geometry_2
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_3 values(now, 'NULL')
|
||||
sql select *from st_geometry_3
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_4 values(now, "NULL")
|
||||
sql select *from st_geometry_4
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_5 values(now, "NULL")
|
||||
sql select *from st_geometry_5
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_6 values(now, "POINT(1.0 1.0)")
|
||||
sql select *from st_geometry_6
|
||||
if $data01 != @POINT (1.000000 1.000000)@ then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_geometry_7 values(now, " LINESTRING(1.0 1.0, 2.0 2.0)")
|
||||
sql select *from st_geometry_7
|
||||
if $data01 != @LINESTRING (1.000000 1.000000, 2.000000 2.000000)@ then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_geometry_8 values(now, "POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))")
|
||||
sql select *from st_geometry_8
|
||||
if $data01 != @POLYGON ((1.000000 1.000000, -2.000000 2.000000, 1.000000 1.000000))@ then
|
||||
# return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_geometry_100 using mt_geometry tags(NULL) values(now, NULL)
|
||||
sql show tags from st_geometry_100
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_100
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_101 using mt_geometry tags(NULL) values(now, NULL)
|
||||
sql show tags from st_geometry_101
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_100
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_102 using mt_geometry tags('NULL') values(now, 'NULL')
|
||||
sql show tags from st_geometry_102
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_100
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_103 using mt_geometry tags('NULL') values(now, 'NULL')
|
||||
sql show tags from st_geometry_103
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_100
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_104 using mt_geometry tags("NULL") values(now, "NULL")
|
||||
sql show tags from st_geometry_104
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_100
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_105 using mt_geometry tags("NULL") values(now, "NULL")
|
||||
sql show tags from st_geometry_105
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_100
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_geometry_106 using mt_geometry tags("POINT(1.0 1.0)") values(now, "POINT(1.0 1.0)")
|
||||
sql show tags from st_geometry_106
|
||||
if $data05 != @POINT (1.000000 1.000000)@ then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_106
|
||||
if $data01 != @POINT (1.000000 1.000000)@ then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_geometry_107 using mt_geometry tags(" LINESTRING(1.0 1.0, 2.0 2.0)") values(now, "LINESTRING(1.0 1.0, 2.0 2.0)")
|
||||
sql show tags from st_geometry_107
|
||||
if $data05 != @LINESTRING (1.000000 1.000000, 2.000000 2.000000)@ then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_107
|
||||
if $data01 != @LINESTRING (1.000000 1.000000, 2.000000 2.000000)@ then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_geometry_108 using mt_geometry tags("POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))") values(now, "POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))")
|
||||
sql show tags from st_geometry_108
|
||||
if $data05 != @POLYGON ((1.000000 1.000000, -2.000000 2.000000, 1.000000 1.000000))@ then
|
||||
return -1
|
||||
endi
|
||||
sql select *from st_geometry_108
|
||||
if $data01 != @POLYGON ((1.000000 1.000000, -2.000000 2.000000, 1.000000 1.000000))@ then
|
||||
# return -1
|
||||
endi
|
||||
|
||||
## case 03: alter tag values
|
||||
sql alter table st_geometry_0 set tag tagname=NULL
|
||||
sql show tags from st_geometry_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_geometry_1 set tag tagname=NULL
|
||||
sql show tags from st_geometry_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_geometry_2 set tag tagname='NULL'
|
||||
sql show tags from st_geometry_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_geometry_3 set tag tagname='NULL'
|
||||
sql show tags from st_geometry_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_geometry_4 set tag tagname="NULL"
|
||||
sql show tags from st_geometry_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_geometry_5 set tag tagname="NULL"
|
||||
sql show tags from st_geometry_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_geometry_6 set tag tagname="POINT(1.0 1.0)"
|
||||
sql show tags from st_geometry_6
|
||||
if $data05 != @POINT (1.000000 1.000000)@ then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_geometry_7 set tag tagname=" LINESTRING(1.0 1.0, 2.0 2.0)"
|
||||
sql show tags from st_geometry_7
|
||||
if $data05 != @LINESTRING (1.000000 1.000000, 2.000000 2.000000)@ then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_geometry_8 set tag tagname="POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))"
|
||||
sql show tags from st_geometry_8
|
||||
if $data05 != @POLYGON ((1.000000 1.000000, -2.000000 2.000000, 1.000000 1.000000))@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
# case 04: illegal input
|
||||
sql_error create table st_geometry_206 using mt_geometry tags(+0123)
|
||||
sql_error create table st_geometry_207 using mt_geometry tags(-01.23)
|
||||
sql_error create table st_geometry_208 using mt_geometry tags(+0x01)
|
||||
sql_error create table st_geometry_209 using mt_geometry tags(-0b01)
|
||||
sql_error create table st_geometry_2010 using mt_geometry tags(-0.1e-10)
|
||||
sql_error create table st_geometry_2011 using mt_geometry tags(+0.1E+2)
|
||||
sql_error create table st_geometry_2012 using mt_geometry tags(tRue)
|
||||
sql_error create table st_geometry_2013 using mt_geometry tags(FalsE)
|
||||
sql_error create table st_geometry_2014 using mt_geometry tags(noW)
|
||||
sql_error create table st_geometry_2015 using mt_geometry tags(toDay)
|
||||
sql_error insert into st_geometry_206 using mt_geometry tags(+0123) values(now, NULL);
|
||||
sql_error insert into st_geometry_207 using mt_geometry tags(-01.23) values(now, NULL);
|
||||
sql_error insert into st_geometry_208 using mt_geometry tags(+0x01) values(now, NULL);
|
||||
sql_error insert into st_geometry_209 using mt_geometry tags(-0b01) values(now, NULL);
|
||||
sql_error insert into st_geometry_2010 using mt_geometry tags(-0.1e-10) values(now, NULL);
|
||||
sql_error insert into st_geometry_2011 using mt_geometry tags(+0.1E+2) values(now, NULL);
|
||||
sql_error insert into st_geometry_2012 using mt_geometry tags(tRue) values(now, NULL);
|
||||
sql_error insert into st_geometry_2013 using mt_geometry tags(FalsE) values(now, NULL);
|
||||
sql_error insert into st_geometry_2014 using mt_geometry tags(noW) values(now, NULL);
|
||||
sql_error insert into st_geometry_2015 using mt_geometry tags(toDay) values(now, NULL);
|
||||
sql_error insert into st_geometry_106 using mt_varbinary tags(NULL) values(now(), +0123)
|
||||
sql_error insert into st_geometry_107 using mt_varbinary tags(NULL) values(now(), -01.23)
|
||||
sql_error insert into st_geometry_108 using mt_varbinary tags(NULL) values(now(), +0x01)
|
||||
sql_error insert into st_geometry_109 using mt_varbinary tags(NULL) values(now(), -0b01)
|
||||
sql_error insert into st_geometry_1010 using mt_varbinary tags(NULL) values(now(), -0.1e-10)
|
||||
sql_error insert into st_geometry_1011 using mt_varbinary tags(NULL) values(now(), +0.1E+2)
|
||||
sql_error insert into st_geometry_1012 using mt_varbinary tags(NULL) values(now(), tRue)
|
||||
sql_error insert into st_geometry_1013 using mt_varbinary tags(NULL) values(now(), FalsE)
|
||||
sql_error insert into st_geometry_1014 using mt_varbinary tags(NULL) values(now(), noW)
|
||||
sql_error insert into st_geometry_1015 using mt_varbinary tags(NULL) values(now(), toDay)
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -28,10 +28,26 @@ if $data05 != NULL then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error create table st_int_2 using mt_int tags ('NULL')
|
||||
sql_error create table st_int_3 using mt_int tags ('NULL')
|
||||
sql_error create table st_int_4 using mt_int tags ("NULL")
|
||||
sql_error create table st_int_5 using mt_int tags ("NULL")
|
||||
sql create table st_int_2 using mt_int tags ('NULL')
|
||||
sql show tags from st_int_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_3 using mt_int tags ('NULL')
|
||||
sql show tags from st_int_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_4 using mt_int tags ("NULL")
|
||||
sql show tags from st_int_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_5 using mt_int tags ("NULL")
|
||||
sql show tags from st_int_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_int_6 using mt_int tags (-2147483647)
|
||||
sql show tags from st_int_6
|
||||
|
@ -78,6 +94,103 @@ sql show tags from st_int_14
|
|||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_100 using mt_int tags ("0x01")
|
||||
sql show tags from st_int_100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_101 using mt_int tags ("0b01")
|
||||
sql show tags from st_int_101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_102 using mt_int tags ("+0x01")
|
||||
sql show tags from st_int_102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_103 using mt_int tags ("-0b01")
|
||||
sql show tags from st_int_103
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_104 using mt_int tags ("-123.1")
|
||||
sql show tags from st_int_104
|
||||
if $data05 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_105 using mt_int tags ("+123.5")
|
||||
sql show tags from st_int_105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_106 using mt_int tags ("-1e-1")
|
||||
sql show tags from st_int_106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_107 using mt_int tags ("+0.1235e3")
|
||||
sql show tags from st_int_107
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_108 using mt_int tags ("-0.11e-30")
|
||||
sql show tags from st_int_108
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_109 using mt_int tags ("-1.1e-307")
|
||||
sql show tags from st_int_109
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_110 using mt_int tags ( -1e-1 )
|
||||
sql show tags from st_int_110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_111 using mt_int tags ( +0.1235e3 )
|
||||
sql show tags from st_int_111
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_112 using mt_int tags (-0.11e-30)
|
||||
sql show tags from st_int_112
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_113 using mt_int tags (-1.1e-307)
|
||||
sql show tags from st_int_113
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_200 using mt_int tags ( 0x01)
|
||||
sql show tags from st_int_200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_201 using mt_int tags (0b01 )
|
||||
sql show tags from st_int_201
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_202 using mt_int tags (+0x01)
|
||||
sql show tags from st_int_202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_int_203 using mt_int tags ( -0b01 )
|
||||
sql show tags from st_int_203
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_int_0 values (now, NULL)
|
||||
|
@ -171,6 +284,122 @@ if $data01 != -56 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_int_100 values (now, "0x01")
|
||||
sql select * from st_int_100
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_101 values (now, "0b01")
|
||||
sql select * from st_int_101
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_102 values (now, "+0x01")
|
||||
sql select * from st_int_102
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_103 values (now, "-0b01")
|
||||
sql select * from st_int_103
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_104 values (now, "-123.1")
|
||||
sql select * from st_int_104
|
||||
if $data01 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_105 values (now, "+123.5")
|
||||
sql select * from st_int_105
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_106 values (now, "-1e-1")
|
||||
sql select * from st_int_106
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_107 values (now, "+0.1235e3")
|
||||
sql select * from st_int_107
|
||||
if $data01 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_108 values (now, "-0.11e-30")
|
||||
sql select * from st_int_108
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_109 values (now, "-1.1e-307")
|
||||
sql select * from st_int_109
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_110 values (now, -1e-1 )
|
||||
sql select * from st_int_110
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_111 values (now, +0.1235e3 )
|
||||
sql select * from st_int_111
|
||||
if $data01 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_112 values (now, -0.11e-30)
|
||||
sql select * from st_int_112
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_113 values (now, -1.1e-307)
|
||||
sql select * from st_int_113
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_200 values (now, 0x01)
|
||||
sql select * from st_int_200
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_201 values (now, 0b01 )
|
||||
sql select * from st_int_201
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_202 values (now, +0x01)
|
||||
sql select * from st_int_202
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_int_203 values (now, -0b01 )
|
||||
sql select * from st_int_203
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_int_16 using mt_int tags (NULL) values (now, NULL)
|
||||
sql show create table st_int_16
|
||||
|
@ -291,52 +520,308 @@ sql select * from st_int_28
|
|||
if $data01 != -56 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1100 using mt_int tags ("0x01") values(now, "0x01");
|
||||
sql show tags from st_int_1100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1100
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1101 using mt_int tags ("0b01") values(now, "0b01");
|
||||
sql show tags from st_int_1101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1101
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1102 using mt_int tags ("+0x01") values(now, "+0x01");
|
||||
sql show tags from st_int_1102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1102
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1103 using mt_int tags ("-0b01") values(now, "-0b01");
|
||||
sql show tags from st_int_1103
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1103
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1104 using mt_int tags ("-123.1") values(now, "-123.1");
|
||||
sql show tags from st_int_1104
|
||||
if $data05 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1104
|
||||
if $data01 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1105 using mt_int tags ("+123.5") values(now, "+123.5");
|
||||
sql show tags from st_int_1105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1105
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1106 using mt_int tags ("-1e-1") values(now, "-1e-1");
|
||||
sql show tags from st_int_1106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1106
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1107 using mt_int tags ("+0.1235e3") values(now, "+0.1235e3");
|
||||
sql show tags from st_int_1107
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1108 using mt_int tags ("-0.11e-30") values(now, "-0.11e-30");
|
||||
sql show tags from st_int_1108
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1108
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1109 using mt_int tags ("-1.1e-307") values(now, "-1.1e-307");
|
||||
sql show tags from st_int_1109
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1109
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1110 using mt_int tags ( -1e-1 ) values(now, -1e-1);
|
||||
sql show tags from st_int_1110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1110
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1111 using mt_int tags ( +0.1235e3 ) values(now, +0.1235e3);
|
||||
sql show tags from st_int_1111
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1111
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1112 using mt_int tags (-0.11e-30) values(now, -0.11e-30);
|
||||
sql show tags from st_int_1112
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1112
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1113 using mt_int tags (-1.1e-307) values(now, -1.1e-307);
|
||||
sql show tags from st_int_1113
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1113
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1200 using mt_int tags ( 0x01) values(now, 0x01);
|
||||
sql show tags from st_int_1200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1200
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1201 using mt_int tags (0b01 ) values(now, 0b01);
|
||||
sql show tags from st_int_1201
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1201
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1202 using mt_int tags (+0x01) values(now, +0x01);
|
||||
sql show tags from st_int_1202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1202
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_int_1203 using mt_int tags ( -0b01 ) values(now, -0b01);
|
||||
sql show tags from st_int_1203
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1203
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
### case 03: alter tag values
|
||||
#sql alter table st_int_0 set tag tagname=2147483647
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 2147483647 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-2147483647
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -2147483647 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=+100
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 100 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-33
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -33 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname='+98'
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 98 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname='-076'
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -76 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=+0012
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 12 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-00063
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -63 then
|
||||
# return -1
|
||||
#endi
|
||||
sql alter table st_int_0 set tag tagname=2147483647
|
||||
sql show tags from st_int_0
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=-2147483647
|
||||
sql show tags from st_int_0
|
||||
if $data05 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=+100
|
||||
sql show tags from st_int_0
|
||||
if $data05 != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=-33
|
||||
sql show tags from st_int_0
|
||||
if $data05 != -33 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname='+98'
|
||||
sql show tags from st_int_0
|
||||
if $data05 != 98 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname='-076'
|
||||
sql show tags from st_int_0
|
||||
if $data05 != -76 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=+0012
|
||||
sql show tags from st_int_0
|
||||
if $data05 != 12 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=-00063
|
||||
sql show tags from st_int_0
|
||||
if $data05 != -63 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_100 set tag tagname="0x01"
|
||||
sql show tags from st_int_100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_101 set tag tagname="0b01"
|
||||
sql show tags from st_int_101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_102 set tag tagname="+0x01"
|
||||
sql show tags from st_int_102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_103 set tag tagname="-0b01"
|
||||
sql show tags from st_int_103
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_104 set tag tagname="-123.1"
|
||||
sql show tags from st_int_104
|
||||
if $data05 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_105 set tag tagname="+123.5"
|
||||
sql show tags from st_int_105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_106 set tag tagname="-1e-1"
|
||||
sql show tags from st_int_106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_107 set tag tagname="+0.1235e3"
|
||||
sql show tags from st_int_107
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_108 set tag tagname="-0.11e-30"
|
||||
sql show tags from st_int_108
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_109 set tag tagname="-1.1e-307"
|
||||
sql show tags from st_int_109
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_110 set tag tagname= -1e-1
|
||||
sql show tags from st_int_110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_111 set tag tagname= +0.1235e3
|
||||
sql show tags from st_int_111
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_112 set tag tagname=-0.11e-30
|
||||
sql show tags from st_int_112
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_113 set tag tagname=-1.1e-307
|
||||
sql show tags from st_int_113
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_200 set tag tagname= 0x01
|
||||
sql show tags from st_int_200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_201 set tag tagname=0b01
|
||||
sql show tags from st_int_201
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_202 set tag tagname=+0x01
|
||||
sql show tags from st_int_202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_203 set tag tagname= -0b01
|
||||
sql show tags from st_int_203
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_int_e0 using mt_int tags (2147483648)
|
||||
sql create table st_int_e0_err1 using mt_int tags (-2147483648)
|
||||
sql_error create table st_int_e0_err2 using mt_int tags (-2147483649)
|
||||
sql_error create table st_int_e0 using mt_int tags (214748364800)
|
||||
sql_error create table st_int_e0 using mt_int tags (-214748364800)
|
||||
#sql_error create table st_int_e0 using mt_int tags (12.80) truncate integer part
|
||||
|
@ -346,7 +831,7 @@ sql_error create table st_int_e0 using mt_int tags ("123abc")
|
|||
sql_error create table st_int_e0 using mt_int tags (abc)
|
||||
sql_error create table st_int_e0 using mt_int tags ("abc")
|
||||
sql_error create table st_int_e0 using mt_int tags (" ")
|
||||
sql create table st_int_e0_err2 using mt_int tags ('')
|
||||
sql_error create table st_int_e0_err2 using mt_int tags ('')
|
||||
|
||||
sql create table st_int_e0 using mt_int tags (123)
|
||||
sql create table st_int_e1 using mt_int tags (123)
|
||||
|
@ -399,7 +884,10 @@ sql_error insert into st_int_e20 using mt_int tags ("123abc") values (now, -033)
|
|||
sql_error insert into st_int_e22 using mt_int tags (abc) values (now, -033)
|
||||
sql_error insert into st_int_e23 using mt_int tags ("abc") values (now, -033)
|
||||
sql_error insert into st_int_e24 using mt_int tags (" ") values (now, -033)
|
||||
sql insert into st_int_e25_1 using mt_int tags ('') values (now, -033)
|
||||
sql_error insert into st_int_e25_1 using mt_int tags ('') values (now, -033)
|
||||
sql insert into st_int_e26_1 using mt_int tags ('123') values (now, -033)
|
||||
sql insert into st_int_e27_1 using mt_int tags ('12.80') values (now, -033)
|
||||
sql insert into st_int_e28_1 using mt_int tags ('-11.80') values (now, -033)
|
||||
|
||||
sql insert into st_int_e13 using mt_int tags (033) values (now, 00062)
|
||||
sql insert into st_int_e14 using mt_int tags (033) values (now, 00062)
|
||||
|
@ -415,8 +903,10 @@ sql insert into st_int_e23 using mt_int tags (033) values (now, 00062)
|
|||
sql insert into st_int_e24 using mt_int tags (033) values (now, 00062)
|
||||
sql insert into st_int_e25 using mt_int tags (033) values (now, 00062)
|
||||
|
||||
sql alter table st_int_e13 set tag tagname=2147483647
|
||||
sql_error alter table st_int_e13 set tag tagname=2147483648
|
||||
sql alter table st_int_e14 set tag tagname=-2147483648
|
||||
sql_error alter table st_int_e14 set tag tagname=2147483649
|
||||
sql_error alter table st_int_e15 set tag tagname=12147483648
|
||||
sql_error alter table st_int_e16 set tag tagname=-3147483648
|
||||
sql_error alter table st_int_e19 set tag tagname=123abc
|
||||
|
@ -424,6 +914,9 @@ sql_error alter table st_int_e20 set tag tagname="123abc"
|
|||
sql_error alter table st_int_e22 set tag tagname=abc
|
||||
sql_error alter table st_int_e23 set tag tagname="abc"
|
||||
sql_error alter table st_int_e24 set tag tagname=" "
|
||||
sql alter table st_int_e25 set tag tagname=''
|
||||
sql_error alter table st_int_e25 set tag tagname=''
|
||||
sql alter table st_int_e26_1 set tag tagname='123'
|
||||
sql alter table st_int_e27_1 set tag tagname='12.80'
|
||||
sql alter table st_int_e28_1 set tag tagname='-11.80'
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
||||
######## case 0: json
|
||||
print ========== json
|
||||
sql create table mt_json (ts timestamp, c varchar(50)) tags(tagname json)
|
||||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_json_0 using mt_json tags(NULL)
|
||||
sql show tags from st_json_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_json_1 using mt_json tags(NULL)
|
||||
sql show tags from st_json_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_json_2 using mt_json tags('NULL')
|
||||
sql show tags from st_json_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_json_3 using mt_json tags('NULL')
|
||||
sql show tags from st_json_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_json_4 using mt_json tags("NULL")
|
||||
sql show tags from st_json_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_json_5 using mt_json tags("NULL")
|
||||
sql show tags from st_json_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_json_6 using mt_json tags("")
|
||||
sql show tags from st_json_6
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_json_7 using mt_json tags(" ")
|
||||
sql show tags from st_json_7
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_json_8 using mt_json tags("{\"k1\":\"v1\",\"k2\":\"v2\"}")
|
||||
sql show tags from st_json_8
|
||||
if $data05 != {"k1":"v1","k2":"v2"} then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_json_100 using mt_json tags(NULL) values(now,NULL)
|
||||
sql show tags from st_json_100
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_100
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_json_101 using mt_json tags(NULL) values(now,NULL)
|
||||
sql show tags from st_json_101
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_101
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_json_102 using mt_json tags('NULL') values(now,'NULL')
|
||||
sql show tags from st_json_102
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_102
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_json_103 using mt_json tags('NULL') values(now,'NULL')
|
||||
sql show tags from st_json_103
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_103
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_json_104 using mt_json tags("NULL") values(now,"NULL")
|
||||
sql show tags from st_json_104
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_104
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_json_105 using mt_json tags("NULL") values(now,"NULL")
|
||||
sql show tags from st_json_105
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_105
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_json_106 using mt_json tags("") values(now,"vc")
|
||||
sql show tags from st_json_106
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_106
|
||||
if $data01 != vc then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_json_107 using mt_json tags(" ") values(now,"vc")
|
||||
sql show tags from st_json_107
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_107
|
||||
if $data01 != vc then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_json_108 using mt_json tags("{\"k1\":\"v1\",\"k2\":\"v2\"} ") values(now,"vc")
|
||||
sql show tags from st_json_108
|
||||
if $data05 != {"k1":"v1","k2":"v2"} then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_json_108
|
||||
if $data01 != vc then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 03: alter tag values
|
||||
sql alter table st_json_100 set tag tagname=NULL
|
||||
sql show tags from st_json_100
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_json_101 set tag tagname=NULL
|
||||
sql show tags from st_json_101
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_json_102 set tag tagname='NULL'
|
||||
sql show tags from st_json_102
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_json_103 set tag tagname='NULL'
|
||||
sql show tags from st_json_103
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_json_104 set tag tagname="NULL"
|
||||
sql show tags from st_json_104
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_json_105 set tag tagname="NULL"
|
||||
sql show tags from st_json_105
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_json_106 set tag tagname=""
|
||||
sql show tags from st_json_106
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_json_107 set tag tagname=" "
|
||||
sql show tags from st_json_107
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_json_108 set tag tagname="{\"k1\":\"v1\",\"k2\":\"v2\"}"
|
||||
sql show tags from st_json_108
|
||||
if $data05 != {"k1":"v1","k2":"v2"} then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
# case 04: illegal input
|
||||
sql_error create table st_json_206 using mt_json tags(+0123)
|
||||
sql_error create table st_json_207 using mt_json tags(-01.23)
|
||||
sql_error create table st_json_208 using mt_json tags(+0x01)
|
||||
sql_error create table st_json_209 using mt_json tags(-0b01)
|
||||
sql_error create table st_json_2010 using mt_json tags(-0.1e-10)
|
||||
sql_error create table st_json_2011 using mt_json tags(+0.1E+2)
|
||||
sql_error create table st_json_2012 using mt_json tags(tRue)
|
||||
sql_error create table st_json_2013 using mt_json tags(FalsE)
|
||||
sql_error create table st_json_2014 using mt_json tags(noW)
|
||||
sql_error create table st_json_2015 using mt_json tags(toDay)
|
||||
sql_error insert into st_json_206 using mt_json tags(+0123) values(now, NULL);
|
||||
sql_error insert into st_json_207 using mt_json tags(-01.23) values(now, NULL);
|
||||
sql_error insert into st_json_208 using mt_json tags(+0x01) values(now, NULL);
|
||||
sql_error insert into st_json_209 using mt_json tags(-0b01) values(now, NULL);
|
||||
sql_error insert into st_json_2010 using mt_json tags(-0.1e-10) values(now, NULL);
|
||||
sql_error insert into st_json_2011 using mt_json tags(+0.1E+2) values(now, NULL);
|
||||
sql_error insert into st_json_2012 using mt_json tags(tRue) values(now, NULL);
|
||||
sql_error insert into st_json_2013 using mt_json tags(FalsE) values(now, NULL);
|
||||
sql_error insert into st_json_2014 using mt_json tags(noW) values(now, NULL);
|
||||
sql_error insert into st_json_2015 using mt_json tags(toDay) values(now, NULL);
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -0,0 +1,415 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
||||
######## case 0: nchar
|
||||
print ========== nchar
|
||||
sql create table mt_nchar (ts timestamp, c nchar(50)) tags (tagname nchar(50))
|
||||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_nchar_0 using mt_nchar tags (NULL)
|
||||
sql show create table st_nchar_0
|
||||
sql show tags from st_nchar_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_1 using mt_nchar tags (NULL)
|
||||
sql show tags from st_nchar_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_2 using mt_nchar tags ('NULL')
|
||||
sql show tags from st_nchar_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_3 using mt_nchar tags ('NULL')
|
||||
sql show tags from st_nchar_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_4 using mt_nchar tags ("NULL")
|
||||
sql show tags from st_nchar_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_5 using mt_nchar tags ("NULL")
|
||||
sql show tags from st_nchar_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_6 using mt_nchar tags (+0123)
|
||||
sql show tags from st_nchar_6
|
||||
if $data05 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_7 using mt_nchar tags (-01.23)
|
||||
sql show tags from st_nchar_7
|
||||
if $data05 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_8 using mt_nchar tags (+0x01)
|
||||
sql show tags from st_nchar_8
|
||||
if $data05 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_9 using mt_nchar tags (-0b01)
|
||||
sql show tags from st_nchar_9
|
||||
if $data05 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_10 using mt_nchar tags (-0.1e-10)
|
||||
sql show tags from st_nchar_10
|
||||
if $data05 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_11 using mt_nchar tags (+0.1E+2)
|
||||
sql show tags from st_nchar_11
|
||||
if $data05 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_12 using mt_nchar tags (tRue)
|
||||
sql show tags from st_nchar_12
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_13 using mt_nchar tags (FalsE)
|
||||
sql show tags from st_nchar_13
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_14 using mt_nchar tags (noW)
|
||||
sql show tags from st_nchar_14
|
||||
if $data05 != now then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_nchar_15 using mt_nchar tags (toDay)
|
||||
sql show tags from st_nchar_15
|
||||
if $data05 != today then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_nchar_0 values(now, NULL)
|
||||
sql select * from st_nchar_0
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_1 values(now, NULL)
|
||||
sql select * from st_nchar_1
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_2 values(now, 'NULL')
|
||||
sql select * from st_nchar_2
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_3 values(now, 'NULL')
|
||||
sql select * from st_nchar_3
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_4 values(now, "NULL")
|
||||
sql select * from st_nchar_4
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_5 values(now, "NULL")
|
||||
sql select * from st_nchar_5
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_6 values(now, +0123)
|
||||
sql select * from st_nchar_6
|
||||
if $data01 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_7 values(now, -01.23)
|
||||
sql select * from st_nchar_7
|
||||
if $data01 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_8 values(now, +0x01)
|
||||
sql select * from st_nchar_8
|
||||
if $data01 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_9 values(now, -0b01)
|
||||
sql select * from st_nchar_9
|
||||
if $data01 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_10 values(now, -0.1e-10)
|
||||
sql select * from st_nchar_10
|
||||
if $data01 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_11 values(now, +0.1E+2)
|
||||
sql select * from st_nchar_11
|
||||
if $data01 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_12 values(now, tRue)
|
||||
sql select * from st_nchar_12
|
||||
if $data01 != true then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_13 values(now, FalsE)
|
||||
sql select * from st_nchar_13
|
||||
if $data01 != false then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_14 values(now, noW)
|
||||
sql select * from st_nchar_14
|
||||
if $data01 != now then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_15 values(now, toDay)
|
||||
sql select * from st_nchar_15
|
||||
if $data01 != today then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_nchar_0 using mt_nchar tags (NULL) values(now, NULL)
|
||||
sql show tags from st_nchar_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_0
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_1 using mt_nchar tags (NULL) values(now, NULL)
|
||||
sql show tags from st_nchar_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_1
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_2 using mt_nchar tags ('NULL') values(now, 'NULL')
|
||||
sql show tags from st_nchar_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_2
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_3 using mt_nchar tags ('NULL') values(now, 'NULL')
|
||||
sql show tags from st_nchar_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_3
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_4 using mt_nchar tags ("NULL") values(now, "NULL")
|
||||
sql show tags from st_nchar_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_4
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_5 using mt_nchar tags ("NULL") values(now, "NULL")
|
||||
sql show tags from st_nchar_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_5
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_6 using mt_nchar tags (+0123) values(now, +0123)
|
||||
sql show tags from st_nchar_6
|
||||
if $data05 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_6
|
||||
if $data01 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_7 using mt_nchar tags (-01.23) values(now, -01.23)
|
||||
sql show tags from st_nchar_7
|
||||
if $data05 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_7
|
||||
if $data01 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_8 using mt_nchar tags (+0x01) values(now, +0x01)
|
||||
sql show tags from st_nchar_8
|
||||
if $data05 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_8
|
||||
if $data01 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_9 using mt_nchar tags (-0b01) values(now, -0b01)
|
||||
sql show tags from st_nchar_9
|
||||
if $data05 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_9
|
||||
if $data01 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_10 using mt_nchar tags (-0.1e-10) values(now, -0.1e-10)
|
||||
sql show tags from st_nchar_10
|
||||
if $data05 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_10
|
||||
if $data01 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_11 using mt_nchar tags (+0.1E+2) values(now, +0.1E+2)
|
||||
sql show tags from st_nchar_11
|
||||
if $data05 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_11
|
||||
if $data01 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_12 using mt_nchar tags (tRue) values(now, tRue)
|
||||
sql show tags from st_nchar_12
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_12
|
||||
if $data01 != true then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_13 using mt_nchar tags (FalsE) values(now, FalsE)
|
||||
sql show tags from st_nchar_13
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_13
|
||||
if $data01 != false then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_14 using mt_nchar tags (noW) values(now, noW)
|
||||
sql show tags from st_nchar_14
|
||||
if $data05 != now then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_14
|
||||
if $data01 != now then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_nchar_15 using mt_nchar tags (toDay) values(now, toDay)
|
||||
sql show tags from st_nchar_15
|
||||
if $data05 != today then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_nchar_15
|
||||
if $data01 != today then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 03: alter tag values
|
||||
sql alter table st_nchar_0 set tag tagname=NULL
|
||||
sql show tags from st_nchar_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_1 set tag tagname=NULL
|
||||
sql show tags from st_nchar_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_2 set tag tagname='NULL'
|
||||
sql show tags from st_nchar_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_3 set tag tagname='NULL'
|
||||
sql show tags from st_nchar_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_4 set tag tagname="NULL"
|
||||
sql show tags from st_nchar_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_5 set tag tagname="NULL"
|
||||
sql show tags from st_nchar_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_6 set tag tagname=+0123
|
||||
sql show tags from st_nchar_6
|
||||
if $data05 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_7 set tag tagname=-01.23
|
||||
sql show tags from st_nchar_7
|
||||
if $data05 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_8 set tag tagname=+0x01
|
||||
sql show tags from st_nchar_8
|
||||
if $data05 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_9 set tag tagname=-0b01
|
||||
sql show tags from st_nchar_9
|
||||
if $data05 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_10 set tag tagname=-0.1e-10
|
||||
sql show tags from st_nchar_10
|
||||
if $data05 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_11 set tag tagname=+0.1E+2
|
||||
sql show tags from st_nchar_11
|
||||
if $data05 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_12 set tag tagname=tRue
|
||||
sql show tags from st_nchar_12
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_13 set tag tagname=FalsE
|
||||
sql show tags from st_nchar_13
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_14 set tag tagname=noW
|
||||
sql show tags from st_nchar_14
|
||||
if $data05 != now then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_nchar_15 set tag tagname=toDay
|
||||
sql show tags from st_nchar_15
|
||||
if $data05 != today then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
# case 04: illegal input
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -31,10 +31,27 @@ if $data05 != NULL then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error create table st_smallint_2 using mt_smallint tags ('NULL')
|
||||
sql_error create table st_smallint_3 using mt_smallint tags ('NULL')
|
||||
sql_error create table st_smallint_4 using mt_smallint tags ("NULL")
|
||||
sql_error create table st_smallint_5 using mt_smallint tags ("NULL")
|
||||
|
||||
sql create table st_smallint_2 using mt_smallint tags ('NULL')
|
||||
sql show tags from st_smallint_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_3 using mt_smallint tags ('NULL')
|
||||
sql show tags from st_smallint_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_4 using mt_smallint tags ("NULL")
|
||||
sql show tags from st_smallint_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_5 using mt_smallint tags ("NULL")
|
||||
sql show tags from st_smallint_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_smallint_6 using mt_smallint tags (-32767)
|
||||
sql show tags from st_smallint_6
|
||||
|
@ -349,7 +366,8 @@ sql_error create table st_smallint_e0 using mt_smallint tags ("123abc")
|
|||
sql_error create table st_smallint_e0 using mt_smallint tags (abc)
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags ("abc")
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags (" ")
|
||||
sql create table st_smallint_e0_1 using mt_smallint tags ('')
|
||||
sql_error create table st_smallint_e0_1 using mt_smallint tags ('')
|
||||
sql create table st_smallint_e0_2 using mt_smallint tags ('123')
|
||||
|
||||
sql create table st_smallint_e0 using mt_smallint tags (123)
|
||||
sql create table st_smallint_e1 using mt_smallint tags (123)
|
||||
|
@ -402,7 +420,8 @@ sql_error insert into st_smallint_e20 using mt_smallint tags ("123abc") values (
|
|||
sql_error insert into st_smallint_e22 using mt_smallint tags (abc) values (now, -033)
|
||||
sql_error insert into st_smallint_e23 using mt_smallint tags ("abc") values (now, -033)
|
||||
sql_error insert into st_smallint_e24 using mt_smallint tags (" ") values (now, -033)
|
||||
sql insert into st_smallint_e25 using mt_smallint tags ('') values (now, -033)
|
||||
sql_error insert into st_smallint_e25 using mt_smallint tags ('') values (now, -033)
|
||||
sql insert into st_smallint_e26 using mt_smallint tags ('123') values (now, -033)
|
||||
|
||||
sql insert into st_smallint_e13 using mt_smallint tags (033) values (now, 00062)
|
||||
sql insert into st_smallint_e14 using mt_smallint tags (033) values (now, 00062)
|
||||
|
@ -427,6 +446,7 @@ sql_error alter table st_smallint_e20 set tag tagname="123abc"
|
|||
sql_error alter table st_smallint_e22 set tag tagname=abc
|
||||
sql_error alter table st_smallint_e23 set tag tagname="abc"
|
||||
sql_error alter table st_smallint_e24 set tag tagname=" "
|
||||
sql alter table st_smallint_e25 set tag tagname=''
|
||||
sql_error alter table st_smallint_e25 set tag tagname=''
|
||||
sql alter table st_smallint_e26 set tag tagname='123'
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -0,0 +1,594 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
||||
######## case 0: timestamp
|
||||
print ========== timestamp
|
||||
sql create table mt_timestamp (ts timestamp, c timestamp) tags (tagname timestamp)
|
||||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_timestamp_0 using mt_timestamp tags (NULL)
|
||||
sql show create table st_timestamp_0
|
||||
sql show tags from st_timestamp_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_1 using mt_timestamp tags (NULL)
|
||||
sql show tags from st_timestamp_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_2 using mt_timestamp tags ('NULL')
|
||||
sql show tags from st_timestamp_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_3 using mt_timestamp tags ('NULL')
|
||||
sql show tags from st_timestamp_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_4 using mt_timestamp tags ("NULL")
|
||||
sql show tags from st_timestamp_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_5 using mt_timestamp tags ("NULL")
|
||||
sql show tags from st_timestamp_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_6 using mt_timestamp tags (-2147483647)
|
||||
sql show tags from st_timestamp_6
|
||||
if $data05 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_7 using mt_timestamp tags (2147483647)
|
||||
sql show tags from st_timestamp_7
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_8 using mt_timestamp tags (37)
|
||||
sql show tags from st_timestamp_8
|
||||
if $data05 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_9 using mt_timestamp tags (-100)
|
||||
sql show tags from st_timestamp_9
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_10 using mt_timestamp tags (+113)
|
||||
sql show tags from st_timestamp_10
|
||||
if $data05 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_11 using mt_timestamp tags ('-100')
|
||||
sql show tags from st_timestamp_11
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_12 using mt_timestamp tags ("-0")
|
||||
sql show tags from st_timestamp_12
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_13 using mt_timestamp tags (+0078)
|
||||
sql show tags from st_timestamp_13
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_14 using mt_timestamp tags (-00078)
|
||||
sql show tags from st_timestamp_14
|
||||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_15 using mt_timestamp tags ("0x01")
|
||||
sql show tags from st_timestamp_15
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_16 using mt_timestamp tags ("0b01")
|
||||
sql show tags from st_timestamp_16
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_17 using mt_timestamp tags ("+0x01")
|
||||
sql show tags from st_timestamp_17
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_18 using mt_timestamp tags ("-0b01")
|
||||
sql show tags from st_timestamp_18
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_19 using mt_timestamp tags ( 0x01)
|
||||
sql show tags from st_timestamp_19
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_20 using mt_timestamp tags (0b01 )
|
||||
sql show tags from st_timestamp_20
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_21 using mt_timestamp tags (+0x01)
|
||||
sql show tags from st_timestamp_21
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_timestamp_22 using mt_timestamp tags ( -0b01 )
|
||||
sql show tags from st_timestamp_22
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_timestamp_0 values(now,NULL)
|
||||
sql select * from st_timestamp_0
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1 values(now,NULL)
|
||||
sql select * from st_timestamp_1
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_2 values(now,'NULL')
|
||||
sql select * from st_timestamp_2
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_3 values(now,'NULL')
|
||||
sql select * from st_timestamp_3
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_4 values(now,"NULL")
|
||||
sql select * from st_timestamp_4
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_5 values(now,"NULL")
|
||||
sql select * from st_timestamp_5
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_6 values(now,-2147483647)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_6
|
||||
if $data01 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_7 values(now,2147483647)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_7
|
||||
if $data01 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_8 values(now,37)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_8
|
||||
if $data01 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_9 values(now,-100)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_9
|
||||
if $data01 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_10 values(now,+113)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_10
|
||||
if $data01 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_11 values(now,'-100')
|
||||
sql select ts, cast(c as bigint) from st_timestamp_11
|
||||
if $data01 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_12 values(now,"-0")
|
||||
sql select ts, cast(c as bigint) from st_timestamp_12
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_13 values(now,+0078)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_13
|
||||
if $data01 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_14 values(now,-00078)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_14
|
||||
if $data01 != -78 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_15 values(now,"0x01")
|
||||
sql select ts, cast(c as bigint) from st_timestamp_15
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_16 values(now,"0b01")
|
||||
sql select ts, cast(c as bigint) from st_timestamp_16
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_17 values(now,"+0x01")
|
||||
sql select ts, cast(c as bigint) from st_timestamp_17
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_18 values(now,"-0b01")
|
||||
sql select ts, cast(c as bigint) from st_timestamp_18
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_19 values(now, 0x01)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_19
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_20 values(now,0b01 )
|
||||
sql select ts, cast(c as bigint) from st_timestamp_20
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_21 values(now,+0x01)
|
||||
sql select ts, cast(c as bigint) from st_timestamp_21
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_22 values(now, -0b01 )
|
||||
sql select ts, cast(c as bigint) from st_timestamp_22
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_timestamp_100 using mt_timestamp tags(NULL) values(now, NULL)
|
||||
sql show tags from st_timestamp_100
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_timestamp_100
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_101 using mt_timestamp tags(NULL) values(now, NULL)
|
||||
sql show tags from st_timestamp_101
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_timestamp_101
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_102 using mt_timestamp tags('NULL') values(now, 'NULL')
|
||||
sql show tags from st_timestamp_102
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_timestamp_102
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_103 using mt_timestamp tags('NULL') values(now, 'NULL')
|
||||
sql show tags from st_timestamp_103
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_timestamp_103
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_104 using mt_timestamp tags("NULL") values(now, "NULL")
|
||||
sql show tags from st_timestamp_104
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_timestamp_104
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_105 using mt_timestamp tags("NULL") values(now, "NULL")
|
||||
sql show tags from st_timestamp_105
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_timestamp_105
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_106 using mt_timestamp tags(-2147483647) values(now, -2147483647)
|
||||
sql show tags from st_timestamp_106
|
||||
if $data05 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_106
|
||||
if $data01 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_107 using mt_timestamp tags(2147483647) values(now, 2147483647)
|
||||
sql show tags from st_timestamp_107
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_107
|
||||
if $data01 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_108 using mt_timestamp tags(37) values(now, 37)
|
||||
sql show tags from st_timestamp_108
|
||||
if $data05 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_108
|
||||
if $data01 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_109 using mt_timestamp tags(-100) values(now, -100)
|
||||
sql show tags from st_timestamp_109
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_109
|
||||
if $data01 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1010 using mt_timestamp tags(+113) values(now, +113)
|
||||
sql show tags from st_timestamp_1010
|
||||
if $data05 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1010
|
||||
if $data01 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1011 using mt_timestamp tags('-100') values(now, '-100')
|
||||
sql show tags from st_timestamp_1011
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1011
|
||||
if $data01 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1012 using mt_timestamp tags("-0") values(now, "-0")
|
||||
sql show tags from st_timestamp_1012
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1012
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1013 using mt_timestamp tags(+0078) values(now, +0078)
|
||||
sql show tags from st_timestamp_1013
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1013
|
||||
if $data01 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1014 using mt_timestamp tags(-00078) values(now, -00078)
|
||||
sql show tags from st_timestamp_1014
|
||||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1014
|
||||
if $data01 != -78 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1015 using mt_timestamp tags("0x01") values(now, "0x01")
|
||||
sql show tags from st_timestamp_1015
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1015
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1016 using mt_timestamp tags("0b01") values(now, "0b01")
|
||||
sql show tags from st_timestamp_1016
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1016
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1017 using mt_timestamp tags("+0x01") values(now, "+0x01")
|
||||
sql show tags from st_timestamp_1017
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1018 using mt_timestamp tags("-0b01") values(now, "-0b01")
|
||||
sql show tags from st_timestamp_1018
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1018
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1019 using mt_timestamp tags( 0x01) values(now, 0x01)
|
||||
sql show tags from st_timestamp_1019
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1020 using mt_timestamp tags(0b01 ) values(now, 0b01 )
|
||||
sql show tags from st_timestamp_1020
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1020
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1021 using mt_timestamp tags(+0x01) values(now, +0x01)
|
||||
sql show tags from st_timestamp_1021
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1021
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_timestamp_1022 using mt_timestamp tags( -0b01 ) values(now, -0b01)
|
||||
sql show tags from st_timestamp_1022
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql select ts, cast(c as bigint) from st_timestamp_1022
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
### case 03: alter tag values
|
||||
sql alter table st_timestamp_0 set tag tagname=NULL
|
||||
sql show tags from st_timestamp_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_1 set tag tagname=NULL
|
||||
sql show tags from st_timestamp_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_2 set tag tagname='NULL'
|
||||
sql show tags from st_timestamp_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_3 set tag tagname='NULL'
|
||||
sql show tags from st_timestamp_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_4 set tag tagname="NULL"
|
||||
sql show tags from st_timestamp_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_5 set tag tagname="NULL"
|
||||
sql show tags from st_timestamp_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_6 set tag tagname=-2147483647
|
||||
sql show tags from st_timestamp_6
|
||||
if $data05 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_7 set tag tagname=2147483647
|
||||
sql show tags from st_timestamp_7
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_8 set tag tagname=37
|
||||
sql show tags from st_timestamp_8
|
||||
if $data05 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_9 set tag tagname=-100
|
||||
sql show tags from st_timestamp_9
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_10 set tag tagname=+113
|
||||
sql show tags from st_timestamp_10
|
||||
if $data05 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_11 set tag tagname='-100'
|
||||
sql show tags from st_timestamp_11
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_12 set tag tagname="-0"
|
||||
sql show tags from st_timestamp_12
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_13 set tag tagname=+0078
|
||||
sql show tags from st_timestamp_13
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_14 set tag tagname=-00078
|
||||
sql show tags from st_timestamp_14
|
||||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_15 set tag tagname="0x01"
|
||||
sql show tags from st_timestamp_15
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_16 set tag tagname="0b01"
|
||||
sql show tags from st_timestamp_16
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_17 set tag tagname="+0x01"
|
||||
sql show tags from st_timestamp_17
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_18 set tag tagname="-0b01"
|
||||
sql show tags from st_timestamp_18
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_19 set tag tagname= 0x01
|
||||
sql show tags from st_timestamp_19
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_20 set tag tagname=0b01
|
||||
sql show tags from st_timestamp_20
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_21 set tag tagname=+0x01
|
||||
sql show tags from st_timestamp_21
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_timestamp_22 set tag tagname= -0b01
|
||||
sql show tags from st_timestamp_22
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_timestamp_e0 using mt_timestamp tags (123abc)
|
||||
sql_error create table st_timestamp_e0 using mt_timestamp tags ("123abc")
|
||||
sql_error create table st_timestamp_e0 using mt_timestamp tags (abc)
|
||||
sql_error create table st_timestamp_e0 using mt_timestamp tags ("abc")
|
||||
sql_error create table st_timestamp_e0 using mt_timestamp tags (" ")
|
||||
sql_error create table st_timestamp_e0 using mt_timestamp tags ('')
|
||||
sql_error create table st_timestamp_104 using mt_timestamp tags ("-123.1")
|
||||
sql_error create table st_timestamp_105 using mt_timestamp tags ("+123.5")
|
||||
sql_error create table st_timestamp_106 using mt_timestamp tags ("-1e-1")
|
||||
sql_error create table st_timestamp_107 using mt_timestamp tags ("+0.1235e3")
|
||||
sql_error create table st_timestamp_108 using mt_timestamp tags ("-0.11e-30")
|
||||
sql_error create table st_timestamp_109 using mt_timestamp tags ("-1.1e-307")
|
||||
sql_error create table st_timestamp_110 using mt_timestamp tags ( -1e-1 )
|
||||
sql_error create table st_timestamp_111 using mt_timestamp tags ( +0.1235e3 )
|
||||
sql_error create table st_timestamp_112 using mt_timestamp tags (-0.11e-30)
|
||||
sql_error create table st_timestamp_113 using mt_timestamp tags (-1.1e-307)
|
||||
sql create table st_timestamp_114 using mt_timestamp tags (9223372036854775807)
|
||||
sql_error create table st_timestamp_115 using mt_timestamp tags (9223372036854775808)
|
||||
sql create table st_timestamp_116 using mt_timestamp tags (-9223372036854775808)
|
||||
sql_error create table st_timestamp_117 using mt_timestamp tags (-9223372036854775809)
|
||||
sql_error insert into st_timestamp_118 using mt_timestamp tags(9223372036854775807) values(9223372036854775807, 9223372036854775807)
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -29,10 +29,26 @@ if $data05 != NULL then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error create table st_tinyint_2 using mt_tinyint tags ('NULL')
|
||||
sql_error create table st_tinyint_3 using mt_tinyint tags ('NULL')
|
||||
sql_error create table st_tinyint_4 using mt_tinyint tags ("NULL")
|
||||
sql_error create table st_tinyint_5 using mt_tinyint tags ("NULL")
|
||||
sql create table st_tinyint_2 using mt_tinyint tags ('NULL')
|
||||
sql show tags from st_tinyint_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_3 using mt_tinyint tags ('NULL')
|
||||
sql show tags from st_tinyint_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_4 using mt_tinyint tags ("NULL")
|
||||
sql show tags from st_tinyint_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_5 using mt_tinyint tags ("NULL")
|
||||
sql show tags from st_tinyint_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_tinyint_6 using mt_tinyint tags (-127)
|
||||
sql show tags from st_tinyint_6
|
||||
|
@ -97,6 +113,40 @@ endi
|
|||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_tinyint_2 values (now, NULL)
|
||||
sql select * from st_tinyint_2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_3 values (now, NULL)
|
||||
sql select * from st_tinyint_3
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_4 values (now, NULL)
|
||||
sql select * from st_tinyint_4
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_5 values (now, NULL)
|
||||
sql select * from st_tinyint_5
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_tinyint_6 values (now, 127)
|
||||
sql select * from st_tinyint_6
|
||||
if $rows != 1 then
|
||||
|
@ -347,7 +397,7 @@ sql_error create table st_tinyint_e0 using mt_tinyint tags ("123abc")
|
|||
sql_error create table st_tinyint_e0 using mt_tinyint tags (abc)
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags ("abc")
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags (" ")
|
||||
sql create table st_tinyint_e0_2 using mt_tinyint tags ('')
|
||||
sql_error create table st_tinyint_e0_2 using mt_tinyint tags ('')
|
||||
|
||||
sql create table st_tinyint_e0 using mt_tinyint tags (123)
|
||||
sql create table st_tinyint_e1 using mt_tinyint tags (123)
|
||||
|
@ -400,7 +450,7 @@ sql_error insert into st_tinyint_e20 using mt_tinyint tags ("123abc") values (no
|
|||
sql_error insert into st_tinyint_e22 using mt_tinyint tags (abc) values (now, -033)
|
||||
sql_error insert into st_tinyint_e23 using mt_tinyint tags ("abc") values (now, -033)
|
||||
sql_error insert into st_tinyint_e24 using mt_tinyint tags (" ") values (now, -033)
|
||||
sql insert into st_tinyint_e25 using mt_tinyint tags ('') values (now, -033)
|
||||
sql_error insert into st_tinyint_e25 using mt_tinyint tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_tinyint_e13 using mt_tinyint tags (033) values (now, 00062)
|
||||
sql insert into st_tinyint_e14 using mt_tinyint tags (033) values (now, 00062)
|
||||
|
@ -425,6 +475,6 @@ sql_error alter table st_tinyint_e20 set tag tagname="123abc"
|
|||
sql_error alter table st_tinyint_e22 set tag tagname=abc
|
||||
sql_error alter table st_tinyint_e23 set tag tagname="abc"
|
||||
sql_error alter table st_tinyint_e24 set tag tagname=" "
|
||||
sql alter table st_tinyint_e25 set tag tagname=''
|
||||
sql_error alter table st_tinyint_e25 set tag tagname=''
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -0,0 +1,904 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
||||
######## case 0: uint
|
||||
print ========== uint
|
||||
sql create table mt_uint (ts timestamp, c int unsigned) tags (tagname int unsigned)
|
||||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_uint_0 using mt_uint tags (NULL)
|
||||
sql show create table st_uint_0
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_1 using mt_uint tags (NULL)
|
||||
sql show tags from st_uint_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_uint_2 using mt_uint tags ('NULL')
|
||||
sql show tags from st_uint_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_3 using mt_uint tags ('NULL')
|
||||
sql show tags from st_uint_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_4 using mt_uint tags ("NULL")
|
||||
sql show tags from st_uint_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_5 using mt_uint tags ("-0")
|
||||
sql show tags from st_uint_5
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_6 using mt_uint tags (-0 )
|
||||
sql show tags from st_uint_6
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_7 using mt_uint tags (2147483647)
|
||||
sql show tags from st_uint_7
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_8 using mt_uint tags (37)
|
||||
sql show tags from st_uint_8
|
||||
if $data05 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_9 using mt_uint tags (098)
|
||||
sql show tags from st_uint_9
|
||||
if $data05 != 98 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_10 using mt_uint tags (+113)
|
||||
sql show tags from st_uint_10
|
||||
if $data05 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_11 using mt_uint tags (+000.000)
|
||||
sql show tags from st_uint_11
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_12 using mt_uint tags ("+78")
|
||||
sql show tags from st_uint_12
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_13 using mt_uint tags (+0078)
|
||||
sql show tags from st_uint_13
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_14 using mt_uint tags (00078)
|
||||
sql show tags from st_uint_14
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_100 using mt_uint tags ("0x01")
|
||||
sql show tags from st_uint_100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_101 using mt_uint tags ("0b01")
|
||||
sql show tags from st_uint_101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_102 using mt_uint tags ("+0x01")
|
||||
sql show tags from st_uint_102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_103 using mt_uint tags ("-0b00")
|
||||
sql show tags from st_uint_103
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_104 using mt_uint tags ("123.1")
|
||||
sql show tags from st_uint_104
|
||||
if $data05 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_105 using mt_uint tags ("+123.5")
|
||||
sql show tags from st_uint_105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_106 using mt_uint tags ("-1e-1")
|
||||
sql show tags from st_uint_106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_107 using mt_uint tags ("+0.1235e3")
|
||||
sql show tags from st_uint_107
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_108 using mt_uint tags ("-0.11e-30")
|
||||
sql show tags from st_uint_108
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_109 using mt_uint tags ("-1.1e-307")
|
||||
sql show tags from st_uint_109
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_110 using mt_uint tags ( -1e-1 )
|
||||
sql show tags from st_uint_110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_111 using mt_uint tags ( +0.1235e3 )
|
||||
sql show tags from st_uint_111
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_112 using mt_uint tags (-0.11e-30)
|
||||
sql show tags from st_uint_112
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_113 using mt_uint tags (-1.1e-307)
|
||||
sql show tags from st_uint_113
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_200 using mt_uint tags ( 0x01)
|
||||
sql show tags from st_uint_200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_201 using mt_uint tags (0b01 )
|
||||
sql show tags from st_uint_201
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_202 using mt_uint tags (+0x01)
|
||||
sql show tags from st_uint_202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_uint_203 using mt_uint tags ( -0b00 )
|
||||
sql show tags from st_uint_203
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_uint_0 values (now, NULL)
|
||||
sql select * from st_uint_0
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1 values (now, "-0")
|
||||
sql select * from st_uint_1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_6 values (now, 2147483647)
|
||||
sql select * from st_uint_6
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_7 values (now, -0)
|
||||
sql select * from st_uint_7
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_8 values (now, +100)
|
||||
sql select * from st_uint_8
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_9 values (now, "098")
|
||||
sql select * from st_uint_9
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 98 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_10 values (now, '0')
|
||||
sql select * from st_uint_10
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_11 values (now, +000.000)
|
||||
sql select * from st_uint_11
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_12 values (now, "+056")
|
||||
sql select * from st_uint_12
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 56 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_uint_13 values (now, +056)
|
||||
sql select * from st_uint_13
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 56 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_uint_14 values (now, 056)
|
||||
sql select * from st_uint_14
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 56 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_uint_100 values (now, "0x01")
|
||||
sql select * from st_uint_100
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_101 values (now, "0b01")
|
||||
sql select * from st_uint_101
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_102 values (now, "+0x01")
|
||||
sql select * from st_uint_102
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_103 values (now, "-0b00")
|
||||
sql select * from st_uint_103
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_104 values (now, "123.1")
|
||||
sql select * from st_uint_104
|
||||
if $data01 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_105 values (now, "+123.5")
|
||||
sql select * from st_uint_105
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_106 values (now, "-1e-1")
|
||||
sql select * from st_uint_106
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_107 values (now, "+0.1235e3")
|
||||
sql select * from st_uint_107
|
||||
if $data01 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_108 values (now, "-0.11e-30")
|
||||
sql select * from st_uint_108
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_109 values (now, "-1.1e-307")
|
||||
sql select * from st_uint_109
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_110 values (now, -1e-1 )
|
||||
sql select * from st_uint_110
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_111 values (now, +0.1235e3 )
|
||||
sql select * from st_uint_111
|
||||
if $data01 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_112 values (now, -0.11e-30)
|
||||
sql select * from st_uint_112
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_113 values (now, -1.1e-307)
|
||||
sql select * from st_uint_113
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_200 values (now, 0x01)
|
||||
sql select * from st_uint_200
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_201 values (now, 0b01 )
|
||||
sql select * from st_uint_201
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_202 values (now, +0x01)
|
||||
sql select * from st_uint_202
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_uint_203 values (now, -0b00 )
|
||||
sql select * from st_uint_203
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_uint_16 using mt_uint tags (NULL) values (now, NULL)
|
||||
sql show create table st_uint_16
|
||||
sql show tags from st_uint_16
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_16
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_uint_17 using mt_uint tags (NULL) values (now, NULL)
|
||||
sql show tags from st_uint_17
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_17
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_18 using mt_uint tags ('NULL') values (now, 'NULL')
|
||||
sql show tags from st_uint_18
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_18
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_19 using mt_uint tags ('NULL') values (now, 'NULL')
|
||||
sql show tags from st_uint_19
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_19
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_20 using mt_uint tags ("NULL") values (now, "NULL")
|
||||
sql show tags from st_uint_20
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_20
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_21 using mt_uint tags ("-0") values (now, "-0")
|
||||
sql show tags from st_uint_21
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_21
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_22 using mt_uint tags (2147483647) values (now, 2147483647)
|
||||
sql show tags from st_uint_22
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_22
|
||||
if $data01 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_23 using mt_uint tags (-0) values (now, -0)
|
||||
sql show tags from st_uint_23
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_23
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_24 using mt_uint tags (10) values (now, 10)
|
||||
sql show tags from st_uint_24
|
||||
if $data05 != 10 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_24
|
||||
if $data01 != 10 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_25 using mt_uint tags ("-0") values (now, "-0")
|
||||
sql show tags from st_uint_25
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_25
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_26 using mt_uint tags ('123') values (now, '123')
|
||||
sql show tags from st_uint_26
|
||||
if $data05 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_26
|
||||
if $data01 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_27 using mt_uint tags (+056) values (now, +00056)
|
||||
sql show tags from st_uint_27
|
||||
if $data05 != 56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_27
|
||||
if $data01 != 56 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_28 using mt_uint tags (056) values (now, 0056)
|
||||
sql show tags from st_uint_28
|
||||
if $data05 != 56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_28
|
||||
if $data01 != 56 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1100 using mt_uint tags ("0x01") values(now, "0x01");
|
||||
sql show tags from st_uint_1100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1100
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1101 using mt_uint tags ("0b01") values(now, "0b01");
|
||||
sql show tags from st_uint_1101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1101
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1102 using mt_uint tags ("+0x01") values(now, "+0x01");
|
||||
sql show tags from st_uint_1102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1102
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1103 using mt_uint tags ("-0b00") values(now, "-0b000");
|
||||
sql show tags from st_uint_1103
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1103
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1104 using mt_uint tags ("123.1") values(now, "123.1");
|
||||
sql show tags from st_uint_1104
|
||||
if $data05 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1104
|
||||
if $data01 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1105 using mt_uint tags ("+123.5") values(now, "+123.5");
|
||||
sql show tags from st_uint_1105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1105
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1106 using mt_uint tags ("-1e-1") values(now, "-1e-1");
|
||||
sql show tags from st_uint_1106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1106
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1107 using mt_uint tags ("+0.1235e3") values(now, "+0.1235e3");
|
||||
sql show tags from st_uint_1107
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1108 using mt_uint tags ("-0.11e-30") values(now, "-0.11e-30");
|
||||
sql show tags from st_uint_1108
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1108
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1109 using mt_uint tags ("-1.1e-307") values(now, "-1.1e-307");
|
||||
sql show tags from st_uint_1109
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1109
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1110 using mt_uint tags ( -1e-1 ) values(now, -1e-1);
|
||||
sql show tags from st_uint_1110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1110
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1111 using mt_uint tags ( +0.1235e3 ) values(now, +0.1235e3);
|
||||
sql show tags from st_uint_1111
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1111
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1112 using mt_uint tags (-0.11e-30) values(now, -0.11e-30);
|
||||
sql show tags from st_uint_1112
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1112
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1113 using mt_uint tags (-1.1e-307) values(now, -1.1e-307);
|
||||
sql show tags from st_uint_1113
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1113
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1200 using mt_uint tags ( 0x01) values(now, 0x01);
|
||||
sql show tags from st_uint_1200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1200
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1201 using mt_uint tags (0b01 ) values(now, 0b01);
|
||||
sql show tags from st_uint_1201
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1201
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_uint_1202 using mt_uint tags (+0x01) values(now, +0x01);
|
||||
sql show tags from st_uint_1202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1202
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_uint_1203 using mt_uint tags ( 0b000000 ) values(now, -0b0000);
|
||||
sql show tags from st_uint_1203
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_uint_1203
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
### case 03: alter tag values
|
||||
sql alter table st_uint_0 set tag tagname=2147483647
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_0 set tag tagname=-0
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_0 set tag tagname=+100
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_0 set tag tagname=+33.333
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != 33 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_0 set tag tagname='+98'
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != 98 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_0 set tag tagname='076'
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != 76 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_0 set tag tagname=+0012
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != 12 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_0 set tag tagname=00063
|
||||
sql show tags from st_uint_0
|
||||
if $data05 != 63 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_100 set tag tagname="0x01"
|
||||
sql show tags from st_uint_100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_101 set tag tagname="0b01"
|
||||
sql show tags from st_uint_101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_102 set tag tagname="+0x01"
|
||||
sql show tags from st_uint_102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_103 set tag tagname="-0b00"
|
||||
sql show tags from st_uint_103
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_104 set tag tagname="123.1"
|
||||
sql show tags from st_uint_104
|
||||
if $data05 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_105 set tag tagname="+123.5"
|
||||
sql show tags from st_uint_105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_106 set tag tagname="-1e-1"
|
||||
sql show tags from st_uint_106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_107 set tag tagname="+0.1235e3"
|
||||
sql show tags from st_uint_107
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_108 set tag tagname="-0.11e-30"
|
||||
sql show tags from st_uint_108
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_109 set tag tagname="-1.1e-307"
|
||||
sql show tags from st_uint_109
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_110 set tag tagname= -1e-1
|
||||
sql show tags from st_uint_110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_111 set tag tagname= +0.1235e3
|
||||
sql show tags from st_uint_111
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_112 set tag tagname=-0.11e-30
|
||||
sql show tags from st_uint_112
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_113 set tag tagname=-1.1e-307
|
||||
sql show tags from st_uint_113
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_200 set tag tagname= 0x01
|
||||
sql show tags from st_uint_200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_201 set tag tagname=0b00
|
||||
sql show tags from st_uint_201
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_202 set tag tagname=+0x01
|
||||
sql show tags from st_uint_202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_uint_203 set tag tagname= -0b0
|
||||
sql show tags from st_uint_203
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_uint_e0_err0 using mt_uint tags (4294967296)
|
||||
sql_error create table st_uint_e0_err1 using mt_uint tags (-4294967297)
|
||||
sql_error create table st_uint_e0_err2 using mt_uint tags (-214748364800)
|
||||
sql_error create table st_uint_e0_err3 using mt_uint tags (123abc)
|
||||
sql_error create table st_uint_e0_err4 using mt_uint tags ("123abc")
|
||||
sql_error create table st_uint_e0_err5 using mt_uint tags (abc)
|
||||
sql_error create table st_uint_e0_err6 using mt_uint tags ("abc")
|
||||
sql_error create table st_uint_e0_err7 using mt_uint tags (" ")
|
||||
sql_error create table st_uint_e0_err8 using mt_uint tags ('')
|
||||
|
||||
sql create table st_uint_e0 using mt_uint tags (123)
|
||||
sql create table st_uint_e1 using mt_uint tags (123)
|
||||
sql create table st_uint_e2 using mt_uint tags (123)
|
||||
sql create table st_uint_e3 using mt_uint tags (123)
|
||||
sql create table st_uint_e4 using mt_uint tags (123)
|
||||
sql create table st_uint_e5 using mt_uint tags (123)
|
||||
sql create table st_uint_e6 using mt_uint tags (123)
|
||||
sql create table st_uint_e7 using mt_uint tags (123)
|
||||
sql create table st_uint_e8 using mt_uint tags (123)
|
||||
sql create table st_uint_e9 using mt_uint tags (123)
|
||||
sql create table st_uint_e10 using mt_uint tags (123)
|
||||
sql create table st_uint_e11 using mt_uint tags (123)
|
||||
sql create table st_uint_e12 using mt_uint tags (123)
|
||||
|
||||
sql_error insert into st_uint_e0 values (now, 4294967296)
|
||||
sql_error insert into st_uint_e1 values (now, -4294967297)
|
||||
sql_error insert into st_uint_e3 values (now, -21474836481)
|
||||
sql_error insert into st_uint_e6 values (now, 123abc)
|
||||
sql_error insert into st_uint_e7 values (now, "123abc")
|
||||
sql_error insert into st_uint_e9 values (now, abc)
|
||||
sql_error insert into st_uint_e10 values (now, "abc")
|
||||
sql_error insert into st_uint_e11 values (now, " ")
|
||||
sql_error insert into st_uint_e12 values (now, '')
|
||||
|
||||
sql_error insert into st_uint_e13 using mt_uint tags (033) values (now, 4294967296)
|
||||
sql_error insert into st_uint_e14 using mt_uint tags (033) values (now, -4294967297)
|
||||
sql_error insert into st_uint_e16 using mt_uint tags (033) values (now, -21474836481)
|
||||
sql_error insert into st_uint_e19 using mt_uint tags (033) values (now, 123abc)
|
||||
sql_error insert into st_uint_e20 using mt_uint tags (033) values (now, "123abc")
|
||||
sql_error insert into st_uint_e22 using mt_uint tags (033) values (now, abc)
|
||||
sql_error insert into st_uint_e23 using mt_uint tags (033) values (now, "abc")
|
||||
sql_error insert into st_uint_e24 using mt_uint tags (033) values (now, " ")
|
||||
sql_error insert into st_uint_e25 using mt_uint tags (033) values (now, '')
|
||||
|
||||
sql_error insert into st_uint_e13 using mt_uint tags (21474294967296483648) values (now, -033)
|
||||
sql_error insert into st_uint_e14_1 using mt_uint tags (-2147483648) values (now, -033)
|
||||
sql_error insert into st_uint_e16 using mt_uint tags (-2147483649) values (now, -033)
|
||||
sql_error insert into st_uint_e19 using mt_uint tags (123abc) values (now, -033)
|
||||
sql_error insert into st_uint_e20 using mt_uint tags ("123abc") values (now, -033)
|
||||
sql_error insert into st_uint_e22 using mt_uint tags (abc) values (now, -033)
|
||||
sql_error insert into st_uint_e23 using mt_uint tags ("abc") values (now, -033)
|
||||
sql_error insert into st_uint_e24 using mt_uint tags (" ") values (now, -033)
|
||||
sql_error insert into st_uint_e25_1 using mt_uint tags ('') values (now, -033)
|
||||
sql insert into st_uint_e26_1 using mt_uint tags ('123') values (now, 033)
|
||||
sql insert into st_uint_e27_1 using mt_uint tags ('12.80') values (now, 033)
|
||||
sql_error insert into st_uint_e28_1 using mt_uint tags ('-11.80') values (now, 033)
|
||||
|
||||
sql insert into st_uint_e13 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e14 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e15 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e16 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e17 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e18 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e19 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e20 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e21 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e22 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e23 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e24 using mt_uint tags (033) values (now, 00062)
|
||||
sql insert into st_uint_e25 using mt_uint tags (033) values (now, 00062)
|
||||
|
||||
sql_error alter table st_uint_e13 set tag tagname=4294967296
|
||||
sql_error alter table st_uint_e14 set tag tagname=-4294967297
|
||||
sql_error alter table st_uint_e16 set tag tagname=-3147483648
|
||||
sql_error alter table st_uint_e19 set tag tagname=123abc
|
||||
sql_error alter table st_uint_e20 set tag tagname="123abc"
|
||||
sql_error alter table st_uint_e22 set tag tagname=abc
|
||||
sql_error alter table st_uint_e23 set tag tagname="abc"
|
||||
sql_error alter table st_uint_e24 set tag tagname=" "
|
||||
sql_error alter table st_uint_e25 set tag tagname=''
|
||||
sql alter table st_uint_e26_1 set tag tagname='123'
|
||||
sql alter table st_uint_e27_1 set tag tagname='12.80'
|
||||
sql_error alter table st_uint_e28_1 set tag tagname='-11.80'
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -0,0 +1,323 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
||||
######## case 0: varbinary
|
||||
print ========== varbinary
|
||||
sql create table mt_varbinary (ts timestamp, c varbinary(50)) tags(tagname varbinary(50))
|
||||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_varbinary_0 using mt_varbinary tags(NULL)
|
||||
sql show tags from st_varbinary_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_1 using mt_varbinary tags(NULL)
|
||||
sql show tags from st_varbinary_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_2 using mt_varbinary tags('NULL')
|
||||
sql show tags from st_varbinary_2
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_3 using mt_varbinary tags('NULL')
|
||||
sql show tags from st_varbinary_3
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_4 using mt_varbinary tags("NULL")
|
||||
sql show tags from st_varbinary_4
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_5 using mt_varbinary tags("NULL")
|
||||
sql show tags from st_varbinary_5
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_6 using mt_varbinary tags("")
|
||||
sql show tags from st_varbinary_6
|
||||
if $data05 != \x then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_7 using mt_varbinary tags(" ")
|
||||
sql show tags from st_varbinary_7
|
||||
if $data05 != \x20 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_8 using mt_varbinary tags("\x")
|
||||
sql show tags from st_varbinary_8
|
||||
if $data05 != \x then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_9 using mt_varbinary tags("\xaB")
|
||||
sql show tags from st_varbinary_9
|
||||
if $data05 != \xAB then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varbinary_10 using mt_varbinary tags("aB")
|
||||
sql show tags from st_varbinary_10
|
||||
if $data05 != \x6142 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_varbinary_0 values(now, NULL)
|
||||
sql select * from st_varbinary_0
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varbinary_1 values(now, NULL)
|
||||
sql select * from st_varbinary_1
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varbinary_2 values(now, 'NULL')
|
||||
sql select * from st_varbinary_2
|
||||
if $data01 != \x4E554C4C then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_3 values(now, 'NULL')
|
||||
sql select * from st_varbinary_3
|
||||
if $data01 != \x4E554C4C then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_4 values(now, "NULL")
|
||||
sql select * from st_varbinary_4
|
||||
if $data01 != \x4E554C4C then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_5 values(now, "NULL")
|
||||
sql select * from st_varbinary_5
|
||||
if $data01 != \x4E554C4C then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_6 values(now, "")
|
||||
sql select * from st_varbinary_6
|
||||
if $data01 != \x then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_7 values(now, " ")
|
||||
sql select * from st_varbinary_7
|
||||
if $data01 != \x20 then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_8 values(now, "\x")
|
||||
sql select * from st_varbinary_8
|
||||
if $data01 != \x then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_9 values(now, "\xaB")
|
||||
sql select * from st_varbinary_9
|
||||
if $data01 != \xAB then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_10 values(now, "aB")
|
||||
sql select * from st_varbinary_10
|
||||
if $data01 != \x6142 then
|
||||
# return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_varbinary_100 using mt_varbinary tags(NULL) values(now,NULL)
|
||||
sql show tags from st_varbinary_100
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_100
|
||||
if $data01 != NULL then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_101 using mt_varbinary tags(NULL) values(now,NULL)
|
||||
sql show tags from st_varbinary_101
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_101
|
||||
if $data01 != NULL then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_102 using mt_varbinary tags('NULL') values(now,'NULL')
|
||||
sql show tags from st_varbinary_102
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_102
|
||||
if $data01 != \x4E554C4C then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_103 using mt_varbinary tags('NULL') values(now,'NULL')
|
||||
sql show tags from st_varbinary_103
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_103
|
||||
if $data01 != \x4E554C4C then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_104 using mt_varbinary tags("NULL") values(now,"NULL")
|
||||
sql show tags from st_varbinary_104
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_104
|
||||
if $data01 != \x4E554C4C then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_105 using mt_varbinary tags("NULL") values(now,"NULL")
|
||||
sql show tags from st_varbinary_105
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_105
|
||||
if $data01 != \x4E554C4C then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_106 using mt_varbinary tags("") values(now,"")
|
||||
sql show tags from st_varbinary_106
|
||||
if $data05 != \x then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_106
|
||||
if $data01 != \x then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_107 using mt_varbinary tags(" ") values(now," ")
|
||||
sql show tags from st_varbinary_107
|
||||
if $data05 != \x20 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_107
|
||||
if $data01 != \x20 then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_108 using mt_varbinary tags("\x") values(now,"\x")
|
||||
sql show tags from st_varbinary_108
|
||||
if $data05 != \x then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_108
|
||||
if $data01 != \x then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_109 using mt_varbinary tags("\xaB") values(now,"\xaB")
|
||||
sql show tags from st_varbinary_109
|
||||
if $data05 != \xAB then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_109
|
||||
if $data01 != \xAB then
|
||||
# return -1
|
||||
endi
|
||||
sql insert into st_varbinary_1010 using mt_varbinary tags("aB") values(now,"aB")
|
||||
sql show tags from st_varbinary_1010
|
||||
if $data05 != \x6142 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varbinary_1010
|
||||
if $data01 != \x6142 then
|
||||
# return -1
|
||||
endi
|
||||
|
||||
## case 03: alter tag values
|
||||
sql alter table st_varbinary_100 set tag tagname=NULL
|
||||
sql show tags from st_varbinary_100
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_101 set tag tagname=NULL
|
||||
sql show tags from st_varbinary_101
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_102 set tag tagname='NULL'
|
||||
sql show tags from st_varbinary_102
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_103 set tag tagname='NULL'
|
||||
sql show tags from st_varbinary_103
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_104 set tag tagname="NULL"
|
||||
sql show tags from st_varbinary_104
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_105 set tag tagname="NULL"
|
||||
sql show tags from st_varbinary_105
|
||||
if $data05 != \x4E554C4C then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_106 set tag tagname=""
|
||||
sql show tags from st_varbinary_106
|
||||
if $data05 != \x then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_107 set tag tagname=" "
|
||||
sql show tags from st_varbinary_107
|
||||
if $data05 != \x20 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_108 set tag tagname="\x"
|
||||
sql show tags from st_varbinary_108
|
||||
if $data05 != \x then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_109 set tag tagname="\xaB"
|
||||
sql show tags from st_varbinary_109
|
||||
if $data05 != \xAB then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varbinary_1010 set tag tagname="aB"
|
||||
sql show tags from st_varbinary_1010
|
||||
if $data05 != \x6142 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
# case 04: illegal input
|
||||
sql_error create table st_varbinary_106 using mt_varbinary tags(+0123)
|
||||
sql_error create table st_varbinary_107 using mt_varbinary tags(-01.23)
|
||||
sql_error create table st_varbinary_108 using mt_varbinary tags(+0x01)
|
||||
sql_error create table st_varbinary_109 using mt_varbinary tags(-0b01)
|
||||
sql_error create table st_varbinary_1010 using mt_varbinary tags(-0.1e-10)
|
||||
sql_error create table st_varbinary_1011 using mt_varbinary tags(+0.1E+2)
|
||||
sql_error create table st_varbinary_1012 using mt_varbinary tags(tRue)
|
||||
sql_error create table st_varbinary_1013 using mt_varbinary tags(FalsE)
|
||||
sql_error create table st_varbinary_1014 using mt_varbinary tags(noW)
|
||||
sql_error create table st_varbinary_1015 using mt_varbinary tags(toDay)
|
||||
sql_error insert into st_varbinary_106 using mt_varbinary tags(+0123) values(now, NULL);
|
||||
sql_error insert into st_varbinary_107 using mt_varbinary tags(-01.23) values(now, NULL);
|
||||
sql_error insert into st_varbinary_108 using mt_varbinary tags(+0x01) values(now, NULL);
|
||||
sql_error insert into st_varbinary_109 using mt_varbinary tags(-0b01) values(now, NULL);
|
||||
sql_error insert into st_varbinary_1010 using mt_varbinary tags(-0.1e-10) values(now, NULL);
|
||||
sql_error insert into st_varbinary_1011 using mt_varbinary tags(+0.1E+2) values(now, NULL);
|
||||
sql_error insert into st_varbinary_1012 using mt_varbinary tags(tRue) values(now, NULL);
|
||||
sql_error insert into st_varbinary_1013 using mt_varbinary tags(FalsE) values(now, NULL);
|
||||
sql_error insert into st_varbinary_1014 using mt_varbinary tags(noW) values(now, NULL);
|
||||
sql_error insert into st_varbinary_1015 using mt_varbinary tags(toDay) values(now, NULL);
|
||||
sql_error insert into st_varbinary_106 using mt_varbinary tags(NULL) values(now(), +0123)
|
||||
sql_error insert into st_varbinary_107 using mt_varbinary tags(NULL) values(now(), -01.23)
|
||||
sql_error insert into st_varbinary_108 using mt_varbinary tags(NULL) values(now(), +0x01)
|
||||
sql_error insert into st_varbinary_109 using mt_varbinary tags(NULL) values(now(), -0b01)
|
||||
sql_error insert into st_varbinary_1010 using mt_varbinary tags(NULL) values(now(), -0.1e-10)
|
||||
sql_error insert into st_varbinary_1011 using mt_varbinary tags(NULL) values(now(), +0.1E+2)
|
||||
sql_error insert into st_varbinary_1012 using mt_varbinary tags(NULL) values(now(), tRue)
|
||||
sql_error insert into st_varbinary_1013 using mt_varbinary tags(NULL) values(now(), FalsE)
|
||||
sql_error insert into st_varbinary_1014 using mt_varbinary tags(NULL) values(now(), noW)
|
||||
sql_error insert into st_varbinary_1015 using mt_varbinary tags(NULL) values(now(), toDay)
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -0,0 +1,415 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
||||
######## case 0: varchar
|
||||
print ========== varchar
|
||||
sql create table mt_varchar (ts timestamp, c varchar(50)) tags (tagname varchar(50))
|
||||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_varchar_0 using mt_varchar tags (NULL)
|
||||
sql show create table st_varchar_0
|
||||
sql show tags from st_varchar_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_1 using mt_varchar tags (NULL)
|
||||
sql show tags from st_varchar_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_2 using mt_varchar tags ('NULL')
|
||||
sql show tags from st_varchar_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_3 using mt_varchar tags ('NULL')
|
||||
sql show tags from st_varchar_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_4 using mt_varchar tags ("NULL")
|
||||
sql show tags from st_varchar_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_5 using mt_varchar tags ("NULL")
|
||||
sql show tags from st_varchar_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_6 using mt_varchar tags (+0123)
|
||||
sql show tags from st_varchar_6
|
||||
if $data05 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_7 using mt_varchar tags (-01.23)
|
||||
sql show tags from st_varchar_7
|
||||
if $data05 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_8 using mt_varchar tags (+0x01)
|
||||
sql show tags from st_varchar_8
|
||||
if $data05 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_9 using mt_varchar tags (-0b01)
|
||||
sql show tags from st_varchar_9
|
||||
if $data05 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_10 using mt_varchar tags (-0.1e-10)
|
||||
sql show tags from st_varchar_10
|
||||
if $data05 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_11 using mt_varchar tags (+0.1E+2)
|
||||
sql show tags from st_varchar_11
|
||||
if $data05 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_12 using mt_varchar tags (tRue)
|
||||
sql show tags from st_varchar_12
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_13 using mt_varchar tags (FalsE)
|
||||
sql show tags from st_varchar_13
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_14 using mt_varchar tags (noW)
|
||||
sql show tags from st_varchar_14
|
||||
if $data05 != now then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_varchar_15 using mt_varchar tags (toDay)
|
||||
sql show tags from st_varchar_15
|
||||
if $data05 != today then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_varchar_0 values(now, NULL)
|
||||
sql select * from st_varchar_0
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_1 values(now, NULL)
|
||||
sql select * from st_varchar_1
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_2 values(now, 'NULL')
|
||||
sql select * from st_varchar_2
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_3 values(now, 'NULL')
|
||||
sql select * from st_varchar_3
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_4 values(now, "NULL")
|
||||
sql select * from st_varchar_4
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_5 values(now, "NULL")
|
||||
sql select * from st_varchar_5
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_6 values(now, +0123)
|
||||
sql select * from st_varchar_6
|
||||
if $data01 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_7 values(now, -01.23)
|
||||
sql select * from st_varchar_7
|
||||
if $data01 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_8 values(now, +0x01)
|
||||
sql select * from st_varchar_8
|
||||
if $data01 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_9 values(now, -0b01)
|
||||
sql select * from st_varchar_9
|
||||
if $data01 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_10 values(now, -0.1e-10)
|
||||
sql select * from st_varchar_10
|
||||
if $data01 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_11 values(now, +0.1E+2)
|
||||
sql select * from st_varchar_11
|
||||
if $data01 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_12 values(now, tRue)
|
||||
sql select * from st_varchar_12
|
||||
if $data01 != true then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_13 values(now, FalsE)
|
||||
sql select * from st_varchar_13
|
||||
if $data01 != false then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_14 values(now, noW)
|
||||
sql select * from st_varchar_14
|
||||
if $data01 != now then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_15 values(now, toDay)
|
||||
sql select * from st_varchar_15
|
||||
if $data01 != today then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_varchar_0 using mt_varchar tags (NULL) values(now, NULL)
|
||||
sql show tags from st_varchar_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_0
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_1 using mt_varchar tags (NULL) values(now, NULL)
|
||||
sql show tags from st_varchar_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_1
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_2 using mt_varchar tags ('NULL') values(now, 'NULL')
|
||||
sql show tags from st_varchar_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_2
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_3 using mt_varchar tags ('NULL') values(now, 'NULL')
|
||||
sql show tags from st_varchar_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_3
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_4 using mt_varchar tags ("NULL") values(now, "NULL")
|
||||
sql show tags from st_varchar_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_4
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_5 using mt_varchar tags ("NULL") values(now, "NULL")
|
||||
sql show tags from st_varchar_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_5
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_6 using mt_varchar tags (+0123) values(now, +0123)
|
||||
sql show tags from st_varchar_6
|
||||
if $data05 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_6
|
||||
if $data01 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_7 using mt_varchar tags (-01.23) values(now, -01.23)
|
||||
sql show tags from st_varchar_7
|
||||
if $data05 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_7
|
||||
if $data01 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_8 using mt_varchar tags (+0x01) values(now, +0x01)
|
||||
sql show tags from st_varchar_8
|
||||
if $data05 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_8
|
||||
if $data01 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_9 using mt_varchar tags (-0b01) values(now, -0b01)
|
||||
sql show tags from st_varchar_9
|
||||
if $data05 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_9
|
||||
if $data01 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_10 using mt_varchar tags (-0.1e-10) values(now, -0.1e-10)
|
||||
sql show tags from st_varchar_10
|
||||
if $data05 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_10
|
||||
if $data01 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_11 using mt_varchar tags (+0.1E+2) values(now, +0.1E+2)
|
||||
sql show tags from st_varchar_11
|
||||
if $data05 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_11
|
||||
if $data01 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_12 using mt_varchar tags (tRue) values(now, tRue)
|
||||
sql show tags from st_varchar_12
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_12
|
||||
if $data01 != true then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_13 using mt_varchar tags (FalsE) values(now, FalsE)
|
||||
sql show tags from st_varchar_13
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_13
|
||||
if $data01 != false then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_14 using mt_varchar tags (noW) values(now, noW)
|
||||
sql show tags from st_varchar_14
|
||||
if $data05 != now then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_14
|
||||
if $data01 != now then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_varchar_15 using mt_varchar tags (toDay) values(now, toDay)
|
||||
sql show tags from st_varchar_15
|
||||
if $data05 != today then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_varchar_15
|
||||
if $data01 != today then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 03: alter tag values
|
||||
sql alter table st_varchar_0 set tag tagname=NULL
|
||||
sql show tags from st_varchar_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_1 set tag tagname=NULL
|
||||
sql show tags from st_varchar_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_2 set tag tagname='NULL'
|
||||
sql show tags from st_varchar_2
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_3 set tag tagname='NULL'
|
||||
sql show tags from st_varchar_3
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_4 set tag tagname="NULL"
|
||||
sql show tags from st_varchar_4
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_5 set tag tagname="NULL"
|
||||
sql show tags from st_varchar_5
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_6 set tag tagname=+0123
|
||||
sql show tags from st_varchar_6
|
||||
if $data05 != +0123 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_7 set tag tagname=-01.23
|
||||
sql show tags from st_varchar_7
|
||||
if $data05 != -01.23 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_8 set tag tagname=+0x01
|
||||
sql show tags from st_varchar_8
|
||||
if $data05 != +0x01 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_9 set tag tagname=-0b01
|
||||
sql show tags from st_varchar_9
|
||||
if $data05 != -0b01 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_10 set tag tagname=-0.1e-10
|
||||
sql show tags from st_varchar_10
|
||||
if $data05 != -0.1e-10 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_11 set tag tagname=+0.1E+2
|
||||
sql show tags from st_varchar_11
|
||||
if $data05 != +0.1e+2 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_12 set tag tagname=tRue
|
||||
sql show tags from st_varchar_12
|
||||
if $data05 != true then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_13 set tag tagname=FalsE
|
||||
sql show tags from st_varchar_13
|
||||
if $data05 != false then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_14 set tag tagname=noW
|
||||
sql show tags from st_varchar_14
|
||||
if $data05 != now then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_varchar_15 set tag tagname=toDay
|
||||
sql show tags from st_varchar_15
|
||||
if $data05 != today then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
# case 04: illegal input
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -187,7 +187,7 @@ sql_error create table $tb using $mt tags (abc)
|
|||
sql_error create table $tb using $mt tags ('abc')
|
||||
sql drop table if exists $tb
|
||||
sql reset query cache
|
||||
sql_error create table $tb using $mt tags (1e1)
|
||||
sql create table $tb using $mt tags (1e1)
|
||||
|
||||
sql_error create table $tb using $mt tags ('1e1')
|
||||
sql_error create table $tb using $mt tags (2147483649)
|
||||
|
|
|
@ -140,7 +140,7 @@ endi
|
|||
|
||||
### bool:
|
||||
sql create table stx using mt2 tags ('NULL', '123aBc', 104, '123')
|
||||
sql create table sty using mt2 tags ('NULL', '123aBc', 104, 'xtz')
|
||||
sql_error create table sty using mt2 tags ('NULL', '123aBc', 104, 'xtz')
|
||||
sql create table st4 using mt2 tags ('NULL', '123aBc', 104, 'NULL')
|
||||
sql insert into st4 (ts, col1) values(now, 1)
|
||||
sql select tag1,tag2,tag3,tag5 from st4
|
||||
|
@ -156,7 +156,7 @@ endi
|
|||
if $data02 != 104 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 0 then
|
||||
if $data03 != NULL then
|
||||
print ==6== expect: NULL, actually: $data03
|
||||
return -1
|
||||
endi
|
||||
|
@ -182,7 +182,7 @@ endi
|
|||
|
||||
#### case 2: dynamic create table using super table when insert into
|
||||
sql create table mt3 (ts timestamp, col1 int, col3 float, col5 binary(8), col6 bool, col9 nchar(8)) tags (tag1 binary(8), tag2 nchar(8), tag3 int, tag5 bool)
|
||||
sql_error insert into st31 using mt3 tags (NULL, 'NULL', 102, 'true') values (now+1s, 31, 31, 'bin_31', '123', 'nchar_31')
|
||||
sql insert into st31 using mt3 tags (NULL, 'NULL', 102, 'true') values (now+1s, 31, 31, 'bin_31', '123', 'nchar_31')
|
||||
sql_error insert into st32 using mt3 tags (NULL, 'ABC', 103, 'FALSE') values (now+2s, 32, 32.12345, 'bin_32', 'abc', 'nchar_32')
|
||||
sql_error insert into st33 using mt3 tags ('NULL', '123aBc', 104, 'NULL') values (now+3s, 33, 33, 'bin_33', 'false123', 'nchar_33')
|
||||
sql_error insert into st34 using mt3 tags ('NULL', '123aBc', 105, NULL) values (now+4s, 34, 34.12345, 'bin_34', 'true123', 'nchar_34')
|
||||
|
@ -306,8 +306,8 @@ if $data02 != NULL then
|
|||
print ==10== expect: NULL, actually: $data02
|
||||
return -1
|
||||
endi
|
||||
sql_error alter table st41 set tag tag_int = 'NULL'
|
||||
sql alter table st41 set tag tag_int = ''
|
||||
sql alter table st41 set tag tag_int = 'NULL'
|
||||
sql_error alter table st41 set tag tag_int = ''
|
||||
sql_error alter table st41 set tag tag_int = abc379
|
||||
|
||||
################### bool
|
||||
|
@ -333,8 +333,8 @@ if $data03 != 1 then
|
|||
endi
|
||||
sql alter table st41 set tag tag_bool = 'NULL'
|
||||
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||
if $data03 != 0 then
|
||||
print ==14== expect: 0, actually: $data03
|
||||
if $data03 != NULL then
|
||||
print ==14== expect: NULL, actually: $data03
|
||||
return -1
|
||||
endi
|
||||
sql alter table st41 set tag tag_bool = NULL
|
||||
|
@ -344,7 +344,7 @@ if $data03 != NULL then
|
|||
endi
|
||||
|
||||
sql alter table st41 set tag tag_bool = '123'
|
||||
sql alter table st41 set tag tag_bool = ''
|
||||
sql_error alter table st41 set tag tag_bool = ''
|
||||
sql_error alter table st41 set tag tag_bool = abc379
|
||||
|
||||
################### float
|
||||
|
@ -380,8 +380,8 @@ if $data04 != NULL then
|
|||
endi
|
||||
sql alter table st41 set tag tag_float = 'NULL'
|
||||
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||
if $data04 != 0.00000 then
|
||||
print ==17== expect: 0.00000, actually : $data04
|
||||
if $data04 != NULL then
|
||||
print ==17== expect: NULL, actually : $data04
|
||||
return -1
|
||||
endi
|
||||
sql alter table st41 set tag tag_float = '54.123456'
|
||||
|
@ -396,10 +396,10 @@ if $data04 != -54.12346 then
|
|||
print ==19== expect: -54.12346, actually : $data04
|
||||
return -1
|
||||
endi
|
||||
sql alter table st41 set tag tag_float = ''
|
||||
sql_error alter table st41 set tag tag_float = ''
|
||||
|
||||
sql alter table st41 set tag tag_float = 'abc'
|
||||
sql alter table st41 set tag tag_float = '123abc'
|
||||
sql_error alter table st41 set tag tag_float = 'abc'
|
||||
sql_error alter table st41 set tag tag_float = '123abc'
|
||||
sql_error alter table st41 set tag tag_float = abc
|
||||
|
||||
################### double
|
||||
|
@ -428,14 +428,15 @@ if $data05 != NULL then
|
|||
endi
|
||||
sql alter table st41 set tag tag_double = 'NULL'
|
||||
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||
if $data05 != 0.000000000 then
|
||||
print ==20== expect: 0.000000000, actually : $data05
|
||||
if $data05 != NULL then
|
||||
print ==20== expect: NULL, actually : $data05
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql alter table st41 set tag tag_double = ''
|
||||
sql alter table st41 set tag tag_double = 'abc'
|
||||
sql alter table st41 set tag tag_double = '123abc'
|
||||
sql_error alter table st41 set tag tag_double = ''
|
||||
sql alter table st41 set tag tag_double = '123'
|
||||
sql_error alter table st41 set tag tag_double = 'abc'
|
||||
sql_error alter table st41 set tag tag_double = '123abc'
|
||||
sql_error alter table st41 set tag tag_double = abc
|
||||
|
||||
################### bigint smallint tinyint
|
||||
|
@ -459,8 +460,8 @@ if $data00 != -9223372036854775807 then
|
|||
endi
|
||||
sql alter table st51 set tag tag_bigint = -9223372036854775808
|
||||
|
||||
sql_error alter table st51 set tag tag_bigint = 'NULL'
|
||||
sql alter table st51 set tag tag_bigint = ''
|
||||
sql alter table st51 set tag tag_bigint = 'NULL'
|
||||
sql_error alter table st51 set tag tag_bigint = ''
|
||||
sql_error alter table st51 set tag tag_bigint = abc379
|
||||
|
||||
####
|
||||
|
@ -480,8 +481,8 @@ if $data01 != -32767 then
|
|||
endi
|
||||
sql alter table st51 set tag tag_smallint = -32768
|
||||
|
||||
sql_error alter table st51 set tag tag_smallint = 'NULL'
|
||||
sql alter table st51 set tag tag_smallint = ''
|
||||
sql alter table st51 set tag tag_smallint = 'NULL'
|
||||
sql_error alter table st51 set tag tag_smallint = ''
|
||||
sql_error alter table st51 set tag tag_smallint = abc379
|
||||
|
||||
####
|
||||
|
@ -499,8 +500,8 @@ if $data02 != -127 then
|
|||
endi
|
||||
sql alter table st51 set tag tag_tinyint = '-128'
|
||||
sql_error alter table st51 set tag tag_tinyint = 128
|
||||
sql_error alter table st51 set tag tag_tinyint = 'NULL'
|
||||
sql alter table st51 set tag tag_tinyint = ''
|
||||
sql alter table st51 set tag tag_tinyint = 'NULL'
|
||||
sql_error alter table st51 set tag tag_tinyint = ''
|
||||
sql_error alter table st51 set tag tag_tinyint = abc379
|
||||
|
||||
# test end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
@ -259,7 +274,7 @@ sql insert into ts4 values(1648791213001,1,12,3,1.0);
|
|||
|
||||
|
||||
$loop_count = 0
|
||||
loop3:
|
||||
loop4:
|
||||
|
||||
$loop_count = $loop_count + 1
|
||||
if $loop_count == 20 then
|
||||
|
@ -276,7 +291,7 @@ if $rows != 1 then
|
|||
print $data00 $data01 $data02
|
||||
print $data10 $data11 $data12
|
||||
print $data20 $data21 $data22
|
||||
goto loop3
|
||||
goto loop4
|
||||
endi
|
||||
|
||||
print 2 select * from streamt5;
|
||||
|
@ -287,7 +302,7 @@ if $rows != 1 then
|
|||
print $data00 $data01 $data02
|
||||
print $data10 $data11 $data12
|
||||
print $data20 $data21 $data22
|
||||
goto loop3
|
||||
goto loop4
|
||||
endi
|
||||
|
||||
print 3 select * from streamt3;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue