You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/10/25 07:04:40 UTC

[GitHub] [doris] zenyanggongmian1995 opened a new issue, #13639: [Bug] Select后的字段解析有问题。

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

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Version
   
   1.1.2.rc02
   
   ### What's Wrong?
   
   # 错误就在第二行,可以看见我month_id之后没有逗号,但是该SQL可以正确执行,而且结果集中没有month字段,这个位置解析应该有问题。当我加上逗号之后,结果集中会出现month_id字段
   SELECT     
       month_id
       standard_app_id,
       split_part(key_value1, '$', 1) AS avg_uv_name,
       split_part(key_value1, '$', 2) AS avg_uv_value
   
   from (
           SELECT *
           FROM (
               SELECT 
                   month_id,
                   standard_app_id,               
                   concat_ws('$', 'avg_uv01', avg_uv01) as con_avg_uv01,  
                   concat_ws('$', 'avg_uv02', avg_uv02) as con_avg_uv02, 
                   concat_ws('$', 'avg_uv03', avg_uv03) as con_avg_uv03
               FROM (
               select
               substring(day_id,1,6) month_id,
               standard_app_id,
   avg(    CASE    when    (day_id-concat(substring(day_id,1,6),'00')  )   =     1   THEN  uv  ELSE    null    END )   avg_uv01,
   avg(    CASE    when    (day_id-concat(substring(day_id,1,6),'00')  )   <=  2     THEN  uv  ELSE    null    END )   avg_uv02,
   avg(    CASE    when    (day_id-concat(substring(day_id,1,6),'00')  )   <=  3     THEN  uv  ELSE    null    END )   avg_uv03	
              
               from
               (select *  from ids.ids_app_rank_product_a4_d where day_id >=DATE_SUB(CURRENT_DATE(),INTERVAL 132 DAY) and day_id <=DATE_SUB(CURRENT_DATE(),INTERVAL 2 DAY) and uv!=0 
               union all
               select * from ids.ids_app_game_rank_product_a4_d where day_id >=DATE_SUB(CURRENT_DATE(),INTERVAL 132 DAY) and day_id <=DATE_SUB(CURRENT_DATE(),INTERVAL 2 DAY) and uv!=0  
               ) b
               group by 1,2  												 
             ) bb
   ) bbview lateral VIEW explode_split ( CONCAT_WS( ',', con_avg_uv01, con_avg_uv02,con_avg_uv03), ',' ) tmp1 AS key_value1)xxx
     where month_id=202207
   
   ### What You Expected?
   
   解决涉及到laterview的查询时,Select字段解析的问题。
   
   此前:#13431 ,使用lateral view之后,内层表别名解析有问题。
   更前:我发现 lateral view之后的过滤条件无法生效,现在已经修复。
   
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] 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: commits-unsubscribe@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] dataalive closed issue #13639: [Bug] Select后的字段解析有问题。

Posted by GitBox <gi...@apache.org>.
dataalive closed issue #13639: [Bug] Select后的字段解析有问题。
URL: https://github.com/apache/doris/issues/13639


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] lsy3993 commented on issue #13639: [Bug] Select后的字段解析有问题。

Posted by GitBox <gi...@apache.org>.
lsy3993 commented on issue #13639:
URL: https://github.com/apache/doris/issues/13639#issuecomment-1291434301

   when you write 
   ```
     select month_id
              standard_app_id, xxx
   ```
   
   doris will think you want to do that:
   ```
     select month_id as standard_app_id, xxx
   ```
   
   But this behavior is OK, you can alias 'month_id' to 'standard_app_id', even if 'standard_app_id' is a column name in your table.
   
   The problem does not relate to 'lateral view',  simple queries can also be reproduced, for exapmle
   ![doris_alias](https://user-images.githubusercontent.com/110876560/197924749-ea85172f-8c43-4ad8-85eb-c7986a1378ec.jpeg)
   And this behavior is same as mysql, the following picture shows mysql's behavior:
   ![mysql_alias](https://user-images.githubusercontent.com/110876560/197924908-402a97cd-1cdc-4409-ad4d-862da63af288.jpeg)
   
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org