Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/TD-30837
This commit is contained in:
commit
77ffe89bf6
|
@ -287,118 +287,118 @@
|
||||||
#define TK_FOR 269
|
#define TK_FOR 269
|
||||||
#define TK_NOW 270
|
#define TK_NOW 270
|
||||||
#define TK_TODAY 271
|
#define TK_TODAY 271
|
||||||
#define TK_SUBSTR 272
|
#define TK_RAND 272
|
||||||
#define TK_SUBSTRING 273
|
#define TK_SUBSTR 273
|
||||||
#define TK_BOTH 274
|
#define TK_SUBSTRING 274
|
||||||
#define TK_TRAILING 275
|
#define TK_BOTH 275
|
||||||
#define TK_LEADING 276
|
#define TK_TRAILING 276
|
||||||
#define TK_TIMEZONE 277
|
#define TK_LEADING 277
|
||||||
#define TK_CLIENT_VERSION 278
|
#define TK_TIMEZONE 278
|
||||||
#define TK_SERVER_VERSION 279
|
#define TK_CLIENT_VERSION 279
|
||||||
#define TK_SERVER_STATUS 280
|
#define TK_SERVER_VERSION 280
|
||||||
#define TK_CURRENT_USER 281
|
#define TK_SERVER_STATUS 281
|
||||||
#define TK_PI 282
|
#define TK_CURRENT_USER 282
|
||||||
#define TK_CASE 283
|
#define TK_PI 283
|
||||||
#define TK_WHEN 284
|
#define TK_CASE 284
|
||||||
#define TK_THEN 285
|
#define TK_WHEN 285
|
||||||
#define TK_ELSE 286
|
#define TK_THEN 286
|
||||||
#define TK_BETWEEN 287
|
#define TK_ELSE 287
|
||||||
#define TK_IS 288
|
#define TK_BETWEEN 288
|
||||||
#define TK_NK_LT 289
|
#define TK_IS 289
|
||||||
#define TK_NK_GT 290
|
#define TK_NK_LT 290
|
||||||
#define TK_NK_LE 291
|
#define TK_NK_GT 291
|
||||||
#define TK_NK_GE 292
|
#define TK_NK_LE 292
|
||||||
#define TK_NK_NE 293
|
#define TK_NK_GE 293
|
||||||
#define TK_MATCH 294
|
#define TK_NK_NE 294
|
||||||
#define TK_NMATCH 295
|
#define TK_MATCH 295
|
||||||
#define TK_CONTAINS 296
|
#define TK_NMATCH 296
|
||||||
#define TK_JOIN 297
|
#define TK_CONTAINS 297
|
||||||
#define TK_INNER 298
|
#define TK_JOIN 298
|
||||||
#define TK_LEFT 299
|
#define TK_INNER 299
|
||||||
#define TK_RIGHT 300
|
#define TK_LEFT 300
|
||||||
#define TK_OUTER 301
|
#define TK_RIGHT 301
|
||||||
#define TK_SEMI 302
|
#define TK_OUTER 302
|
||||||
#define TK_ANTI 303
|
#define TK_SEMI 303
|
||||||
#define TK_ASOF 304
|
#define TK_ANTI 304
|
||||||
#define TK_WINDOW 305
|
#define TK_ASOF 305
|
||||||
#define TK_WINDOW_OFFSET 306
|
#define TK_WINDOW 306
|
||||||
#define TK_JLIMIT 307
|
#define TK_WINDOW_OFFSET 307
|
||||||
#define TK_SELECT 308
|
#define TK_JLIMIT 308
|
||||||
#define TK_NK_HINT 309
|
#define TK_SELECT 309
|
||||||
#define TK_DISTINCT 310
|
#define TK_NK_HINT 310
|
||||||
#define TK_WHERE 311
|
#define TK_DISTINCT 311
|
||||||
#define TK_PARTITION 312
|
#define TK_WHERE 312
|
||||||
#define TK_BY 313
|
#define TK_PARTITION 313
|
||||||
#define TK_SESSION 314
|
#define TK_BY 314
|
||||||
#define TK_STATE_WINDOW 315
|
#define TK_SESSION 315
|
||||||
#define TK_EVENT_WINDOW 316
|
#define TK_STATE_WINDOW 316
|
||||||
#define TK_COUNT_WINDOW 317
|
#define TK_EVENT_WINDOW 317
|
||||||
#define TK_SLIDING 318
|
#define TK_COUNT_WINDOW 318
|
||||||
#define TK_FILL 319
|
#define TK_SLIDING 319
|
||||||
#define TK_VALUE 320
|
#define TK_FILL 320
|
||||||
#define TK_VALUE_F 321
|
#define TK_VALUE 321
|
||||||
#define TK_NONE 322
|
#define TK_VALUE_F 322
|
||||||
#define TK_PREV 323
|
#define TK_NONE 323
|
||||||
#define TK_NULL_F 324
|
#define TK_PREV 324
|
||||||
#define TK_LINEAR 325
|
#define TK_NULL_F 325
|
||||||
#define TK_NEXT 326
|
#define TK_LINEAR 326
|
||||||
#define TK_HAVING 327
|
#define TK_NEXT 327
|
||||||
#define TK_RANGE 328
|
#define TK_HAVING 328
|
||||||
#define TK_EVERY 329
|
#define TK_RANGE 329
|
||||||
#define TK_ORDER 330
|
#define TK_EVERY 330
|
||||||
#define TK_SLIMIT 331
|
#define TK_ORDER 331
|
||||||
#define TK_SOFFSET 332
|
#define TK_SLIMIT 332
|
||||||
#define TK_LIMIT 333
|
#define TK_SOFFSET 333
|
||||||
#define TK_OFFSET 334
|
#define TK_LIMIT 334
|
||||||
#define TK_ASC 335
|
#define TK_OFFSET 335
|
||||||
#define TK_NULLS 336
|
#define TK_ASC 336
|
||||||
#define TK_ABORT 337
|
#define TK_NULLS 337
|
||||||
#define TK_AFTER 338
|
#define TK_ABORT 338
|
||||||
#define TK_ATTACH 339
|
#define TK_AFTER 339
|
||||||
#define TK_BEFORE 340
|
#define TK_ATTACH 340
|
||||||
#define TK_BEGIN 341
|
#define TK_BEFORE 341
|
||||||
#define TK_BITAND 342
|
#define TK_BEGIN 342
|
||||||
#define TK_BITNOT 343
|
#define TK_BITAND 343
|
||||||
#define TK_BITOR 344
|
#define TK_BITNOT 344
|
||||||
#define TK_BLOCKS 345
|
#define TK_BITOR 345
|
||||||
#define TK_CHANGE 346
|
#define TK_BLOCKS 346
|
||||||
#define TK_COMMA 347
|
#define TK_CHANGE 347
|
||||||
#define TK_CONCAT 348
|
#define TK_COMMA 348
|
||||||
#define TK_CONFLICT 349
|
#define TK_CONCAT 349
|
||||||
#define TK_COPY 350
|
#define TK_CONFLICT 350
|
||||||
#define TK_DEFERRED 351
|
#define TK_COPY 351
|
||||||
#define TK_DELIMITERS 352
|
#define TK_DEFERRED 352
|
||||||
#define TK_DETACH 353
|
#define TK_DELIMITERS 353
|
||||||
#define TK_DIVIDE 354
|
#define TK_DETACH 354
|
||||||
#define TK_DOT 355
|
#define TK_DIVIDE 355
|
||||||
#define TK_EACH 356
|
#define TK_DOT 356
|
||||||
#define TK_FAIL 357
|
#define TK_EACH 357
|
||||||
#define TK_GLOB 358
|
#define TK_FAIL 358
|
||||||
#define TK_ID 359
|
#define TK_GLOB 359
|
||||||
#define TK_IMMEDIATE 360
|
#define TK_ID 360
|
||||||
#define TK_IMPORT 361
|
#define TK_IMMEDIATE 361
|
||||||
#define TK_INITIALLY 362
|
#define TK_IMPORT 362
|
||||||
#define TK_INSTEAD 363
|
#define TK_INITIALLY 363
|
||||||
#define TK_ISNULL 364
|
#define TK_INSTEAD 364
|
||||||
#define TK_MODULES 365
|
#define TK_ISNULL 365
|
||||||
#define TK_NK_BITNOT 366
|
#define TK_MODULES 366
|
||||||
#define TK_NK_SEMI 367
|
#define TK_NK_BITNOT 367
|
||||||
#define TK_NOTNULL 368
|
#define TK_NK_SEMI 368
|
||||||
#define TK_OF 369
|
#define TK_NOTNULL 369
|
||||||
#define TK_PLUS 370
|
#define TK_OF 370
|
||||||
#define TK_PRIVILEGE 371
|
#define TK_PLUS 371
|
||||||
#define TK_RAISE 372
|
#define TK_PRIVILEGE 372
|
||||||
#define TK_RESTRICT 373
|
#define TK_RAISE 373
|
||||||
#define TK_ROW 374
|
#define TK_RESTRICT 374
|
||||||
#define TK_STAR 375
|
#define TK_ROW 375
|
||||||
#define TK_STATEMENT 376
|
#define TK_STAR 376
|
||||||
#define TK_STRICT 377
|
#define TK_STATEMENT 377
|
||||||
#define TK_STRING 378
|
#define TK_STRICT 378
|
||||||
#define TK_TIMES 379
|
#define TK_STRING 379
|
||||||
#define TK_VALUES 380
|
#define TK_TIMES 380
|
||||||
#define TK_VARIABLE 381
|
#define TK_VALUES 381
|
||||||
#define TK_WAL 382
|
#define TK_VARIABLE 382
|
||||||
|
#define TK_WAL 383
|
||||||
|
|
||||||
#define TK_NK_SPACE 600
|
#define TK_NK_SPACE 600
|
||||||
#define TK_NK_COMMENT 601
|
#define TK_NK_COMMENT 601
|
||||||
|
|
|
@ -191,6 +191,8 @@ typedef struct SFunctionNode {
|
||||||
bool hasOriginalFunc;
|
bool hasOriginalFunc;
|
||||||
int32_t originalFuncId;
|
int32_t originalFuncId;
|
||||||
ETrimType trimType;
|
ETrimType trimType;
|
||||||
|
bool hasSMA;
|
||||||
|
bool dual; // whether select stmt without from stmt, true for without.
|
||||||
} SFunctionNode;
|
} SFunctionNode;
|
||||||
|
|
||||||
typedef struct STableNode {
|
typedef struct STableNode {
|
||||||
|
|
|
@ -70,6 +70,7 @@ int32_t modFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu
|
||||||
int32_t signFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
int32_t signFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
||||||
int32_t degreesFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
int32_t degreesFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
||||||
int32_t radiansFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
int32_t radiansFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
||||||
|
int32_t randFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
||||||
|
|
||||||
/* String functions */
|
/* String functions */
|
||||||
int32_t lengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
int32_t lengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
||||||
|
|
|
@ -43,22 +43,22 @@
|
||||||
#include "tcol.h"
|
#include "tcol.h"
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
|
|
||||||
#define DECODESQL() \
|
#define DECODESQL() \
|
||||||
do { \
|
do { \
|
||||||
if (!tDecodeIsEnd(&decoder)) { \
|
if (!tDecodeIsEnd(&decoder)) { \
|
||||||
if (tDecodeI32(&decoder, &pReq->sqlLen) < 0) return -1; \
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->sqlLen)); \
|
||||||
if (pReq->sqlLen > 0) { \
|
if (pReq->sqlLen > 0) { \
|
||||||
if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->sql, NULL) < 0) return -1; \
|
TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pReq->sql, NULL)); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ENCODESQL() \
|
#define ENCODESQL() \
|
||||||
do { \
|
do { \
|
||||||
if (tEncodeI32(&encoder, pReq->sqlLen) < 0) return -1; \
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->sqlLen)); \
|
||||||
if (pReq->sqlLen > 0) { \
|
if (pReq->sqlLen > 0) { \
|
||||||
if (tEncodeBinary(&encoder, pReq->sql, pReq->sqlLen) < 0) return -1; \
|
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)pReq->sql, pReq->sqlLen)); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define FREESQL() \
|
#define FREESQL() \
|
||||||
|
@ -1243,19 +1243,7 @@ _exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
// int32_t tSerializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) {
|
|
||||||
// SEncoder encoder = {0};
|
|
||||||
// tEncoderInit(&encoder, buf, bufLen);
|
|
||||||
// if (tStartEncode(&encoder) < 0) return -1;
|
|
||||||
// tEndEncode(&encoder);
|
|
||||||
|
|
||||||
// if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
|
||||||
// if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
|
|
||||||
|
|
||||||
// int32_t tlen = encoder.pos;
|
|
||||||
// tEncoderClear(&encoder);
|
|
||||||
// return tlen;
|
|
||||||
// }
|
|
||||||
int32_t tDeserializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) {
|
int32_t tDeserializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1307,32 +1295,6 @@ void tFreeSMCreateFullTextReq(SMCreateFullTextReq *pReq) {
|
||||||
// impl later
|
// impl later
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// int32_t tSerializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
|
|
||||||
// SEncoder encoder = {0};
|
|
||||||
// tEncoderInit(&encoder, buf, bufLen);
|
|
||||||
|
|
||||||
// if (tStartEncode(&encoder) < 0) return -1;
|
|
||||||
|
|
||||||
// if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
|
||||||
|
|
||||||
// if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
|
|
||||||
|
|
||||||
// tEndEncode(&encoder);
|
|
||||||
// int32_t tlen = encoder.pos;
|
|
||||||
// tEncoderClear(&encoder);
|
|
||||||
// return tlen;
|
|
||||||
// }
|
|
||||||
// int32_t tDeserializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
|
|
||||||
// SDecoder decoder = {0};
|
|
||||||
// tDecoderInit(&decoder, buf, bufLen);
|
|
||||||
// if (tStartDecode(&decoder) < 0) return -1;
|
|
||||||
// if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
|
|
||||||
// if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
|
|
||||||
|
|
||||||
// tEndDecode(&decoder);
|
|
||||||
// tDecoderClear(&decoder);
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
int32_t tSerializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) {
|
int32_t tSerializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
@ -2108,7 +2070,7 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq)
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tabName));
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tabName));
|
||||||
}
|
}
|
||||||
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen));
|
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)pReq->tagCond, pReq->tagCondLen));
|
||||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numIpRanges));
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numIpRanges));
|
||||||
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
||||||
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].ip));
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].ip));
|
||||||
|
@ -3386,6 +3348,8 @@ void tFreeSRetrieveFuncRsp(SRetrieveFuncRsp *pRsp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) {
|
int32_t tSerializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
int32_t headLen = sizeof(SMsgHead);
|
int32_t headLen = sizeof(SMsgHead);
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
buf = (char *)buf + headLen;
|
buf = (char *)buf + headLen;
|
||||||
|
@ -3395,26 +3359,34 @@ int32_t tSerializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
if (tEncodeCStr(&encoder, pReq->dbFName) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dbFName));
|
||||||
if (tEncodeCStr(&encoder, pReq->tbName) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tbName));
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
tEncoderClear(&encoder);
|
if (code) {
|
||||||
|
tEncoderClear(&encoder);
|
||||||
|
return code;
|
||||||
|
} else {
|
||||||
|
int32_t tlen = encoder.pos;
|
||||||
|
tEncoderClear(&encoder);
|
||||||
|
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
|
SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
|
||||||
pHead->vgId = htonl(pReq->header.vgId);
|
pHead->vgId = htonl(pReq->header.vgId);
|
||||||
pHead->contLen = htonl(tlen + headLen);
|
pHead->contLen = htonl(tlen + headLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tlen + headLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tlen + headLen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) {
|
int32_t tDeserializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) {
|
||||||
int32_t headLen = sizeof(SMsgHead);
|
int32_t headLen = sizeof(SMsgHead);
|
||||||
|
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
SMsgHead *pHead = buf;
|
SMsgHead *pHead = buf;
|
||||||
pHead->vgId = pReq->header.vgId;
|
pHead->vgId = pReq->header.vgId;
|
||||||
pHead->contLen = pReq->header.contLen;
|
pHead->contLen = pReq->header.contLen;
|
||||||
|
@ -3422,13 +3394,14 @@ int32_t tDeserializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq)
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
|
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->dbFName) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dbFName));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->tbName) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tbName));
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) {
|
int32_t tSerializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) {
|
||||||
|
@ -4683,14 +4656,22 @@ _exit:
|
||||||
|
|
||||||
int32_t tSerializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) {
|
int32_t tSerializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
if (tEncodeCStr(&encoder, pReq->db) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db));
|
||||||
if (tEncodeI32(&encoder, pReq->maxSpeed) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->maxSpeed));
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
@ -5726,6 +5707,8 @@ void tFreeSSTbHbRsp(SSTbHbRsp *pRsp) {
|
||||||
|
|
||||||
int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq) {
|
int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq) {
|
||||||
int32_t headLen = sizeof(SMsgHead);
|
int32_t headLen = sizeof(SMsgHead);
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
buf = (char *)buf + headLen;
|
buf = (char *)buf + headLen;
|
||||||
bufLen -= headLen;
|
bufLen -= headLen;
|
||||||
|
@ -5734,26 +5717,33 @@ int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq)
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
if (tEncodeCStr(&encoder, pReq->dbFName) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dbFName));
|
||||||
if (tEncodeCStr(&encoder, pReq->tbName) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tbName));
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
tEncoderClear(&encoder);
|
if (code) {
|
||||||
|
tEncoderClear(&encoder);
|
||||||
|
return code;
|
||||||
|
} else {
|
||||||
|
int32_t tlen = encoder.pos;
|
||||||
|
tEncoderClear(&encoder);
|
||||||
|
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
|
SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
|
||||||
pHead->vgId = htonl(pReq->header.vgId);
|
pHead->vgId = htonl(pReq->header.vgId);
|
||||||
pHead->contLen = htonl(tlen + headLen);
|
pHead->contLen = htonl(tlen + headLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tlen + headLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tlen + headLen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq) {
|
int32_t tDeserializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq) {
|
||||||
int32_t headLen = sizeof(SMsgHead);
|
int32_t headLen = sizeof(SMsgHead);
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
SMsgHead *pHead = buf;
|
SMsgHead *pHead = buf;
|
||||||
pHead->vgId = pReq->header.vgId;
|
pHead->vgId = pReq->header.vgId;
|
||||||
pHead->contLen = pReq->header.contLen;
|
pHead->contLen = pReq->header.contLen;
|
||||||
|
@ -5761,13 +5751,14 @@ int32_t tDeserializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
|
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->dbFName) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dbFName));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->tbName) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tbName));
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *pReq) {
|
int32_t tSerializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *pReq) {
|
||||||
|
@ -6393,7 +6384,7 @@ int32_t tSerializeSQueryCompactProgressReq(void *buf, int32_t bufLen, SQueryComp
|
||||||
int32_t tlen;
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
|
||||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->compactId));
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->compactId));
|
||||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId));
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId));
|
||||||
|
@ -7768,7 +7759,9 @@ int32_t tDeserializeSMArbUpdateGroupBatchReq(void *buf, int32_t bufLen, SMArbUpd
|
||||||
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz));
|
||||||
|
|
||||||
SArray *updateArray = taosArrayInit(sz, sizeof(SMArbUpdateGroup));
|
SArray *updateArray = taosArrayInit(sz, sizeof(SMArbUpdateGroup));
|
||||||
if (!updateArray) return -1;
|
if (!updateArray) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < sz; i++) {
|
for (int32_t i = 0; i < sz; i++) {
|
||||||
SMArbUpdateGroup group = {0};
|
SMArbUpdateGroup group = {0};
|
||||||
|
@ -7939,6 +7932,8 @@ void tFreeSExplainRsp(SExplainRsp *pRsp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
|
int32_t tSerializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
int32_t headLen = sizeof(SMsgHead);
|
int32_t headLen = sizeof(SMsgHead);
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
buf = (char *)buf + headLen;
|
buf = (char *)buf + headLen;
|
||||||
|
@ -7947,35 +7942,42 @@ int32_t tSerializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
|
||||||
|
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
|
||||||
int32_t num = taosArrayGetSize(pReq->pMsgs);
|
int32_t num = taosArrayGetSize(pReq->pMsgs);
|
||||||
if (tEncodeI32(&encoder, num) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, num));
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
SBatchMsg *pMsg = taosArrayGet(pReq->pMsgs, i);
|
SBatchMsg *pMsg = taosArrayGet(pReq->pMsgs, i);
|
||||||
if (tEncodeI32(&encoder, pMsg->msgIdx) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->msgIdx));
|
||||||
if (tEncodeI32(&encoder, pMsg->msgType) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->msgType));
|
||||||
if (tEncodeI32(&encoder, pMsg->msgLen) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->msgLen));
|
||||||
if (tEncodeBinary(&encoder, pMsg->msg, pMsg->msgLen) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pMsg->msg, pMsg->msgLen));
|
||||||
}
|
}
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
tEncoderClear(&encoder);
|
if (code) {
|
||||||
|
tEncoderClear(&encoder);
|
||||||
|
return code;
|
||||||
|
} else {
|
||||||
|
int32_t tlen = encoder.pos;
|
||||||
|
tEncoderClear(&encoder);
|
||||||
|
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
|
SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
|
||||||
pHead->vgId = htonl(pReq->header.vgId);
|
pHead->vgId = htonl(pReq->header.vgId);
|
||||||
pHead->contLen = htonl(tlen + headLen);
|
pHead->contLen = htonl(tlen + headLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tlen + headLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tlen + headLen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
|
int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
|
||||||
int32_t headLen = sizeof(SMsgHead);
|
int32_t headLen = sizeof(SMsgHead);
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
SMsgHead *pHead = buf;
|
SMsgHead *pHead = buf;
|
||||||
pHead->vgId = pReq->header.vgId;
|
pHead->vgId = pReq->header.vgId;
|
||||||
pHead->contLen = pReq->header.contLen;
|
pHead->contLen = pReq->header.contLen;
|
||||||
|
@ -7983,33 +7985,37 @@ int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
|
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
|
|
||||||
int32_t num = 0;
|
int32_t num = 0;
|
||||||
if (tDecodeI32(&decoder, &num) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num));
|
||||||
if (num <= 0) {
|
if (num <= 0) {
|
||||||
pReq->pMsgs = NULL;
|
pReq->pMsgs = NULL;
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pReq->pMsgs = taosArrayInit(num, sizeof(SBatchMsg));
|
pReq->pMsgs = taosArrayInit(num, sizeof(SBatchMsg));
|
||||||
if (NULL == pReq->pMsgs) return -1;
|
if (NULL == pReq->pMsgs) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
SBatchMsg msg = {0};
|
SBatchMsg msg = {0};
|
||||||
if (tDecodeI32(&decoder, &msg.msgIdx) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.msgIdx));
|
||||||
if (tDecodeI32(&decoder, &msg.msgType) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.msgType));
|
||||||
if (tDecodeI32(&decoder, &msg.msgLen) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.msgLen));
|
||||||
if (tDecodeBinaryAlloc(&decoder, &msg.msg, NULL) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, &msg.msg, NULL));
|
||||||
if (NULL == taosArrayPush(pReq->pMsgs, &msg)) return -1;
|
if (NULL == taosArrayPush(pReq->pMsgs, &msg)) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp) {
|
int32_t tSerializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp) {
|
||||||
|
@ -8169,7 +8175,9 @@ int32_t tDeserializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) {
|
||||||
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz));
|
||||||
if (sz > 0) {
|
if (sz > 0) {
|
||||||
pRsp->topicPrivileges = taosArrayInit(sz, sizeof(STopicPrivilege));
|
pRsp->topicPrivileges = taosArrayInit(sz, sizeof(STopicPrivilege));
|
||||||
if (NULL == pRsp->topicPrivileges) return -1;
|
if (NULL == pRsp->topicPrivileges) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
for (int32_t i = 0; i < sz; ++i) {
|
for (int32_t i = 0; i < sz; ++i) {
|
||||||
STopicPrivilege *data = taosArrayReserve(pRsp->topicPrivileges, 1);
|
STopicPrivilege *data = taosArrayReserve(pRsp->topicPrivileges, 1);
|
||||||
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, data->topic));
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, data->topic));
|
||||||
|
@ -8529,7 +8537,7 @@ int32_t tSerializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) {
|
||||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId));
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId));
|
||||||
if (pReq->pOpParam) {
|
if (pReq->pOpParam) {
|
||||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, 1));
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, 1));
|
||||||
if (tSerializeSOperatorParam(&encoder, pReq->pOpParam) < 0) return -1;
|
TAOS_CHECK_EXIT(tSerializeSOperatorParam(&encoder, pReq->pOpParam));
|
||||||
} else {
|
} else {
|
||||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0));
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0));
|
||||||
}
|
}
|
||||||
|
@ -9021,7 +9029,9 @@ int32_t tDeserializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *
|
||||||
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num));
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
pRsp->taskStatus = taosArrayInit(num, sizeof(STaskStatus));
|
pRsp->taskStatus = taosArrayInit(num, sizeof(STaskStatus));
|
||||||
if (NULL == pRsp->taskStatus) return -1;
|
if (NULL == pRsp->taskStatus) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
STaskStatus status = {0};
|
STaskStatus status = {0};
|
||||||
TAOS_CHECK_EXIT(tDecodeU64(&decoder, &status.queryId));
|
TAOS_CHECK_EXIT(tDecodeU64(&decoder, &status.queryId));
|
||||||
|
@ -9289,8 +9299,12 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
|
||||||
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->maxDelay));
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->maxDelay));
|
||||||
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->watermark));
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->watermark));
|
||||||
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igExpired));
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igExpired));
|
||||||
if (sqlLen > 0 && tEncodeCStr(&encoder, pReq->sql) < 0) return -1;
|
if (sqlLen > 0) {
|
||||||
if (astLen > 0 && tEncodeCStr(&encoder, pReq->ast) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sql));
|
||||||
|
}
|
||||||
|
if (astLen > 0) {
|
||||||
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->ast));
|
||||||
|
}
|
||||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfTags));
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfTags));
|
||||||
for (int32_t i = 0; i < pReq->numOfTags; ++i) {
|
for (int32_t i = 0; i < pReq->numOfTags; ++i) {
|
||||||
SField *pField = taosArrayGet(pReq->pTags, i);
|
SField *pField = taosArrayGet(pReq->pTags, i);
|
||||||
|
@ -9735,7 +9749,9 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
|
||||||
TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pReq->commentLen));
|
TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pReq->commentLen));
|
||||||
if (pReq->commentLen > 0) {
|
if (pReq->commentLen > 0) {
|
||||||
pReq->comment = taosMemoryMalloc(pReq->commentLen + 1);
|
pReq->comment = taosMemoryMalloc(pReq->commentLen + 1);
|
||||||
if (pReq->comment == NULL) return -1;
|
if (pReq->comment == NULL) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
TAOS_CHECK_EXIT(tDecodeCStrTo(pCoder, pReq->comment));
|
TAOS_CHECK_EXIT(tDecodeCStrTo(pCoder, pReq->comment));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10244,7 +10260,9 @@ int32_t tDecodeSVAlterTbRsp(SDecoder *pDecoder, SVAlterTbRsp *pRsp) {
|
||||||
TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &meta));
|
TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &meta));
|
||||||
if (meta) {
|
if (meta) {
|
||||||
pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
|
pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
|
||||||
if (NULL == pRsp->pMeta) return -1;
|
if (NULL == pRsp->pMeta) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta));
|
TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta));
|
||||||
}
|
}
|
||||||
tEndDecode(pDecoder);
|
tEndDecode(pDecoder);
|
||||||
|
@ -10275,7 +10293,9 @@ int32_t tDecodeSMAlterStbRsp(SDecoder *pDecoder, SMAlterStbRsp *pRsp) {
|
||||||
TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &meta));
|
TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &meta));
|
||||||
if (meta) {
|
if (meta) {
|
||||||
pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
|
pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
|
||||||
if (NULL == pRsp->pMeta) return -1;
|
if (NULL == pRsp->pMeta) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta));
|
TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta));
|
||||||
}
|
}
|
||||||
tEndDecode(pDecoder);
|
tEndDecode(pDecoder);
|
||||||
|
@ -10383,8 +10403,8 @@ int32_t tDecodeSTqOffsetVal(SDecoder *pDecoder, STqOffsetVal *pOffsetVal) {
|
||||||
if (offsetVersion >= TQ_OFFSET_VERSION) {
|
if (offsetVersion >= TQ_OFFSET_VERSION) {
|
||||||
TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pOffsetVal->primaryKey.type));
|
TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pOffsetVal->primaryKey.type));
|
||||||
if (IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)) {
|
if (IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)) {
|
||||||
if (tDecodeBinaryAlloc32(pDecoder, (void **)&pOffsetVal->primaryKey.pData, &pOffsetVal->primaryKey.nData) < 0)
|
TAOS_CHECK_EXIT(
|
||||||
return -1;
|
tDecodeBinaryAlloc32(pDecoder, (void **)&pOffsetVal->primaryKey.pData, &pOffsetVal->primaryKey.nData));
|
||||||
} else {
|
} else {
|
||||||
TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pOffsetVal->primaryKey.val));
|
TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pOffsetVal->primaryKey.val));
|
||||||
}
|
}
|
||||||
|
@ -11697,7 +11717,9 @@ int32_t tDeserializeSViewHbRsp(void *buf, int32_t bufLen, SViewHbRsp *pRsp) {
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfMeta; ++i) {
|
for (int32_t i = 0; i < numOfMeta; ++i) {
|
||||||
SViewMetaRsp *metaRsp = taosMemoryCalloc(1, sizeof(SViewMetaRsp));
|
SViewMetaRsp *metaRsp = taosMemoryCalloc(1, sizeof(SViewMetaRsp));
|
||||||
if (NULL == metaRsp) return -1;
|
if (NULL == metaRsp) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
TAOS_CHECK_EXIT(tDecodeSViewMetaRsp(&decoder, metaRsp));
|
TAOS_CHECK_EXIT(tDecodeSViewMetaRsp(&decoder, metaRsp));
|
||||||
if (taosArrayPush(pRsp->pViewRsp, &metaRsp) == NULL) {
|
if (taosArrayPush(pRsp->pViewRsp, &metaRsp) == NULL) {
|
||||||
TAOS_CHECK_EXIT(terrno);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
|
|
@ -55,36 +55,44 @@ void tFreeCompactObj(SCompactObj *pCompact) {}
|
||||||
|
|
||||||
int32_t tSerializeSCompactObj(void *buf, int32_t bufLen, const SCompactObj *pObj) {
|
int32_t tSerializeSCompactObj(void *buf, int32_t bufLen, const SCompactObj *pObj) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->compactId));
|
||||||
if (tEncodeI32(&encoder, pObj->compactId) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pObj->dbname));
|
||||||
if (tEncodeCStr(&encoder, pObj->dbname) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pObj->startTime));
|
||||||
if (tEncodeI64(&encoder, pObj->startTime) < 0) return -1;
|
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj) {
|
int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj) {
|
||||||
int8_t ex = 0;
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
TAOS_CHECK_RETURN(tStartDecode(&decoder));
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->compactId));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->compactId));
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pObj->dbname));
|
||||||
TAOS_CHECK_RETURN(tDecodeCStrTo(&decoder, pObj->dbname));
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pObj->startTime));
|
||||||
TAOS_CHECK_RETURN(tDecodeI64(&decoder, &pObj->startTime));
|
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
|
SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
|
||||||
|
@ -633,8 +641,8 @@ void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact) {
|
||||||
|
|
||||||
static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
|
static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
bool needSave = false;
|
bool needSave = false;
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
while (1) {
|
while (1) {
|
||||||
SCompactDetailObj *pDetail = NULL;
|
SCompactDetailObj *pDetail = NULL;
|
||||||
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "mndCompactDetail.h"
|
#include "mndCompactDetail.h"
|
||||||
#include "mndTrans.h"
|
|
||||||
#include "mndShow.h"
|
|
||||||
#include "mndDb.h"
|
#include "mndDb.h"
|
||||||
|
#include "mndShow.h"
|
||||||
|
#include "mndTrans.h"
|
||||||
|
|
||||||
#define MND_COMPACT_VER_NUMBER 1
|
#define MND_COMPACT_VER_NUMBER 1
|
||||||
|
|
||||||
|
@ -35,21 +35,20 @@ int32_t mndInitCompactDetail(SMnode *pMnode) {
|
||||||
return sdbSetTable(pMnode->pSdb, table);
|
return sdbSetTable(pMnode->pSdb, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mndCleanupCompactDetail(SMnode *pMnode) {
|
void mndCleanupCompactDetail(SMnode *pMnode) { mDebug("mnd compact detail cleanup"); }
|
||||||
mDebug("mnd compact detail cleanup");
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows){
|
int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
SCompactDetailObj *pCompactDetail = NULL;
|
SCompactDetailObj *pCompactDetail = NULL;
|
||||||
char *sep = NULL;
|
char *sep = NULL;
|
||||||
SDbObj *pDb = NULL;
|
SDbObj *pDb = NULL;
|
||||||
|
|
||||||
if (strlen(pShow->db) > 0) {
|
if (strlen(pShow->db) > 0) {
|
||||||
sep = strchr(pShow->db, '.');
|
sep = strchr(pShow->db, '.');
|
||||||
if (sep && ((0 == strcmp(sep + 1, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcmp(sep + 1, TSDB_PERFORMANCE_SCHEMA_DB))))) {
|
if (sep &&
|
||||||
|
((0 == strcmp(sep + 1, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcmp(sep + 1, TSDB_PERFORMANCE_SCHEMA_DB))))) {
|
||||||
sep++;
|
sep++;
|
||||||
} else {
|
} else {
|
||||||
pDb = mndAcquireDb(pMnode, pShow->db);
|
pDb = mndAcquireDb(pMnode, pShow->db);
|
||||||
|
@ -57,7 +56,7 @@ int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while(numOfRows < rows){
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = sdbFetch(pSdb, SDB_COMPACT_DETAIL, pShow->pIter, (void **)&pCompactDetail);
|
pShow->pIter = sdbFetch(pSdb, SDB_COMPACT_DETAIL, pShow->pIter, (void **)&pCompactDetail);
|
||||||
if (pShow->pIter == NULL) break;
|
if (pShow->pIter == NULL) break;
|
||||||
|
|
||||||
|
@ -94,53 +93,60 @@ int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeCompactDetailObj(SCompactDetailObj *pCompact) {
|
void tFreeCompactDetailObj(SCompactDetailObj *pCompact) {}
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tSerializeSCompactDetailObj(void *buf, int32_t bufLen, const SCompactDetailObj *pObj) {
|
int32_t tSerializeSCompactDetailObj(void *buf, int32_t bufLen, const SCompactDetailObj *pObj) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->compactDetailId));
|
||||||
if (tEncodeI32(&encoder, pObj->compactDetailId) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->compactId));
|
||||||
if (tEncodeI32(&encoder, pObj->compactId) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->vgId));
|
||||||
if (tEncodeI32(&encoder, pObj->vgId) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->dnodeId));
|
||||||
if (tEncodeI32(&encoder, pObj->dnodeId) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->numberFileset));
|
||||||
if (tEncodeI32(&encoder, pObj->numberFileset) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->finished));
|
||||||
if (tEncodeI32(&encoder, pObj->finished) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pObj->startTime));
|
||||||
if (tEncodeI64(&encoder, pObj->startTime) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->newNumberFileset));
|
||||||
if (tEncodeI32(&encoder, pObj->newNumberFileset) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->newFinished));
|
||||||
if (tEncodeI32(&encoder, pObj->newFinished) < 0) return -1;
|
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSCompactDetailObj(void *buf, int32_t bufLen, SCompactDetailObj *pObj) {
|
int32_t tDeserializeSCompactDetailObj(void *buf, int32_t bufLen, SCompactDetailObj *pObj) {
|
||||||
int8_t ex = 0;
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
TAOS_CHECK_RETURN(tStartDecode(&decoder));
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->compactDetailId));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->compactDetailId));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->compactId));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->compactId));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->vgId));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->vgId));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->dnodeId));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->dnodeId));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->numberFileset));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->numberFileset));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->finished));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->finished));
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pObj->startTime));
|
||||||
TAOS_CHECK_RETURN(tDecodeI64(&decoder, &pObj->startTime));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->newNumberFileset));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->newNumberFileset));
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->newFinished));
|
||||||
TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->newFinished));
|
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
|
SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
|
||||||
|
@ -148,7 +154,7 @@ SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
SSdbRaw *pRaw = NULL;
|
SSdbRaw *pRaw = NULL;
|
||||||
|
|
||||||
int32_t tlen = tSerializeSCompactDetailObj(NULL, 0, pCompact);
|
int32_t tlen = tSerializeSCompactDetailObj(NULL, 0, pCompact);
|
||||||
|
@ -157,7 +163,7 @@ SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
|
||||||
goto OVER;
|
goto OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t size = sizeof(int32_t) + tlen;
|
int32_t size = sizeof(int32_t) + tlen;
|
||||||
pRaw = sdbAllocRaw(SDB_COMPACT_DETAIL, MND_COMPACT_VER_NUMBER, size);
|
pRaw = sdbAllocRaw(SDB_COMPACT_DETAIL, MND_COMPACT_VER_NUMBER, size);
|
||||||
if (pRaw == NULL) {
|
if (pRaw == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -181,7 +187,6 @@ SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
|
||||||
SDB_SET_BINARY(pRaw, dataPos, buf, tlen, OVER);
|
SDB_SET_BINARY(pRaw, dataPos, buf, tlen, OVER);
|
||||||
SDB_SET_DATALEN(pRaw, dataPos, OVER);
|
SDB_SET_DATALEN(pRaw, dataPos, OVER);
|
||||||
|
|
||||||
|
|
||||||
OVER:
|
OVER:
|
||||||
taosMemoryFreeClear(buf);
|
taosMemoryFreeClear(buf);
|
||||||
if (terrno != TSDB_CODE_SUCCESS) {
|
if (terrno != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -263,9 +268,8 @@ int32_t mndCompactDetailActionDelete(SSdb *pSdb, SCompactDetailObj *pCompact) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndCompactDetailActionUpdate(SSdb *pSdb, SCompactDetailObj *pOldCompact, SCompactDetailObj *pNewCompact) {
|
int32_t mndCompactDetailActionUpdate(SSdb *pSdb, SCompactDetailObj *pOldCompact, SCompactDetailObj *pNewCompact) {
|
||||||
mTrace("compact detail:%" PRId32 ", perform update action, old row:%p new row:%p",
|
mTrace("compact detail:%" PRId32 ", perform update action, old row:%p new row:%p", pOldCompact->compactId,
|
||||||
pOldCompact->compactId, pOldCompact, pNewCompact);
|
pOldCompact, pNewCompact);
|
||||||
|
|
||||||
|
|
||||||
pOldCompact->numberFileset = pNewCompact->numberFileset;
|
pOldCompact->numberFileset = pNewCompact->numberFileset;
|
||||||
pOldCompact->finished = pNewCompact->finished;
|
pOldCompact->finished = pNewCompact->finished;
|
||||||
|
@ -273,8 +277,8 @@ int32_t mndCompactDetailActionUpdate(SSdb *pSdb, SCompactDetailObj *pOldCompact,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndAddCompactDetailToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* pCompact, SVgObj *pVgroup,
|
int32_t mndAddCompactDetailToTran(SMnode *pMnode, STrans *pTrans, SCompactObj *pCompact, SVgObj *pVgroup,
|
||||||
SVnodeGid *pVgid, int32_t index){
|
SVnodeGid *pVgid, int32_t index) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SCompactDetailObj compactDetail = {0};
|
SCompactDetailObj compactDetail = {0};
|
||||||
compactDetail.compactDetailId = index;
|
compactDetail.compactDetailId = index;
|
||||||
|
@ -287,8 +291,8 @@ int32_t mndAddCompactDetailToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* p
|
||||||
compactDetail.newNumberFileset = -1;
|
compactDetail.newNumberFileset = -1;
|
||||||
compactDetail.newFinished = -1;
|
compactDetail.newFinished = -1;
|
||||||
|
|
||||||
mInfo("compact:%d, add compact detail to trans, index:%d, vgId:%d, dnodeId:%d",
|
mInfo("compact:%d, add compact detail to trans, index:%d, vgId:%d, dnodeId:%d", compactDetail.compactId,
|
||||||
compactDetail.compactId, compactDetail.compactDetailId, compactDetail.vgId, compactDetail.dnodeId);
|
compactDetail.compactDetailId, compactDetail.vgId, compactDetail.dnodeId);
|
||||||
|
|
||||||
SSdbRaw *pVgRaw = mndCompactDetailActionEncode(&compactDetail);
|
SSdbRaw *pVgRaw = mndCompactDetailActionEncode(&compactDetail);
|
||||||
if (pVgRaw == NULL) return -1;
|
if (pVgRaw == NULL) return -1;
|
||||||
|
|
|
@ -161,6 +161,8 @@ int metaTtlFindExpired(SMeta* pMeta, int64_t timePointMs, SArray* tb
|
||||||
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
|
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
|
||||||
int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs);
|
int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs);
|
||||||
SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock);
|
SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock);
|
||||||
|
int32_t metaGetTbTSchemaNotNull(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema);
|
||||||
|
int32_t metaGetTbTSchemaMaybeNull(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema);
|
||||||
STSchema* metaGetTbTSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock);
|
STSchema* metaGetTbTSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock);
|
||||||
int32_t metaGetTbTSchemaEx(SMeta* pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sver, STSchema** ppTSchema);
|
int32_t metaGetTbTSchemaEx(SMeta* pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sver, STSchema** ppTSchema);
|
||||||
int metaGetTableEntryByName(SMetaReader* pReader, const char* name);
|
int metaGetTableEntryByName(SMetaReader* pReader, const char* name);
|
||||||
|
|
|
@ -45,6 +45,7 @@ void metaReaderClear(SMetaReader *pReader) {
|
||||||
}
|
}
|
||||||
tDecoderClear(&pReader->coder);
|
tDecoderClear(&pReader->coder);
|
||||||
tdbFree(pReader->pBuf);
|
tdbFree(pReader->pBuf);
|
||||||
|
pReader->pBuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t uid) {
|
int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t uid) {
|
||||||
|
@ -614,6 +615,22 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock) {
|
||||||
return pTSchema;
|
return pTSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t metaGetTbTSchemaNotNull(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema) {
|
||||||
|
*ppTSchema = metaGetTbTSchema(pMeta, uid, sver, lock);
|
||||||
|
if(*ppTSchema == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t metaGetTbTSchemaMaybeNull(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema) {
|
||||||
|
*ppTSchema = metaGetTbTSchema(pMeta, uid, sver, lock);
|
||||||
|
if(*ppTSchema == NULL && terrno == TSDB_CODE_OUT_OF_MEMORY) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sver, STSchema **ppTSchema) {
|
int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sver, STSchema **ppTSchema) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t lino;
|
int32_t lino;
|
||||||
|
|
|
@ -392,10 +392,9 @@ int32_t tdRSmaProcessCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
STSchema *pTSchema = metaGetTbTSchema(SMA_META(pSma), suid, -1, 1);
|
STSchema *pTSchema;
|
||||||
if (!pTSchema) {
|
code = metaGetTbTSchemaNotNull(SMA_META(pSma), suid, -1, 1, &pTSchema);
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION);
|
TAOS_CHECK_EXIT(code);
|
||||||
}
|
|
||||||
pRSmaInfo->pSma = pSma;
|
pRSmaInfo->pSma = pSma;
|
||||||
pRSmaInfo->pTSchema = pTSchema;
|
pRSmaInfo->pTSchema = pTSchema;
|
||||||
pRSmaInfo->suid = suid;
|
pRSmaInfo->suid = suid;
|
||||||
|
|
|
@ -343,11 +343,8 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
pTsmaStat->pTSma = pTSma;
|
pTsmaStat->pTSma = pTSma;
|
||||||
pTsmaStat->pTSchema = metaGetTbTSchema(SMA_META(pSma), pTSma->dstTbUid, -1, 1);
|
code = metaGetTbTSchemaNotNull(SMA_META(pSma), pTSma->dstTbUid, -1, 1, &pTsmaStat->pTSchema);
|
||||||
if (!pTsmaStat->pTSchema) {
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
code = TSDB_CODE_TSMA_INVALID_PTR;
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTsmaStat->pTSma->indexUid != indexUid) {
|
if (pTsmaStat->pTSma->indexUid != indexUid) {
|
||||||
|
|
|
@ -16,64 +16,79 @@
|
||||||
#include "tq.h"
|
#include "tq.h"
|
||||||
|
|
||||||
int32_t tEncodeSTqHandle(SEncoder* pEncoder, const STqHandle* pHandle) {
|
int32_t tEncodeSTqHandle(SEncoder* pEncoder, const STqHandle* pHandle) {
|
||||||
if (tStartEncode(pEncoder) < 0) return -1;
|
int32_t code = 0;
|
||||||
if (tEncodeCStr(pEncoder, pHandle->subKey) < 0) return -1;
|
int32_t lino;
|
||||||
if (tEncodeI8(pEncoder, pHandle->fetchMeta) < 0) return -1;
|
|
||||||
if (tEncodeI64(pEncoder, pHandle->consumerId) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(pEncoder));
|
||||||
if (tEncodeI64(pEncoder, pHandle->snapshotVer) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pHandle->subKey));
|
||||||
if (tEncodeI32(pEncoder, pHandle->epoch) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pHandle->fetchMeta));
|
||||||
if (tEncodeI8(pEncoder, pHandle->execHandle.subType) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pHandle->consumerId));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pHandle->snapshotVer));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pHandle->epoch));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pHandle->execHandle.subType));
|
||||||
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
|
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||||
if (tEncodeCStr(pEncoder, pHandle->execHandle.execCol.qmsg) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pHandle->execHandle.execCol.qmsg));
|
||||||
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
|
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
|
||||||
int32_t size = taosHashGetSize(pHandle->execHandle.execDb.pFilterOutTbUid);
|
int32_t size = taosHashGetSize(pHandle->execHandle.execDb.pFilterOutTbUid);
|
||||||
if (tEncodeI32(pEncoder, size) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
|
||||||
void* pIter = NULL;
|
void* pIter = NULL;
|
||||||
pIter = taosHashIterate(pHandle->execHandle.execDb.pFilterOutTbUid, pIter);
|
pIter = taosHashIterate(pHandle->execHandle.execDb.pFilterOutTbUid, pIter);
|
||||||
while (pIter) {
|
while (pIter) {
|
||||||
int64_t* tbUid = (int64_t*)taosHashGetKey(pIter, NULL);
|
int64_t* tbUid = (int64_t*)taosHashGetKey(pIter, NULL);
|
||||||
if (tEncodeI64(pEncoder, *tbUid) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(pEncoder, *tbUid));
|
||||||
pIter = taosHashIterate(pHandle->execHandle.execDb.pFilterOutTbUid, pIter);
|
pIter = taosHashIterate(pHandle->execHandle.execDb.pFilterOutTbUid, pIter);
|
||||||
}
|
}
|
||||||
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
|
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
|
||||||
if (tEncodeI64(pEncoder, pHandle->execHandle.execTb.suid) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pHandle->execHandle.execTb.suid));
|
||||||
if (pHandle->execHandle.execTb.qmsg != NULL) {
|
if (pHandle->execHandle.execTb.qmsg != NULL) {
|
||||||
if (tEncodeCStr(pEncoder, pHandle->execHandle.execTb.qmsg) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pHandle->execHandle.execTb.qmsg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tEndEncode(pEncoder);
|
tEndEncode(pEncoder);
|
||||||
return pEncoder->pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
return code;
|
||||||
|
} else {
|
||||||
|
return pEncoder->pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) {
|
int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) {
|
||||||
if (tStartDecode(pDecoder) < 0) return -1;
|
int32_t code = 0;
|
||||||
if (tDecodeCStrTo(pDecoder, pHandle->subKey) < 0) return -1;
|
int32_t lino;
|
||||||
if (tDecodeI8(pDecoder, &pHandle->fetchMeta) < 0) return -1;
|
|
||||||
if (tDecodeI64(pDecoder, &pHandle->consumerId) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(pDecoder));
|
||||||
if (tDecodeI64(pDecoder, &pHandle->snapshotVer) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pHandle->subKey));
|
||||||
if (tDecodeI32(pDecoder, &pHandle->epoch) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pHandle->fetchMeta));
|
||||||
if (tDecodeI8(pDecoder, &pHandle->execHandle.subType) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pHandle->consumerId));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pHandle->snapshotVer));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pHandle->epoch));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pHandle->execHandle.subType));
|
||||||
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
|
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||||
if (tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execCol.qmsg) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execCol.qmsg));
|
||||||
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
|
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
|
||||||
pHandle->execHandle.execDb.pFilterOutTbUid =
|
pHandle->execHandle.execDb.pFilterOutTbUid =
|
||||||
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||||
if (pHandle->execHandle.execDb.pFilterOutTbUid == NULL) return -1;
|
if (pHandle->execHandle.execDb.pFilterOutTbUid == NULL) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
int32_t size = 0;
|
int32_t size = 0;
|
||||||
if (tDecodeI32(pDecoder, &size) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
|
||||||
for (int32_t i = 0; i < size; i++) {
|
for (int32_t i = 0; i < size; i++) {
|
||||||
int64_t tbUid = 0;
|
int64_t tbUid = 0;
|
||||||
if (tDecodeI64(pDecoder, &tbUid) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &tbUid));
|
||||||
if (taosHashPut(pHandle->execHandle.execDb.pFilterOutTbUid, &tbUid, sizeof(int64_t), NULL, 0) != 0) return -1;
|
TAOS_CHECK_EXIT(taosHashPut(pHandle->execHandle.execDb.pFilterOutTbUid, &tbUid, sizeof(int64_t), NULL, 0));
|
||||||
}
|
}
|
||||||
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
|
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
|
||||||
if (tDecodeI64(pDecoder, &pHandle->execHandle.execTb.suid) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pHandle->execHandle.execTb.suid));
|
||||||
if (!tDecodeIsEnd(pDecoder)) {
|
if (!tDecodeIsEnd(pDecoder)) {
|
||||||
if (tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execTb.qmsg) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execTb.qmsg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tEndDecode(pDecoder);
|
tEndDecode(pDecoder);
|
||||||
return 0;
|
|
||||||
|
_exit:
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tqMetaDecodeCheckInfo(STqCheckInfo* info, void* pVal, int32_t vLen) {
|
int32_t tqMetaDecodeCheckInfo(STqCheckInfo* info, void* pVal, int32_t vLen) {
|
||||||
|
|
|
@ -237,17 +237,25 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
||||||
|
|
||||||
static int32_t setTableSchema(SCacheRowsReader* p, uint64_t suid, const char* idstr) {
|
static int32_t setTableSchema(SCacheRowsReader* p, uint64_t suid, const char* idstr) {
|
||||||
int32_t numOfTables = p->numOfTables;
|
int32_t numOfTables = p->numOfTables;
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
if (suid != 0) {
|
if (suid != 0) {
|
||||||
p->pSchema = metaGetTbTSchema(p->pVnode->pMeta, suid, -1, 1);
|
code = metaGetTbTSchemaNotNull(p->pVnode->pMeta, suid, -1, 1, &p->pSchema);
|
||||||
if (p->pSchema == NULL) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
tsdbWarn("stable:%" PRIu64 " has been dropped, failed to retrieve cached rows, %s", suid, idstr);
|
tsdbWarn("stable:%" PRIu64 " has been dropped, failed to retrieve cached rows, %s", suid, idstr);
|
||||||
return TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
if(code != TSDB_CODE_OUT_OF_MEMORY) {
|
||||||
|
return TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
||||||
|
} else {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int32_t i = 0; i < numOfTables; ++i) {
|
for (int32_t i = 0; i < numOfTables; ++i) {
|
||||||
uint64_t uid = p->pTableList[i].uid;
|
uint64_t uid = p->pTableList[i].uid;
|
||||||
p->pSchema = metaGetTbTSchema(p->pVnode->pMeta, uid, -1, 1);
|
code = metaGetTbTSchemaMaybeNull(p->pVnode->pMeta, uid, -1, 1, &p->pSchema);
|
||||||
|
if(code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
if (p->pSchema != NULL) {
|
if (p->pSchema != NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4580,6 +4580,8 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t
|
||||||
clearBlockScanInfo(*p);
|
clearBlockScanInfo(*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tSimpleHashClear(pReader->status.pTableMap);
|
||||||
|
|
||||||
if (size < num) {
|
if (size < num) {
|
||||||
code = ensureBlockScanInfoBuf(&pReader->blockInfoBuf, num);
|
code = ensureBlockScanInfoBuf(&pReader->blockInfoBuf, num);
|
||||||
if (code) {
|
if (code) {
|
||||||
|
@ -4596,7 +4598,6 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t
|
||||||
pReader->status.uidList.tableUidList = (uint64_t*)p1;
|
pReader->status.uidList.tableUidList = (uint64_t*)p1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tSimpleHashClear(pReader->status.pTableMap);
|
|
||||||
STableUidList* pUidList = &pReader->status.uidList;
|
STableUidList* pUidList = &pReader->status.uidList;
|
||||||
pUidList->currentIndex = 0;
|
pUidList->currentIndex = 0;
|
||||||
|
|
||||||
|
@ -4745,13 +4746,15 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi
|
||||||
// no valid error code set in metaGetTbTSchema, so let's set the error code here.
|
// no valid error code set in metaGetTbTSchema, so let's set the error code here.
|
||||||
// we should proceed in case of tmq processing.
|
// we should proceed in case of tmq processing.
|
||||||
if (pCond->suid != 0) {
|
if (pCond->suid != 0) {
|
||||||
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1);
|
code = metaGetTbTSchemaMaybeNull(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1, &pReader->info.pSchema);
|
||||||
|
TSDB_CHECK_CODE(code, lino, _err);
|
||||||
if (pReader->info.pSchema == NULL) {
|
if (pReader->info.pSchema == NULL) {
|
||||||
tsdbWarn("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr);
|
tsdbWarn("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr);
|
||||||
}
|
}
|
||||||
} else if (numOfTables > 0) {
|
} else if (numOfTables > 0) {
|
||||||
STableKeyInfo* pKey = pTableList;
|
STableKeyInfo* pKey = pTableList;
|
||||||
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1);
|
code = metaGetTbTSchemaMaybeNull(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1, &pReader->info.pSchema);
|
||||||
|
TSDB_CHECK_CODE(code, lino, _err);
|
||||||
if (pReader->info.pSchema == NULL) {
|
if (pReader->info.pSchema == NULL) {
|
||||||
tsdbWarn("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
|
tsdbWarn("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1477,15 +1477,15 @@ static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock,
|
||||||
tInitSubmitBlkIter(msgIter, pBlock, &blkIter);
|
tInitSubmitBlkIter(msgIter, pBlock, &blkIter);
|
||||||
if (blkIter.row == NULL) return 0;
|
if (blkIter.row == NULL) return 0;
|
||||||
|
|
||||||
pSchema = metaGetTbTSchema(pMeta, msgIter->suid, TD_ROW_SVER(blkIter.row), 1); // TODO: use the real schema
|
int32_t code = metaGetTbTSchemaNotNull(pMeta, msgIter->suid, TD_ROW_SVER(blkIter.row), 1, &pSchema); // TODO: use the real schema
|
||||||
if (pSchema) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
suid = msgIter->suid;
|
|
||||||
rv = TD_ROW_SVER(blkIter.row);
|
|
||||||
}
|
|
||||||
if (!pSchema) {
|
|
||||||
printf("%s:%d no valid schema\n", tags, __LINE__);
|
printf("%s:%d no valid schema\n", tags, __LINE__);
|
||||||
return -1;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suid = msgIter->suid;
|
||||||
|
rv = TD_ROW_SVER(blkIter.row);
|
||||||
|
|
||||||
char __tags[128] = {0};
|
char __tags[128] = {0};
|
||||||
snprintf(__tags, 128, "%s: uid %" PRIi64 " ", tags, msgIter->uid);
|
snprintf(__tags, 128, "%s: uid %" PRIi64 " ", tags, msgIter->uid);
|
||||||
while ((row = tGetSubmitBlkNext(&blkIter))) {
|
while ((row = tGetSubmitBlkNext(&blkIter))) {
|
||||||
|
@ -1510,10 +1510,10 @@ typedef struct SSubmitReqConvertCxt {
|
||||||
|
|
||||||
static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
|
static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
|
||||||
taosMemoryFreeClear(pCxt->pTbSchema);
|
taosMemoryFreeClear(pCxt->pTbSchema);
|
||||||
pCxt->pTbSchema = metaGetTbTSchema(pMeta, pCxt->msgIter.suid > 0 ? pCxt->msgIter.suid : pCxt->msgIter.uid,
|
int32_t code = metaGetTbTSchemaNotNull(pMeta, pCxt->msgIter.suid > 0 ? pCxt->msgIter.suid : pCxt->msgIter.uid,
|
||||||
pCxt->msgIter.sversion, 1);
|
pCxt->msgIter.sversion, 1, &pCxt->pTbSchema);
|
||||||
if (NULL == pCxt->pTbSchema) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
return TSDB_CODE_INVALID_MSG;
|
return code;
|
||||||
}
|
}
|
||||||
tdSTSRowIterInit(&pCxt->rowIter, pCxt->pTbSchema);
|
tdSTSRowIterInit(&pCxt->rowIter, pCxt->pTbSchema);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ typedef struct SSumRes {
|
||||||
typedef struct SMinmaxResInfo {
|
typedef struct SMinmaxResInfo {
|
||||||
bool assign; // assign the first value or not
|
bool assign; // assign the first value or not
|
||||||
int64_t v;
|
int64_t v;
|
||||||
|
char *str;
|
||||||
STuplePos tuplePos;
|
STuplePos tuplePos;
|
||||||
|
|
||||||
STuplePos nullTuplePos;
|
STuplePos nullTuplePos;
|
||||||
|
|
|
@ -24,7 +24,7 @@ extern "C" {
|
||||||
|
|
||||||
#define FUNCTION_NAME_MAX_LENGTH 32
|
#define FUNCTION_NAME_MAX_LENGTH 32
|
||||||
|
|
||||||
#define FUNC_MGT_FUNC_CLASSIFICATION_MASK(n) (1 << n)
|
#define FUNC_MGT_FUNC_CLASSIFICATION_MASK(n) ((uint64_t)1 << n)
|
||||||
|
|
||||||
#define FUNC_MGT_AGG_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(0)
|
#define FUNC_MGT_AGG_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(0)
|
||||||
#define FUNC_MGT_SCALAR_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(1)
|
#define FUNC_MGT_SCALAR_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(1)
|
||||||
|
|
|
@ -271,6 +271,21 @@ static int32_t addUint8Param(SNodeList** pList, uint8_t param) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t addPseudoParam(SNodeList** pList) {
|
||||||
|
SNode *pseudoNode = NULL;
|
||||||
|
int32_t code = nodesMakeNode(QUERY_NODE_LEFT_VALUE, &pseudoNode);
|
||||||
|
if (pseudoNode == NULL) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
code = nodesListMakeAppend(pList, pseudoNode);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
nodesDestroyNode(pseudoNode);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static SDataType* getSDataTypeFromNode(SNode* pNode) {
|
static SDataType* getSDataTypeFromNode(SNode* pNode) {
|
||||||
if (pNode == NULL) return NULL;
|
if (pNode == NULL) return NULL;
|
||||||
if (nodesIsExprNode(pNode)) {
|
if (nodesIsExprNode(pNode)) {
|
||||||
|
@ -299,6 +314,25 @@ static int32_t translateInOutNum(SFunctionNode* pFunc, char* pErrBuf, int32_t le
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There is only one parameter of numeric type, and the return type is parameter type
|
||||||
|
static int32_t translateMinMax(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||||
|
if (1 != LIST_LENGTH(pFunc->pParameterList)) {
|
||||||
|
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDataType* dataType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0));
|
||||||
|
uint8_t paraType = dataType->type;
|
||||||
|
if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType) && !IS_STR_DATA_TYPE(paraType)) {
|
||||||
|
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
|
} else if (IS_NULL_TYPE(paraType)) {
|
||||||
|
paraType = TSDB_DATA_TYPE_BIGINT;
|
||||||
|
}
|
||||||
|
pFunc->hasSMA = !IS_VAR_DATA_TYPE(paraType);
|
||||||
|
int32_t bytes = IS_STR_DATA_TYPE(paraType) ? dataType->bytes : tDataTypes[paraType].bytes;
|
||||||
|
pFunc->node.resType = (SDataType){.bytes = bytes, .type = paraType};
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// There is only one parameter of numeric type, and the return type is double type
|
// There is only one parameter of numeric type, and the return type is double type
|
||||||
static int32_t translateInNumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
static int32_t translateInNumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||||
if (1 != LIST_LENGTH(pFunc->pParameterList)) {
|
if (1 != LIST_LENGTH(pFunc->pParameterList)) {
|
||||||
|
@ -579,6 +613,30 @@ static int32_t translatePi(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t translateRand(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||||
|
if (0 != LIST_LENGTH(pFunc->pParameterList) && 1 != LIST_LENGTH(pFunc->pParameterList)) {
|
||||||
|
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 == LIST_LENGTH(pFunc->pParameterList)) {
|
||||||
|
uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type;
|
||||||
|
if (!IS_INTEGER_TYPE(paraType) && !IS_NULL_TYPE(paraType)) {
|
||||||
|
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pFunc->dual) {
|
||||||
|
int32_t code = addPseudoParam(&pFunc->pParameterList);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pFunc->node.resType =
|
||||||
|
(SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE};
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t translateRound(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
static int32_t translateRound(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||||
if (2 != LIST_LENGTH(pFunc->pParameterList) && 1 != LIST_LENGTH(pFunc->pParameterList)) {
|
if (2 != LIST_LENGTH(pFunc->pParameterList) && 1 != LIST_LENGTH(pFunc->pParameterList)) {
|
||||||
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
|
@ -2904,7 +2962,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
||||||
.name = "min",
|
.name = "min",
|
||||||
.type = FUNCTION_TYPE_MIN,
|
.type = FUNCTION_TYPE_MIN,
|
||||||
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC,
|
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC,
|
||||||
.translateFunc = translateInOutNum,
|
.translateFunc = translateMinMax,
|
||||||
.dataRequiredFunc = statisDataRequired,
|
.dataRequiredFunc = statisDataRequired,
|
||||||
.getEnvFunc = getMinmaxFuncEnv,
|
.getEnvFunc = getMinmaxFuncEnv,
|
||||||
.initFunc = minmaxFunctionSetup,
|
.initFunc = minmaxFunctionSetup,
|
||||||
|
@ -2920,7 +2978,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
||||||
.name = "max",
|
.name = "max",
|
||||||
.type = FUNCTION_TYPE_MAX,
|
.type = FUNCTION_TYPE_MAX,
|
||||||
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC,
|
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC,
|
||||||
.translateFunc = translateInOutNum,
|
.translateFunc = translateMinMax,
|
||||||
.dataRequiredFunc = statisDataRequired,
|
.dataRequiredFunc = statisDataRequired,
|
||||||
.getEnvFunc = getMinmaxFuncEnv,
|
.getEnvFunc = getMinmaxFuncEnv,
|
||||||
.initFunc = minmaxFunctionSetup,
|
.initFunc = minmaxFunctionSetup,
|
||||||
|
@ -4729,6 +4787,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
||||||
.sprocessFunc = weekofyearFunction,
|
.sprocessFunc = weekofyearFunction,
|
||||||
.finalizeFunc = NULL
|
.finalizeFunc = NULL
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "rand",
|
||||||
|
.type = FUNCTION_TYPE_RAND,
|
||||||
|
.classification = FUNC_MGT_SCALAR_FUNC,
|
||||||
|
.translateFunc = translateRand,
|
||||||
|
.getEnvFunc = NULL,
|
||||||
|
.initFunc = NULL,
|
||||||
|
.sprocessFunc = randFunction,
|
||||||
|
.finalizeFunc = NULL
|
||||||
|
},
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
|
|
@ -1026,6 +1026,7 @@ int32_t minmaxFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultIn
|
||||||
|
|
||||||
buf->nullTupleSaved = false;
|
buf->nullTupleSaved = false;
|
||||||
buf->nullTuplePos.pageId = -1;
|
buf->nullTuplePos.pageId = -1;
|
||||||
|
buf->str = NULL;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1101,11 +1102,21 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
colDataSetFloat(pCol, currentRow, &v);
|
colDataSetFloat(pCol, currentRow, &v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TSDB_DATA_TYPE_VARBINARY:
|
||||||
|
case TSDB_DATA_TYPE_VARCHAR:
|
||||||
|
case TSDB_DATA_TYPE_NCHAR: {
|
||||||
|
code = colDataSetVal(pCol, currentRow, pRes->str, false);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
colDataSetNULL(pCol, currentRow);
|
colDataSetNULL(pCol, currentRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosMemoryFreeClear(pRes->str);
|
||||||
if (pCtx->subsidiaries.num > 0) {
|
if (pCtx->subsidiaries.num > 0) {
|
||||||
if (pEntryInfo->numOfRes > 0) {
|
if (pEntryInfo->numOfRes > 0) {
|
||||||
code = setSelectivityValue(pCtx, pBlock, &pRes->tuplePos, currentRow);
|
code = setSelectivityValue(pCtx, pBlock, &pRes->tuplePos, currentRow);
|
||||||
|
@ -2155,6 +2166,8 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
tMemBucketDestroy(pMemBucket);
|
tMemBucketDestroy(pMemBucket);
|
||||||
return functionFinalize(pCtx, pBlock);
|
return functionFinalize(pCtx, pBlock);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return functionFinalize(pCtx, pBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
_fin_error:
|
_fin_error:
|
||||||
|
@ -3163,7 +3176,7 @@ static int32_t doSaveLastrow(SqlFunctionCtx* pCtx, char* pData, int32_t rowIndex
|
||||||
(void)memcpy(pInfo->buf, pData, pInfo->bytes);
|
(void)memcpy(pInfo->buf, pData, pInfo->bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCtx->hasPrimaryKey) {
|
if (pCtx->hasPrimaryKey && !colDataIsNull_s(pkCol, rowIndex)) {
|
||||||
char* pkData = colDataGetData(pkCol, rowIndex);
|
char* pkData = colDataGetData(pkCol, rowIndex);
|
||||||
if (IS_VAR_DATA_TYPE(pInfo->pkType)) {
|
if (IS_VAR_DATA_TYPE(pInfo->pkType)) {
|
||||||
pInfo->pkBytes = varDataTLen(pkData);
|
pInfo->pkBytes = varDataTLen(pkData);
|
||||||
|
@ -6437,63 +6450,74 @@ int32_t blockDistFunction(SqlFunctionCtx* pCtx) {
|
||||||
|
|
||||||
int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDistInfo* pInfo) {
|
int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDistInfo* pInfo) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
if (tEncodeU32(&encoder, pInfo->rowSize) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->rowSize));
|
||||||
|
|
||||||
if (tEncodeU16(&encoder, pInfo->numOfFiles) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU16(&encoder, pInfo->numOfFiles));
|
||||||
if (tEncodeU32(&encoder, pInfo->numOfBlocks) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfBlocks));
|
||||||
if (tEncodeU32(&encoder, pInfo->numOfTables) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfTables));
|
||||||
|
|
||||||
if (tEncodeU64(&encoder, pInfo->totalSize) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU64(&encoder, pInfo->totalSize));
|
||||||
if (tEncodeU64(&encoder, pInfo->totalRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU64(&encoder, pInfo->totalRows));
|
||||||
if (tEncodeI32(&encoder, pInfo->maxRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->maxRows));
|
||||||
if (tEncodeI32(&encoder, pInfo->minRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->minRows));
|
||||||
if (tEncodeI32(&encoder, pInfo->defMaxRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->defMaxRows));
|
||||||
if (tEncodeI32(&encoder, pInfo->defMinRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->defMinRows));
|
||||||
if (tEncodeU32(&encoder, pInfo->numOfInmemRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfInmemRows));
|
||||||
if (tEncodeU32(&encoder, pInfo->numOfSttRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfSttRows));
|
||||||
if (tEncodeU32(&encoder, pInfo->numOfVgroups) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfVgroups));
|
||||||
|
|
||||||
for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) {
|
for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) {
|
||||||
if (tEncodeI32(&encoder, pInfo->blockRowsHisto[i]) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->blockRowsHisto[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo* pInfo) {
|
int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo* pInfo) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
if (tDecodeU32(&decoder, &pInfo->rowSize) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->rowSize));
|
||||||
|
|
||||||
if (tDecodeU16(&decoder, &pInfo->numOfFiles) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU16(&decoder, &pInfo->numOfFiles));
|
||||||
if (tDecodeU32(&decoder, &pInfo->numOfBlocks) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfBlocks));
|
||||||
if (tDecodeU32(&decoder, &pInfo->numOfTables) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfTables));
|
||||||
|
|
||||||
if (tDecodeU64(&decoder, &pInfo->totalSize) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pInfo->totalSize));
|
||||||
if (tDecodeU64(&decoder, &pInfo->totalRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pInfo->totalRows));
|
||||||
if (tDecodeI32(&decoder, &pInfo->maxRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->maxRows));
|
||||||
if (tDecodeI32(&decoder, &pInfo->minRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->minRows));
|
||||||
if (tDecodeI32(&decoder, &pInfo->defMaxRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->defMaxRows));
|
||||||
if (tDecodeI32(&decoder, &pInfo->defMinRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->defMinRows));
|
||||||
if (tDecodeU32(&decoder, &pInfo->numOfInmemRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfInmemRows));
|
||||||
if (tDecodeU32(&decoder, &pInfo->numOfSttRows) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfSttRows));
|
||||||
if (tDecodeU32(&decoder, &pInfo->numOfVgroups) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfVgroups));
|
||||||
|
|
||||||
for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) {
|
for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) {
|
||||||
if (tDecodeI32(&decoder, &pInfo->blockRowsHisto[i]) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->blockRowsHisto[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "builtinsimpl.h"
|
#include "builtinsimpl.h"
|
||||||
#include "function.h"
|
#include "function.h"
|
||||||
|
#include "tcompare.h"
|
||||||
#include "tdatablock.h"
|
#include "tdatablock.h"
|
||||||
#include "tfunctionInt.h"
|
#include "tfunctionInt.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
|
@ -365,10 +366,10 @@ static double doubleVectorCmpAVX(const double* pData, int32_t numOfRows, bool is
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t findFirstValPosition(const SColumnInfoData* pCol, int32_t start, int32_t numOfRows) {
|
static int32_t findFirstValPosition(const SColumnInfoData* pCol, int32_t start, int32_t numOfRows, bool isStr) {
|
||||||
int32_t i = start;
|
int32_t i = start;
|
||||||
|
|
||||||
while (i < (start + numOfRows) && (colDataIsNull_f(pCol->nullbitmap, i) == true)) {
|
while (i < (start + numOfRows) && (isStr ? colDataIsNull_s(pCol, i) : colDataIsNull_f(pCol->nullbitmap, i) == true)) {
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,6 +644,52 @@ static int32_t doExtractVal(SColumnInfoData* pCol, int32_t i, int32_t end, SqlFu
|
||||||
__COMPARE_ACQUIRED_MIN(i, end, pCol->nullbitmap, pData, pCtx, *(double*)&(pBuf->v), &pBuf->tuplePos)
|
__COMPARE_ACQUIRED_MIN(i, end, pCol->nullbitmap, pData, pCtx, *(double*)&(pBuf->v), &pBuf->tuplePos)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TSDB_DATA_TYPE_VARCHAR:
|
||||||
|
case TSDB_DATA_TYPE_VARBINARY: {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
for (; i < (end); ++i) {
|
||||||
|
if (colDataIsNull_var(pCol, i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
char *pLeft = (char *)colDataGetData(pCol, i);
|
||||||
|
char *pRight = (char *)pBuf->str;
|
||||||
|
|
||||||
|
int32_t ret = compareLenBinaryVal(pLeft, pRight);
|
||||||
|
if (ret < 0) {
|
||||||
|
memcpy(pBuf->str, pLeft, varDataTLen(pLeft));
|
||||||
|
if (pCtx->subsidiaries.num > 0) {
|
||||||
|
code = updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSDB_DATA_TYPE_NCHAR: {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
for (; i < (end); ++i) {
|
||||||
|
if (colDataIsNull_var(pCol, i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
char *pLeft = (char *)colDataGetData(pCol, i);
|
||||||
|
char *pRight = (char *)pBuf->str;
|
||||||
|
|
||||||
|
int32_t ret = compareLenPrefixedWStr(pLeft, pRight);
|
||||||
|
if (ret < 0) {
|
||||||
|
memcpy(pBuf->str, pLeft, varDataTLen(pLeft));
|
||||||
|
if (pCtx->subsidiaries.num > 0) {
|
||||||
|
code = updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (pCol->info.type) {
|
switch (pCol->info.type) {
|
||||||
|
@ -706,6 +753,53 @@ static int32_t doExtractVal(SColumnInfoData* pCol, int32_t i, int32_t end, SqlFu
|
||||||
__COMPARE_ACQUIRED_MAX(i, end, pCol->nullbitmap, pData, pCtx, *(double*)&(pBuf->v), &pBuf->tuplePos)
|
__COMPARE_ACQUIRED_MAX(i, end, pCol->nullbitmap, pData, pCtx, *(double*)&(pBuf->v), &pBuf->tuplePos)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TSDB_DATA_TYPE_VARCHAR:
|
||||||
|
case TSDB_DATA_TYPE_VARBINARY: {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
for (; i < (end); ++i) {
|
||||||
|
if (colDataIsNull_var(pCol, i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
char *pLeft = (char *)colDataGetData(pCol, i);
|
||||||
|
char *pRight = (char *)pBuf->str;
|
||||||
|
|
||||||
|
int32_t ret = compareLenBinaryVal(pLeft, pRight);
|
||||||
|
if (ret > 0) {
|
||||||
|
memcpy(pBuf->str, pLeft, varDataTLen(pLeft));
|
||||||
|
if (pCtx->subsidiaries.num > 0) {
|
||||||
|
code = updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TSDB_DATA_TYPE_NCHAR: {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
for (; i < (end); ++i) {
|
||||||
|
if (colDataIsNull_var(pCol, i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
char *pLeft = (char *)colDataGetData(pCol, i);
|
||||||
|
char *pRight = (char *)pBuf->str;
|
||||||
|
|
||||||
|
int32_t ret = compareLenPrefixedWStr(pLeft, pRight);
|
||||||
|
if (ret > 0) {
|
||||||
|
memcpy(pBuf->str, pLeft, varDataTLen(pLeft));
|
||||||
|
if (pCtx->subsidiaries.num > 0) {
|
||||||
|
code = updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -743,7 +837,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
|
||||||
}
|
}
|
||||||
|
|
||||||
// data in current data block are qualified to the query
|
// data in current data block are qualified to the query
|
||||||
if (pInput->colDataSMAIsSet) {
|
if (pInput->colDataSMAIsSet && !IS_STR_DATA_TYPE(type)) {
|
||||||
|
|
||||||
numOfElems = pInput->numOfRows - pAgg->numOfNull;
|
numOfElems = pInput->numOfRows - pAgg->numOfNull;
|
||||||
if (numOfElems == 0) {
|
if (numOfElems == 0) {
|
||||||
|
@ -820,7 +914,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
if (pCol->hasNull || numOfRows < threshold[pCol->info.type] || pCtx->subsidiaries.num > 0) {
|
if (pCol->hasNull || numOfRows < threshold[pCol->info.type] || pCtx->subsidiaries.num > 0) {
|
||||||
int32_t i = findFirstValPosition(pCol, start, numOfRows);
|
int32_t i = findFirstValPosition(pCol, start, numOfRows, IS_STR_DATA_TYPE(type));
|
||||||
|
|
||||||
if ((i < end) && (!pBuf->assign)) {
|
if ((i < end) && (!pBuf->assign)) {
|
||||||
char* p = pCol->pData + pCol->info.bytes * i;
|
char* p = pCol->pData + pCol->info.bytes * i;
|
||||||
|
@ -848,6 +942,16 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
|
||||||
*(float*)&pBuf->v = *(float*)p;
|
*(float*)&pBuf->v = *(float*)p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TSDB_DATA_TYPE_VARCHAR:
|
||||||
|
case TSDB_DATA_TYPE_VARBINARY:
|
||||||
|
case TSDB_DATA_TYPE_NCHAR: {
|
||||||
|
pBuf->str = taosMemoryMalloc(pCol->info.bytes);
|
||||||
|
if (pBuf->str == NULL) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
(void)memcpy(pBuf->str, colDataGetData(pCol, i), varDataTLen(colDataGetData(pCol, i)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
(void)memcpy(&pBuf->v, p, pCol->info.bytes);
|
(void)memcpy(&pBuf->v, p, pCol->info.bytes);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -45,6 +45,7 @@ typedef struct STranslateContext {
|
||||||
bool showRewrite;
|
bool showRewrite;
|
||||||
SNode* pPrevRoot;
|
SNode* pPrevRoot;
|
||||||
SNode* pPostRoot;
|
SNode* pPostRoot;
|
||||||
|
bool dual; // whether select stmt without from stmt, true for without.
|
||||||
} STranslateContext;
|
} STranslateContext;
|
||||||
|
|
||||||
int32_t biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRet);
|
int32_t biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRet);
|
||||||
|
|
|
@ -1208,11 +1208,15 @@ function_expression(A) ::=
|
||||||
substr_func(B) NK_LP expr_or_subquery(C) FROM expr_or_subquery(D) FOR expr_or_subquery(E) NK_RP(F). { A = createRawExprNodeExt(pCxt, &B, &F, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), releaseRawExprNode(pCxt, E))); }
|
substr_func(B) NK_LP expr_or_subquery(C) FROM expr_or_subquery(D) FOR expr_or_subquery(E) NK_RP(F). { A = createRawExprNodeExt(pCxt, &B, &F, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), releaseRawExprNode(pCxt, E))); }
|
||||||
function_expression(A) ::= REPLACE(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
|
function_expression(A) ::= REPLACE(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
|
||||||
function_expression(A) ::= literal_func(B). { A = B; }
|
function_expression(A) ::= literal_func(B). { A = B; }
|
||||||
|
function_expression(A) ::= rand_func(B). { A = B; }
|
||||||
|
|
||||||
literal_func(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
|
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) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
|
||||||
literal_func(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
|
literal_func(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
|
||||||
|
|
||||||
|
rand_func(A) ::= RAND(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
|
||||||
|
rand_func(A) ::= RAND(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
|
||||||
|
|
||||||
%type substr_func { SToken }
|
%type substr_func { SToken }
|
||||||
%destructor substr_func { }
|
%destructor substr_func { }
|
||||||
substr_func(A) ::= SUBSTR(B). { A = B; }
|
substr_func(A) ::= SUBSTR(B). { A = B; }
|
||||||
|
|
|
@ -206,6 +206,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"QUERIES", TK_QUERIES},
|
{"QUERIES", TK_QUERIES},
|
||||||
{"QUERY", TK_QUERY},
|
{"QUERY", TK_QUERY},
|
||||||
{"PI", TK_PI},
|
{"PI", TK_PI},
|
||||||
|
{"RAND", TK_RAND},
|
||||||
{"RANGE", TK_RANGE},
|
{"RANGE", TK_RANGE},
|
||||||
{"RATIO", TK_RATIO},
|
{"RATIO", TK_RATIO},
|
||||||
{"PAUSE", TK_PAUSE},
|
{"PAUSE", TK_PAUSE},
|
||||||
|
|
|
@ -2307,6 +2307,7 @@ static bool hasInvalidFuncNesting(SNodeList* pParameterList) {
|
||||||
|
|
||||||
static int32_t getFuncInfo(STranslateContext* pCxt, SFunctionNode* pFunc) {
|
static int32_t getFuncInfo(STranslateContext* pCxt, SFunctionNode* pFunc) {
|
||||||
// the time precision of the function execution environment
|
// the time precision of the function execution environment
|
||||||
|
pFunc->dual = pCxt->dual;
|
||||||
pFunc->node.resType.precision = getPrecisionFromCurrStmt(pCxt->pCurrStmt, TSDB_TIME_PRECISION_MILLI);
|
pFunc->node.resType.precision = getPrecisionFromCurrStmt(pCxt->pCurrStmt, TSDB_TIME_PRECISION_MILLI);
|
||||||
int32_t code = fmGetFuncInfo(pFunc, pCxt->msgBuf.buf, pCxt->msgBuf.len);
|
int32_t code = fmGetFuncInfo(pFunc, pCxt->msgBuf.buf, pCxt->msgBuf.len);
|
||||||
if (TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION == code) {
|
if (TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION == code) {
|
||||||
|
@ -6708,11 +6709,13 @@ static int32_t replaceOrderByAliasForSelect(STranslateContext* pCxt, SSelectStmt
|
||||||
static int32_t translateSelectWithoutFrom(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
static int32_t translateSelectWithoutFrom(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
pCxt->pCurrStmt = (SNode*)pSelect;
|
pCxt->pCurrStmt = (SNode*)pSelect;
|
||||||
pCxt->currClause = SQL_CLAUSE_SELECT;
|
pCxt->currClause = SQL_CLAUSE_SELECT;
|
||||||
|
pCxt->dual = true;
|
||||||
return translateExprList(pCxt, pSelect->pProjectionList);
|
return translateExprList(pCxt, pSelect->pProjectionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
pCxt->pCurrStmt = (SNode*)pSelect;
|
pCxt->pCurrStmt = (SNode*)pSelect;
|
||||||
|
pCxt->dual = false;
|
||||||
int32_t code = translateFrom(pCxt, &pSelect->pFromTable);
|
int32_t code = translateFrom(pCxt, &pSelect->pFromTable);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pSelect->precision = ((STableNode*)pSelect->pFromTable)->precision;
|
pSelect->precision = ((STableNode*)pSelect->pFromTable)->precision;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -294,6 +294,9 @@ static bool scanPathOptIsSpecifiedFuncType(const SFunctionNode* pFunc, bool (*ty
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isMinMaxFunction(int32_t funcType) {
|
||||||
|
return funcType == FUNCTION_TYPE_MIN || funcType == FUNCTION_TYPE_MAX;
|
||||||
|
}
|
||||||
static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSdrFuncs, SNodeList** pDsoFuncs) {
|
static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSdrFuncs, SNodeList** pDsoFuncs) {
|
||||||
SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent);
|
SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent);
|
||||||
SNodeList* pTmpSdrFuncs = NULL;
|
SNodeList* pTmpSdrFuncs = NULL;
|
||||||
|
@ -303,7 +306,8 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd
|
||||||
FOREACH(pNode, pAllFuncs) {
|
FOREACH(pNode, pAllFuncs) {
|
||||||
SFunctionNode* pFunc = (SFunctionNode*)pNode;
|
SFunctionNode* pFunc = (SFunctionNode*)pNode;
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (scanPathOptIsSpecifiedFuncType(pFunc, fmIsSpecialDataRequiredFunc)) {
|
if ((!isMinMaxFunction(pFunc->funcType) && scanPathOptIsSpecifiedFuncType(pFunc, fmIsSpecialDataRequiredFunc)) ||
|
||||||
|
(isMinMaxFunction(pFunc->funcType) && pFunc->hasSMA)) {
|
||||||
SNode* pNew = NULL;
|
SNode* pNew = NULL;
|
||||||
code = nodesCloneNode(pNode, &pNew);
|
code = nodesCloneNode(pNode, &pNew);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ typedef struct SOperatorValueType {
|
||||||
|
|
||||||
typedef struct SScalarCtx {
|
typedef struct SScalarCtx {
|
||||||
int32_t code;
|
int32_t code;
|
||||||
bool dual;
|
bool dual; /* whether select stmt has from stmt */
|
||||||
SArray* pBlockList; /* element is SSDataBlock* */
|
SArray* pBlockList; /* element is SSDataBlock* */
|
||||||
SHashObj* pRes; /* element is SScalarParam */
|
SHashObj* pRes; /* element is SScalarParam */
|
||||||
void* param; // additional parameter (meta actually) for acquire value such as tbname/tags values
|
void* param; // additional parameter (meta actually) for acquire value such as tbname/tags values
|
||||||
|
|
|
@ -1179,7 +1179,8 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) {
|
||||||
EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) {
|
EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) {
|
||||||
SFunctionNode *node = (SFunctionNode *)*pNode;
|
SFunctionNode *node = (SFunctionNode *)*pNode;
|
||||||
SNode *tnode = NULL;
|
SNode *tnode = NULL;
|
||||||
if ((!fmIsScalarFunc(node->funcId) && (!ctx->dual)) || fmIsUserDefinedFunc(node->funcId)) {
|
if ((!fmIsScalarFunc(node->funcId) && (!ctx->dual)) ||
|
||||||
|
fmIsUserDefinedFunc(node->funcId)) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2887,6 +2887,21 @@ int32_t floorFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOut
|
||||||
return doScalarFunction(pInput, inputNum, pOutput, floorf, floor);
|
return doScalarFunction(pInput, inputNum, pOutput, floorf, floor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t randFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
|
||||||
|
if (!IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[0]))) {
|
||||||
|
int32_t seed;
|
||||||
|
GET_TYPED_DATA(seed, int32_t, GET_PARAM_TYPE(&pInput[0]), pInput[0].columnData->pData);
|
||||||
|
taosSeedRand(seed);
|
||||||
|
}
|
||||||
|
int32_t numOfRows = inputNum == 1 ? pInput[0].numOfRows : TMAX(pInput[0].numOfRows, pInput[1].numOfRows);
|
||||||
|
for (int32_t i = 0; i < numOfRows; ++i) {
|
||||||
|
double random_value = (double)(taosRand() % RAND_MAX) / RAND_MAX;
|
||||||
|
colDataSetDouble(pOutput->columnData, i, &random_value);
|
||||||
|
}
|
||||||
|
pOutput->numOfRows = numOfRows;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static double decimalFn(double val1, double val2, _double_fn fn) {
|
static double decimalFn(double val1, double val2, _double_fn fn) {
|
||||||
if (val1 > DBL_MAX || val1 < -DBL_MAX) {
|
if (val1 > DBL_MAX || val1 < -DBL_MAX) {
|
||||||
return val1;
|
return val1;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,6 +28,28 @@ from frame import *
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase(TBase):
|
class TDTestCase(TBase):
|
||||||
|
def alterCachemodel(self):
|
||||||
|
"""Add test case for altering cache model(TS-5390)
|
||||||
|
"""
|
||||||
|
# drop database if exists
|
||||||
|
tdSql.execute(f"drop database if exists db3590;")
|
||||||
|
# create database with cachemodel 'none'
|
||||||
|
tdSql.execute(f"create database db3590 vgroups 1 replica 1 cachemodel 'none';")
|
||||||
|
tdSql.execute("use db3590;")
|
||||||
|
tdSql.execute("create table ntb1 (ts timestamp, ival1 int);")
|
||||||
|
tdSql.execute("insert into ntb1 values(now, 1);")
|
||||||
|
tdSql.execute("flush database db3590;")
|
||||||
|
# alter table schema
|
||||||
|
tdSql.execute("alter table ntb1 add column ival2 int;")
|
||||||
|
tdSql.execute("insert into ntb1 values(now, 2, NULL);")
|
||||||
|
# alter table schema again
|
||||||
|
tdSql.execute("alter table ntb1 add column ival3 int;")
|
||||||
|
# alter database with cachemodel 'both‘
|
||||||
|
tdSql.execute("alter database db3590 cachemodel 'both';")
|
||||||
|
# wait for cachemodel avaiable
|
||||||
|
time.sleep(5)
|
||||||
|
tdSql.query("select last(*) from ntb1;")
|
||||||
|
|
||||||
def alterTtlConfig(self):
|
def alterTtlConfig(self):
|
||||||
"""Add test case for altering ttl config
|
"""Add test case for altering ttl config
|
||||||
"""
|
"""
|
||||||
|
@ -86,6 +108,8 @@ class TDTestCase(TBase):
|
||||||
self.alterSupportVnodes()
|
self.alterSupportVnodes()
|
||||||
# TS-5191
|
# TS-5191
|
||||||
self.alterTtlConfig()
|
self.alterTtlConfig()
|
||||||
|
# TS-5390
|
||||||
|
self.alterCachemodel()
|
||||||
|
|
||||||
tdLog.success(f"{__file__} successfully executed")
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,480 @@
|
||||||
|
9999
|
||||||
|
11.9989996
|
||||||
|
224
|
||||||
|
x
|
||||||
|
一二三四五六七八九十
|
||||||
|
四
|
||||||
|
一二三四五六七八九十
|
||||||
|
四
|
||||||
|
1110
|
||||||
|
2838
|
||||||
|
4566
|
||||||
|
6294
|
||||||
|
8022
|
||||||
|
9750
|
||||||
|
9999
|
||||||
|
3206
|
||||||
|
4934
|
||||||
|
6662
|
||||||
|
8390
|
||||||
|
9999
|
||||||
|
1846
|
||||||
|
3574
|
||||||
|
5302
|
||||||
|
7030
|
||||||
|
8758
|
||||||
|
9999
|
||||||
|
2214
|
||||||
|
3942
|
||||||
|
5670
|
||||||
|
7398
|
||||||
|
9126
|
||||||
|
9999
|
||||||
|
2582
|
||||||
|
4310
|
||||||
|
6038
|
||||||
|
7766
|
||||||
|
9494
|
||||||
|
9999
|
||||||
|
2950
|
||||||
|
4678
|
||||||
|
6406
|
||||||
|
8134
|
||||||
|
9862
|
||||||
|
9999
|
||||||
|
3318
|
||||||
|
5046
|
||||||
|
6774
|
||||||
|
8502
|
||||||
|
9999
|
||||||
|
1958
|
||||||
|
3686
|
||||||
|
5414
|
||||||
|
7142
|
||||||
|
8870
|
||||||
|
9999
|
||||||
|
2326
|
||||||
|
4054
|
||||||
|
5782
|
||||||
|
7510
|
||||||
|
9238
|
||||||
|
9999
|
||||||
|
2694
|
||||||
|
4422
|
||||||
|
6150
|
||||||
|
7878
|
||||||
|
9606
|
||||||
|
9999
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9980001
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9980001
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9980001
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9980001
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9980001
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9980001
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9969997
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9989996
|
||||||
|
11.9860001
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
224
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
x
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
一二三四五六七八九十
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
||||||
|
四
|
|
|
@ -0,0 +1,480 @@
|
||||||
|
0
|
||||||
|
8.0000000
|
||||||
|
215
|
||||||
|
haha
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
a
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
a
|
||||||
|
0
|
||||||
|
1111
|
||||||
|
2839
|
||||||
|
4567
|
||||||
|
6295
|
||||||
|
8023
|
||||||
|
0
|
||||||
|
1479
|
||||||
|
3207
|
||||||
|
4935
|
||||||
|
6663
|
||||||
|
0
|
||||||
|
119
|
||||||
|
1847
|
||||||
|
3575
|
||||||
|
5303
|
||||||
|
7031
|
||||||
|
0
|
||||||
|
487
|
||||||
|
2215
|
||||||
|
3943
|
||||||
|
5671
|
||||||
|
7399
|
||||||
|
0
|
||||||
|
855
|
||||||
|
2583
|
||||||
|
4311
|
||||||
|
6039
|
||||||
|
7767
|
||||||
|
0
|
||||||
|
1223
|
||||||
|
2951
|
||||||
|
4679
|
||||||
|
6407
|
||||||
|
8135
|
||||||
|
0
|
||||||
|
1591
|
||||||
|
3319
|
||||||
|
5047
|
||||||
|
6775
|
||||||
|
0
|
||||||
|
231
|
||||||
|
1959
|
||||||
|
3687
|
||||||
|
5415
|
||||||
|
7143
|
||||||
|
0
|
||||||
|
599
|
||||||
|
2327
|
||||||
|
4055
|
||||||
|
5783
|
||||||
|
7511
|
||||||
|
0
|
||||||
|
967
|
||||||
|
2695
|
||||||
|
4423
|
||||||
|
6151
|
||||||
|
7879
|
||||||
|
9607
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0010004
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0030003
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0030003
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0010004
|
||||||
|
8.0089998
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0030003
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0000000
|
||||||
|
8.0019999
|
||||||
|
8.0010004
|
||||||
|
8.0000000
|
||||||
|
8.0050001
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
215
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
haha
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
abc一二三abc一二三abc
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
||||||
|
a
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
select MAX(id) from ts_4893.meters;
|
||||||
|
select MAX(current) from ts_4893.meters;
|
||||||
|
select MAX(voltage) from ts_4893.meters;
|
||||||
|
select MAX(name) from ts_4893.meters;
|
||||||
|
select MAX(nch1) from ts_4893.meters;
|
||||||
|
select MAX(nch2) from ts_4893.meters;
|
||||||
|
select MAX(var1) from ts_4893.meters;
|
||||||
|
select MAX(var2) from ts_4893.meters;
|
||||||
|
select MAX(id) from ts_4893.meters interval(60d);
|
||||||
|
select MAX(current) from ts_4893.meters interval(60d);
|
||||||
|
select MAX(voltage) from ts_4893.meters interval(60d);
|
||||||
|
select MAX(name) from ts_4893.meters interval(60d);
|
||||||
|
select MAX(nch1) from ts_4893.meters interval(60d);
|
||||||
|
select MAX(nch2) from ts_4893.meters interval(60d);
|
||||||
|
select MAX(var1) from ts_4893.meters interval(60d);
|
||||||
|
select MAX(var2) from ts_4893.meters interval(60d);
|
|
@ -0,0 +1,16 @@
|
||||||
|
select MIN(id) from ts_4893.meters;
|
||||||
|
select MIN(current) from ts_4893.meters;
|
||||||
|
select MIN(voltage) from ts_4893.meters;
|
||||||
|
select MIN(name) from ts_4893.meters;
|
||||||
|
select MIN(nch1) from ts_4893.meters;
|
||||||
|
select MIN(nch2) from ts_4893.meters;
|
||||||
|
select MIN(var1) from ts_4893.meters;
|
||||||
|
select MIN(var2) from ts_4893.meters;
|
||||||
|
select MIN(id) from ts_4893.meters interval(60d);
|
||||||
|
select MIN(current) from ts_4893.meters interval(60d);
|
||||||
|
select MIN(voltage) from ts_4893.meters interval(60d);
|
||||||
|
select MIN(name) from ts_4893.meters interval(60d);
|
||||||
|
select MIN(nch1) from ts_4893.meters interval(60d);
|
||||||
|
select MIN(nch2) from ts_4893.meters interval(60d);
|
||||||
|
select MIN(var1) from ts_4893.meters interval(60d);
|
||||||
|
select MIN(var2) from ts_4893.meters interval(60d);
|
|
@ -505,12 +505,35 @@ class TDTestCase(TBase):
|
||||||
tdSql.query("select var_pop(null) from ts_4893.meters;")
|
tdSql.query("select var_pop(null) from ts_4893.meters;")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, None)
|
tdSql.checkData(0, 0, None)
|
||||||
|
|
||||||
def test_error(self):
|
def test_error(self):
|
||||||
tdSql.error(
|
tdSql.error(
|
||||||
"select * from (select to_iso8601(ts, timezone()), timezone() from meters order by ts desc) limit 1000;",
|
"select * from (select to_iso8601(ts, timezone()), timezone() from meters order by ts desc) limit 1000;",
|
||||||
expectErrInfo="Not supported timzone format") # TS-5340
|
expectErrInfo="Not supported timzone format") # TS-5340
|
||||||
|
def test_min(self):
|
||||||
|
self.test_normal_query("min")
|
||||||
|
|
||||||
|
tdSql.query("select min(var1), min(id) from ts_4893.d0;")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 'abc一二三abc一二三abc')
|
||||||
|
tdSql.checkData(0, 1, 0)
|
||||||
|
def test_max(self):
|
||||||
|
self.test_normal_query("max")
|
||||||
|
tdSql.query("select max(var1), max(id) from ts_4893.d0;")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, '一二三四五六七八九十')
|
||||||
|
tdSql.checkData(0, 1, 9999)
|
||||||
|
def test_rand(self):
|
||||||
|
tdSql.query("select rand();")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
|
tdSql.query("select rand(1);")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
|
tdSql.query("select rand(1) from ts_4893.meters limit 10;")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
|
||||||
|
tdSql.query("select rand(id) from ts_4893.d0 limit 10;")
|
||||||
|
tdSql.checkRows(10)
|
||||||
# run
|
# run
|
||||||
def run(self):
|
def run(self):
|
||||||
tdLog.debug(f"start to excute {__file__}")
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
@ -528,6 +551,7 @@ class TDTestCase(TBase):
|
||||||
self.test_sign()
|
self.test_sign()
|
||||||
self.test_degrees()
|
self.test_degrees()
|
||||||
self.test_radians()
|
self.test_radians()
|
||||||
|
self.test_rand()
|
||||||
|
|
||||||
# char function
|
# char function
|
||||||
self.test_char_length()
|
self.test_char_length()
|
||||||
|
@ -551,6 +575,10 @@ class TDTestCase(TBase):
|
||||||
self.test_stddev()
|
self.test_stddev()
|
||||||
self.test_varpop()
|
self.test_varpop()
|
||||||
|
|
||||||
|
# select function
|
||||||
|
self.test_min()
|
||||||
|
self.test_max()
|
||||||
|
|
||||||
# error function
|
# error function
|
||||||
self.test_error()
|
self.test_error()
|
||||||
|
|
||||||
|
|
|
@ -226,8 +226,6 @@ if $data10 != 5 then
|
||||||
endi
|
endi
|
||||||
sql_error select avg(tbcol) from $mt where tbcol1 = 1 group by tgcol
|
sql_error select avg(tbcol) from $mt where tbcol1 = 1 group by tgcol
|
||||||
sql_error select sum(tbcol) from $mt where tbcol1 = 1 group by tgcol
|
sql_error select sum(tbcol) from $mt where tbcol1 = 1 group by tgcol
|
||||||
sql_error select min(tbcol) from $mt where tbcol1 = 1 group by tgcol
|
|
||||||
sql_error select max(tbcol) from $mt where tbcol1 = 1 group by tgcol
|
|
||||||
|
|
||||||
sql select first(tbcol), tgcol from $mt where tbcol1 = 1 group by tgcol order by tgcol
|
sql select first(tbcol), tgcol from $mt where tbcol1 = 1 group by tgcol order by tgcol
|
||||||
if $rows != 2 then
|
if $rows != 2 then
|
||||||
|
|
|
@ -35,16 +35,12 @@ sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) in
|
||||||
sql create sma index sma_index_name2 on stb function(sum(c1),first(c1), last(c1), first(c4),last(c4),count(c4),first(c5),last(c5),count(c5),apercentile(c1,80,"t-digest"), avg(c2),count(c3), spread(c3), stddev(c2), hyperloglog(c2), hyperloglog(c4), hyperloglog(c5)) interval(5m,10s) sliding(5m);
|
sql create sma index sma_index_name2 on stb function(sum(c1),first(c1), last(c1), first(c4),last(c4),count(c4),first(c5),last(c5),count(c5),apercentile(c1,80,"t-digest"), avg(c2),count(c3), spread(c3), stddev(c2), hyperloglog(c2), hyperloglog(c4), hyperloglog(c5)) interval(5m,10s) sliding(5m);
|
||||||
# for varchar/binary
|
# for varchar/binary
|
||||||
sql_error create sma index sma_index_name3 on stb function(sum(c4)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(sum(c4)) interval(5m,10s) sliding(5m);
|
||||||
sql_error create sma index sma_index_name3 on stb function(min(c4)) interval(5m,10s) sliding(5m);
|
|
||||||
sql_error create sma index sma_index_name3 on stb function(max(c4)) interval(5m,10s) sliding(5m);
|
|
||||||
sql_error create sma index sma_index_name3 on stb function(avg(c4)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(avg(c4)) interval(5m,10s) sliding(5m);
|
||||||
sql_error create sma index sma_index_name3 on stb function(apercentile(c4)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(apercentile(c4)) interval(5m,10s) sliding(5m);
|
||||||
sql_error create sma index sma_index_name3 on stb function(spread(c4)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(spread(c4)) interval(5m,10s) sliding(5m);
|
||||||
sql_error create sma index sma_index_name3 on stb function(stddev(c4)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(stddev(c4)) interval(5m,10s) sliding(5m);
|
||||||
# for nchar
|
# for nchar
|
||||||
sql_error create sma index sma_index_name3 on stb function(sum(c5)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(sum(c5)) interval(5m,10s) sliding(5m);
|
||||||
sql_error create sma index sma_index_name3 on stb function(min(c5)) interval(5m,10s) sliding(5m);
|
|
||||||
sql_error create sma index sma_index_name3 on stb function(max(c5)) interval(5m,10s) sliding(5m);
|
|
||||||
sql_error create sma index sma_index_name3 on stb function(avg(c5)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(avg(c5)) interval(5m,10s) sliding(5m);
|
||||||
sql_error create sma index sma_index_name3 on stb function(apercentile(c5)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(apercentile(c5)) interval(5m,10s) sliding(5m);
|
||||||
sql_error create sma index sma_index_name3 on stb function(spread(c5)) interval(5m,10s) sliding(5m);
|
sql_error create sma index sma_index_name3 on stb function(spread(c5)) interval(5m,10s) sliding(5m);
|
||||||
|
|
|
@ -41,8 +41,6 @@ class TDTestCase:
|
||||||
tdSql.error(f"select min(now()) from {dbname}.stb_1")
|
tdSql.error(f"select min(now()) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(ts) from {dbname}.stb_1")
|
tdSql.error(f"select min(ts) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(col7) from {dbname}.stb_1")
|
tdSql.error(f"select min(col7) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(col8) from {dbname}.stb_1")
|
|
||||||
tdSql.error(f"select min(col9) from {dbname}.stb_1")
|
|
||||||
tdSql.error(f"select min(a) from {dbname}.stb_1")
|
tdSql.error(f"select min(a) from {dbname}.stb_1")
|
||||||
tdSql.query(f"select min(1) from {dbname}.stb_1")
|
tdSql.query(f"select min(1) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.stb_1")
|
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.stb_1")
|
||||||
|
@ -69,13 +67,15 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, np.min(floatData))
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
tdSql.query(f"select min(col1) from {dbname}.stb_1 where col2>=5")
|
tdSql.query(f"select min(col1) from {dbname}.stb_1 where col2>=5")
|
||||||
tdSql.checkData(0,0,5)
|
tdSql.checkData(0,0,5)
|
||||||
|
tdSql.query(f"select min(col8) from {dbname}.stb_1")
|
||||||
|
tdSql.checkData(0,0,'taosdata1')
|
||||||
|
tdSql.query(f"select min(col9) from {dbname}.stb_1")
|
||||||
|
tdSql.checkData(0,0,'涛思数据1')
|
||||||
|
|
||||||
|
|
||||||
tdSql.error(f"select min(now()) from {dbname}.stb_1")
|
tdSql.error(f"select min(now()) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(ts) from {dbname}.stb_1")
|
tdSql.error(f"select min(ts) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(col7) from {dbname}.stb_1")
|
tdSql.error(f"select min(col7) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(col8) from {dbname}.stb_1")
|
|
||||||
tdSql.error(f"select min(col9) from {dbname}.stb_1")
|
|
||||||
tdSql.error(f"select min(a) from {dbname}.stb_1")
|
tdSql.error(f"select min(a) from {dbname}.stb_1")
|
||||||
tdSql.query(f"select min(1) from {dbname}.stb_1")
|
tdSql.query(f"select min(1) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.stb_1")
|
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.stb_1")
|
||||||
|
@ -102,12 +102,14 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, np.min(floatData))
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
tdSql.query(f"select min(col1) from {dbname}.stb where col2>=5")
|
tdSql.query(f"select min(col1) from {dbname}.stb where col2>=5")
|
||||||
tdSql.checkData(0,0,5)
|
tdSql.checkData(0,0,5)
|
||||||
|
tdSql.query(f"select min(col8) from {dbname}.stb")
|
||||||
|
tdSql.checkData(0,0,'taosdata1')
|
||||||
|
tdSql.query(f"select min(col9) from {dbname}.stb")
|
||||||
|
tdSql.checkData(0,0,'涛思数据1')
|
||||||
|
|
||||||
tdSql.error(f"select min(now()) from {dbname}.stb_1")
|
tdSql.error(f"select min(now()) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(ts) from {dbname}.stb_1")
|
tdSql.error(f"select min(ts) from {dbname}.stb_1")
|
||||||
tdSql.error(f"select min(col7) from {dbname}.ntb")
|
tdSql.error(f"select min(col7) from {dbname}.ntb")
|
||||||
tdSql.error(f"select min(col8) from {dbname}.ntb")
|
|
||||||
tdSql.error(f"select min(col9) from {dbname}.ntb")
|
|
||||||
tdSql.error(f"select min(a) from {dbname}.ntb")
|
tdSql.error(f"select min(a) from {dbname}.ntb")
|
||||||
tdSql.query(f"select min(1) from {dbname}.ntb")
|
tdSql.query(f"select min(1) from {dbname}.ntb")
|
||||||
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.ntb")
|
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.ntb")
|
||||||
|
@ -134,6 +136,10 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, np.min(floatData))
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
tdSql.query(f"select min(col1) from {dbname}.ntb where col2>=5")
|
tdSql.query(f"select min(col1) from {dbname}.ntb where col2>=5")
|
||||||
tdSql.checkData(0,0,5)
|
tdSql.checkData(0,0,5)
|
||||||
|
tdSql.query(f"select min(col8) from {dbname}.ntb")
|
||||||
|
tdSql.checkData(0,0,'taosdata1')
|
||||||
|
tdSql.query(f"select min(col9) from {dbname}.ntb")
|
||||||
|
tdSql.checkData(0,0,'涛思数据1')
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
|
|
@ -122,21 +122,27 @@ class TDTestCase:
|
||||||
tdSql.query(sql)
|
tdSql.query(sql)
|
||||||
tdSql.checkData(0,0,4)
|
tdSql.checkData(0,0,4)
|
||||||
sql = "select max(t1) from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t1) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'varchar4')
|
||||||
sql = "select max(t1),ts from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t1),ts from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'varchar4')
|
||||||
sql = "select max(t_bool) from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t_bool) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.error(sql)
|
||||||
sql = "select max(t_bool),ts from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t_bool),ts from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.error(sql)
|
||||||
sql = "select max(t_binary) from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t_binary) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'binary4')
|
||||||
sql = "select max(t_binary),ts from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t_binary),ts from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'binary4')
|
||||||
sql = "select max(t_nchar) from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t_nchar) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'nchar4')
|
||||||
sql = "select max(t_nchar),ts from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t_nchar),ts from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'nchar4')
|
||||||
sql = "select max(t_int) from %s.stb0 where ts<now;"%(database)
|
sql = "select max(t_int) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.query(sql)
|
tdSql.query(sql)
|
||||||
tdSql.checkData(0,0,4)
|
tdSql.checkData(0,0,4)
|
||||||
|
@ -220,21 +226,27 @@ class TDTestCase:
|
||||||
tdSql.query(sql)
|
tdSql.query(sql)
|
||||||
tdSql.checkData(0,0,0)
|
tdSql.checkData(0,0,0)
|
||||||
sql = "select min(t1) from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t1) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'varchar0')
|
||||||
sql = "select min(t1),ts from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t1),ts from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'varchar0')
|
||||||
sql = "select min(t_bool) from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t_bool) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.error(sql)
|
||||||
sql = "select min(t_bool),ts from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t_bool),ts from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.error(sql)
|
||||||
sql = "select min(t_binary) from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t_binary) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'binary0')
|
||||||
sql = "select min(t_binary),ts from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t_binary),ts from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'binary0')
|
||||||
sql = "select min(t_nchar) from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t_nchar) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'nchar0')
|
||||||
sql = "select min(t_nchar),ts from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t_nchar),ts from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.error(sql)
|
tdSql.query(sql)
|
||||||
|
tdSql.checkData(0,0,'nchar0')
|
||||||
sql = "select min(t_int) from %s.stb0 where ts<now;"%(database)
|
sql = "select min(t_int) from %s.stb0 where ts<now;"%(database)
|
||||||
tdSql.query(sql)
|
tdSql.query(sql)
|
||||||
tdSql.checkData(0,0,0)
|
tdSql.checkData(0,0,0)
|
||||||
|
|
Loading…
Reference in New Issue