提交 097a2b92 编写于 作者: wmmhello's avatar wmmhello

opti:modify parse json

上级 ac16bfc4
...@@ -113,7 +113,7 @@ typedef struct { ...@@ -113,7 +113,7 @@ typedef struct {
int32_t sTableNameLen; int32_t sTableNameLen;
char childTableName[TSDB_TABLE_NAME_LEN]; char childTableName[TSDB_TABLE_NAME_LEN];
uint64_t uid; uint64_t uid;
void *key; // for openTsdb telnet void *key; // for openTsdb
SArray *tags; SArray *tags;
...@@ -177,7 +177,7 @@ typedef struct { ...@@ -177,7 +177,7 @@ typedef struct {
int32_t lineNum; int32_t lineNum;
SSmlMsgBuf msgBuf; SSmlMsgBuf msgBuf;
cJSON *root; // for parse json // cJSON *root; // for parse json
SSmlLineInfo *lines; // element is SSmlLineInfo SSmlLineInfo *lines; // element is SSmlLineInfo
// //
...@@ -216,7 +216,7 @@ SSmlSTableMeta* smlBuildSTableMeta(bool isDataFormat); ...@@ -216,7 +216,7 @@ SSmlSTableMeta* smlBuildSTableMeta(bool isDataFormat);
int32_t smlSetCTableName(SSmlTableInfo *oneTable); int32_t smlSetCTableName(SSmlTableInfo *oneTable);
STableMeta* smlGetMeta(SSmlHandle *info, const void* measure, int32_t measureLen); STableMeta* smlGetMeta(SSmlHandle *info, const void* measure, int32_t measureLen);
int32_t is_same_child_table_telnet(const void *a, const void *b); int32_t is_same_child_table_telnet(const void *a, const void *b);
int32_t is_same_child_table_json(const void *a, const void *b); int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32_t len);
int32_t smlClearForRerun(SSmlHandle *info); int32_t smlClearForRerun(SSmlHandle *info);
int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements); int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements);
......
...@@ -1060,7 +1060,6 @@ static void smlDestroyInfo(SSmlHandle *info) { ...@@ -1060,7 +1060,6 @@ static void smlDestroyInfo(SSmlHandle *info) {
taosMemoryFree(info->lines); taosMemoryFree(info->lines);
} }
cJSON_Delete(info->root);
taosMemoryFreeClear(info); taosMemoryFreeClear(info);
} }
...@@ -1125,7 +1124,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { ...@@ -1125,7 +1124,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
}else if(info->protocol == TSDB_SML_TELNET_PROTOCOL){ }else if(info->protocol == TSDB_SML_TELNET_PROTOCOL){
tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements, POINTER_BYTES, is_same_child_table_telnet); tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements, POINTER_BYTES, is_same_child_table_telnet);
}else{ }else{
tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements->tags, POINTER_BYTES, is_same_child_table_json); tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements, POINTER_BYTES, is_same_child_table_telnet);
} }
if(tinfo == NULL){ if(tinfo == NULL){
......
此差异已折叠。
...@@ -456,7 +456,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, ...@@ -456,7 +456,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
bool isInQuote = false; bool isInQuote = false;
while (*sql < sqlEnd) { while (*sql < sqlEnd) {
// parse value // parse value
if (IS_QUOTE(*sql)) { if (unlikely(IS_QUOTE(*sql))) {
isInQuote = !isInQuote; isInQuote = !isInQuote;
(*sql)++; (*sql)++;
continue; continue;
...@@ -513,32 +513,32 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, ...@@ -513,32 +513,32 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
} }
if(isSameMeasure){ if(isSameMeasure){
if(cnt >= taosArrayGetSize(preLineKV)) { // if(cnt >= taosArrayGetSize(preLineKV)) {
info->dataFormat = false; // info->dataFormat = false;
info->reRun = true; // info->reRun = true;
return TSDB_CODE_SUCCESS; // return TSDB_CODE_SUCCESS;
} // }
SSmlKv *preKV = (SSmlKv *)taosArrayGet(preLineKV, cnt); // SSmlKv *preKV = (SSmlKv *)taosArrayGet(preLineKV, cnt);
if(kv.type != preKV->type){ // if(kv.type != preKV->type){
info->dataFormat = false; // info->dataFormat = false;
info->reRun = true; // info->reRun = true;
return TSDB_CODE_SUCCESS; // return TSDB_CODE_SUCCESS;
} // }
//
if(unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > preKV->length)){ // if(unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > preKV->length)){
preKV->length = kv.length; // preKV->length = kv.length;
SSmlSTableMeta *tableMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL); // SSmlSTableMeta *tableMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL);
ASSERT(tableMeta != NULL); // ASSERT(tableMeta != NULL);
//
SSmlKv *oldKV = (SSmlKv *)taosArrayGet(tableMeta->cols, cnt); // SSmlKv *oldKV = (SSmlKv *)taosArrayGet(tableMeta->cols, cnt);
oldKV->length = kv.length; // oldKV->length = kv.length;
info->needModifySchema = true; // info->needModifySchema = true;
} // }
if(unlikely(!IS_SAME_KEY)){ // if(unlikely(!IS_SAME_KEY)){
info->dataFormat = false; // info->dataFormat = false;
info->reRun = true; // info->reRun = true;
return TSDB_CODE_SUCCESS; // return TSDB_CODE_SUCCESS;
} // }
}else{ }else{
if(isSuperKVInit){ if(isSuperKVInit){
if(unlikely(cnt >= taosArrayGetSize(superKV))) { if(unlikely(cnt >= taosArrayGetSize(superKV))) {
......
...@@ -27,7 +27,7 @@ int32_t is_same_child_table_telnet(const void *a, const void *b){ ...@@ -27,7 +27,7 @@ int32_t is_same_child_table_telnet(const void *a, const void *b){
&& ((t1->tagsLen == t2->tagsLen) && memcmp(t1->tags, t2->tags, t1->tagsLen) == 0)) ? 0 : 1; && ((t1->tagsLen == t2->tagsLen) && memcmp(t1->tags, t2->tags, t1->tagsLen) == 0)) ? 0 : 1;
} }
static int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32_t len) { int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32_t len) {
uint8_t toPrecision = info->currSTableMeta ? info->currSTableMeta->tableInfo.precision : TSDB_TIME_PRECISION_NANO; uint8_t toPrecision = info->currSTableMeta ? info->currSTableMeta->tableInfo.precision : TSDB_TIME_PRECISION_NANO;
if (unlikely(!data)) { if (unlikely(!data)) {
......
...@@ -414,28 +414,28 @@ TEST(testCase, smlParseCols_Test) { ...@@ -414,28 +414,28 @@ TEST(testCase, smlParseCols_Test) {
smlDestroyInfo(info); smlDestroyInfo(info);
} }
TEST(testCase, smlGetTimestampLen_Test) { //TEST(testCase, smlGetTimestampLen_Test) {
uint8_t len = smlGetTimestampLen(0); // uint8_t len = smlGetTimestampLen(0);
ASSERT_EQ(len, 1); // ASSERT_EQ(len, 1);
//
len = smlGetTimestampLen(1); // len = smlGetTimestampLen(1);
ASSERT_EQ(len, 1); // ASSERT_EQ(len, 1);
//
len = smlGetTimestampLen(10); // len = smlGetTimestampLen(10);
ASSERT_EQ(len, 2); // ASSERT_EQ(len, 2);
//
len = smlGetTimestampLen(390); // len = smlGetTimestampLen(390);
ASSERT_EQ(len, 3); // ASSERT_EQ(len, 3);
//
len = smlGetTimestampLen(-1); // len = smlGetTimestampLen(-1);
ASSERT_EQ(len, 1); // ASSERT_EQ(len, 1);
//
len = smlGetTimestampLen(-10); // len = smlGetTimestampLen(-10);
ASSERT_EQ(len, 2); // ASSERT_EQ(len, 2);
//
len = smlGetTimestampLen(-390); // len = smlGetTimestampLen(-390);
ASSERT_EQ(len, 3); // ASSERT_EQ(len, 3);
} //}
TEST(testCase, smlParseNumber_Test) { TEST(testCase, smlParseNumber_Test) {
SSmlKv kv = {0}; SSmlKv kv = {0};
...@@ -487,139 +487,32 @@ TEST(testCase, smlParseTelnetLine_error_Test) { ...@@ -487,139 +487,32 @@ TEST(testCase, smlParseTelnetLine_error_Test) {
smlDestroyInfo(info); smlDestroyInfo(info);
} }
TEST(testCase, smlParseTelnetLine_json_error_Test) { TEST(testCase, smlParseTelnetLine_diff_json_type2_Test) {
SSmlHandle *info = smlBuildSmlInfo(NULL); SSmlHandle *info = smlBuildSmlInfo(NULL);
info->protocol = TSDB_SML_JSON_PROTOCOL; info->protocol = TSDB_SML_JSON_PROTOCOL;
info->dataFormat = false;
ASSERT_NE(info, nullptr); ASSERT_NE(info, nullptr);
const char *sql[] = { const char *sql[] = {
"[\n" "[{\"metric\":\"sys.cpu.nice\",\"timestamp\": 1346846400,\"value\": 18,\"tags\": {\"host\": \"lga\"}},{\"metric\": \"sys.sdfa\",\"timestamp\": 1346846400,\"value\": \"18\",\"tags\": {\"host\": 8932}},]",
" {\n"
" \"metric\": \"sys.cpu.nice\",\n"
" \"timestamp\": 13468464009999333322222223,\n"
" \"value\": 18,\n"
" \"tags\": {\n"
" \"host\": \"web01\",\n"
" \"dc\": \"lga\"\n"
" }\n"
" },\n"
"]",
"[\n"
" {\n"
" \"metric\": \"sys.cpu.nice\",\n"
" \"timestamp\": 1346846400i,\n"
" \"value\": 18,\n"
" \"tags\": {\n"
" \"host\": \"web01\",\n"
" \"dc\": \"lga\"\n"
" }\n"
" },\n"
"]",
"[\n"
" {\n"
" \"metric\": \"sys.cpu.nice\",\n"
" \"timestamp\": 1346846400,\n"
" \"value\": 18,\n"
" \"tags\": {\n"
" \"groupid\": { \n"
" \"value\" : 2,\n"
" \"type\" : \"nchar\"\n"
" },\n"
" \"location\": { \n"
" \"value\" : \"北京\",\n"
" \"type\" : \"binary\"\n"
" },\n"
" \"id\": \"d1001\"\n"
" }\n"
" },\n"
"]",
}; };
int ret = TSDB_CODE_SUCCESS;
for (int i = 0; i < sizeof(sql) / sizeof(sql[0]); i++) { for (int i = 0; i < sizeof(sql) / sizeof(sql[0]); i++) {
SSmlLineInfo elements = {0}; char *dataPointStart = (char *)sql[i];
ret = smlParseTelnetString(info, (char *)sql[i], (char*)(sql[i] + strlen(sql[i])), &elements); char *dataPointEnd = NULL;
ASSERT_NE(ret, 0); while (1) {
} dataPointEnd = smlJsonGetObj(dataPointStart);
if (dataPointEnd == NULL) break;
smlDestroyInfo(info);
}
TEST(testCase, smlParseTelnetLine_diff_json_type1_Test) {
SSmlHandle *info = smlBuildSmlInfo(NULL);
info->protocol = TSDB_SML_JSON_PROTOCOL;
info->dataFormat = false;
ASSERT_NE(info, nullptr);
const char *sql[] = {
"[\n"
" {\n"
" \"metric\": \"sys.cpu.nice\",\n"
" \"timestamp\": 1346846400,\n"
" \"value\": 18,\n"
" \"tags\": {\n"
" \"host\": \"lga\"\n"
" }\n"
" },\n"
"]",
"[\n"
" {\n"
" \"metric\": \"sys.cpu.nice\",\n"
" \"timestamp\": 1346846400,\n"
" \"value\": 18,\n"
" \"tags\": {\n"
" \"host\": 8\n"
" }\n"
" },\n"
"]",
};
int ret = TSDB_CODE_SUCCESS;
for (int i = 0; i < sizeof(sql) / sizeof(sql[0]); i++) {
SSmlLineInfo elements = {0}; SSmlLineInfo elements = {0};
ret = smlParseTelnetString(info, (char *)sql[i], (char*)(sql[i] + strlen(sql[i])), &elements); smlJsonParseObj(dataPointStart, dataPointEnd, &elements);
if (ret != TSDB_CODE_SUCCESS) break;
}
ASSERT_NE(ret, 0);
smlDestroyInfo(info);
}
TEST(testCase, smlParseTelnetLine_diff_json_type2_Test) { SArray *tags = smlJsonParseTags(elements.tags, elements.tags + elements.tagsLen);
SSmlHandle *info = smlBuildSmlInfo(NULL); size_t num = taosArrayGetSize(tags);
info->protocol = TSDB_SML_JSON_PROTOCOL; ASSERT_EQ(num, 1);
info->dataFormat = false;
ASSERT_NE(info, nullptr);
const char *sql[] = { taosArrayDestroy(tags);
"[\n" dataPointStart = dataPointEnd;
" {\n" }
" \"metric\": \"sys.cpu.nice\",\n"
" \"timestamp\": 1346846400,\n"
" \"value\": 18,\n"
" \"tags\": {\n"
" \"host\": \"lga\"\n"
" }\n"
" },\n"
"]",
"[\n"
" {\n"
" \"metric\": \"sys.cpu.nice\",\n"
" \"timestamp\": 1346846400,\n"
" \"value\": \"18\",\n"
" \"tags\": {\n"
" \"host\": \"fff\"\n"
" }\n"
" },\n"
"]",
};
int ret = TSDB_CODE_SUCCESS;
for (int i = 0; i < sizeof(sql) / sizeof(sql[0]); i++) {
SSmlLineInfo elements = {0};
ret = smlParseTelnetString(info, (char *)sql[i], (char*)(sql[i] + strlen(sql[i])), &elements);
if (ret != TSDB_CODE_SUCCESS) break;
} }
ASSERT_NE(ret, 0);
smlDestroyInfo(info); smlDestroyInfo(info);
} }
...@@ -647,6 +540,4 @@ TEST(testCase, smlParseNumber_performance_Test) { ...@@ -647,6 +540,4 @@ TEST(testCase, smlParseNumber_performance_Test) {
printf("smlParseNumberOld:%s cost:%" PRId64, str[i], taosGetTimestampUs() - t2); printf("smlParseNumberOld:%s cost:%" PRId64, str[i], taosGetTimestampUs() - t2);
printf("\n\n"); printf("\n\n");
} }
} }
\ No newline at end of file
...@@ -156,28 +156,7 @@ int smlProcess_json3_Test() { ...@@ -156,28 +156,7 @@ int smlProcess_json3_Test() {
taos_free_result(pRes); taos_free_result(pRes);
const char *sql[] = { const char *sql[] = {
"{\"metric\":\"meter_current1\",\"timestamp\":{\"value\":1662344042,\"type\":\"s\"},\"value\":{\"value\":10.3,\"type\":\"i64\"},\"tags\":{\"t1\":{\"value\":2,\"type\":\"bigint\"},\"t2\":{\"value\":2,\"type\":\"int\"},\"t3\":{\"value\":2,\"type\":\"i16\"},\"t4\":{\"value\":2,\"type\":\"i8\"},\"t5\":{\"value\":2,\"type\":\"f32\"},\"t6\":{\"value\":2,\"type\":\"double\"},\"t7\":{\"value\":\"8323\",\"type\":\"binary\"},\"t8\":{\"value\":\"北京\",\"type\":\"nchar\"},\"t9\":{\"value\":true,\"type\":\"bool\"},\"id\":\"d1001\"}}"}; "[{\"metric\":\"sys.cpu.nice\",\"timestamp\":0,\"value\":\"18\",\"tags\":{\"host\":\"web01\",\"id\":\"t1\",\"dc\":\"lga\"}}]"
pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL,
TSDB_SML_TIMESTAMP_NANO_SECONDS);
printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes));
int code = taos_errno(pRes);
taos_free_result(pRes);
taos_close(taos);
return code;
}
int smlProcess_json4_Test() {
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1");
taos_free_result(pRes);
pRes = taos_query(taos, "use sml_db");
taos_free_result(pRes);
const char *sql[] = {
"{\"metric\":\"meter_current2\",\"timestamp\":{\"value\":1662344042000,\"type\":\"ms\"},\"value\":\"ni\",\"tags\":{\"t1\":{\"value\":20,\"type\":\"i64\"},\"t2\":{\"value\":25,\"type\":\"i32\"},\"t3\":{\"value\":2,\"type\":\"smallint\"},\"t4\":{\"value\":2,\"type\":\"tinyint\"},\"t5\":{\"value\":2,\"type\":\"float\"},\"t6\":{\"value\":0.2,\"type\":\"f64\"},\"t7\":\"nsj\",\"t8\":{\"value\":\"北京\",\"type\":\"nchar\"},\"t9\":false,\"id\":\"d1001\"}}"
}; };
pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL,
TSDB_SML_TIMESTAMP_NANO_SECONDS); TSDB_SML_TIMESTAMP_NANO_SECONDS);
...@@ -686,52 +665,6 @@ int sml_oom_Test() { ...@@ -686,52 +665,6 @@ int sml_oom_Test() {
return code; return code;
} }
int sml_16368_Test() {
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1");
taos_free_result(pRes);
pRes = taos_query(taos, "use sml_db");
taos_free_result(pRes);
const char *sql[] = {
"[{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833639000, \"type\": \"us\"}, \"value\": 1, "
"\"tags\": {\"t1\": 3, \"t2\": {\"value\": 4, \"type\": \"double\"}, \"t3\": {\"value\": \"t3\", \"type\": "
"\"binary\"}}},"
"{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833739000, \"type\": \"us\"}, \"value\": 2, "
"\"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, "
"\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}},"
"{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006833639100, \"type\": \"us\"}, \"value\": 3, "
"\"tags\": {\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t3\": {\"value\": \"ste\", \"type\": \"nchar\"}}},"
"{\"metric\": \"stf567890\", \"timestamp\": {\"value\": 1626006833639200, \"type\": \"us\"}, \"value\": 4, "
"\"tags\": {\"t1\": {\"value\": 4, \"type\": \"bigint\"}, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, "
"\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}},"
"{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833639300, \"type\": \"us\"}, \"value\": "
"{\"value\": 5, \"type\": \"double\"}, \"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t2\": 5.0, "
"\"t3\": {\"value\": \"t4\", \"type\": \"binary\"}}},"
"{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006833639400, \"type\": \"us\"}, \"value\": "
"{\"value\": 6, \"type\": \"double\"}, \"tags\": {\"t2\": 5.0, \"t3\": {\"value\": \"ste2\", \"type\": "
"\"nchar\"}}},"
"{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006834639400, \"type\": \"us\"}, \"value\": "
"{\"value\": 7, \"type\": \"double\"}, \"tags\": {\"t2\": {\"value\": 5.0, \"type\": \"double\"}, \"t3\": "
"{\"value\": \"ste2\", \"type\": \"nchar\"}}},"
"{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833839006, \"type\": \"us\"}, \"value\": "
"{\"value\": 8, \"type\": \"double\"}, \"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t3\": "
"{\"value\": \"t4\", \"type\": \"binary\"}, \"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, "
"\"type\": \"double\"}}},"
"{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833939007, \"type\": \"us\"}, \"value\": "
"{\"value\": 9, \"type\": \"double\"}, \"tags\": {\"t1\": 4, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, "
"\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}}]"};
pRes = taos_schemaless_insert(taos, (char **)sql, 0, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_MICRO_SECONDS);
printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes));
int code = taos_errno(pRes);
taos_free_result(pRes);
taos_close(taos);
return code;
}
int sml_dup_time_Test() { int sml_dup_time_Test() {
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
...@@ -771,214 +704,6 @@ int sml_dup_time_Test() { ...@@ -771,214 +704,6 @@ int sml_dup_time_Test() {
return code; return code;
} }
int sml_16960_Test() {
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1");
taos_free_result(pRes);
pRes = taos_query(taos, "use sml_db");
taos_free_result(pRes);
const char *sql[] = {
"["
"{"
"\"timestamp\":"
""
"{ \"value\": 1664418955000, \"type\": \"ms\" }"
","
"\"value\":"
""
"{ \"value\": 830525384, \"type\": \"int\" }"
","
"\"tags\": {"
"\"id\": \"stb00_0\","
"\"t0\":"
""
"{ \"value\": 83972721, \"type\": \"int\" }"
","
"\"t1\":"
""
"{ \"value\": 539147525, \"type\": \"int\" }"
","
"\"t2\":"
""
"{ \"value\": 618258572, \"type\": \"int\" }"
","
"\"t3\":"
""
"{ \"value\": -10536201, \"type\": \"int\" }"
","
"\"t4\":"
""
"{ \"value\": 349227409, \"type\": \"int\" }"
","
"\"t5\":"
""
"{ \"value\": 249347042, \"type\": \"int\" }"
"},"
"\"metric\": \"stb0\""
"},"
"{"
"\"timestamp\":"
""
"{ \"value\": 1664418955001, \"type\": \"ms\" }"
","
"\"value\":"
""
"{ \"value\": -588348364, \"type\": \"int\" }"
","
"\"tags\": {"
"\"id\": \"stb00_0\","
"\"t0\":"
""
"{ \"value\": 83972721, \"type\": \"int\" }"
","
"\"t1\":"
""
"{ \"value\": 539147525, \"type\": \"int\" }"
","
"\"t2\":"
""
"{ \"value\": 618258572, \"type\": \"int\" }"
","
"\"t3\":"
""
"{ \"value\": -10536201, \"type\": \"int\" }"
","
"\"t4\":"
""
"{ \"value\": 349227409, \"type\": \"int\" }"
","
"\"t5\":"
""
"{ \"value\": 249347042, \"type\": \"int\" }"
"},"
"\"metric\": \"stb0\""
"},"
"{"
"\"timestamp\":"
""
"{ \"value\": 1664418955002, \"type\": \"ms\" }"
","
"\"value\":"
""
"{ \"value\": -370310823, \"type\": \"int\" }"
","
"\"tags\": {"
"\"id\": \"stb00_0\","
"\"t0\":"
""
"{ \"value\": 83972721, \"type\": \"int\" }"
","
"\"t1\":"
""
"{ \"value\": 539147525, \"type\": \"int\" }"
","
"\"t2\":"
""
"{ \"value\": 618258572, \"type\": \"int\" }"
","
"\"t3\":"
""
"{ \"value\": -10536201, \"type\": \"int\" }"
","
"\"t4\":"
""
"{ \"value\": 349227409, \"type\": \"int\" }"
","
"\"t5\":"
""
"{ \"value\": 249347042, \"type\": \"int\" }"
"},"
"\"metric\": \"stb0\""
"},"
"{"
"\"timestamp\":"
""
"{ \"value\": 1664418955003, \"type\": \"ms\" }"
","
"\"value\":"
""
"{ \"value\": -811250191, \"type\": \"int\" }"
","
"\"tags\": {"
"\"id\": \"stb00_0\","
"\"t0\":"
""
"{ \"value\": 83972721, \"type\": \"int\" }"
","
"\"t1\":"
""
"{ \"value\": 539147525, \"type\": \"int\" }"
","
"\"t2\":"
""
"{ \"value\": 618258572, \"type\": \"int\" }"
","
"\"t3\":"
""
"{ \"value\": -10536201, \"type\": \"int\" }"
","
"\"t4\":"
""
"{ \"value\": 349227409, \"type\": \"int\" }"
","
"\"t5\":"
""
"{ \"value\": 249347042, \"type\": \"int\" }"
"},"
"\"metric\": \"stb0\""
"},"
"{"
"\"timestamp\":"
""
"{ \"value\": 1664418955004, \"type\": \"ms\" }"
","
"\"value\":"
""
"{ \"value\": -330340558, \"type\": \"int\" }"
","
"\"tags\": {"
"\"id\": \"stb00_0\","
"\"t0\":"
""
"{ \"value\": 83972721, \"type\": \"int\" }"
","
"\"t1\":"
""
"{ \"value\": 539147525, \"type\": \"int\" }"
","
"\"t2\":"
""
"{ \"value\": 618258572, \"type\": \"int\" }"
","
"\"t3\":"
""
"{ \"value\": -10536201, \"type\": \"int\" }"
","
"\"t4\":"
""
"{ \"value\": 349227409, \"type\": \"int\" }"
","
"\"t5\":"
""
"{ \"value\": 249347042, \"type\": \"int\" }"
"},"
"\"metric\": \"stb0\""
"}"
"]"};
pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL,
TSDB_SML_TIMESTAMP_MILLI_SECONDS);
printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes));
int code = taos_errno(pRes);
taos_free_result(pRes);
taos_close(taos);
return code;
}
int sml_add_tag_col_Test() { int sml_add_tag_col_Test() {
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
...@@ -1211,11 +936,9 @@ int main(int argc, char *argv[]) { ...@@ -1211,11 +936,9 @@ int main(int argc, char *argv[]) {
ret = smlProcess_json1_Test(); ret = smlProcess_json1_Test();
ASSERT(!ret); ASSERT(!ret);
ret = smlProcess_json2_Test(); ret = smlProcess_json2_Test();
ASSERT(!ret); ASSERT(ret);
ret = smlProcess_json3_Test(); ret = smlProcess_json3_Test();
ASSERT(!ret); ASSERT(ret);
ret = smlProcess_json4_Test();
ASSERT(!ret);
ret = sml_TD15662_Test(); ret = sml_TD15662_Test();
ASSERT(!ret); ASSERT(!ret);
ret = sml_TD15742_Test(); ret = sml_TD15742_Test();
...@@ -1224,12 +947,8 @@ int main(int argc, char *argv[]) { ...@@ -1224,12 +947,8 @@ int main(int argc, char *argv[]) {
ASSERT(!ret); ASSERT(!ret);
ret = sml_oom_Test(); ret = sml_oom_Test();
ASSERT(!ret); ASSERT(!ret);
ret = sml_16368_Test();
ASSERT(!ret);
ret = sml_dup_time_Test(); ret = sml_dup_time_Test();
ASSERT(!ret); ASSERT(!ret);
ret = sml_16960_Test();
ASSERT(!ret);
ret = sml_add_tag_col_Test(); ret = sml_add_tag_col_Test();
ASSERT(!ret); ASSERT(!ret);
ret = smlProcess_18784_Test(); ret = smlProcess_18784_Test();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册