mihaibudiu commented on code in PR #5400:
URL: https://github.com/apache/calcite/pull/5400#discussion_r4518503936
##########
core/src/test/java/org/apache/calcite/test/RelMdPredicatesTest.java:
##########
@@ -35,11 +43,147 @@
import static org.apache.calcite.test.Matchers.sortsAs;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;
/** Tests for {@link org.apache.calcite.rel.metadata.RelMdPredicates} class. */
public class RelMdPredicatesTest {
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-7916">[CALCITE-7916]
+ * RelMdPredicates should preserve input predicates through Window</a>. */
+ @Test void testPullUpConstantThroughWindow() {
+ final Window window = window("select *, row_number() over (order by empno)
as rn\n"
+ + "from emp where deptno = 10");
+ final RelMetadataQuery mq = window.getCluster().getMetadataQuery();
+ final RelOptPredicateList predicates = mq.getPulledUpPredicates(window);
Review Comment:
looks like you could also use a windowPredicates helper to get the window
predicates?
##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java:
##########
@@ -548,6 +549,20 @@ public RelOptPredicateList getPredicates(Sort sort,
RelMetadataQuery mq) {
return mq.getPulledUpPredicates(input);
}
+ /**
+ * Infers predicates for a Window.
+ *
+ * <p>A Window preserves its input fields and appends its aggregate results,
Review Comment:
I would put this second part of the comment in the body of the function - it
describes the implementation.
--
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]