public class TestBuilder extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
TestBuilder.BaselineQueryTestBuilder |
class |
TestBuilder.CSVTestBuilder |
class |
TestBuilder.JSONTestBuilder |
class |
TestBuilder.SchemaTestBuilder |
| Modifier and Type | Field and Description |
|---|---|
protected String[] |
baselineColumns |
protected Map<SchemaPath,TypeProtos.MajorType> |
baselineTypeMap |
| Constructor and Description |
|---|
TestBuilder(DrillTestWrapper.TestServices services) |
TestBuilder(DrillTestWrapper.TestServices services,
Object query,
UserBitShared.QueryType queryType,
Boolean ordered,
boolean approximateEquality,
Map<SchemaPath,TypeProtos.MajorType> baselineTypeMap,
String baselineOptionSettingQueries,
String testOptionSettingQueries,
boolean highPerformanceComparison,
int expectedNumBatches) |
| Modifier and Type | Method and Description |
|---|---|
TestBuilder |
approximateEquality() |
TestBuilder |
approximateEquality(double tolerance) |
TestBuilder |
baselineColumns(String... columns)
This setting has a slightly different impact on the test depending on some of the other
configuration options are set.
|
TestBuilder |
baselineRecords(List<Map<String,Object>> materializedRecords)
This can be used in cases where we want to avoid issues with the assumptions made by the test framework.
|
TestBuilder |
baselineTypes(Map<SchemaPath,TypeProtos.MajorType> baselineTypeMap) |
TestBuilder |
baselineValues(Object... baselineValues)
This method is used to pass in a simple list of values for a single record verification without
the need to create a CSV or JSON file to store the baseline.
|
TestBuilder |
baselineValuesForSingleColumn(Object... baselineValues)
This method is used to pass in an array of values for records verification in case if
baselineColumns(String...) specifies one column only without
the need to create a CSV or JSON file to store the baseline. |
DrillTestWrapper |
build() |
static LocalDateTime |
convertToLocalDateTime(String value)
Helper method for the timestamp values that depend on the local timezone
|
static Timestamp |
convertToLocalTimestamp(String value)
Helper method for the timestamp values that depend on the local timezone
|
TestBuilder.CSVTestBuilder |
csvBaselineFile(String filePath) |
TestBuilder |
expectsEmptyResultSet()
Indicate that the tests query should be checked for an empty result set.
|
TestBuilder |
expectsNumBatches(int expectedNumBatches)
Sets the number of expected batch count for this query.
|
TestBuilder |
expectsNumRecords(int expectedNumRecords) |
List<org.apache.commons.lang3.tuple.Pair<SchemaPath,TypeProtos.MajorType>> |
getExpectedSchema() |
protected UserBitShared.QueryType |
getValidationQueryType() |
void |
go() |
TestBuilder |
highPerformanceComparison() |
TestBuilder.JSONTestBuilder |
jsonBaselineFile(String filePath) |
static JsonStringArrayList<Object> |
listOf(Object... values)
Convenience method to create a
list from the given values. |
static JsonStringHashMap<String,Object> |
mapOf(Object... keyValueSequence)
Convenience method to create a
JsonStringHashMap map instance with the given key value sequence. |
static JsonStringHashMap<Object,Object> |
mapOfObject(Object... keyValueSequence)
Convenience method to create an instance of
JsonStringHashMap<Object, Object> with the given key-value sequence. |
TestBuilder |
optionSettingQueriesForBaseline(String queries) |
TestBuilder |
optionSettingQueriesForBaseline(String queries,
Object... args) |
TestBuilder |
optionSettingQueriesForTestQuery(String queries)
list of queries to run before the test query, can be used to set several options
list takes the form of a semi-colon separated list.
|
TestBuilder |
optionSettingQueriesForTestQuery(String query,
Object... args) |
TestBuilder |
ordered() |
static SchemaPath |
parsePath(String path) |
TestBuilder.BaselineQueryTestBuilder |
physicalPlanBaseline(String physicalPlan) |
TestBuilder.BaselineQueryTestBuilder |
physicalPlanBaselineQueryFromFile(String baselinePhysicalPlanPath) |
TestBuilder |
physicalPlanFromFile(String queryFile) |
TestBuilder |
preparedStatement(UserProtos.PreparedStatementHandle preparedStatementHandle) |
protected TestBuilder |
reset() |
TestBuilder.SchemaTestBuilder |
schemaBaseLine(BatchSchema batchSchema) |
TestBuilder.SchemaTestBuilder |
schemaBaseLine(List<org.apache.commons.lang3.tuple.Pair<SchemaPath,TypeProtos.MajorType>> expectedSchema) |
TestBuilder.BaselineQueryTestBuilder |
sqlBaselineQuery(Object baselineQuery)
Provide a SQL query to validate against.
|
TestBuilder.BaselineQueryTestBuilder |
sqlBaselineQuery(String query,
String... replacements) |
TestBuilder.BaselineQueryTestBuilder |
sqlBaselineQueryFromFile(String baselineQueryFilename) |
TestBuilder |
sqlQuery(String query) |
TestBuilder |
sqlQuery(String query,
Object... replacements) |
TestBuilder |
sqlQueryFromFile(String queryFile) |
TestBuilder |
unOrdered() |
protected Map<SchemaPath,TypeProtos.MajorType> baselineTypeMap
protected String[] baselineColumns
public TestBuilder(DrillTestWrapper.TestServices services)
public TestBuilder(DrillTestWrapper.TestServices services, Object query, UserBitShared.QueryType queryType, Boolean ordered, boolean approximateEquality, Map<SchemaPath,TypeProtos.MajorType> baselineTypeMap, String baselineOptionSettingQueries, String testOptionSettingQueries, boolean highPerformanceComparison, int expectedNumBatches)
protected TestBuilder reset()
public DrillTestWrapper build()
public List<org.apache.commons.lang3.tuple.Pair<SchemaPath,TypeProtos.MajorType>> getExpectedSchema()
public TestBuilder sqlQuery(String query)
public TestBuilder sqlQuery(String query, Object... replacements)
public TestBuilder preparedStatement(UserProtos.PreparedStatementHandle preparedStatementHandle)
public TestBuilder sqlQueryFromFile(String queryFile) throws IOException
IOExceptionpublic TestBuilder physicalPlanFromFile(String queryFile) throws IOException
IOExceptionpublic TestBuilder ordered()
public TestBuilder unOrdered()
public TestBuilder highPerformanceComparison() throws Exception
Exceptionpublic TestBuilder optionSettingQueriesForBaseline(String queries)
public TestBuilder optionSettingQueriesForBaseline(String queries, Object... args)
public TestBuilder optionSettingQueriesForTestQuery(String queries)
queries - queries that set session and system optionspublic TestBuilder optionSettingQueriesForTestQuery(String query, Object... args) throws Exception
Exceptionpublic TestBuilder approximateEquality()
public TestBuilder approximateEquality(double tolerance)
public static SchemaPath parsePath(String path)
protected UserBitShared.QueryType getValidationQueryType()
public TestBuilder.JSONTestBuilder jsonBaselineFile(String filePath)
public TestBuilder.CSVTestBuilder csvBaselineFile(String filePath)
public TestBuilder.SchemaTestBuilder schemaBaseLine(BatchSchema batchSchema)
public TestBuilder.SchemaTestBuilder schemaBaseLine(List<org.apache.commons.lang3.tuple.Pair<SchemaPath,TypeProtos.MajorType>> expectedSchema)
public TestBuilder baselineTypes(Map<SchemaPath,TypeProtos.MajorType> baselineTypeMap)
public TestBuilder expectsEmptyResultSet()
public TestBuilder expectsNumBatches(int expectedNumBatches)
expectedNumBatches - expected batch countpublic TestBuilder expectsNumRecords(int expectedNumRecords)
public TestBuilder baselineValues(Object... baselineValues)
baselineValues - - the baseline values to validatepublic TestBuilder baselineValuesForSingleColumn(Object... baselineValues)
baselineColumns(String...) specifies one column only without
the need to create a CSV or JSON file to store the baseline.
This can be called repeatedly to pass an array of records to verify. It works for both ordered and unordered
checks.baselineValues - baseline values for a single column to validatethis test builderpublic TestBuilder baselineRecords(List<Map<String,Object>> materializedRecords)
materializedRecords - - a list of maps representing materialized resultspublic TestBuilder baselineColumns(String... columns)
public TestBuilder.BaselineQueryTestBuilder sqlBaselineQuery(Object baselineQuery)
baselineQuery - public TestBuilder.BaselineQueryTestBuilder sqlBaselineQuery(String query, String... replacements)
public TestBuilder.BaselineQueryTestBuilder sqlBaselineQueryFromFile(String baselineQueryFilename) throws IOException
IOExceptionpublic TestBuilder.BaselineQueryTestBuilder physicalPlanBaselineQueryFromFile(String baselinePhysicalPlanPath) throws IOException
IOExceptionpublic TestBuilder.BaselineQueryTestBuilder physicalPlanBaseline(String physicalPlan)
public static JsonStringArrayList<Object> listOf(Object... values)
list from the given values.public static JsonStringHashMap<String,Object> mapOf(Object... keyValueSequence)
JsonStringHashMap map instance with the given key value sequence.
Key value sequence consists of key - value pairs such that a key precedes its value. For instance:
mapOf("name", "Adam", "age", 41) corresponds to {"name": "Adam", "age": 41} in JSON.public static JsonStringHashMap<Object,Object> mapOfObject(Object... keyValueSequence)
JsonStringHashMap<Object, Object> with the given key-value sequence.
By default, any String instance will be wrapped by Text instance. To disable wrapping pass
false as the first object to key-value sequence.keyValueSequence - sequence of key-value pairs with optional boolean
flag which disables wrapping String instances by Text.public static Timestamp convertToLocalTimestamp(String value)
value - expected timestamp value in UTCpublic static LocalDateTime convertToLocalDateTime(String value)
value - expected timestamp value in UTCCopyright © 2021 The Apache Software Foundation. All rights reserved.