未验证 提交 9eed798a 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #8453 from taosdata/glzhao/remove_appendix

[schemaless] removed line protocol timestamp appendix
...@@ -1435,58 +1435,65 @@ static bool isNchar(char *pVal, uint16_t len) { ...@@ -1435,58 +1435,65 @@ static bool isNchar(char *pVal, uint16_t len) {
return false; return false;
} }
static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, SSmlLinesInfo* info) { static int32_t isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, SSmlLinesInfo* info) {
if (len == 0) { if (len == 0) {
return true; return TSDB_CODE_SUCCESS;
} }
if ((len == 1) && pVal[0] == '0') { if ((len == 1) && pVal[0] == '0') {
*tsType = SML_TIME_STAMP_NOW; *tsType = SML_TIME_STAMP_NOW;
return true; return TSDB_CODE_SUCCESS;
} }
//Default no appendix for (int i = 0; i < len; ++i) {
if (isdigit(pVal[len - 1]) && isdigit(pVal[len - 2])) { if(!isdigit(pVal[i])) {
if (info->protocol == TSDB_SML_LINE_PROTOCOL) { return TSDB_CODE_TSC_INVALID_TIME_STAMP;
if (info->tsType != SML_TIME_STAMP_NOT_CONFIGURED) {
*tsType = info->tsType;
} else {
*tsType = SML_TIME_STAMP_NANO_SECONDS;
}
} else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) {
if (len == SML_TIMESTAMP_SECOND_DIGITS) {
*tsType = SML_TIME_STAMP_SECONDS;
} else if (len == SML_TIMESTAMP_MILLI_SECOND_DIGITS) {
*tsType = SML_TIME_STAMP_MILLI_SECONDS;
} else {
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
}
} }
return true;
} }
if (pVal[len - 1] == 's') { /* For InfluxDB line protocol use user passed timestamp precision
switch (pVal[len - 2]) { * For OpenTSDB protocols only 10 digit(seconds) or 13 digits(milliseconds)
case 'm': * precision allowed
*tsType = SML_TIME_STAMP_MILLI_SECONDS; */
break; if (info->protocol == TSDB_SML_LINE_PROTOCOL) {
case 'u': if (info->tsType != SML_TIME_STAMP_NOT_CONFIGURED) {
*tsType = SML_TIME_STAMP_MICRO_SECONDS; *tsType = info->tsType;
break; } else {
case 'n': *tsType = SML_TIME_STAMP_NANO_SECONDS;
*tsType = SML_TIME_STAMP_NANO_SECONDS; }
break; } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) {
default: if (len == SML_TIMESTAMP_SECOND_DIGITS) {
if (isdigit(pVal[len - 2])) { *tsType = SML_TIME_STAMP_SECONDS;
*tsType = SML_TIME_STAMP_SECONDS; } else if (len == SML_TIMESTAMP_MILLI_SECOND_DIGITS) {
break; *tsType = SML_TIME_STAMP_MILLI_SECONDS;
} else { } else {
return false; return TSDB_CODE_TSC_INVALID_TIME_STAMP;
}
} }
//printf("Type is timestamp(%s)\n", pVal);
return true;
} }
return false; return TSDB_CODE_SUCCESS;
//if (pVal[len - 1] == 's') {
// switch (pVal[len - 2]) {
// case 'm':
// *tsType = SML_TIME_STAMP_MILLI_SECONDS;
// break;
// case 'u':
// *tsType = SML_TIME_STAMP_MICRO_SECONDS;
// break;
// case 'n':
// *tsType = SML_TIME_STAMP_NANO_SECONDS;
// break;
// default:
// if (isdigit(pVal[len - 2])) {
// *tsType = SML_TIME_STAMP_SECONDS;
// break;
// } else {
// return false;
// }
// }
// //printf("Type is timestamp(%s)\n", pVal);
// return true;
//}
//return false;
} }
static bool convertStrToNumber(TAOS_SML_KV *pVal, char *str, SSmlLinesInfo* info) { static bool convertStrToNumber(TAOS_SML_KV *pVal, char *str, SSmlLinesInfo* info) {
...@@ -1750,14 +1757,6 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1750,14 +1757,6 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
static int32_t getTimeStampValue(char *value, uint16_t len, static int32_t getTimeStampValue(char *value, uint16_t len,
SMLTimeStampType type, int64_t *ts, SSmlLinesInfo* info) { SMLTimeStampType type, int64_t *ts, SSmlLinesInfo* info) {
if (len >= 2) {
for (int i = 0; i < len - 2; ++i) {
if(!isdigit(value[i])) {
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
}
}
}
//No appendix or no timestamp given (len = 0) //No appendix or no timestamp given (len = 0)
if (len != 0 && type != SML_TIME_STAMP_NOW) { if (len != 0 && type != SML_TIME_STAMP_NOW) {
*ts = (int64_t)strtoll(value, NULL, 10); *ts = (int64_t)strtoll(value, NULL, 10);
...@@ -1806,13 +1805,13 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, ...@@ -1806,13 +1805,13 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
SMLTimeStampType type; SMLTimeStampType type;
int64_t tsVal; int64_t tsVal;
strntolower_s(value, value, len); ret = isTimeStamp(value, len, &type, info);
if (!isTimeStamp(value, len, &type, info)) { if (ret != TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_TIME_STAMP; return ret;
} }
ret = getTimeStampValue(value, len, type, &tsVal, info); ret = getTimeStampValue(value, len, type, &tsVal, info);
if (ret) { if (ret != TSDB_CODE_SUCCESS) {
return ret; return ret;
} }
tscDebug("SML:0x%"PRIx64"Timestamp after conversion:%"PRId64, info->id, tsVal); tscDebug("SML:0x%"PRIx64"Timestamp after conversion:%"PRId64, info->id, tsVal);
......
...@@ -15,7 +15,7 @@ static void prepare_data(TAOS* taos) { ...@@ -15,7 +15,7 @@ static void prepare_data(TAOS* taos) {
result = taos_query(taos, "drop database if exists test;"); result = taos_query(taos, "drop database if exists test;");
taos_free_result(result); taos_free_result(result);
usleep(100000); usleep(100000);
result = taos_query(taos, "create database test precision 'us';"); result = taos_query(taos, "create database test precision 'ns';");
taos_free_result(result); taos_free_result(result);
usleep(100000); usleep(100000);
taos_select_db(taos, "test"); taos_select_db(taos, "test");
...@@ -293,7 +293,7 @@ void verify_schema_less(TAOS* taos) { ...@@ -293,7 +293,7 @@ void verify_schema_less(TAOS* taos) {
result = taos_query(taos, "drop database if exists test;"); result = taos_query(taos, "drop database if exists test;");
taos_free_result(result); taos_free_result(result);
usleep(100000); usleep(100000);
result = taos_query(taos, "create database test precision 'us' update 1;"); result = taos_query(taos, "create database test precision 'ns' update 1 keep 36500;");
taos_free_result(result); taos_free_result(result);
usleep(100000); usleep(100000);
...@@ -401,6 +401,21 @@ void verify_schema_less(TAOS* taos) { ...@@ -401,6 +401,21 @@ void verify_schema_less(TAOS* taos) {
} }
taos_free_result(result); taos_free_result(result);
//Test timestamp precision
char* lines7[] = {
"stts,t1=10i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1",
};
for (int precision = TSDB_SML_TIMESTAMP_HOURS; precision <= TSDB_SML_TIMESTAMP_NANO_SECONDS; ++precision) {
result = taos_schemaless_insert(taos, lines7, 1, TSDB_SML_LINE_PROTOCOL, precision);
code = taos_errno(result);
if (code != TSDB_CODE_SUCCESS) {
affected_rows = taos_affected_rows(result);
printf("\033[31m [lines7_%d]taos_schemaless_insert failed, code: %d,%s, affected rows:%d \033[0m\n", precision, code, taos_errstr(result), affected_rows);
}
taos_free_result(result);
}
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
......
...@@ -32,10 +32,10 @@ class TDTestCase: ...@@ -32,10 +32,10 @@ class TDTestCase:
### metric ### ### metric ###
print("============= step1 : test metric ================") print("============= step1 : test metric ================")
lines0 = [ lines0 = [
"stb0_0 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "stb0_0 1626006833639 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_1 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "stb0_1 1626006833639 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_2 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "stb0_2 1626006833639 4i8 host=\"host0\" interface=\"eth0\"",
"`.stb0.3.` 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "`.stb0.3.` 1626006833639 4i8 host=\"host0\" interface=\"eth0\"",
] ]
code = self._conn.schemaless_insert(lines0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -59,28 +59,24 @@ class TDTestCase: ...@@ -59,28 +59,24 @@ class TDTestCase:
### timestamp ### ### timestamp ###
print("============= step2 : test timestamp ================") print("============= step2 : test timestamp ================")
lines1 = [ lines1 = [
"stb1 1626006833s 1i8 host=\"host0\"", "stb1 1626006833641 1i8 host=\"host0\"",
"stb1 1626006833639000000ns 2i8 host=\"host0\"", "stb1 1626006834 2i8 host=\"host0\"",
"stb1 1626006833640000us 3i8 host=\"host0\"", "stb1 0 3i8 host=\"host0\"",
"stb1 1626006833641 4i8 host=\"host0\"",
"stb1 1626006834 5i8 host=\"host0\"",
"stb1 1626006833651ms 6i8 host=\"host0\"",
"stb1 0 7i8 host=\"host0\"",
] ]
code = self._conn.schemaless_insert(lines1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb1") tdSql.query("select * from stb1")
tdSql.checkRows(7) tdSql.checkRows(3)
### metric value ### ### metric value ###
print("============= step3 : test metric value ================") print("============= step3 : test metric value ================")
#tinyint #tinyint
lines2_0 = [ lines2_0 = [
"stb2_0 1626006833651ms -127i8 host=\"host0\"", "stb2_0 1626006833651 -127i8 host=\"host0\"",
"stb2_0 1626006833652ms 127i8 host=\"host0\"" "stb2_0 1626006833652 127i8 host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code)) print("schemaless_insert result {}".format(code))
...@@ -94,8 +90,8 @@ class TDTestCase: ...@@ -94,8 +90,8 @@ class TDTestCase:
#smallint #smallint
lines2_1 = [ lines2_1 = [
"stb2_1 1626006833651ms -32767i16 host=\"host0\"", "stb2_1 1626006833651 -32767i16 host=\"host0\"",
"stb2_1 1626006833652ms 32767i16 host=\"host0\"" "stb2_1 1626006833652 32767i16 host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code)) print("schemaless_insert result {}".format(code))
...@@ -109,8 +105,8 @@ class TDTestCase: ...@@ -109,8 +105,8 @@ class TDTestCase:
#int #int
lines2_2 = [ lines2_2 = [
"stb2_2 1626006833651ms -2147483647i32 host=\"host0\"", "stb2_2 1626006833651 -2147483647i32 host=\"host0\"",
"stb2_2 1626006833652ms 2147483647i32 host=\"host0\"" "stb2_2 1626006833652 2147483647i32 host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_2, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_2, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -125,8 +121,8 @@ class TDTestCase: ...@@ -125,8 +121,8 @@ class TDTestCase:
#bigint #bigint
lines2_3 = [ lines2_3 = [
"stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"", "stb2_3 1626006833651 -9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"" "stb2_3 1626006833652 9223372036854775807i64 host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_3, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_3, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -141,16 +137,16 @@ class TDTestCase: ...@@ -141,16 +137,16 @@ class TDTestCase:
#float #float
lines2_4 = [ lines2_4 = [
"stb2_4 1626006833610ms 3f32 host=\"host0\"", "stb2_4 1626006833610 3f32 host=\"host0\"",
"stb2_4 1626006833620ms -3f32 host=\"host0\"", "stb2_4 1626006833620 -3f32 host=\"host0\"",
"stb2_4 1626006833630ms 3.4f32 host=\"host0\"", "stb2_4 1626006833630 3.4f32 host=\"host0\"",
"stb2_4 1626006833640ms -3.4f32 host=\"host0\"", "stb2_4 1626006833640 -3.4f32 host=\"host0\"",
"stb2_4 1626006833650ms 3.4E10f32 host=\"host0\"", "stb2_4 1626006833650 3.4E10f32 host=\"host0\"",
"stb2_4 1626006833660ms -3.4e10f32 host=\"host0\"", "stb2_4 1626006833660 -3.4e10f32 host=\"host0\"",
"stb2_4 1626006833670ms 3.4E+2f32 host=\"host0\"", "stb2_4 1626006833670 3.4E+2f32 host=\"host0\"",
"stb2_4 1626006833680ms -3.4e-2f32 host=\"host0\"", "stb2_4 1626006833680 -3.4e-2f32 host=\"host0\"",
"stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"", "stb2_4 1626006833700 3.4E38f32 host=\"host0\"",
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\"" "stb2_4 1626006833710 -3.4E38f32 host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_4, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_4, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -165,17 +161,17 @@ class TDTestCase: ...@@ -165,17 +161,17 @@ class TDTestCase:
#double #double
lines2_5 = [ lines2_5 = [
"stb2_5 1626006833610ms 3f64 host=\"host0\"", "stb2_5 1626006833610 3f64 host=\"host0\"",
"stb2_5 1626006833620ms -3f64 host=\"host0\"", "stb2_5 1626006833620 -3f64 host=\"host0\"",
"stb2_5 1626006833630ms 3.4f64 host=\"host0\"", "stb2_5 1626006833630 3.4f64 host=\"host0\"",
"stb2_5 1626006833640ms -3.4f64 host=\"host0\"", "stb2_5 1626006833640 -3.4f64 host=\"host0\"",
"stb2_5 1626006833650ms 3.4E10f64 host=\"host0\"", "stb2_5 1626006833650 3.4E10f64 host=\"host0\"",
"stb2_5 1626006833660ms -3.4e10f64 host=\"host0\"", "stb2_5 1626006833660 -3.4e10f64 host=\"host0\"",
"stb2_5 1626006833670ms 3.4E+2f64 host=\"host0\"", "stb2_5 1626006833670 3.4E+2f64 host=\"host0\"",
"stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"", "stb2_5 1626006833680 -3.4e-2f64 host=\"host0\"",
"stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"", "stb2_5 1626006833690 1.7E308f64 host=\"host0\"",
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\"", "stb2_5 1626006833700 -1.7E308f64 host=\"host0\"",
"stb2_5 1626006833710ms 3 host=\"host0\"" "stb2_5 1626006833710 3 host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_5, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_5, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -190,16 +186,16 @@ class TDTestCase: ...@@ -190,16 +186,16 @@ class TDTestCase:
#bool #bool
lines2_6 = [ lines2_6 = [
"stb2_6 1626006833610ms t host=\"host0\"", "stb2_6 1626006833610 t host=\"host0\"",
"stb2_6 1626006833620ms T host=\"host0\"", "stb2_6 1626006833620 T host=\"host0\"",
"stb2_6 1626006833630ms true host=\"host0\"", "stb2_6 1626006833630 true host=\"host0\"",
"stb2_6 1626006833640ms True host=\"host0\"", "stb2_6 1626006833640 True host=\"host0\"",
"stb2_6 1626006833650ms TRUE host=\"host0\"", "stb2_6 1626006833650 TRUE host=\"host0\"",
"stb2_6 1626006833660ms f host=\"host0\"", "stb2_6 1626006833660 f host=\"host0\"",
"stb2_6 1626006833670ms F host=\"host0\"", "stb2_6 1626006833670 F host=\"host0\"",
"stb2_6 1626006833680ms false host=\"host0\"", "stb2_6 1626006833680 false host=\"host0\"",
"stb2_6 1626006833690ms False host=\"host0\"", "stb2_6 1626006833690 False host=\"host0\"",
"stb2_6 1626006833700ms FALSE host=\"host0\"" "stb2_6 1626006833700 FALSE host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_6, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_6, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -214,9 +210,9 @@ class TDTestCase: ...@@ -214,9 +210,9 @@ class TDTestCase:
#binary #binary
lines2_7 = [ lines2_7 = [
"stb2_7 1626006833610ms \" binary_val .!@#$%^&* \" host=\"host0\"", "stb2_7 1626006833610 \" binary_val .!@#$%^&* \" host=\"host0\"",
"stb2_7 1626006833620ms \"binary_val.:;,./?|+-=\" host=\"host0\"", "stb2_7 1626006833620 \"binary_val.:;,./?|+-=\" host=\"host0\"",
"stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\"" "stb2_7 1626006833630 \"binary_val.()[]{}<>\" host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_7, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_7, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -231,8 +227,8 @@ class TDTestCase: ...@@ -231,8 +227,8 @@ class TDTestCase:
#nchar #nchar
lines2_8 = [ lines2_8 = [
"stb2_8 1626006833610ms L\" nchar_val 数值一 \" host=\"host0\"", "stb2_8 1626006833610 L\" nchar_val 数值一 \" host=\"host0\"",
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\"" "stb2_8 1626006833620 L\"nchar_val数值二\" host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_8, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines2_8, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -249,8 +245,8 @@ class TDTestCase: ...@@ -249,8 +245,8 @@ class TDTestCase:
print("============= step3 : test tags ================") print("============= step3 : test tags ================")
#tag value types #tag value types
lines3_0 = [ lines3_0 = [
"stb3_0 1626006833610ms 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=\"binary_val_1\" t9=L\"标签值1\"", "stb3_0 1626006833610 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=\"binary_val_1\" t9=L\"标签值1\"",
"stb3_0 1626006833610ms 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\"" "stb3_0 1626006833610 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\""
] ]
code = self._conn.schemaless_insert(lines3_0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines3_0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
...@@ -292,9 +288,9 @@ class TDTestCase: ...@@ -292,9 +288,9 @@ class TDTestCase:
#tag ID as child table name #tag ID as child table name
lines3_1 = [ lines3_1 = [
"stb3_1 1626006833610ms 1 id=child_table1 host=host1", "stb3_1 1626006833610 1 id=child_table1 host=host1",
"stb3_1 1626006833610ms 2 host=host2 iD=child_table2", "stb3_1 1626006833610 2 host=host2 iD=child_table2",
"stb3_1 1626006833610ms 3 ID=child_table3 host=host3" "stb3_1 1626006833610 3 ID=child_table3 host=host3"
] ]
code = self._conn.schemaless_insert(lines3_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) code = self._conn.schemaless_insert(lines3_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
......
...@@ -22,9 +22,9 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -22,9 +22,9 @@ void verify_telnet_insert(TAOS* taos) {
/* metric */ /* metric */
char* lines0[] = { char* lines0[] = {
"stb0_0 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "stb0_0 1626006833639 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_1 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "stb0_1 1626006833639 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_2 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "stb0_2 1626006833639 4i8 host=\"host0\" interface=\"eth0\"",
}; };
result = taos_schemaless_insert(taos, lines0, 3, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines0, 3, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -35,15 +35,11 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -35,15 +35,11 @@ void verify_telnet_insert(TAOS* taos) {
/* timestamp */ /* timestamp */
char* lines1[] = { char* lines1[] = {
"stb1 1626006833s 1i8 host=\"host0\"", "stb1 1626006833641 1i8 host=\"host0\"",
"stb1 1626006833639000000ns 2i8 host=\"host0\"", "stb1 1626006832 2i8 host=\"host0\"",
"stb1 1626006833640000us 3i8 host=\"host0\"", "stb1 0 3i8 host=\"host0\"",
"stb1 1626006833641 4i8 host=\"host0\"",
"stb1 1626006832 5i8 host=\"host0\"",
"stb1 1626006833651ms 6i8 host=\"host0\"",
"stb1 0 7i8 host=\"host0\"",
}; };
result = taos_schemaless_insert(taos, lines1, 7, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines1, 3, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
if (code) { if (code) {
printf("lines1 code: %d, %s.\n", code, tstrerror(code)); printf("lines1 code: %d, %s.\n", code, tstrerror(code));
...@@ -53,8 +49,8 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -53,8 +49,8 @@ void verify_telnet_insert(TAOS* taos) {
/* metric value */ /* metric value */
//tinyint //tinyint
char* lines2_0[] = { char* lines2_0[] = {
"stb2_0 1626006833651ms -127i8 host=\"host0\"", "stb2_0 1626006833651 -127i8 host=\"host0\"",
"stb2_0 1626006833652ms 127i8 host=\"host0\"" "stb2_0 1626006833652 127i8 host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_0, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_0, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -65,8 +61,8 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -65,8 +61,8 @@ void verify_telnet_insert(TAOS* taos) {
//smallint //smallint
char* lines2_1[] = { char* lines2_1[] = {
"stb2_1 1626006833651ms -32767i16 host=\"host0\"", "stb2_1 1626006833651 -32767i16 host=\"host0\"",
"stb2_1 1626006833652ms 32767i16 host=\"host0\"" "stb2_1 1626006833652 32767i16 host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_1, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_1, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -77,8 +73,8 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -77,8 +73,8 @@ void verify_telnet_insert(TAOS* taos) {
//int //int
char* lines2_2[] = { char* lines2_2[] = {
"stb2_2 1626006833651ms -2147483647i32 host=\"host0\"", "stb2_2 1626006833651 -2147483647i32 host=\"host0\"",
"stb2_2 1626006833652ms 2147483647i32 host=\"host0\"" "stb2_2 1626006833652 2147483647i32 host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_2, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_2, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -89,8 +85,8 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -89,8 +85,8 @@ void verify_telnet_insert(TAOS* taos) {
//bigint //bigint
char* lines2_3[] = { char* lines2_3[] = {
"stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"", "stb2_3 1626006833651 -9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"" "stb2_3 1626006833652 9223372036854775807i64 host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_3, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_3, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -101,16 +97,16 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -101,16 +97,16 @@ void verify_telnet_insert(TAOS* taos) {
//float //float
char* lines2_4[] = { char* lines2_4[] = {
"stb2_4 1626006833610ms 3f32 host=\"host0\"", "stb2_4 1626006833610 3f32 host=\"host0\"",
"stb2_4 1626006833620ms -3f32 host=\"host0\"", "stb2_4 1626006833620 -3f32 host=\"host0\"",
"stb2_4 1626006833630ms 3.4f32 host=\"host0\"", "stb2_4 1626006833630 3.4f32 host=\"host0\"",
"stb2_4 1626006833640ms -3.4f32 host=\"host0\"", "stb2_4 1626006833640 -3.4f32 host=\"host0\"",
"stb2_4 1626006833650ms 3.4E10f32 host=\"host0\"", "stb2_4 1626006833650 3.4E10f32 host=\"host0\"",
"stb2_4 1626006833660ms -3.4e10f32 host=\"host0\"", "stb2_4 1626006833660 -3.4e10f32 host=\"host0\"",
"stb2_4 1626006833670ms 3.4E+2f32 host=\"host0\"", "stb2_4 1626006833670 3.4E+2f32 host=\"host0\"",
"stb2_4 1626006833680ms -3.4e-2f32 host=\"host0\"", "stb2_4 1626006833680 -3.4e-2f32 host=\"host0\"",
"stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"", "stb2_4 1626006833700 3.4E38f32 host=\"host0\"",
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\"" "stb2_4 1626006833710 -3.4E38f32 host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_4, 10, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_4, 10, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -121,17 +117,17 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -121,17 +117,17 @@ void verify_telnet_insert(TAOS* taos) {
//double //double
char* lines2_5[] = { char* lines2_5[] = {
"stb2_5 1626006833610ms 3f64 host=\"host0\"", "stb2_5 1626006833610 3f64 host=\"host0\"",
"stb2_5 1626006833620ms -3f64 host=\"host0\"", "stb2_5 1626006833620 -3f64 host=\"host0\"",
"stb2_5 1626006833630ms 3.4f64 host=\"host0\"", "stb2_5 1626006833630 3.4f64 host=\"host0\"",
"stb2_5 1626006833640ms -3.4f64 host=\"host0\"", "stb2_5 1626006833640 -3.4f64 host=\"host0\"",
"stb2_5 1626006833650ms 3.4E10f64 host=\"host0\"", "stb2_5 1626006833650 3.4E10f64 host=\"host0\"",
"stb2_5 1626006833660ms -3.4e10f64 host=\"host0\"", "stb2_5 1626006833660 -3.4e10f64 host=\"host0\"",
"stb2_5 1626006833670ms 3.4E+2f64 host=\"host0\"", "stb2_5 1626006833670 3.4E+2f64 host=\"host0\"",
"stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"", "stb2_5 1626006833680 -3.4e-2f64 host=\"host0\"",
"stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"", "stb2_5 1626006833690 1.7E308f64 host=\"host0\"",
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\"", "stb2_5 1626006833700 -1.7E308f64 host=\"host0\"",
"stb2_5 1626006833710ms 3.15 host=\"host0\"" "stb2_5 1626006833710 3.15 host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_5, 11, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_5, 11, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -142,16 +138,16 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -142,16 +138,16 @@ void verify_telnet_insert(TAOS* taos) {
//bool //bool
char* lines2_6[] = { char* lines2_6[] = {
"stb2_6 1626006833610ms t host=\"host0\"", "stb2_6 1626006833610 t host=\"host0\"",
"stb2_6 1626006833620ms T host=\"host0\"", "stb2_6 1626006833620 T host=\"host0\"",
"stb2_6 1626006833630ms true host=\"host0\"", "stb2_6 1626006833630 true host=\"host0\"",
"stb2_6 1626006833640ms True host=\"host0\"", "stb2_6 1626006833640 True host=\"host0\"",
"stb2_6 1626006833650ms TRUE host=\"host0\"", "stb2_6 1626006833650 TRUE host=\"host0\"",
"stb2_6 1626006833660ms f host=\"host0\"", "stb2_6 1626006833660 f host=\"host0\"",
"stb2_6 1626006833670ms F host=\"host0\"", "stb2_6 1626006833670 F host=\"host0\"",
"stb2_6 1626006833680ms false host=\"host0\"", "stb2_6 1626006833680 false host=\"host0\"",
"stb2_6 1626006833690ms False host=\"host0\"", "stb2_6 1626006833690 False host=\"host0\"",
"stb2_6 1626006833700ms FALSE host=\"host0\"" "stb2_6 1626006833700 FALSE host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_6, 10, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_6, 10, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -162,9 +158,9 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -162,9 +158,9 @@ void verify_telnet_insert(TAOS* taos) {
//binary //binary
char* lines2_7[] = { char* lines2_7[] = {
"stb2_7 1626006833610ms \"binary_val.!@#$%^&*\" host=\"host0\"", "stb2_7 1626006833610 \"binary_val.!@#$%^&*\" host=\"host0\"",
"stb2_7 1626006833620ms \"binary_val.:;,./?|+-=\" host=\"host0\"", "stb2_7 1626006833620 \"binary_val.:;,./?|+-=\" host=\"host0\"",
"stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\"" "stb2_7 1626006833630 \"binary_val.()[]{}<>\" host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_7, 3, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_7, 3, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -175,8 +171,8 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -175,8 +171,8 @@ void verify_telnet_insert(TAOS* taos) {
//nchar //nchar
char* lines2_8[] = { char* lines2_8[] = {
"stb2_8 1626006833610ms L\"nchar_val数值一\" host=\"host0\"", "stb2_8 1626006833610 L\"nchar_val数值一\" host=\"host0\"",
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\"" "stb2_8 1626006833620 L\"nchar_val数值二\" host=\"host0\""
}; };
result = taos_schemaless_insert(taos, lines2_8, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines2_8, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -188,8 +184,8 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -188,8 +184,8 @@ void verify_telnet_insert(TAOS* taos) {
/* tags */ /* tags */
//tag value types //tag value types
char* lines3_0[] = { char* lines3_0[] = {
"stb3_0 1626006833610ms 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=\"binary_val_1\" t9=L\"标签值1\"", "stb3_0 1626006833610 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=\"binary_val_1\" t9=L\"标签值1\"",
"stb3_0 1626006833610ms 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\"" "stb3_0 1626006833610 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\""
}; };
result = taos_schemaless_insert(taos, lines3_0, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines3_0, 2, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
...@@ -200,9 +196,9 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -200,9 +196,9 @@ void verify_telnet_insert(TAOS* taos) {
//tag ID as child table name //tag ID as child table name
char* lines3_1[] = { char* lines3_1[] = {
"stb3_1 1626006833610ms 1 id=child_table1 host=host1", "stb3_1 1626006833610 1 id=child_table1 host=host1",
"stb3_1 1626006833610ms 2 host=host2 iD=child_table2", "stb3_1 1626006833610 2 host=host2 iD=child_table2",
"stb3_1 1626006833610ms 3 ID=child_table3 host=host3" "stb3_1 1626006833610 3 ID=child_table3 host=host3"
}; };
result = taos_schemaless_insert(taos, lines3_1, 3, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED); result = taos_schemaless_insert(taos, lines3_1, 3, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result); code = taos_errno(result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册