q_where=['ts < now +1s','q_bigint >= -9223372036854775807 and q_bigint <= 9223372036854775807','q_int <= 2147483647 and q_int >= -2147483647',
'q_smallint >= -32767 and q_smallint <= 32767','q_tinyint >= -127 and q_tinyint <= 127','q_float >= -100000 and q_float <= 100000',
'q_double >= -1000000000 and q_double <= 1000000000','q_binary like \'binary%\' or q_binary = \'0\' ','q_nchar like \'nchar%\' or q_nchar = \'0\' ',
'q_bool = true or q_bool = false','q_bool in (0 , 1)','q_bool in ( true , false)','q_bool = 0 or q_bool = 1',
'q_bigint between -9223372036854775807 and 9223372036854775807',' q_int between -2147483647 and 2147483647','q_smallint between -32767 and 32767',
'q_tinyint between -127 and 127 ','q_float between -100000 and 100000','q_double between -1000000000 and 1000000000']
#TD-6201 ,'q_bool between 0 and 1'
# regular column where for test union,join
q_u_where=['t1.ts < now +1s','t2.ts < now +1s','t1.q_bigint >= -9223372036854775807 and t1.q_bigint <= 9223372036854775807 and t2.q_bigint >= -9223372036854775807 and t2.q_bigint <= 9223372036854775807',
't1.q_int <= 2147483647 and t1.q_int >= -2147483647 and t2.q_int <= 2147483647 and t2.q_int >= -2147483647',
't1.q_smallint >= -32767 and t1.q_smallint <= 32767 and t2.q_smallint >= -32767 and t2.q_smallint <= 32767',
't1.q_tinyint >= -127 and t1.q_tinyint <= 127 and t2.q_tinyint >= -127 and t2.q_tinyint <= 127',
't1.q_float >= -100000 and t1.q_float <= 100000 and t2.q_float >= -100000 and t2.q_float <= 100000',
't1.q_double >= -1000000000 and t1.q_double <= 1000000000 and t2.q_double >= -1000000000 and t2.q_double <= 1000000000',
't1.q_binary like \'binary%\' or t1.q_binary = \'0\' or t2.q_binary like \'binary%\' or t2.q_binary = \'0\' ',
't1.q_nchar like \'nchar%\' or t1.q_nchar = \'0\' or t2.q_nchar like \'nchar%\' or t2.q_nchar = \'0\' ','t1.q_bool = true or t1.q_bool = false or t2.q_bool = true or t2.q_bool = false',
't1.q_bool in (0 , 1) or t2.q_bool in (0 , 1)','t1.q_bool in ( true , false) or t2.q_bool in ( true , false)','t1.q_bool = 0 or t1.q_bool = 1 or t2.q_bool = 0 or t2.q_bool = 1',
't1.q_bigint between -9223372036854775807 and 9223372036854775807 or t2.q_bigint between -9223372036854775807 and 9223372036854775807',
't1.q_int between -2147483647 and 2147483647 or t2.q_int between -2147483647 and 2147483647',
't1.q_smallint between -32767 and 32767 or t2.q_smallint between -32767 and 32767',
't1.q_tinyint between -127 and 127 or t2.q_tinyint between -127 and 127 ','t1.q_float between -100000 and 100000 or t2.q_float between -100000 and 100000',
't1.q_double between -1000000000 and 1000000000 or t2.q_double between -1000000000 and 1000000000']
#TD-6201 ,'t1.q_bool between 0 and 1 or t2.q_bool between 0 and 1']
# tag column where
t_where=['ts < now +1s','t_bigint >= -9223372036854775807 and t_bigint <= 9223372036854775807','t_int <= 2147483647 and t_int >= -2147483647',
't_smallint >= -32767 and t_smallint <= 32767','q_tinyint >= -127 and t_tinyint <= 127','t_float >= -100000 and t_float <= 100000',
't_double >= -1000000000 and t_double <= 1000000000','t_binary like \'binary%\' or t_binary = \'0\' ','t_nchar like \'nchar%\' or t_nchar = \'0\'',
't_bool = true or t_bool = false','t_bool in (0 , 1)','t_bool in ( true , false)','t_bool = 0 or t_bool = 1',
't_bigint between -9223372036854775807 and 9223372036854775807',' t_int between -2147483647 and 2147483647','t_smallint between -32767 and 32767',
't_tinyint between -127 and 127 ','t_float between -100000 and 100000','t_double between -1000000000 and 1000000000']
#TD-6201,'t_bool between 0 and 1'
# tag column where for test union,join | this is not support
t_u_where=['t1.ts < now +1s','t2.ts < now +1s','t1.t_bigint >= -9223372036854775807 and t1.t_bigint <= 9223372036854775807 and t2.t_bigint >= -9223372036854775807 and t2.t_bigint <= 9223372036854775807',
't1.t_int <= 2147483647 and t1.t_int >= -2147483647 and t2.t_int <= 2147483647 and t2.t_int >= -2147483647',
't1.t_smallint >= -32767 and t1.t_smallint <= 32767 and t2.t_smallint >= -32767 and t2.t_smallint <= 32767',
't1.t_tinyint >= -127 and t1.t_tinyint <= 127 and t2.t_tinyint >= -127 and t2.t_tinyint <= 127',
't1.t_float >= -100000 and t1.t_float <= 100000 and t2.t_float >= -100000 and t2.t_float <= 100000',
't1.t_double >= -1000000000 and t1.t_double <= 1000000000 and t2.t_double >= -1000000000 and t2.t_double <= 1000000000',
't1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\' ',
't1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' ','t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false',
't1.t_bool in (0 , 1) or t2.t_bool in (0 , 1)','t1.t_bool in ( true , false) or t2.t_bool in ( true , false)','t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1',
't1.t_bigint between -9223372036854775807 and 9223372036854775807 or t2.t_bigint between -9223372036854775807 and 9223372036854775807',
't1.t_int between -2147483647 and 2147483647 or t2.t_int between -2147483647 and 2147483647',
't1.t_smallint between -32767 and 32767 or t2.t_smallint between -32767 and 32767',
't1.t_tinyint between -127 and 127 or t2.t_tinyint between -127 and 127 ','t1.t_float between -100000 and 100000 or t2.t_float between -100000 and 100000',
't1.t_double between -1000000000 and 1000000000 or t2.t_double between -1000000000 and 1000000000']
#TD-6201,'t1.t_bool between 0 and 1 or t2.q_bool between 0 and 1']
# regular and tag column where
qt_where=q_where+t_where
qt_u_where=q_u_where+t_u_where
# tag column where for test super join | this is support , 't1.t_bool = t2.t_bool ' ???
order_u_where=['order by t1.ts','order by t1.ts asc','order by t2.ts','order by t2.ts asc']
order_desc_where=['order by ts','order by ts asc','order by ts desc']
orders_desc_where=['order by ts','order by ts asc','order by ts desc','order by loc','order by loc asc','order by loc desc']
# group by where,not include null-tag
group_where=['group by tbname , loc','group by tbname','group by tbname, t_bigint','group by tbname,t_int','group by tbname, t_smallint','group by tbname,t_tinyint',
'group by tbname,t_float','group by tbname,t_double','group by tbname,t_binary','group by tbname,t_nchar','group by tbname,t_bool','group by tbname ,loc ,t_bigint',
'group by tbname,t_binary ,t_nchar ,t_bool','group by tbname,t_int ,t_smallint ,t_tinyint','group by tbname,t_float ,t_double ']
interp_where=['ts = now','ts = \'2020-09-13 20:26:40.000\'','ts = \'2020-09-13 20:26:40.009\'','tbname in (\'table_1\') and ts = now','tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and ts = \'2020-09-13 20:26:40.000\'','tbname like \'table%\' and ts = \'2020-09-13 20:26:40.002\'']
't1.tbname in (\'table_1\') and t1.ts = now','t1.tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and t1.ts = \'2020-09-13 20:26:40.000\'','t1.tbname like \'table%\' and t1.ts = \'2020-09-13 20:26:40.002\'',
't2.tbname in (\'table_1\') and t2.ts = now','t2.tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and t2.ts = \'2020-09-13 20:26:40.000\'','t2.tbname like \'table%\' and t2.ts = \'2020-09-13 20:26:40.002\'']
#16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset )
dcDB=self.dropandcreateDB(random.randint(1,2))
tdSql.query("select 16-1 from table_0;")
foriinrange(self.fornum):
sql="select * from ( select "
sql+="%s as calc16_0 , "%random.choice(calc_calculate_all)
sql+="%s as calc16_1 , "%random.choice(calc_aggregate_all)
sql+="%s as calc16_2 "%random.choice(calc_select_in)
sql+=" from stable_1 where "
sql+="%s "%random.choice(q_where)
sql+="%s "%random.choice(group_where)
sql+="%s "%random.choice(having_support)
sql+=") "
sql+="order by calc16_0 "
sql+="%s "%random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(1)
tdSql.query("select 16-2 from table_0;")
foriinrange(self.fornum):
sql="select * from ( select "
sql+="%s as calc16_0 "%random.choice(calc_calculate_all_j)
sql+=", %s as calc16_1 "%random.choice(calc_aggregate_all_j)
#sql += ", %s as calc16_2 " % random.choice(calc_select_in_j)
sql+=" from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql+="%s "%random.choice(t_join_where)
sql+=") "
sql+="order by calc16_0 "
sql+="%s "%random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
dcDB=self.dropandcreateDB(random.randint(1,3))
tdSql.query("select 16-3 from table_0;")
foriinrange(self.fornum):
sql="select * from ( select "
sql+="%s as calc16_1 "%random.choice(calc_calculate_regular)
sql+=" from regular_table_1 where "
sql+="%s "%random.choice(q_where)
sql+="limit 2 ) "
sql+="%s "%random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(1)
tdSql.query("select 16-4 from table_0;")
foriinrange(self.fornum):
sql="select * from ( select "
sql+="%s as calc16_1 "%random.choice(calc_calculate_regular_j)
sql+=" from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql+="%s "%random.choice(q_u_where)
sql+="limit 2 ) "
sql+="%s "%random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(1)
tdSql.query("select 16-5 from table_0;")
foriinrange(self.fornum):
sql="select * from ( select "
sql+="%s as calc16_1 , "%random.choice(calc_calculate_all)
sql+="%s as calc16_1 , "%random.choice(calc_calculate_regular)
sql+="%s as calc16_2 "%random.choice(calc_select_all)
sql+=" from stable_1 where "
sql+="%s "%random.choice(q_where)
sql+="%s "%random.choice(group_where)
sql+="%s "%random.choice(having_support)
sql+=") "
sql+="order by calc16_1 "
sql+="%s "%random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
dcDB=self.dropandcreateDB(random.randint(1,3))
tdSql.query("select 16-6 from table_0;")
foriinrange(self.fornum):
sql="select * from ( select "
sql+="%s as calc16_1 "%random.choice(calc_calculate_groupbytbname)
sql+=" from stable_1 where "
sql+="%s "%random.choice(q_where)
sql+="%s "%random.choice(group_where)
sql+="limit 2 ) "
sql+="%s "%random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(1)
tdSql.query("select 16-7 from table_0;")
foriinrange(self.fornum):
sql="select * from ( select "
sql+="%s as calc16_1 "%random.choice(calc_calculate_groupbytbname_j)
sql+=" from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql+="%s "%random.choice(t_join_where)
sql+="limit 2 ) "
sql+="%s "%random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
#17 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or interval_sliding group by having order by limit offset )interval_sliding
# TD-6088
dcDB=self.dropandcreateDB(random.randint(1,2))
tdSql.query("select 17-1 from table_0;")
foriinrange(self.fornum):
#this is having_support , but tag-select cannot mix with last_row,other select can