public class RowSetComparison extends Object
Drill rows are analogous to JSON documents: they can have scalars, arrays and maps, with maps and lists holding maps, arrays and scalars. This class walks the row structure tree to compare each structure of two row sets checking counts, types and values to ensure that the "actual" result set (result of a test) matches the "expected" result set.
This class acts as an example of how to use the suite of reader abstractions.
| Modifier and Type | Class and Description |
|---|---|
static class |
RowSetComparison.ObjectComparator |
| Constructor and Description |
|---|
RowSetComparison(RowSet expected) |
| Modifier and Type | Method and Description |
|---|---|
RowSetComparison |
exclude(int colNo)
Mark a specific column as excluded from comparisons.
|
RowSetComparison |
offset(int offset)
Specify an offset into the row sets to start the comparison.
|
RowSetComparison |
span(int span)
Specify a subset of rows to compare.
|
void |
unorderedVerify(RowSet actual) |
void |
unorderedVerifyAndClearAll(RowSet actual)
Verifies the actual results, then frees memory
for both the expected and actual result sets.
|
void |
verify(RowSet actual)
Verify the actual rows using the rules defined in this builder
|
void |
verifyAndClear(RowSet actual)
Convenience method to verify the actual results, then free memory
for the actual result sets.
|
void |
verifyAndClearAll(RowSet actual)
Convenience method to verify the actual results, then free memory
for both the expected and actual result sets.
|
RowSetComparison |
withMask(Boolean... flags)
Specifies a "selection" mask that determines which columns
to compare.
|
RowSetComparison |
withScale(int scale)
Specify the precision to use when comparing float or
double values.
|
public RowSetComparison(RowSet expected)
public RowSetComparison exclude(int colNo)
colNo - the index of the column to excludepublic RowSetComparison withMask(Boolean... flags)
flags - variable-length list of column flagspublic RowSetComparison withScale(int scale)
scale - the precision to use for comparing floats and doubles. See BigDecimal.scale() for
a definition scale.public RowSetComparison offset(int offset)
span(int).offset - offset into the row set to start the comparisonpublic RowSetComparison span(int span)
offset(int).span - the number of rows to comparepublic void unorderedVerify(RowSet actual)
public void unorderedVerifyAndClearAll(RowSet actual)
actual - the actual results to verifypublic void verify(RowSet actual)
actual - the actual results to verifypublic void verifyAndClear(RowSet actual)
actual - the actual results to verifypublic void verifyAndClearAll(RowSet actual)
actual - the actual results to verifyCopyright © 2021 The Apache Software Foundation. All rights reserved.