Merge pull request #12610 from taosdata/feature/qnode
feat: support stmt query
This commit is contained in:
commit
d42961521c
|
@ -218,6 +218,13 @@ int32_t stmtParseSql(STscStmt* pStmt) {
|
||||||
|
|
||||||
pStmt->bInfo.needParse = false;
|
pStmt->bInfo.needParse = false;
|
||||||
|
|
||||||
|
if (pStmt->sql.pQuery->pRoot && 0 == pStmt->sql.type) {
|
||||||
|
pStmt->sql.type = STMT_TYPE_INSERT;
|
||||||
|
} else if (pStmt->sql.pQuery->pPrepareRoot) {
|
||||||
|
pStmt->sql.type = STMT_TYPE_QUERY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
switch (nodeType(pStmt->sql.pQuery->pRoot)) {
|
switch (nodeType(pStmt->sql.pQuery->pRoot)) {
|
||||||
case QUERY_NODE_VNODE_MODIF_STMT:
|
case QUERY_NODE_VNODE_MODIF_STMT:
|
||||||
if (0 == pStmt->sql.type) {
|
if (0 == pStmt->sql.type) {
|
||||||
|
@ -231,6 +238,7 @@ int32_t stmtParseSql(STscStmt* pStmt) {
|
||||||
tscError("not supported stmt type %d", nodeType(pStmt->sql.pQuery->pRoot));
|
tscError("not supported stmt type %d", nodeType(pStmt->sql.pQuery->pRoot));
|
||||||
STMT_ERR_RET(TSDB_CODE_TSC_STMT_CLAUSE_ERROR);
|
STMT_ERR_RET(TSDB_CODE_TSC_STMT_CLAUSE_ERROR);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,11 +170,11 @@ CaseCfg gCase[] = {
|
||||||
// 22
|
// 22
|
||||||
{"insert:AUTO1-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, true, true, insertAUTOTest1, 10, 10, 2, 0, 0, 0, 1, -1},
|
{"insert:AUTO1-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, true, true, insertAUTOTest1, 10, 10, 2, 0, 0, 0, 1, -1},
|
||||||
|
|
||||||
// {"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryColumnTest, 10, 10, 1, 3, 0, 0, 1, 2},
|
{"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryColumnTest, 10, 10, 1, 3, 0, 0, 1, 2},
|
||||||
// {"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryMiscTest, 10, 10, 1, 3, 0, 0, 1, 2},
|
{"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryMiscTest, 10, 10, 1, 3, 0, 0, 1, 2},
|
||||||
|
|
||||||
{"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryColumnTest, 1, 10, 1, 1, 0, 0, 1, 2},
|
// {"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryColumnTest, 1, 10, 1, 1, 0, 0, 1, 2},
|
||||||
{"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryMiscTest, 2, 10, 1, 1, 0, 0, 1, 2},
|
// {"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryMiscTest, 2, 10, 1, 1, 0, 0, 1, 2},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,7 +209,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,
|
||||||
|
@ -267,7 +267,7 @@ CaseCtrl gCaseCtrl = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
CaseCtrl gCaseCtrl = { // query case with specified col&oper
|
CaseCtrl gCaseCtrl = { // query case with specified col&oper
|
||||||
.bindNullNum = 1,
|
.bindNullNum = 1,
|
||||||
.printCreateTblSql = false,
|
.printCreateTblSql = false,
|
||||||
|
@ -292,7 +292,7 @@ CaseCtrl gCaseCtrl = { // query case with specified col&oper
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
CaseCtrl gCaseCtrl = { // query case with specified col&oper
|
CaseCtrl gCaseCtrl = { // query case with specified col&oper
|
||||||
.bindNullNum = 0,
|
.bindNullNum = 1,
|
||||||
.printCreateTblSql = true,
|
.printCreateTblSql = true,
|
||||||
.printQuerySql = true,
|
.printQuerySql = true,
|
||||||
.printStmtSql = true,
|
.printStmtSql = true,
|
||||||
|
@ -309,10 +309,10 @@ CaseCtrl gCaseCtrl = { // query case with specified col&oper
|
||||||
.printRes = true,
|
.printRes = true,
|
||||||
.runTimes = 0,
|
.runTimes = 0,
|
||||||
.caseRunIdx = -1,
|
.caseRunIdx = -1,
|
||||||
.optrIdxListNum = tListLen(optrIdxList),
|
//.optrIdxListNum = tListLen(optrIdxList),
|
||||||
.optrIdxList = optrIdxList,
|
//.optrIdxList = optrIdxList,
|
||||||
.bindColTypeNum = tListLen(bindColTypeList),
|
//.bindColTypeNum = tListLen(bindColTypeList),
|
||||||
.bindColTypeList = bindColTypeList,
|
//.bindColTypeList = bindColTypeList,
|
||||||
.caseIdx = 24,
|
.caseIdx = 24,
|
||||||
.caseNum = 1,
|
.caseNum = 1,
|
||||||
.caseRunNum = 1,
|
.caseRunNum = 1,
|
||||||
|
@ -665,15 +665,16 @@ void bpGenerateConstInFuncSQL(BindData *data, int32_t tblIdx) {
|
||||||
|
|
||||||
|
|
||||||
void generateQueryMiscSQL(BindData *data, int32_t tblIdx) {
|
void generateQueryMiscSQL(BindData *data, int32_t tblIdx) {
|
||||||
|
if (tblIdx == FUNCTION_TEST_IDX && gCurCase->bindNullNum <= 0) {
|
||||||
|
bpGenerateConstInFuncSQL(data, tblIdx);
|
||||||
|
} else {
|
||||||
switch(tblIdx) {
|
switch(tblIdx) {
|
||||||
case 0:
|
case 0:
|
||||||
//TODO FILL TEST
|
//TODO FILL TEST
|
||||||
default:
|
default:
|
||||||
bpGenerateConstInOpSQL(data, tblIdx);
|
bpGenerateConstInOpSQL(data, tblIdx);
|
||||||
break;
|
break;
|
||||||
case FUNCTION_TEST_IDX:
|
}
|
||||||
bpGenerateConstInFuncSQL(data, tblIdx);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gCaseCtrl.printStmtSql) {
|
if (gCaseCtrl.printStmtSql) {
|
||||||
|
@ -1064,6 +1065,8 @@ int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) {
|
||||||
|
|
||||||
if (tblIdx == FUNCTION_TEST_IDX) {
|
if (tblIdx == FUNCTION_TEST_IDX) {
|
||||||
gCaseCtrl.numericParam = true;
|
gCaseCtrl.numericParam = true;
|
||||||
|
} else {
|
||||||
|
gCaseCtrl.numericParam = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int b = 0; b < bindNum; b++) {
|
for (int b = 0; b < bindNum; b++) {
|
||||||
|
@ -1072,6 +1075,8 @@ int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gCaseCtrl.numericParam = false;
|
||||||
|
|
||||||
generateQueryMiscSQL(data, tblIdx);
|
generateQueryMiscSQL(data, tblIdx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue