Merge pull request #9583 from taosdata/feature/3.0_wxy
TD-12696 bug fix for insert
This commit is contained in:
commit
c5ae0c9e0c
|
@ -203,7 +203,10 @@ int32_t getPlan(SRequestObj* pRequest, SQueryNode* pQuery, SQueryDag** pDag) {
|
||||||
|
|
||||||
int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, void** pJob) {
|
int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, void** pJob) {
|
||||||
if (TSDB_SQL_INSERT == pRequest->type || TSDB_SQL_CREATE_TABLE == pRequest->type) {
|
if (TSDB_SQL_INSERT == pRequest->type || TSDB_SQL_CREATE_TABLE == pRequest->type) {
|
||||||
return scheduleExecJob(pRequest->pTscObj->pTransporter, NULL/*todo appInfo.xxx*/, pDag, pJob, &pRequest->affectedRows);
|
SQueryResult res = {.code = 0, .numOfRows = 0, .msgSize = ERROR_MSG_BUF_DEFAULT_SIZE, .msg = pRequest->msgBuf};
|
||||||
|
int32_t code = scheduleExecJob(pRequest->pTscObj->pTransporter, NULL, pDag, pJob, &res);
|
||||||
|
pRequest->affectedRows = res.numOfRows;
|
||||||
|
return res.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return scheduleAsyncExecJob(pRequest->pTscObj->pTransporter, NULL/*todo appInfo.xxx*/, pDag, pJob);
|
return scheduleAsyncExecJob(pRequest->pTscObj->pTransporter, NULL/*todo appInfo.xxx*/, pDag, pJob);
|
||||||
|
|
|
@ -262,6 +262,8 @@ const char *taos_data_type(int type) {
|
||||||
|
|
||||||
const char *taos_get_client_info() { return version; }
|
const char *taos_get_client_info() { return version; }
|
||||||
|
|
||||||
int taos_affected_rows(TAOS_RES *res) { return 1; }
|
int taos_affected_rows(TAOS_RES *res) {
|
||||||
|
return ((SRequestObj*)res)->affectedRows;
|
||||||
|
}
|
||||||
|
|
||||||
int taos_result_precision(TAOS_RES *res) { return TSDB_TIME_PRECISION_MILLI; }
|
int taos_result_precision(TAOS_RES *res) { return TSDB_TIME_PRECISION_MILLI; }
|
||||||
|
|
|
@ -126,7 +126,7 @@ static FORCE_INLINE void getMemRowAppendInfo(SSchema *pSchema, uint8_t memRowTyp
|
||||||
int32_t idx, int32_t *toffset) {
|
int32_t idx, int32_t *toffset) {
|
||||||
int32_t schemaIdx = 0;
|
int32_t schemaIdx = 0;
|
||||||
if (IS_DATA_COL_ORDERED(spd)) {
|
if (IS_DATA_COL_ORDERED(spd)) {
|
||||||
schemaIdx = spd->boundedColumns[idx];
|
schemaIdx = spd->boundedColumns[idx] - 1;
|
||||||
if (isDataRowT(memRowType)) {
|
if (isDataRowT(memRowType)) {
|
||||||
*toffset = (spd->cols + schemaIdx)->toffset; // the offset of firstPart
|
*toffset = (spd->cols + schemaIdx)->toffset; // the offset of firstPart
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -106,6 +106,7 @@ static int32_t getTableMeta(SInsertParseContext* pCxt, SToken* pTname) {
|
||||||
SVgroupInfo vg;
|
SVgroupInfo vg;
|
||||||
CHECK_CODE(catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &vg));
|
CHECK_CODE(catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &vg));
|
||||||
CHECK_CODE(taosHashPut(pCxt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg)));
|
CHECK_CODE(taosHashPut(pCxt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg)));
|
||||||
|
pCxt->pTableMeta->vgId = vg.vgId; // todo remove
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +426,7 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks,
|
||||||
// 1. set the parsed value from sql string
|
// 1. set the parsed value from sql string
|
||||||
for (int i = 0; i < spd->numOfBound; ++i) {
|
for (int i = 0; i < spd->numOfBound; ++i) {
|
||||||
NEXT_TOKEN(pCxt->pSql, sToken);
|
NEXT_TOKEN(pCxt->pSql, sToken);
|
||||||
SSchema *pSchema = &schema[spd->boundedColumns[i]];
|
SSchema *pSchema = &schema[spd->boundedColumns[i] - 1];
|
||||||
param.schema = pSchema;
|
param.schema = pSchema;
|
||||||
param.compareStat = pBuilder->compareStat;
|
param.compareStat = pBuilder->compareStat;
|
||||||
getMemRowAppendInfo(schema, pBuilder->memRowType, spd, i, ¶m.toffset);
|
getMemRowAppendInfo(schema, pBuilder->memRowType, spd, i, ¶m.toffset);
|
||||||
|
|
|
@ -247,8 +247,8 @@ int32_t queryProcessTableMetaRsp(void* output, char *msg, int32_t msgSize) {
|
||||||
pOut->metaNum = 2;
|
pOut->metaNum = 2;
|
||||||
|
|
||||||
if (pMetaMsg->dbFname[0]) {
|
if (pMetaMsg->dbFname[0]) {
|
||||||
snprintf(pOut->ctbFname, "%s.%s", pMetaMsg->dbFname, pMetaMsg->tbFname);
|
snprintf(pOut->ctbFname, sizeof(pOut->ctbFname), "%s.%s", pMetaMsg->dbFname, pMetaMsg->tbFname);
|
||||||
snprintf(pOut->tbFname, "%s.%s", pMetaMsg->dbFname, pMetaMsg->stbFname);
|
snprintf(pOut->tbFname, sizeof(pOut->tbFname), "%s.%s", pMetaMsg->dbFname, pMetaMsg->stbFname);
|
||||||
} else {
|
} else {
|
||||||
memcpy(pOut->ctbFname, pMetaMsg->tbFname, sizeof(pOut->ctbFname));
|
memcpy(pOut->ctbFname, pMetaMsg->tbFname, sizeof(pOut->ctbFname));
|
||||||
memcpy(pOut->tbFname, pMetaMsg->stbFname, sizeof(pOut->tbFname));
|
memcpy(pOut->tbFname, pMetaMsg->stbFname, sizeof(pOut->tbFname));
|
||||||
|
|
Loading…
Reference in New Issue