This commit is contained in:
cpwu 2022-05-28 20:00:55 +08:00
parent 55e464d3ab
commit e92623967d
1 changed files with 16 additions and 14 deletions

View File

@ -33,11 +33,10 @@ class TDTestCase:
tdSql.init(conn.cursor())
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:
query_condition.extend(
(
f"{tbname}.{num_col}",
f"abs( {tbname}.{num_col} )",
f"acos( {tbname}.{num_col} )",
f"asin( {tbname}.{num_col} )",
@ -63,18 +62,19 @@ class TDTestCase:
for char_col in CHAR_COL:
query_condition.extend(
(
f"count({tbname}.{char_col})",
f"sum(cast({tbname}.{char_col}) as bigint)",
f"max(cast({tbname}.{char_col}) as bigint)",
f"min(cast({tbname}.{char_col}) as bigint)",
f"avg(cast({tbname}.{char_col}) as bigint)",
)
)
# query_condition.extend(
# (
# 1010,
# )
# )
query_condition.extend(
(
1010,
''' "test1234!@#$%^&*():'><?/.,][}{" ''',
"null"
)
)
return query_condition
@ -126,7 +126,7 @@ class TDTestCase:
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]:
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
def __tb_list(self):
@ -219,11 +219,13 @@ class TDTestCase:
def __test_error(self):
tdLog.printNoPrefix("===step 0: err case, must return err")
tdSql.error( "select hyperloglog() from ct1" )
tdSql.error( "select hyperloglog(c1, c2) from ct2" )
tdSql.error( "select hyperloglog(1) from ct2" )
tdSql.error( f"select hyperloglog({NUM_COL[0]}, {NUM_COL[1]}) from ct4" )
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( "select hyperloglog(c1) from ct8" )
tdSql.error( "explain show databases " )
tdSql.error( "explain show stables " )
tdSql.error( "explain show tables " )
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
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']