public class TestBaseViewSupport extends PlanTestBase
BaseTestQuery.ClassicTestServices, BaseTestQuery.SilentListener, BaseTestQuery.TestResultSet
EXPECTED_NOT_FOUND, JSON_FORMAT, OPTIQ_FORMAT, UNEXPECTED_FOUND
allocator, bits, client, config, serviceSet
c, dirTestWatcher, optionManager
Constructor and Description |
---|
TestBaseViewSupport() |
Modifier and Type | Method and Description |
---|---|
protected static String[] |
baselineColumns(String... names)
Convenient method for defining baselineColumns to be passed into
view helper methods.
|
protected static List<Object[]> |
baselineRows(Object[]... rows)
Convenient method for grouping of expected rows into
list of Object arrays, where each array represents concrete
row.
|
protected static void |
createViewHelper(String viewSchema,
String viewName,
String finalSchema,
String viewFields,
String viewDef)
Create view with given parameters.
|
protected static void |
dropViewHelper(String viewSchema,
String viewName,
String finalSchema)
Drop view with given parameters.
|
protected static void |
dropViewIfExistsHelper(String viewSchema,
String viewName,
String finalSchema,
Boolean ifViewExists)
Drop view if exists with given parameters.
|
protected static String |
generateViewName()
Generate a view name by appending the test class with a increasing counter.
|
protected static void |
queryViewHelper(String query,
String[] baselineColumns,
List<Object[]> baselineValues)
Execute the given query and check against the given baseline.
|
protected static Object[] |
row(Object... columns)
Helper method for conversion of Object varargs into
array of objects.
|
protected static void |
testViewHelper(String finalSchema,
String viewFields,
String viewDef,
String queryOnView,
String[] expectedBaselineColumns,
List<Object[]> expectedBaselineValues)
Tests creating a view with given parameters, query the view and check against the provided baselines and finally
drop the view.
|
checkForMetadataFile, createMetadataDir, getPhysicalJsonPlan, getPlanInString, testPhysicalPlan, testPhysicalPlanExecutionBasedOnQuery, testPlanMatchingPatterns, testPlanMatchingPatterns, testPlanMatchingPatterns, testPlanMatchingPatterns, testPlanOneExcludedPattern, testPlanOneExpectedPattern, testPlanOneExpectedPatternOneExcluded, testPlanSubstrPatterns, testPlanWithAttributesMatchingPatterns, testRelLogicalJoinOrder, testRelLogicalPlanLevDigest, testRelLogicalPlanLevExplain, testRelPhysicalJoinOrder, testRelPhysicalPlanLevDigest, testRelPhysicalPlanLevExplain
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, updateTestCluster
clear, getLocalFileSystem, mockDrillbitContext, mockUsDateFormatSymbols, mockUtcDateTimeZone, parseExpr, setupOptionManager
protected static void createViewHelper(String viewSchema, String viewName, String finalSchema, String viewFields, String viewDef) throws Exception
viewSchema
- Schema name to prefix when referring to the view.viewName
- Name of the view.finalSchema
- Absolute schema path where the view is created. Pameter viewSchema may refer the schema
with respect the current default schema. Combining viewSchema with default schema
gives the final schema.viewFields
- If the created view needs to specify the fields, otherwise nullviewDef
- Definition of the view.Exception
protected static void dropViewHelper(String viewSchema, String viewName, String finalSchema) throws Exception
viewSchema
- viewName
- finalSchema
- Exception
protected static void dropViewIfExistsHelper(String viewSchema, String viewName, String finalSchema, Boolean ifViewExists) throws Exception
viewSchema
- viewName
- finalSchema
- ifViewExists
- Helps to check query result depending from the existing of the view.Exception
protected static void queryViewHelper(String query, String[] baselineColumns, List<Object[]> baselineValues) throws Exception
query
- baselineColumns
- baselineValues
- Exception
protected static String generateViewName()
protected static void testViewHelper(String finalSchema, String viewFields, String viewDef, String queryOnView, String[] expectedBaselineColumns, List<Object[]> expectedBaselineValues) throws Exception
finalSchema
- Absolute schema path where the view is going to be created.viewFields
- If view has any field listviewDef
- Definition of the view.queryOnView
- Query to run on created view. Refer to test view using "TEST_VIEW_NAME". Similarly schema
using "TEST_SCHEMA".expectedBaselineColumns
- Expected columns from querying the view.expectedBaselineValues
- Expected row values from querying the view.Exception
protected static String[] baselineColumns(String... names)
names
- column names varargsprotected static List<Object[]> baselineRows(Object[]... rows)
rows
- rows in form of Object[] varargsCopyright © 2022 The Apache Software Foundation. All rights reserved.