提交 aab9c55d 编写于 作者: C cpwu

fix case

上级 a08fdbb4
...@@ -20,7 +20,7 @@ class TDTestCase: ...@@ -20,7 +20,7 @@ class TDTestCase:
__sql = f"select cast({col_name} as bigint), {col_name} from {tbname}" __sql = f"select cast({col_name} as bigint), {col_name} from {tbname}"
tdSql.query(sql=__sql) tdSql.query(sql=__sql)
data_tb_col = [result[1] for result in tdSql.queryResult] data_tb_col = [result[1] for result in tdSql.queryResult]
for i in range(len(tdSql.queryRows)): for i in range(tdSql.queryRows):
tdSql.checkData( i, 0, None ) if data_tb_col[i] is None else tdSql.checkData( i, 0, int(data_tb_col[i]) ) tdSql.checkData( i, 0, None ) if data_tb_col[i] is None else tdSql.checkData( i, 0, int(data_tb_col[i]) )
def __range_to_bigint(self,cols,tables): def __range_to_bigint(self,cols,tables):
...@@ -32,7 +32,7 @@ class TDTestCase: ...@@ -32,7 +32,7 @@ class TDTestCase:
__sql = f"select cast({col_name} as timestamp), {col_name} from {tbname}" __sql = f"select cast({col_name} as timestamp), {col_name} from {tbname}"
tdSql.query(sql=__sql) tdSql.query(sql=__sql)
data_tb_col = [result[1] for result in tdSql.queryResult] data_tb_col = [result[1] for result in tdSql.queryResult]
for i in range(len(tdSql.queryRows)): for i in range(tdSql.queryRows):
if data_tb_col[i] is None: if data_tb_col[i] is None:
tdSql.checkData( i, 0 , None ) tdSql.checkData( i, 0 , None )
if col_name not in ["c2", "double"] or tbname != "t1" or i != 10: if col_name not in ["c2", "double"] or tbname != "t1" or i != 10:
...@@ -597,37 +597,37 @@ class TDTestCase: ...@@ -597,37 +597,37 @@ class TDTestCase:
tdLog.printNoPrefix("==========step39: cast constant operation to bigint, expect change to int ") tdLog.printNoPrefix("==========step39: cast constant operation to bigint, expect change to int ")
tdSql.query("select cast(12121.23323131 as bigint) as b from ct4") tdSql.query("select cast(12121.23323131 as bigint) as b from ct4")
( tdSql.checkData(i, 0, 12121) for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, 12121) for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 as binary(16)) as b from ct4") tdSql.query("select cast(12121.23323131 as binary(16)) as b from ct4")
( tdSql.checkData(i, 0, '12121.233231') for i in range(len(tdSql.queryRows)) ) ( tdSql.checkData(i, 0, '12121.233231') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 as binary(2)) as b from ct4") tdSql.query("select cast(12121.23323131 as binary(2)) as b from ct4")
( tdSql.checkData(i, 0, '12') for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, '12') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 as nchar(16)) as b from ct4") tdSql.query("select cast(12121.23323131 as nchar(16)) as b from ct4")
( tdSql.checkData(i, 0, '12121.233231') for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, '12121.233231') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 as nchar(2)) as b from ct4") tdSql.query("select cast(12121.23323131 as nchar(2)) as b from ct4")
( tdSql.checkData(i, 0, '12') for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, '12') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 321.876897998 as bigint) as b from ct4") tdSql.query("select cast(12121.23323131 + 321.876897998 as bigint) as b from ct4")
( tdSql.checkData(i, 0, 12443) for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, 12443) for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 321.876897998 as binary(16)) as b from ct4") tdSql.query("select cast(12121.23323131 + 321.876897998 as binary(16)) as b from ct4")
( tdSql.checkData(i, 0, '12443.110129') for i in range(len(tdSql.queryRows)) ) ( tdSql.checkData(i, 0, '12443.110129') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 321.876897998 as binary(3)) as b from ct4") tdSql.query("select cast(12121.23323131 + 321.876897998 as binary(3)) as b from ct4")
( tdSql.checkData(i, 0, '124') for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, '124') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 321.876897998 as nchar(16)) as b from ct4") tdSql.query("select cast(12121.23323131 + 321.876897998 as nchar(16)) as b from ct4")
( tdSql.checkData(i, 0, '12443.110129') for i in range(len(tdSql.queryRows)) ) ( tdSql.checkData(i, 0, '12443.110129') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 321.876897998 as nchar(3)) as b from ct4") tdSql.query("select cast(12121.23323131 + 321.876897998 as nchar(3)) as b from ct4")
( tdSql.checkData(i, 0, '124') for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, '124') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as bigint) as b from ct4") tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as bigint) as b from ct4")
( tdSql.checkData(i, 0, 12121) for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, 12121) for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as binary(16)) as b from ct4") tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as binary(16)) as b from ct4")
( tdSql.checkData(i, 0, '12121.233231') for i in range(len(tdSql.queryRows)) ) ( tdSql.checkData(i, 0, '12121.233231') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as binary(2)) as b from ct4") tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as binary(2)) as b from ct4")
( tdSql.checkData(i, 0, '12') for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, '12') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as nchar(16)) as b from ct4") tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as nchar(16)) as b from ct4")
( tdSql.checkData(i, 0, '12121.233231') for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, '12121.233231') for i in range(tdSql.queryRows) )
tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as nchar(2)) as b from ct4") tdSql.query("select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as nchar(2)) as b from ct4")
( tdSql.checkData(i, 0, '12') for i in range(len(tdSql.queryRows) ) ) ( tdSql.checkData(i, 0, '12') for i in range(tdSql.queryRows) )
tdLog.printNoPrefix("==========step40: error cast condition, should return error ") tdLog.printNoPrefix("==========step40: error cast condition, should return error ")
tdSql.error("select cast(c1 as int) as b from ct4") tdSql.error("select cast(c1 as int) as b from ct4")
......
...@@ -232,13 +232,13 @@ class TDTestCase: ...@@ -232,13 +232,13 @@ class TDTestCase:
tdLog.printNoPrefix("==========step3:all check") tdLog.printNoPrefix("==========step3:all check")
self.all_test() self.all_test()
# tdDnodes.stop(1) tdDnodes.stop(1)
# tdDnodes.start(1) tdDnodes.start(1)
# tdSql.execute("use db") tdSql.execute("use db")
# tdLog.printNoPrefix("==========step4:after wal, all check again ") tdLog.printNoPrefix("==========step4:after wal, all check again ")
# self.all_test() self.all_test()
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -14,6 +14,9 @@ python3 ./test.py -f 2-query/varchar.py ...@@ -14,6 +14,9 @@ python3 ./test.py -f 2-query/varchar.py
python3 ./test.py -f 2-query/ltrim.py python3 ./test.py -f 2-query/ltrim.py
python3 ./test.py -f 2-query/rtrim.py python3 ./test.py -f 2-query/rtrim.py
python3 ./test.py -f 2-query/length.py python3 ./test.py -f 2-query/length.py
python3 ./test.py -f 2-query/char_length.py
python3 ./test.py -f 2-query/upper.py
python3 ./test.py -f 2-query/lower.py
python3 ./test.py -f 2-query/timezone.py python3 ./test.py -f 2-query/timezone.py
python3 ./test.py -f 2-query/Now.py python3 ./test.py -f 2-query/Now.py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册