Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fuzzer): Ensure common dictionary generation skips row_number column #11821

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions velox/expression/fuzzer/ExpressionFuzzerVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,15 @@ void ExpressionFuzzerVerifier::retryWithTry(
}
}

RowVectorPtr ExpressionFuzzerVerifier::fuzzInputWithRowNumber(
VectorFuzzer& fuzzer,
const RowTypePtr& type) {
auto rowVector = fuzzer.fuzzInputRow(type);
auto names = type->names();
RowVectorPtr ExpressionFuzzerVerifier::appendRowNumberColumn(
RowVectorPtr& inputRow) {
auto names = asRowType(inputRow->type())->names();
names.push_back("row_number");

auto& children = rowVector->children();
auto& children = inputRow->children();
velox::test::VectorMaker vectorMaker{pool_.get()};
children.push_back(vectorMaker.flatVector<int64_t>(
rowVector->size(), [&](auto row) { return row; }));
inputRow->size(), [&](auto row) { return row; }));

return vectorMaker.rowVector(names, children);
}
Expand Down Expand Up @@ -375,10 +373,10 @@ void ExpressionFuzzerVerifier::go() {

std::vector<core::TypedExprPtr> plans = std::move(expressions);

auto rowVector = fuzzInputWithRowNumber(*vectorFuzzer_, inputType);

auto rowVector = vectorFuzzer_->fuzzInputRow(inputType);
InputRowMetadata inputRowMetadata =
generateInputRowMetadata(rowVector, *vectorFuzzer_);
rowVector = appendRowNumberColumn(rowVector);

auto resultVectors = generateResultVectors(plans);
ResultOrError result;
Expand Down
8 changes: 4 additions & 4 deletions velox/expression/fuzzer/ExpressionFuzzerVerifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ class ExpressionFuzzerVerifier {
const RowVectorPtr& rowVector,
VectorFuzzer& vectorFuzzer);

// Fuzzes the input vector of type with an additional row number column.
RowVectorPtr fuzzInputWithRowNumber(
VectorFuzzer& fuzzer,
const RowTypePtr& type);
// Appends an additional row number column called 'row_number' at the end of
// the 'inputRow'. This column is then used to line up rows when comparing
// results against a reference database.
RowVectorPtr appendRowNumberColumn(RowVectorPtr& inputRow);

const Options options_;

Expand Down
Loading