liliyuanshang commented on issue #61219:
URL: https://github.com/apache/doris/issues/61219#issuecomment-4073019461

   2、确切的CREATE VIEW声明 CREATE OR REPLACE VIEW view_name AS
   
   SELECT
   
   id,
   
   c1,
   
   c2,
   
   c3,
   
   CASE
   
   WHEN delivered_time IS NOT NULL THEN 'Delivered'
   
   WHEN otd_now&nbsp;< 3 THEN 'Normal'
   
   WHEN otd_now&nbsp;< 5 THEN 'Level1'
   
   WHEN otd_now&nbsp;< 7 THEN 'Level2'
   
   WHEN otd_now&nbsp;&gt;= 7 THEN 'Level3'
   
   ELSE NULL
   
   END AS otd_status,
   
   c4,
   
   CURRENT_TIMESTAMP() AS data_update_time
   
   FROM (SELECT
   
                *,
   
   FLOOR(
   
   TIMESTAMPDIFF(
   
   HOUR,
   
   DATE_SUB(standard_otd_time, INTERVAL 10 DAY),&nbsp;
   
   COALESCE(delivered_time, CURRENT_TIMESTAMP())&nbsp;
   
   ) / 24
   
   ) AS otd_now
   
   FROM table_name
   )t
   
   ;
   
   3、确切的SELECT触发该错误的查询
   
   SELECT&nbsp;* FROM table
   
   WHERE 1 and region&nbsp;= 'NA'
   
   ORDER BY is_delivered ASC, CAST(otd AS SIGNED) DESC
   
   LIMIT 100;
   
   
   
   4、当前行为与预期行为 预期查询显示视图所有列,实际除order by case when 等需要的列全为空,发现:在order 
by中加入一列,则查询时该列不会为空。
   
   
   
   
   
   5、环境: 这在4.0.1版本中是否可以重现
   
   
   
   
            原始邮件
            
          
   发件人:ARYASH GUPTA ***@***.***&gt;
   发件时间:2026年3月15日 13:08
   收件人:apache/doris ***@***.***&gt;
   抄送:离离原上 ***@***.***&gt;, Mention ***@***.***&gt;
   主题:Re: [apache/doris] [Bug] Doris View Order by 会过度列裁剪导致列为空 (Issue #61219)
   
   
   
   aryash45 left a comment (apache/doris#61219)
   
   Hi @liliyuanshang @morningman&nbsp;, I'm interested in working on this issue.
   
   Could you please help clarify the following:
   
   
   Minimal Reproducible Example (MRE): Could you provide the complete SQL 
statements with:
   
   
   The exact CREATE TABLE&nbsp;statement for the base table
   
   The exact CREATE VIEW&nbsp;statement
   
   The exact SELECT&nbsp;query that triggers the bug
   
   Sample test data (if possible)
   
   
   Current vs Expected Behavior:
   
   
   Which specific columns are becoming empty/NULL?
   
   What is the expected output?
   
   Can you share the actual query result vs expected result?
   
   
   Error Details:
   
   
   Are there any error logs or exception stack traces?
   
   Does this happen consistently or only under certain conditions?
   
   
   Environment:
   
   
   Is this reproducible in version 4.0.1 specifically, or other versions too?
   
   Which backend (BE) and frontend (FE) versions were used?
   
   
   Root Cause&nbsp;(if known):
   
   
   Is this related to how the query optimizer prunes columns for views with 
ORDER BY?
   
   Are there any related issues or discussions about this?
   
   Once I have these details, I'll be able to create a proper reproduction test 
case and submit a fix with regression tests.
   
   Thanks!
   
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   You are receiving this because you were mentioned.


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