提交 fc7f9d5a 编写于 作者: J jiajingbin

save

上级 167b4aaa
...@@ -397,7 +397,7 @@ class TDTestCase: ...@@ -397,7 +397,7 @@ class TDTestCase:
col_dict = self.genMulTagColDict("col", 1, value_type) col_dict = self.genMulTagColDict("col", 1, value_type)
tag_dict["id"] = tb_name tag_dict["id"] = tb_name
ts_dict = {'value': 1626006833639000000, 'type': 'ns'} ts_dict = {'value': 1626006833639000000, 'type': 'ns'}
long_json = {"metric": f"{stb_name}", "timestamp": ts_dict, "value": col_dict, "tags": tag_dict} long_json = {"metric": stb_name, "timestamp": ts_dict, "value": col_dict, "tags": tag_dict}
return long_json, stb_name return long_json, stb_name
def getNoIdTbName(self, stb_name): def getNoIdTbName(self, stb_name):
...@@ -626,73 +626,81 @@ class TDTestCase: ...@@ -626,73 +626,81 @@ class TDTestCase:
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def tagValueLengthCheckCase(self): def tagValueLengthCheckCase(self, value_type="obj"):
""" """
check full type tag value limit check full type tag value limit
""" """
tdCom.cleanTb() tdCom.cleanTb()
# i8 # i8
for t1 in [-127, 127]: for t1 in [-127, 127]:
input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t1_value=t1)) input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t1_value=t1, value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
for t1 in [-128, 128]: for t1 in [-128, 128]:
input_json = self.genFullTypeJson(tag_value=self.genTagValue(t1_value=t1))[0] input_json = self.genFullTypeJson(tag_value=self.genTagValue(t1_value=t1))[0]
print(input_json)
try: try:
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
#i16 #i16
for t2 in [-32767, 32767]: for t2 in [-32767, 32767]:
input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t2_value=t2)) input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t2_value=t2, value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
for t2 in [-32768, 32768]: for t2 in [-32768, 32768]:
input_json = self.genFullTypeJson(tag_value=self.genTagValue(t2_value=t2))[0] input_json = self.genFullTypeJson(tag_value=self.genTagValue(t2_value=t2))[0]
try: try:
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
#i32 #i32
for t3 in [-2147483647, 2147483647]: for t3 in [-2147483647, 2147483647]:
input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t3_value=t3)) input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t3_value=t3, value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
for t3 in [-2147483648, 2147483648]: for t3 in [-2147483648, 2147483648]:
input_json = self.genFullTypeJson(tag_value=self.genTagValue(t3_value=t3))[0] input_json = self.genFullTypeJson(tag_value=self.genTagValue(t3_value=t3))[0]
try: try:
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# #i64 #! json bug #i64
# for t4 in [-9223372036854775807, 9223372036854775807]: for t4 in [-9223372036854775807, 9223372036854775807]:
# input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t4_value=t4)) input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t4_value=t4, value_type=value_type))
# print(input_json) print(input_json)
# self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
for t4 in [-9223372036854775808, 9223372036854775808]: for t4 in [-9223372036854775808, 9223372036854775808]:
input_json = self.genFullTypeJson(tag_value=self.genTagValue(t4_value=t4))[0] input_json = self.genFullTypeJson(tag_value=self.genTagValue(t4_value=t4, value_type=value_type))[0]
try:
self._conn.insert_lines([json.dumps(input_json)], 2)
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# f32
for t5 in [-3.4028234663852885981170418348451692544*(10**38), 3.4028234663852885981170418348451692544*(10**38)]:
input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t5_value=t5))
self.resCmp(input_json, stb_name)
# * limit set to 3.4028234664*(10**38)
for t5 in [-3.4028234664*(10**38), 3.4028234664*(10**38)]:
input_json = self.genFullTypeJson(tag_value=self.genTagValue(t5_value=t5))[0]
try: try:
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# ! bug
# # f32
# for t5 in [-3.4028234663852885981170418348451692544*(10**38), 3.4028234663852885981170418348451692544*(10**38)]:
# input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t5_value=t5, value_type=value_type))
# self.resCmp(input_json, stb_name)
# # * limit set to 3.4028234664*(10**38)
# for t5 in [-3.4028234664*(10**38), 3.4028234664*(10**38)]:
# input_json = self.genFullTypeJson(tag_value=self.genTagValue(t5_value=t5, value_type=value_type))[0]
# print(input_json)
# try:
# self._conn.insert_lines([json.dumps(input_json)], 2)
# raise Exception("should not reach here")
# except LinesError as err:
# tdSql.checkNotEqual(err.errno, 0)
# f64 # f64
for t6 in [-1.79769*(10**308), -1.79769*(10**308)]: for t6 in [-1.79769*(10**308), -1.79769*(10**308)]:
input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t6_value=t6)) input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t6_value=t6, value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
for t6 in [float(-1.797693134862316*(10**308)), -1.797693134862316*(10**308)]: for t6 in [float(-1.797693134862316*(10**308)), -1.797693134862316*(10**308)]:
input_json = self.genFullTypeJson(tag_value=self.genTagValue(t6_value=t6))[0] input_json = self.genFullTypeJson(tag_value=self.genTagValue(t6_value=t6))[0]
...@@ -702,39 +710,56 @@ class TDTestCase: ...@@ -702,39 +710,56 @@ class TDTestCase:
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# binary if value_type == "obj":
stb_name = tdCom.getLongName(7, "letters") # binary
input_json = {"metric": f"{stb_name}", "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': True, 'type': 'bool'}, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1":{'value': tdCom.getLongName(16374, "letters"), 'type': 'binary'}}} stb_name = tdCom.getLongName(7, "letters")
self._conn.insert_lines([json.dumps(input_json)], 2) input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': True, 'type': 'bool'}, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1":{'value': tdCom.getLongName(16374, "letters"), 'type': 'binary'}}}
input_json = {"metric": f"{stb_name}", "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': True, 'type': 'bool'}, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1":{'value': tdCom.getLongName(16375, "letters"), 'type': 'binary'}}}
try:
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err: input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': True, 'type': 'bool'}, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1":{'value': tdCom.getLongName(16375, "letters"), 'type': 'binary'}}}
tdSql.checkNotEqual(err.errno, 0) try:
self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# # nchar # # nchar
# # * legal nchar could not be larger than 16374/4 # # * legal nchar could not be larger than 16374/4
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
input_json = {"metric": f"{stb_name}", "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': True, 'type': 'bool'}, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1":{'value': tdCom.getLongName(4093, "letters"), 'type': 'nchar'}}} input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': True, 'type': 'bool'}, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1":{'value': tdCom.getLongName(4093, "letters"), 'type': 'nchar'}}}
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
input_json = {"metric": f"{stb_name}", "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': True, 'type': 'bool'}, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1":{'value': tdCom.getLongName(4094, "letters"), 'type': 'nchar'}}} input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': True, 'type': 'bool'}, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1":{'value': tdCom.getLongName(4094, "letters"), 'type': 'nchar'}}}
try: try:
self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
elif value_type == "default":
stb_name = tdCom.getLongName(7, "letters")
if tdSql.getVariable("defaultJSONStrType")[0].lower() == "binary":
input_json = {"metric": stb_name, "timestamp": 1626006833639019, "value": True, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1": tdCom.getLongName(16374, "letters")}}
elif tdSql.getVariable("defaultJSONStrType")[0].lower() == "nchar":
input_json = {"metric": stb_name, "timestamp": 1626006833639019, "value": True, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1": tdCom.getLongName(4093, "letters")}}
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here") if tdSql.getVariable("defaultJSONStrType")[0].lower() == "binary":
except LinesError as err: input_json = {"metric": stb_name, "timestamp": 1626006833639019, "value": True, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1": tdCom.getLongName(16375, "letters")}}
tdSql.checkNotEqual(err.errno, 0) elif tdSql.getVariable("defaultJSONStrType")[0].lower() == "nchar":
input_json = {"metric": stb_name, "timestamp": 1626006833639019, "value": True, "tags": {"t0": {'value': True, 'type': 'bool'}, "t1": tdCom.getLongName(4094, "letters")}}
try:
self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def colValueLengthCheckCase(self): def colValueLengthCheckCase(self, value_type="obj"):
""" """
check full type col value limit check full type col value limit
""" """
tdCom.cleanTb() tdCom.cleanTb()
# i8 # i8
for value in [-127, 127]: for value in [-127, 127]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="tinyint")) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="tinyint", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
tdCom.cleanTb() tdCom.cleanTb()
for value in [-128, 128]: for value in [-128, 128]:
...@@ -747,7 +772,7 @@ class TDTestCase: ...@@ -747,7 +772,7 @@ class TDTestCase:
# i16 # i16
tdCom.cleanTb() tdCom.cleanTb()
for value in [-32767]: for value in [-32767]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="smallint")) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="smallint", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
tdCom.cleanTb() tdCom.cleanTb()
for value in [-32768, 32768]: for value in [-32768, 32768]:
...@@ -761,7 +786,7 @@ class TDTestCase: ...@@ -761,7 +786,7 @@ class TDTestCase:
# i32 # i32
tdCom.cleanTb() tdCom.cleanTb()
for value in [-2147483647]: for value in [-2147483647]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="int")) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="int", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
tdCom.cleanTb() tdCom.cleanTb()
for value in [-2147483648, 2147483648]: for value in [-2147483648, 2147483648]:
...@@ -772,26 +797,24 @@ class TDTestCase: ...@@ -772,26 +797,24 @@ class TDTestCase:
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i64 #! json bug # i64
# tdCom.cleanTb() tdCom.cleanTb()
# for value in [-9223372036854775807]: for value in [-9223372036854775807]:
# input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="bigint")) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="bigint", value_type=value_type))
# print("input_json---", input_json) self.resCmp(input_json, stb_name)
# self.resCmp(input_json, stb_name) tdCom.cleanTb()
# tdCom.cleanTb() for value in [-9223372036854775808, 9223372036854775808]:
# for value in [-9223372036854775808, 9223372036854775808]: input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="bigint", value_type=value_type))[0]
# input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="bigint"))[0] try:
# try: self._conn.insert_lines([json.dumps(input_json)], 2)
# self._conn.insert_lines([json.dumps(input_json)], 2) raise Exception("should not reach here")
# raise Exception("should not reach here") except LinesError as err:
# except LinesError as err: tdSql.checkNotEqual(err.errno, 0)
# tdSql.checkNotEqual(err.errno, 0)
# f32 # f32
tdCom.cleanTb() tdCom.cleanTb()
for value in [-3.4028234663852885981170418348451692544*(10**38), 3.4028234663852885981170418348451692544*(10**38)]: for value in [-3.4028234663852885981170418348451692544*(10**38), 3.4028234663852885981170418348451692544*(10**38)]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="float")) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="float", value_type=value_type))
print(input_json)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
# * limit set to 4028234664*(10**38) # * limit set to 4028234664*(10**38)
tdCom.cleanTb() tdCom.cleanTb()
...@@ -803,51 +826,73 @@ class TDTestCase: ...@@ -803,51 +826,73 @@ class TDTestCase:
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f64 # f64 #! bug
tdCom.cleanTb() # tdCom.cleanTb()
for value in [-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308), -1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)]: # for value in [-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308), -1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="double")) # input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="double", value_type=value_type))
self.resCmp(input_json, stb_name) # print("value_type----", value_type)
# print("input_json----", input_json)
# self.resCmp(input_json, stb_name)
# * limit set to 1.797693134862316*(10**308) # * limit set to 1.797693134862316*(10**308)
tdCom.cleanTb() tdCom.cleanTb()
for value in [-1.797693134862316*(10**308), -1.797693134862316*(10**308)]: for value in [-1.797693134862316*(10**308), -1.797693134862316*(10**308)]:
input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="double"))[0] input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="double", value_type=value_type))[0]
try: try:
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except LinesError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# binary if value_type == "obj":
tdCom.cleanTb() # binary
stb_name = tdCom.getLongName(7, "letters") tdCom.cleanTb()
input_json = {"metric": f"{stb_name}", "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(16374, "letters"), 'type': 'binary'}, "tags": {"t0": {'value': True, 'type': 'bool'}}} stb_name = tdCom.getLongName(7, "letters")
self._conn.insert_lines([json.dumps(input_json)], 2) input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(16374, "letters"), 'type': 'binary'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
tdCom.cleanTb()
input_json = {"metric": f"{stb_name}", "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(16375, "letters"), 'type': 'binary'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
try:
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err: tdCom.cleanTb()
tdSql.checkNotEqual(err.errno, 0) input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(16375, "letters"), 'type': 'binary'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
try:
self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# nchar # nchar
# * legal nchar could not be larger than 16374/4 # * legal nchar could not be larger than 16374/4
tdCom.cleanTb() tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
input_json = {"metric": f"{stb_name}", "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(4093, "letters"), 'type': 'nchar'}, "tags": {"t0": {'value': True, 'type': 'bool'}}} input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(4093, "letters"), 'type': 'nchar'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
tdCom.cleanTb() tdCom.cleanTb()
input_json = {"metric": f"{stb_name}", "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(4094, "letters"), 'type': 'nchar'}, "tags": {"t0": {'value': True, 'type': 'bool'}}} input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(4094, "letters"), 'type': 'nchar'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
try: try:
self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
elif value_type == "default":
# binary
tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters")
if tdSql.getVariable("defaultJSONStrType")[0].lower() == "binary":
input_json = {"metric": stb_name, "timestamp": 1626006833639019, "value": tdCom.getLongName(16374, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}}
elif tdSql.getVariable("defaultJSONStrType")[0].lower() == "nchar":
input_json = {"metric": stb_name, "timestamp": 1626006833639019, "value": tdCom.getLongName(4093, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}}
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here") tdCom.cleanTb()
except LinesError as err: if tdSql.getVariable("defaultJSONStrType")[0].lower() == "binary":
tdSql.checkNotEqual(err.errno, 0) input_json = {"metric": stb_name, "timestamp": 1626006833639019, "value": tdCom.getLongName(16375, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}}
elif tdSql.getVariable("defaultJSONStrType")[0].lower() == "nchar":
input_json = {"metric": stb_name, "timestamp": 1626006833639019, "value": tdCom.getLongName(4094, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}}
try:
self._conn.insert_lines([json.dumps(input_json)], 2)
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def tagColIllegalValueCheckCase(self): def tagColIllegalValueCheckCase(self, value_type="obj"):
""" """
test illegal tag col value test illegal tag col value
...@@ -879,21 +924,21 @@ class TDTestCase: ...@@ -879,21 +924,21 @@ class TDTestCase:
# check binary and nchar blank # check binary and nchar blank
input_sql1 = self.genFullTypeJson(col_value=self.genTsColValue(value="abc aaa", t_type="binary"))[0] input_sql1 = self.genFullTypeJson(col_value=self.genTsColValue(value="abc aaa", t_type="binary", value_type=value_type))[0]
input_sql2 = self.genFullTypeJson(col_value=self.genTsColValue(value="abc aaa", t_type="nchar"))[0] input_sql2 = self.genFullTypeJson(col_value=self.genTsColValue(value="abc aaa", t_type="nchar", value_type=value_type))[0]
input_sql3 = self.genFullTypeJson(tag_value=self.genTagValue(t7_value="abc aaa"))[0] input_sql3 = self.genFullTypeJson(tag_value=self.genTagValue(t7_value="abc aaa", value_type=value_type))[0]
input_sql4 = self.genFullTypeJson(tag_value=self.genTagValue(t8_value="abc aaa"))[0] input_sql4 = self.genFullTypeJson(tag_value=self.genTagValue(t8_value="abc aaa", value_type=value_type))[0]
for input_json in [input_sql1, input_sql2, input_sql3, input_sql4]: for input_json in [input_sql1, input_sql2, input_sql3, input_sql4]:
try: try:
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
except LinesError as err: except LinesError as err:
pass tdSql.checkNotEqual(err.errno, 0)
# check accepted binary and nchar symbols # check accepted binary and nchar symbols
# # * ~!@#$¥%^&*()-+={}|[]、「」:; # # * ~!@#$¥%^&*()-+={}|[]、「」:;
for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'): for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'):
input_json1 = self.genFullTypeJson(col_value=self.genTsColValue(value=f"abc{symbol}aaa", t_type="binary"))[0] input_json1 = self.genFullTypeJson(col_value=self.genTsColValue(value=f"abc{symbol}aaa", t_type="binary", value_type=value_type))[0]
input_json2 = self.genFullTypeJson(tag_value=self.genTagValue(t8_value=f"abc{symbol}aaa"))[0] input_json2 = self.genFullTypeJson(tag_value=self.genTagValue(t8_value=f"abc{symbol}aaa", value_type=value_type))[0]
self._conn.insert_lines([json.dumps(input_json1)], 2) self._conn.insert_lines([json.dumps(input_json1)], 2)
self._conn.insert_lines([json.dumps(input_json2)], 2) self._conn.insert_lines([json.dumps(input_json2)], 2)
...@@ -1060,7 +1105,7 @@ class TDTestCase: ...@@ -1060,7 +1105,7 @@ class TDTestCase:
tag_value = {"t0": {"value": True, "type": "bool"}} tag_value = {"t0": {"value": True, "type": "bool"}}
tag_value["id"] = tb_name tag_value["id"] = tb_name
col_value=self.genTsColValue(value=True, t_type="bool") col_value=self.genTsColValue(value=True, t_type="bool")
input_json = {"metric": f"{stb_name}", "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": col_value, "tags": tag_value} input_json = {"metric": stb_name, "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": col_value, "tags": tag_value}
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
# * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2 # * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2
...@@ -1091,7 +1136,7 @@ class TDTestCase: ...@@ -1091,7 +1136,7 @@ class TDTestCase:
tag_value = {"t0": {"value": True, "type": "bool"}} tag_value = {"t0": {"value": True, "type": "bool"}}
tag_value["id"] = tb_name tag_value["id"] = tb_name
col_value=self.genTsColValue(value=True, t_type="bool") col_value=self.genTsColValue(value=True, t_type="bool")
input_json = {"metric": f"{stb_name}", "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": col_value, "tags": tag_value} input_json = {"metric": stb_name, "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": col_value, "tags": tag_value}
self._conn.insert_lines([json.dumps(input_json)], 2) self._conn.insert_lines([json.dumps(input_json)], 2)
# * legal nchar could not be larger than 16374/4 # * legal nchar could not be larger than 16374/4
...@@ -1528,9 +1573,9 @@ class TDTestCase: ...@@ -1528,9 +1573,9 @@ class TDTestCase:
self.nowTsCheckCase(value_type) self.nowTsCheckCase(value_type)
self.dateFormatTsCheckCase(value_type) self.dateFormatTsCheckCase(value_type)
self.illegalTsCheckCase(value_type) self.illegalTsCheckCase(value_type)
# self.tagValueLengthCheckCase() self.tagValueLengthCheckCase(value_type)
# self.colValueLengthCheckCase() self.colValueLengthCheckCase(value_type)
# self.tagColIllegalValueCheckCase() self.tagColIllegalValueCheckCase(value_type)
# #! bug # #! bug
# self.duplicateIdTagColInsertCheckCase() # self.duplicateIdTagColInsertCheckCase()
# self.noIdStbExistCheckCase() # self.noIdStbExistCheckCase()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册