Re: [PR] handling window frame selection in case of same bound kind (druid)

2024-04-03 Thread via GitHub


kgyrtkirk commented on code in PR #16231:
URL: https://github.com/apache/druid/pull/16231#discussion_r1549450440


##
processing/src/main/java/org/apache/druid/query/rowsandcols/semantic/DefaultFramedOnHeapAggregatable.java:
##
@@ -434,7 +434,9 @@ private AppendableRowsAndColumns 
computeCumulativeAggregates(AggregatorFactory[]
 // a specialized implementation of this interface against, say, a Frame 
object that can deal with arrays instead
 // of trying to optimize this generic implementation.
 Object[][] results = new Object[aggFactories.length][numRows];
-int resultStorageIndex = 0;
+
+// if the upper offset is -ve, then we need to ignore those many rows 
prior to the current row
+int resultStorageIndex = -1 * Math.min(upperOffset, 0);

Review Comment:
   nit: why not use an unary `-` ? 



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

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


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



Re: [PR] handling window frame selection in case of same bound kind (druid)

2024-04-03 Thread via GitHub


kgyrtkirk commented on code in PR #16231:
URL: https://github.com/apache/druid/pull/16231#discussion_r1549445767


##
processing/src/main/java/org/apache/druid/query/rowsandcols/semantic/DefaultFramedOnHeapAggregatable.java:
##
@@ -187,7 +187,7 @@ public AggInterval next()
   groupToRowIndex(relativeGroupId(1))
   ),
   Interval.of(
-  groupToRowIndex(relativeGroupId(-lowerOffset)),
+  groupToRowIndex(relativeGroupId(lowerOffset < 0 ? 
lowerOffset : -lowerOffset)),

Review Comment:
   this doesn't look right - this is effectively: `-Math.abs(lowerOffset)`
   this part was already working with relative offsets ; so I think it should 
be simply `relativeGroupId(lowerOffset)` - didn't that worked?
   



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

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


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



[PR] handling window frame selection in case of same bound kind (druid)

2024-04-03 Thread via GitHub


sreemanamala opened a new pull request, #16231:
URL: https://github.com/apache/druid/pull/16231

   
   
   
   
   
   
   
   
   
   ### Description
   
   This PR aims to handle the following cases in window frame selection
   
   `rows between unbounded preceding and x preceding
   rows between x following and unbounded following 
   rows between x preceding and y preceding
   rows between x following and y following`
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   # Key changed/added classes in this PR
* `DefaultFramedOnHeapAggregatable.java`
* `DruidSqlValidator.java`
* `Windowing.java`
   
   
   
   
   
   This PR has:
   
   - [ ] been self-reviewed.
  - [ ] using the [concurrency 
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
 (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in 
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


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

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


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