boy-xiaozhang commented on issue #7156:
URL: 
https://github.com/apache/dolphinscheduler/issues/7156#issuecomment-992337930


   > @lenboo Did you ask whether sql parser could parse below sql script or not?
   > 
   > ```sql
   > -- Can the following sql script parser to the following dependencies?
   > -- users -> target_table
   > -- orders -> target_table
   > 
   > -- last 3 months registered users
   > with user_cte as (
   >     select id, name, regist_time
   >     from users
   >     where regist_time > date_sub(current_date, 30 * 3)
   > )
   > 
   > -- last month orders
   > , order_cte as (
   >     select id, user_id, amount
   >     from orders
   >     where pay_time > date_sub(current_date, 30)
   > )
   > 
   > -- Total order amount in last 3 months registered users
   > insert overwrite target_table
   > select u.id
   >      , u.name
   >      , sum(o.amount) as total_amount
   > from user_cte u
   > join order_cte o on o.user_id = u.id
   > group by u.id, u.name
   > ```
   
   After my test, I tested all kinds of complex CTE statements, so far it can 
be parsed.


-- 
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]


Reply via email to