Skip to content

Commit

Permalink
fix(fuzzer): Ensure common dictionary generation skips row_number column
Browse files Browse the repository at this point in the history
Ensure that the row_number column, used for lining up results with the
reference database, is not treated as a candidate for wrapping by the
fuzzer's feature that probabilistically adds a common dictionary layer.
This prevents verification mismatches caused by the column being
wrapped and losing its intended purpose.
  • Loading branch information
bikramSingh91 committed Dec 11, 2024
1 parent b9cce6d commit 729e3c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
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

0 comments on commit 729e3c3

Please sign in to comment.