From ba4a6254c535e4880cdcef8153947ede6cdd676d Mon Sep 17 00:00:00 2001 From: zhejiangxiaomai Date: Sun, 23 Apr 2023 15:05:19 +0800 Subject: [PATCH] Revert "Fix: use rows.end() instead of rows.size() in functions. (#4456)" This reverts commit c69efa598f71ec512a80f1555e0f7146f1624ecb. --- velox/duckdb/functions/DuckFunctions.cpp | 4 ++-- velox/functions/lib/IsNull.cpp | 15 ++++++++++----- velox/functions/lib/LambdaFunctionUtil.cpp | 6 +++--- velox/functions/lib/MapConcat.cpp | 8 ++++---- velox/functions/lib/SubscriptUtil.h | 16 ++++++++-------- velox/functions/prestosql/ArrayConstructor.cpp | 4 ++-- velox/functions/prestosql/ArrayDistinct.cpp | 6 +++--- velox/functions/prestosql/ArrayDuplicates.cpp | 6 +++--- velox/functions/prestosql/ArrayShuffle.cpp | 6 +++--- velox/functions/prestosql/ArraySort.cpp | 4 ++-- velox/functions/prestosql/FilterFunctions.cpp | 8 ++++---- velox/functions/prestosql/FromUnixTime.cpp | 2 +- velox/functions/prestosql/InPredicate.cpp | 8 ++++---- velox/functions/prestosql/Map.cpp | 4 ++-- velox/functions/prestosql/MapKeysAndValues.cpp | 2 +- velox/functions/prestosql/Not.cpp | 6 +++--- velox/functions/prestosql/Repeat.cpp | 4 ++-- velox/functions/prestosql/Reverse.cpp | 2 +- velox/functions/prestosql/RowFunction.cpp | 2 +- velox/functions/prestosql/VectorArithmetic.cpp | 2 +- velox/functions/prestosql/ZipWith.cpp | 2 +- .../prestosql/tests/StringFunctionsTest.cpp | 2 +- velox/functions/sparksql/ArraySort.cpp | 2 +- velox/functions/sparksql/Map.cpp | 12 ++++++------ 24 files changed, 69 insertions(+), 64 deletions(-) diff --git a/velox/duckdb/functions/DuckFunctions.cpp b/velox/duckdb/functions/DuckFunctions.cpp index 89a57f10e67a..ca14ecf6aa66 100644 --- a/velox/duckdb/functions/DuckFunctions.cpp +++ b/velox/duckdb/functions/DuckFunctions.cpp @@ -347,7 +347,7 @@ static void toDuck( if (args.size() == 0) { return; } - auto numRows = rows.end(); + auto numRows = args[0]->size(); auto cardinality = std::min(numRows - offset, STANDARD_VECTOR_SIZE); result.SetCardinality(cardinality); @@ -453,7 +453,7 @@ class DuckDBFunction : public exec::VectorFunction { auto state = initializeState(std::move(inputTypes), duckDBAllocator); assert(state->functionIndex < set_.size()); auto& function = set_[state->functionIndex]; - idx_t nrow = rows.end(); + idx_t nrow = rows.size(); if (!result) { result = createVeloxVector(rows, function.return_type, nrow, context); diff --git a/velox/functions/lib/IsNull.cpp b/velox/functions/lib/IsNull.cpp index b14a60eeeef7..a0b34e6f7e35 100644 --- a/velox/functions/lib/IsNull.cpp +++ b/velox/functions/lib/IsNull.cpp @@ -38,7 +38,7 @@ class IsNullFunction : public exec::VectorFunction { if (arg->isConstantEncoding()) { bool isNull = arg->isNullAt(rows.begin()); auto localResult = BaseVector::createConstant( - BOOLEAN(), IsNotNULL ? !isNull : isNull, rows.end(), pool); + BOOLEAN(), IsNotNULL ? !isNull : isNull, rows.size(), pool); context.moveOrCopyResult(localResult, rows, result); return; } @@ -46,7 +46,7 @@ class IsNullFunction : public exec::VectorFunction { if (!arg->mayHaveNulls()) { // No nulls. auto localResult = BaseVector::createConstant( - BOOLEAN(), IsNotNULL ? true : false, rows.end(), pool); + BOOLEAN(), IsNotNULL ? true : false, rows.size(), pool); context.moveOrCopyResult(localResult, rows, result); return; } @@ -56,7 +56,7 @@ class IsNullFunction : public exec::VectorFunction { if constexpr (IsNotNULL) { isNull = arg->nulls(); } else { - isNull = AlignedBuffer::allocate(rows.end(), pool); + isNull = AlignedBuffer::allocate(rows.size(), pool); memcpy( isNull->asMutable(), arg->rawNulls(), @@ -66,7 +66,7 @@ class IsNullFunction : public exec::VectorFunction { } else { exec::DecodedArgs decodedArgs(rows, args, context); - isNull = AlignedBuffer::allocate(rows.end(), pool); + isNull = AlignedBuffer::allocate(rows.size(), pool); memcpy( isNull->asMutable(), decodedArgs.at(0)->nulls(), @@ -78,7 +78,12 @@ class IsNullFunction : public exec::VectorFunction { } auto localResult = std::make_shared>( - pool, BOOLEAN(), nullptr, rows.end(), isNull, std::vector{}); + pool, + BOOLEAN(), + nullptr, + rows.size(), + isNull, + std::vector{}); context.moveOrCopyResult(localResult, rows, result); } diff --git a/velox/functions/lib/LambdaFunctionUtil.cpp b/velox/functions/lib/LambdaFunctionUtil.cpp index 59dd28b6dc52..63a887120113 100644 --- a/velox/functions/lib/LambdaFunctionUtil.cpp +++ b/velox/functions/lib/LambdaFunctionUtil.cpp @@ -25,7 +25,7 @@ BufferPtr flattenNulls( } BufferPtr nulls = - AlignedBuffer::allocate(rows.end(), decodedVector.base()->pool()); + AlignedBuffer::allocate(rows.size(), decodedVector.base()->pool()); auto rawNulls = nulls->asMutable(); rows.applyToSelected([&](vector_size_t row) { bits::setNull(rawNulls, row, decodedVector.isNullAt(row)); @@ -104,7 +104,7 @@ ArrayVectorPtr flattenArray( array->pool(), array->type(), newNulls, - rows.end(), + rows.size(), newOffsets, newSizes, BaseVector::wrapInDictionary( @@ -142,7 +142,7 @@ MapVectorPtr flattenMap( map->pool(), map->type(), newNulls, - rows.end(), + rows.size(), newOffsets, newSizes, BaseVector::wrapInDictionary( diff --git a/velox/functions/lib/MapConcat.cpp b/velox/functions/lib/MapConcat.cpp index 4d7da0ca759c..bbe7a300a289 100644 --- a/velox/functions/lib/MapConcat.cpp +++ b/velox/functions/lib/MapConcat.cpp @@ -67,10 +67,10 @@ class MapConcatFunction : public exec::VectorFunction { // Initialize offsets and sizes to 0 so that canonicalize() will // work also for sparse 'rows'. - BufferPtr offsets = allocateOffsets(rows.end(), pool); + BufferPtr offsets = allocateOffsets(rows.size(), pool); auto rawOffsets = offsets->asMutable(); - BufferPtr sizes = allocateSizes(rows.end(), pool); + BufferPtr sizes = allocateSizes(rows.size(), pool); auto rawSizes = sizes->asMutable(); vector_size_t offset = 0; @@ -99,7 +99,7 @@ class MapConcatFunction : public exec::VectorFunction { pool, outputType, BufferPtr(nullptr), - rows.end(), + rows.size(), offsets, sizes, combinedKeys, @@ -148,7 +148,7 @@ class MapConcatFunction : public exec::VectorFunction { pool, outputType, BufferPtr(nullptr), - rows.end(), + rows.size(), offsets, sizes, keys, diff --git a/velox/functions/lib/SubscriptUtil.h b/velox/functions/lib/SubscriptUtil.h index 8926475623c9..028f07acc257 100644 --- a/velox/functions/lib/SubscriptUtil.h +++ b/velox/functions/lib/SubscriptUtil.h @@ -156,11 +156,11 @@ class SubscriptImpl : public exec::VectorFunction { exec::EvalCtx& context) const { auto* pool = context.pool(); - BufferPtr indices = allocateIndices(rows.end(), pool); + BufferPtr indices = allocateIndices(rows.size(), pool); auto rawIndices = indices->asMutable(); // Create nulls for lazy initialization. - NullsBuilder nullsBuilder(rows.end(), pool); + NullsBuilder nullsBuilder(rows.size(), pool); exec::LocalDecodedVector arrayHolder(context, *arrayArg, rows); auto decodedArray = arrayHolder.get(); @@ -211,11 +211,11 @@ class SubscriptImpl : public exec::VectorFunction { // to ensure user error checks for indices are not skipped. if (baseArray->elements()->size() == 0) { return BaseVector::createNullConstant( - baseArray->elements()->type(), rows.end(), context.pool()); + baseArray->elements()->type(), rows.size(), context.pool()); } return BaseVector::wrapInDictionary( - nullsBuilder.build(), indices, rows.end(), baseArray->elements()); + nullsBuilder.build(), indices, rows.size(), baseArray->elements()); } // Normalize indices from 1 or 0-based into always 0-based (according to @@ -290,11 +290,11 @@ class SubscriptImpl : public exec::VectorFunction { exec::EvalCtx& context) const { auto* pool = context.pool(); - BufferPtr indices = allocateIndices(rows.end(), pool); + BufferPtr indices = allocateIndices(rows.size(), pool); auto rawIndices = indices->asMutable(); // Create nulls for lazy initialization. - NullsBuilder nullsBuilder(rows.end(), pool); + NullsBuilder nullsBuilder(rows.size(), pool); // Get base MapVector. // TODO: Optimize the case when indices are identity. @@ -364,11 +364,11 @@ class SubscriptImpl : public exec::VectorFunction { // ensure user error checks for indices are not skipped. if (baseMap->mapValues()->size() == 0) { return BaseVector::createNullConstant( - baseMap->mapValues()->type(), rows.end(), context.pool()); + baseMap->mapValues()->type(), rows.size(), context.pool()); } return BaseVector::wrapInDictionary( - nullsBuilder.build(), indices, rows.end(), baseMap->mapValues()); + nullsBuilder.build(), indices, rows.size(), baseMap->mapValues()); } }; diff --git a/velox/functions/prestosql/ArrayConstructor.cpp b/velox/functions/prestosql/ArrayConstructor.cpp index 81e643e64cb9..db9a762b5a81 100644 --- a/velox/functions/prestosql/ArrayConstructor.cpp +++ b/velox/functions/prestosql/ArrayConstructor.cpp @@ -37,9 +37,9 @@ class ArrayConstructor : public exec::VectorFunction { context.ensureWritable(rows, outputType, result); result->clearNulls(rows); auto arrayResult = result->as(); - auto sizes = arrayResult->mutableSizes(rows.end()); + auto sizes = arrayResult->mutableSizes(rows.size()); auto rawSizes = sizes->asMutable(); - auto offsets = arrayResult->mutableOffsets(rows.end()); + auto offsets = arrayResult->mutableOffsets(rows.size()); auto rawOffsets = offsets->asMutable(); auto elementsResult = arrayResult->elements(); diff --git a/velox/functions/prestosql/ArrayDistinct.cpp b/velox/functions/prestosql/ArrayDistinct.cpp index 42bc88fbde72..8402da7bacdc 100644 --- a/velox/functions/prestosql/ArrayDistinct.cpp +++ b/velox/functions/prestosql/ArrayDistinct.cpp @@ -62,7 +62,7 @@ class ArrayDistinctFunction : public exec::VectorFunction { exec::LocalSingleRow singleRow(context, flatIndex); localResult = applyFlat(*singleRow, flatArray, context); localResult = - BaseVector::wrapInConstant(rows.end(), flatIndex, localResult); + BaseVector::wrapInConstant(rows.size(), flatIndex, localResult); } else { localResult = applyFlat(rows, arg, context); } @@ -81,8 +81,8 @@ class ArrayDistinctFunction : public exec::VectorFunction { toElementRows(elementsVector->size(), rows, arrayVector); exec::LocalDecodedVector elements(context, *elementsVector, elementsRows); - vector_size_t elementsCount = elementsRows.end(); - vector_size_t rowCount = rows.end(); + vector_size_t elementsCount = elementsRows.size(); + vector_size_t rowCount = arrayVector->size(); // Allocate new vectors for indices, length and offsets. memory::MemoryPool* pool = context.pool(); diff --git a/velox/functions/prestosql/ArrayDuplicates.cpp b/velox/functions/prestosql/ArrayDuplicates.cpp index 6acedd4505c5..6fac70b14ed5 100644 --- a/velox/functions/prestosql/ArrayDuplicates.cpp +++ b/velox/functions/prestosql/ArrayDuplicates.cpp @@ -63,7 +63,7 @@ class ArrayDuplicatesFunction : public exec::VectorFunction { exec::LocalSingleRow singleRow(context, flatIndex); localResult = applyFlat(*singleRow, flatArray, context); localResult = - BaseVector::wrapInConstant(rows.end(), flatIndex, localResult); + BaseVector::wrapInConstant(rows.size(), flatIndex, localResult); } else { localResult = applyFlat(rows, arg, context); } @@ -84,8 +84,8 @@ class ArrayDuplicatesFunction : public exec::VectorFunction { toElementRows(elementsVector->size(), rows, arrayVector); exec::LocalDecodedVector elements(context, *elementsVector, elementsRows); - vector_size_t numElements = elementsRows.end(); - vector_size_t numRows = rows.end(); + vector_size_t numElements = elementsRows.size(); + vector_size_t numRows = arrayVector->size(); // Allocate new vectors for indices, length and offsets. memory::MemoryPool* pool = context.pool(); diff --git a/velox/functions/prestosql/ArrayShuffle.cpp b/velox/functions/prestosql/ArrayShuffle.cpp index 03c35e792666..0736ddde9bc7 100644 --- a/velox/functions/prestosql/ArrayShuffle.cpp +++ b/velox/functions/prestosql/ArrayShuffle.cpp @@ -69,8 +69,8 @@ class ArrayShuffleFunction : public exec::VectorFunction { // Allocate new buffer to hold shuffled indices. BufferPtr shuffledIndices = allocateIndices(numElements, context.pool()); - BufferPtr offsets = allocateOffsets(rows.end(), context.pool()); - BufferPtr sizes = allocateSizes(rows.end(), context.pool()); + BufferPtr offsets = allocateOffsets(rows.size(), context.pool()); + BufferPtr sizes = allocateSizes(rows.size(), context.pool()); vector_size_t* rawIndices = shuffledIndices->asMutable(); vector_size_t* rawOffsets = offsets->asMutable(); @@ -98,7 +98,7 @@ class ArrayShuffleFunction : public exec::VectorFunction { context.pool(), arrayVector->type(), nullptr, - rows.end(), + rows.size(), std::move(offsets), std::move(sizes), std::move(resultElements)); diff --git a/velox/functions/prestosql/ArraySort.cpp b/velox/functions/prestosql/ArraySort.cpp index 28f44122a3de..f1c9fe6ec1bd 100644 --- a/velox/functions/prestosql/ArraySort.cpp +++ b/velox/functions/prestosql/ArraySort.cpp @@ -101,7 +101,7 @@ void applyScalarType( VELOX_DCHECK(kind == inputElements->typeKind()); const SelectivityVector inputElementRows = toElementRows(inputElements->size(), rows, inputArray); - const vector_size_t elementsCount = inputElementRows.end(); + const vector_size_t elementsCount = inputElementRows.size(); // TODO: consider to use dictionary wrapping to avoid the direct sorting on // the scalar values as we do for complex data type if this runs slow in @@ -186,7 +186,7 @@ class ArraySortFunction : public exec::VectorFunction { exec::LocalSingleRow singleRow(context, flatIndex); localResult = applyFlat(*singleRow, flatArray, context); localResult = - BaseVector::wrapInConstant(rows.end(), flatIndex, localResult); + BaseVector::wrapInConstant(rows.size(), flatIndex, localResult); } else { localResult = applyFlat(rows, arg, context); } diff --git a/velox/functions/prestosql/FilterFunctions.cpp b/velox/functions/prestosql/FilterFunctions.cpp index a5fe095e15cd..6b2498296c45 100644 --- a/velox/functions/prestosql/FilterFunctions.cpp +++ b/velox/functions/prestosql/FilterFunctions.cpp @@ -64,8 +64,8 @@ class FilterFunctionBase : public exec::VectorFunction { auto inputSizes = input->rawSizes(); auto* pool = context.pool(); - resultSizes = allocateSizes(rows.end(), pool); - resultOffsets = allocateOffsets(rows.end(), pool); + resultSizes = allocateSizes(rows.size(), pool); + resultOffsets = allocateOffsets(rows.size(), pool); auto rawResultSizes = resultSizes->asMutable(); auto rawResultOffsets = resultOffsets->asMutable(); auto numElements = lambdaArgs[0]->size(); @@ -163,7 +163,7 @@ class ArrayFilterFunction : public FilterFunctionBase { flatArray->pool(), flatArray->type(), flatArray->nulls(), - rows.end(), + rows.size(), std::move(resultOffsets), std::move(resultSizes), wrappedElements); @@ -228,7 +228,7 @@ class MapFilterFunction : public FilterFunctionBase { flatMap->pool(), outputType, flatMap->nulls(), - rows.end(), + rows.size(), std::move(resultOffsets), std::move(resultSizes), wrappedKeys, diff --git a/velox/functions/prestosql/FromUnixTime.cpp b/velox/functions/prestosql/FromUnixTime.cpp index f670c3ad1fd7..20ad0f4791aa 100644 --- a/velox/functions/prestosql/FromUnixTime.cpp +++ b/velox/functions/prestosql/FromUnixTime.cpp @@ -77,7 +77,7 @@ class FromUnixtimeFunction : public exec::VectorFunction { pool, outputType, BufferPtr(nullptr), - rows.end(), + rows.size(), std::vector{timestamps, timezones}, 0 /*nullCount*/); diff --git a/velox/functions/prestosql/InPredicate.cpp b/velox/functions/prestosql/InPredicate.cpp index b9eba168e122..24ed3b104770 100644 --- a/velox/functions/prestosql/InPredicate.cpp +++ b/velox/functions/prestosql/InPredicate.cpp @@ -244,7 +244,7 @@ class InPredicate : public exec::VectorFunction { VectorPtr& result, F&& testFunction) const { if (alwaysNull_) { - auto localResult = createBoolConstantNull(rows.end(), context); + auto localResult = createBoolConstantNull(rows.size(), context); context.moveOrCopyResult(localResult, rows, result); return; } @@ -257,13 +257,13 @@ class InPredicate : public exec::VectorFunction { auto simpleArg = arg->asUnchecked>(); VectorPtr localResult; if (simpleArg->isNullAt(rows.begin())) { - localResult = createBoolConstantNull(rows.end(), context); + localResult = createBoolConstantNull(rows.size(), context); } else { bool pass = testFunction(simpleArg->valueAt(rows.begin())); if (!pass && passOrNull) { - localResult = createBoolConstantNull(rows.end(), context); + localResult = createBoolConstantNull(rows.size(), context); } else { - localResult = createBoolConstant(pass, rows.end(), context); + localResult = createBoolConstant(pass, rows.size(), context); } } diff --git a/velox/functions/prestosql/Map.cpp b/velox/functions/prestosql/Map.cpp index db364a09d296..5978ce7c233c 100644 --- a/velox/functions/prestosql/Map.cpp +++ b/velox/functions/prestosql/Map.cpp @@ -119,10 +119,10 @@ class MapFunction : public exec::VectorFunction { totalElements += keysArray->sizeAt(keyIndices[row]); }); - BufferPtr offsets = allocateOffsets(rows.end(), context.pool()); + BufferPtr offsets = allocateOffsets(rows.size(), context.pool()); auto rawOffsets = offsets->asMutable(); - BufferPtr sizes = allocateSizes(rows.end(), context.pool()); + BufferPtr sizes = allocateSizes(rows.size(), context.pool()); auto rawSizes = sizes->asMutable(); BufferPtr valuesIndices = allocateIndices(totalElements, context.pool()); diff --git a/velox/functions/prestosql/MapKeysAndValues.cpp b/velox/functions/prestosql/MapKeysAndValues.cpp index 742042270fa9..4f23b99cac46 100644 --- a/velox/functions/prestosql/MapKeysAndValues.cpp +++ b/velox/functions/prestosql/MapKeysAndValues.cpp @@ -40,7 +40,7 @@ class MapKeyValueFunction : public exec::VectorFunction { exec::LocalSingleRow singleRow(context, flatIndex); localResult = applyFlat(*singleRow, flatMap, context); localResult = - BaseVector::wrapInConstant(rows.end(), flatIndex, localResult); + BaseVector::wrapInConstant(rows.size(), flatIndex, localResult); } else { localResult = applyFlat(rows, arg, context); } diff --git a/velox/functions/prestosql/Not.cpp b/velox/functions/prestosql/Not.cpp index 6ed340c61338..220a1ad19da1 100644 --- a/velox/functions/prestosql/Not.cpp +++ b/velox/functions/prestosql/Not.cpp @@ -39,9 +39,9 @@ class NotFunction : public exec::VectorFunction { if (input->isConstantEncoding()) { bool value = input->as>()->valueAt(0); negated = - AlignedBuffer::allocate(rows.end(), context.pool(), !value); + AlignedBuffer::allocate(rows.size(), context.pool(), !value); } else { - negated = AlignedBuffer::allocate(rows.end(), context.pool()); + negated = AlignedBuffer::allocate(rows.size(), context.pool()); auto rawNegated = negated->asMutable(); auto rawInput = input->asFlatVector()->rawValues(); @@ -54,7 +54,7 @@ class NotFunction : public exec::VectorFunction { context.pool(), BOOLEAN(), nullptr, - rows.end(), + rows.size(), negated, std::vector{}); diff --git a/velox/functions/prestosql/Repeat.cpp b/velox/functions/prestosql/Repeat.cpp index 7ed0e5f41fd4..5de1dcf83b6e 100644 --- a/velox/functions/prestosql/Repeat.cpp +++ b/velox/functions/prestosql/Repeat.cpp @@ -66,7 +66,7 @@ class RepeatFunction : public exec::VectorFunction { std::vector& args, const TypePtr& outputType, exec::EvalCtx& context) const { - const auto numRows = rows.end(); + const auto numRows = rows.size(); auto pool = context.pool(); if (args[1]->as>()->isNullAt(0)) { @@ -120,7 +120,7 @@ class RepeatFunction : public exec::VectorFunction { totalCount += count; }); - const auto numRows = rows.end(); + const auto numRows = rows.size(); auto pool = context.pool(); // Allocate new vector for nulls if necessary. diff --git a/velox/functions/prestosql/Reverse.cpp b/velox/functions/prestosql/Reverse.cpp index 9f1861d90b01..3395884f515e 100644 --- a/velox/functions/prestosql/Reverse.cpp +++ b/velox/functions/prestosql/Reverse.cpp @@ -129,7 +129,7 @@ class ReverseFunction : public exec::VectorFunction { exec::LocalSingleRow singleRow(context, flatIndex); localResult = applyArrayFlat(*singleRow, flatArray, context); localResult = - BaseVector::wrapInConstant(rows.end(), flatIndex, localResult); + BaseVector::wrapInConstant(rows.size(), flatIndex, localResult); } else { localResult = applyArrayFlat(rows, arg, context); } diff --git a/velox/functions/prestosql/RowFunction.cpp b/velox/functions/prestosql/RowFunction.cpp index 77e7ca03e893..3855be8627a6 100644 --- a/velox/functions/prestosql/RowFunction.cpp +++ b/velox/functions/prestosql/RowFunction.cpp @@ -32,7 +32,7 @@ class RowFunction : public exec::VectorFunction { context.pool(), outputType, BufferPtr(nullptr), - rows.end(), + rows.size(), std::move(argsCopy), 0 /*nullCount*/); context.moveOrCopyResult(row, rows, result); diff --git a/velox/functions/prestosql/VectorArithmetic.cpp b/velox/functions/prestosql/VectorArithmetic.cpp index 39a21eada383..af950662aa76 100644 --- a/velox/functions/prestosql/VectorArithmetic.cpp +++ b/velox/functions/prestosql/VectorArithmetic.cpp @@ -139,7 +139,7 @@ class VectorArithmetic : public VectorFunction { args[1].unique() && rightEncoding == VectorEncoding::Simple::FLAT) { result = std::move(args[1]); } else { - result = BaseVector::create(outputType, rows.end(), context.pool()); + result = BaseVector::create(outputType, rows.size(), context.pool()); } } else { // if the output is previously initialized, we prepare it for writing diff --git a/velox/functions/prestosql/ZipWith.cpp b/velox/functions/prestosql/ZipWith.cpp index 27e951d434f0..3b2a99e636cc 100644 --- a/velox/functions/prestosql/ZipWith.cpp +++ b/velox/functions/prestosql/ZipWith.cpp @@ -250,7 +250,7 @@ class ZipWithFunction : public exec::VectorFunction { auto* sizes = base->rawSizes(); if (!needsPadding && decoded->isIdentityMapping() && rows.isAllSelected() && - areSameOffsets(offsets, resultOffsets, rows.end())) { + areSameOffsets(offsets, resultOffsets, rows.size())) { return base->elements(); } diff --git a/velox/functions/prestosql/tests/StringFunctionsTest.cpp b/velox/functions/prestosql/tests/StringFunctionsTest.cpp index b8e5b6c0ac04..5ff99584eeea 100644 --- a/velox/functions/prestosql/tests/StringFunctionsTest.cpp +++ b/velox/functions/prestosql/tests/StringFunctionsTest.cpp @@ -1379,7 +1379,7 @@ class MultiStringFunction : public exec::VectorFunction { const TypePtr& /* outputType */, exec::EvalCtx& /*context*/, VectorPtr& result) const override { - result = BaseVector::wrapInConstant(rows.end(), 0, args[0]); + result = BaseVector::wrapInConstant(rows.size(), 0, args[0]); } static std::vector> signatures() { diff --git a/velox/functions/sparksql/ArraySort.cpp b/velox/functions/sparksql/ArraySort.cpp index 0edd7d874872..524e16b69c75 100644 --- a/velox/functions/sparksql/ArraySort.cpp +++ b/velox/functions/sparksql/ArraySort.cpp @@ -176,7 +176,7 @@ void ArraySort::apply( exec::LocalSingleRow singleRow(context, flatIndex); localResult = applyFlat(*singleRow, flatArray, context); localResult = - BaseVector::wrapInConstant(rows.end(), flatIndex, localResult); + BaseVector::wrapInConstant(rows.size(), flatIndex, localResult); } else { localResult = applyFlat(rows, arg, context); } diff --git a/velox/functions/sparksql/Map.cpp b/velox/functions/sparksql/Map.cpp index 16656473453a..9ecaf2a322d3 100644 --- a/velox/functions/sparksql/Map.cpp +++ b/velox/functions/sparksql/Map.cpp @@ -41,7 +41,7 @@ void setKeysResultTyped( const SelectivityVector& rows) { using T = typename KindToFlatVector::WrapperType; auto flatVector = keysResult->asFlatVector(); - flatVector->resize(rows.end() * mapSize); + flatVector->resize(rows.size() * mapSize); exec::LocalDecodedVector decoded(context); for (vector_size_t i = 0; i < mapSize; i++) { @@ -63,7 +63,7 @@ void setValuesResultTyped( const SelectivityVector& rows) { using T = typename KindToFlatVector::WrapperType; auto flatVector = valuesResult->asFlatVector(); - flatVector->resize(rows.end() * mapSize); + flatVector->resize(rows.size() * mapSize); exec::LocalDecodedVector decoded(context); for (vector_size_t i = 0; i < mapSize; i++) { @@ -116,9 +116,9 @@ class MapFunction : public exec::VectorFunction { rows, std::make_shared(keyType, valueType), result); auto mapResult = result->as(); - auto sizes = mapResult->mutableSizes(rows.end()); + auto sizes = mapResult->mutableSizes(rows.size()); auto rawSizes = sizes->asMutable(); - auto offsets = mapResult->mutableOffsets(rows.end()); + auto offsets = mapResult->mutableOffsets(rows.size()); auto rawOffsets = offsets->asMutable(); // Setting size and offsets @@ -130,8 +130,8 @@ class MapFunction : public exec::VectorFunction { // Setting keys and value elements auto keysResult = mapResult->mapKeys(); auto valuesResult = mapResult->mapValues(); - keysResult->resize(rows.end() * mapSize); - valuesResult->resize(rows.end() * mapSize); + keysResult->resize(rows.size() * mapSize); + valuesResult->resize(rows.size() * mapSize); VELOX_DYNAMIC_SCALAR_TYPE_DISPATCH( setKeysResultTyped,