-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow Aggregations in Case Expressions #12613
Allow Aggregations in Case Expressions #12613
Conversation
Could not find the right place to put a V1 engine unit test for this change, so please let me know where it should go. |
new Object[]{"SELECT a.col1, CASE WHEN sum(a.col3) = 0 THEN 0 ELSE SUM(a.col3) END AS match_sum " | ||
+ " FROM a WHERE a.ts >= 1600000000 GROUP BY a.col1"}, |
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.
Would like to add additional unit tests for V2 as I think this test just verifies Semantics and Syntax, would like to test execution results.
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 we want to add tests for V1. It is already working in V2
…llowed in case expressions
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #12613 +/- ##
============================================
+ Coverage 61.75% 61.86% +0.10%
+ Complexity 207 198 -9
============================================
Files 2436 2453 +17
Lines 133233 133827 +594
Branches 20636 20752 +116
============================================
+ Hits 82274 82786 +512
- Misses 44911 44925 +14
- Partials 6048 6116 +68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Correct. I added a test for v2 because I didn't see one and just wanted to
be thorough.
Hiwever I had a comment that I couldn't find the right place to add the
test for V1. So just need to find out where to write that test and I'll add
it.
…On Mon, Mar 11, 2024, 5:05 PM Xiaotian (Jackie) Jiang < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
pinot-query-runtime/src/test/java/org/apache/pinot/query/QueryTestSet.java
<#12613 (comment)>:
> + new Object[]{"SELECT a.col1, CASE WHEN sum(a.col3) = 0 THEN 0 ELSE SUM(a.col3) END AS match_sum "
+ + " FROM a WHERE a.ts >= 1600000000 GROUP BY a.col1"},
Actually we want to add tests for V1. It is already working in V2
—
Reply to this email directly, view it on GitHub
<#12613 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BAASDJYTOC73P7DVTEJSLV3YXZIF3AVCNFSM6AAAAABEO7KSI6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSMRZHA3DENRTGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
You may add some queries in |
pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
Show resolved
Hide resolved
That's a very good suggestion, I'll do that.
…On Tue, Mar 12, 2024, 8:14 AM Gonzalo Ortiz Jaureguizar < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
<#12613 (comment)>:
> @@ -141,27 +141,6 @@ public void testCaseWhenStatements() {
Assert.assertEquals(caseFunc.getOperands().get(6).getLiteral().getFieldValue(), 0L);
}
- @test(expectedExceptions = SqlCompilationException.class)
- public void testInvalidCaseWhenStatements() {
Couldn't we reuse the text to verify this works now?
Even something as simple as compiling the same SQL query and assert no
failure is found. May not be super useful, but given it is already written,
we could use it
—
Reply to this email directly, view it on GitHub
<#12613 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BAASDJ2EDIFY2GIXBPXMNDLYX4LVNAVCNFSM6AAAAABEO7KSI6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSMZRGM3TCMZSGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
(Bugfix)
In Calcite, this removes the check that prevents aggregation functions from being used within a Case/When expression in the V1 engine.
Testing:
select AirlineID, (CASE WHEN sum(ActualElapsedTime) > 0 THEN sum(ActualElapsedTime) ELSE 0 END) AS cpm from airlineStats group by AirlineID
and comparing the results between V1 and V2 engine.