-
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
Timestamp in MSE #14690
Merged
+547
−84
Merged
Timestamp in MSE #14690
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ac48f4b
Attempt to apply timestamp expr override in V2
gortiz 98d424c
Merge remote-tracking branch 'personal/timestamp-expr-override-in-v2'…
gortiz 7c1d5ed
Apply TimestampIndex trick in filtered aggregation functions
gortiz 1338c15
Change the way ServerPlanRequestVisitor finds dateTrunc function calls
gortiz 4689d87
Add tests that verify timestamp indexes can be used in MSE
gortiz a04a9f5
Add a group by test
gortiz 6879cc4
Remove unused visitor
gortiz 0277460
Use TransformFunctionType.DATE_TRUNC.getName() instead of the literal
gortiz 6dc210f
Rename RequestUtils.applyTimestampIndex as RequestUtils.applyTimestam…
gortiz 1cd3dfd
Merge remote-tracking branch 'origin/master' into timestamp-v2
gortiz 005ba05
Add timestamp tests for SSE
gortiz 08aba97
Make default columns immutable again
gortiz 3e32e61
Add the ability to write sse explain tests as regexps
gortiz 790a9ae
Improve assertion messages
gortiz 86aa3e8
Resolve checkstyle issue
gortiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
...n-tests/src/test/java/org/apache/pinot/integration/tests/ExplainIntegrationTestTrait.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pinot.integration.tests; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.regex.Pattern; | ||
import java.util.stream.Collectors; | ||
import org.apache.pinot.spi.utils.JsonUtils; | ||
import org.intellij.lang.annotations.Language; | ||
import org.testng.Assert; | ||
|
||
|
||
public interface ExplainIntegrationTestTrait { | ||
|
||
JsonNode postQuery(@Language("sql") String query) | ||
throws Exception; | ||
|
||
default void explainLogical(@Language("sql") String query, String expected) { | ||
yashmayya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
try { | ||
JsonNode jsonNode = postQuery("explain plan without implementation for " + query); | ||
JsonNode plan = jsonNode.get("resultTable").get("rows").get(0).get(1); | ||
|
||
Assert.assertEquals(plan.asText(), expected); | ||
} catch (RuntimeException e) { | ||
throw e; | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
default void explainSse(boolean verbose, @Language("sql") String query, Object... expected) { | ||
try { | ||
@Language("sql") | ||
String actualQuery = "SET useMultistageEngine=false; explain plan for " + query; | ||
if (verbose) { | ||
actualQuery = "SET explainPlanVerbose=true; " + actualQuery; | ||
} | ||
JsonNode jsonNode = postQuery(actualQuery); | ||
JsonNode plan = jsonNode.get("resultTable").get("rows"); | ||
List<String> planAsStrList = (List<String>) JsonUtils.jsonNodeToObject(plan, List.class).stream() | ||
.map(Object::toString) | ||
.collect(Collectors.toList()); | ||
|
||
if (planAsStrList.size() != expected.length) { | ||
Assert.fail("Actual: " + planAsStrList + ", Expected: " + Arrays.toString(expected) | ||
+ ". Size mismatch. Actual: " + planAsStrList.size() + ", Expected: " + expected.length); | ||
} | ||
for (int i = 0; i < planAsStrList.size(); i++) { | ||
String planAsStr = planAsStrList.get(i); | ||
Object expectedObj = expected[i]; | ||
if (expectedObj instanceof Pattern) { | ||
Assert.assertTrue(((Pattern) expectedObj).matcher(planAsStr).matches(), | ||
"Pattern doesn't match. Actual: " + planAsStr + ", Expected: " + expectedObj | ||
+ ", Actual complete plan: " + planAsStrList); | ||
} else if (expectedObj instanceof String) { | ||
Assert.assertEquals(planAsStr, expectedObj, "Actual: " + planAsStr + ", Expected: " + expectedObj | ||
+ ", Actual complete plan: " + planAsStrList); | ||
} else { | ||
Assert.fail("Expected object should be either Pattern or String in position " + i + ". Actual: " | ||
+ expectedObj + " of type " + expectedObj.getClass()); | ||
} | ||
} | ||
} catch (RuntimeException e) { | ||
throw e; | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
default void explainSse(@Language("sql") String query, Object... expected) { | ||
explainSse(false, query, expected); | ||
} | ||
|
||
default void explain(@Language("sql") String query, String expected) { | ||
try { | ||
JsonNode jsonNode = postQuery("explain plan for " + query); | ||
JsonNode plan = jsonNode.get("resultTable").get("rows").get(0).get(1); | ||
|
||
Assert.assertEquals(plan.asText(), expected); | ||
} catch (RuntimeException e) { | ||
throw e; | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
default void explainVerbose(@Language("sql") String query, String expected) { | ||
try { | ||
JsonNode jsonNode = postQuery("set explainPlanVerbose=true; explain plan for " + query); | ||
JsonNode plan = jsonNode.get("resultTable").get("rows").get(0).get(1); | ||
|
||
String actual = plan.asText() | ||
.replaceAll("numDocs=\\[[^\\]]*]", "numDocs=[any]") | ||
.replaceAll("segment=\\[[^\\]]*]", "segment=[any]") | ||
.replaceAll("totalDocs=\\[[^\\]]*]", "totalDocs=[any]"); | ||
|
||
|
||
Assert.assertEquals(actual, expected); | ||
} catch (RuntimeException e) { | ||
throw e; | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could we add an integration test that verifies this filtered aggregation on timestamp column with timestamp index execution path on both the query engines?
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.
test timestampIndexSubstitutedInAggregateFilter already tested this code in MME. I've just added the same test class for SSE.