Skip to content
Open
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
32 changes: 16 additions & 16 deletions velox/core/Expressions.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ class CallTypedExpr : public ITypedExpr {
return false;
}
return std::equal(
this->inputs().begin(),
this->inputs().end(),
other.inputs().begin(),
other.inputs().end(),
this->inputs().cbegin(),
this->inputs().cend(),
other.inputs().cbegin(),
other.inputs().cend(),
[](const auto& p1, const auto& p2) { return *p1 == *p2; });
}

Expand Down Expand Up @@ -316,10 +316,10 @@ class FieldAccessTypedExpr : public ITypedExpr {
return false;
}
return std::equal(
this->inputs().begin(),
this->inputs().end(),
other.inputs().begin(),
other.inputs().end(),
this->inputs().cbegin(),
this->inputs().cend(),
other.inputs().cbegin(),
other.inputs().cend(),
[](const auto& p1, const auto& p2) { return *p1 == *p2; });
}

Expand Down Expand Up @@ -396,10 +396,10 @@ class DereferenceTypedExpr : public ITypedExpr {
return false;
}
return std::equal(
this->inputs().begin(),
this->inputs().end(),
other.inputs().begin(),
other.inputs().end(),
this->inputs().cbegin(),
this->inputs().cend(),
other.inputs().cbegin(),
other.inputs().cend(),
[](const auto& p1, const auto& p2) { return *p1 == *p2; });
}

Expand Down Expand Up @@ -451,10 +451,10 @@ class ConcatTypedExpr : public ITypedExpr {
return false;
}
return std::equal(
this->inputs().begin(),
this->inputs().end(),
other.inputs().begin(),
other.inputs().end(),
this->inputs().cbegin(),
this->inputs().cend(),
other.inputs().cbegin(),
other.inputs().cend(),
[](const auto& p1, const auto& p2) { return *p1 == *p2; });
}

Expand Down
8 changes: 4 additions & 4 deletions velox/core/PlanNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ std::vector<std::string> allNames(
const std::vector<std::string>& names,
const std::vector<std::string>& moreNames) {
auto result = names;
result.insert(result.end(), moreNames.begin(), moreNames.end());
result.insert(result.cend(), moreNames.cbegin(), moreNames.cend());
return result;
}

Expand All @@ -1150,7 +1150,7 @@ std::vector<TypedExprPtr> flattenExprs(
const PlanNodePtr& input) {
std::vector<TypedExprPtr> result;
for (auto& group : exprs) {
result.insert(result.end(), group.begin(), group.end());
result.insert(result.cend(), group.cbegin(), group.cend());
}

const auto& sourceType = input->outputType();
Expand Down Expand Up @@ -2502,7 +2502,7 @@ const char* TopNRowNumberNode::rankFunctionName(
static const auto kFunctionNames = rankFunctionNames();
auto it = kFunctionNames.find(function);
VELOX_CHECK(
it != kFunctionNames.end(),
it != kFunctionNames.cend(),
"Invalid rank function {}",
static_cast<int>(function));
return it->second.c_str();
Expand All @@ -2513,7 +2513,7 @@ TopNRowNumberNode::RankFunction TopNRowNumberNode::rankFunctionFromName(
std::string_view name) {
static const auto kFunctionNames = invertMap(rankFunctionNames());
auto it = kFunctionNames.find(name.data());
VELOX_CHECK(it != kFunctionNames.end(), "Invalid rank function {}", name);
VELOX_CHECK(it != kFunctionNames.cend(), "Invalid rank function {}", name);
return it->second;
}

Expand Down
8 changes: 4 additions & 4 deletions velox/core/PlanNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,10 @@ class AggregationNode : public PlanNode {
bool isPreGrouped() const {
return !preGroupedKeys_.empty() &&
std::equal(
preGroupedKeys_.begin(),
preGroupedKeys_.end(),
groupingKeys_.begin(),
groupingKeys_.end(),
preGroupedKeys_.cbegin(),
preGroupedKeys_.cend(),
groupingKeys_.cbegin(),
groupingKeys_.cend(),
[](const FieldAccessTypedExprPtr& x,
const FieldAccessTypedExprPtr& y) -> bool {
return (*x == *y);
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/common/DataBufferHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void DataBufferHolder::take(const std::vector<std::string_view>& buffers) {
auto* data = buf.data();
for (auto& buffer : buffers) {
const auto size = buffer.size();
::memcpy(data, buffer.begin(), size);
::memcpy(data, buffer.cbegin(), size);
data += size;
}
// If possibly, write content of the data to output immediately. Otherwise,
Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/common/DirectBufferedInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ std::shared_ptr<DirectCoalescedLoad> DirectBufferedInput::coalescedLoad(
return streamToCoalescedLoad_.withWLock(
[&](auto& loads) -> std::shared_ptr<DirectCoalescedLoad> {
auto it = loads.find(stream);
if (it == loads.end()) {
if (it == loads.cend()) {
return nullptr;
}
auto load = std::move(it->second);
Expand Down Expand Up @@ -343,7 +343,7 @@ int32_t DirectCoalescedLoad::getData(
requests_.begin(), requests_.end(), offset, [](auto& x, auto offset) {
return x.region.offset < offset;
});
if (it == requests_.end() || it->region.offset != offset) {
if (it == requests_.cend() || it->region.offset != offset) {
return 0;
}
data = std::move(it->data);
Expand Down
7 changes: 4 additions & 3 deletions velox/dwio/common/DirectBufferedInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ class DirectCoalescedLoad : public cache::CoalescedLoad {
pool_(pool) {
VELOX_DCHECK_NOT_NULL(pool_);
VELOX_DCHECK(
std::is_sorted(requests.begin(), requests.end(), [](auto* x, auto* y) {
return x->region.offset < y->region.offset;
}));
std::is_sorted(
requests.cbegin(), requests.cend(), [](auto* x, auto* y) {
return x->region.offset < y->region.offset;
}));
requests_.reserve(requests.size());
for (auto i = 0; i < requests.size(); ++i) {
requests_.push_back(std::move(*requests[i]));
Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/common/FlatMapHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ KeyPredicate<T> prepareKeyPredicate(std::string_view expression) {
// You cannot mix allow key and reject key.
VELOX_CHECK(
modes.empty() ||
std::all_of(modes.begin(), modes.end(), [&modes](const auto& v) {
std::all_of(modes.cbegin(), modes.cend(), [&modes](const auto& v) {
return v == modes.front();
}));

auto mode = modes.empty() ? KeyProjectionMode::ALLOW : modes.front();

return KeyPredicate<T>(
mode, typename KeyPredicate<T>::Lookup(keys.begin(), keys.end()));
mode, typename KeyPredicate<T>::Lookup(keys.cbegin(), keys.cend()));
}

} // namespace facebook::velox::dwio::common::flatmap
4 changes: 2 additions & 2 deletions velox/dwio/common/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ class RowReaderOptions {
flatmapNodeIdsAsStruct) {
VELOX_CHECK(
std::all_of(
flatmapNodeIdsAsStruct.begin(),
flatmapNodeIdsAsStruct.end(),
flatmapNodeIdsAsStruct.cbegin(),
flatmapNodeIdsAsStruct.cend(),
[](const auto& kv) { return !kv.second.empty(); }),
"To use struct encoding for flatmap, keys to project must be specified");
flatmapNodeIdAsStruct_ = std::move(flatmapNodeIdsAsStruct);
Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/common/ScanSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ uint64_t ScanSpec::newRead() {
if (numReads_ == 0 ||
(!disableStatsBasedFilterReorder_ &&
!std::is_sorted(
children_.begin(),
children_.end(),
children_.cbegin(),
children_.cend(),
[this](
const std::shared_ptr<ScanSpec>& left,
const std::shared_ptr<ScanSpec>& right) {
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/common/StreamUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ inline void readContiguous(

// Returns the number of elements in rows that are < limit.
inline int32_t numBelow(folly::Range<const int32_t*> rows, int32_t limit) {
return std::lower_bound(rows.begin(), rows.end(), limit) - rows.begin();
return std::lower_bound(rows.cbegin(), rows.cend(), limit) - rows.cbegin();
}

template <typename T, typename SingleValue, typename SparseRange>
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/common/encryption/TestProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TestEncryption {

std::unique_ptr<folly::IOBuf> decrypt(std::string_view input) const {
++count_;
std::string key{input.begin(), key_.size()};
std::string key{input.cbegin(), key_.size()};
DWIO_ENSURE_EQ(key_, key);
auto decoded = velox::encoding::Base64::decodeUrl(
std::string_view{
Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/common/tests/utils/E2EFilterTestBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void E2EFilterTestBase::readWithFilter(
auto resultBatch = BaseVector::create(rowType_, 1, leafPool_.get());
resetReadBatchSizes();
int32_t clearCnt = 0;
auto deletedRowsIter = mutationSpec.deletedRows.begin();
auto deletedRowsIter = mutationSpec.deletedRows.cbegin();
while (true) {
{
MicrosecondTimer timer(&time);
Expand All @@ -182,7 +182,7 @@ void E2EFilterTestBase::readWithFilter(
auto readSize = rowReader->nextReadSize(nextReadBatchSize());
std::vector<uint64_t> isDeleted(bits::nwords(readSize));
bool haveDelete = false;
for (; deletedRowsIter != mutationSpec.deletedRows.end();
for (; deletedRowsIter != mutationSpec.deletedRows.cend();
++deletedRowsIter) {
auto i = *deletedRowsIter;
if (i < nextRowNumber) {
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/common/tests/utils/UnitLoaderTestTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ReaderMock {
void seek(uint64_t rowNumber);

std::vector<bool> unitsLoaded() const {
return {unitsLoaded_.begin(), unitsLoaded_.end()};
return {unitsLoaded_.cbegin(), unitsLoaded_.cend()};
}

private:
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/dwrf/common/RLEv1.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class RleDecoderV1 : public dwio::common::IntDecoder<isSigned> {
rows + rowIndex,
std::min<int32_t>(remainingValues_, numRows - rowIndex));
const auto endOfRun = currentRow + remainingValues_;
const auto bound = std::lower_bound(range.begin(), range.end(), endOfRun);
const auto bound = std::lower_bound(range.cbegin(), range.cend(), endOfRun);
return std::make_pair(bound - range.begin(), bound[-1] - currentRow + 1);
}

Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/dwrf/reader/ColumnReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ void StringDictionaryColumnReader::loadStrideDictionary() {
if (strideDictCount_ > 0) {
// seek stride dictionary related streams
std::vector<uint64_t> pos(
positions.begin() + positionOffset_, positions.end());
positions.cbegin() + positionOffset_, positions.cend());
dwio::common::PositionProvider pp(pos);
strideDictStream_->seekToPosition(pp);
strideDictLengthDecoder_->seekToRowGroup(pp);
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/dwrf/reader/DwrfData.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class DwrfData : public dwio::common::FormatData {
static std::vector<uint64_t> toPositionsInner(
const proto::RowIndexEntry& entry) {
return std::vector<uint64_t>(
entry.positions().begin(), entry.positions().end());
entry.positions().cbegin(), entry.positions().cend());
}

memory::MemoryPool& memoryPool_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void SelectiveStringDictionaryColumnReader::loadStrideDictionary() {
if (scanState_.dictionary2.numValues > 0) {
// seek stride dictionary related streams
std::vector<uint64_t> pos(
positions.begin() + positionOffset_, positions.end());
positions.cbegin() + positionOffset_, positions.cend());
PositionProvider pp(pos);
strideDictStream_->seekToPosition(pp);
strideDictLengthDecoder_->seekToRowGroup(pp);
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/dwrf/reader/StripeMetadataCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class StripeMetadataCache {
std::vector<uint32_t> offsets;
offsets.reserve(footer.stripeCacheOffsetsSize());
const auto& from = footer.stripeCacheOffsets();
offsets.assign(from.begin(), from.end());
offsets.assign(from.cbegin(), from.cend());
return offsets;
}

Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/dwrf/test/ColumnWriterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ VectorPtr populateBatch(
auto valuesPtr = values->asMutableRange<T>();

const size_t nulloptCount =
std::count(data.begin(), data.end(), std::nullopt);
std::count(data.cbegin(), data.cend(), std::nullopt);
if (nulloptCount == 0) {
size_t index = 0;
for (auto val : data) {
Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/dwrf/test/E2EReaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class ValueTypes {
}

auto begin() const {
return values_.begin();
return values_.cbegin();
}

auto end() const {
return values_.end();
return values_.cend();
}

const std::shared_ptr<folly::Executor>& decodingExecutor() const {
Expand Down
Loading
Loading