lianzhuhuang96 opened a new issue, #33770:
URL: https://github.com/apache/doris/issues/33770

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   2.1.1-rc05
   
   ### What's Wrong?
   
   create a view using with...as... and window function,
   and then execute the query 'select * from view',
   return error message: [INTERNAL_ERROR]Unknown expr node type: 0
   
   ### What You Expected?
   
   query then view success
   
   ### How to Reproduce?
   
   step1: create a view (view_temp_0) using with...as... and window function.
   ```
   create view view_temp_0 as
   with b as (select a.TABLE_NAME,a.TABLE_SCHEMA,a.TABLE_ROWS  -- using 
with...as...
        from information_schema.`tables` a 
        inner join (select a.TABLE_NAME
                ,ROW_NUMBER() over(partition by a.TABLE_NAME order by 
a.UPDATE_TIME desc ) as rk   -- using window function
                from information_schema.`tables` a ) b on a.TABLE_NAME = 
b.table_name and b.rk = 1 
        )
   
   select b.table_name
   from information_schema.`tables` a 
   left join b on a.table_name = b.table_name and a.table_schema = 
b.table_schema
   ;
   ```
   step1 execute successfully and return ok
   
   step2: execute query `select * from view_temp_0`
   step2 return error message: [INTERNAL_ERROR]Unknown expr node type: 0
   
![Snipaste_2024-04-17_15-43-28](https://github.com/apache/doris/assets/113155578/cbfa49b6-c33d-4a56-a8ee-0ebc89497d64)
   
   
   ### Anything Else?
   
   however, create a view using window function without with...as..., it works 
well.
   ```
   create view view_temp_1 as
   select b.table_name
   from information_schema.`tables` a 
   left join (select a.TABLE_NAME,a.TABLE_SCHEMA,a.TABLE_ROWS 
        from information_schema.`tables` a 
        inner join (select a.TABLE_NAME
                ,ROW_NUMBER() over(partition by a.TABLE_NAME order by 
a.UPDATE_TIME desc ) as rk 
                from information_schema.`tables` a ) b on a.TABLE_NAME = 
b.table_name and b.rk = 1 
        ) b on a.table_name = b.table_name and a.table_schema = b.table_schema
   ;
   
   select * from view_temp_1
   ;
   ```
   
   
![image](https://github.com/apache/doris/assets/113155578/f7d9ece3-91dd-4583-82df-19c0f930d7fc)
   
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to