jadami10 opened a new pull request, #17348:
URL: https://github.com/apache/pinot/pull/17348

   This is a bugfix for the lead/lag functions. If a query specified an offset 
> number of rows available, this would fail with an `Array index out of range:` 
error.
   
   I added a unit test to cover with and without default values. I validated 
these failed on master. I also validated this locally with MSE quickstart where 
this query failed before and return the right data after
   
   ```
   WITH city_billing_max AS (
     SELECT buildingType,
       city,
       DATETIMECONVERT(
         billingMonth,
         '1:MILLISECONDS:SIMPLE_DATE_FORMAT:yyyyMM',
         '1:MILLISECONDS:EPOCH',
         '1:MILLISECONDS'
       ) AS billingMonth_ts,
       MAX(baseUsage) AS max_baseUsage
     FROM billing
     GROUP BY 1,
       2,
       3
   )
   SELECT billingMonth_ts,
     buildingType,
     city,
     LAG(max_baseUsage, 100, '0') OVER (
       PARTITION BY buildingType,
       city
       ORDER BY billingMonth_ts
     ) AS previous_max_baseUsage,
     max_baseUsage AS current_max_baseUsage
   FROM city_billing_max
   ```


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