fix:[TS-5528] insert error in sml

This commit is contained in:
wangmm0220 2024-10-15 15:19:37 +08:00
parent 986f92d317
commit 4904667471
2 changed files with 8 additions and 4 deletions

View File

@ -262,7 +262,7 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml
return TSDB_CODE_SUCCESS;
}
bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) {
void isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) {
// cnt begin 0, add ts so + 2
if (unlikely(cnt + 2 > info->currSTableMeta->tableInfo.numOfColumns)) {
goto END;
@ -288,12 +288,11 @@ bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) {
maxKV->length = kv->length;
info->needModifySchema = true;
}
return true;
return;
END:
info->dataFormat = false;
info->reRun = true;
return false;
}
bool isSmlTagAligned(SSmlHandle *info, int cnt, SSmlKv *kv) {

View File

@ -452,7 +452,10 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
if (info->dataFormat) {
bool isAligned = isSmlColAligned(info, cnt, &kv);
if (kv.type == TSDB_DATA_TYPE_BINARY && valueEscaped) {
taosArrayPush(info->escapedStringList, &kv.value);
if (taosArrayPush(info->escapedStringList, &kv.value) == NULL){
freeSSmlKv(&kv);
return terrno;
}
kv.value = NULL;
}
freeSSmlKv(&kv);
@ -463,10 +466,12 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
if (currElement->colArray == NULL) {
currElement->colArray = taosArrayInit_s(sizeof(SSmlKv), 1);
if (currElement->colArray == NULL) {
freeSSmlKv(&kv);
return terrno;
}
}
if (taosArrayPush(currElement->colArray, &kv) == NULL){ // reserve for timestamp
freeSSmlKv(&kv);
return terrno;
}
}