Skip to content

Commit

Permalink
[Draft] Add utility to read json files and test against Presto
Browse files Browse the repository at this point in the history
  • Loading branch information
bikramSingh91 committed Nov 12, 2024
1 parent e936f6e commit beb39f1
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 196 deletions.
22 changes: 14 additions & 8 deletions velox/exec/tests/utils/QueryAssertions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,7 @@ std::string makeErrorMessage(
message << extraRows.size() << " extra rows, " << missingRows.size()
<< " missing rows" << std::endl;

auto extraRowsToPrint =
std::min((size_t)FLAGS_max_error_rows, extraRows.size());
auto extraRowsToPrint = extraRows.size();
message << extraRowsToPrint << " of extra rows:" << std::endl;

for (int32_t i = 0; i < extraRowsToPrint; i++) {
Expand All @@ -696,8 +695,7 @@ std::string makeErrorMessage(
}
message << std::endl;

auto missingRowsToPrint =
std::min((size_t)FLAGS_max_error_rows, missingRows.size());
auto missingRowsToPrint = missingRows.size();
message << missingRowsToPrint << " of missing rows:" << std::endl;
for (int32_t i = 0; i < missingRowsToPrint; i++) {
message << "\t";
Expand Down Expand Up @@ -852,20 +850,28 @@ std::string generateUserFriendlyDiff(
const MaterializedRowMultiset& actualRows,
const TypePtr& type) {
std::vector<MaterializedRow> extraRows;
std::set_difference(
/* std::set_difference(
actualRows.begin(),
actualRows.end(),
expectedRows.begin(),
expectedRows.end(),
std::inserter(extraRows, extraRows.end()));
std::inserter(extraRows, extraRows.end()));*/

for(auto& item : actualRows) {
extraRows.push_back(item);
}

std::vector<MaterializedRow> missingRows;
std::set_difference(
/* std::set_difference(
expectedRows.begin(),
expectedRows.end(),
actualRows.begin(),
actualRows.end(),
std::inserter(missingRows, missingRows.end()));
std::inserter(missingRows, missingRows.end()));*/

for(auto& item : expectedRows) {
missingRows.push_back(item);
}

return makeErrorMessage(
missingRows, extraRows, expectedRows.size(), actualRows.size(), type);
Expand Down
Loading

0 comments on commit beb39f1

Please sign in to comment.