Package com.illumon.iris.validation
Class DataQualityTestCase
java.lang.Object
com.illumon.iris.validation.DataQualityTestCase
- All Implemented Interfaces:
DataQualityTestCaseInterface
- Direct Known Subclasses:
AuditEventLogValidator
,DynamicValidator
,NonEmptyValidator
,NullValidator
,PersistentQueryConfigurationLogV2Validator
,PersistentQueryStateLogValidator
,ProcessEventLogValidator
,QueryOperationPerformanceLogValidator
,QueryPerformanceLogValidator
,UpdatePerformanceLogValidator
Tests to assure the quality of the data in a table. All data quality tests should inherit from this class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An exception thrown when an assertion fails.static interface
Interface for testing monotonicity. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Table
Table to validate.protected final ValidationTableDescription
Description of the table to validate. -
Constructor Summary
ConstructorsConstructorDescriptionDataQualityTestCase
(ValidationTableDescription validationTableDescription) Create a test case for use in validation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
assertAllValuesBetween
(Table t, String column, Comparable minValue, Comparable maxValue) Asserts that all values between [minValue,maxValue] is in the inclusive range [min,max].void
assertAllValuesEqual
(Table t, String column) Asserts that a column only contains a single value.void
assertAllValuesEqual
(Table t, String column, Object value) Asserts that a column only contains a single value.void
assertAllValuesInArrayInDistinctSet
(Table t, String column, Object... expectedValues) Asserts that all values contained in arrays in a column are present in a set of expected values.void
assertAllValuesInArrayNotInDistinctSet
(Table t, String column, Object... values) Asserts that all values contained in arrays in a column are not present in a set of values.void
assertAllValuesInDistinctSet
(Table t, String column, Object... expectedValues) Asserts that all values in a column are present in a set of expected values.void
assertAllValuesInStringSetInDistinctSet
(Table t, String column, Object... expectedValues) Asserts that all values contained in string sets in a column are present in a set of expected values.void
assertAllValuesInStringSetNotInDistinctSet
(Table t, String column, Object... values) Asserts that all values contained in string sets in a column are not present in a set of expected values.void
assertAllValuesNotEqual
(Table t, String column) Asserts that a column does not contain repeated values.void
assertAllValuesNotEqual
(Table t, String column, Object value) Asserts that a column does not contain a specified value.void
assertAllValuesNotInDistinctSet
(Table t, String column, Object... values) Asserts that all values in a column are not present in a set of values.void
assertAscending
(Table t, String column, String... groupByColumns) Asserts that sub-groups of a column have monotonically increasing values.void
Asserts that the average of the column is in the inclusive range [min,max].void
assertColumnGrouped
(Table t, String column) Asserts that a column is grouped.void
assertColumnType
(Table t, String column, Class type) Asserts that a column is of the expected type.void
Asserts that the column types in the table match the column types in the schema.void
assertCountEqual
(Table t, String column, Object value1, Object value2) Asserts that a column contains the same number of rows for two given values.void
assertDescending
(Table t, String column, String... groupByColumns) Asserts that sub-groups of a column have monotonically decreasing values.void
assertEqual
(Table t, String column1, String column2) Asserts that all values incolumn1
are equal to all values incolumn2
.static void
Asserts that a value equals a target.void
assertExpectedTableSize
(int partitionsBefore, int partitionsAfter, double min, double max) Asserts the number of rows in the table is within a specified fraction of the expected size, determined by looking at the other tables in the database.static void
assertFalse
(String message, boolean value) Asserts that value is false.void
assertFracInf
(Table t, String column, double min, double max) Asserts that the fraction of infinite values is in the inclusive range [min,max].void
assertFracNan
(Table t, String column, double min, double max) Asserts that the fraction of NaN values is in the inclusive range [min,max].void
assertFracNull
(Table t, String column, double min, double max) Asserts that the fraction of NULL values is in the inclusive range [min,max].void
assertFracValuesBetween
(Table t, String column, Comparable minValue, Comparable maxValue, double min, double max) Asserts that the fraction of values between [minValue,maxValue] is in the inclusive range [min,max].void
assertFracWhere
(Table t, String filter, double min, double max) Asserts the fraction of a table's rows matching the provided filter falls within a defined range.void
assertFracZero
(Table t, String column, double min, double max) Asserts that the fraction of zero values is in the inclusive range [min,max].void
assertGreater
(Table t, String column1, String column2) Asserts that all values incolumn1
are greater than all values incolumn2
.void
assertGreaterEqual
(Table t, String column1, String column2) Asserts that all values incolumn1
are greater than or equal to all values incolumn2
.static void
assertInRange
(String testName, String tableName, String column, double value, double min, double max) Asserts that a value is in the inclusive range [min,max].static void
assertInRange
(String testName, String tableName, String column, long value, long min, long max) Asserts that a value is in the inclusive range [min,max].static <T extends Comparable<T>>
voidassertInRange
(String testName, String tableName, String column, T value, T min, T max) Asserts that a value is in the inclusive range [min,max].void
assertLess
(Table t, String column1, String column2) Asserts that all values incolumn1
are less than all values incolumn2
.void
assertLessEqual
(Table t, String column1, String column2) Asserts that all values incolumn1
are less than or equal to all values incolumn2
.void
assertMax
(Table t, String column, Comparable min, Comparable max, String... groupByColumns) Asserts that the maximum value of the column is in the inclusive range [min,max].void
assertMin
(Table t, String column, Comparable min, Comparable max, String... groupByColumns) Asserts that the minimum value of the column is in the inclusive range [min,max].void
assertNotEqual
(Table t, String column1, String column2) Asserts that all values incolumn1
are not equal to all values incolumn2
.static void
Asserts that a value does not equal a target.void
assertNotNull
(Table t, String... columns) void
assertNumberDistinctValues
(Table t, String columns, long min, long max) Asserts the number of distinct values is in the inclusive range [min,max].void
assertPercentile
(Table t, String column, double percentile, double min, double max, String... groupByColumns) Asserts that the defined percentile of the column is in the inclusive range [min,max].void
assertSize
(Table t, long min, long max) Asserts the number of rows in the table is in the inclusive range [min,max].void
Asserts that the standard deviation of the column is in the inclusive range [min,max].void
assertStrictlyAscending
(Table t, String column, String... groupByColumns) Asserts that sub-groups of a column have monotonically strictly increasing values.void
assertStrictlyDescending
(Table t, String column, String... groupByColumns) Asserts that sub-groups of a column have monotonically strictly decreasing values.static void
assertTrue
(String message, boolean value) Asserts that value is true.static Table
Remove rows containing various values from a table.static Table
Remove rows containing various values from a table.void
Empties the list of messages.static void
fail()
Fails the teststatic void
Fails the testprotected static long
getActualTableSize
(Database database, String namespace, String tableName, String partition) Gets the size of table.protected static long
getActualTableSize
(ValidationTableDescription validationTableDescription) Gets the size of table.protected static long
getExpectedTableSize
(Database database, String namespace, String tableName, String partition, int partitionsBefore, int partitionsAfter) Gets the size of table we expect by looking at other tables in the database.protected static long
getExpectedTableSize
(ValidationTableDescription validationTableDescription, int partitionsBefore, int partitionsAfter) Gets the size of table we expect by looking at other tables in the database.Gets the messages to log.protected static String[]
Gets the names of the partitioning columns from a table.protected static String[]
Gets the names of the partitioning columns from a table definition.protected static Table
getPartitionTable
(Database database, FullTableLocationKey.AggregateTableLocationKey location) Gets the table from a database for a given partition.void
Add a message to log.void
Write a message and a the first rows of a table out to the message queue.void
Write a message and a the first rows of a table out to the message queue.void
messageIfNotEmpty
(String message, Table t) Write a message and a the first rows of a table out to the message queue.void
messageIfNotEmpty
(String message, Table t, int nRows) Write a message and a the first rows of a table out to the message queue.void
setUp()
Setup the test.void
tearDown()
Tear down the test.
-
Field Details
-
validationTableDescription
Description of the table to validate. -
table
Table to validate.
-
-
Constructor Details
-
DataQualityTestCase
Create a test case for use in validation.- Parameters:
validationTableDescription
- description of the table to validate.
-
-
Method Details
-
getPartitionColumnNames
Gets the names of the partitioning columns from a table.- Parameters:
t
- table- Returns:
- names of the partitioning columns
-
getPartitionColumnNames
Gets the names of the partitioning columns from a table definition.- Parameters:
td
- table definition- Returns:
- names of the partitioning columns
-
getPartitionTable
protected static Table getPartitionTable(Database database, FullTableLocationKey.AggregateTableLocationKey location) Gets the table from a database for a given partition. -
setUp
public void setUp()Description copied from interface:DataQualityTestCaseInterface
Setup the test.- Specified by:
setUp
in interfaceDataQualityTestCaseInterface
-
tearDown
public void tearDown()Description copied from interface:DataQualityTestCaseInterface
Tear down the test.- Specified by:
tearDown
in interfaceDataQualityTestCaseInterface
-
clearMessages
public void clearMessages()Description copied from interface:DataQualityTestCaseInterface
Empties the list of messages.- Specified by:
clearMessages
in interfaceDataQualityTestCaseInterface
-
getMessages
Description copied from interface:DataQualityTestCaseInterface
Gets the messages to log.- Specified by:
getMessages
in interfaceDataQualityTestCaseInterface
- Returns:
- messages to log
-
message
Description copied from interface:DataQualityTestCaseInterface
Add a message to log.- Specified by:
message
in interfaceDataQualityTestCaseInterface
- Parameters:
m
- message to log.
-
clean
public static Table clean(Table t, String column, boolean removeNull, boolean removeNaN, boolean removeInf) Remove rows containing various values from a table.- Parameters:
t
- tablecolumn
- columnremoveNull
- true to remove rows wherecolumn
is NULLremoveNaN
- true to remove rows wherecolumn
is NaNremoveInf
- true to remove rows wherecolumn
is Inf- Returns:
- table with rows matching the indicated filters removed
-
clean
public static Table clean(Table t, String[] columns, boolean removeNull, boolean removeNaN, boolean removeInf) Remove rows containing various values from a table.- Parameters:
t
- tablecolumns
- columnsremoveNull
- true to remove rows wherecolumns
are NULLremoveNaN
- true to remove rows wherecolumns
are NaNremoveInf
- true to remove rows wherecolumns
are Inf- Returns:
- table with rows matching the indicated filters removed
-
message
Write a message and a the first rows of a table out to the message queue.- Parameters:
message
- messaget
- table to lognRows
- number of rows to log
-
message
Write a message and a the first rows of a table out to the message queue.- Parameters:
message
- messaget
- table to log
-
messageIfNotEmpty
Write a message and a the first rows of a table out to the message queue. Output is only generated if the table is not empty.- Parameters:
message
- messaget
- table to lognRows
- number of rows to log
-
messageIfNotEmpty
Write a message and a the first rows of a table out to the message queue. Output is only generated if the table is not empty.- Parameters:
message
- messaget
- table to log
-
fail
Fails the test- Parameters:
message
- message describing the failure
-
fail
public static void fail()Fails the test -
assertTrue
Asserts that value is true.- Parameters:
message
- message describing the failurevalue
- value to test- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertFalse
Asserts that value is false.- Parameters:
message
- message describing the failurevalue
- value to test- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertEquals
public static void assertEquals(String testName, String tableName, String column, Object value, Object target) Asserts that a value equals a target.- Parameters:
testName
- test nametableName
- table namecolumn
- column namevalue
- to testtarget
- target value- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertNotEquals
public static void assertNotEquals(String testName, String tableName, String column, Object value, Object target) Asserts that a value does not equal a target.- Parameters:
testName
- test nametableName
- table namecolumn
- column namevalue
- to testtarget
- target value- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertInRange
public static <T extends Comparable<T>> void assertInRange(String testName, String tableName, String column, T value, T min, T max) Asserts that a value is in the inclusive range [min,max].- Parameters:
testName
- test nametableName
- table namecolumn
- column namevalue
- to testmin
- minimum value for the value rangemax
- maximum value for the value range- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertInRange
public static void assertInRange(String testName, String tableName, String column, long value, long min, long max) Asserts that a value is in the inclusive range [min,max].- Parameters:
testName
- test nametableName
- table namecolumn
- column namevalue
- to testmin
- minimum value for the value rangemax
- maximum value for the value range- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertInRange
public static void assertInRange(String testName, String tableName, String column, double value, double min, double max) Asserts that a value is in the inclusive range [min,max].- Parameters:
testName
- test nametableName
- table namecolumn
- column namevalue
- to testmin
- minimum value for the value rangemax
- maximum value for the value range- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertSize
Asserts the number of rows in the table is in the inclusive range [min,max].- Parameters:
t
- table to validatemin
- minimum number of table rowsmax
- maximum number of table rows- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertColumnType
Asserts that a column is of the expected type.- Parameters:
t
- table to validatecolumn
- column to validatetype
- expected type- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertColumnGrouped
Asserts that a column is grouped.- Parameters:
t
- table to validatecolumn
- column to validate- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesEqual
Asserts that a column only contains a single value.- Parameters:
t
- table to validatecolumn
- column to validate- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesNotEqual
Asserts that a column does not contain repeated values.- Parameters:
t
- table to validatecolumn
- column to validate- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesEqual
Asserts that a column only contains a single value.- Parameters:
t
- table to validatecolumn
- column to validatevalue
- make sure the column only contains this value- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesNotEqual
Asserts that a column does not contain a specified value.- Parameters:
t
- table to validatecolumn
- column to validatevalue
- make sure the column does not contain this value- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertEqual
Asserts that all values incolumn1
are equal to all values incolumn2
.- Parameters:
t
- table to validatecolumn1
- column to testcolumn2
- column to test- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertNotEqual
Asserts that all values incolumn1
are not equal to all values incolumn2
.- Parameters:
t
- table to validatecolumn1
- column to testcolumn2
- column to test- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertLess
Asserts that all values incolumn1
are less than all values incolumn2
.- Parameters:
t
- Tablecolumn1
- column to testcolumn2
- column to test- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertLessEqual
Asserts that all values incolumn1
are less than or equal to all values incolumn2
.- Parameters:
t
- Tablecolumn1
- column to testcolumn2
- column to test- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertGreater
Asserts that all values incolumn1
are greater than all values incolumn2
.- Parameters:
t
- Tablecolumn1
- column to testcolumn2
- column to test- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertGreaterEqual
Asserts that all values incolumn1
are greater than or equal to all values incolumn2
.- Parameters:
t
- Tablecolumn1
- column to testcolumn2
- column to test- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertNumberDistinctValues
Asserts the number of distinct values is in the inclusive range [min,max].- Parameters:
t
- Tablecolumns
- comma separated list of columns to testmin
- minimum fraction of values remaining after the filter. Between 0 and 1.max
- maximum fraction of values remaining after the filter. Between 0 and 1.- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesInDistinctSet
Asserts that all values in a column are present in a set of expected values.- Parameters:
t
- Tablecolumn
- column to testexpectedValues
- set of expected values- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesInArrayInDistinctSet
Asserts that all values contained in arrays in a column are present in a set of expected values.- Parameters:
t
- Tablecolumn
- column to testexpectedValues
- set of expected values- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesInStringSetInDistinctSet
public void assertAllValuesInStringSetInDistinctSet(Table t, String column, Object... expectedValues) Asserts that all values contained in string sets in a column are present in a set of expected values.- Parameters:
t
- Tablecolumn
- column to testexpectedValues
- set of expected values- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesNotInDistinctSet
Asserts that all values in a column are not present in a set of values.- Parameters:
t
- Tablecolumn
- column to testvalues
- set of values- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesInArrayNotInDistinctSet
Asserts that all values contained in arrays in a column are not present in a set of values.- Parameters:
t
- Tablecolumn
- column to testvalues
- set of values- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesInStringSetNotInDistinctSet
Asserts that all values contained in string sets in a column are not present in a set of expected values.- Parameters:
t
- Tablecolumn
- column to testvalues
- set of expected values- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertFracWhere
Asserts the fraction of a table's rows matching the provided filter falls within a defined range.- Parameters:
t
- table to validatefilter
- filtermin
- minimum fraction of values remaining after the filter. Between 0 and 1.max
- maximum fraction of values remaining after the filter. Between 0 and 1.- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertFracNull
Asserts that the fraction of NULL values is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testmin
- minimum fraction of values remaining after the filter. Between 0 and 1.max
- maximum fraction of values remaining after the filter. Between 0 and 1.- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertNotNull
-
assertFracNan
Asserts that the fraction of NaN values is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testmin
- minimum fraction of values remaining after the filter. Between 0 and 1.max
- maximum fraction of values remaining after the filter. Between 0 and 1.- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertFracInf
Asserts that the fraction of infinite values is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testmin
- minimum fraction of values remaining after the filter. Between 0 and 1.max
- maximum fraction of values remaining after the filter. Between 0 and 1.- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertFracZero
Asserts that the fraction of zero values is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testmin
- minimum fraction of values remaining after the filter. Between 0 and 1.max
- maximum fraction of values remaining after the filter. Between 0 and 1.- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertFracValuesBetween
public void assertFracValuesBetween(Table t, String column, Comparable minValue, Comparable maxValue, double min, double max) Asserts that the fraction of values between [minValue,maxValue] is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testminValue
- minimum value for the value rangemaxValue
- maximum value for the value rangemin
- minimum fraction of values remaining after the filter. Between 0 and 1.max
- maximum fraction of values remaining after the filter. Between 0 and 1.- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAllValuesBetween
public void assertAllValuesBetween(Table t, String column, Comparable minValue, Comparable maxValue) Asserts that all values between [minValue,maxValue] is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testminValue
- minimum value for the value rangemaxValue
- maximum value for the value range- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertMin
public void assertMin(Table t, String column, Comparable min, Comparable max, String... groupByColumns) Asserts that the minimum value of the column is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testmin
- minimum value for the value rangemax
- maximum value for the value rangegroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertMax
public void assertMax(Table t, String column, Comparable min, Comparable max, String... groupByColumns) Asserts that the maximum value of the column is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testmin
- minimum value for the value rangemax
- maximum value for the value rangegroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAvg
Asserts that the average of the column is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testmin
- minimum value for the value rangemax
- maximum value for the value rangegroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertStd
Asserts that the standard deviation of the column is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testmin
- minimum value for the value rangemax
- maximum value for the value rangegroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertPercentile
public void assertPercentile(Table t, String column, double percentile, double min, double max, String... groupByColumns) Asserts that the defined percentile of the column is in the inclusive range [min,max].- Parameters:
t
- Tablecolumn
- column to testpercentile
- percentile of the column to test. Between 0 and 1.min
- minimum value for the value rangemax
- maximum value for the value rangegroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertAscending
Asserts that sub-groups of a column have monotonically increasing values. Consecutive values within a group must be equal or increasing.- Parameters:
t
- Tablecolumn
- column to testgroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertStrictlyAscending
Asserts that sub-groups of a column have monotonically strictly increasing values. Consecutive values within a group must be increasing.- Parameters:
t
- Tablecolumn
- column to testgroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertDescending
Asserts that sub-groups of a column have monotonically decreasing values. Consecutive values within a group must be equal or decreasing.- Parameters:
t
- Tablecolumn
- column to testgroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertStrictlyDescending
Asserts that sub-groups of a column have monotonically strictly decreasing values. Consecutive values within a group must be decreasing.- Parameters:
t
- Tablecolumn
- column to testgroupByColumns
- columns delineating groups for testing monotonicity- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertExpectedTableSize
public void assertExpectedTableSize(int partitionsBefore, int partitionsAfter, double min, double max) Asserts the number of rows in the table is within a specified fraction of the expected size, determined by looking at the other tables in the database. For example min=0.8 and max=1.2 would assert that the table size is within 80% and 120% of the typical table size.- Parameters:
partitionsBefore
- number of partitions before the current partition to compute expectationpartitionsAfter
- number of partitions after the current partition to compute expectationmin
- minimum fraction of expected rows in this tablemax
- maximum fraction of expected rows in this table- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
getActualTableSize
Gets the size of table.- Parameters:
validationTableDescription
- description of the table to validate- Returns:
- size of the table for the partition.
-
getActualTableSize
protected static long getActualTableSize(Database database, String namespace, String tableName, String partition) Gets the size of table.- Parameters:
database
- databasenamespace
- namespace for the databasetableName
- name of the tablepartition
- to get the expected size for.- Returns:
- size of the table for the partition.
-
getExpectedTableSize
protected static long getExpectedTableSize(ValidationTableDescription validationTableDescription, int partitionsBefore, int partitionsAfter) Gets the size of table we expect by looking at other tables in the database.- Parameters:
validationTableDescription
- description of the table to validatepartitionsBefore
- number of partitions before the current partition to use as a baselinepartitionsAfter
- number of partitions after the current partition to use as a baseline- Returns:
- expected size of the table for the partition.
-
getExpectedTableSize
protected static long getExpectedTableSize(Database database, String namespace, String tableName, String partition, int partitionsBefore, int partitionsAfter) Gets the size of table we expect by looking at other tables in the database.- Parameters:
database
- databasenamespace
- namespace for the databasetableName
- name of the tablepartition
- to get the expected size for.partitionsBefore
- number of partitions before the current partition to use as a baselinepartitionsAfter
- number of partitions after the current partition to use as a baseline- Returns:
- expected size of the table for the partition.
-
assertCountEqual
Asserts that a column contains the same number of rows for two given values.- Parameters:
t
- table to validatecolumn
- column to validatevalue1
- make sure the column has the same number of value1 and value2 entriesvalue2
- make sure the column has the same number of value1 and value2 entries- Throws:
DataQualityTestCase.AssertionFailed
- the assertion failed
-
assertColumnTypes
Asserts that the column types in the table match the column types in the schema.- Parameters:
t
- table to validate
-