public class PlanTestBase extends BaseTestQuery
BaseTestQuery.ClassicTestServices, BaseTestQuery.SilentListener, BaseTestQuery.TestResultSet| Modifier and Type | Field and Description |
|---|---|
protected static String |
EXPECTED_NOT_FOUND |
protected static String |
JSON_FORMAT |
protected static String |
OPTIQ_FORMAT |
protected static String |
UNEXPECTED_FOUND |
allocator, bits, client, config, serviceSetc, dirTestWatcher, optionManager| Constructor and Description |
|---|
PlanTestBase() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkForMetadataFile(String table)
Helper method for checking the metadata file existence
|
static void |
createMetadataDir(String table)
Create a temp metadata directory to query the metadata summary cache file
|
static String |
getPhysicalJsonPlan(String sql)
Converts given sql query into physical JSON plan representation.
|
protected static String |
getPlanInString(String sql,
String columnName) |
static void |
testPhysicalPlan(String sql,
String... expectedSubstrs)
This method will take a SQL string statement, get the PHYSICAL plan in json
format.
|
static void |
testPhysicalPlanExecutionBasedOnQuery(String query)
Creates physical plan for the given query and then executes this plan.
|
static void |
testPlanMatchingPatterns(String query,
Pattern[] expectedPatterns,
Pattern[] excludedPatterns) |
static void |
testPlanMatchingPatterns(String query,
String... expectedPatterns)
The same as above, but without excludedPatterns
|
static void |
testPlanMatchingPatterns(String query,
String[] expectedPatterns,
String[] excludedPatterns)
Runs an explain plan query and check for expected regex patterns (in optiq
text format), also ensure excluded patterns are not found.
|
static void |
testPlanMatchingPatterns(String query,
String planFormat,
String[] expectedPatterns,
String[] excludedPatterns) |
static void |
testPlanOneExcludedPattern(String query,
String excludedPattern) |
static void |
testPlanOneExpectedPattern(String query,
String expectedPattern) |
static void |
testPlanOneExpectedPatternOneExcluded(String query,
String expectedPattern,
String excludedPattern) |
static void |
testPlanSubstrPatterns(String query,
String[] expectedPatterns,
String[] excludedPatterns)
Runs an explain plan query and check for expected substring patterns (in optiq
text format), also ensure excluded patterns are not found.
|
static void |
testPlanWithAttributesMatchingPatterns(String query,
String[] expectedPatterns,
String[] excludedPatterns)
Runs an explain plan including attributes query and check for expected regex patterns
(in optiq text format), also ensure excluded patterns are not found.
|
static void |
testRelLogicalJoinOrder(String sql,
String... expectedSubstrs)
This method will take a SQL string statement, get the LOGICAL plan in Optiq
RelNode format.
|
static void |
testRelLogicalPlanLevDigest(String sql,
String... expectedSubstrs)
This method will take a SQL string statement, get the LOGICAL plan in Optiq
RelNode format.
|
static void |
testRelLogicalPlanLevExplain(String sql,
String... expectedSubstrs)
This method will take a SQL string statement, get the LOGICAL plan in Optiq
RelNode format.
|
static void |
testRelPhysicalJoinOrder(String sql,
String... expectedSubstrs)
This method will take a SQL string statement, get the LOGICAL plan in Optiq
RelNode format.
|
static void |
testRelPhysicalPlanLevDigest(String sql,
String... expectedSubstrs)
This method will take a SQL string statement, get the PHYSICAL plan in
Optiq RelNode format.
|
static void |
testRelPhysicalPlanLevExplain(String sql,
String... expectedSubstrs)
This method will take a SQL string statement, get the PHYSICAL plan in
Optiq RelNode format.
|
alterSession, cloneDefaultTestConfigProperties, closeClient, errorMsgTestHelper, getAllocator, getDrillbitContext, getFile, getPhysicalFileFromResource, getResultString, getUserPort, logResult, newTest, parseErrorHelper, printResult, resetAllSessionOptions, resetDrillbitCount, resetSessionOption, runSQL, setColumnWidth, setColumnWidths, setSessionOption, setSessionOption, setSessionOption, setSessionOption, setupDefaultTestCluster, test, test, testBuilder, testLogicalWithResults, testNoResult, testNoResult, testPhysical, testPhysicalFromFile, testPhysicalWithResults, testPreparedStatement, testRunAndPrint, testRunAndReturn, testSql, testSqlWithResults, testWithListener, updateClient, updateClient, updateClient, updateTestCluster, updateTestClusterclear, getLocalFileSystem, mockDrillbitContext, mockUsDateFormatSymbols, mockUtcDateTimeZone, parseExpr, setupOptionManagerprotected static final String OPTIQ_FORMAT
protected static final String JSON_FORMAT
protected static final String EXPECTED_NOT_FOUND
protected static final String UNEXPECTED_FOUND
public static void testPhysicalPlan(String sql, String... expectedSubstrs) throws Exception
Exceptionpublic static String getPhysicalJsonPlan(String sql) throws Exception
sql - sql queryExceptionpublic static void testPlanMatchingPatterns(String query, String[] expectedPatterns, String[] excludedPatterns) throws Exception
query - - an explain query, this method does not add it for youexpectedPatterns - - list of patterns that should appear in the planexcludedPatterns - - list of patterns that should not appear in the planException - - if an inclusion or exclusion check fails, or the
planning process throws an exceptionpublic static void testPlanMatchingPatterns(String query, Pattern[] expectedPatterns, Pattern[] excludedPatterns) throws Exception
Exceptionpublic static void testPlanMatchingPatterns(String query, String planFormat, String[] expectedPatterns, String[] excludedPatterns) throws Exception
Exceptionpublic static void testPlanMatchingPatterns(String query, String... expectedPatterns) throws Exception
Exceptionpublic static void testPlanWithAttributesMatchingPatterns(String query, String[] expectedPatterns, String[] excludedPatterns) throws Exception
query - - an explain query, this method does not add it for youexpectedPatterns - - list of patterns that should appear in the planexcludedPatterns - - list of patterns that should not appear in the planException - - if an inclusion or exclusion check fails, or the
planning process throws an exceptionpublic static void testPlanSubstrPatterns(String query, String[] expectedPatterns, String[] excludedPatterns) throws Exception
query - - an explain query, this method does not add it for youexpectedPatterns - - list of patterns that should appear in the planexcludedPatterns - - list of patterns that should not appear in the planException - - if an inclusion or exclusion check fails, or the
planning process throws an exceptionpublic static void testPlanOneExpectedPatternOneExcluded(String query, String expectedPattern, String excludedPattern) throws Exception
Exceptionpublic static void testPlanOneExpectedPattern(String query, String expectedPattern) throws Exception
Exceptionpublic static void testPlanOneExcludedPattern(String query, String excludedPattern) throws Exception
Exceptionpublic static void testRelLogicalJoinOrder(String sql, String... expectedSubstrs) throws Exception
Exceptionpublic static void testRelPhysicalJoinOrder(String sql, String... expectedSubstrs) throws Exception
Exceptionpublic static void testRelPhysicalPlanLevDigest(String sql, String... expectedSubstrs) throws Exception
Exceptionpublic static void testRelLogicalPlanLevDigest(String sql, String... expectedSubstrs) throws Exception
Exceptionpublic static void testRelPhysicalPlanLevExplain(String sql, String... expectedSubstrs) throws Exception
Exceptionpublic static void testRelLogicalPlanLevExplain(String sql, String... expectedSubstrs) throws Exception
Exceptionpublic static void testPhysicalPlanExecutionBasedOnQuery(String query) throws Exception
query - query stringExceptionpublic static void checkForMetadataFile(String table)
table - table name or table pathprotected static String getPlanInString(String sql, String columnName) throws Exception
Exceptionpublic static void createMetadataDir(String table) throws IOException
table - table name or table pathIOExceptionCopyright © 2022 The Apache Software Foundation. All rights reserved.