提交 e9262396 编写于 作者: C cpwu

fix case

上级 55e464d3
...@@ -33,11 +33,10 @@ class TDTestCase: ...@@ -33,11 +33,10 @@ class TDTestCase:
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
def __query_condition(self,tbname): def __query_condition(self,tbname):
query_condition = [f"cast({col} as bigint)" for col in ALL_COL] query_condition = [f"{tbname}.{col}" for col in ALL_COL]
for num_col in NUM_COL: for num_col in NUM_COL:
query_condition.extend( query_condition.extend(
( (
f"{tbname}.{num_col}",
f"abs( {tbname}.{num_col} )", f"abs( {tbname}.{num_col} )",
f"acos( {tbname}.{num_col} )", f"acos( {tbname}.{num_col} )",
f"asin( {tbname}.{num_col} )", f"asin( {tbname}.{num_col} )",
...@@ -63,18 +62,19 @@ class TDTestCase: ...@@ -63,18 +62,19 @@ class TDTestCase:
for char_col in CHAR_COL: for char_col in CHAR_COL:
query_condition.extend( query_condition.extend(
( (
f"count({tbname}.{char_col})",
f"sum(cast({tbname}.{char_col}) as bigint)", f"sum(cast({tbname}.{char_col}) as bigint)",
f"max(cast({tbname}.{char_col}) as bigint)", f"max(cast({tbname}.{char_col}) as bigint)",
f"min(cast({tbname}.{char_col}) as bigint)", f"min(cast({tbname}.{char_col}) as bigint)",
f"avg(cast({tbname}.{char_col}) as bigint)", f"avg(cast({tbname}.{char_col}) as bigint)",
) )
) )
# query_condition.extend( query_condition.extend(
# ( (
# 1010, 1010,
# ) ''' "test1234!@#$%^&*():'><?/.,][}{" ''',
# ) "null"
)
)
return query_condition return query_condition
...@@ -126,7 +126,7 @@ class TDTestCase: ...@@ -126,7 +126,7 @@ class TDTestCase:
def __single_sql(self, select_clause, from_clause, where_condition="", group_condition=""): def __single_sql(self, select_clause, from_clause, where_condition="", group_condition=""):
if isinstance(select_clause, str) and "on" not in from_clause and select_clause.split(".")[0].split("(")[-1] != from_clause.split(".")[0]: if isinstance(select_clause, str) and "on" not in from_clause and select_clause.split(".")[0].split("(")[-1] != from_clause.split(".")[0]:
return return
return f"select hyperloglog({select_clause}) from {from_clause} {where_condition} {group_condition}" return f"explain select {select_clause} from {from_clause} {where_condition} {group_condition}"
@property @property
def __tb_list(self): def __tb_list(self):
...@@ -219,11 +219,13 @@ class TDTestCase: ...@@ -219,11 +219,13 @@ class TDTestCase:
def __test_error(self): def __test_error(self):
tdLog.printNoPrefix("===step 0: err case, must return err") tdLog.printNoPrefix("===step 0: err case, must return err")
tdSql.error( "select hyperloglog() from ct1" ) tdSql.error( "select hyperloglog(c1) from ct8" )
tdSql.error( "select hyperloglog(c1, c2) from ct2" ) tdSql.error( "explain show databases " )
tdSql.error( "select hyperloglog(1) from ct2" ) tdSql.error( "explain show stables " )
tdSql.error( f"select hyperloglog({NUM_COL[0]}, {NUM_COL[1]}) from ct4" ) tdSql.error( "explain show tables " )
tdSql.error( ''' select hyperloglog(['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10']) tdSql.error( "explain show vgroups " )
tdSql.error( "explain show dnodes " )
tdSql.error( '''explain select hyperloglog(['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'])
from ct1 from ct1
where ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'] is not null where ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'] is not null
group by ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'] group by ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10']
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册