HuangYuChen1998 commented on issue #17635:
URL: https://github.com/apache/iotdb/issues/17635#issuecomment-4471478020

   @DaZuiZui  @Wei-hao-Li @JackieTien97 
   我进行了进一步测试,发现了如下几个问题,**为方便测试和复现我将建表、数据准备和CASE SQL都添加到了 附件中,方便复现和排查问题**:
   
   [测试rank.sql](https://github.com/user-attachments/files/27903809/rank.sql)
   
   case 1:对震幅和收盘价排序,ASC和DESC,结果是正确的
   ```sql
   select
       "time",
       amplitude,
       close_hfq,
       ma_5,
       ma_64,
       ma_120,
   --    RANK() OVER (ORDER BY "time" ) AS rank_time,
       RANK() OVER (ORDER BY "amplitude" DESC) AS rank_amplitude,
       RANK() OVER (ORDER BY "close_hfq" DESC) AS rank_close_hfq
   --    RANK() OVER (ORDER BY ma_5) AS rank_ma5,
   --    RANK() OVER (ORDER BY ma_64 DESC) AS rank_ma64,
   --    RANK() OVER (ORDER BY ma_120) AS rank_ma120
   FROM quant.stock_kline_weekly
   WHERE "time" >= 2026-04-11
   AND symbol = '600000'
   ORDER BY "time";
   ```
   DESC 情况
   <img width="1302" height="641" alt="Image" 
src="https://github.com/user-attachments/assets/9ec08eb9-302b-4ad7-9449-568dd55db3ba";
 />
   ASC 情况
   <img width="975" height="668" alt="Image" 
src="https://github.com/user-attachments/assets/7e5a381c-baaf-4d93-ad32-c95ae9ff48b2";
 />
   
   ### 以下是异常情况
   
   case 2: 一旦我第一个rank带上时间,则会影响其后面的一个rank结果
   
   <img width="1247" height="695" alt="Image" 
src="https://github.com/user-attachments/assets/ef459c63-5e85-4270-8731-b605f4252242";
 />
   time DESC,time ASC 跟随了 time DESC,这也 不对
   
   <img width="1294" height="729" alt="Image" 
src="https://github.com/user-attachments/assets/a18e201e-f002-45a1-af8b-3acc65d93711";
 />
   
   2列 关于 time 的rank,后面那一列rank不会影响其后面的rank结果
   <img width="1266" height="651" alt="Image" 
src="https://github.com/user-attachments/assets/b08b5c30-8512-4a2c-8413-e7116845bfb9";
 />
   
   但是排序不对
   <img width="1283" height="583" alt="Image" 
src="https://github.com/user-attachments/assets/93a3d62d-74cc-4172-8306-c8f991a783dc";
 />
   
   case 3:当我使用 ma 3、13、120测试时,后面的排序完全跟随于第一个 rank
   
   <img width="1425" height="965" alt="Image" 
src="https://github.com/user-attachments/assets/b73a7921-db85-4328-a2fa-d3b1faaa952c";
 />
   
    
   


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