adj last function
This commit is contained in:
parent
eb50334baf
commit
9a8d03f0ca
|
@ -3368,9 +3368,9 @@ static int32_t createMultiResFuncsParas(STranslateContext* pCxt, SNodeList* pSrc
|
||||||
SNode* pPara = NULL;
|
SNode* pPara = NULL;
|
||||||
FOREACH(pPara, pSrcParas) {
|
FOREACH(pPara, pSrcParas) {
|
||||||
if (nodesIsStar(pPara)) {
|
if (nodesIsStar(pPara)) {
|
||||||
code = createAllColumns(pCxt, true, &pExprs);
|
code = createAllColumns(pCxt, false, &pExprs);
|
||||||
} else if (nodesIsTableStar(pPara)) {
|
} else if (nodesIsTableStar(pPara)) {
|
||||||
code = createTableAllCols(pCxt, (SColumnNode*)pPara, true, &pExprs);
|
code = createTableAllCols(pCxt, (SColumnNode*)pPara, false, &pExprs);
|
||||||
} else {
|
} else {
|
||||||
code = nodesListMakeStrictAppend(&pExprs, nodesCloneNode(pPara));
|
code = nodesListMakeStrictAppend(&pExprs, nodesCloneNode(pPara));
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ if $data01 != 112 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != @tm0@ then
|
if $data03 != @tm0@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ if $data11 != 421 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data12 != @tm1@ then
|
if $data13 != @tm1@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -805,16 +805,16 @@ endi
|
||||||
if $data04 != 01 then
|
if $data04 != 01 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data05 != @21-03-01 01:00:00.000@ then
|
if $data[0][10] != @21-03-01 01:00:00.000@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data06 != 9911 then
|
if $data[0][11] != 9911 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data07 != 9911.000000000 then
|
if $data[0][12] != 9911.000000000 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data08 != 11 then
|
if $data[0][13] != 11 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -837,16 +837,16 @@ endi
|
||||||
if $data04 != 05 then
|
if $data04 != 05 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data05 != @21-03-01 05:00:00.000@ then
|
if $data[0][10] != @21-03-01 05:00:00.000@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data06 != 9915 then
|
if $data[0][11] != 9915 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data07 != 9915.000000000 then
|
if $data[0][12] != 9915.000000000 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data08 != 15 then
|
if $data[0][13] != 15 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -243,11 +243,11 @@ endi
|
||||||
if $data04 != @70-01-01 07:59:57.000@ then
|
if $data04 != @70-01-01 07:59:57.000@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data05 != @21-05-12 10:10:12.000@ then
|
if $data06 != @21-05-12 10:10:12.000@ then
|
||||||
print $data00
|
print $data00
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data06 != @70-01-01 07:59:57.000@ then
|
if $data07 != @70-01-01 07:59:57.000@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -54,13 +54,13 @@ sql select last_row(*), ts, 'abc', 123.981, tbname from m1
|
||||||
if $rows != 1 then
|
if $rows != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data02 != @19-01-01 01:01:01.000@ then
|
if $data03 != @19-01-01 01:01:01.000@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data03 != @abc@ then
|
if $data04 != @abc@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data04 != 123.981000000 then
|
if $data05 != 123.981000000 then
|
||||||
print expect 123.981000000, actual: $data04
|
print expect 123.981000000, actual: $data04
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
|
@ -33,29 +33,29 @@ if $data06 != tba1 then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select last(*) from db1.sta;
|
sql select last(*) from db1.sta;
|
||||||
if $cols != 4 then
|
if $cols != 7 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != tba2 then
|
if $data06 != tba2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select last_row(*) from db1.sta;
|
sql select last_row(*) from db1.sta;
|
||||||
if $cols != 4 then
|
if $cols != 7 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != tba2 then
|
if $data06 != tba2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select first(*) from db1.sta;
|
sql select first(*) from db1.sta;
|
||||||
if $cols != 4 then
|
if $cols != 7 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != tba1 then
|
if $data06 != tba1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -71,29 +71,29 @@ if $data06 != tba1 then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select last(b.*) from db1.sta b;
|
sql select last(b.*) from db1.sta b;
|
||||||
if $cols != 4 then
|
if $cols != 7 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != tba2 then
|
if $data06 != tba2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select last_row(b.*) from db1.sta b;
|
sql select last_row(b.*) from db1.sta b;
|
||||||
if $cols != 4 then
|
if $cols != 7 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != tba2 then
|
if $data06 != tba2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select first(b.*) from db1.sta b;
|
sql select first(b.*) from db1.sta b;
|
||||||
if $cols != 4 then
|
if $cols != 7 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != tba1 then
|
if $data06 != tba1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,12 @@ if $data03 != b then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql explain select count(*), last(*) from sta;
|
sql explain select count(*), last(*) from sta;
|
||||||
if $data00 != @-> Merge (columns=4 width=226 input_order=unknown output_order=unknown mode=column)@ then
|
if $data00 != @-> Merge (columns=5 width=230 input_order=unknown output_order=unknown mode=column)@ then
|
||||||
|
print $data00
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql explain select first(f1), last(*) from sta;
|
sql explain select first(f1), last(*) from sta;
|
||||||
if $data00 != @-> Merge (columns=4 width=226 input_order=unknown output_order=unknown mode=column)@ then
|
if $data00 != @-> Merge (columns=5 width=230 input_order=unknown output_order=unknown mode=column)@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql select first(f1), last(*) from sta;
|
sql select first(f1), last(*) from sta;
|
||||||
|
|
|
@ -152,8 +152,8 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, last_ts4)
|
tdSql.checkData(0, 0, last_ts4)
|
||||||
tdSql.checkData(0, 1, 5 * maxRange - 1)
|
tdSql.checkData(0, 1, 5 * maxRange - 1)
|
||||||
tdSql.checkData(0, 2, last_ts4)
|
tdSql.checkData(0, 3, last_ts4)
|
||||||
tdSql.checkData(0, 3, 4 * maxRange + 1)
|
tdSql.checkData(0, 4, 4 * maxRange + 1)
|
||||||
|
|
||||||
explain_res = self.explain_sql(sql)
|
explain_res = self.explain_sql(sql)
|
||||||
self.check_explain_res_no_row("Last Row Scan", explain_res, sql)
|
self.check_explain_res_no_row("Last Row Scan", explain_res, sql)
|
||||||
|
|
Loading…
Reference in New Issue