diff --git a/velox/expression/fuzzer/ExpressionFuzzerVerifier.cpp b/velox/expression/fuzzer/ExpressionFuzzerVerifier.cpp index ddae30f11f0e..1ede9f9cccb9 100644 --- a/velox/expression/fuzzer/ExpressionFuzzerVerifier.cpp +++ b/velox/expression/fuzzer/ExpressionFuzzerVerifier.cpp @@ -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( - rowVector->size(), [&](auto row) { return row; })); + inputRow->size(), [&](auto row) { return row; })); return vectorMaker.rowVector(names, children); } @@ -375,10 +373,10 @@ void ExpressionFuzzerVerifier::go() { std::vector 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; diff --git a/velox/expression/fuzzer/ExpressionFuzzerVerifier.h b/velox/expression/fuzzer/ExpressionFuzzerVerifier.h index c03de0de2b3d..aaf6d7d5cdce 100644 --- a/velox/expression/fuzzer/ExpressionFuzzerVerifier.h +++ b/velox/expression/fuzzer/ExpressionFuzzerVerifier.h @@ -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_;