You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "somu-imply (via GitHub)" <gi...@apache.org> on 2024/01/23 05:21:07 UTC

[I] Window function fails to demarcate if 2 following are used (druid)

somu-imply opened a new issue, #15739:
URL: https://github.com/apache/druid/issues/15739

   At this moment, a query like 
   ```
   WITH virtual_table as (select ("customers_city(orders)") as vsum_dim1,sum("shipping_cost(orders)") as mes_col
   from us_ecom_orders_com101 group by 1 order by mes_col DESC)
   select vsum_dim1,mes_col,sum(mes_col) OVER (order by vsum_dim1 rows between 2 PRECEDING and 3 FOLLOWING) as mes_sum
   from virtual_table order by 1
   ```
   AND
   ```
   WITH virtual_table as (select ("customers_city(orders)") as vsum_dim1,sum("shipping_cost(orders)") as mes_col
   from us_ecom_orders_com101 group by 1 order by mes_col DESC)
   select vsum_dim1,mes_col,sum(mes_col) OVER (order by vsum_dim1 rows between 2 FOLLOWING and 3 FOLLOWING) as mes_sum
   from virtual_table order by 1
   ```
   
   are planned identically with the native query showing the same offset in the processor for both
   ```
   "processor": {
               "type": "framedAgg",
               "frame": {
                 "peerType": "ROWS",
                 "lowUnbounded": false,
                 "lowOffset": 2,
                 "uppUnbounded": false,
                 "uppOffset": 3,
                 "orderBy": null
               },
   ```
   
   Going forward we need to demarcate these cases and make sure we support negative offsets in such a case. At the moment even in native you cannot specify
   ```
   "processor": {
               "type": "framedAgg",
               "frame": {
                 "peerType": "ROWS",
                 "lowUnbounded": false,
                 "lowOffset": -2,
                 "uppUnbounded": false,
                 "uppOffset": 3,
                 "orderBy": null
               },
               "aggregations": [
                 {
                   "type": "longSum",
                   "name": "w0",
                   "fieldName": "a0"
                 }
               ]
             }
   ```
   which throws an IndexOutOfBounds exception


-- 
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@druid.apache.org.apache.org

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


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


Re: [I] Window function fails to demarcate if 2 following are used (druid)

Posted by "kgyrtkirk (via GitHub)" <gi...@apache.org>.
kgyrtkirk closed issue #15739: Window function fails to demarcate if 2 following are used
URL: https://github.com/apache/druid/issues/15739


-- 
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@druid.apache.org

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


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


Re: [I] Window function fails to demarcate if 2 following are used (druid)

Posted by "kgyrtkirk (via GitHub)" <gi...@apache.org>.
kgyrtkirk commented on issue #15739:
URL: https://github.com/apache/druid/issues/15739#issuecomment-1911751261

   some testcases which should start working if this is fixed:
   ```
   type: "operatorValidation"
   
   sql: |
     SELECT
       m1,
       FLOOR(m1/3),
       -- incorrect range frames https://github.com/apache/druid/issues/15739
       1 >= COUNT(1) OVER (ORDER BY m1 ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING), 
       1 >= COUNT(1) OVER (ORDER BY m1 ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING),
       1 >= COUNT(1) OVER (ORDER BY m1 RANGE BETWEEN 1 PRECEDING AND 1 PRECEDING), 
       1 >= COUNT(1) OVER (ORDER BY m1 RANGE BETWEEN 1 FOLLOWING AND 1 FOLLOWING),
       -- not sure if this should be allowed or not; but if its allowed it should be 0
       0 = COUNT(1) OVER (ORDER BY FLOOR(m1/3) ROWS BETWEEN 2 FOLLOWING AND 1 FOLLOWING),
     FROM foo
   
   expectedResults:
     - [1.0,0.0,true,true,true,true,true]
     - [2.0,0.0,true,true,true,true,true]
     - [3.0,1.0,true,true,true,true,true]
     - [4.0,1.0,true,true,true,true,true]
     - [5.0,1.0,true,true,true,true,true]
     - [6.0,2.0,true,true,true,true,true]
    ```


-- 
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@druid.apache.org

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


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