fix: only query issue
This commit is contained in:
parent
93e6e278ab
commit
b75adfcd9f
|
@ -65,6 +65,8 @@ typedef struct SParseCsvCxt {
|
||||||
const char* pLastSqlPos; // the location of the last parsed sql
|
const char* pLastSqlPos; // the location of the last parsed sql
|
||||||
} SParseCsvCxt;
|
} SParseCsvCxt;
|
||||||
|
|
||||||
|
typedef void(*setQueryFn)(int64_t);
|
||||||
|
|
||||||
typedef struct SParseContext {
|
typedef struct SParseContext {
|
||||||
uint64_t requestId;
|
uint64_t requestId;
|
||||||
int64_t requestRid;
|
int64_t requestRid;
|
||||||
|
@ -98,6 +100,7 @@ typedef struct SParseContext {
|
||||||
void* parseSqlParam;
|
void* parseSqlParam;
|
||||||
int8_t biMode;
|
int8_t biMode;
|
||||||
SArray* pSubMetaList;
|
SArray* pSubMetaList;
|
||||||
|
setQueryFn setQueryFp;
|
||||||
} SParseContext;
|
} SParseContext;
|
||||||
|
|
||||||
int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery);
|
int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery);
|
||||||
|
|
|
@ -284,6 +284,7 @@ typedef struct SRequestObj {
|
||||||
bool isSubReq;
|
bool isSubReq;
|
||||||
bool inCallback;
|
bool inCallback;
|
||||||
bool isStmtBind; // is statement bind parameter
|
bool isStmtBind; // is statement bind parameter
|
||||||
|
bool isQuery;
|
||||||
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
|
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
|
||||||
uint32_t retry;
|
uint32_t retry;
|
||||||
int64_t allocatorRefId;
|
int64_t allocatorRefId;
|
||||||
|
|
|
@ -31,6 +31,15 @@
|
||||||
static int32_t initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet);
|
static int32_t initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet);
|
||||||
static int32_t buildConnectMsg(SRequestObj* pRequest, SMsgSendInfo** pMsgSendInfo);
|
static int32_t buildConnectMsg(SRequestObj* pRequest, SMsgSendInfo** pMsgSendInfo);
|
||||||
|
|
||||||
|
void setQueryRequest(int64_t rId) {
|
||||||
|
SRequestObj* pReq = acquireRequest(rId);
|
||||||
|
if (pReq != NULL) {
|
||||||
|
pReq->isQuery = true;
|
||||||
|
(void)releaseRequest(rId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static bool stringLengthCheck(const char* str, size_t maxsize) {
|
static bool stringLengthCheck(const char* str, size_t maxsize) {
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -286,7 +295,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
|
||||||
.enableSysInfo = pTscObj->sysInfo,
|
.enableSysInfo = pTscObj->sysInfo,
|
||||||
.svrVer = pTscObj->sVer,
|
.svrVer = pTscObj->sVer,
|
||||||
.nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes),
|
.nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes),
|
||||||
.isStmtBind = pRequest->isStmtBind};
|
.isStmtBind = pRequest->isStmtBind,
|
||||||
|
.setQueryFp = setQueryRequest};
|
||||||
|
|
||||||
cxt.mgmtEpSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
|
cxt.mgmtEpSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
|
||||||
int32_t code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &cxt.pCatalog);
|
int32_t code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &cxt.pCatalog);
|
||||||
|
@ -2953,7 +2963,7 @@ void taosAsyncFetchImpl(SRequestObj* pRequest, __taos_async_fn_t fp, void* param
|
||||||
void doRequestCallback(SRequestObj* pRequest, int32_t code) {
|
void doRequestCallback(SRequestObj* pRequest, int32_t code) {
|
||||||
pRequest->inCallback = true;
|
pRequest->inCallback = true;
|
||||||
int64_t this = pRequest->self;
|
int64_t this = pRequest->self;
|
||||||
if (tsQueryTbNotExistAsEmpty && TD_RES_QUERY(&pRequest->resType) && (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_TDB_TABLE_NOT_EXIST)) {
|
if (tsQueryTbNotExistAsEmpty && TD_RES_QUERY(&pRequest->resType) && pRequest->isQuery && (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_TDB_TABLE_NOT_EXIST)) {
|
||||||
code = TSDB_CODE_SUCCESS;
|
code = TSDB_CODE_SUCCESS;
|
||||||
pRequest->type = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
|
pRequest->type = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6784,6 +6784,10 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
|
if (pCxt->pParseCxt && pCxt->pParseCxt->setQueryFp) {
|
||||||
|
(*pCxt->pParseCxt->setQueryFp)(pCxt->pParseCxt->requestRid);
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL == pSelect->pFromTable) {
|
if (NULL == pSelect->pFromTable) {
|
||||||
return translateSelectWithoutFrom(pCxt, pSelect);
|
return translateSelectWithoutFrom(pCxt, pSelect);
|
||||||
} else {
|
} else {
|
||||||
|
@ -6908,6 +6912,10 @@ static int32_t checkSetOperLimit(STranslateContext* pCxt, SLimitNode* pLimit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateSetOperator(STranslateContext* pCxt, SSetOperator* pSetOperator) {
|
static int32_t translateSetOperator(STranslateContext* pCxt, SSetOperator* pSetOperator) {
|
||||||
|
if (pCxt->pParseCxt && pCxt->pParseCxt->setQueryFp) {
|
||||||
|
(*pCxt->pParseCxt->setQueryFp)(pCxt->pParseCxt->requestRid);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t code = translateQuery(pCxt, pSetOperator->pLeft);
|
int32_t code = translateQuery(pCxt, pSetOperator->pLeft);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = resetHighLevelTranslateNamespace(pCxt);
|
code = resetHighLevelTranslateNamespace(pCxt);
|
||||||
|
|
Loading…
Reference in New Issue