add tests for tsma with bigger interval
This commit is contained in:
parent
64f3d11783
commit
143dda3e6f
|
@ -1984,7 +1984,7 @@ static int64_t MATRIX[10][11] = { /* ns, us, ms, s, min, h, d,
|
||||||
/*s*/ { 0, 0, 1000, 1, 60, 0},
|
/*s*/ { 0, 0, 1000, 1, 60, 0},
|
||||||
/*min*/ { 0, 0, 0, 60, 1, 60, 0},
|
/*min*/ { 0, 0, 0, 60, 1, 60, 0},
|
||||||
/*h*/ { 0, 0, 0, 0, 60, 1, 1, 0},
|
/*h*/ { 0, 0, 0, 0, 60, 1, 1, 0},
|
||||||
/*d*/ { 0, 0, 0, 0, 0, 1, 1, 7, 1, 0},
|
/*d*/ { 0, 0, 0, 0, 0, 24, 1, 7, 1, 0},
|
||||||
/*w*/ { 0, 0, 0, 0, 0, 0, 7, 1, -1, 0},
|
/*w*/ { 0, 0, 0, 0, 0, 0, 7, 1, -1, 0},
|
||||||
/*mon*/ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 0},
|
/*mon*/ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 0},
|
||||||
/*y*/ { 0, 0, 0, 0, 0, 0, 0, 0, 12, 1, 0}};
|
/*y*/ { 0, 0, 0, 0, 0, 0, 0, 0, 12, 1, 0}};
|
||||||
|
@ -2006,7 +2006,8 @@ static bool recursiveTsmaCheckRecursive(int64_t baseInterval, int8_t baseIdx, in
|
||||||
}
|
}
|
||||||
if (val % baseInterval == 0 || baseInterval % val == 0) {
|
if (val % baseInterval == 0 || baseInterval % val == 0) {
|
||||||
int8_t extra = baseInterval >= val ? 0 : 1;
|
int8_t extra = baseInterval >= val ? 0 : 1;
|
||||||
if (!recursiveTsmaCheckRecursive(baseInterval / val + extra, next, interval, idx, (extra == 0) && checkEq)) {
|
bool needCheckEq = baseInterval >= val && !(baseIdx < next && val == 1);
|
||||||
|
if (!recursiveTsmaCheckRecursive(baseInterval / val + extra, next, interval, idx, needCheckEq && checkEq)) {
|
||||||
next++;
|
next++;
|
||||||
val = MATRIX[baseIdx][next];
|
val = MATRIX[baseIdx][next];
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1220,8 +1220,8 @@ class TDTestCase:
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.init_data()
|
self.init_data()
|
||||||
#self.test_ddl()
|
self.test_ddl()
|
||||||
#self.test_query_with_tsma()
|
self.test_query_with_tsma()
|
||||||
self.test_bigger_tsma_interval()
|
self.test_bigger_tsma_interval()
|
||||||
# bug to fix
|
# bug to fix
|
||||||
self.test_flush_query()
|
self.test_flush_query()
|
||||||
|
@ -1611,7 +1611,6 @@ class TDTestCase:
|
||||||
# def test_split_dnode(self):
|
# def test_split_dnode(self):
|
||||||
|
|
||||||
def test_create_recursive_tsma_interval(self, db: str, tb: str, func: list[str], interval: str, recursive_interval: str, succ: bool, code: int):
|
def test_create_recursive_tsma_interval(self, db: str, tb: str, func: list[str], interval: str, recursive_interval: str, succ: bool, code: int):
|
||||||
return
|
|
||||||
self.create_tsma('tsma1', db, tb, func, interval)
|
self.create_tsma('tsma1', db, tb, func, interval)
|
||||||
sql = f'CREATE RECURSIVE TSMA tsma2 ON tsma1 INTERVAL({recursive_interval})'
|
sql = f'CREATE RECURSIVE TSMA tsma2 ON tsma1 INTERVAL({recursive_interval})'
|
||||||
if not succ:
|
if not succ:
|
||||||
|
@ -1640,7 +1639,6 @@ class TDTestCase:
|
||||||
return ctxs
|
return ctxs
|
||||||
|
|
||||||
def test_bigger_tsma_interval(self):
|
def test_bigger_tsma_interval(self):
|
||||||
#os.system("taosBenchmark -d db -t 100 -n 10000 -v 2 -S 32000000 -y")
|
|
||||||
db = 'db'
|
db = 'db'
|
||||||
tb = 'meters'
|
tb = 'meters'
|
||||||
func = ['max(c1)', 'min(c1)', 'min(c2)', 'max(c2)', 'avg(c1)', 'count(ts)']
|
func = ['max(c1)', 'min(c1)', 'min(c2)', 'max(c2)', 'avg(c1)', 'count(ts)']
|
||||||
|
@ -1663,19 +1661,19 @@ class TDTestCase:
|
||||||
ctxs.append(TSMAQCBuilder()
|
ctxs.append(TSMAQCBuilder()
|
||||||
.with_sql('SELECT max(c1) FROM meters WHERE ts > "2024-09-03 18:40:00.324"')
|
.with_sql('SELECT max(c1) FROM meters WHERE ts > "2024-09-03 18:40:00.324"')
|
||||||
.should_query_with_table('meters', '2024-09-03 18:40:00.325', '2024-12-31 23:59:59.999')
|
.should_query_with_table('meters', '2024-09-03 18:40:00.325', '2024-12-31 23:59:59.999')
|
||||||
.should_query_with_tsma('tsma3', '2025-01-01 00:00:00.000', UsedTsma.TS_MIN)
|
.should_query_with_tsma('tsma3', '2025-01-01 00:00:00.000', UsedTsma.TS_MAX)
|
||||||
.get_qc())
|
.get_qc())
|
||||||
|
|
||||||
ctxs.append(TSMAQCBuilder()
|
ctxs.append(TSMAQCBuilder()
|
||||||
.with_sql('SELECT max(c1) FROM meters WHERE ts >= "2024-09-03 18:00:00.000"')
|
.with_sql('SELECT max(c1) FROM meters WHERE ts >= "2024-09-03 18:00:00.000"')
|
||||||
.should_query_with_tsma('tsma1', '2024-09-03 18:00:00.000', '2024-12-31 23:59:59.999')
|
.should_query_with_tsma('tsma1', '2024-09-03 18:00:00.000', '2024-12-31 23:59:59.999')
|
||||||
.should_query_with_tsma('tsma3', '2025-01-01 00:00:00.000', UsedTsma.TS_MIN)
|
.should_query_with_tsma('tsma3', '2025-01-01 00:00:00.000', UsedTsma.TS_MAX)
|
||||||
.get_qc())
|
.get_qc())
|
||||||
|
|
||||||
ctxs.append(TSMAQCBuilder()
|
ctxs.append(TSMAQCBuilder()
|
||||||
.with_sql('SELECT max(c1) FROM meters WHERE ts >= "2024-09-01 00:00:00.000"')
|
.with_sql('SELECT max(c1) FROM meters WHERE ts >= "2024-09-01 00:00:00.000"')
|
||||||
.should_query_with_tsma('tsma2', '2024-09-01 00:00:00.000', '2024-12-31 23:59:59.999')
|
.should_query_with_tsma('tsma2', '2024-09-01 00:00:00.000', '2024-12-31 23:59:59.999')
|
||||||
.should_query_with_tsma('tsma3', '2025-01-01 00:00:00.000', UsedTsma.TS_MIN)
|
.should_query_with_tsma('tsma3', '2025-01-01 00:00:00.000', UsedTsma.TS_MAX)
|
||||||
.get_qc())
|
.get_qc())
|
||||||
|
|
||||||
ctxs.append(TSMAQCBuilder()
|
ctxs.append(TSMAQCBuilder()
|
||||||
|
@ -1690,8 +1688,8 @@ class TDTestCase:
|
||||||
|
|
||||||
ctxs.append(TSMAQCBuilder()
|
ctxs.append(TSMAQCBuilder()
|
||||||
.with_sql("SELECT max(c1),min(c1),min(c2),max(c2),avg(c1),count(ts) FROM db.t9 WHERE ts > '2018-09-17 08:16:00'")
|
.with_sql("SELECT max(c1),min(c1),min(c2),max(c2),avg(c1),count(ts) FROM db.t9 WHERE ts > '2018-09-17 08:16:00'")
|
||||||
.should_query_with_table('meters', '2018-09-17 08:16:00.001', '2018-12-31 23:59:59:999')
|
.should_query_with_table('t9', '2018-09-17 08:16:00.001', '2018-12-31 23:59:59:999')
|
||||||
.should_query_with_tsma('tsma3', '2019-01-01')
|
.should_query_with_tsma_ctb('db', 'tsma3', 't9', '2019-01-01')
|
||||||
.get_qc())
|
.get_qc())
|
||||||
|
|
||||||
ctxs.append(TSMAQCBuilder()
|
ctxs.append(TSMAQCBuilder()
|
||||||
|
@ -1707,6 +1705,7 @@ class TDTestCase:
|
||||||
.get_qc())
|
.get_qc())
|
||||||
|
|
||||||
self.check(ctxs)
|
self.check(ctxs)
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
Loading…
Reference in New Issue