stmt auto create table

This commit is contained in:
dapan1121 2022-05-11 19:02:39 +08:00
parent c0bd8a2f83
commit 327b5cdae9
5 changed files with 34 additions and 24 deletions

View File

@ -89,7 +89,7 @@ extern char *qtypeStr[];
#define TSDB_PORT_HTTP 11 #define TSDB_PORT_HTTP 11
#define TD_DEBUG_PRINT_ROW #undef TD_DEBUG_PRINT_ROW
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -260,7 +260,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) {
comparFn = 20; comparFn = 20;
} else if (optr == OP_TYPE_LIKE) { } else if (optr == OP_TYPE_LIKE) {
comparFn = 9; comparFn = 9;
} else if (optr == OP_TYPE_LIKE) { } else if (optr == OP_TYPE_NOT_LIKE) {
comparFn = 27; comparFn = 27;
} else if (optr == OP_TYPE_IN) { } else if (optr == OP_TYPE_IN) {
comparFn = 8; comparFn = 8;

View File

@ -92,8 +92,9 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
} }
if (IS_VAR_DATA_TYPE(type)) { if (IS_VAR_DATA_TYPE(type)) {
len = varDataLen(out.columnData->pData); char* data = colDataGetVarData(out.columnData, 0);
buf = varDataVal(out.columnData->pData); len = varDataLen(data);
buf = varDataVal(data);
} else { } else {
len = tDataTypes[type].bytes; len = tDataTypes[type].bytes;
buf = out.columnData->pData; buf = out.columnData->pData;
@ -109,7 +110,7 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
} }
if (taosHashPut(pObj, buf, (size_t)len, NULL, 0)) { if (taosHashPut(pObj, buf, (size_t)len, NULL, 0)) {
sclError("taosHashPut failed"); sclError("taosHashPut to set failed");
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
} }

View File

@ -512,7 +512,7 @@ int32_t vectorConvertToVarData(const SScalarParam* pIn, SScalarParam* pOut, int1
if (outType == TSDB_DATA_TYPE_NCHAR) { if (outType == TSDB_DATA_TYPE_NCHAR) {
varToNchar(tmp, pOut, i); varToNchar(tmp, pOut, i);
} else { } else {
colDataAppend(pOutputCol, i, (char *)&value, false); colDataAppend(pOutputCol, i, (char *)tmp, false);
} }
} }
} else if (IS_UNSIGNED_NUMERIC_TYPE(inType)) { } else if (IS_UNSIGNED_NUMERIC_TYPE(inType)) {
@ -529,7 +529,7 @@ int32_t vectorConvertToVarData(const SScalarParam* pIn, SScalarParam* pOut, int1
if (outType == TSDB_DATA_TYPE_NCHAR) { if (outType == TSDB_DATA_TYPE_NCHAR) {
varToNchar(tmp, pOut, i); varToNchar(tmp, pOut, i);
} else { } else {
colDataAppend(pOutputCol, i, (char *)&value, false); colDataAppend(pOutputCol, i, (char *)tmp, false);
} }
} }
} else if (IS_FLOAT_TYPE(inType)) { } else if (IS_FLOAT_TYPE(inType)) {
@ -546,7 +546,7 @@ int32_t vectorConvertToVarData(const SScalarParam* pIn, SScalarParam* pOut, int1
if (outType == TSDB_DATA_TYPE_NCHAR) { if (outType == TSDB_DATA_TYPE_NCHAR) {
varToNchar(tmp, pOut, i); varToNchar(tmp, pOut, i);
} else { } else {
colDataAppend(pOutputCol, i, (char *)&value, false); colDataAppend(pOutputCol, i, (char *)tmp, false);
} }
} }
} else { } else {

View File

@ -11,8 +11,8 @@
int32_t shortColList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_INT}; int32_t shortColList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_INT};
int32_t fullColList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_BOOL, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_UTINYINT, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_USMALLINT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_UINT, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_UBIGINT, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_BINARY, TSDB_DATA_TYPE_NCHAR}; int32_t fullColList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_BOOL, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_UTINYINT, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_USMALLINT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_UINT, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_UBIGINT, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_BINARY, TSDB_DATA_TYPE_NCHAR};
int32_t bindColTypeList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_NCHAR}; int32_t bindColTypeList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_NCHAR};
int32_t optrIdxList[] = {0, 1, 2}; int32_t optrIdxList[] = {0, 9};
typedef struct { typedef struct {
char* oper; char* oper;
@ -184,7 +184,7 @@ typedef struct {
int32_t caseRunNum; // total run case num int32_t caseRunNum; // total run case num
} CaseCtrl; } CaseCtrl;
#if 0 #if 1
CaseCtrl gCaseCtrl = { // default CaseCtrl gCaseCtrl = { // default
.bindNullNum = 0, .bindNullNum = 0,
.printCreateTblSql = false, .printCreateTblSql = false,
@ -202,7 +202,7 @@ CaseCtrl gCaseCtrl = { // default
.optrIdxListNum = 0, .optrIdxListNum = 0,
.optrIdxList = NULL, .optrIdxList = NULL,
.checkParamNum = false, .checkParamNum = false,
.printRes = true, .printRes = false,
.runTimes = 0, .runTimes = 0,
.caseIdx = -1, .caseIdx = -1,
.caseNum = -1, .caseNum = -1,
@ -212,7 +212,7 @@ CaseCtrl gCaseCtrl = { // default
#endif #endif
#if 1 #if 0
CaseCtrl gCaseCtrl = { CaseCtrl gCaseCtrl = {
.bindNullNum = 0, .bindNullNum = 0,
.printCreateTblSql = true, .printCreateTblSql = true,
@ -223,18 +223,18 @@ CaseCtrl gCaseCtrl = {
.bindColNum = 0, .bindColNum = 0,
.bindTagNum = 0, .bindTagNum = 0,
.bindRowNum = 0, .bindRowNum = 0,
.bindColTypeNum = 0, .bindColTypeNum = tListLen(bindColTypeList),
.bindColTypeList = NULL, .bindColTypeList = bindColTypeList,
.bindTagTypeNum = 0, .bindTagTypeNum = 0,
.bindTagTypeList = NULL, .bindTagTypeList = NULL,
.optrIdxListNum = 0, .optrIdxListNum = tListLen(optrIdxList),
.optrIdxList = NULL, .optrIdxList = optrIdxList,
.checkParamNum = false, .checkParamNum = false,
.printRes = false, .printRes = false,
.runTimes = 0, .runTimes = 0,
.caseIdx = -1, .caseIdx = 23,
.caseNum = 1, .caseNum = 1,
.caseRunIdx = 20, .caseRunIdx = -1,
.caseRunNum = 1, .caseRunNum = 1,
}; };
#endif #endif
@ -253,14 +253,14 @@ CaseCtrl gCaseCtrl = { // query case with specified col&oper
.optrIdxListNum = 0, .optrIdxListNum = 0,
.optrIdxList = NULL, .optrIdxList = NULL,
.checkParamNum = false, .checkParamNum = false,
.printRes = true, .printRes = false,
.runTimes = 0, .runTimes = 0,
.caseRunIdx = -1, .caseRunIdx = -1,
.optrIdxListNum = 0, .optrIdxListNum = 0,
.optrIdxList = NULL, .optrIdxList = NULL,
.bindColTypeNum = 0, .bindColTypeNum = 0,
.bindColTypeList = NULL, .bindColTypeList = NULL,
.caseIdx = 22, .caseIdx = 23,
.caseNum = 1, .caseNum = 1,
.caseRunNum = 1, .caseRunNum = 1,
}; };
@ -3332,6 +3332,7 @@ int32_t runCase(TAOS *taos, int32_t caseIdx, int32_t caseRunIdx, bool silent) {
TAOS_STMT *stmt = NULL; TAOS_STMT *stmt = NULL;
int64_t beginUs, endUs, totalUs; int64_t beginUs, endUs, totalUs;
CaseCfg cfg = gCase[caseIdx]; CaseCfg cfg = gCase[caseIdx];
CaseCfg cfgBk;
gCurCase = &cfg; gCurCase = &cfg;
if ((gCaseCtrl.bindColTypeNum || gCaseCtrl.bindColNum) && (gCurCase->colNum != gFullColNum)) { if ((gCaseCtrl.bindColTypeNum || gCaseCtrl.bindColNum) && (gCurCase->colNum != gFullColNum)) {
@ -3402,6 +3403,7 @@ int32_t runCase(TAOS *taos, int32_t caseIdx, int32_t caseRunIdx, bool silent) {
} }
totalUs = 0; totalUs = 0;
cfgBk = cfg;
for (int32_t n = 0; n < gCurCase->runTimes; ++n) { for (int32_t n = 0; n < gCurCase->runTimes; ++n) {
if (gCurCase->preCaseIdx < 0) { if (gCurCase->preCaseIdx < 0) {
prepare(taos, gCurCase->colNum, gCurCase->colList, gCurCase->autoCreateTbl); prepare(taos, gCurCase->colNum, gCurCase->colList, gCurCase->autoCreateTbl);
@ -3423,6 +3425,8 @@ int32_t runCase(TAOS *taos, int32_t caseIdx, int32_t caseRunIdx, bool silent) {
totalUs += (endUs - beginUs); totalUs += (endUs - beginUs);
prepareCheckResult(taos, silent); prepareCheckResult(taos, silent);
cfg = cfgBk;
} }
if (!silent) { if (!silent) {
@ -3465,18 +3469,19 @@ void* runCaseList(TAOS *taos) {
} }
void runAll(TAOS *taos) { void runAll(TAOS *taos) {
#if 0 #if 1
strcpy(gCaseCtrl.caseCatalog, "Normal Test"); strcpy(gCaseCtrl.caseCatalog, "Normal Test");
printf("%s Begin\n", gCaseCtrl.caseCatalog); printf("%s Begin\n", gCaseCtrl.caseCatalog);
runCaseList(taos); runCaseList(taos);
#endif
#if 1
strcpy(gCaseCtrl.caseCatalog, "Auto Create Table Test"); strcpy(gCaseCtrl.caseCatalog, "Auto Create Table Test");
gCaseCtrl.autoCreateTbl = true; gCaseCtrl.autoCreateTbl = true;
printf("%s Begin\n", gCaseCtrl.caseCatalog); printf("%s Begin\n", gCaseCtrl.caseCatalog);
runCaseList(taos); runCaseList(taos);
gCaseCtrl.autoCreateTbl = false; gCaseCtrl.autoCreateTbl = false;
#endif #endif
/* /*
@ -3499,6 +3504,7 @@ void runAll(TAOS *taos) {
runCaseList(taos); runCaseList(taos);
gCaseCtrl.rowNum = 0; gCaseCtrl.rowNum = 0;
gCaseCtrl.printRes = true; gCaseCtrl.printRes = true;
*/
strcpy(gCaseCtrl.caseCatalog, "Runtimes Test"); strcpy(gCaseCtrl.caseCatalog, "Runtimes Test");
printf("%s Begin\n", gCaseCtrl.caseCatalog); printf("%s Begin\n", gCaseCtrl.caseCatalog);
@ -3506,12 +3512,15 @@ void runAll(TAOS *taos) {
runCaseList(taos); runCaseList(taos);
gCaseCtrl.runTimes = 0; gCaseCtrl.runTimes = 0;
#if 1
strcpy(gCaseCtrl.caseCatalog, "Check Param Test"); strcpy(gCaseCtrl.caseCatalog, "Check Param Test");
printf("%s Begin\n", gCaseCtrl.caseCatalog); printf("%s Begin\n", gCaseCtrl.caseCatalog);
gCaseCtrl.checkParamNum = true; gCaseCtrl.checkParamNum = true;
runCaseList(taos); runCaseList(taos);
gCaseCtrl.checkParamNum = false; gCaseCtrl.checkParamNum = false;
#endif
/*
strcpy(gCaseCtrl.caseCatalog, "Bind Col Num Test"); strcpy(gCaseCtrl.caseCatalog, "Bind Col Num Test");
printf("%s Begin\n", gCaseCtrl.caseCatalog); printf("%s Begin\n", gCaseCtrl.caseCatalog);
gCaseCtrl.bindColNum = 6; gCaseCtrl.bindColNum = 6;