assert getExpectedSchema() == null : "The expected schema is not needed when baselineValues are provided "; if (ordered == null) { throw new RuntimeException("Ordering not set, before specifying baseline data you must explicitly call the ordered() or unOrdered() method on the " + this.getClass().getSimpleName());
/** * This setting has a slightly different impact on the test depending on some of the other * configuration options are set. * * If a JSON baseline file is given, this list will act as a project list to verify the * test query against a subset of the columns in the file. * * For a CSV baseline file, these will act as aliases for columns [0 .. n] in the repeated * varchar column that is read out of CSV. * * For a baseline sql query, this currently has no effect. * * For explicit baseline values given in java code with the baselineValues() method, these will * be used to create a map for the one record verification. */ public TestBuilder baselineColumns(String... columns) { assert getExpectedSchema() == null : "The expected schema is not needed when baselineColumns are provided "; this.baselineColumns = new String[columns.length]; for (int i = 0; i < columns.length; i++) { this.baselineColumns[i] = parsePath(columns[i]).toExpr(); } return this; }
public void run() throws Exception { if (testBuilder.getExpectedSchema() != null) { compareSchemaOnly(); } else { if (ordered) { compareOrderedResults(); } else { compareUnorderedResults(); } } }
final List<Pair<SchemaPath, MajorType>> expectedSchema = testBuilder.getExpectedSchema(); if(schema.getFieldCount() != expectedSchema.size()) { throw new Exception(String.format("Expected and actual numbers of columns do not match. Expected: %s, Actual: %s.", expectedSchema, schema));