opti:modify logic for telnet and json in schemaless
This commit is contained in:
parent
001269530f
commit
200d879fe5
|
@ -1280,7 +1280,9 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
|
||||||
SSmlKv kv = {.key = key, .type = TSDB_DATA_TYPE_NCHAR, .keyLen = keyLen, .value = value, .length = valueLen};
|
SSmlKv kv = {.key = key, .type = TSDB_DATA_TYPE_NCHAR, .keyLen = keyLen, .value = value, .length = valueLen};
|
||||||
if(info->dataFormat){
|
if(info->dataFormat){
|
||||||
if(unlikely(cnt + 1 > info->currSTableMeta->tableInfo.numOfTags)){
|
if(unlikely(cnt + 1 > info->currSTableMeta->tableInfo.numOfTags)){
|
||||||
info->needModifySchema = true;
|
info->dataFormat = false;
|
||||||
|
info->reRun = true;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSameMeasure){
|
if(isSameMeasure){
|
||||||
|
@ -1488,13 +1490,17 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
|
||||||
if(info->dataFormat){
|
if(info->dataFormat){
|
||||||
//cnt begin 0, add ts so + 2
|
//cnt begin 0, add ts so + 2
|
||||||
if(unlikely(cnt + 2 > info->currSTableMeta->tableInfo.numOfColumns)){
|
if(unlikely(cnt + 2 > info->currSTableMeta->tableInfo.numOfColumns)){
|
||||||
info->needModifySchema = true;
|
info->dataFormat = false;
|
||||||
|
info->reRun = true;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
// bind data
|
// bind data
|
||||||
ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, cnt + 1);
|
ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, cnt + 1);
|
||||||
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
||||||
smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL);
|
uError("smlBuildCol error, retry");
|
||||||
return ret;
|
info->dataFormat = false;
|
||||||
|
info->reRun = true;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSameMeasure){
|
if(isSameMeasure){
|
||||||
|
@ -1795,7 +1801,9 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
|
||||||
|
|
||||||
if(info->dataFormat){
|
if(info->dataFormat){
|
||||||
if(unlikely(cnt + 1 > info->currSTableMeta->tableInfo.numOfTags)){
|
if(unlikely(cnt + 1 > info->currSTableMeta->tableInfo.numOfTags)){
|
||||||
info->needModifySchema = true;
|
info->dataFormat = false;
|
||||||
|
info->reRun = true;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSameMeasure){
|
if(isSameMeasure){
|
||||||
|
@ -2516,7 +2524,9 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *root, SSmlLineInfo
|
||||||
|
|
||||||
if(info->dataFormat){
|
if(info->dataFormat){
|
||||||
if(unlikely(cnt + 1 > info->currSTableMeta->tableInfo.numOfTags)){
|
if(unlikely(cnt + 1 > info->currSTableMeta->tableInfo.numOfTags)){
|
||||||
info->needModifySchema = true;
|
info->dataFormat = false;
|
||||||
|
info->reRun = true;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSameMeasure){
|
if(isSameMeasure){
|
||||||
|
@ -2899,6 +2909,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *oldRaw = rawLine;
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
while (i < numLines) {
|
while (i < numLines) {
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
|
@ -2915,7 +2926,6 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
if (info->protocol == TSDB_SML_LINE_PROTOCOL && tmp[0] == '#') { // this line is comment
|
if (info->protocol == TSDB_SML_LINE_PROTOCOL && tmp[0] == '#') { // this line is comment
|
||||||
i++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2946,6 +2956,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
|
||||||
}
|
}
|
||||||
if(info->reRun){
|
if(info->reRun){
|
||||||
i = 0;
|
i = 0;
|
||||||
|
rawLine = oldRaw;
|
||||||
info->reRun = false;
|
info->reRun = false;
|
||||||
// clear info->childTables
|
// clear info->childTables
|
||||||
NodeList* pList = info->childTables;
|
NodeList* pList = info->childTables;
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ int smlProcess_18784_Test() {
|
||||||
printf("%s result:%s, rows:%d\n", __FUNCTION__, taos_errstr(pRes), taos_affected_rows(pRes));
|
printf("%s result:%s, rows:%d\n", __FUNCTION__, taos_errstr(pRes), taos_affected_rows(pRes));
|
||||||
int code = taos_errno(pRes);
|
int code = taos_errno(pRes);
|
||||||
ASSERT(!code);
|
ASSERT(!code);
|
||||||
ASSERT(taos_affected_rows(pRes) == 2);
|
ASSERT(taos_affected_rows(pRes) == 1);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
pRes = taos_query(taos, "select * from disk");
|
pRes = taos_query(taos, "select * from disk");
|
||||||
|
@ -1160,8 +1160,8 @@ int sml_ttl_Test() {
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
// ret = sml_ttl_Test();
|
ret = sml_ttl_Test();
|
||||||
// ASSERT(!ret);
|
ASSERT(!ret);
|
||||||
ret = sml_ts2164_Test();
|
ret = sml_ts2164_Test();
|
||||||
ASSERT(!ret);
|
ASSERT(!ret);
|
||||||
ret = smlProcess_influx_Test();
|
ret = smlProcess_influx_Test();
|
||||||
|
|
Loading…
Reference in New Issue