-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix non-sqlcompat validation in CalciteWindowQueryTest #15086
Conversation
This reverts commit 5cf1e2c.
(cherry picked from commit ab346d4373ea888eb8ef6115e018e7fb0d27407f)
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java
Fixed
Show fixed
Hide fixed
@@ -3,7 +3,7 @@ type: "operatorValidation" | |||
sql: | | |||
SELECT | |||
m1, | |||
COUNT(m1) OVER () cc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a separate test if we are changing from COUNT to SUM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...actually retaining the COUNT
here was leading to a difference in the plans (and/or possibly to a bug) ; the goal in this patch was to enable the checks back - from the standpoint of this test the important thing is to run a query with at least 1 window function without any group by
clauses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add that with a failingTest annotation instead of the regular operatorValidation. That way we'll have the failing test in there so that once that bug gets address we can update it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep; that makes sense:
- added the new test as
no_grouping2.sqlTest
- changed
no_grouping.sqlTest
to befailingTest
verifier.verifyResults(queryResults); | ||
} | ||
catch (Exception e) { | ||
throw new RuntimeException("Exception during verification!", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use a druid exception here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking around what else to use - but since this is part of the test framework and DruidException
wants "Persona" and "Category" which is clearly unrelated as an Exception
here means that the test most likely have crashed...
throw DruidException.forPersona(Persona.DEVELOPER)
.ofCategory(Category.UNCATEGORIZED)
.build(e, "Exception during verification!");
I could probably use Assert.fail
here - but the junit4 Assert.fail
does not accept an Exception
so it would not retain the stacktrace... junit5 has a method like that - but we don't yet have that here (...and since the test most likely crashed; and not failed using that would kinda miss its usecase)
Letting out the Exception
at this point kinda leads to a shotgun surgery (although I do thing that every test method should be allowed to just let checked Exception
-s out)
I was looking around what other exceptions are out there...but didn't found a better match than retaining to wrap the checked Exception
into a plain RuntimeException
; to let it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes @kgyrtkirk - mostly looks good. Left a few comments!
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/apache/druid/sql/calcite/CalciteWindowQueryTest.java
Show resolved
Hide resolved
sql/src/test/java/org/apache/druid/sql/calcite/CalciteWindowQueryTest.java
Outdated
Show resolved
Hide resolved
There is a difference in the wee bits after the decimal in the tests. Can you please take a look at it. So far things looks good to me |
mismatchMessage(row, column), | ||
(Float) expectedCell, | ||
(Float) resultCell, | ||
1e-5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should make this a static variable and set it to 1e-5. Also is there any rationale behind chosing this value ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two tests were overriding the assertResultsEquals
method - and they had this constant in them; to set the absolute error bound to 1e-5
I think they were making assertions on approximation results - which may be a little bit different based on the jvm or other external reasons.
I've extracted it into a constant
mismatchMessage(row, column), | ||
(Double) expectedCell, | ||
(Double) resultCell, | ||
1e-5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java
Outdated
Show resolved
Hide resolved
Once the CI is all greens I'll merge this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* fixes * check for latest rewrite place * Revert "check for latest rewrite place" This reverts commit 5cf1e2c. * some stuff (cherry picked from commit ab346d4373ea888eb8ef6115e018e7fb0d27407f) * update test output * updates to test ouptuts * some stuff * move validator * cleanup * fix * change test slightly * add apidoc cleanup warnings * cleanup/etc * instead of telling the story; add a fail with some reason whats the issue * lead-lag fix * add test * remove unnecessary throw * druidexception-trial * Revert "druidexception-trial" This reverts commit 8fa0664. * undo changes to no_grouping; add no_grouping2 * add missing assert on resultcount * rename method; update * introduce enum/etc * make resultmatchmode accessible from TestBuilder#expectedResults * fix dump results to use log * fix * handle null correctly * disable feature type based things for MSQ * fix varianssqlaggtest * use eps in other test * fix intellij error * add final * addrss review * update test/string/etc * write concat in 3 lines :D
* fixes * check for latest rewrite place * Revert "check for latest rewrite place" This reverts commit 5cf1e2c. * some stuff (cherry picked from commit ab346d4373ea888eb8ef6115e018e7fb0d27407f) * update test output * updates to test ouptuts * some stuff * move validator * cleanup * fix * change test slightly * add apidoc cleanup warnings * cleanup/etc * instead of telling the story; add a fail with some reason whats the issue * lead-lag fix * add test * remove unnecessary throw * druidexception-trial * Revert "druidexception-trial" This reverts commit 8fa0664. * undo changes to no_grouping; add no_grouping2 * add missing assert on resultcount * rename method; update * introduce enum/etc * make resultmatchmode accessible from TestBuilder#expectedResults * fix dump results to use log * fix * handle null correctly * disable feature type based things for MSQ * fix varianssqlaggtest * use eps in other test * fix intellij error * add final * addrss review * update test/string/etc * write concat in 3 lines :D
* fixes * check for latest rewrite place * Revert "check for latest rewrite place" This reverts commit 5cf1e2c. * some stuff (cherry picked from commit ab346d4373ea888eb8ef6115e018e7fb0d27407f) * update test output * updates to test ouptuts * some stuff * move validator * cleanup * fix * change test slightly * add apidoc cleanup warnings * cleanup/etc * instead of telling the story; add a fail with some reason whats the issue * lead-lag fix * add test * remove unnecessary throw * druidexception-trial * Revert "druidexception-trial" This reverts commit 8fa0664. * undo changes to no_grouping; add no_grouping2 * add missing assert on resultcount * rename method; update * introduce enum/etc * make resultmatchmode accessible from TestBuilder#expectedResults * fix dump results to use log * fix * handle null correctly * disable feature type based things for MSQ * fix varianssqlaggtest * use eps in other test * fix intellij error * add final * addrss review * update test/string/etc * write concat in 3 lines :D
* fixes * check for latest rewrite place * Revert "check for latest rewrite place" This reverts commit 5cf1e2c. * some stuff (cherry picked from commit ab346d4373ea888eb8ef6115e018e7fb0d27407f) * update test output * updates to test ouptuts * some stuff * move validator * cleanup * fix * change test slightly * add apidoc cleanup warnings * cleanup/etc * instead of telling the story; add a fail with some reason whats the issue * lead-lag fix * add test * remove unnecessary throw * druidexception-trial * Revert "druidexception-trial" This reverts commit 8fa0664. * undo changes to no_grouping; add no_grouping2 * add missing assert on resultcount * rename method; update * introduce enum/etc * make resultmatchmode accessible from TestBuilder#expectedResults * fix dump results to use log * fix * handle null correctly * disable feature type based things for MSQ * fix varianssqlaggtest * use eps in other test * fix intellij error * add final * addrss review * update test/string/etc * write concat in 3 lines :D
useDefaultValueForNull=false
null
or thedefault_value
in case the expectation isnull
CalciteWindowQueryTest
useDefaultValueForNull=true
no_grouping
testcase ; as it was triggering some independent bug with the original queryThis PR has: