Merge pull request #29494 from taosdata/fix/TS-5869

fix: alias not keep in view issue
This commit is contained in:
Shengliang Guan 2025-01-08 10:48:10 +08:00 committed by GitHub
commit 756fcd17f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 0 deletions

View File

@ -102,6 +102,9 @@ static int32_t exprNodeCopy(const SExprNode* pSrc, SExprNode* pDst) {
COPY_OBJECT_FIELD(resType, sizeof(SDataType));
COPY_CHAR_ARRAY_FIELD(aliasName);
COPY_CHAR_ARRAY_FIELD(userAlias);
COPY_SCALAR_FIELD(asAlias);
COPY_SCALAR_FIELD(asParam);
COPY_SCALAR_FIELD(asPosition);
COPY_SCALAR_FIELD(projIdx);
return TSDB_CODE_SUCCESS;
}

View File

@ -236,3 +236,28 @@ sql drop view view6;
sql drop view view7;
sql drop view view8;
sql use testb;
sql create view viewx1 as select ts, t from (select last(ts) as ts, last(f) as f, t from st3 partition by t order by ts desc);
sql create view viewx2 as select ts, t from (select last(dt) as ts, last(f) as f, t from st3 partition by t order by ts desc);
sql create view viewx3 as select ts1, t from (select last(ts) as ts1, last(f) as f, t from st3 partition by t order by ts1 desc);
sql create view viewx4 as select f, t from (select last(ts) as f, last(g) as g, t from st3 partition by t order by f desc);
sql select * from viewx1;
if $rows != 4 then
return -1
endi
sql select * from viewx2;
if $rows != 4 then
return -1
endi
sql select * from viewx3;
if $rows != 4 then
return -1
endi
sql select * from viewx4;
if $rows != 4 then
return -1
endi
sql drop view viewx1;
sql drop view viewx2;
sql drop view viewx3;
sql drop view viewx4;

View File

@ -40,6 +40,12 @@ sql insert into ctb22 using st2 tags(2) values('2023-10-16 09:10:12', 110222, 11
sql insert into ctb23 using st2 tags(3) values('2023-10-16 09:10:13', 110223, 1102230);
sql insert into ctb24 using st2 tags(4) values('2023-10-16 09:10:14', 110224, 1102240);
sql create table st3(dt timestamp, ts timestamp, f int, g int) tags (t int);
sql insert into ctb31 using st3 tags(1) values('2023-10-16 09:10:11', 0, 110221, 1102210);
sql insert into ctb32 using st3 tags(2) values('2023-10-16 09:10:12', 1, 110222, 1102220);
sql insert into ctb33 using st3 tags(3) values('2023-10-16 09:10:13', 2, 110223, 1102230);
sql insert into ctb34 using st3 tags(4) values('2023-10-16 09:10:14', 3, 110224, 1102240);
run tsim/view/privilege_basic_view.sim
run tsim/view/privilege_nested_view.sim
run tsim/view/create_drop_view.sim
@ -63,4 +69,14 @@ run tsim/view/stream_view.sim
run tsim/view/show_desc_view.sim
run tsim/view/same_name_tb_view.sim
sql alter local 'keepColumnName' '1'
run tsim/view/privilege_basic_view.sim
run tsim/view/privilege_nested_view.sim
run tsim/view/create_drop_view.sim
run tsim/view/query_view.sim
run tsim/view/insert_view.sim
run tsim/view/stream_view.sim
run tsim/view/show_desc_view.sim
run tsim/view/same_name_tb_view.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT