diff options
| author | vvvv <[email protected]> | 2025-06-23 13:38:54 +0300 |
|---|---|---|
| committer | vvvv <[email protected]> | 2025-06-23 14:22:17 +0300 |
| commit | 99a63eaece7367f17dac58e66e45043aa641d9f7 (patch) | |
| tree | d104b51aab8eaf495f95d81525716e34b5bef983 /yql | |
| parent | a731af300f45dd4cb0f3fd3b24c8213fe1425068 (diff) | |
YQL-20086 minikql
commit_hash:c35c972d6708fb1b3f34fa34a42cdae1ddf11cdc
Diffstat (limited to 'yql')
121 files changed, 4763 insertions, 4747 deletions
diff --git a/yql/essentials/minikql/aligned_page_pool.cpp b/yql/essentials/minikql/aligned_page_pool.cpp index 8b09172a1f9..30f0682e5b4 100644 --- a/yql/essentials/minikql/aligned_page_pool.cpp +++ b/yql/essentials/minikql/aligned_page_pool.cpp @@ -64,21 +64,21 @@ class TGlobalPagePool { public: TGlobalPagePool(size_t pageSize) - : PageSize(pageSize) + : PageSize_(pageSize) {} ~TGlobalPagePool() { void* addr = nullptr; - while (Pages.Dequeue(&addr)) { + while (Pages_.Dequeue(&addr)) { FreePage(addr); } } void* GetPage() { void *page = nullptr; - if (Pages.Dequeue(&page)) { - --Count; - NYql::NUdf::SanitizerMakeRegionInaccessible(page, PageSize); + if (Pages_.Dequeue(&page)) { + --Count_; + NYql::NUdf::SanitizerMakeRegionInaccessible(page, PageSize_); return page; } @@ -86,11 +86,11 @@ public: } ui64 GetPageCount() const { - return Count.load(std::memory_order_relaxed); + return Count_.load(std::memory_order_relaxed); } size_t GetPageSize() const { - return PageSize; + return PageSize_; } size_t GetSize() const { @@ -104,22 +104,22 @@ private: FreePage(addr); return GetPageSize(); } - NYql::NUdf::SanitizerMakeRegionInaccessible(addr, PageSize); - ++Count; - Pages.Enqueue(addr); + NYql::NUdf::SanitizerMakeRegionInaccessible(addr, PageSize_); + ++Count_; + Pages_.Enqueue(addr); return 0; } void FreePage(void* addr) { - NYql::NUdf::SanitizerMakeRegionInaccessible(addr, PageSize); - auto res = T::Munmap(addr, PageSize); + NYql::NUdf::SanitizerMakeRegionInaccessible(addr, PageSize_); + auto res = T::Munmap(addr, PageSize_); Y_DEBUG_ABORT_UNLESS(0 == res, "Madvise failed: %s", LastSystemErrorText()); } private: - const size_t PageSize; - std::atomic<ui64> Count = 0; - TLockFreeStack<void*> Pages; + const size_t PageSize_; + std::atomic<ui64> Count_ = 0; + TLockFreeStack<void*> Pages_; }; template<typename T, bool SysAlign> @@ -130,11 +130,11 @@ public: } TGlobalPagePool<T, SysAlign>& Get(ui32 index) { - return *Pools[index]; + return *Pools_[index]; } const TGlobalPagePool<T, SysAlign>& Get(ui32 index) const { - return *Pools[index]; + return *Pools_[index]; } TGlobalPools() @@ -147,7 +147,7 @@ public: void* res = T::Mmap(size); NYql::NUdf::SanitizerMakeRegionInaccessible(res, size); - TotalMmappedBytes += size; + TotalMmappedBytes_ += size; return res; } @@ -163,7 +163,7 @@ public: break; p.FreePage(page); - i64 prev = TotalMmappedBytes.fetch_sub(pageSize); + i64 prev = TotalMmappedBytes_.fetch_sub(pageSize); Y_DEBUG_ABORT_UNLESS(prev >= 0); } } @@ -173,7 +173,7 @@ public: auto& pool = Get(level); size_t free = pool.PushPage(addr); if (Y_UNLIKELY(free > 0)) { - i64 prev = TotalMmappedBytes.fetch_sub(free); + i64 prev = TotalMmappedBytes_.fetch_sub(free); Y_DEBUG_ABORT_UNLESS(prev >= 0); } } @@ -191,12 +191,12 @@ public: << ", " << size << ") failed: " << LastSystemErrorText(lastError) << mmaps.Str(); } - i64 prev = TotalMmappedBytes.fetch_sub(size); + i64 prev = TotalMmappedBytes_.fetch_sub(size); Y_DEBUG_ABORT_UNLESS(prev >= 0); } i64 GetTotalMmappedBytes() const { - return TotalMmappedBytes.load(); + return TotalMmappedBytes_.load(); } i64 GetTotalFreeListBytes() const { @@ -210,16 +210,16 @@ public: void Reset() { - Pools.clear(); - Pools.reserve(MidLevels + 1); + Pools_.clear(); + Pools_.reserve(MidLevels + 1); for (ui32 i = 0; i <= MidLevels; ++i) { - Pools.emplace_back(MakeHolder<TGlobalPagePool<T, SysAlign>>(TAlignedPagePool::POOL_PAGE_SIZE << i)); + Pools_.emplace_back(MakeHolder<TGlobalPagePool<T, SysAlign>>(TAlignedPagePool::POOL_PAGE_SIZE << i)); } } private: - TVector<THolder<TGlobalPagePool<T, SysAlign>>> Pools; - std::atomic<i64> TotalMmappedBytes{0}; + TVector<THolder<TGlobalPagePool<T, SysAlign>>> Pools_; + std::atomic<i64> TotalMmappedBytes_{0}; }; } // unnamed @@ -321,16 +321,16 @@ TAlignedPagePoolCounters::TAlignedPagePoolCounters(::NMonitoring::TDynamicCounte template<typename T> TAlignedPagePoolImpl<T>::~TAlignedPagePoolImpl() { - if (CheckLostMem && !UncaughtException()) { - Y_DEBUG_ABORT_UNLESS(TotalAllocated == FreePages.size() * POOL_PAGE_SIZE, + if (CheckLostMem_ && !UncaughtException()) { + Y_DEBUG_ABORT_UNLESS(TotalAllocated_ == FreePages_.size() * POOL_PAGE_SIZE, "memory leak; Expected %ld, actual %ld (%ld page(s), %ld offloaded); allocator created at: %s", - TotalAllocated, FreePages.size() * POOL_PAGE_SIZE, - FreePages.size(), OffloadedActiveBytes, GetDebugInfo().data()); - Y_DEBUG_ABORT_UNLESS(OffloadedActiveBytes == 0, "offloaded: %ld", OffloadedActiveBytes); + TotalAllocated_, FreePages_.size() * POOL_PAGE_SIZE, + FreePages_.size(), OffloadedActiveBytes_, GetDebugInfo().data()); + Y_DEBUG_ABORT_UNLESS(OffloadedActiveBytes_ == 0, "offloaded: %ld", OffloadedActiveBytes_); } size_t activeBlocksSize = 0; - for (auto it = ActiveBlocks.cbegin(); ActiveBlocks.cend() != it; ActiveBlocks.erase(it++)) { + for (auto it = ActiveBlocks_.cbegin(); ActiveBlocks_.cend() != it; ActiveBlocks_.erase(it++)) { activeBlocksSize += it->second; if (Y_UNLIKELY(IsDefaultAllocatorUsed())) { @@ -341,68 +341,68 @@ TAlignedPagePoolImpl<T>::~TAlignedPagePoolImpl() { Free(it->first, it->second); } - if (activeBlocksSize > 0 || FreePages.size() != AllPages.size() || OffloadedActiveBytes) { - if (Counters.LostPagesBytesFreeCntr) { - (*Counters.LostPagesBytesFreeCntr) += OffloadedActiveBytes + activeBlocksSize + (AllPages.size() - FreePages.size()) * POOL_PAGE_SIZE; + if (activeBlocksSize > 0 || FreePages_.size() != AllPages_.size() || OffloadedActiveBytes_) { + if (Counters_.LostPagesBytesFreeCntr) { + (*Counters_.LostPagesBytesFreeCntr) += OffloadedActiveBytes_ + activeBlocksSize + (AllPages_.size() - FreePages_.size()) * POOL_PAGE_SIZE; } } - Y_DEBUG_ABORT_UNLESS(TotalAllocated == AllPages.size() * POOL_PAGE_SIZE + OffloadedActiveBytes, - "Expected %ld, actual %ld (%ld page(s))", TotalAllocated, - AllPages.size() * POOL_PAGE_SIZE + OffloadedActiveBytes, AllPages.size()); + Y_DEBUG_ABORT_UNLESS(TotalAllocated_ == AllPages_.size() * POOL_PAGE_SIZE + OffloadedActiveBytes_, + "Expected %ld, actual %ld (%ld page(s))", TotalAllocated_, + AllPages_.size() * POOL_PAGE_SIZE + OffloadedActiveBytes_, AllPages_.size()); - for (auto &ptr : AllPages) { + for (auto &ptr : AllPages_) { TGlobalPools<T, false>::Instance().PushPage(0, ptr); } - if (Counters.TotalBytesAllocatedCntr) { - (*Counters.TotalBytesAllocatedCntr) -= TotalAllocated; + if (Counters_.TotalBytesAllocatedCntr) { + (*Counters_.TotalBytesAllocatedCntr) -= TotalAllocated_; } - if (Counters.PoolsCntr) { - --(*Counters.PoolsCntr); + if (Counters_.PoolsCntr) { + --(*Counters_.PoolsCntr); } - TotalAllocated = 0; + TotalAllocated_ = 0; } template<typename T> void TAlignedPagePoolImpl<T>::ReleaseFreePages() { - TotalAllocated -= FreePages.size() * POOL_PAGE_SIZE; - if (Counters.TotalBytesAllocatedCntr) { - (*Counters.TotalBytesAllocatedCntr) -= FreePages.size() * POOL_PAGE_SIZE; + TotalAllocated_ -= FreePages_.size() * POOL_PAGE_SIZE; + if (Counters_.TotalBytesAllocatedCntr) { + (*Counters_.TotalBytesAllocatedCntr) -= FreePages_.size() * POOL_PAGE_SIZE; } - for (; !FreePages.empty(); FreePages.pop()) { - AllPages.erase(FreePages.top()); - TGlobalPools<T, false>::Instance().PushPage(0, FreePages.top()); + for (; !FreePages_.empty(); FreePages_.pop()) { + AllPages_.erase(FreePages_.top()); + TGlobalPools<T, false>::Instance().PushPage(0, FreePages_.top()); } } template<typename T> void TAlignedPagePoolImpl<T>::OffloadAlloc(ui64 size) { - if (Limit && TotalAllocated + size > Limit && !TryIncreaseLimit(TotalAllocated + size)) { + if (Limit_ && TotalAllocated_ + size > Limit_ && !TryIncreaseLimit(TotalAllocated_ + size)) { throw TMemoryLimitExceededException(); } - if (AllocNotifyCallback) { - if (AllocNotifyCurrentBytes > AllocNotifyBytes) { - AllocNotifyCallback(); - AllocNotifyCurrentBytes = 0; + if (AllocNotifyCallback_) { + if (AllocNotifyCurrentBytes_ > AllocNotifyBytes_) { + AllocNotifyCallback_(); + AllocNotifyCurrentBytes_ = 0; } } - ++OffloadedAllocCount; - OffloadedBytes += size; - OffloadedActiveBytes += size; - TotalAllocated += size; - if (AllocNotifyCallback) { - AllocNotifyCurrentBytes += size; + ++OffloadedAllocCount_; + OffloadedBytes_ += size; + OffloadedActiveBytes_ += size; + TotalAllocated_ += size; + if (AllocNotifyCallback_) { + AllocNotifyCurrentBytes_ += size; } - if (Counters.TotalBytesAllocatedCntr) { - (*Counters.TotalBytesAllocatedCntr) += size; + if (Counters_.TotalBytesAllocatedCntr) { + (*Counters_.TotalBytesAllocatedCntr) += size; } - if (Counters.AllocationsCntr) { - ++(*Counters.AllocationsCntr); + if (Counters_.AllocationsCntr) { + ++(*Counters_.AllocationsCntr); } UpdatePeaks(); @@ -410,44 +410,44 @@ void TAlignedPagePoolImpl<T>::OffloadAlloc(ui64 size) { template<typename T> void TAlignedPagePoolImpl<T>::OffloadFree(ui64 size) noexcept { - TotalAllocated -= size; - OffloadedActiveBytes -= size; - if (Counters.TotalBytesAllocatedCntr) { - (*Counters.TotalBytesAllocatedCntr) -= size; + TotalAllocated_ -= size; + OffloadedActiveBytes_ -= size; + if (Counters_.TotalBytesAllocatedCntr) { + (*Counters_.TotalBytesAllocatedCntr) -= size; } } template<typename T> void* TAlignedPagePoolImpl<T>::GetPageImpl() { - ++PageAllocCount; - if (!FreePages.empty()) { - ++PageHitCount; - const auto res = FreePages.top(); - FreePages.pop(); + ++PageAllocCount_; + if (!FreePages_.empty()) { + ++PageHitCount_; + const auto res = FreePages_.top(); + FreePages_.pop(); return res; } - if (Limit && TotalAllocated + POOL_PAGE_SIZE > Limit && !TryIncreaseLimit(TotalAllocated + POOL_PAGE_SIZE)) { + if (Limit_ && TotalAllocated_ + POOL_PAGE_SIZE > Limit_ && !TryIncreaseLimit(TotalAllocated_ + POOL_PAGE_SIZE)) { throw TMemoryLimitExceededException(); } if (Y_LIKELY(!IsDefaultAllocatorUsed())) { if (const auto ptr = TGlobalPools<T, false>::Instance().Get(0).GetPage()) { - TotalAllocated += POOL_PAGE_SIZE; - if (AllocNotifyCallback) { - AllocNotifyCurrentBytes += POOL_PAGE_SIZE; + TotalAllocated_ += POOL_PAGE_SIZE; + if (AllocNotifyCallback_) { + AllocNotifyCurrentBytes_ += POOL_PAGE_SIZE; } - if (Counters.TotalBytesAllocatedCntr) { - (*Counters.TotalBytesAllocatedCntr) += POOL_PAGE_SIZE; + if (Counters_.TotalBytesAllocatedCntr) { + (*Counters_.TotalBytesAllocatedCntr) += POOL_PAGE_SIZE; } - ++PageGlobalHitCount; - AllPages.emplace(ptr); + ++PageGlobalHitCount_; + AllPages_.emplace(ptr); UpdatePeaks(); return ptr; } - ++PageMissCount; + ++PageMissCount_; } void* res; @@ -456,7 +456,7 @@ void* TAlignedPagePoolImpl<T>::GetPageImpl() { } else { res = Alloc(POOL_PAGE_SIZE); } - AllPages.emplace(res); + AllPages_.emplace(res); return res; } @@ -472,13 +472,13 @@ template<typename T> void TAlignedPagePoolImpl<T>::ReturnPage(void* addr) noexcept { if (Y_UNLIKELY(IsDefaultAllocatorUsed())) { ReturnBlock(addr, POOL_PAGE_SIZE); - AllPages.erase(addr); + AllPages_.erase(addr); return; } NYql::NUdf::SanitizerMakeRegionInaccessible(addr, POOL_PAGE_SIZE); - Y_DEBUG_ABORT_UNLESS(AllPages.find(addr) != AllPages.end()); - FreePages.emplace(addr); + Y_DEBUG_ABORT_UNLESS(AllPages_.find(addr) != AllPages_.end()); + FreePages_.emplace(addr); } template<typename T> @@ -514,7 +514,7 @@ void TAlignedPagePoolImpl<T>::ReturnBlock(void* ptr, size_t size) noexcept { ReturnPage(ptr); } else { Free(ptr, size); - Y_DEBUG_ABORT_UNLESS(ActiveBlocks.erase(ptr)); + Y_DEBUG_ABORT_UNLESS(ActiveBlocks_.erase(ptr)); } UpdateMemoryYellowZone(); } @@ -524,14 +524,14 @@ void* TAlignedPagePoolImpl<T>::Alloc(size_t size) { void* res = nullptr; size = AlignUp(size, SYS_PAGE_SIZE); - if (Limit && TotalAllocated + size > Limit && !TryIncreaseLimit(TotalAllocated + size)) { + if (Limit_ && TotalAllocated_ + size > Limit_ && !TryIncreaseLimit(TotalAllocated_ + size)) { throw TMemoryLimitExceededException(); } - if (AllocNotifyCallback) { - if (AllocNotifyCurrentBytes > AllocNotifyBytes) { - AllocNotifyCallback(); - AllocNotifyCurrentBytes = 0; + if (AllocNotifyCallback_) { + if (AllocNotifyCurrentBytes_ > AllocNotifyBytes_) { + AllocNotifyCallback_(); + AllocNotifyCurrentBytes_ = 0; } } @@ -542,16 +542,16 @@ void* TAlignedPagePoolImpl<T>::Alloc(size_t size) { auto level = LeastSignificantBit(size) - LeastSignificantBit(POOL_PAGE_SIZE); Y_DEBUG_ABORT_UNLESS(level >= 1 && level <= MidLevels); if (res = globalPool.Get(level).GetPage()) { - TotalAllocated += size; - if (AllocNotifyCallback) { - AllocNotifyCurrentBytes += size; + TotalAllocated_ += size; + if (AllocNotifyCallback_) { + AllocNotifyCurrentBytes_ += size; } - if (Counters.TotalBytesAllocatedCntr) { - (*Counters.TotalBytesAllocatedCntr) += size; + if (Counters_.TotalBytesAllocatedCntr) { + (*Counters_.TotalBytesAllocatedCntr) += size; } - ++PageGlobalHitCount; + ++PageGlobalHitCount_; } else { - ++PageMissCount; + ++PageMissCount_; } } @@ -581,8 +581,8 @@ void* TAlignedPagePoolImpl<T>::Alloc(size_t size) { ui64 tail = (allocSize - off - alignedSize) % POOL_PAGE_SIZE; auto extraPage = reinterpret_cast<ui8*>(res) + alignedSize; for (ui64 i = 0; i < extraPages; ++i) { - AllPages.emplace(extraPage); - FreePages.emplace(extraPage); + AllPages_.emplace(extraPage); + FreePages_.emplace(extraPage); extraPage += POOL_PAGE_SIZE; } if (size != alignedSize) { @@ -598,19 +598,19 @@ void* TAlignedPagePoolImpl<T>::Alloc(size_t size) { auto extraSize = extraPages * POOL_PAGE_SIZE; auto totalSize = size + extraSize; - TotalAllocated += totalSize; - if (AllocNotifyCallback) { - AllocNotifyCurrentBytes += totalSize; + TotalAllocated_ += totalSize; + if (AllocNotifyCallback_) { + AllocNotifyCurrentBytes_ += totalSize; } - if (Counters.TotalBytesAllocatedCntr) { - (*Counters.TotalBytesAllocatedCntr) += totalSize; + if (Counters_.TotalBytesAllocatedCntr) { + (*Counters_.TotalBytesAllocatedCntr) += totalSize; } } - if (Counters.AllocationsCntr) { - ++(*Counters.AllocationsCntr); + if (Counters_.AllocationsCntr) { + ++(*Counters_.AllocationsCntr); } - ++AllocCount; + ++AllocCount_; UpdatePeaks(); return res; } @@ -628,10 +628,10 @@ void TAlignedPagePoolImpl<T>::Free(void* ptr, size_t size) noexcept { TGlobalPools<T, false>::Instance().DoMunmap(ptr, size); } - Y_DEBUG_ABORT_UNLESS(TotalAllocated >= size); - TotalAllocated -= size; - if (Counters.TotalBytesAllocatedCntr) { - (*Counters.TotalBytesAllocatedCntr) -= size; + Y_DEBUG_ABORT_UNLESS(TotalAllocated_ >= size); + TotalAllocated_ -= size; + if (Counters_.TotalBytesAllocatedCntr) { + (*Counters_.TotalBytesAllocatedCntr) -= size; } } @@ -645,25 +645,25 @@ void TAlignedPagePoolImpl<T>::DoCleanupGlobalFreeList(ui64 targetSize) { template<typename T> void TAlignedPagePoolImpl<T>::UpdateMemoryYellowZone() { - if (Limit == 0) return; - if (IsMemoryYellowZoneForcefullyChanged) return; - if (IncreaseMemoryLimitCallback && !IsMaximumLimitValueReached) return; + if (Limit_ == 0) return; + if (IsMemoryYellowZoneForcefullyChanged_) return; + if (IncreaseMemoryLimitCallback_ && !IsMaximumLimitValueReached_) return; - ui8 usedMemoryPercent = 100 * GetUsed() / Limit; - if (usedMemoryPercent >= EnableMemoryYellowZoneThreshold) { - IsMemoryYellowZoneReached = true; - } else if (usedMemoryPercent <= DisableMemoryYellowZoneThreshold) { - IsMemoryYellowZoneReached = false; + ui8 usedMemoryPercent = 100 * GetUsed() / Limit_; + if (usedMemoryPercent >= EnableMemoryYellowZoneThreshold_) { + IsMemoryYellowZoneReached_ = true; + } else if (usedMemoryPercent <= DisableMemoryYellowZoneThreshold_) { + IsMemoryYellowZoneReached_ = false; } } template<typename T> bool TAlignedPagePoolImpl<T>::TryIncreaseLimit(ui64 required) { - if (!IncreaseMemoryLimitCallback) { + if (!IncreaseMemoryLimitCallback_) { return false; } - IncreaseMemoryLimitCallback(Limit, required); - return Limit >= required; + IncreaseMemoryLimitCallback_(Limit_, required); + return Limit_ >= required; } template <typename T> @@ -672,7 +672,7 @@ void* TAlignedPagePoolImpl<T>::GetBlockImpl(size_t size) { return GetPage(); } else { const auto ptr = Alloc(size); - Y_DEBUG_ABORT_UNLESS(ActiveBlocks.emplace(ptr, size).second); + Y_DEBUG_ABORT_UNLESS(ActiveBlocks_.emplace(ptr, size).second); return ptr; } } diff --git a/yql/essentials/minikql/aligned_page_pool.h b/yql/essentials/minikql/aligned_page_pool.h index 6028878f5a9..8d666aa4b65 100644 --- a/yql/essentials/minikql/aligned_page_pool.h +++ b/yql/essentials/minikql/aligned_page_pool.h @@ -70,11 +70,11 @@ public: explicit TAlignedPagePoolImpl(const TSourceLocation& location, const TAlignedPagePoolCounters& counters = TAlignedPagePoolCounters()) - : Counters(counters) - , DebugInfo(location) + : Counters_(counters) + , DebugInfo_(location) { - if (Counters.PoolsCntr) { - ++(*Counters.PoolsCntr); + if (Counters_.PoolsCntr) { + ++(*Counters_.PoolsCntr); } } @@ -87,15 +87,15 @@ public: ~TAlignedPagePoolImpl(); inline size_t GetAllocated() const noexcept { - return TotalAllocated; + return TotalAllocated_; } inline size_t GetUsed() const noexcept { - return TotalAllocated - GetFreePageCount() * POOL_PAGE_SIZE; + return TotalAllocated_ - GetFreePageCount() * POOL_PAGE_SIZE; } inline size_t GetFreePageCount() const noexcept { - return FreePages.size(); + return FreePages_.size(); } static inline const void* GetPageStart(const void* addr) noexcept { @@ -111,31 +111,31 @@ public: void ReturnPage(void* addr) noexcept; void Swap(TAlignedPagePoolImpl& other) { - DoSwap(FreePages, other.FreePages); - DoSwap(AllPages, other.AllPages); - DoSwap(ActiveBlocks, other.ActiveBlocks); - DoSwap(TotalAllocated, other.TotalAllocated); - DoSwap(PeakAllocated, other.PeakAllocated); - DoSwap(PeakUsed, other.PeakUsed); - DoSwap(Limit, other.Limit); - DoSwap(AllocCount, other.AllocCount); - DoSwap(PageAllocCount, other.PageAllocCount); - DoSwap(PageHitCount, other.PageHitCount); - DoSwap(PageGlobalHitCount, other.PageGlobalHitCount); - DoSwap(PageMissCount, other.PageMissCount); - DoSwap(OffloadedAllocCount, other.OffloadedAllocCount); - DoSwap(OffloadedBytes, other.OffloadedBytes); - DoSwap(OffloadedActiveBytes, other.OffloadedActiveBytes); - DoSwap(Counters, other.Counters); - DoSwap(CheckLostMem, other.CheckLostMem); - DoSwap(AllocNotifyCallback, other.AllocNotifyCallback); - DoSwap(IncreaseMemoryLimitCallback, other.IncreaseMemoryLimitCallback); + DoSwap(FreePages_, other.FreePages_); + DoSwap(AllPages_, other.AllPages_); + DoSwap(ActiveBlocks_, other.ActiveBlocks_); + DoSwap(TotalAllocated_, other.TotalAllocated_); + DoSwap(PeakAllocated_, other.PeakAllocated_); + DoSwap(PeakUsed_, other.PeakUsed_); + DoSwap(Limit_, other.Limit_); + DoSwap(AllocCount_, other.AllocCount_); + DoSwap(PageAllocCount_, other.PageAllocCount_); + DoSwap(PageHitCount_, other.PageHitCount_); + DoSwap(PageGlobalHitCount_, other.PageGlobalHitCount_); + DoSwap(PageMissCount_, other.PageMissCount_); + DoSwap(OffloadedAllocCount_, other.OffloadedAllocCount_); + DoSwap(OffloadedBytes_, other.OffloadedBytes_); + DoSwap(OffloadedActiveBytes_, other.OffloadedActiveBytes_); + DoSwap(Counters_, other.Counters_); + DoSwap(CheckLostMem_, other.CheckLostMem_); + DoSwap(AllocNotifyCallback_, other.AllocNotifyCallback_); + DoSwap(IncreaseMemoryLimitCallback_, other.IncreaseMemoryLimitCallback_); } void PrintStat(size_t usedPages, IOutputStream& out) const; TString GetDebugInfo() const { - return ToString(DebugInfo); + return ToString(DebugInfo_); } void* GetBlock(size_t size); @@ -143,39 +143,39 @@ public: void ReturnBlock(void* ptr, size_t size) noexcept; size_t GetPeakAllocated() const noexcept { - return PeakAllocated; + return PeakAllocated_; } size_t GetPeakUsed() const noexcept { - return PeakUsed; + return PeakUsed_; } ui64 GetAllocCount() const noexcept { - return AllocCount; + return AllocCount_; } ui64 GetPageAllocCount() const noexcept { - return PageAllocCount; + return PageAllocCount_; } ui64 GetPageHitCount() const noexcept { - return PageHitCount; + return PageHitCount_; } ui64 GetPageGlobalHitCount() const noexcept { - return PageGlobalHitCount; + return PageGlobalHitCount_; } ui64 GetPageMissCount() const noexcept { - return PageMissCount; + return PageMissCount_; } ui64 GetOffloadedAllocCount() const noexcept { - return OffloadedAllocCount; + return OffloadedAllocCount_; } ui64 GetOffloadedBytes() const noexcept { - return OffloadedBytes; + return OffloadedBytes_; } void OffloadAlloc(ui64 size); @@ -186,49 +186,49 @@ public: static ui64 GetGlobalPagePoolSize(); ui64 GetLimit() const noexcept { - return Limit; + return Limit_; } void SetLimit(size_t limit) noexcept { - Limit = limit; + Limit_ = limit; } void ReleaseFreePages(); void DisableStrictAllocationCheck() noexcept { - CheckLostMem = false; + CheckLostMem_ = false; } using TAllocNotifyCallback = std::function<void()>; void SetAllocNotifyCallback(TAllocNotifyCallback&& callback, ui64 notifyBytes = 0) { - AllocNotifyCallback = std::move(callback); - AllocNotifyBytes = notifyBytes; - AllocNotifyCurrentBytes = 0; + AllocNotifyCallback_ = std::move(callback); + AllocNotifyBytes_ = notifyBytes; + AllocNotifyCurrentBytes_ = 0; } using TIncreaseMemoryLimitCallback = std::function<void(ui64 currentLimit, ui64 required)>; void SetIncreaseMemoryLimitCallback(TIncreaseMemoryLimitCallback&& callback) { - IncreaseMemoryLimitCallback = std::move(callback); + IncreaseMemoryLimitCallback_ = std::move(callback); } static void ResetGlobalsUT(); void SetMaximumLimitValueReached(bool isReached) noexcept { - IsMaximumLimitValueReached = isReached; + IsMaximumLimitValueReached_ = isReached; } bool GetMaximumLimitValueReached() const noexcept { - return IsMaximumLimitValueReached; + return IsMaximumLimitValueReached_; } bool IsMemoryYellowZoneEnabled() const noexcept { - return IsMemoryYellowZoneReached; + return IsMemoryYellowZoneReached_; } void ForcefullySetMemoryYellowZone(bool isEnabled) noexcept { - IsMemoryYellowZoneReached = isEnabled; - IsMemoryYellowZoneForcefullyChanged = true; + IsMemoryYellowZoneReached_ = isEnabled; + IsMemoryYellowZoneForcefullyChanged_ = true; } #if defined(ALLOW_DEFAULT_ALLOCATOR) @@ -244,8 +244,8 @@ protected: void Free(void* ptr, size_t size) noexcept; void UpdatePeaks() { - PeakAllocated = Max(PeakAllocated, GetAllocated()); - PeakUsed = Max(PeakUsed, GetUsed()); + PeakAllocated_ = Max(PeakAllocated_, GetAllocated()); + PeakUsed_ = Max(PeakUsed_, GetUsed()); UpdateMemoryYellowZone(); } @@ -258,49 +258,49 @@ protected: void* GetPageImpl(); protected: - std::stack<void*, std::vector<void*>> FreePages; - std::unordered_set<void*> AllPages; - std::unordered_map<void*, size_t> ActiveBlocks; - size_t TotalAllocated = 0; - size_t PeakAllocated = 0; - size_t PeakUsed = 0; - size_t Limit = 0; - - ui64 AllocCount = 0; - ui64 PageAllocCount = 0; - ui64 PageHitCount = 0; - ui64 PageGlobalHitCount = 0; - ui64 PageMissCount = 0; - - ui64 OffloadedAllocCount = 0; - ui64 OffloadedBytes = 0; - ui64 OffloadedActiveBytes = 0; - - TAlignedPagePoolCounters Counters; - bool CheckLostMem = true; - - TAllocNotifyCallback AllocNotifyCallback; - ui64 AllocNotifyBytes = 0; - ui64 AllocNotifyCurrentBytes = 0; - - TIncreaseMemoryLimitCallback IncreaseMemoryLimitCallback; - const TSourceLocation DebugInfo; + std::stack<void*, std::vector<void*>> FreePages_; + std::unordered_set<void*> AllPages_; + std::unordered_map<void*, size_t> ActiveBlocks_; + size_t TotalAllocated_ = 0; + size_t PeakAllocated_ = 0; + size_t PeakUsed_ = 0; + size_t Limit_ = 0; + + ui64 AllocCount_ = 0; + ui64 PageAllocCount_ = 0; + ui64 PageHitCount_ = 0; + ui64 PageGlobalHitCount_ = 0; + ui64 PageMissCount_ = 0; + + ui64 OffloadedAllocCount_ = 0; + ui64 OffloadedBytes_ = 0; + ui64 OffloadedActiveBytes_ = 0; + + TAlignedPagePoolCounters Counters_; + bool CheckLostMem_ = true; + + TAllocNotifyCallback AllocNotifyCallback_; + ui64 AllocNotifyBytes_ = 0; + ui64 AllocNotifyCurrentBytes_ = 0; + + TIncreaseMemoryLimitCallback IncreaseMemoryLimitCallback_; + const TSourceLocation DebugInfo_; // Indicates when memory limit is almost reached. - bool IsMemoryYellowZoneReached = false; + bool IsMemoryYellowZoneReached_ = false; // Indicates that memory yellow zone was enabled or disabled forcefully. // If the value of this variable is true, then the limits specified below will not be applied and // changing the value can only be done manually. - bool IsMemoryYellowZoneForcefullyChanged = false; + bool IsMemoryYellowZoneForcefullyChanged_ = false; // This theshold is used to determine is memory limit is almost reached. // If TIncreaseMemoryLimitCallback is set this thresholds should be ignored. // The yellow zone turns on when memory consumption reaches 80% and turns off when consumption drops below 50%. - const ui8 EnableMemoryYellowZoneThreshold = 80; - const ui8 DisableMemoryYellowZoneThreshold = 50; + const ui8 EnableMemoryYellowZoneThreshold_ = 80; + const ui8 DisableMemoryYellowZoneThreshold_ = 50; // This flag indicates that value of memory limit reached it's maximum. // Next TryIncreaseLimit call most likely will return false. - bool IsMaximumLimitValueReached = false; + bool IsMaximumLimitValueReached_ = false; }; using TAlignedPagePool = TAlignedPagePoolImpl<>; diff --git a/yql/essentials/minikql/arrow/arrow_util.h b/yql/essentials/minikql/arrow/arrow_util.h index 8df5ada0bdc..ce9e75d4695 100644 --- a/yql/essentials/minikql/arrow/arrow_util.h +++ b/yql/essentials/minikql/arrow/arrow_util.h @@ -225,7 +225,7 @@ namespace arrow { template <> struct TypeTraits<typename NKikimr::NMiniKQL::TPrimitiveDataType<NYql::NDecimal::TInt128>::TResult> { - static inline std::shared_ptr<DataType> type_singleton() { + static inline std::shared_ptr<DataType> type_singleton() { // NOLINT(readability-identifier-naming) return arrow::fixed_size_binary(16); } }; diff --git a/yql/essentials/minikql/comp_nodes/mkql_addmember.cpp b/yql/essentials/minikql/comp_nodes/mkql_addmember.cpp index 4ef6ca69a9d..79eca0bdd41 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_addmember.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_addmember.cpp @@ -66,7 +66,7 @@ public: const auto idxType = Type::getInt32Ty(context); const auto type = ArrayType::get(valType, newSize); const auto itmsType = PointerType::getUnqual(type); - const auto itms = *Stateless || ctx.AlwaysInline ? + const auto itms = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(itmsType, 0U, "itms", &ctx.Func->getEntryBlock().back()): new AllocaInst(itmsType, 0U, "itms", block); const auto result = Cache_.GenNewArray(newSize, itms, ctx, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_aggrcount.cpp b/yql/essentials/minikql/comp_nodes/mkql_aggrcount.cpp index d9fb8325db7..25b56842311 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_aggrcount.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_aggrcount.cpp @@ -24,8 +24,8 @@ public: Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* value, BasicBlock*& block) const { auto& context = ctx.Codegen.GetContext(); const auto check = IsExists(value, block, context); - if (Node->IsTemporaryValue()) - ValueCleanup(Node->GetRepresentation(), value, ctx, block); + if (Node_->IsTemporaryValue()) + ValueCleanup(Node_->GetRepresentation(), value, ctx, block); return MakeBoolean(check, context, block); } #endif diff --git a/yql/essentials/minikql/comp_nodes/mkql_apply.cpp b/yql/essentials/minikql/comp_nodes/mkql_apply.cpp index 60fbe82ad43..d64dc1a4fbb 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_apply.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_apply.cpp @@ -100,7 +100,7 @@ public: , Position(pos) , CallableType(callableType) { - Stateless = false; + Stateless_ = false; } std::unique_ptr<IArrowKernelComputationNode> PrepareArrowKernelComputationNode(TComputationContext& ctx) const final { @@ -150,7 +150,7 @@ public: const auto idxType = Type::getInt32Ty(context); const auto valType = Type::getInt128Ty(context); const auto arrayType = ArrayType::get(valType, ArgNodes.size()); - const auto args = *Stateless || ctx.AlwaysInline ? + const auto args = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(arrayType, 0U, "args", &ctx.Func->getEntryBlock().back()): new AllocaInst(arrayType, 0U, "args", block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_block_agg.cpp b/yql/essentials/minikql/comp_nodes/mkql_block_agg.cpp index 6063faaccb3..7d1d1805a1f 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_block_agg.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_block_agg.cpp @@ -1198,7 +1198,7 @@ public: , Builders_(keys.size()) , Arena_(TlsAllocState) { - Pointer_ = Values_.data(); + Pointer = Values_.data(); for (size_t i = 0; i < Keys_.size(); ++i) { auto itemType = AS_TYPE(TBlockType, Keys_[i].Type)->GetItemType(); Readers_[i] = NYql::NUdf::MakeBlockReader(TTypeInfoHelper(), itemType); diff --git a/yql/essentials/minikql/comp_nodes/mkql_blocks.cpp b/yql/essentials/minikql/comp_nodes/mkql_blocks.cpp index 6bf6bc38894..b131b43a9b2 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_blocks.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_blocks.cpp @@ -417,7 +417,7 @@ private: private: NUdf::EFetchStatus WideFetch(NUdf::TUnboxedValue* output, ui32 width) { auto& blockState = *static_cast<TState*>(BlockState_.AsBoxed().Get()); - auto* inputFields = blockState.Pointer_; + auto* inputFields = blockState.Pointer; const size_t inputWidth = blockState.Values.size() - 1; if (!blockState.Count) { @@ -651,10 +651,10 @@ private: } bool HasListItems() const final { - if (!HasItems.has_value()) { - HasItems = List_.HasListItems(); + if (!HasItems_.has_value()) { + HasItems_ = List_.HasListItems(); } - return *HasItems; + return *HasItems_; } private: @@ -1347,25 +1347,25 @@ private: } bool HasListItems() const final { - if (!HasItems.has_value()) { - HasItems = List_.HasListItems(); + if (!HasItems_.has_value()) { + HasItems_ = List_.HasListItems(); } - return *HasItems; + return *HasItems_; } ui64 GetListLength() const final { - if (!Length.has_value()) { + if (!Length_.has_value()) { auto iter = List_.GetListIterator(); - Length = 0; + Length_ = 0; NUdf::TUnboxedValue block; while (iter.Next(block)) { auto blockLengthValue = block.GetElement(BlockLengthIndex_); - *Length += GetBlockCount(blockLengthValue); + *Length_ += GetBlockCount(blockLengthValue); } } - return *Length; + return *Length_; } private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_chain1_map.cpp b/yql/essentials/minikql/comp_nodes/mkql_chain1_map.cpp index 0afe3ad37fe..2503d22de46 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_chain1_map.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_chain1_map.cpp @@ -160,19 +160,19 @@ public: } ui64 GetListLength() const final { - if (!Length) { - Length = List.GetListLength(); + if (!Length_) { + Length_ = List.GetListLength(); } - return *Length; + return *Length_; } bool HasListItems() const final { - if (!HasItems) { - HasItems = List.HasListItems(); + if (!HasItems_) { + HasItems_ = List.HasListItems(); } - return *HasItems; + return *HasItems_; } TComputationContext& CompCtx; @@ -414,7 +414,7 @@ public: const auto size = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListLength>(Type::getInt64Ty(context), list, ctx.Codegen, block); - const auto itemsPtr = *Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(elementsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(elementsType, 0U, "items_ptr", block); const auto array = GenNewArray(ctx, size, itemsPtr, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_chain_map.cpp b/yql/essentials/minikql/comp_nodes/mkql_chain_map.cpp index c3ea1e97fd6..f3683ed84d1 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_chain_map.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_chain_map.cpp @@ -155,19 +155,19 @@ public: } ui64 GetListLength() const final { - if (!Length) { - Length = List.GetListLength(); + if (!Length_) { + Length_ = List.GetListLength(); } - return *Length; + return *Length_; } bool HasListItems() const final { - if (!HasItems) { - HasItems = List.HasListItems(); + if (!HasItems_) { + HasItems_ = List.HasListItems(); } - return *HasItems; + return *HasItems_; } TComputationContext& CompCtx; @@ -409,7 +409,7 @@ public: codegenStateArg->CreateSetValue(ctx, block, init); - const auto itemsPtr = *Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(elementsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(elementsType, 0U, "items_ptr", block); const auto array = GenNewArray(ctx, size, itemsPtr, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_coalesce.cpp b/yql/essentials/minikql/comp_nodes/mkql_coalesce.cpp index d86628650e1..6ea0a3503a9 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_coalesce.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_coalesce.cpp @@ -18,18 +18,18 @@ public: } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& compCtx) const { - if (auto left = this->Left->GetValue(compCtx)) { + if (auto left = this->Left_->GetValue(compCtx)) { return left.Release().template GetOptionalValueIf<Unpack>(); } - return this->Right->GetValue(compCtx).Release(); + return this->Right_->GetValue(compCtx).Release(); } #ifndef MKQL_DISABLE_CODEGEN Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const { auto& context = ctx.Codegen.GetContext(); - const auto left = GetNodeValue(this->Left, ctx, block); + const auto left = GetNodeValue(this->Left_, ctx, block); const auto null = BasicBlock::Create(context, "null", ctx.Func); const auto good = BasicBlock::Create(context, "good", ctx.Func); @@ -40,7 +40,7 @@ public: BranchInst::Create(good, null, IsExists(left, block, context), block); block = null; - const auto right = GetNodeValue(this->Right, ctx, block); + const auto right = GetNodeValue(this->Right_, ctx, block); result->addIncoming(right, block); BranchInst::Create(done, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_condense.cpp b/yql/essentials/minikql/comp_nodes/mkql_condense.cpp index 04181778482..a7d674bc9ab 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_condense.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_condense.cpp @@ -299,7 +299,7 @@ public: , Stream(stream) , State(item, state, outSwitch, initState, updateState, inSave, outSave, inLoad, outLoad, stateType) { - this->Stateless = false; + this->Stateless_ = false; } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& ctx) const { diff --git a/yql/essentials/minikql/comp_nodes/mkql_condense1.cpp b/yql/essentials/minikql/comp_nodes/mkql_condense1.cpp index b2cda5a5872..4100d83948a 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_condense1.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_condense1.cpp @@ -317,7 +317,7 @@ public: , Stream(stream) , State(item, state, outSwitch, initState, updateState, inSave, outSave, inLoad, outLoad, stateType) { - this->Stateless = false; + this->Stateless_ = false; } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& ctx) const { diff --git a/yql/essentials/minikql/comp_nodes/mkql_contains.cpp b/yql/essentials/minikql/comp_nodes/mkql_contains.cpp index 148eff3c04d..33f2444520f 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_contains.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_contains.cpp @@ -28,7 +28,7 @@ public: const auto dict = GetNodeValue(Dict, ctx, block); - const auto keyp = *Stateless || ctx.AlwaysInline ? + const auto keyp = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(valueType, 0U, "key", &ctx.Func->getEntryBlock().back()): new AllocaInst(valueType, 0U, "key", block); GetNodeValue(keyp, Key, ctx, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_enumerate.cpp b/yql/essentials/minikql/comp_nodes/mkql_enumerate.cpp index 31ef5761c65..f56dd99070b 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_enumerate.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_enumerate.cpp @@ -81,19 +81,19 @@ public: private: ui64 GetListLength() const override { - if (!Length) { - Length = List.GetListLength(); + if (!Length_) { + Length_ = List.GetListLength(); } - return *Length; + return *Length_; } bool HasListItems() const override { - if (!HasItems) { - HasItems = List.HasListItems(); + if (!HasItems_) { + HasItems_ = List.HasListItems(); } - return *HasItems; + return *HasItems_; } NUdf::TUnboxedValue GetListIterator() const override { diff --git a/yql/essentials/minikql/comp_nodes/mkql_exists.cpp b/yql/essentials/minikql/comp_nodes/mkql_exists.cpp index 7dac8c63865..a566a6b1672 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_exists.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_exists.cpp @@ -22,8 +22,8 @@ public: Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* value, BasicBlock*& block) const { auto& context = ctx.Codegen.GetContext(); const auto check = IsExists(value, block, context); - if (Node->IsTemporaryValue()) - ValueCleanup(Node->GetRepresentation(), value, ctx, block); + if (Node_->IsTemporaryValue()) + ValueCleanup(Node_->GetRepresentation(), value, ctx, block); return MakeBoolean(check, context, block); } #endif diff --git a/yql/essentials/minikql/comp_nodes/mkql_extend.cpp b/yql/essentials/minikql/comp_nodes/mkql_extend.cpp index fa77bbfd40d..e0c452903e6 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_extend.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_extend.cpp @@ -554,7 +554,7 @@ public: const auto size = ConstantInt::get(sizeType, Lists.size()); const auto arrayType = ArrayType::get(valueType, Lists.size()); - const auto array = *this->Stateless || ctx.AlwaysInline ? + const auto array = *this->Stateless_ || ctx.AlwaysInline ? new AllocaInst(arrayType, 0U, "array", &ctx.Func->getEntryBlock().back()): new AllocaInst(arrayType, 0U, "array", block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_filter.cpp b/yql/essentials/minikql/comp_nodes/mkql_filter.cpp index 3afd228845f..827a441a5aa 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_filter.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_filter.cpp @@ -768,7 +768,7 @@ public: block = smsk; const auto arrayType = ArrayType::get(Type::getInt64Ty(context), UseOnStack); - const auto array = *Stateless || ctx.AlwaysInline ? + const auto array = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(arrayType, 0U, "array", &ctx.Func->getEntryBlock().back()): new AllocaInst(arrayType, 0U, "array", block); const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, array, {zeroSize, zeroSize}, "ptr", block); @@ -866,7 +866,7 @@ public: } const auto itemsType = PointerType::getUnqual(list->getType()); - const auto itemsPtr = *Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(itemsType, 0U, "items_ptr", block); const auto array = GenNewArray(ctx, count, itemsPtr, block); @@ -1123,7 +1123,7 @@ public: block = smsk; const auto arrayType = ArrayType::get(Type::getInt64Ty(context), UseOnStack); - const auto array = *Stateless || ctx.AlwaysInline ? + const auto array = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(arrayType, 0U, "array", &ctx.Func->getEntryBlock().back()): new AllocaInst(arrayType, 0U, "array", block); const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, array, {zeroSize, zeroSize}, "ptr", block); @@ -1225,7 +1225,7 @@ public: } const auto itemsType = PointerType::getUnqual(list->getType()); - const auto itemsPtr = *Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(itemsType, 0U, "items_ptr", block); const auto array = GenNewArray(ctx, count, itemsPtr, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_flatmap.cpp b/yql/essentials/minikql/comp_nodes/mkql_flatmap.cpp index 69c42c7afbd..1f4596616ca 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_flatmap.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_flatmap.cpp @@ -1484,7 +1484,7 @@ public: block = smsk; const auto arrayType = ArrayType::get(list->getType(), UseOnStack); - const auto array = *this->Stateless || ctx.AlwaysInline ? + const auto array = *this->Stateless_ || ctx.AlwaysInline ? new AllocaInst(arrayType, 0U, "array", &ctx.Func->getEntryBlock().back()): new AllocaInst(arrayType, 0U, "array", block); const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, array, {zeroSize, zeroSize}, "ptr", block); @@ -1556,7 +1556,7 @@ public: Value* res; if constexpr (!IsMultiRowPerItem) { const auto newType = PointerType::getUnqual(list->getType()); - const auto newPtr = *this->Stateless || ctx.AlwaysInline ? + const auto newPtr = *this->Stateless_ || ctx.AlwaysInline ? new AllocaInst(newType, 0U, "new_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(newType, 0U, "new_ptr", block); res = GenNewArray(ctx, idx, newPtr, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_fold.cpp b/yql/essentials/minikql/comp_nodes/mkql_fold.cpp index 30ce24e48fc..db8fd318b0d 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_fold.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_fold.cpp @@ -99,7 +99,7 @@ public: { block = slow; - const auto iterPtr = *Stateless || ctx.AlwaysInline ? + const auto iterPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(valueType, 0U, "iter_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(valueType, 0U, "iter_ptr", block); CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListIterator>(iterPtr, list, ctx.Codegen, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_fold1.cpp b/yql/essentials/minikql/comp_nodes/mkql_fold1.cpp index 8195b75f14a..a94696d9c3d 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_fold1.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_fold1.cpp @@ -124,7 +124,7 @@ public: { block = slow; - const auto iterPtr = *Stateless || ctx.AlwaysInline ? + const auto iterPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(valueType, 0U, "iter_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(valueType, 0U, "iter_ptr", block); CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListIterator>(iterPtr, list, ctx.Codegen, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_guess.cpp b/yql/essentials/minikql/comp_nodes/mkql_guess.cpp index 2dd0cd3a56f..a4245b15890 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_guess.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_guess.cpp @@ -105,7 +105,7 @@ public: const auto mask = ConstantInt::get(valueType, APInt(128, 2, init)); const auto clean = BinaryOperator::CreateAnd(var, mask, "clean", block); new StoreInst(MakeOptional(context, clean, block), pointer, block); - ValueAddRef(this->RepresentationKind, pointer, ctx, block); + ValueAddRef(this->RepresentationKind_, pointer, ctx, block); BranchInst::Create(done, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_heap.cpp b/yql/essentials/minikql/comp_nodes/mkql_heap.cpp index e01d4d449f7..692d0051fad 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_heap.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_heap.cpp @@ -77,7 +77,7 @@ public: block = work; const auto itemsType = PointerType::getUnqual(valueType); - const auto itemsPtr = *Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(itemsType, 0U, "items_ptr", block); @@ -253,7 +253,7 @@ public: block = work; const auto itemsType = PointerType::getUnqual(valueType); - const auto itemsPtr = *Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(itemsType, 0U, "items_ptr", block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_hopping.cpp b/yql/essentials/minikql/comp_nodes/mkql_hopping.cpp index 8866dfe3a0d..bebcf6fe09f 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_hopping.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_hopping.cpp @@ -261,7 +261,7 @@ public: , StateType(stateType) , Packer(mutables) { - Stateless = false; + Stateless_ = false; } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& ctx) const { diff --git a/yql/essentials/minikql/comp_nodes/mkql_invoke.cpp b/yql/essentials/minikql/comp_nodes/mkql_invoke.cpp index 4408ada57f0..901b39ca3df 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_invoke.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_invoke.cpp @@ -117,13 +117,13 @@ public: } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& compCtx) const { - const std::array<NUdf::TUnboxedValue, 2U> args {{Left->GetValue(compCtx), Right->GetValue(compCtx)}}; + const std::array<NUdf::TUnboxedValue, 2U> args {{Left_->GetValue(compCtx), Right_->GetValue(compCtx)}}; return Descriptor.Function(args.data()); } #ifndef MKQL_DISABLE_CODEGEN Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const { - const std::array<Value*, 2U> args {{GetNodeValue(Left, ctx, block), GetNodeValue(Right, ctx, block)}}; + const std::array<Value*, 2U> args {{GetNodeValue(Left_, ctx, block), GetNodeValue(Right_, ctx, block)}}; return reinterpret_cast<TGeneratorPtr>(Descriptor.Generator)(args.data(), ctx, block); } #endif diff --git a/yql/essentials/minikql/comp_nodes/mkql_logical.cpp b/yql/essentials/minikql/comp_nodes/mkql_logical.cpp index e747929c0e1..554f60c1dda 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_logical.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_logical.cpp @@ -20,14 +20,14 @@ public: } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& ctx) const { - const auto& left = this->Left->GetValue(ctx); + const auto& left = this->Left_->GetValue(ctx); if (!IsLeftOptional || left) { if (!left.template Get<bool>()) { return NUdf::TUnboxedValuePod(false); } } - const auto& right = this->Right->GetValue(ctx); + const auto& right = this->Right_->GetValue(ctx); if (!IsRightOptional || right) { if (!right.template Get<bool>()) { return NUdf::TUnboxedValuePod(false); @@ -47,7 +47,7 @@ public: auto& context = ctx.Codegen.GetContext(); const auto valueType = Type::getInt128Ty(context); - const auto left = GetNodeValue(this->Left, ctx, block); + const auto left = GetNodeValue(this->Left_, ctx, block); const auto uvFalse = GetFalse(context); @@ -62,7 +62,7 @@ public: BranchInst::Create(done, both, skip, block); block = both; - const auto right = GetNodeValue(this->Right, ctx, block); + const auto right = GetNodeValue(this->Right_, ctx, block); if (IsLeftOptional) { const auto andr = BinaryOperator::CreateAnd(left, right, "and", block); @@ -92,14 +92,14 @@ public: } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& ctx) const { - const auto& left = this->Left->GetValue(ctx); + const auto& left = this->Left_->GetValue(ctx); if (!IsLeftOptional || left) { if (left.template Get<bool>()) { return NUdf::TUnboxedValuePod(true); } } - const auto& right = this->Right->GetValue(ctx); + const auto& right = this->Right_->GetValue(ctx); if (!IsRightOptional || right) { if (right.template Get<bool>()) { return NUdf::TUnboxedValuePod(true); @@ -119,7 +119,7 @@ public: auto& context = ctx.Codegen.GetContext(); const auto valueType = Type::getInt128Ty(context); - const auto left = GetNodeValue(this->Left, ctx, block); + const auto left = GetNodeValue(this->Left_, ctx, block); const auto uvTrue = GetTrue(context); @@ -134,7 +134,7 @@ public: BranchInst::Create(done, both, skip, block); block = both; - const auto right = GetNodeValue(this->Right, ctx, block); + const auto right = GetNodeValue(this->Right_, ctx, block); if (IsLeftOptional) { const auto andr = BinaryOperator::CreateAnd(left, right, "and", block); @@ -164,12 +164,12 @@ public: } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& ctx) const { - const auto& left = this->Left->GetValue(ctx); + const auto& left = this->Left_->GetValue(ctx); if (IsLeftOptional && !left) { return NUdf::TUnboxedValuePod(); } - const auto& right = this->Right->GetValue(ctx); + const auto& right = this->Right_->GetValue(ctx); if (IsRightOptional && !right) { return NUdf::TUnboxedValuePod(); } @@ -192,14 +192,14 @@ public: const auto result = PHINode::Create(valueType, 2, "result", done); if (IsLeftOptional) { - const auto left = GetNodeValue(this->Left, ctx, block); + const auto left = GetNodeValue(this->Left_, ctx, block); const auto skip = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, left, zero, "skip", block); result->addIncoming(zero, block); BranchInst::Create(done, both, skip, block); block = both; - const auto right = GetNodeValue(this->Right, ctx, block); + const auto right = GetNodeValue(this->Right_, ctx, block); if (IsRightOptional) { const auto xorr = BinaryOperator::CreateXor(left, right, "xor", block); @@ -213,14 +213,14 @@ public: result->addIncoming(full, block); } } else if (IsRightOptional) { - const auto right = GetNodeValue(this->Right, ctx, block); + const auto right = GetNodeValue(this->Right_, ctx, block); const auto skip = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, right, zero, "skip", block); result->addIncoming(zero, block); BranchInst::Create(done, both, skip, block); block = both; - const auto left = GetNodeValue(this->Left, ctx, block); + const auto left = GetNodeValue(this->Left_, ctx, block); const auto xorr = BinaryOperator::CreateXor(left, right, "xor", block); const auto full = BinaryOperator::CreateOr(xorr, GetFalse(context), "full", block); @@ -232,8 +232,8 @@ public: return result; } else { - const auto left = GetNodeValue(this->Left, ctx, block); - const auto right = GetNodeValue(this->Right, ctx, block); + const auto left = GetNodeValue(this->Left_, ctx, block); + const auto right = GetNodeValue(this->Right_, ctx, block); const auto xorr = BinaryOperator::CreateXor(left, right, "xor", block); const auto full = BinaryOperator::CreateOr(xorr, GetFalse(context), "full", block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_map.cpp b/yql/essentials/minikql/comp_nodes/mkql_map.cpp index defa36147b7..fb9819fd4a5 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_map.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_map.cpp @@ -111,19 +111,19 @@ protected: } ui64 GetListLength() const final { - if (!Length) { - Length = List.GetListLength(); + if (!Length_) { + Length_ = List.GetListLength(); } - return *Length; + return *Length_; } bool HasListItems() const final { - if (!HasItems) { - HasItems = List.HasListItems(); + if (!HasItems_) { + HasItems_ = List.HasListItems(); } - return *HasItems; + return *HasItems_; } bool HasFastListLength() const final { @@ -345,7 +345,7 @@ public: const auto size = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListLength>(Type::getInt64Ty(context), list, ctx.Codegen, block); - const auto itemsPtr = *Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(elementsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(elementsType, 0U, "items_ptr", block); const auto array = GenNewArray(ctx, size, itemsPtr, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_multihopping.cpp b/yql/essentials/minikql/comp_nodes/mkql_multihopping.cpp index 735cd9cab85..7ecca9fe538 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_multihopping.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_multihopping.cpp @@ -474,7 +474,7 @@ public: , UseIHash(false) , Watermark(watermark) { - Stateless = false; + Stateless_ = false; bool encoded; GetDictionaryKeyTypes(keyType, KeyTypes, IsTuple, encoded, UseIHash); Y_ABORT_UNLESS(!encoded, "TODO"); diff --git a/yql/essentials/minikql/comp_nodes/mkql_multimap.cpp b/yql/essentials/minikql/comp_nodes/mkql_multimap.cpp index 5e33c133c31..7050f33f4a5 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_multimap.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_multimap.cpp @@ -153,19 +153,19 @@ private: } ui64 GetListLength() const final { - if (!Length) { - Length = List.GetListLength() * NewItems.size(); + if (!Length_) { + Length_ = List.GetListLength() * NewItems.size(); } - return *Length; + return *Length_; } bool HasListItems() const final { - if (!HasItems) { - HasItems = List.HasListItems(); + if (!HasItems_) { + HasItems_ = List.HasListItems(); } - return *HasItems; + return *HasItems_; } bool HasFastListLength() const final { @@ -231,7 +231,7 @@ public: block = hard; const auto size = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListLength>(Type::getInt64Ty(context), list, ctx.Codegen, block); - const auto itemsPtr = *Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(elementsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(elementsType, 0U, "items_ptr", block); const auto full = BinaryOperator::CreateMul(size, ConstantInt::get(size->getType(), NewItems.size()), "full", block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_reduce.cpp b/yql/essentials/minikql/comp_nodes/mkql_reduce.cpp index 895b52a1963..37819a19081 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_reduce.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_reduce.cpp @@ -71,7 +71,7 @@ public: const auto list = GetNodeValue(List, ctx, block); - const auto itemPtr = *this->Stateless || ctx.AlwaysInline ? + const auto itemPtr = *this->Stateless_ || ctx.AlwaysInline ? new AllocaInst(valueType, 0U, "item_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(valueType, 0U, "item_ptr", block); new StoreInst(ConstantInt::get(valueType, 0), itemPtr, block); @@ -101,7 +101,7 @@ public: block = done; } else { - const auto iterPtr = *this->Stateless || ctx.AlwaysInline ? + const auto iterPtr = *this->Stateless_ || ctx.AlwaysInline ? new AllocaInst(valueType, 0U, "iter_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(valueType, 0U, "iter_ptr", block); CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListIterator>(iterPtr, list, ctx.Codegen, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_removemember.cpp b/yql/essentials/minikql/comp_nodes/mkql_removemember.cpp index f59add8060b..02020bc2bfd 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_removemember.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_removemember.cpp @@ -63,7 +63,7 @@ public: const auto idxType = Type::getInt32Ty(context); const auto type = ArrayType::get(valType, newSize); const auto itmsType = PointerType::getUnqual(type); - const auto itms = *Stateless || ctx.AlwaysInline ? + const auto itms = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(itmsType, 0U, "itms", &ctx.Func->getEntryBlock().back()): new AllocaInst(itmsType, 0U, "itms", block); const auto result = Cache.GenNewArray(newSize, itms, ctx, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_rh_hash.h b/yql/essentials/minikql/comp_nodes/mkql_rh_hash.h index 3387039477e..7028e3d924a 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_rh_hash.h +++ b/yql/essentials/minikql/comp_nodes/mkql_rh_hash.h @@ -47,8 +47,8 @@ public: using iterator = char*; using const_iterator = const char*; protected: - THash HashLocal; - TEqual EqualLocal; + THash HashLocal_; + TEqual EqualLocal_; template <bool CacheHashForPSL> struct TPSLStorageImpl; @@ -77,19 +77,19 @@ protected: using TPSLStorage = TPSLStorageImpl<CacheHash>; explicit TRobinHoodHashBase(const ui64 initialCapacity, THash hash, TEqual equal) - : HashLocal(std::move(hash)) - , EqualLocal(std::move(equal)) - , Capacity(initialCapacity) - , CapacityShift(64 - MostSignificantBit(initialCapacity)) - , Allocator() - , SelfHash(GetSelfHash(this)) + : HashLocal_(std::move(hash)) + , EqualLocal_(std::move(equal)) + , Capacity_(initialCapacity) + , CapacityShift_(64 - MostSignificantBit(initialCapacity)) + , Allocator_() + , SelfHash_(GetSelfHash(this)) { - Y_ENSURE((Capacity & (Capacity - 1)) == 0); + Y_ENSURE((Capacity_ & (Capacity_ - 1)) == 0); } ~TRobinHoodHashBase() { - if (Data) { - Allocator.deallocate(Data, DataEnd - Data); + if (Data_) { + Allocator_.deallocate(Data_, DataEnd_ - Data_); } } @@ -101,46 +101,46 @@ protected: public: // returns iterator Y_FORCE_INLINE char* Insert(TKey key, bool& isNew) { - auto hash = HashLocal(key); - auto ptr = MakeIterator(hash, Data, CapacityShift); - auto ret = InsertImpl(key, hash, isNew, Data, DataEnd, ptr); - Size += isNew ? 1 : 0; + auto hash = HashLocal_(key); + auto ptr = MakeIterator(hash, Data_, CapacityShift_); + auto ret = InsertImpl(key, hash, isNew, Data_, DataEnd_, ptr); + Size_ += isNew ? 1 : 0; return ret; } // should be called after Insert if isNew is true Y_FORCE_INLINE void CheckGrow() { - if (RHHashTableNeedsGrow(Size, Capacity)) { + if (RHHashTableNeedsGrow(Size_, Capacity_)) { Grow(); } } // returns iterator or nullptr if key is not present Y_FORCE_INLINE char* Lookup(TKey key) { - auto hash = HashLocal(key); - auto ptr = MakeIterator(hash, Data, CapacityShift); - auto ret = LookupImpl(key, hash, Data, DataEnd, ptr); + auto hash = HashLocal_(key); + auto ptr = MakeIterator(hash, Data_, CapacityShift_); + auto ret = LookupImpl(key, hash, Data_, DataEnd_, ptr); return ret; } template <typename TSink> Y_NO_INLINE void BatchInsert(std::span<TRobinHoodBatchRequestItem<TKey>> batchRequest, TSink&& sink) { - while (RHHashTableNeedsGrow(Size + batchRequest.size(), Capacity)) { + while (RHHashTableNeedsGrow(Size_ + batchRequest.size(), Capacity_)) { Grow(); } for (size_t i = 0; i < batchRequest.size(); ++i) { auto& r = batchRequest[i]; - r.Hash = HashLocal(r.GetKey()); - r.InitialIterator = MakeIterator(r.Hash, Data, CapacityShift); + r.Hash = HashLocal_(r.GetKey()); + r.InitialIterator = MakeIterator(r.Hash, Data_, CapacityShift_); NYql::PrefetchForWrite(r.InitialIterator); } for (size_t i = 0; i < batchRequest.size(); ++i) { auto& r = batchRequest[i]; bool isNew; - auto iter = InsertImpl(r.GetKey(), r.Hash, isNew, Data, DataEnd, r.InitialIterator); - Size += isNew ? 1 : 0; + auto iter = InsertImpl(r.GetKey(), r.Hash, isNew, Data_, DataEnd_, r.InitialIterator); + Size_ += isNew ? 1 : 0; sink(i, iter, isNew); } } @@ -149,53 +149,53 @@ public: Y_NO_INLINE void BatchLookup(std::span<TRobinHoodBatchRequestItem<TKey>> batchRequest, TSink&& sink) { for (size_t i = 0; i < batchRequest.size(); ++i) { auto& r = batchRequest[i]; - r.Hash = HashLocal(r.GetKey()); - r.InitialIterator = MakeIterator(r.Hash, Data, CapacityShift); + r.Hash = HashLocal_(r.GetKey()); + r.InitialIterator = MakeIterator(r.Hash, Data_, CapacityShift_); NYql::PrefetchForRead(r.InitialIterator); } for (size_t i = 0; i < batchRequest.size(); ++i) { auto& r = batchRequest[i]; - auto iter = LookupImpl(r.GetKey(), r.Hash, Data, DataEnd, r.InitialIterator); + auto iter = LookupImpl(r.GetKey(), r.Hash, Data_, DataEnd_, r.InitialIterator); sink(i, iter); } } ui64 GetCapacity() const { - return Capacity; + return Capacity_; } void Clear() { - char* ptr = Data; - for (ui64 i = 0; i < Capacity; ++i) { + char* ptr = Data_; + for (ui64 i = 0; i < Capacity_; ++i) { GetPSL(ptr).Distance = -1; ptr += AsDeriv().GetCellSize(); } - Size = 0; + Size_ = 0; } bool Empty() const { - return !Size; + return !Size_; } ui64 GetSize() const { - return Size; + return Size_; } const char* Begin() const { - return Data; + return Data_; } const char* End() const { - return DataEnd; + return DataEnd_; } char* Begin() { - return Data; + return Data_; } char* End() { - return DataEnd; + return DataEnd_; } void Advance(char*& ptr) const { @@ -241,7 +241,7 @@ private: Y_FORCE_INLINE char* MakeIterator(const ui64 hash, char* data, ui64 capacityShift) { // https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/ - ui64 bucket = ((SelfHash ^ hash) * 11400714819323198485llu) >> capacityShift; + ui64 bucket = ((SelfHash_ ^ hash) * 11400714819323198485llu) >> capacityShift; char* ptr = data + AsDeriv().GetCellSize() * bucket; return ptr; } @@ -261,11 +261,11 @@ private: } if constexpr (CacheHash) { - if (pslPtr.Hash == psl.Hash && EqualLocal(GetKey(ptr), key)) { + if (pslPtr.Hash == psl.Hash && EqualLocal_(GetKey(ptr), key)) { return ptr; } } else { - if (EqualLocal(GetKey(ptr), key)) { + if (EqualLocal_(GetKey(ptr), key)) { return ptr; } } @@ -317,11 +317,11 @@ private: } if constexpr (CacheHash) { - if (pslPtr.Hash == hash && EqualLocal(GetKey(ptr), key)) { + if (pslPtr.Hash == hash && EqualLocal_(GetKey(ptr), key)) { return ptr; } } else { - if (EqualLocal(GetKey(ptr), key)) { + if (EqualLocal_(GetKey(ptr), key)) { return ptr; } } @@ -332,12 +332,12 @@ private: } Y_NO_INLINE void Grow() { - auto newCapacity = Capacity * CalculateRHHashTableGrowFactor(Capacity); + auto newCapacity = Capacity_ * CalculateRHHashTableGrowFactor(Capacity_); auto newCapacityShift = 64 - MostSignificantBit(newCapacity); char *newData, *newDataEnd; Allocate(newCapacity, newData, newDataEnd); Y_DEFER { - Allocator.deallocate(newData, newDataEnd - newData); + Allocator_.deallocate(newData, newDataEnd - newData); }; std::array<TInternalBatchRequestItem, PrefetchBatchSize> batch; @@ -359,7 +359,7 @@ private: if constexpr (CacheHash) { r.Hash = GetPSL(iter).Hash; } else { - r.Hash = HashLocal(r.GetKey()); + r.Hash = HashLocal_(r.GetKey()); } r.InitialIterator = MakeIterator(r.Hash, newData, newCapacityShift); @@ -368,10 +368,10 @@ private: CopyBatch({batch.data(), batchLen}, newData, newDataEnd); - Capacity = newCapacity; - CapacityShift = newCapacityShift; - std::swap(Data, newData); - std::swap(DataEnd, newDataEnd); + Capacity_ = newCapacity; + CapacityShift_ = newCapacityShift; + std::swap(Data_, newData); + std::swap(DataEnd_, newDataEnd); } Y_NO_INLINE void CopyBatch(std::span<TInternalBatchRequestItem> batch, char* newData, char* newDataEnd) { @@ -396,13 +396,13 @@ private: protected: void Init() { - Allocate(Capacity, Data, DataEnd); + Allocate(Capacity_, Data_, DataEnd_); } private: void Allocate(ui64 capacity, char*& data, char*& dataEnd) { ui64 bytes = capacity * AsDeriv().GetCellSize(); - data = Allocator.allocate(bytes); + data = Allocator_.allocate(bytes); dataEnd = data + bytes; char* ptr = data; for (ui64 i = 0; i < capacity; ++i) { @@ -420,13 +420,13 @@ private: } private: - ui64 Size = 0; - ui64 Capacity; - ui64 CapacityShift; - TAllocator Allocator; - const ui64 SelfHash; - char* Data = nullptr; - char* DataEnd = nullptr; + ui64 Size_ = 0; + ui64 Capacity_; + ui64 CapacityShift_; + TAllocator Allocator_; + const ui64 SelfHash_; + char* Data_ = nullptr; + char* DataEnd_ = nullptr; }; template <typename TKey, typename TEqual = std::equal_to<TKey>, typename THash = std::hash<TKey>, typename TAllocator = std::allocator<char>, typename TSettings = TRobinHoodDefaultSettings<TKey>> @@ -438,26 +438,26 @@ public: explicit TRobinHoodHashMap(ui32 payloadSize, ui64 initialCapacity = 1u << 8) : TBase(initialCapacity, THash(), TEqual()) - , CellSize(sizeof(typename TBase::TPSLStorage) + sizeof(TKey) + payloadSize) - , PayloadSize(payloadSize) + , CellSize_(sizeof(typename TBase::TPSLStorage) + sizeof(TKey) + payloadSize) + , PayloadSize_(payloadSize) { - TmpPayload.resize(PayloadSize); - TmpPayload2.resize(PayloadSize); + TmpPayload_.resize(PayloadSize_); + TmpPayload2_.resize(PayloadSize_); TBase::Init(); } explicit TRobinHoodHashMap(ui32 payloadSize, const THash& hash, const TEqual& equal, ui64 initialCapacity = 1u << 8) : TBase(initialCapacity, hash, equal) - , CellSize(sizeof(typename TBase::TPSLStorage) + sizeof(TKey) + payloadSize) - , PayloadSize(payloadSize) + , CellSize_(sizeof(typename TBase::TPSLStorage) + sizeof(TKey) + payloadSize) + , PayloadSize_(payloadSize) { - TmpPayload.resize(PayloadSize); - TmpPayload2.resize(PayloadSize); + TmpPayload_.resize(PayloadSize_); + TmpPayload2_.resize(PayloadSize_); TBase::Init(); } ui32 GetCellSize() const { - return CellSize; + return CellSize_; } void* GetPayloadImpl(char* ptr) { @@ -469,31 +469,31 @@ public: } void CopyPayload(void* dst, const void* src) { - memcpy(dst, src, PayloadSize); + memcpy(dst, src, PayloadSize_); } void SavePayload(const void* p, int& store) { Y_UNUSED(store); - memcpy(TmpPayload.data(), p, PayloadSize); + memcpy(TmpPayload_.data(), p, PayloadSize_); } void RestorePayload(void* p, const int& store) { Y_UNUSED(store); - memcpy(p, TmpPayload.data(), PayloadSize); + memcpy(p, TmpPayload_.data(), PayloadSize_); } void SwapPayload(void* p, int& store) { Y_UNUSED(store); - memcpy(TmpPayload2.data(), p, PayloadSize); - memcpy(p, TmpPayload.data(), PayloadSize); - TmpPayload2.swap(TmpPayload); + memcpy(TmpPayload2_.data(), p, PayloadSize_); + memcpy(p, TmpPayload_.data(), PayloadSize_); + TmpPayload2_.swap(TmpPayload_); } private: - const ui32 CellSize; - const ui32 PayloadSize; + const ui32 CellSize_; + const ui32 PayloadSize_; using TVec = std::vector<char, TAllocator>; - TVec TmpPayload, TmpPayload2; + TVec TmpPayload_, TmpPayload2_; }; template <typename TKey, typename TPayload, typename TEqual = std::equal_to<TKey>, typename THash = std::hash<TKey>, typename TAllocator = std::allocator<char>, typename TSettings = TRobinHoodDefaultSettings<TKey>> diff --git a/yql/essentials/minikql/comp_nodes/mkql_udf.cpp b/yql/essentials/minikql/comp_nodes/mkql_udf.cpp index 42fedd2c247..0f3fb4a5cd8 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_udf.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_udf.cpp @@ -90,7 +90,7 @@ public: , UserType(userType) , WrapDateTimeConvert(wrapDateTimeConvert) { - this->Stateless = false; + this->Stateless_ = false; } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& ctx) const { @@ -246,7 +246,7 @@ public: , WrapDateTimeConvert(wrapDateTimeConvert) , UdfIndex(mutables.CurValueIndex++) { - this->Stateless = false; + this->Stateless_ = false; } NUdf::TUnboxedValue DoCalculate(TComputationContext& ctx) const { diff --git a/yql/essentials/minikql/comp_nodes/mkql_unwrap.cpp b/yql/essentials/minikql/comp_nodes/mkql_unwrap.cpp index 75d0f4ba581..29627cb9da5 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_unwrap.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_unwrap.cpp @@ -69,11 +69,11 @@ private: } IComputationNode* Optional() const { - return Left; + return Left_; }; IComputationNode* Message() const { - return Right; + return Right_; }; const NUdf::TSourcePosition Pos; diff --git a/yql/essentials/minikql/comp_nodes/mkql_varitem.cpp b/yql/essentials/minikql/comp_nodes/mkql_varitem.cpp index e5693c5896f..663f8836e8e 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_varitem.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_varitem.cpp @@ -66,7 +66,7 @@ public: const auto mask = ConstantInt::get(valueType, APInt(128, 2, init)); const auto clean = BinaryOperator::CreateAnd(var, mask, "clean", block); new StoreInst(clean, pointer, block); - ValueAddRef(this->RepresentationKind, pointer, ctx, block); + ValueAddRef(this->RepresentationKind_, pointer, ctx, block); BranchInst::Create(done, block); block = box; diff --git a/yql/essentials/minikql/comp_nodes/mkql_while.cpp b/yql/essentials/minikql/comp_nodes/mkql_while.cpp index 441d386fc84..db65a4c618a 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_while.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_while.cpp @@ -564,7 +564,7 @@ public: block = make; const auto itemsType = PointerType::getUnqual(list->getType()); - const auto itemsPtr = *this->Stateless || ctx.AlwaysInline ? + const auto itemsPtr = *this->Stateless_ || ctx.AlwaysInline ? new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()): new AllocaInst(itemsType, 0U, "items_ptr", block); const auto array = GenNewArray(ctx, copy, itemsPtr, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_zip.cpp b/yql/essentials/minikql/comp_nodes/mkql_zip.cpp index 3389ae69cdd..60b947a9a4e 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_zip.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_zip.cpp @@ -123,7 +123,7 @@ public: } ui64 GetListLength() const override { - if (!Length) { + if (!Length_) { ui64 length = 0; if (!Lists.empty()) { if (!All) { @@ -140,18 +140,18 @@ public: } } - Length = length; + Length_ = length; } - return *Length; + return *Length_; } bool HasListItems() const override { - if (!HasItems) { - HasItems = GetListLength() != 0; + if (!HasItems_) { + HasItems_ = GetListLength() != 0; } - return *HasItems; + return *HasItems_; } TUnboxedValueVector Lists; diff --git a/yql/essentials/minikql/comp_nodes/ut/mkql_test_factory.cpp b/yql/essentials/minikql/comp_nodes/ut/mkql_test_factory.cpp index c30cd86c88a..aa33307b44c 100644 --- a/yql/essentials/minikql/comp_nodes/ut/mkql_test_factory.cpp +++ b/yql/essentials/minikql/comp_nodes/ut/mkql_test_factory.cpp @@ -25,40 +25,40 @@ public: TStreamValue(TMemoryUsageInfo* memInfo, ui64 count) : TBase(memInfo) - , Count(count) + , Count_(count) { } private: NUdf::EFetchStatus Fetch(NUdf::TUnboxedValue& result) override { - if (Index == Count) { + if (Index_ == Count_) { return NUdf::EFetchStatus::Finish; } - result = NUdf::TUnboxedValuePod(g_TestStreamData[Index++]); + result = NUdf::TUnboxedValuePod(g_TestStreamData[Index_++]); return NUdf::EFetchStatus::Ok; } private: - ui64 Index = 0; - const ui64 Count; + ui64 Index_ = 0; + const ui64 Count_; }; TTestStreamWrapper(TComputationMutables& mutables, ui64 count) : TBaseComputation(mutables) - , Count(Min<ui64>(count, Y_ARRAY_SIZE(g_TestStreamData))) + , Count_(Min<ui64>(count, Y_ARRAY_SIZE(g_TestStreamData))) { } NUdf::TUnboxedValuePod DoCalculate(TComputationContext& ctx) const { - return ctx.HolderFactory.Create<TStreamValue>(Count); + return ctx.HolderFactory.Create<TStreamValue>(Count_); } private: void RegisterDependencies() const final {} private: - const ui64 Count; + const ui64 Count_; }; class TTestYieldStreamWrapper: public TMutableComputationNode<TTestYieldStreamWrapper> { @@ -70,32 +70,32 @@ public: TStreamValue(TMemoryUsageInfo* memInfo, TComputationContext& compCtx) : TBase(memInfo) - , CompCtx(compCtx) {} + , CompCtx_(compCtx) {} private: NUdf::EFetchStatus Fetch(NUdf::TUnboxedValue& result) override { - if (Index == Y_ARRAY_SIZE(g_TestYieldStreamData)) { + if (Index_ == Y_ARRAY_SIZE(g_TestYieldStreamData)) { return NUdf::EFetchStatus::Finish; } - const auto value = g_TestYieldStreamData[Index]; + const auto value = g_TestYieldStreamData[Index_]; if (value == g_Yield) { - ++Index; + ++Index_; return NUdf::EFetchStatus::Yield; } NUdf::TUnboxedValue* items = nullptr; - result = CompCtx.HolderFactory.CreateDirectArrayHolder(2, items); + result = CompCtx_.HolderFactory.CreateDirectArrayHolder(2, items); items[0] = NUdf::TUnboxedValuePod(value); - items[1] = MakeString(ToString(Index)); + items[1] = MakeString(ToString(Index_)); - ++Index; + ++Index_; return NUdf::EFetchStatus::Ok; } private: - TComputationContext& CompCtx; - ui64 Index = 0; + TComputationContext& CompCtx_; + ui64 Index_ = 0; }; TTestYieldStreamWrapper(TComputationMutables& mutables) diff --git a/yql/essentials/minikql/compact_hash.h b/yql/essentials/minikql/compact_hash.h index 5c04ecca338..00d6c892f1d 100644 --- a/yql/essentials/minikql/compact_hash.h +++ b/yql/essentials/minikql/compact_hash.h @@ -123,43 +123,43 @@ public: TListIterator(T* list) { if (LARGE_MARK == GetMark(list)) { - CurrentPage = EndPage = GetLargeListHeader(list)->Next(); - Current = CurrentPage->template GetList<T>(); - End = (TRawByte)Current + CurrentPage->Size * sizeof(T); + CurrentPage_ = EndPage_ = GetLargeListHeader(list)->Next(); + Current_ = CurrentPage_->template GetList<T>(); + End_ = (TRawByte)Current_ + CurrentPage_->Size * sizeof(T); } else { - Current = list; - End = (TRawByte)Current + GetPartListSize(list) * sizeof(T); + Current_ = list; + End_ = (TRawByte)Current_ + GetPartListSize(list) * sizeof(T); } } TListIterator(TRaw start, TRaw end) - : Current(start) - , End(end) + : Current_(start) + , End_(end) { } TListIterator& operator++() { Y_ASSERT(Ok()); - Current = (TRawByte)Current + sizeof(T); - if (Current == End) { - if (CurrentPage) { - CurrentPage = CurrentPage->Next(); - if (CurrentPage != EndPage) { - Current = (TRaw)CurrentPage->template GetList<T>(); - End = (TRawByte)Current + CurrentPage->Size * sizeof(T); + Current_ = (TRawByte)Current_ + sizeof(T); + if (Current_ == End_) { + if (CurrentPage_) { + CurrentPage_ = CurrentPage_->Next(); + if (CurrentPage_ != EndPage_) { + Current_ = (TRaw)CurrentPage_->template GetList<T>(); + End_ = (TRawByte)Current_ + CurrentPage_->Size * sizeof(T); } else { - CurrentPage = EndPage = nullptr; - Current = End = nullptr; + CurrentPage_ = EndPage_ = nullptr; + Current_ = End_ = nullptr; } } else { - Current = End = nullptr; + Current_ = End_ = nullptr; } } return *this; } bool operator ==(const TListIterator& it) const { - return Current == it.Current && CurrentPage == it.CurrentPage; + return Current_ == it.Current_ && CurrentPage_ == it.CurrentPage_; } bool operator !=(const TListIterator& it) const { @@ -168,26 +168,26 @@ public: T Get() const { using TClean = typename std::remove_cv<T>::type; - return ::ReadUnaligned<TClean>(Current); + return ::ReadUnaligned<TClean>(Current_); } void Set(T val) const { - ::WriteUnaligned<T>(Current, val); + ::WriteUnaligned<T>(Current_, val); } TRaw GetRaw() const { - return Current; + return Current_; } bool Ok() const { - return Current != nullptr; + return Current_ != nullptr; } private: - TRaw Current = nullptr; - TRaw End = nullptr; - THeader* CurrentPage = nullptr; - THeader* EndPage = nullptr; + TRaw Current_ = nullptr; + TRaw End_ = nullptr; + THeader* CurrentPage_ = nullptr; + THeader* EndPage_ = nullptr; }; public: @@ -383,12 +383,12 @@ public: TListPool(const TListPool&) = delete; TListPool(TListPool&& other) : TListPoolBase(std::move(other)) - , Pools(std::move(other.Pools)) + , Pools_(std::move(other.Pools_)) { } ~TListPool() { - for (auto& p: Pools) { + for (auto& p: Pools_) { for (auto& list: p.SmallPages) { Y_ABORT_UNLESS(list.Empty(), "%s", DebugInfo().data()); } @@ -523,24 +523,24 @@ public: void Swap(TListPool& other) { TListPoolBase::Swap(other); - DoSwap(Pools, other.Pools); + DoSwap(Pools_, other.Pools_); } void PrintStat(IOutputStream& out) const { size_t usedPages = 0; if (std::is_same<TPrimary, TSecondary>::value) { - usedPages = Pools[0].PrintStat(TStringBuf(""), out); + usedPages = Pools_[0].PrintStat(TStringBuf(""), out); } else { - usedPages = Pools[0].PrintStat(TStringBuf("Primary: "), out) + Pools[1].PrintStat(TStringBuf("Secondary: "), out); + usedPages = Pools_[0].PrintStat(TStringBuf("Primary: "), out) + Pools_[1].PrintStat(TStringBuf("Secondary: "), out); } GetPagePool().PrintStat(usedPages, out); } TString DebugInfo() const { if (std::is_same<TPrimary, TSecondary>::value) { - return Pools[0].DebugInfo(); + return Pools_[0].DebugInfo(); } else { - return TString().append("Primary:\n").append(Pools[0].DebugInfo()).append("Secondary:\n").append(Pools[1].DebugInfo()); + return TString().append("Primary:\n").append(Pools_[0].DebugInfo()).append("Secondary:\n").append(Pools_[1].DebugInfo()); } } @@ -558,7 +558,7 @@ private: template <size_t PoolNdx, typename T> TListHeader* GetSmallListPage(size_t size) { Y_ASSERT(size > 1 && size <= MAX_SMALL_LIST_SIZE); - TListType& pages = Pools[PoolNdx].SmallPages[size - 2]; + TListType& pages = Pools_[PoolNdx].SmallPages[size - 2]; if (!pages.Empty()) { return pages.Front()->As<TListHeader>(); } @@ -573,8 +573,8 @@ private: TListHeader* GetMediumListPage(size_t size) { Y_ASSERT(size > MAX_SMALL_LIST_SIZE && size <= TListPoolBase::GetMaxListSize<T>()); size_t index = MostSignificantBit((size - 1) >> MostSignificantBitCT(MAX_SMALL_LIST_SIZE)); - Y_ASSERT(index < Pools[PoolNdx].MediumPages.size()); - TListType& pages = Pools[PoolNdx].MediumPages[index]; + Y_ASSERT(index < Pools_[PoolNdx].MediumPages.size()); + TListType& pages = Pools_[PoolNdx].MediumPages[index]; if (!pages.Empty()) { return pages.Front()->As<TListHeader>(); } @@ -613,7 +613,7 @@ private: } if (last) { listHeader->ListItem.Unlink(); - Pools[PoolNdx].FullPages.PushBack(&listHeader->ListItem); + Pools_[PoolNdx].FullPages.PushBack(&listHeader->ListItem); } return reinterpret_cast<T*>(l); } @@ -639,7 +639,7 @@ private: if (last) { listHeader->ListItem.Unlink(); - Pools[PoolNdx].FullPages.PushBack(&listHeader->ListItem); + Pools_[PoolNdx].FullPages.PushBack(&listHeader->ListItem); } // For medium pages store the list size ahead *l = size; @@ -659,7 +659,7 @@ private: ++listHeader->FreeLists; if (1 == listHeader->FreeLists) { listHeader->ListItem.Unlink(); // Remove from full list - Pools[PoolNdx].SmallPages[listHeader->ListSize - 2].PushFront(&listHeader->ListItem); // Add to partially used + Pools_[PoolNdx].SmallPages[listHeader->ListSize - 2].PushFront(&listHeader->ListItem); // Add to partially used } else if (GetSmallPageCapacity<T>(listHeader->ListSize) == listHeader->FreeLists) { listHeader->ListItem.Unlink(); // Remove from partially used FreeListPage(listHeader); @@ -679,8 +679,8 @@ private: if (1 == listHeader->FreeLists) { listHeader->ListItem.Unlink(); // Remove from full list const size_t index = MostSignificantBit((listHeader->ListSize - 1) >> MostSignificantBitCT(MAX_SMALL_LIST_SIZE)); - Y_ASSERT(index < Pools[PoolNdx].MediumPages.size()); - Pools[PoolNdx].MediumPages[index].PushFront(&listHeader->ListItem); // Add to partially used + Y_ASSERT(index < Pools_[PoolNdx].MediumPages.size()); + Pools_[PoolNdx].MediumPages[index].PushFront(&listHeader->ListItem); // Add to partially used } else if (GetMediumPageCapacity<T>(listHeader->ListSize) == listHeader->FreeLists) { listHeader->ListItem.Unlink(); // Remove from partially used FreeListPage(listHeader); @@ -702,7 +702,7 @@ private: GetPagePool().ReturnPage(header); } protected: - std::array<TUsedPages, PoolCount> Pools; + std::array<TUsedPages, PoolCount> Pools_; }; #pragma pack(push, 1) @@ -841,8 +841,8 @@ struct TKeyValuePair { TKeyValuePair& operator =(const TKeyValuePair&) = default; TKeyValuePair& operator =(TKeyValuePair&&) = default; - TKey first; - TValue second; + TKey first; // NOLINT(readability-identifier-naming) + TValue second; // NOLINT(readability-identifier-naming) }; template <typename TKey, typename TValue> @@ -870,14 +870,14 @@ public: // Full scan iterator TIteratorImpl(const TCompactHashBase* hash) - : Hash(hash) - , Bucket(0) - , EndBucket(Hash->BucketsCount_) - , Pos() + : Hash_(hash) + , Bucket_(0) + , EndBucket_(Hash_->BucketsCount_) + , Pos_() { - for (; Bucket < EndBucket; ++Bucket) { - if (!Hash->IsEmptyBucket(Bucket)) { - Pos = Hash->GetBucketIter(Bucket); + for (; Bucket_ < EndBucket_; ++Bucket_) { + if (!Hash_->IsEmptyBucket(Bucket_)) { + Pos_ = Hash_->GetBucketIter(Bucket_); break; } } @@ -885,10 +885,10 @@ public: // Key iterator TIteratorImpl(const TCompactHashBase* hash, size_t bucket, const TBucketIter& pos) - : Hash(hash) - , Bucket(bucket) - , EndBucket(bucket + 1) - , Pos(pos) + : Hash_(hash) + , Bucket_(bucket) + , EndBucket_(bucket + 1) + , Pos_(pos) { } @@ -898,26 +898,26 @@ public: public: TIteratorImpl& operator=(const TIteratorImpl& rhs) { - Hash = rhs.Hash; - Bucket = rhs.Bucket; - EndBucket = rhs.EndBucket; - Pos = rhs.Pos; + Hash_ = rhs.Hash_; + Bucket_ = rhs.Bucket_; + EndBucket_ = rhs.EndBucket_; + Pos_ = rhs.Pos_; return *this; } bool Ok() const { - return Bucket < EndBucket && Pos.Ok(); + return Bucket_ < EndBucket_ && Pos_.Ok(); } TIteratorImpl& operator++() { - if (Bucket < EndBucket) { - if ((++Pos).Ok()) { + if (Bucket_ < EndBucket_) { + if ((++Pos_).Ok()) { return *this; } - for (++Bucket; Bucket < EndBucket; ++Bucket) { - if (!Hash->IsEmptyBucket(Bucket)) { - Pos = Hash->GetBucketIter(Bucket); + for (++Bucket_; Bucket_ < EndBucket_; ++Bucket_) { + if (!Hash_->IsEmptyBucket(Bucket_)) { + Pos_ = Hash_->GetBucketIter(Bucket_); break; } } @@ -927,24 +927,24 @@ public: T operator*() const { Y_ASSERT(Ok()); - return Pos.Get(); + return Pos_.Get(); } T Get() const { Y_ASSERT(Ok()); - return Pos.Get(); + return Pos_.Get(); } TIteratorImpl MakeCurrentKeyIter() const { Y_ASSERT(Ok()); - return TIteratorImpl(Hash, Bucket, TBucketIter(Pos.GetRaw(), Pos.GetRaw() + sizeof(T))); + return TIteratorImpl(Hash_, Bucket_, TBucketIter(Pos_.GetRaw(), Pos_.GetRaw() + sizeof(T))); } private: - const TCompactHashBase* Hash = nullptr; - size_t Bucket = 0; - size_t EndBucket = 0; - TBucketIter Pos; + const TCompactHashBase* Hash_ = nullptr; + size_t Bucket_ = 0; + size_t EndBucket_ = 0; + TBucketIter Pos_; }; template <typename T> @@ -955,14 +955,14 @@ public: // Full scan iterator TIteratorImpl(const TCompactHashBase* hash) - : Hash(hash) - , Bucket(0) - , EndBucket(Hash->BucketsCount_) + : Hash_(hash) + , Bucket_(0) + , EndBucket_(Hash_->BucketsCount_) { - for (; Bucket < EndBucket; ++Bucket) { - if (!Hash->IsEmptyBucket(Bucket)) { - Pos = Hash->GetBucketIter(Bucket); - SubPos = static_cast<const TKeyNodePair<TKeyType, T>*>(Pos.GetRaw())->second.Iter(); + for (; Bucket_ < EndBucket_; ++Bucket_) { + if (!Hash_->IsEmptyBucket(Bucket_)) { + Pos_ = Hash_->GetBucketIter(Bucket_); + SubPos_ = static_cast<const TKeyNodePair<TKeyType, T>*>(Pos_.GetRaw())->second.Iter(); break; } } @@ -970,11 +970,11 @@ public: // Key iterator TIteratorImpl(const TCompactHashBase* hash, size_t bucket, const TBucketIter& pos) - : Hash(hash) - , Bucket(bucket) - , EndBucket(bucket + 1) - , Pos(pos) - , SubPos(static_cast<const TKeyNodePair<TKeyType, T>*>(Pos.GetRaw())->second.Iter()) + : Hash_(hash) + , Bucket_(bucket) + , EndBucket_(bucket + 1) + , Pos_(pos) + , SubPos_(static_cast<const TKeyNodePair<TKeyType, T>*>(Pos_.GetRaw())->second.Iter()) { } @@ -984,7 +984,7 @@ public: public: bool Ok() const { - return Bucket < EndBucket; + return Bucket_ < EndBucket_; } TIteratorImpl& operator++() { @@ -997,12 +997,12 @@ public: TKeyType GetKey() const { Y_ASSERT(Ok()); - return Pos.Get().first; + return Pos_.Get().first; } T GetValue() const { Y_ASSERT(Ok()); - return SubPos.Get(); + return SubPos_.Get(); } T operator*() const { @@ -1011,29 +1011,29 @@ public: TIteratorImpl MakeCurrentKeyIter() const { Y_ASSERT(Ok()); - return TIteratorImpl(Hash, Bucket, TBucketIter(Pos.GetRaw(), static_cast<const ui8*>(Pos.GetRaw()) + sizeof(TKeyNodePair<TKeyType, T>))); + return TIteratorImpl(Hash_, Bucket_, TBucketIter(Pos_.GetRaw(), static_cast<const ui8*>(Pos_.GetRaw()) + sizeof(TKeyNodePair<TKeyType, T>))); } private: TIteratorImpl& Shift(bool nextKey) { - Y_ASSERT(Bucket < EndBucket); - Y_ASSERT(SubPos.Ok()); - if (!nextKey && (++SubPos).Ok()) { + Y_ASSERT(Bucket_ < EndBucket_); + Y_ASSERT(SubPos_.Ok()); + if (!nextKey && (++SubPos_).Ok()) { return *this; } - Y_ASSERT(Pos.Ok()); - if ((++Pos).Ok()) { - SubPos = static_cast<const TKeyNodePair<TKeyType, T>*>(Pos.GetRaw())->second.Iter(); + Y_ASSERT(Pos_.Ok()); + if ((++Pos_).Ok()) { + SubPos_ = static_cast<const TKeyNodePair<TKeyType, T>*>(Pos_.GetRaw())->second.Iter(); return *this; } else { - SubPos = TValueIter(); + SubPos_ = TValueIter(); } - for (++Bucket; Bucket < EndBucket; ++Bucket) { - if (!Hash->IsEmptyBucket(Bucket)) { - Pos = Hash->GetBucketIter(Bucket); - SubPos = static_cast<const TKeyNodePair<TKeyType, T>*>(Pos.GetRaw())->second.Iter(); + for (++Bucket_; Bucket_ < EndBucket_; ++Bucket_) { + if (!Hash_->IsEmptyBucket(Bucket_)) { + Pos_ = Hash_->GetBucketIter(Bucket_); + SubPos_ = static_cast<const TKeyNodePair<TKeyType, T>*>(Pos_.GetRaw())->second.Iter(); break; } } @@ -1042,11 +1042,11 @@ public: } private: - const TCompactHashBase* Hash = nullptr; - size_t Bucket = 0; - size_t EndBucket = 0; - TBucketIter Pos; - TValueIter SubPos; + const TCompactHashBase* Hash_ = nullptr; + size_t Bucket_ = 0; + size_t EndBucket_ = 0; + TBucketIter Pos_; + TValueIter SubPos_; }; public: diff --git a/yql/essentials/minikql/computation/mkql_block_impl.cpp b/yql/essentials/minikql/computation/mkql_block_impl.cpp index 0f16206c112..91292a3df81 100644 --- a/yql/essentials/minikql/computation/mkql_block_impl.cpp +++ b/yql/essentials/minikql/computation/mkql_block_impl.cpp @@ -252,14 +252,14 @@ TBlockFuncNode::TBlockFuncNode(TComputationMutables& mutables, TStringBuf name, std::shared_ptr<arrow::compute::ScalarKernel> kernelHolder, const arrow::compute::FunctionOptions* functionOptions) : TMutableComputationNode(mutables) - , StateIndex(mutables.CurValueIndex++) - , ArgsNodes(std::move(argsNodes)) - , ArgsValuesDescr(ToValueDescr(argsTypes)) - , Kernel(kernel) - , KernelHolder(std::move(kernelHolder)) - , Options(functionOptions) - , ScalarOutput(GetResultShape(argsTypes) == TBlockType::EShape::Scalar) - , Name(name.starts_with("Block") ? name.substr(5) : name) + , StateIndex_(mutables.CurValueIndex++) + , ArgsNodes_(std::move(argsNodes)) + , ArgsValuesDescr_(ToValueDescr(argsTypes)) + , Kernel_(kernel) + , KernelHolder_(std::move(kernelHolder)) + , Options_(functionOptions) + , ScalarOutput_(GetResultShape(argsTypes) == TBlockType::EShape::Scalar) + , Name_(name.starts_with("Block") ? name.substr(5) : name) { } @@ -267,15 +267,15 @@ NUdf::TUnboxedValuePod TBlockFuncNode::DoCalculate(TComputationContext& ctx) con auto& state = GetState(ctx); std::vector<arrow::Datum> argDatums; - for (ui32 i = 0; i < ArgsNodes.size(); ++i) { - const auto& value = ArgsNodes[i]->GetValue(ctx); + for (ui32 i = 0; i < ArgsNodes_.size(); ++i) { + const auto& value = ArgsNodes_[i]->GetValue(ctx); argDatums.emplace_back(TArrowBlock::From(value).GetDatum()); - ARROW_DEBUG_CHECK_DATUM_TYPES(ArgsValuesDescr[i], argDatums.back().descr()); + ARROW_DEBUG_CHECK_DATUM_TYPES(ArgsValuesDescr_[i], argDatums.back().descr()); } - if (ScalarOutput) { + if (ScalarOutput_) { auto executor = arrow::compute::detail::KernelExecutor::MakeScalar(); - ARROW_OK(executor->Init(&state.KernelContext, { &Kernel, ArgsValuesDescr, Options })); + ARROW_OK(executor->Init(&state.KernelContext, { &Kernel_, ArgsValuesDescr_, Options_ })); auto listener = std::make_shared<arrow::compute::detail::DatumAccumulator>(); ARROW_OK(executor->Execute(argDatums, listener.get())); @@ -289,7 +289,7 @@ NUdf::TUnboxedValuePod TBlockFuncNode::DoCalculate(TComputationContext& ctx) con while (dechunker.Next(chunk)) { auto executor = arrow::compute::detail::KernelExecutor::MakeScalar(); - ARROW_OK(executor->Init(&state.KernelContext, { &Kernel, ArgsValuesDescr, Options })); + ARROW_OK(executor->Init(&state.KernelContext, { &Kernel_, ArgsValuesDescr_, Options_ })); arrow::compute::detail::DatumAccumulator listener; ARROW_OK(executor->Execute(chunk, &listener)); @@ -303,15 +303,15 @@ NUdf::TUnboxedValuePod TBlockFuncNode::DoCalculate(TComputationContext& ctx) con void TBlockFuncNode::RegisterDependencies() const { - for (const auto& arg : ArgsNodes) { + for (const auto& arg : ArgsNodes_) { DependsOn(arg); } } TBlockFuncNode::TState& TBlockFuncNode::GetState(TComputationContext& ctx) const { - auto& result = ctx.MutableValues[StateIndex]; + auto& result = ctx.MutableValues[StateIndex_]; if (!result.HasValue()) { - result = ctx.HolderFactory.Create<TState>(Options, Kernel, ArgsValuesDescr, ctx); + result = ctx.HolderFactory.Create<TState>(Options_, Kernel_, ArgsValuesDescr_, ctx); } return *static_cast<TState*>(result.AsBoxed().Get()); @@ -326,28 +326,28 @@ TBlockFuncNode::TArrowNode::TArrowNode(const TBlockFuncNode* parent) {} TStringBuf TBlockFuncNode::TArrowNode::GetKernelName() const { - return Parent_->Name; + return Parent_->Name_; } const arrow::compute::ScalarKernel& TBlockFuncNode::TArrowNode::GetArrowKernel() const { - return Parent_->Kernel; + return Parent_->Kernel_; } const std::vector<arrow::ValueDescr>& TBlockFuncNode::TArrowNode::GetArgsDesc() const { - return Parent_->ArgsValuesDescr; + return Parent_->ArgsValuesDescr_; } const IComputationNode* TBlockFuncNode::TArrowNode::GetArgument(ui32 index) const { - MKQL_ENSURE(index < Parent_->ArgsNodes.size(), "Wrong index"); - return Parent_->ArgsNodes[index]; + MKQL_ENSURE(index < Parent_->ArgsNodes_.size(), "Wrong index"); + return Parent_->ArgsNodes_[index]; } TBlockState::TBlockState(TMemoryUsageInfo* memInfo, size_t width, i64 blockLengthIndex) : TBase(memInfo), Values(width), Deques(width), Arrays(width) - , BlockLengthIndex_(blockLengthIndex == LAST_COLUMN_MARKER ? width - 1 : blockLengthIndex) + , BlockLengthIndex(blockLengthIndex == LAST_COLUMN_MARKER ? width - 1 : blockLengthIndex) { MKQL_ENSURE(blockLengthIndex == LAST_COLUMN_MARKER || (0 <= blockLengthIndex && size_t(blockLengthIndex) < width), "Bad blockLengthIndex"); - Pointer_ = Values.data(); + Pointer = Values.data(); } void TBlockState::ClearValues() { @@ -356,14 +356,14 @@ void TBlockState::ClearValues() { void TBlockState::FillArrays() { MKQL_ENSURE(Count == 0, "All existing arrays have to be processed"); - auto& counterDatum = TArrowBlock::From(Values[BlockLengthIndex_]).GetDatum(); + auto& counterDatum = TArrowBlock::From(Values[BlockLengthIndex]).GetDatum(); MKQL_ENSURE(counterDatum.is_scalar(), "Unexpected block length type (expecting scalar)"); Count = counterDatum.scalar_as<arrow::UInt64Scalar>().value; if (!Count) return; for (size_t i = 0U; i < Deques.size(); ++i) { - if (i == BlockLengthIndex_) { + if (i == BlockLengthIndex) { continue; } @@ -409,7 +409,7 @@ ui64 TBlockState::Slice() { } NUdf::TUnboxedValuePod TBlockState::Get(const ui64 sliceSize, const THolderFactory& holderFactory, const size_t idx) const { - if (idx == BlockLengthIndex_) + if (idx == BlockLengthIndex) return holderFactory.CreateArrowBlock(arrow::Datum(std::make_shared<arrow::UInt64Scalar>(sliceSize))); if (auto array = Arrays[idx]) diff --git a/yql/essentials/minikql/computation/mkql_block_impl.h b/yql/essentials/minikql/computation/mkql_block_impl.h index 61964c030e0..4bcdc9514fb 100644 --- a/yql/essentials/minikql/computation/mkql_block_impl.h +++ b/yql/essentials/minikql/computation/mkql_block_impl.h @@ -79,14 +79,14 @@ private: std::unique_ptr<IArrowKernelComputationNode> PrepareArrowKernelComputationNode(TComputationContext& ctx) const final; private: - const ui32 StateIndex; - const TComputationNodePtrVector ArgsNodes; - const std::vector<arrow::ValueDescr> ArgsValuesDescr; - const arrow::compute::ScalarKernel& Kernel; - const std::shared_ptr<arrow::compute::ScalarKernel> KernelHolder; - const arrow::compute::FunctionOptions* const Options; - const bool ScalarOutput; - const TString Name; + const ui32 StateIndex_; + const TComputationNodePtrVector ArgsNodes_; + const std::vector<arrow::ValueDescr> ArgsValuesDescr_; + const arrow::compute::ScalarKernel& Kernel_; + const std::shared_ptr<arrow::compute::ScalarKernel> KernelHolder_; + const arrow::compute::FunctionOptions* const Options_; + const bool ScalarOutput_; + const TString Name_; }; struct TBlockState : public TComputationValue<TBlockState> { @@ -95,13 +95,13 @@ struct TBlockState : public TComputationValue<TBlockState> { using TBase = TComputationValue<TBlockState>; ui64 Count = 0; - NUdf::TUnboxedValue* Pointer_ = nullptr; + NUdf::TUnboxedValue* Pointer = nullptr; TUnboxedValueVector Values; std::vector<std::deque<std::shared_ptr<arrow::ArrayData>>> Deques; std::vector<std::shared_ptr<arrow::ArrayData>> Arrays; - ui64 BlockLengthIndex_ = 0; + ui64 BlockLengthIndex = 0; TBlockState(TMemoryUsageInfo* memInfo, size_t width, i64 blockLengthIndex = LAST_COLUMN_MARKER); diff --git a/yql/essentials/minikql/computation/mkql_block_reader.cpp b/yql/essentials/minikql/computation/mkql_block_reader.cpp index 5886e121c40..9104c6e70ed 100644 --- a/yql/essentials/minikql/computation/mkql_block_reader.cpp +++ b/yql/essentials/minikql/computation/mkql_block_reader.cpp @@ -108,9 +108,9 @@ class TStringBlockItemConverter : public IBlockItemConverter { public: void SetPgBuilder(const NUdf::IPgBuilder* pgBuilder, ui32 pgTypeId, i32 typeLen) { Y_ENSURE(PgString != NUdf::EPgStringType::None); - PgBuilder = pgBuilder; - PgTypeId = pgTypeId; - TypeLen = typeLen; + PgBuilder_ = pgBuilder; + PgTypeId_ = pgTypeId; + TypeLen_ = typeLen; } NUdf::TUnboxedValuePod MakeValue(TBlockItem item, const THolderFactory& holderFactory) const final { @@ -122,14 +122,14 @@ public: } if constexpr (PgString == NUdf::EPgStringType::CString) { - return PgBuilder->MakeCString(item.AsStringRef().Data() + sizeof(void*)).Release(); + return PgBuilder_->MakeCString(item.AsStringRef().Data() + sizeof(void*)).Release(); } else if constexpr (PgString == NUdf::EPgStringType::Text) { - return PgBuilder->MakeText(item.AsStringRef().Data() + sizeof(void*)).Release(); + return PgBuilder_->MakeText(item.AsStringRef().Data() + sizeof(void*)).Release(); } else if constexpr (PgString == NUdf::EPgStringType::Fixed) { auto str = item.AsStringRef().Data() + sizeof(void*); auto len = item.AsStringRef().Size() - sizeof(void*); - Y_DEBUG_ABORT_UNLESS(ui32(TypeLen) <= len); - return PgBuilder->NewString(TypeLen, PgTypeId, NUdf::TStringRef(str, TypeLen)).Release(); + Y_DEBUG_ABORT_UNLESS(ui32(TypeLen_) <= len); + return PgBuilder_->NewString(TypeLen_, PgTypeId_, NUdf::TStringRef(str, TypeLen_)).Release(); } else { return MakeString(item.AsStringRef()); } @@ -143,13 +143,13 @@ public: } if constexpr (PgString == NUdf::EPgStringType::CString) { - auto buf = PgBuilder->AsCStringBuffer(value); + auto buf = PgBuilder_->AsCStringBuffer(value); return TBlockItem(NYql::NUdf::TStringRef(buf.Data() - sizeof(void*), buf.Size() + sizeof(void*))); } else if constexpr (PgString == NUdf::EPgStringType::Text) { - auto buf = PgBuilder->AsTextBuffer(value); + auto buf = PgBuilder_->AsTextBuffer(value); return TBlockItem(NYql::NUdf::TStringRef(buf.Data() - sizeof(void*), buf.Size() + sizeof(void*))); } else if constexpr (PgString == NUdf::EPgStringType::Fixed) { - auto buf = PgBuilder->AsFixedStringBuffer(value, (ui32)TypeLen); + auto buf = PgBuilder_->AsFixedStringBuffer(value, (ui32)TypeLen_); return TBlockItem(NYql::NUdf::TStringRef(buf.Data() - sizeof(void*), buf.Size() + sizeof(void*))); } else { return TBlockItem(value.AsStringRef()); @@ -157,9 +157,9 @@ public: } private: - const NUdf::IPgBuilder* PgBuilder = nullptr; - ui32 PgTypeId = 0; - i32 TypeLen = 0; + const NUdf::IPgBuilder* PgBuilder_ = nullptr; + ui32 PgTypeId_ = 0; + i32 TypeLen_ = 0; }; class TSingularTypeItemConverter: public IBlockItemConverter { @@ -179,10 +179,10 @@ template <bool Nullable> class TTupleBlockItemConverter : public IBlockItemConverter { public: TTupleBlockItemConverter(TVector<std::unique_ptr<IBlockItemConverter>>&& children) - : Children(std::move(children)) + : Children_(std::move(children)) { - Items.resize(Children.size()); - Unboxed.resize(Children.size()); + Items_.resize(Children_.size()); + Unboxed_.resize(Children_.size()); } NUdf::TUnboxedValuePod MakeValue(TBlockItem item, const THolderFactory& holderFactory) const final { @@ -193,10 +193,10 @@ public: } NUdf::TUnboxedValue* values; - auto result = holderFactory.CreateDirectArrayHolder(Children.size(), values); + auto result = holderFactory.CreateDirectArrayHolder(Children_.size(), values); const TBlockItem* childItems = item.AsTuple(); - for (ui32 i = 0; i < Children.size(); ++i) { - values[i] = Children[i]->MakeValue(childItems[i], holderFactory); + for (ui32 i = 0; i < Children_.size(); ++i) { + values[i] = Children_[i]->MakeValue(childItems[i], holderFactory); } return result; @@ -211,24 +211,24 @@ public: auto elements = value.GetElements(); if (!elements) { - for (ui32 i = 0; i < Children.size(); ++i) { - Unboxed[i] = value.GetElement(i); + for (ui32 i = 0; i < Children_.size(); ++i) { + Unboxed_[i] = value.GetElement(i); } - elements = Unboxed.data(); + elements = Unboxed_.data(); } - for (ui32 i = 0; i < Children.size(); ++i) { - Items[i] = Children[i]->MakeItem(elements[i]); + for (ui32 i = 0; i < Children_.size(); ++i) { + Items_[i] = Children_[i]->MakeItem(elements[i]); } - return TBlockItem{ Items.data() }; + return TBlockItem{ Items_.data() }; } private: - const TVector<std::unique_ptr<IBlockItemConverter>> Children; - mutable TVector<NUdf::TUnboxedValue> Unboxed; - mutable TVector<TBlockItem> Items; + const TVector<std::unique_ptr<IBlockItemConverter>> Children_; + mutable TVector<NUdf::TUnboxedValue> Unboxed_; + mutable TVector<TBlockItem> Items_; }; template <typename TTzDate, bool Nullable> @@ -265,14 +265,14 @@ public: class TExternalOptionalBlockItemConverter : public IBlockItemConverter { public: TExternalOptionalBlockItemConverter(std::unique_ptr<IBlockItemConverter>&& inner) - : Inner(std::move(inner)) + : Inner_(std::move(inner)) {} NUdf::TUnboxedValuePod MakeValue(TBlockItem item, const THolderFactory& holderFactory) const final { if (!item) { return {}; } - return Inner->MakeValue(item.GetOptionalValue(), holderFactory).MakeOptional(); + return Inner_->MakeValue(item.GetOptionalValue(), holderFactory).MakeOptional(); } TBlockItem MakeItem(const NUdf::TUnboxedValuePod& value) const final { @@ -280,11 +280,11 @@ public: return {}; } - return Inner->MakeItem(value.GetOptionalValue()).MakeOptional(); + return Inner_->MakeItem(value.GetOptionalValue()).MakeOptional(); } private: - const std::unique_ptr<IBlockItemConverter> Inner; + const std::unique_ptr<IBlockItemConverter> Inner_; }; struct TConverterTraits { diff --git a/yql/essentials/minikql/computation/mkql_computation_list_adapter.h b/yql/essentials/minikql/computation/mkql_computation_list_adapter.h index 948052d33a2..fe20b91ede9 100644 --- a/yql/essentials/minikql/computation/mkql_computation_list_adapter.h +++ b/yql/essentials/minikql/computation/mkql_computation_list_adapter.h @@ -18,57 +18,57 @@ public: public: TIterator(TMemoryUsageInfo* memInfo, const TVectorType& list, TItemFactory itemFactory, ui64 start, ui64 finish, bool reversed) : TTemporaryComputationValue<TIterator>(memInfo) - , List(list) - , ItemFactory(itemFactory) - , Start(start) - , Finish(finish) - , Reversed(reversed) + , List_(list) + , ItemFactory_(itemFactory) + , Start_(start) + , Finish_(finish) + , Reversed_(reversed) { - Index = Reversed ? Finish : (Start - 1); + Index_ = Reversed_ ? Finish_ : (Start_ - 1); } private: bool Next(NUdf::TUnboxedValue& value) override { if (!Skip()) return false; - value = ItemFactory(List[Index]); + value = ItemFactory_(List_[Index_]); return true; } bool Skip() override { - if (!Reversed) { - if (Index + 1 >= Finish) + if (!Reversed_) { + if (Index_ + 1 >= Finish_) return false; - ++Index; + ++Index_; } else { - if (Index < Start + 1) + if (Index_ < Start_ + 1) return false; - --Index; + --Index_; } return true; } - const TVectorType& List; - const TItemFactory ItemFactory; - const ui64 Start; - const ui64 Finish; - const bool Reversed; - ui64 Index; + const TVectorType& List_; + const TItemFactory ItemFactory_; + const ui64 Start_; + const ui64 Finish_; + const bool Reversed_; + ui64 Index_; }; class TDictIterator : public TTemporaryComputationValue<TDictIterator> { public: TDictIterator(TMemoryUsageInfo* memInfo, THolder<TIterator>&& iter) : TTemporaryComputationValue<TDictIterator>(memInfo) - , Iter(std::move(iter)) - , Index(Max<ui64>()) + , Iter_(std::move(iter)) + , Index_(Max<ui64>()) {} private: bool Next(NUdf::TUnboxedValue& key) override { - if (NUdf::TBoxedValueAccessor::Skip(*Iter)) { - key = NUdf::TUnboxedValuePod(++Index); + if (NUdf::TBoxedValueAccessor::Skip(*Iter_)) { + key = NUdf::TUnboxedValuePod(++Index_); return true; } @@ -76,8 +76,8 @@ public: } bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) override { - if (NUdf::TBoxedValueAccessor::Next(*Iter, payload)) { - key = NUdf::TUnboxedValuePod(++Index); + if (NUdf::TBoxedValueAccessor::Next(*Iter_, payload)) { + key = NUdf::TUnboxedValuePod(++Index_); return true; } @@ -85,16 +85,16 @@ public: } bool Skip() override { - if (NUdf::TBoxedValueAccessor::Skip(*Iter)) { - ++Index; + if (NUdf::TBoxedValueAccessor::Skip(*Iter_)) { + ++Index_; return true; } return false; } - THolder<TIterator> Iter; - ui64 Index; + THolder<TIterator> Iter_; + ui64 Index_; }; TVectorListAdapter( @@ -104,13 +104,13 @@ public: ui64 start, ui64 finish, bool reversed) : TBase(memInfo) - , List(list) - , ItemFactory(itemFactory) - , Start(start) - , Finish(finish) - , Reversed(reversed) + , List_(list) + , ItemFactory_(itemFactory) + , Start_(start) + , Finish_(finish) + , Reversed_(reversed) { - Y_ABORT_UNLESS(Start <= Finish && Finish <= List.size()); + Y_ABORT_UNLESS(Start_ <= Finish_ && Finish_ <= List_.size()); } private: @@ -119,40 +119,40 @@ private: } ui64 GetListLength() const override { - return Finish - Start; + return Finish_ - Start_; } ui64 GetEstimatedListLength() const override { - return Finish - Start; + return Finish_ - Start_; } bool HasListItems() const override { - return Finish != Start; + return Finish_ != Start_; } NUdf::IBoxedValuePtr ReverseListImpl(const NUdf::IValueBuilder& builder) const override { Y_UNUSED(builder); - return new TSelf(this->GetMemInfo(), List, ItemFactory, Start, Finish, !Reversed); + return new TSelf(this->GetMemInfo(), List_, ItemFactory_, Start_, Finish_, !Reversed_); } NUdf::IBoxedValuePtr SkipListImpl(const NUdf::IValueBuilder& builder, ui64 count) const override { Y_UNUSED(builder); - const ui64 newStart = Min(Start + count, Finish); - if (newStart == Start) { + const ui64 newStart = Min(Start_ + count, Finish_); + if (newStart == Start_) { return const_cast<TVectorListAdapter*>(this); } - return new TSelf(this->GetMemInfo(), List, ItemFactory, newStart, Finish, Reversed); + return new TSelf(this->GetMemInfo(), List_, ItemFactory_, newStart, Finish_, Reversed_); } NUdf::IBoxedValuePtr TakeListImpl(const NUdf::IValueBuilder& builder, ui64 count) const override { Y_UNUSED(builder); - const ui64 newFinish = Min(Start + count, Finish); - if (newFinish == Finish) { + const ui64 newFinish = Min(Start_ + count, Finish_); + if (newFinish == Finish_) { return const_cast<TVectorListAdapter*>(this); } - return new TSelf(this->GetMemInfo(), List, ItemFactory, Start, newFinish, Reversed); + return new TSelf(this->GetMemInfo(), List_, ItemFactory_, Start_, newFinish, Reversed_); } NUdf::IBoxedValuePtr ToIndexDictImpl(const NUdf::IValueBuilder& builder) const override { @@ -161,7 +161,7 @@ private: } NUdf::TUnboxedValue GetListIterator() const override { - return NUdf::TUnboxedValuePod(new TIterator(this->GetMemInfo(), List, ItemFactory, Start, Finish, Reversed)); + return NUdf::TUnboxedValuePod(new TIterator(this->GetMemInfo(), List_, ItemFactory_, Start_, Finish_, Reversed_)); } bool Contains(const NUdf::TUnboxedValuePod& key) const override { @@ -175,16 +175,16 @@ private: return NUdf::TUnboxedValuePod(); } - const ui64 realIndex = Reversed ? (Finish - 1 - index) : (Start + index); - return ItemFactory(List[realIndex]).Release().MakeOptional(); + const ui64 realIndex = Reversed_ ? (Finish_ - 1 - index) : (Start_ + index); + return ItemFactory_(List_[realIndex]).Release().MakeOptional(); } NUdf::TUnboxedValue GetKeysIterator() const override { - return NUdf::TUnboxedValuePod(new TDictIterator(this->GetMemInfo(), MakeHolder<TIterator>(this->GetMemInfo(), List, ItemFactory, Start, Finish, Reversed))); + return NUdf::TUnboxedValuePod(new TDictIterator(this->GetMemInfo(), MakeHolder<TIterator>(this->GetMemInfo(), List_, ItemFactory_, Start_, Finish_, Reversed_))); } NUdf::TUnboxedValue GetDictIterator() const override { - return NUdf::TUnboxedValuePod(new TDictIterator(this->GetMemInfo(), MakeHolder<TIterator>(this->GetMemInfo(), List, ItemFactory, Start, Finish, Reversed))); + return NUdf::TUnboxedValuePod(new TDictIterator(this->GetMemInfo(), MakeHolder<TIterator>(this->GetMemInfo(), List_, ItemFactory_, Start_, Finish_, Reversed_))); } ui64 GetDictLength() const override { @@ -192,7 +192,7 @@ private: } bool HasDictItems() const override { - return Finish != Start; + return Finish_ != Start_; } bool IsSortedDict() const override { @@ -200,11 +200,11 @@ private: } private: - const TVectorType& List; - const TItemFactory ItemFactory; - const ui64 Start; - const ui64 Finish; - const bool Reversed; + const TVectorType& List_; + const TItemFactory ItemFactory_; + const ui64 Start_; + const ui64 Finish_; + const bool Reversed_; }; template <typename TVectorType> diff --git a/yql/essentials/minikql/computation/mkql_computation_node.cpp b/yql/essentials/minikql/computation/mkql_computation_node.cpp index 6625d3a6eef..a8c898d82dd 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node.cpp @@ -70,14 +70,14 @@ TComputationContext::TComputationContext(const THolderFactory& holderFactory, } } - RssLogger = MakeLogger(); - RssLoggerComponent = RssLogger->RegisterComponent("TrackRss"); + RssLogger_ = MakeLogger(); + RssLoggerComponent_ = RssLogger_->RegisterComponent("TrackRss"); } TComputationContext::~TComputationContext() { #ifndef NDEBUG if (RssCounter) { - RssLogger->Log(RssLoggerComponent, NUdf::ELogLevel::Info, TStringBuilder() + RssLogger_->Log(RssLoggerComponent_, NUdf::ELogLevel::Info, TStringBuilder() << "UsageOnFinish: graph=" << HolderFactory.GetPagePool().GetUsed() << ", rss=" << TRusage::Get().MaxRss << ", peakAlloc=" << HolderFactory.GetPagePool().GetPeakAllocated() @@ -92,20 +92,20 @@ NUdf::TLoggerPtr TComputationContext::MakeLogger() const { void TComputationContext::UpdateUsageAdjustor(ui64 memLimit) { const auto rss = TRusage::Get().MaxRss; - if (!InitRss) { - LastRss = InitRss = rss; + if (!InitRss_) { + LastRss_ = InitRss_ = rss; } #ifndef NDEBUG // Print first time and then each 30 seconds - bool printUsage = LastPrintUsage == TInstant::Zero() - || TInstant::Now() > TDuration::Seconds(30).ToDeadLine(LastPrintUsage); + bool printUsage = LastPrintUsage_ == TInstant::Zero() + || TInstant::Now() > TDuration::Seconds(30).ToDeadLine(LastPrintUsage_); #endif if (auto peakAlloc = HolderFactory.GetPagePool().GetPeakAllocated()) { - if (rss - InitRss > memLimit && rss - LastRss > (memLimit / 4)) { - UsageAdjustor = std::max(1.f, float(rss - InitRss) / float(peakAlloc)); - LastRss = rss; + if (rss - InitRss_ > memLimit && rss - LastRss_ > (memLimit / 4)) { + UsageAdjustor = std::max(1.f, float(rss - InitRss_) / float(peakAlloc)); + LastRss_ = rss; #ifndef NDEBUG printUsage = UsageAdjustor > 1.f; #endif @@ -114,12 +114,12 @@ void TComputationContext::UpdateUsageAdjustor(ui64 memLimit) { #ifndef NDEBUG if (printUsage) { - RssLogger->Log(RssLoggerComponent, NUdf::ELogLevel::Info, TStringBuilder() + RssLogger_->Log(RssLoggerComponent_, NUdf::ELogLevel::Info, TStringBuilder() << "Usage: graph=" << HolderFactory.GetPagePool().GetUsed() << ", rss=" << rss << ", peakAlloc=" << HolderFactory.GetPagePool().GetPeakAllocated() << ", adjustor=" << UsageAdjustor); - LastPrintUsage = TInstant::Now(); + LastPrintUsage_ = TInstant::Now(); } #endif } @@ -127,11 +127,11 @@ void TComputationContext::UpdateUsageAdjustor(ui64 memLimit) { class TSimpleSecureParamsProvider : public NUdf::ISecureParamsProvider { public: TSimpleSecureParamsProvider(const THashMap<TString, TString>& secureParams) - : SecureParams(secureParams) + : SecureParams_(secureParams) {} bool GetSecureParam(NUdf::TStringRef key, NUdf::TStringRef& value) const override { - auto found = SecureParams.FindPtr(TStringBuf(key)); + auto found = SecureParams_.FindPtr(TStringBuf(key)); if (!found) { return false; } @@ -141,7 +141,7 @@ public: } private: - const THashMap<TString, TString> SecureParams; + const THashMap<TString, TString> SecureParams_; }; std::unique_ptr<NUdf::ISecureParamsProvider> MakeSimpleSecureParamsProvider(const THashMap<TString, TString>& secureParams) { diff --git a/yql/essentials/minikql/computation/mkql_computation_node.h b/yql/essentials/minikql/computation/mkql_computation_node.h index b1004629394..741d77371ce 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node.h +++ b/yql/essentials/minikql/computation/mkql_computation_node.h @@ -142,12 +142,12 @@ struct TComputationContext : public TComputationContextLLVM { void UpdateUsageAdjustor(ui64 memLimit); NUdf::TLoggerPtr MakeLogger() const; private: - ui64 InitRss = 0ULL; - ui64 LastRss = 0ULL; - NUdf::TLoggerPtr RssLogger; - NUdf::TLogComponentId RssLoggerComponent; + ui64 InitRss_ = 0ULL; + ui64 LastRss_ = 0ULL; + NUdf::TLoggerPtr RssLogger_; + NUdf::TLogComponentId RssLoggerComponent_; #ifndef NDEBUG - TInstant LastPrintUsage; + TInstant LastPrintUsage_; #endif }; diff --git a/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp b/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp index 72d1c5abfe1..e0bbb759c2e 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp @@ -1008,7 +1008,7 @@ TUnboxedImmutableCodegeneratorNode::TUnboxedImmutableCodegeneratorNode(TMemoryUs {} Value* TUnboxedImmutableCodegeneratorNode::CreateGetValue(const TCodegenContext& ctx, BasicBlock*&) const { - return ConstantInt::get(Type::getInt128Ty(ctx.Codegen.GetContext()), APInt(128, 2, reinterpret_cast<const uint64_t*>(&UnboxedValue))); + return ConstantInt::get(Type::getInt128Ty(ctx.Codegen.GetContext()), APInt(128, 2, reinterpret_cast<const uint64_t*>(&UnboxedValue_))); } TExternalCodegeneratorNode::TExternalCodegeneratorNode(TComputationMutables& mutables, EValueRepresentation kind) @@ -1123,11 +1123,11 @@ Value* TExternalCodegeneratorNode::CreateGetValue(const TCodegenContext& ctx, Ba return LoadIfPointer(temporaryValue, itemType, block); } - MKQL_ENSURE(!Getter, "Wrong LLVM function generation order."); + MKQL_ENSURE(!Getter_, "Wrong LLVM function generation order."); auto& context = ctx.Codegen.GetContext(); const auto indexType = Type::getInt32Ty(context); const auto valueType = Type::getInt128Ty(context); - const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(indexType, ValueIndex)}, "value_ptr", block); + const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(indexType, ValueIndex_)}, "value_ptr", block); const auto value = new LoadInst(valueType, valuePtr, "value", block); return value; } @@ -1139,7 +1139,7 @@ Value* TExternalCodegeneratorNode::CreateRefValue(const TCodegenContext& ctx, Ba const auto indexType = Type::getInt32Ty(context); const auto valueType = Type::getInt128Ty(context); const auto values = ctx.GetMutables(); - const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, values, {ConstantInt::get(indexType, ValueIndex)}, "value_ptr", block); + const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, values, {ConstantInt::get(indexType, ValueIndex_)}, "value_ptr", block); return valuePtr; } @@ -1148,16 +1148,16 @@ void TExternalCodegeneratorNode::CreateSetValue(const TCodegenContext& ctx, Basi const auto indexType = Type::getInt32Ty(context); const auto valueType = Type::getInt128Ty(context); const auto values = ctx.GetMutables(); - const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, values, {ConstantInt::get(indexType, ValueIndex)}, "value_ptr", block); + const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, values, {ConstantInt::get(indexType, ValueIndex_)}, "value_ptr", block); if (value->getType()->isPointerTy()) { - ValueUnRef(RepresentationKind, valuePtr, ctx, block); + ValueUnRef(RepresentationKind_, valuePtr, ctx, block); const auto load = new LoadInst(valueType, value, "value", block); new StoreInst(load, valuePtr, block); new StoreInst(ConstantInt::get(load->getType(), 0), value, block); } else { - if (EValueRepresentation::Embedded == RepresentationKind) { + if (EValueRepresentation::Embedded == RepresentationKind_) { new StoreInst(value, valuePtr, block); } else { const auto load = new LoadInst(valueType, valuePtr, "value", block); @@ -1168,9 +1168,9 @@ void TExternalCodegeneratorNode::CreateSetValue(const TCodegenContext& ctx, Basi BranchInst::Create(skip, refs, equal, block); block = refs; - ValueUnRef(RepresentationKind, valuePtr, ctx, block); + ValueUnRef(RepresentationKind_, valuePtr, ctx, block); new StoreInst(value, valuePtr, block); - ValueAddRef(RepresentationKind, valuePtr, ctx, block); + ValueAddRef(RepresentationKind_, valuePtr, ctx, block); BranchInst::Create(skip, block); block = skip; @@ -1185,16 +1185,16 @@ Value* TExternalCodegeneratorNode::CreateSwapValue(const TCodegenContext& ctx, B const auto indexType = Type::getInt32Ty(context); const auto valueType = Type::getInt128Ty(context); const auto values = ctx.GetMutables(); - const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, values, {ConstantInt::get(indexType, ValueIndex)}, "value_ptr", block); + const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, values, {ConstantInt::get(indexType, ValueIndex_)}, "value_ptr", block); const auto output = new LoadInst(valueType, valuePtr, "output", block); - ValueRelease(RepresentationKind, output, ctx, block); + ValueRelease(RepresentationKind_, output, ctx, block); if (value->getType()->isPointerTy()) { const auto load = new LoadInst(valueType, value, "load", block); new StoreInst(load, valuePtr, block); new StoreInst(ConstantInt::get(load->getType(), 0), value, block); } else { - ValueAddRef(RepresentationKind, value, ctx, block); + ValueAddRef(RepresentationKind_, value, ctx, block); new StoreInst(value, valuePtr, block); } @@ -1203,7 +1203,7 @@ Value* TExternalCodegeneratorNode::CreateSwapValue(const TCodegenContext& ctx, B } void TExternalCodegeneratorNode::CreateInvalidate(const TCodegenContext& ctx, BasicBlock*& block) const { - GenInvalidate(ctx, InvalidationSet, block); + GenInvalidate(ctx, InvalidationSet_, block); } void TExternalCodegeneratorNode::SetValueBuilder(TValueBuilder valueBuilder) @@ -1217,7 +1217,7 @@ void TExternalCodegeneratorNode::SetValueGetterBuilder(TValueGetterBuilder value } void TWideFlowProxyCodegeneratorNode::CreateInvalidate(const TCodegenContext& ctx, BasicBlock*& block) const { - GenInvalidate(ctx, InvalidationSet, block); + GenInvalidate(ctx, InvalidationSet_, block); } void TWideFlowProxyCodegeneratorNode::SetGenerator(TGenerator&& generator) { diff --git a/yql/essentials/minikql/computation/mkql_computation_node_codegen.h.txt b/yql/essentials/minikql/computation/mkql_computation_node_codegen.h.txt index ab330d852b0..d90b41db6eb 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_codegen.h.txt +++ b/yql/essentials/minikql/computation/mkql_computation_node_codegen.h.txt @@ -288,7 +288,7 @@ protected: {} Value* CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const final { - return CreateGetValueImpl(this->Node, ctx, block); + return CreateGetValueImpl(this->Node_, ctx, block); } }; @@ -537,7 +537,7 @@ protected: {} Value* CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const final { - return CreateGetValueImpl(*this->Stateless, this->GetRepresentation(), this->ValueIndex, MakeName(), ctx, block); + return CreateGetValueImpl(*this->Stateless_, this->GetRepresentation(), this->ValueIndex_, MakeName(), ctx, block); } }; @@ -569,7 +569,7 @@ protected: {} Value* CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const final { - return CreateGetValueImpl(*this->Stateless, this->GetRepresentation(), this->ValueIndex, MakeName(), ctx, block); + return CreateGetValueImpl(*this->Stateless_, this->GetRepresentation(), this->ValueIndex_, MakeName(), ctx, block); } }; diff --git a/yql/essentials/minikql/computation/mkql_computation_node_graph_saveload_ut.cpp b/yql/essentials/minikql/computation/mkql_computation_node_graph_saveload_ut.cpp index dc3b20ddcba..1527d598a31 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_graph_saveload_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_graph_saveload_ut.cpp @@ -68,15 +68,15 @@ namespace { struct TStreamWithYield : public NUdf::TBoxedValue { TStreamWithYield(const TUnboxedValueVector& items, ui32 yieldPos, ui32 index) - : Items(items) - , YieldPos(yieldPos) - , Index(index) + : Items_(items) + , YieldPos_(yieldPos) + , Index_(index) {} private: - TUnboxedValueVector Items; - ui32 YieldPos; - ui32 Index; + TUnboxedValueVector Items_; + ui32 YieldPos_; + ui32 Index_; ui32 GetTraverseCount() const override { return 0; @@ -92,13 +92,13 @@ namespace { } NUdf::EFetchStatus Fetch(NUdf::TUnboxedValue& result) final { - if (Index >= Items.size()) { + if (Index_ >= Items_.size()) { return NUdf::EFetchStatus::Finish; } - if (Index == YieldPos) { + if (Index_ == YieldPos_) { return NUdf::EFetchStatus::Yield; } - result = Items[Index++]; + result = Items_[Index_++]; return NUdf::EFetchStatus::Ok; } }; diff --git a/yql/essentials/minikql/computation/mkql_computation_node_holders.cpp b/yql/essentials/minikql/computation/mkql_computation_node_holders.cpp index ea643142173..a14dec94e5d 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_holders.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_holders.cpp @@ -24,11 +24,11 @@ class TValueDataHolder: public TComputationValue<TValueDataHolder> { public: TValueDataHolder(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& value) : TComputationValue(memInfo) - , Value(std::move(value)) + , Value_(std::move(value)) {} private: - const NUdf::TUnboxedValue Value; + const NUdf::TUnboxedValue Value_; }; class TDirectListHolder: public TComputationValue<TDirectListHolder> { @@ -37,51 +37,51 @@ public: public: TIterator(const TDirectListHolder* parent) : TComputationValue(parent->GetMemInfo()) - , Parent(const_cast<TDirectListHolder*>(parent)) - , Iterator(parent->Items) - , AtStart(true) + , Parent_(const_cast<TDirectListHolder*>(parent)) + , Iterator_(parent->Items_) + , AtStart_(true) { } private: bool Skip() override { - if (AtStart) { - AtStart = false; + if (AtStart_) { + AtStart_ = false; } else { - if (Iterator.AtEnd()) { + if (Iterator_.AtEnd()) { return false; } - Iterator.Next(); + Iterator_.Next(); } - return !Iterator.AtEnd(); + return !Iterator_.AtEnd(); } bool Next(NUdf::TUnboxedValue& value) override { if (!Skip()) return false; - value = Iterator.Current(); + value = Iterator_.Current(); return true; } - const NUdf::TRefCountedPtr<TDirectListHolder> Parent; - TDefaultListRepresentation::TIterator Iterator; - bool AtStart; + const NUdf::TRefCountedPtr<TDirectListHolder> Parent_; + TDefaultListRepresentation::TIterator Iterator_; + bool AtStart_; }; class TDictIterator: public TComputationValue<TDictIterator> { public: TDictIterator(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& iter) : TComputationValue(memInfo) - , Iter(std::move(iter)) - , Index(Max<ui64>()) + , Iter_(std::move(iter)) + , Index_(Max<ui64>()) {} private: bool Next(NUdf::TUnboxedValue& key) override { - if (Iter.Skip()) { - key = NUdf::TUnboxedValuePod(++Index); + if (Iter_.Skip()) { + key = NUdf::TUnboxedValuePod(++Index_); return true; } @@ -89,8 +89,8 @@ public: } bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) override { - if (Iter.Next(payload)) { - key = NUdf::TUnboxedValuePod(++Index); + if (Iter_.Next(payload)) { + key = NUdf::TUnboxedValuePod(++Index_); return true; } @@ -98,21 +98,21 @@ public: } bool Skip() override { - if (Iter.Skip()) { - ++Index; + if (Iter_.Skip()) { + ++Index_; return true; } return false; } - const NUdf::TUnboxedValue Iter; - ui64 Index; + const NUdf::TUnboxedValue Iter_; + ui64 Index_; }; TDirectListHolder(TMemoryUsageInfo* memInfo, TDefaultListRepresentation&& items) : TComputationValue(memInfo) - , Items(std::move(items)) + , Items_(std::move(items)) {} private: @@ -127,7 +127,7 @@ private: return NUdf::TUnboxedValuePod(); } - return Items.GetItemByIndex(index).Release().MakeOptional(); + return Items_.GetItemByIndex(index).Release().MakeOptional(); } NUdf::TUnboxedValue GetListIterator() const override { @@ -151,30 +151,30 @@ private: } ui64 GetListLength() const override { - return Items.GetLength(); + return Items_.GetLength(); } ui64 GetEstimatedListLength() const override { - return Items.GetLength(); + return Items_.GetLength(); } bool HasListItems() const override { - return Items.GetLength() != 0; + return Items_.GetLength() != 0; } const NUdf::TOpaqueListRepresentation* GetListRepresentation() const override { - return reinterpret_cast<const NUdf::TOpaqueListRepresentation*>(&Items); + return reinterpret_cast<const NUdf::TOpaqueListRepresentation*>(&Items_); } NUdf::IBoxedValuePtr ReverseListImpl(const NUdf::IValueBuilder& builder) const override { - switch (Items.GetLength()) { + switch (Items_.GetLength()) { case 0U: return builder.NewEmptyList().Release().AsBoxed(); case 1U: return const_cast<TDirectListHolder*>(this); default: break; } TDefaultListRepresentation result; - for (auto it = Items.GetReverseIterator(); !it.AtEnd(); it.Next()) { + for (auto it = Items_.GetReverseIterator(); !it.AtEnd(); it.Next()) { result = result.Append(NUdf::TUnboxedValue(it.Current())); } @@ -185,10 +185,10 @@ private: if (count == 0) return const_cast<TDirectListHolder*>(this); - if (count >= Items.GetLength()) + if (count >= Items_.GetLength()) return builder.NewEmptyList().Release().AsBoxed(); - auto result = Items.SkipFromBegin(static_cast<size_t>(count)); + auto result = Items_.SkipFromBegin(static_cast<size_t>(count)); return new TDirectListHolder(GetMemInfo(), std::move(result)); } @@ -196,10 +196,10 @@ private: if (count == 0) return builder.NewEmptyList().Release().AsBoxed(); - if (count >= Items.GetLength()) + if (count >= Items_.GetLength()) return const_cast<TDirectListHolder*>(this); - auto result = Items.SkipFromEnd(static_cast<size_t>(Items.GetLength() - count)); + auto result = Items_.SkipFromEnd(static_cast<size_t>(Items_.GetLength() - count)); return new TDirectListHolder(GetMemInfo(), std::move(result)); } @@ -213,22 +213,22 @@ private: } bool HasDictItems() const override { - return Items.GetLength() != 0; + return Items_.GetLength() != 0; } NUdf::TUnboxedValue GetElement(ui32 index) const final { - return Items.GetItemByIndex(index); + return Items_.GetItemByIndex(index); } const NUdf::TUnboxedValue* GetElements() const final { - return Items.GetItems(); + return Items_.GetItems(); } bool IsSortedDict() const override { return true; } - TDefaultListRepresentation Items; + TDefaultListRepresentation Items_; }; template <class TBaseVector> @@ -256,27 +256,27 @@ private: public: TValuesIterator(const TVectorHolderBase* parent) : TBase(parent->GetMemInfo()) - , Size(parent->size()) - , Parent(const_cast<TVectorHolderBase*>(parent)) { + , Size_(parent->size()) + , Parent_(const_cast<TVectorHolderBase*>(parent)) { } private: bool Skip() final { - return ++Current < Size; + return ++Current_ < Size_; } bool Next(NUdf::TUnboxedValue& value) final { - if (Size <= Current) { + if (Size_ <= Current_) { return false; } - value = (*Parent)[Current]; - ++Current; + value = (*Parent_)[Current_]; + ++Current_; return true; } - const size_t Size; - ui64 Current = 0; - const NUdf::TRefCountedPtr<TVectorHolderBase> Parent; + const size_t Size_; + ui64 Current_ = 0; + const NUdf::TRefCountedPtr<TVectorHolderBase> Parent_; }; class TDictIterator: public TTemporaryComputationValue<TDictIterator> { @@ -285,36 +285,36 @@ private: public: TDictIterator(const TVectorHolderBase* parent) : TBase(parent->GetMemInfo()) - , Size(parent->size()) - , Parent(const_cast<TVectorHolderBase*>(parent)) { + , Size_(parent->size()) + , Parent_(const_cast<TVectorHolderBase*>(parent)) { } private: bool Skip() final { - return ++Current < Size; + return ++Current_ < Size_; } bool Next(NUdf::TUnboxedValue& key) final { - if (Current == Size) { + if (Current_ == Size_) { return false; } - key = NUdf::TUnboxedValuePod(Current); - ++Current; + key = NUdf::TUnboxedValuePod(Current_); + ++Current_; return true; } bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) final { - if (Current == Size) { + if (Current_ == Size_) { return false; } - key = NUdf::TUnboxedValuePod(Current); - payload = (*Parent)[Current]; - ++Current; + key = NUdf::TUnboxedValuePod(Current_); + payload = (*Parent_)[Current_]; + ++Current_; return true; } - const size_t Size; - ui64 Current = 0; - const NUdf::TRefCountedPtr<TVectorHolderBase> Parent; + const size_t Size_; + ui64 Current_ = 0; + const NUdf::TRefCountedPtr<TVectorHolderBase> Parent_; }; bool HasListItems() const final { @@ -431,7 +431,7 @@ public: class TEmptyContainerHolder: public TComputationValue<TEmptyContainerHolder> { public: TEmptyContainerHolder(TMemoryUsageInfo* memInfo) - : TComputationValue(memInfo), None() + : TComputationValue(memInfo), None_() {} private: @@ -440,7 +440,7 @@ private: } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod&) const override { - return None; + return None_; } NUdf::EFetchStatus Fetch(NUdf::TUnboxedValue&) override { @@ -476,7 +476,7 @@ private: } const NUdf::TOpaqueListRepresentation* GetListRepresentation() const override { - return reinterpret_cast<const NUdf::TOpaqueListRepresentation*>(&List); + return reinterpret_cast<const NUdf::TOpaqueListRepresentation*>(&List_); } bool HasFastListLength() const override { @@ -530,11 +530,11 @@ private: } const NUdf::TUnboxedValue* GetElements() const override { - return &None; + return &None_; } - const NUdf::TUnboxedValue None; - const TDefaultListRepresentation List; + const NUdf::TUnboxedValue None_; + const TDefaultListRepresentation List_; }; class TSortedSetHolder: public TComputationValue<TSortedSetHolder> { @@ -546,33 +546,33 @@ public: public: TIterator(const TSortedSetHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) - , Parent(const_cast<TSortedSetHolder*>(parent)) - , Iterator(Parent->Items.begin()) - , AtStart(true) + , Parent_(const_cast<TSortedSetHolder*>(parent)) + , Iterator_(Parent_->Items_.begin()) + , AtStart_(true) { } private: bool Skip() override { - if (AtStart) { - AtStart = false; + if (AtStart_) { + AtStart_ = false; } else { - if (Iterator == Parent->Items.end()) + if (Iterator_ == Parent_->Items_.end()) return false; - ++Iterator; + ++Iterator_; } - return Iterator != Parent->Items.end(); + return Iterator_ != Parent_->Items_.end(); } bool Next(NUdf::TUnboxedValue& key) override { if (!Skip()) return false; if (NoSwap) { - key = *Iterator; - if (Parent->Packer) { - key = Parent->Packer->Decode(key.AsStringRef(), false, Parent->HolderFactory); + key = *Iterator_; + if (Parent_->Packer_) { + key = Parent_->Packer_->Decode(key.AsStringRef(), false, Parent_->HolderFactory_); } } else { key = NUdf::TUnboxedValuePod::Void(); @@ -586,17 +586,17 @@ public: if (NoSwap) { payload = NUdf::TUnboxedValuePod::Void(); } else { - payload = *Iterator; - if (Parent->Packer) { - payload = Parent->Packer->Decode(payload.AsStringRef(), false, Parent->HolderFactory); + payload = *Iterator_; + if (Parent_->Packer_) { + payload = Parent_->Packer_->Decode(payload.AsStringRef(), false, Parent_->HolderFactory_); } } return true; } - const NUdf::TRefCountedPtr<TSortedSetHolder> Parent; - TItems::const_iterator Iterator; - bool AtStart; + const NUdf::TRefCountedPtr<TSortedSetHolder> Parent_; + TItems::const_iterator Iterator_; + bool AtStart_; }; TSortedSetHolder( @@ -611,17 +611,17 @@ public: const NUdf::IEquate* equate, const THolderFactory& holderFactory) : TComputationValue(memInfo) - , Filler(filler) - , Types(types) - , IsTuple(isTuple) - , Mode(mode) - , Compare(compare) - , Equate(equate) - , IsBuilt(false) - , HolderFactory(holderFactory) + , Filler_(filler) + , Types_(types) + , IsTuple_(isTuple) + , Mode_(mode) + , Compare_(compare) + , Equate_(equate) + , IsBuilt_(false) + , HolderFactory_(holderFactory) { if (encodedType) { - Packer.emplace(encodedType); + Packer_.emplace(encodedType); } if (eagerFill) @@ -629,30 +629,30 @@ public: } ~TSortedSetHolder() { - MKQL_MEM_RETURN(GetMemInfo(), &Items, Items.capacity() * sizeof(TItems::value_type)); + MKQL_MEM_RETURN(GetMemInfo(), &Items_, Items_.capacity() * sizeof(TItems::value_type)); } private: bool Contains(const NUdf::TUnboxedValuePod& key) const override { LazyBuildDict(); NUdf::TUnboxedValue encodedKey; - if (Packer) { - encodedKey = MakeString(Packer->Encode(key, false)); + if (Packer_) { + encodedKey = MakeString(Packer_->Encode(key, false)); } - return BinarySearch(Items.begin(), Items.end(), NUdf::TUnboxedValuePod(Packer ? encodedKey : key), - TValueLess(Types, IsTuple, Compare)); + return BinarySearch(Items_.begin(), Items_.end(), NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key), + TValueLess(Types_, IsTuple_, Compare_)); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override { LazyBuildDict(); NUdf::TUnboxedValue encodedKey; - if (Packer) { - encodedKey = MakeString(Packer->Encode(key, false)); + if (Packer_) { + encodedKey = MakeString(Packer_->Encode(key, false)); } - const auto it = LowerBound(Items.begin(), Items.end(), NUdf::TUnboxedValuePod(Packer ? encodedKey : key), TValueLess(Types, IsTuple, Compare)); - if (it == Items.end() || !TValueEqual(Types, IsTuple, Equate)(*it, NUdf::TUnboxedValuePod(Packer ? encodedKey : key))) + const auto it = LowerBound(Items_.begin(), Items_.end(), NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key), TValueLess(Types_, IsTuple_, Compare_)); + if (it == Items_.end() || !TValueEqual(Types_, IsTuple_, Equate_)(*it, NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key))) return NUdf::TUnboxedValuePod(); return it->MakeOptional(); @@ -675,47 +675,47 @@ private: ui64 GetDictLength() const override { LazyBuildDict(); - return Items.size(); + return Items_.size(); } bool HasDictItems() const override { LazyBuildDict(); - return !Items.empty(); + return !Items_.empty(); } void LazyBuildDict() const { - if (IsBuilt) + if (IsBuilt_) return; - Filler(Items); - Filler = TSortedSetFiller(); + Filler_(Items_); + Filler_ = TSortedSetFiller(); - switch (Mode) { + switch (Mode_) { case EDictSortMode::RequiresSorting: - StableSort(Items.begin(), Items.end(), TValueLess(Types, IsTuple, Compare)); - Items.erase(Unique(Items.begin(), Items.end(), TValueEqual(Types, IsTuple, Equate)), Items.end()); + StableSort(Items_.begin(), Items_.end(), TValueLess(Types_, IsTuple_, Compare_)); + Items_.erase(Unique(Items_.begin(), Items_.end(), TValueEqual(Types_, IsTuple_, Equate_)), Items_.end()); break; case EDictSortMode::SortedUniqueAscending: break; case EDictSortMode::SortedUniqueDescening: - Reverse(Items.begin(), Items.end()); + Reverse(Items_.begin(), Items_.end()); break; default: Y_ABORT(); } Y_DEBUG_ABORT_UNLESS(IsSortedUnique()); - IsBuilt = true; + IsBuilt_ = true; - if (!Items.empty()) { - MKQL_MEM_TAKE(GetMemInfo(), &Items, Items.capacity() * sizeof(TItems::value_type)); + if (!Items_.empty()) { + MKQL_MEM_TAKE(GetMemInfo(), &Items_, Items_.capacity() * sizeof(TItems::value_type)); } } bool IsSortedUnique() const { - TValueLess less(Types, IsTuple, Compare); - for (size_t i = 1, e = Items.size(); i < e; ++i) { - if (!less(Items[i - 1], Items[i])) + TValueLess less(Types_, IsTuple_, Compare_); + for (size_t i = 1, e = Items_.size(); i < e; ++i) { + if (!less(Items_[i - 1], Items_[i])) return false; } @@ -727,16 +727,16 @@ private: } private: - mutable TSortedSetFiller Filler; - const TKeyTypes Types; - const bool IsTuple; - const EDictSortMode Mode; - const NUdf::ICompare* Compare; - const NUdf::IEquate* Equate; - mutable bool IsBuilt; - const THolderFactory& HolderFactory; - mutable TItems Items; - mutable std::optional<TGenericPresortEncoder> Packer; + mutable TSortedSetFiller Filler_; + const TKeyTypes Types_; + const bool IsTuple_; + const EDictSortMode Mode_; + const NUdf::ICompare* Compare_; + const NUdf::IEquate* Equate_; + mutable bool IsBuilt_; + const THolderFactory& HolderFactory_; + mutable TItems Items_; + mutable std::optional<TGenericPresortEncoder> Packer_; }; class TSortedDictHolder: public TComputationValue<TSortedDictHolder> { @@ -748,36 +748,36 @@ public: public: TIterator(const TSortedDictHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) - , Parent(const_cast<TSortedDictHolder*>(parent)) - , Iterator(Parent->Items.begin()) - , AtStart(true) + , Parent_(const_cast<TSortedDictHolder*>(parent)) + , Iterator_(Parent_->Items_.begin()) + , AtStart_(true) { } private: bool Skip() override { - if (AtStart) { - AtStart = false; + if (AtStart_) { + AtStart_ = false; } else { - if (Iterator == Parent->Items.end()) + if (Iterator_ == Parent_->Items_.end()) return false; - ++Iterator; + ++Iterator_; } - return Iterator != Parent->Items.end(); + return Iterator_ != Parent_->Items_.end(); } bool Next(NUdf::TUnboxedValue& key) override { if (!Skip()) return false; if (NoSwap) { - key = Iterator->first; - if (Parent->Packer) { - key = Parent->Packer->Decode(key.AsStringRef(), false, Parent->HolderFactory); + key = Iterator_->first; + if (Parent_->Packer_) { + key = Parent_->Packer_->Decode(key.AsStringRef(), false, Parent_->HolderFactory_); } } else { - key = Iterator->second; + key = Iterator_->second; } return true; } @@ -786,19 +786,19 @@ public: if (!Next(key)) return false; if (NoSwap) { - payload = Iterator->second; + payload = Iterator_->second; } else { - payload = Iterator->first; - if (Parent->Packer) { - payload = Parent->Packer->Decode(payload.AsStringRef(), false, Parent->HolderFactory); + payload = Iterator_->first; + if (Parent_->Packer_) { + payload = Parent_->Packer_->Decode(payload.AsStringRef(), false, Parent_->HolderFactory_); } } return true; } - const NUdf::TRefCountedPtr<TSortedDictHolder> Parent; - TItems::const_iterator Iterator; - bool AtStart; + const NUdf::TRefCountedPtr<TSortedDictHolder> Parent_; + TItems::const_iterator Iterator_; + bool AtStart_; }; TSortedDictHolder( @@ -813,17 +813,17 @@ public: const NUdf::IEquate* equate, const THolderFactory& holderFactory) : TComputationValue(memInfo) - , Filler(filler) - , Types(types) - , IsTuple(isTuple) - , Mode(mode) - , Compare(compare) - , Equate(equate) - , IsBuilt(false) - , HolderFactory(holderFactory) + , Filler_(filler) + , Types_(types) + , IsTuple_(isTuple) + , Mode_(mode) + , Compare_(compare) + , Equate_(equate) + , IsBuilt_(false) + , HolderFactory_(holderFactory) { if (encodedType) { - Packer.emplace(encodedType); + Packer_.emplace(encodedType); } if (eagerFill) @@ -831,30 +831,30 @@ public: } ~TSortedDictHolder() { - MKQL_MEM_RETURN(GetMemInfo(), &Items, Items.capacity() * sizeof(TItems::value_type)); + MKQL_MEM_RETURN(GetMemInfo(), &Items_, Items_.capacity() * sizeof(TItems::value_type)); } private: bool Contains(const NUdf::TUnboxedValuePod& key) const override { LazyBuildDict(); NUdf::TUnboxedValue encodedKey; - if (Packer) { - encodedKey = MakeString(Packer->Encode(key, false)); + if (Packer_) { + encodedKey = MakeString(Packer_->Encode(key, false)); } - return BinarySearch(Items.begin(), Items.end(), TItems::value_type(NUdf::TUnboxedValuePod(Packer ? encodedKey : key), NUdf::TUnboxedValuePod()), - TKeyPayloadPairLess(Types, IsTuple, Compare)); + return BinarySearch(Items_.begin(), Items_.end(), TItems::value_type(NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key), NUdf::TUnboxedValuePod()), + TKeyPayloadPairLess(Types_, IsTuple_, Compare_)); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override { LazyBuildDict(); NUdf::TUnboxedValue encodedKey; - if (Packer) { - encodedKey = MakeString(Packer->Encode(key, false)); + if (Packer_) { + encodedKey = MakeString(Packer_->Encode(key, false)); } - const auto it = LowerBound(Items.begin(), Items.end(), TItems::value_type(NUdf::TUnboxedValuePod(Packer ? encodedKey : key), NUdf::TUnboxedValue()), TKeyPayloadPairLess(Types, IsTuple, Compare)); - if (it == Items.end() || !TKeyPayloadPairEqual(Types, IsTuple, Equate)({it->first, it->second}, TKeyPayloadPair(NUdf::TUnboxedValuePod(Packer ? encodedKey : key), {}))) + const auto it = LowerBound(Items_.begin(), Items_.end(), TItems::value_type(NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key), NUdf::TUnboxedValue()), TKeyPayloadPairLess(Types_, IsTuple_, Compare_)); + if (it == Items_.end() || !TKeyPayloadPairEqual(Types_, IsTuple_, Equate_)({it->first, it->second}, TKeyPayloadPair(NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key), {}))) return NUdf::TUnboxedValuePod(); return it->second.MakeOptional(); @@ -877,47 +877,47 @@ private: ui64 GetDictLength() const override { LazyBuildDict(); - return Items.size(); + return Items_.size(); } bool HasDictItems() const override { LazyBuildDict(); - return !Items.empty(); + return !Items_.empty(); } void LazyBuildDict() const { - if (IsBuilt) + if (IsBuilt_) return; - Filler(Items); - Filler = TSortedDictFiller(); + Filler_(Items_); + Filler_ = TSortedDictFiller(); - switch (Mode) { + switch (Mode_) { case EDictSortMode::RequiresSorting: - StableSort(Items.begin(), Items.end(), TKeyPayloadPairLess(Types, IsTuple, Compare)); - Items.erase(Unique(Items.begin(), Items.end(), TKeyPayloadPairEqual(Types, IsTuple, Equate)), Items.end()); + StableSort(Items_.begin(), Items_.end(), TKeyPayloadPairLess(Types_, IsTuple_, Compare_)); + Items_.erase(Unique(Items_.begin(), Items_.end(), TKeyPayloadPairEqual(Types_, IsTuple_, Equate_)), Items_.end()); break; case EDictSortMode::SortedUniqueAscending: break; case EDictSortMode::SortedUniqueDescening: - Reverse(Items.begin(), Items.end()); + Reverse(Items_.begin(), Items_.end()); break; default: Y_ABORT(); } Y_DEBUG_ABORT_UNLESS(IsSortedUnique()); - IsBuilt = true; + IsBuilt_ = true; - if (!Items.empty()) { - MKQL_MEM_TAKE(GetMemInfo(), &Items, Items.capacity() * sizeof(TItems::value_type)); + if (!Items_.empty()) { + MKQL_MEM_TAKE(GetMemInfo(), &Items_, Items_.capacity() * sizeof(TItems::value_type)); } } bool IsSortedUnique() const { - TKeyPayloadPairLess less(Types, IsTuple, Compare); - for (size_t i = 1, e = Items.size(); i < e; ++i) { - if (!less(Items[i - 1], Items[i])) + TKeyPayloadPairLess less(Types_, IsTuple_, Compare_); + for (size_t i = 1, e = Items_.size(); i < e; ++i) { + if (!less(Items_[i - 1], Items_[i])) return false; } @@ -929,16 +929,16 @@ private: } private: - mutable TSortedDictFiller Filler; - const TKeyTypes Types; - const bool IsTuple; - const EDictSortMode Mode; - const NUdf::ICompare* Compare; - const NUdf::IEquate* Equate; - mutable bool IsBuilt; - const THolderFactory& HolderFactory; - mutable TItems Items; - mutable std::optional<TGenericPresortEncoder> Packer; + mutable TSortedDictFiller Filler_; + const TKeyTypes Types_; + const bool IsTuple_; + const EDictSortMode Mode_; + const NUdf::ICompare* Compare_; + const NUdf::IEquate* Equate_; + mutable bool IsBuilt_; + const THolderFactory& HolderFactory_; + mutable TItems Items_; + mutable std::optional<TGenericPresortEncoder> Packer_; }; class THashedSetHolder : public TComputationValue<THashedSetHolder> { @@ -947,35 +947,35 @@ public: public: TIterator(const THashedSetHolder* parent) : TComputationValue(parent->GetMemInfo()) - , Parent(const_cast<THashedSetHolder*>(parent)) - , Iterator(Parent->Set.begin()) - , End(Parent->Set.end()) - , AtStart(true) + , Parent_(const_cast<THashedSetHolder*>(parent)) + , Iterator_(Parent_->Set_.begin()) + , End_(Parent_->Set_.end()) + , AtStart_(true) { } private: bool Skip() override { - if (AtStart) { - AtStart = false; + if (AtStart_) { + AtStart_ = false; } else { - if (Iterator == End) { + if (Iterator_ == End_) { return false; } - ++Iterator; + ++Iterator_; } - return Iterator != End; + return Iterator_ != End_; } bool Next(NUdf::TUnboxedValue& key) override { if (!Skip()) return false; - key = *Iterator; - if (Parent->Packer) { - key = Parent->Packer->Unpack(key.AsStringRef(), Parent->HolderFactory); + key = *Iterator_; + if (Parent_->Packer_) { + key = Parent_->Packer_->Unpack(key.AsStringRef(), Parent_->HolderFactory_); } return true; @@ -989,24 +989,24 @@ public: } private: - const NUdf::TRefCountedPtr<THashedSetHolder> Parent; - TValuesDictHashSet::const_iterator Iterator; - TValuesDictHashSet::const_iterator End; - bool AtStart; + const NUdf::TRefCountedPtr<THashedSetHolder> Parent_; + TValuesDictHashSet::const_iterator Iterator_; + TValuesDictHashSet::const_iterator End_; + bool AtStart_; }; THashedSetHolder(TMemoryUsageInfo* memInfo, THashedSetFiller filler, const TKeyTypes& types, bool isTuple, bool eagerFill, TType* encodedType, const NUdf::IHash* hash, const NUdf::IEquate* equate, const THolderFactory& holderFactory) : TComputationValue(memInfo) - , Filler(filler) - , Types(types) - , Set(0, TValueHasher(Types, isTuple, hash), TValueEqual(Types, isTuple, equate)) - , IsBuilt(false) - , HolderFactory(holderFactory) + , Filler_(filler) + , Types_(types) + , Set_(0, TValueHasher(Types_, isTuple, hash), TValueEqual(Types_, isTuple, equate)) + , IsBuilt_(false) + , HolderFactory_(holderFactory) { if (encodedType) { - Packer.emplace(true, encodedType); + Packer_.emplace(true, encodedType); } if (eagerFill) @@ -1017,22 +1017,22 @@ private: bool Contains(const NUdf::TUnboxedValuePod& key) const override { LazyBuildDict(); NUdf::TUnboxedValue encodedKey; - if (Packer) { - encodedKey = MakeString(Packer->Pack(key)); + if (Packer_) { + encodedKey = MakeString(Packer_->Pack(key)); } - return Set.find(NUdf::TUnboxedValuePod(Packer ? encodedKey : key)) != Set.cend(); + return Set_.find(NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key)) != Set_.cend(); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override { LazyBuildDict(); NUdf::TUnboxedValue encodedKey; - if (Packer) { - encodedKey = MakeString(Packer->Pack(key)); + if (Packer_) { + encodedKey = MakeString(Packer_->Pack(key)); } - const auto it = Set.find(NUdf::TUnboxedValuePod(Packer ? encodedKey : key)); - if (it == Set.cend()) + const auto it = Set_.find(NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key)); + if (it == Set_.cend()) return NUdf::TUnboxedValuePod(); return NUdf::TUnboxedValuePod::Void(); } @@ -1059,12 +1059,12 @@ private: ui64 GetDictLength() const override { LazyBuildDict(); - return Set.size(); + return Set_.size(); } bool HasDictItems() const override { LazyBuildDict(); - return !Set.empty(); + return !Set_.empty(); } bool IsSortedDict() const override { @@ -1073,22 +1073,22 @@ private: private: void LazyBuildDict() const { - if (IsBuilt) + if (IsBuilt_) return; - Filler(Set); - Filler = THashedSetFiller(); + Filler_(Set_); + Filler_ = THashedSetFiller(); - IsBuilt = true; + IsBuilt_ = true; } private: - mutable THashedSetFiller Filler; - const TKeyTypes Types; - mutable TValuesDictHashSet Set; - mutable bool IsBuilt; - const THolderFactory& HolderFactory; - mutable std::optional<TValuePacker> Packer; + mutable THashedSetFiller Filler_; + const TKeyTypes Types_; + mutable TValuesDictHashSet Set_; + mutable bool IsBuilt_; + const THolderFactory& HolderFactory_; + mutable std::optional<TValuePacker> Packer_; }; template <typename T, bool OptionalKey> @@ -1105,36 +1105,36 @@ public: }; TIterator(const THashedSingleFixedSetHolder* parent) : TComputationValue<TIterator>(parent->GetMemInfo()) - , Parent(const_cast<THashedSingleFixedSetHolder*>(parent)) - , Iterator(Parent->Set.begin()) - , End(Parent->Set.end()) - , State(EState::AtStart) + , Parent_(const_cast<THashedSingleFixedSetHolder*>(parent)) + , Iterator_(Parent_->Set_.begin()) + , End_(Parent_->Set_.end()) + , State_(EState::AtStart) { } private: bool Skip() final { - switch (State) { + switch (State_) { case EState::AtStart: - State = OptionalKey && Parent->HasNull ? EState::AtNull : EState::Iterator; + State_ = OptionalKey && Parent_->HasNull_ ? EState::AtNull : EState::Iterator; break; case EState::AtNull: - State = EState::Iterator; + State_ = EState::Iterator; break; case EState::Iterator: - if (Iterator == End) + if (Iterator_ == End_) return false; - ++Iterator; + ++Iterator_; break; } - return EState::AtNull == State || Iterator != End; + return EState::AtNull == State_ || Iterator_ != End_; } bool Next(NUdf::TUnboxedValue& key) final { if (!Skip()) return false; - key = EState::AtNull == State ? NUdf::TUnboxedValuePod() : NUdf::TUnboxedValuePod(*Iterator); + key = EState::AtNull == State_ ? NUdf::TUnboxedValuePod() : NUdf::TUnboxedValuePod(*Iterator_); return true; } @@ -1145,28 +1145,28 @@ public: return true; } - const NUdf::TRefCountedPtr<THashedSingleFixedSetHolder> Parent; - typename TSetType::const_iterator Iterator; - typename TSetType::const_iterator End; - EState State; + const NUdf::TRefCountedPtr<THashedSingleFixedSetHolder> Parent_; + typename TSetType::const_iterator Iterator_; + typename TSetType::const_iterator End_; + EState State_; }; THashedSingleFixedSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set, bool hasNull) : TComputationValue<THashedSingleFixedSetHolder>(memInfo) - , Set(std::move(set)) - , HasNull(hasNull) + , Set_(std::move(set)) + , HasNull_(hasNull) { - MKQL_ENSURE(OptionalKey || !HasNull, "Null value is not allowed for non-optional key type"); + MKQL_ENSURE(OptionalKey || !HasNull_, "Null value is not allowed for non-optional key type"); } private: bool Contains(const NUdf::TUnboxedValuePod& key) const final { if constexpr (OptionalKey) { if (!key) { - return HasNull; + return HasNull_; } } - return Set.find(key.Get<T>()) != Set.cend(); + return Set_.find(key.Get<T>()) != Set_.cend(); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const final { @@ -1192,19 +1192,19 @@ private: } ui64 GetDictLength() const final { - return Set.size() + ui64(OptionalKey && HasNull); + return Set_.size() + ui64(OptionalKey && HasNull_); } bool HasDictItems() const final { - return !Set.empty() || (OptionalKey && HasNull); + return !Set_.empty() || (OptionalKey && HasNull_); } bool IsSortedDict() const final { return false; } - const TSetType Set; - const bool HasNull; + const TSetType Set_; + const bool HasNull_; }; template <typename T, bool OptionalKey> @@ -1221,35 +1221,35 @@ public: }; TIterator(const THashedSingleFixedCompactSetHolder* parent) : TComputationValue<TIterator>(parent->GetMemInfo()) - , Parent(const_cast<THashedSingleFixedCompactSetHolder*>(parent)) - , Iterator(Parent->Set.Iterate()) - , State(EState::AtStart) + , Parent_(const_cast<THashedSingleFixedCompactSetHolder*>(parent)) + , Iterator_(Parent_->Set_.Iterate()) + , State_(EState::AtStart) { } private: bool Skip() final { - switch (State) { + switch (State_) { case EState::AtStart: - State = OptionalKey && Parent->HasNull ? EState::AtNull : EState::Iterator; + State_ = OptionalKey && Parent_->HasNull_ ? EState::AtNull : EState::Iterator; break; case EState::AtNull: - State = EState::Iterator; + State_ = EState::Iterator; break; case EState::Iterator: - if (!Iterator.Ok()) + if (!Iterator_.Ok()) return false; - ++Iterator; + ++Iterator_; break; } - return EState::AtNull == State || Iterator.Ok(); + return EState::AtNull == State_ || Iterator_.Ok(); } bool Next(NUdf::TUnboxedValue& key) final { if (!Skip()) return false; - key = EState::AtNull == State ? NUdf::TUnboxedValuePod() : NUdf::TUnboxedValuePod(*Iterator); + key = EState::AtNull == State_ ? NUdf::TUnboxedValuePod() : NUdf::TUnboxedValuePod(*Iterator_); return true; } @@ -1260,27 +1260,27 @@ public: return true; } - const NUdf::TRefCountedPtr<THashedSingleFixedCompactSetHolder> Parent; - typename TSetType::TIterator Iterator; - EState State; + const NUdf::TRefCountedPtr<THashedSingleFixedCompactSetHolder> Parent_; + typename TSetType::TIterator Iterator_; + EState State_; }; THashedSingleFixedCompactSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set, bool hasNull) : TComputationValue<THashedSingleFixedCompactSetHolder>(memInfo) - , Set(std::move(set)) - , HasNull(hasNull) + , Set_(std::move(set)) + , HasNull_(hasNull) { - MKQL_ENSURE(OptionalKey || !HasNull, "Null value is not allowed for non-optional key type"); + MKQL_ENSURE(OptionalKey || !HasNull_, "Null value is not allowed for non-optional key type"); } private: bool Contains(const NUdf::TUnboxedValuePod& key) const final { if constexpr (OptionalKey) { if (!key) { - return HasNull; + return HasNull_; } } - return Set.Has(key.Get<T>()); + return Set_.Has(key.Get<T>()); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const final { @@ -1306,19 +1306,19 @@ private: } ui64 GetDictLength() const final { - return Set.Size() + ui64(OptionalKey && HasNull); + return Set_.Size() + ui64(OptionalKey && HasNull_); } bool HasDictItems() const final { - return !Set.Empty() || (OptionalKey && HasNull); + return !Set_.Empty() || (OptionalKey && HasNull_); } bool IsSortedDict() const final { return false; } - const TSetType Set; - const bool HasNull; + const TSetType Set_; + const bool HasNull_; }; class THashedCompactSetHolder : public TComputationValue<THashedCompactSetHolder> { @@ -1329,30 +1329,30 @@ public: public: TIterator(const THashedCompactSetHolder* parent) : TComputationValue(parent->GetMemInfo()) - , Parent(const_cast<THashedCompactSetHolder*>(parent)) - , Iterator(Parent->Set.Iterate()) - , AtStart(true) + , Parent_(const_cast<THashedCompactSetHolder*>(parent)) + , Iterator_(Parent_->Set_.Iterate()) + , AtStart_(true) { } private: bool Skip() override { - if (AtStart) { - AtStart = false; + if (AtStart_) { + AtStart_ = false; } else { - if (!Iterator.Ok()) + if (!Iterator_.Ok()) return false; - ++Iterator; + ++Iterator_; } - return Iterator.Ok(); + return Iterator_.Ok(); } bool Next(NUdf::TUnboxedValue& key) override { if (!Skip()) return false; - key = Parent->KeyPacker.Unpack(GetSmallValue(*Iterator), Parent->Ctx->HolderFactory); + key = Parent_->KeyPacker_.Unpack(GetSmallValue(*Iterator_), Parent_->Ctx_->HolderFactory); return true; } @@ -1363,31 +1363,31 @@ public: return true; } - const NUdf::TRefCountedPtr<THashedCompactSetHolder> Parent; - typename TSetType::TIterator Iterator; - bool AtStart; + const NUdf::TRefCountedPtr<THashedCompactSetHolder> Parent_; + typename TSetType::TIterator Iterator_; + bool AtStart_; }; THashedCompactSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set, TPagedArena&& pool, TType* keyType, TComputationContext* ctx) : TComputationValue(memInfo) - , Pool(std::move(pool)) - , Set(std::move(set)) - , KeyPacker(true, keyType) - , Ctx(ctx) + , Pool_(std::move(pool)) + , Set_(std::move(set)) + , KeyPacker_(true, keyType) + , Ctx_(ctx) { } private: bool Contains(const NUdf::TUnboxedValuePod& key) const override { - auto serializedKey = KeyPacker.Pack(NUdf::TUnboxedValuePod(key)); + auto serializedKey = KeyPacker_.Pack(NUdf::TUnboxedValuePod(key)); ui64 smallValue = AsSmallValue(serializedKey); - return Set.Has(smallValue); + return Set_.Has(smallValue); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override { - auto serializedKey = KeyPacker.Pack(NUdf::TUnboxedValuePod(key)); + auto serializedKey = KeyPacker_.Pack(NUdf::TUnboxedValuePod(key)); ui64 smallValue = AsSmallValue(serializedKey); - if (Set.Has(smallValue)) + if (Set_.Has(smallValue)) return NUdf::TUnboxedValuePod::Void(); return NUdf::TUnboxedValuePod(); } @@ -1409,11 +1409,11 @@ private: } ui64 GetDictLength() const override { - return Set.Size(); + return Set_.Size(); } bool HasDictItems() const override { - return !Set.Empty(); + return !Set_.Empty(); } bool IsSortedDict() const override { @@ -1421,10 +1421,10 @@ private: } private: - TPagedArena Pool; - const TSetType Set; - mutable TValuePacker KeyPacker; - TComputationContext* Ctx; + TPagedArena Pool_; + const TSetType Set_; + mutable TValuePacker KeyPacker_; + TComputationContext* Ctx_; }; class THashedCompactMapHolder : public TComputationValue<THashedCompactMapHolder> { @@ -1436,32 +1436,32 @@ public: public: TIterator(const THashedCompactMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) - , Parent(const_cast<THashedCompactMapHolder*>(parent)) - , Iterator(Parent->Map.Iterate()) - , AtStart(true) + , Parent_(const_cast<THashedCompactMapHolder*>(parent)) + , Iterator_(Parent_->Map_.Iterate()) + , AtStart_(true) { } private: bool Skip() override { - if (AtStart) { - AtStart = false; + if (AtStart_) { + AtStart_ = false; } else { - if (!Iterator.Ok()) + if (!Iterator_.Ok()) return false; - ++Iterator; + ++Iterator_; } - return Iterator.Ok(); + return Iterator_.Ok(); } bool Next(NUdf::TUnboxedValue& key) override { if (!Skip()) return false; key = NoSwap ? - Parent->KeyPacker.Unpack(GetSmallValue(Iterator.Get().first), Parent->Ctx->HolderFactory): - Parent->PayloadPacker.Unpack(GetSmallValue(Iterator.Get().second), Parent->Ctx->HolderFactory); + Parent_->KeyPacker_.Unpack(GetSmallValue(Iterator_.Get().first), Parent_->Ctx_->HolderFactory): + Parent_->PayloadPacker_.Unpack(GetSmallValue(Iterator_.Get().second), Parent_->Ctx_->HolderFactory); return true; } @@ -1469,41 +1469,41 @@ public: if (!Next(key)) return false; payload = NoSwap ? - Parent->PayloadPacker.Unpack(GetSmallValue(Iterator.Get().second), Parent->Ctx->HolderFactory): - Parent->KeyPacker.Unpack(GetSmallValue(Iterator.Get().first), Parent->Ctx->HolderFactory); + Parent_->PayloadPacker_.Unpack(GetSmallValue(Iterator_.Get().second), Parent_->Ctx_->HolderFactory): + Parent_->KeyPacker_.Unpack(GetSmallValue(Iterator_.Get().first), Parent_->Ctx_->HolderFactory); return true; } - const NUdf::TRefCountedPtr<THashedCompactMapHolder> Parent; - typename TMapType::TIterator Iterator; - bool AtStart; + const NUdf::TRefCountedPtr<THashedCompactMapHolder> Parent_; + typename TMapType::TIterator Iterator_; + bool AtStart_; }; THashedCompactMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, TType* keyType, TType* payloadType, TComputationContext* ctx) : TComputationValue(memInfo) - , Pool(std::move(pool)) - , Map(std::move(map)) - , KeyPacker(true, keyType) - , PayloadPacker(false, payloadType) - , Ctx(ctx) + , Pool_(std::move(pool)) + , Map_(std::move(map)) + , KeyPacker_(true, keyType) + , PayloadPacker_(false, payloadType) + , Ctx_(ctx) { } private: bool Contains(const NUdf::TUnboxedValuePod& key) const override { - auto serializedKey = KeyPacker.Pack(NUdf::TUnboxedValuePod(key)); + auto serializedKey = KeyPacker_.Pack(NUdf::TUnboxedValuePod(key)); ui64 smallValue = AsSmallValue(serializedKey); - return Map.Has(smallValue); + return Map_.Has(smallValue); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override { - auto serializedKey = KeyPacker.Pack(NUdf::TUnboxedValuePod(key)); + auto serializedKey = KeyPacker_.Pack(NUdf::TUnboxedValuePod(key)); ui64 smallValue = AsSmallValue(serializedKey); - auto it = Map.Find(smallValue); + auto it = Map_.Find(smallValue); if (!it.Ok()) return NUdf::TUnboxedValuePod(); - return PayloadPacker.Unpack(GetSmallValue(it.Get().second), Ctx->HolderFactory).Release().MakeOptional(); + return PayloadPacker_.Unpack(GetSmallValue(it.Get().second), Ctx_->HolderFactory).Release().MakeOptional(); } NUdf::TUnboxedValue GetKeysIterator() const override { @@ -1519,22 +1519,22 @@ private: } ui64 GetDictLength() const override { - return Map.Size(); + return Map_.Size(); } bool HasDictItems() const override { - return !Map.Empty(); + return !Map_.Empty(); } bool IsSortedDict() const override { return false; } - TPagedArena Pool; - const TMapType Map; - mutable TValuePacker KeyPacker; - mutable TValuePacker PayloadPacker; - TComputationContext* Ctx; + TPagedArena Pool_; + const TMapType Map_; + mutable TValuePacker KeyPacker_; + mutable TValuePacker PayloadPacker_; + TComputationContext* Ctx_; }; class THashedCompactMultiMapHolder : public TComputationValue<THashedCompactMultiMapHolder> { @@ -1548,41 +1548,41 @@ public: public: TIterator(const THashedCompactMultiMapHolder* parent, TMapIterator from) : TComputationValue(parent->GetMemInfo()) - , Parent(const_cast<THashedCompactMultiMapHolder*>(parent)) - , Iterator(from) + , Parent_(const_cast<THashedCompactMultiMapHolder*>(parent)) + , Iterator_(from) { } private: bool Next(NUdf::TUnboxedValue& value) override { - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } - value = Parent->PayloadPacker.Unpack(GetSmallValue(Iterator.GetValue()), Parent->CompCtx.HolderFactory); - ++Iterator; + value = Parent_->PayloadPacker_.Unpack(GetSmallValue(Iterator_.GetValue()), Parent_->CompCtx_.HolderFactory); + ++Iterator_; return true; } bool Skip() override { - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } - ++Iterator; + ++Iterator_; return true; } - const NUdf::TRefCountedPtr<THashedCompactMultiMapHolder> Parent; - TMapIterator Iterator; + const NUdf::TRefCountedPtr<THashedCompactMultiMapHolder> Parent_; + TMapIterator Iterator_; }; TPayloadList(TMemoryUsageInfo* memInfo, const THashedCompactMultiMapHolder* parent, TMapIterator from) : TCustomListValue(memInfo) - , Parent(const_cast<THashedCompactMultiMapHolder*>(parent)) - , From(from) + , Parent_(const_cast<THashedCompactMultiMapHolder*>(parent)) + , From_(from) { - Y_ASSERT(From.Ok()); + Y_ASSERT(From_.Ok()); } private: @@ -1591,11 +1591,11 @@ public: } ui64 GetListLength() const override { - if (!Length) { - Length = Parent->Map.Count(From.GetKey()); + if (!Length_) { + Length_ = Parent_->Map_.Count(From_.GetKey()); } - return *Length; + return *Length_; } bool HasListItems() const override { @@ -1603,11 +1603,11 @@ public: } NUdf::TUnboxedValue GetListIterator() const override { - return NUdf::TUnboxedValuePod(new TIterator(Parent.Get(), From)); + return NUdf::TUnboxedValuePod(new TIterator(Parent_.Get(), From_)); } - const NUdf::TRefCountedPtr<THashedCompactMultiMapHolder> Parent; - TMapIterator From; + const NUdf::TRefCountedPtr<THashedCompactMultiMapHolder> Parent_; + TMapIterator From_; }; template <bool NoSwap> @@ -1615,79 +1615,79 @@ public: public: TIterator(const THashedCompactMultiMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) - , Parent(const_cast<THashedCompactMultiMapHolder*>(parent)) - , Iterator(parent->Map.Iterate()) + , Parent_(const_cast<THashedCompactMultiMapHolder*>(parent)) + , Iterator_(parent->Map_.Iterate()) { } private: bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) override { - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } if (NoSwap) { - key = Parent->KeyPacker.Unpack(GetSmallValue(Iterator.GetKey()), Parent->CompCtx.HolderFactory); - payload = Parent->CompCtx.HolderFactory.Create<TPayloadList>(Parent.Get(), Iterator.MakeCurrentKeyIter()); + key = Parent_->KeyPacker_.Unpack(GetSmallValue(Iterator_.GetKey()), Parent_->CompCtx_.HolderFactory); + payload = Parent_->CompCtx_.HolderFactory.Create<TPayloadList>(Parent_.Get(), Iterator_.MakeCurrentKeyIter()); } else { - payload = Parent->KeyPacker.Unpack(GetSmallValue(Iterator.GetKey()), Parent->CompCtx.HolderFactory); - key = Parent->CompCtx.HolderFactory.Create<TPayloadList>(Parent.Get(), Iterator.MakeCurrentKeyIter()); + payload = Parent_->KeyPacker_.Unpack(GetSmallValue(Iterator_.GetKey()), Parent_->CompCtx_.HolderFactory); + key = Parent_->CompCtx_.HolderFactory.Create<TPayloadList>(Parent_.Get(), Iterator_.MakeCurrentKeyIter()); } - Iterator.NextKey(); + Iterator_.NextKey(); return true; } bool Next(NUdf::TUnboxedValue& key) override { - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } key = NoSwap ? - Parent->KeyPacker.Unpack(GetSmallValue(Iterator.GetKey()), Parent->CompCtx.HolderFactory): - NUdf::TUnboxedValue(Parent->CompCtx.HolderFactory.Create<TPayloadList>(Parent.Get(), Iterator.MakeCurrentKeyIter())); - Iterator.NextKey(); + Parent_->KeyPacker_.Unpack(GetSmallValue(Iterator_.GetKey()), Parent_->CompCtx_.HolderFactory): + NUdf::TUnboxedValue(Parent_->CompCtx_.HolderFactory.Create<TPayloadList>(Parent_.Get(), Iterator_.MakeCurrentKeyIter())); + Iterator_.NextKey(); return true; } bool Skip() override { - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } - Iterator.NextKey(); + Iterator_.NextKey(); return true; } - const NUdf::TRefCountedPtr<THashedCompactMultiMapHolder> Parent; - TMapIterator Iterator; + const NUdf::TRefCountedPtr<THashedCompactMultiMapHolder> Parent_; + TMapIterator Iterator_; }; THashedCompactMultiMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, TType* keyType, TType* payloadType, TComputationContext* ctx) : TComputationValue(memInfo) - , Pool(std::move(pool)) - , Map(std::move(map)) - , KeyPacker(true, keyType) - , PayloadPacker(false, payloadType) - , CompCtx(*ctx) + , Pool_(std::move(pool)) + , Map_(std::move(map)) + , KeyPacker_(true, keyType) + , PayloadPacker_(false, payloadType) + , CompCtx_(*ctx) { } private: bool Contains(const NUdf::TUnboxedValuePod& key) const override { - auto serializedKey = KeyPacker.Pack(NUdf::TUnboxedValuePod(key)); + auto serializedKey = KeyPacker_.Pack(NUdf::TUnboxedValuePod(key)); ui64 smallValue = AsSmallValue(serializedKey); - return Map.Has(smallValue); + return Map_.Has(smallValue); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override { - auto serializedKey = KeyPacker.Pack(NUdf::TUnboxedValuePod(key)); + auto serializedKey = KeyPacker_.Pack(NUdf::TUnboxedValuePod(key)); ui64 smallValue = AsSmallValue(serializedKey); - auto it = Map.Find(smallValue); + auto it = Map_.Find(smallValue); if (!it.Ok()) return NUdf::TUnboxedValuePod(); - return CompCtx.HolderFactory.Create<TPayloadList>(this, it); + return CompCtx_.HolderFactory.Create<TPayloadList>(this, it); } NUdf::TUnboxedValue GetKeysIterator() const override { @@ -1703,22 +1703,22 @@ private: } ui64 GetDictLength() const override { - return Map.UniqSize(); + return Map_.UniqSize(); } bool HasDictItems() const override { - return !Map.Empty(); + return !Map_.Empty(); } bool IsSortedDict() const override { return false; } - TPagedArena Pool; - const TMapType Map; - mutable TValuePacker KeyPacker; - mutable TValuePacker PayloadPacker; - TComputationContext& CompCtx; + TPagedArena Pool_; + const TMapType Map_; + mutable TValuePacker KeyPacker_; + mutable TValuePacker PayloadPacker_; + TComputationContext& CompCtx_; }; class THashedDictHolder: public TComputationValue<THashedDictHolder> { @@ -1728,36 +1728,36 @@ public: public: TIterator(const THashedDictHolder* parent) : TTemporaryComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) - , Parent(const_cast<THashedDictHolder*>(parent)) - , Iterator(Parent->Map.begin()) - , End(Parent->Map.end()) - , AtStart(true) + , Parent_(const_cast<THashedDictHolder*>(parent)) + , Iterator_(Parent_->Map_.begin()) + , End_(Parent_->Map_.end()) + , AtStart_(true) { } private: bool Skip() override { - if (AtStart) { - AtStart = false; + if (AtStart_) { + AtStart_ = false; } else { - if (Iterator == End) + if (Iterator_ == End_) return false; - ++Iterator; + ++Iterator_; } - return Iterator != End; + return Iterator_ != End_; } bool Next(NUdf::TUnboxedValue& key) override { if (!Skip()) return false; if (NoSwap) { - key = Iterator->first; - if (Parent->Packer) { - key = Parent->Packer->Unpack(key.AsStringRef(), Parent->HolderFactory); + key = Iterator_->first; + if (Parent_->Packer_) { + key = Parent_->Packer_->Unpack(key.AsStringRef(), Parent_->HolderFactory_); } } else { - key = Iterator->second; + key = Iterator_->second; } return true; @@ -1767,34 +1767,34 @@ public: if (!Next(key)) return false; if (NoSwap) { - payload = Iterator->second; + payload = Iterator_->second; } else { - payload = Iterator->first; - if (Parent->Packer) { - payload = Parent->Packer->Unpack(payload.AsStringRef(), Parent->HolderFactory); + payload = Iterator_->first; + if (Parent_->Packer_) { + payload = Parent_->Packer_->Unpack(payload.AsStringRef(), Parent_->HolderFactory_); } } return true; } - const NUdf::TRefCountedPtr<THashedDictHolder> Parent; - TValuesDictHashMap::const_iterator Iterator; - TValuesDictHashMap::const_iterator End; - bool AtStart; + const NUdf::TRefCountedPtr<THashedDictHolder> Parent_; + TValuesDictHashMap::const_iterator Iterator_; + TValuesDictHashMap::const_iterator End_; + bool AtStart_; }; THashedDictHolder(TMemoryUsageInfo* memInfo, THashedDictFiller filler, const TKeyTypes& types, bool isTuple, bool eagerFill, TType* encodedType, const NUdf::IHash* hash, const NUdf::IEquate* equate, const THolderFactory& holderFactory) : TComputationValue(memInfo) - , Filler(filler) - , Types(types) - , Map(0, TValueHasher(Types, isTuple, hash), TValueEqual(Types, isTuple, equate)) - , IsBuilt(false) - , HolderFactory(holderFactory) + , Filler_(filler) + , Types_(types) + , Map_(0, TValueHasher(Types_, isTuple, hash), TValueEqual(Types_, isTuple, equate)) + , IsBuilt_(false) + , HolderFactory_(holderFactory) { if (encodedType) { - Packer.emplace(true, encodedType); + Packer_.emplace(true, encodedType); } if (eagerFill) @@ -1805,22 +1805,22 @@ private: bool Contains(const NUdf::TUnboxedValuePod& key) const override { LazyBuildDict(); NUdf::TUnboxedValue encodedKey; - if (Packer) { - encodedKey = MakeString(Packer->Pack(key)); + if (Packer_) { + encodedKey = MakeString(Packer_->Pack(key)); } - return Map.find(NUdf::TUnboxedValuePod(Packer ? encodedKey : key)) != Map.cend(); + return Map_.find(NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key)) != Map_.cend(); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override { LazyBuildDict(); NUdf::TUnboxedValue encodedKey; - if (Packer) { - encodedKey = MakeString(Packer->Pack(key)); + if (Packer_) { + encodedKey = MakeString(Packer_->Pack(key)); } - const auto it = Map.find(NUdf::TUnboxedValuePod(Packer ? encodedKey : key)); - if (it == Map.cend()) + const auto it = Map_.find(NUdf::TUnboxedValuePod(Packer_ ? encodedKey : key)); + if (it == Map_.cend()) return NUdf::TUnboxedValuePod(); return it->second.MakeOptional(); } @@ -1842,12 +1842,12 @@ private: ui64 GetDictLength() const override { LazyBuildDict(); - return Map.size(); + return Map_.size(); } bool HasDictItems() const override { LazyBuildDict(); - return !Map.empty(); + return !Map_.empty(); } bool IsSortedDict() const override { @@ -1856,21 +1856,21 @@ private: private: void LazyBuildDict() const { - if (IsBuilt) + if (IsBuilt_) return; - Filler(Map); - Filler = THashedDictFiller(); - IsBuilt = true; + Filler_(Map_); + Filler_ = THashedDictFiller(); + IsBuilt_ = true; } private: - mutable THashedDictFiller Filler; - const TKeyTypes Types; - mutable TValuesDictHashMap Map; - mutable bool IsBuilt; - const THolderFactory& HolderFactory; - std::optional<TValuePacker> Packer; + mutable THashedDictFiller Filler_; + const TKeyTypes Types_; + mutable TValuesDictHashMap Map_; + mutable bool IsBuilt_; + const THolderFactory& HolderFactory_; + std::optional<TValuePacker> Packer_; }; template <typename T, bool OptionalKey> @@ -1888,39 +1888,39 @@ public: }; TIterator(const THashedSingleFixedMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) - , Parent(const_cast<THashedSingleFixedMapHolder*>(parent)) - , Iterator(Parent->Map.begin()) - , End(Parent->Map.end()) - , State(EState::AtStart) + , Parent_(const_cast<THashedSingleFixedMapHolder*>(parent)) + , Iterator_(Parent_->Map_.begin()) + , End_(Parent_->Map_.end()) + , State_(EState::AtStart) { } private: bool Skip() final { - switch (State) { + switch (State_) { case EState::AtStart: - State = OptionalKey && Parent->NullPayload.has_value() ? EState::AtNull : EState::Iterator; + State_ = OptionalKey && Parent_->NullPayload_.has_value() ? EState::AtNull : EState::Iterator; break; case EState::AtNull: - State = EState::Iterator; + State_ = EState::Iterator; break; case EState::Iterator: - if (Iterator == End) { + if (Iterator_ == End_) { return false; } - ++Iterator; + ++Iterator_; break; } - return EState::AtNull == State || Iterator != End; + return EState::AtNull == State_ || Iterator_ != End_; } bool Next(NUdf::TUnboxedValue& key) final { if (!Skip()) return false; key = NoSwap - ? (EState::AtNull == State ? NUdf::TUnboxedValue() : NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(Iterator->first))) - : (EState::AtNull == State ? *Parent->NullPayload : Iterator->second); + ? (EState::AtNull == State_ ? NUdf::TUnboxedValue() : NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(Iterator_->first))) + : (EState::AtNull == State_ ? *Parent_->NullPayload_ : Iterator_->second); return true; } @@ -1928,21 +1928,21 @@ public: if (!Next(key)) return false; payload = NoSwap - ? (EState::AtNull == State ? *Parent->NullPayload : Iterator->second) - : (EState::AtNull == State ? NUdf::TUnboxedValue() : NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(Iterator->first))); + ? (EState::AtNull == State_ ? *Parent_->NullPayload_ : Iterator_->second) + : (EState::AtNull == State_ ? NUdf::TUnboxedValue() : NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(Iterator_->first))); return true; } - const NUdf::TRefCountedPtr<THashedSingleFixedMapHolder> Parent; - typename TMapType::const_iterator Iterator; - typename TMapType::const_iterator End; - EState State; + const NUdf::TRefCountedPtr<THashedSingleFixedMapHolder> Parent_; + typename TMapType::const_iterator Iterator_; + typename TMapType::const_iterator End_; + EState State_; }; THashedSingleFixedMapHolder(TMemoryUsageInfo* memInfo, TValuesDictHashSingleFixedMap<T>&& map, std::optional<NUdf::TUnboxedValue>&& nullPayload) : TComputationValue<THashedSingleFixedMapHolder>(memInfo) - , Map(std::move(map)) - , NullPayload(std::move(nullPayload)) + , Map_(std::move(map)) + , NullPayload_(std::move(nullPayload)) { } @@ -1950,20 +1950,20 @@ private: bool Contains(const NUdf::TUnboxedValuePod& key) const final { if constexpr (OptionalKey) { if (!key) { - return NullPayload.has_value(); + return NullPayload_.has_value(); } } - return Map.find(key.Get<T>()) != Map.end(); + return Map_.find(key.Get<T>()) != Map_.end(); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const final { if constexpr (OptionalKey) { if (!key) { - return NullPayload.has_value() ? NullPayload->MakeOptional() : NUdf::TUnboxedValuePod(); + return NullPayload_.has_value() ? NullPayload_->MakeOptional() : NUdf::TUnboxedValuePod(); } } - const auto it = Map.find(key.Get<T>()); - if (it == Map.end()) + const auto it = Map_.find(key.Get<T>()); + if (it == Map_.end()) return NUdf::TUnboxedValuePod(); return it->second.MakeOptional(); } @@ -1981,19 +1981,19 @@ private: } ui64 GetDictLength() const final { - return Map.size() + ui64(OptionalKey && NullPayload.has_value()); + return Map_.size() + ui64(OptionalKey && NullPayload_.has_value()); } bool HasDictItems() const final { - return !Map.empty() || (OptionalKey && NullPayload.has_value()); + return !Map_.empty() || (OptionalKey && NullPayload_.has_value()); } bool IsSortedDict() const final { return false; } - const TMapType Map; - const std::optional<NUdf::TUnboxedValue> NullPayload; + const TMapType Map_; + const std::optional<NUdf::TUnboxedValue> NullPayload_; }; template <typename T, bool OptionalKey> @@ -2011,28 +2011,28 @@ public: }; TIterator(const THashedSingleFixedCompactMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) - , Parent(const_cast<THashedSingleFixedCompactMapHolder*>(parent)) - , Iterator(Parent->Map.Iterate()) - , State(EState::AtStart) + , Parent_(const_cast<THashedSingleFixedCompactMapHolder*>(parent)) + , Iterator_(Parent_->Map_.Iterate()) + , State_(EState::AtStart) { } private: bool Skip() final { - switch (State) { + switch (State_) { case EState::AtStart: - State = OptionalKey && Parent->NullPayload.has_value() ? EState::AtNull : EState::Iterator; + State_ = OptionalKey && Parent_->NullPayload_.has_value() ? EState::AtNull : EState::Iterator; break; case EState::AtNull: - State = EState::Iterator; + State_ = EState::Iterator; break; case EState::Iterator: - if (Iterator.Ok()) - ++Iterator; + if (Iterator_.Ok()) + ++Iterator_; break; } - return EState::AtNull == State || Iterator.Ok(); + return EState::AtNull == State_ || Iterator_.Ok(); } bool Next(NUdf::TUnboxedValue& key) final { @@ -2040,13 +2040,13 @@ public: return false; key = NoSwap - ? (EState::AtNull == State + ? (EState::AtNull == State_ ? NUdf::TUnboxedValue() - : NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(Iterator.Get().first)) + : NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(Iterator_.Get().first)) ) - : (EState::AtNull == State - ? Parent->PayloadPacker.Unpack(GetSmallValue(*Parent->NullPayload), Parent->Ctx->HolderFactory) - : Parent->PayloadPacker.Unpack(GetSmallValue(Iterator.Get().second), Parent->Ctx->HolderFactory) + : (EState::AtNull == State_ + ? Parent_->PayloadPacker_.Unpack(GetSmallValue(*Parent_->NullPayload_), Parent_->Ctx_->HolderFactory) + : Parent_->PayloadPacker_.Unpack(GetSmallValue(Iterator_.Get().second), Parent_->Ctx_->HolderFactory) ); return true; } @@ -2055,30 +2055,30 @@ public: if (!Next(key)) return false; payload = NoSwap - ? (EState::AtNull == State - ? Parent->PayloadPacker.Unpack(GetSmallValue(*Parent->NullPayload), Parent->Ctx->HolderFactory) - : Parent->PayloadPacker.Unpack(GetSmallValue(Iterator.Get().second), Parent->Ctx->HolderFactory) + ? (EState::AtNull == State_ + ? Parent_->PayloadPacker_.Unpack(GetSmallValue(*Parent_->NullPayload_), Parent_->Ctx_->HolderFactory) + : Parent_->PayloadPacker_.Unpack(GetSmallValue(Iterator_.Get().second), Parent_->Ctx_->HolderFactory) ) - : (EState::AtNull == State + : (EState::AtNull == State_ ? NUdf::TUnboxedValue() - : NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(Iterator.Get().first)) + : NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(Iterator_.Get().first)) ); return true; } - const NUdf::TRefCountedPtr<THashedSingleFixedCompactMapHolder> Parent; - typename TMapType::TIterator Iterator; - EState State; + const NUdf::TRefCountedPtr<THashedSingleFixedCompactMapHolder> Parent_; + typename TMapType::TIterator Iterator_; + EState State_; }; THashedSingleFixedCompactMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, std::optional<ui64>&& nullPayload, TPagedArena&& pool, TType* payloadType, TComputationContext* ctx) : TComputationValue<THashedSingleFixedCompactMapHolder>(memInfo) - , Pool(std::move(pool)) - , Map(std::move(map)) - , NullPayload(std::move(nullPayload)) - , PayloadPacker(false, payloadType) - , Ctx(ctx) + , Pool_(std::move(pool)) + , Map_(std::move(map)) + , NullPayload_(std::move(nullPayload)) + , PayloadPacker_(false, payloadType) + , Ctx_(ctx) { } @@ -2086,24 +2086,24 @@ private: bool Contains(const NUdf::TUnboxedValuePod& key) const final { if constexpr (OptionalKey) { if (!key) { - return NullPayload.has_value(); + return NullPayload_.has_value(); } } - return Map.Has(key.Get<T>()); + return Map_.Has(key.Get<T>()); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const final { if constexpr (OptionalKey) { if (!key) { - return NullPayload.has_value() - ? PayloadPacker.Unpack(GetSmallValue(*NullPayload), Ctx->HolderFactory).Release().MakeOptional() + return NullPayload_.has_value() + ? PayloadPacker_.Unpack(GetSmallValue(*NullPayload_), Ctx_->HolderFactory).Release().MakeOptional() : NUdf::TUnboxedValuePod(); } } - auto it = Map.Find(key.Get<T>()); + auto it = Map_.Find(key.Get<T>()); if (!it.Ok()) return NUdf::TUnboxedValuePod(); - return PayloadPacker.Unpack(GetSmallValue(it.Get().second), Ctx->HolderFactory).Release().MakeOptional(); + return PayloadPacker_.Unpack(GetSmallValue(it.Get().second), Ctx_->HolderFactory).Release().MakeOptional(); } NUdf::TUnboxedValue GetKeysIterator() const final { @@ -2119,11 +2119,11 @@ private: } ui64 GetDictLength() const final { - return Map.Size() + ui64(OptionalKey && NullPayload.has_value()); + return Map_.Size() + ui64(OptionalKey && NullPayload_.has_value()); } bool HasDictItems() const final { - return !Map.Empty() || (OptionalKey && NullPayload.has_value()); + return !Map_.Empty() || (OptionalKey && NullPayload_.has_value()); } bool IsSortedDict() const final { @@ -2131,11 +2131,11 @@ private: } private: - TPagedArena Pool; - const TMapType Map; - const std::optional<ui64> NullPayload; - mutable TValuePacker PayloadPacker; - TComputationContext* Ctx; + TPagedArena Pool_; + const TMapType Map_; + const std::optional<ui64> NullPayload_; + mutable TValuePacker PayloadPacker_; + TComputationContext* Ctx_; }; template <typename T, bool OptionalKey> @@ -2150,33 +2150,33 @@ public: public: TIterator(const THashedSingleFixedCompactMultiMapHolder* parent, TMapIterator from) : TComputationValue<TIterator>(parent->GetMemInfo()) - , Parent(const_cast<THashedSingleFixedCompactMultiMapHolder*>(parent)) - , Iterator(from) + , Parent_(const_cast<THashedSingleFixedCompactMultiMapHolder*>(parent)) + , Iterator_(from) { } private: bool Next(NUdf::TUnboxedValue& value) final { - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } - value = Parent->PayloadPacker.Unpack(GetSmallValue(Iterator.GetValue()), Parent->Ctx->HolderFactory); - ++Iterator; + value = Parent_->PayloadPacker_.Unpack(GetSmallValue(Iterator_.GetValue()), Parent_->Ctx_->HolderFactory); + ++Iterator_; return true; } bool Skip() final { - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } - ++Iterator; + ++Iterator_; return true; } - const NUdf::TRefCountedPtr<THashedSingleFixedCompactMultiMapHolder> Parent; - TMapIterator Iterator; + const NUdf::TRefCountedPtr<THashedSingleFixedCompactMultiMapHolder> Parent_; + TMapIterator Iterator_; }; TPayloadList(TMemoryUsageInfo* memInfo, const THashedSingleFixedCompactMultiMapHolder* parent, TMapIterator from) @@ -2192,11 +2192,11 @@ public: } ui64 GetListLength() const final { - if (!Length) { - Length = Parent->Map.Count(From.GetKey()); + if (!Length_) { + Length_ = Parent->Map_.Count(From.GetKey()); } - return *Length; + return *Length_; } bool HasListItems() const final { @@ -2217,33 +2217,33 @@ public: public: TIterator(const THashedSingleFixedCompactMultiMapHolder* parent) : TComputationValue<TIterator>(parent->GetMemInfo()) - , Parent(const_cast<THashedSingleFixedCompactMultiMapHolder*>(parent)) - , Iterator(Parent->NullPayloads.cbegin()) + , Parent_(const_cast<THashedSingleFixedCompactMultiMapHolder*>(parent)) + , Iterator_(Parent_->NullPayloads_.cbegin()) { } private: bool Next(NUdf::TUnboxedValue& value) final { - if (Iterator == Parent->NullPayloads.cend()) { + if (Iterator_ == Parent_->NullPayloads_.cend()) { return false; } - value = Parent->PayloadPacker.Unpack(GetSmallValue(*Iterator), Parent->Ctx->HolderFactory); - ++Iterator; + value = Parent_->PayloadPacker_.Unpack(GetSmallValue(*Iterator_), Parent_->Ctx_->HolderFactory); + ++Iterator_; return true; } bool Skip() final { - if (Iterator == Parent->NullPayloads.cend()) { + if (Iterator_ == Parent_->NullPayloads_.cend()) { return false; } - ++Iterator; + ++Iterator_; return true; } - const NUdf::TRefCountedPtr<THashedSingleFixedCompactMultiMapHolder> Parent; - typename std::vector<ui64>::const_iterator Iterator; + const NUdf::TRefCountedPtr<THashedSingleFixedCompactMultiMapHolder> Parent_; + typename std::vector<ui64>::const_iterator Iterator_; }; TNullPayloadList(TMemoryUsageInfo* memInfo, const THashedSingleFixedCompactMultiMapHolder* parent) @@ -2257,11 +2257,11 @@ public: } ui64 GetListLength() const final { - if (!Length) { - Length = Parent->NullPayloads.size(); + if (!Length_) { + Length_ = Parent->NullPayloads_.size(); } - return *Length; + return *Length_; } bool HasListItems() const final { @@ -2280,85 +2280,85 @@ public: public: TIterator(const THashedSingleFixedCompactMultiMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) - , Parent(const_cast<THashedSingleFixedCompactMultiMapHolder*>(parent)) - , Iterator(parent->Map.Iterate()) - , AtNull(OptionalKey && !parent->NullPayloads.empty()) + , Parent_(const_cast<THashedSingleFixedCompactMultiMapHolder*>(parent)) + , Iterator_(parent->Map_.Iterate()) + , AtNull_(OptionalKey && !parent->NullPayloads_.empty()) { } private: bool Next(NUdf::TUnboxedValue& key) override { - if (AtNull) { - AtNull = false; + if (AtNull_) { + AtNull_ = false; key = NoSwap ? NUdf::TUnboxedValuePod() - : Parent->Ctx->HolderFactory.template Create<TNullPayloadList>(Parent.Get()); + : Parent_->Ctx_->HolderFactory.template Create<TNullPayloadList>(Parent_.Get()); return true; } - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } key = NoSwap ? - NUdf::TUnboxedValuePod(Iterator.GetKey()): - Parent->Ctx->HolderFactory.template Create<TPayloadList>(Parent.Get(), Iterator.MakeCurrentKeyIter()); - Iterator.NextKey(); + NUdf::TUnboxedValuePod(Iterator_.GetKey()): + Parent_->Ctx_->HolderFactory.template Create<TPayloadList>(Parent_.Get(), Iterator_.MakeCurrentKeyIter()); + Iterator_.NextKey(); return true; } bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) override { - if (AtNull) { - AtNull = false; + if (AtNull_) { + AtNull_ = false; if (NoSwap) { key = NUdf::TUnboxedValuePod(); - payload = Parent->Ctx->HolderFactory.template Create<TNullPayloadList>(Parent.Get()); + payload = Parent_->Ctx_->HolderFactory.template Create<TNullPayloadList>(Parent_.Get()); } else { payload = NUdf::TUnboxedValuePod(); - key = Parent->Ctx->HolderFactory.template Create<TNullPayloadList>(Parent.Get()); + key = Parent_->Ctx_->HolderFactory.template Create<TNullPayloadList>(Parent_.Get()); } return true; } - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } if (NoSwap) { - key = NUdf::TUnboxedValuePod(Iterator.GetKey()); - payload = Parent->Ctx->HolderFactory.template Create<TPayloadList>(Parent.Get(), Iterator.MakeCurrentKeyIter()); + key = NUdf::TUnboxedValuePod(Iterator_.GetKey()); + payload = Parent_->Ctx_->HolderFactory.template Create<TPayloadList>(Parent_.Get(), Iterator_.MakeCurrentKeyIter()); } else { - payload = NUdf::TUnboxedValuePod(Iterator.GetKey()); - key = Parent->Ctx->HolderFactory.template Create<TPayloadList>(Parent.Get(), Iterator.MakeCurrentKeyIter()); + payload = NUdf::TUnboxedValuePod(Iterator_.GetKey()); + key = Parent_->Ctx_->HolderFactory.template Create<TPayloadList>(Parent_.Get(), Iterator_.MakeCurrentKeyIter()); } - Iterator.NextKey(); + Iterator_.NextKey(); return true; } bool Skip() override { - if (AtNull) { - AtNull = false; + if (AtNull_) { + AtNull_ = false; return true; } - if (!Iterator.Ok()) { + if (!Iterator_.Ok()) { return false; } - Iterator.NextKey(); + Iterator_.NextKey(); return true; } - const NUdf::TRefCountedPtr<THashedSingleFixedCompactMultiMapHolder> Parent; - TMapIterator Iterator; - bool AtNull; + const NUdf::TRefCountedPtr<THashedSingleFixedCompactMultiMapHolder> Parent_; + TMapIterator Iterator_; + bool AtNull_; }; THashedSingleFixedCompactMultiMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, std::vector<ui64>&& nullPayloads, TPagedArena&& pool, TType* payloadType, TComputationContext* ctx) : TComputationValue<THashedSingleFixedCompactMultiMapHolder>(memInfo) - , Pool(std::move(pool)) - , Map(std::move(map)) - , NullPayloads(std::move(nullPayloads)) - , PayloadPacker(false, payloadType) - , Ctx(ctx) + , Pool_(std::move(pool)) + , Map_(std::move(map)) + , NullPayloads_(std::move(nullPayloads)) + , PayloadPacker_(false, payloadType) + , Ctx_(ctx) { } @@ -2366,24 +2366,24 @@ private: bool Contains(const NUdf::TUnboxedValuePod& key) const override { if constexpr (OptionalKey) { if (!key) { - return !NullPayloads.empty(); + return !NullPayloads_.empty(); } } - return Map.Has(key.Get<T>()); + return Map_.Has(key.Get<T>()); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override { if constexpr (OptionalKey) { if (!key) { - return NullPayloads.empty() + return NullPayloads_.empty() ? NUdf::TUnboxedValuePod() - : Ctx->HolderFactory.Create<TNullPayloadList>(this); + : Ctx_->HolderFactory.Create<TNullPayloadList>(this); } } - const auto it = Map.Find(key.Get<T>()); + const auto it = Map_.Find(key.Get<T>()); if (!it.Ok()) return NUdf::TUnboxedValuePod(); - return Ctx->HolderFactory.Create<TPayloadList>(this, it); + return Ctx_->HolderFactory.Create<TPayloadList>(this, it); } NUdf::TUnboxedValue GetKeysIterator() const override { @@ -2399,11 +2399,11 @@ private: } ui64 GetDictLength() const override { - return Map.UniqSize() + ui64(OptionalKey && !NullPayloads.empty()); + return Map_.UniqSize() + ui64(OptionalKey && !NullPayloads_.empty()); } bool HasDictItems() const override { - return !Map.Empty() || (OptionalKey && !NullPayloads.empty()); + return !Map_.Empty() || (OptionalKey && !NullPayloads_.empty()); } bool IsSortedDict() const override { @@ -2411,50 +2411,50 @@ private: } private: - TPagedArena Pool; - const TMapType Map; - const std::vector<ui64> NullPayloads; - mutable TValuePacker PayloadPacker; - TComputationContext* Ctx; + TPagedArena Pool_; + const TMapType Map_; + const std::vector<ui64> NullPayloads_; + mutable TValuePacker PayloadPacker_; + TComputationContext* Ctx_; }; class TVariantHolder : public TComputationValue<TVariantHolder> { public: TVariantHolder(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& item, ui32 index) : TComputationValue(memInfo) - , Item(std::move(item)) - , Index(index) + , Item_(std::move(item)) + , Index_(index) { } private: NUdf::TUnboxedValue GetVariantItem() const override { - return Item; + return Item_; } ui32 GetVariantIndex() const override { - return Index; + return Index_; } - const NUdf::TUnboxedValue Item; - const ui32 Index; + const NUdf::TUnboxedValue Item_; + const ui32 Index_; }; class TListIteratorHolder : public TComputationValue<TListIteratorHolder> { public: TListIteratorHolder(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& list) : TComputationValue(memInfo) - , List(std::move(list)) - , Iter(List.GetListIterator()) + , List_(std::move(list)) + , Iter_(List_.GetListIterator()) {} private: NUdf::EFetchStatus Fetch(NUdf::TUnboxedValue& result) override { - return Iter.Next(result) ? NUdf::EFetchStatus::Ok : NUdf::EFetchStatus::Finish; + return Iter_.Next(result) ? NUdf::EFetchStatus::Ok : NUdf::EFetchStatus::Finish; } - const NUdf::TUnboxedValue List; - const NUdf::TUnboxedValue Iter; + const NUdf::TUnboxedValue List_; + const NUdf::TUnboxedValue Iter_; }; class TLimitedList: public TComputationValue<TLimitedList> { @@ -2463,112 +2463,112 @@ public: public: TIterator(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& iter, TMaybe<ui64> skip, TMaybe<ui64> take) : TComputationValue(memInfo) - , Iter(std::move(iter)) + , Iter_(std::move(iter)) , Skip_(skip) , Take_(take) - , Index(Max<ui64>()) + , Index_(Max<ui64>()) { } private: bool Next(NUdf::TUnboxedValue& value) override { - if (!Iter) { + if (!Iter_) { return false; } if (Skip_) { - while ((Index + 1) < Skip_.GetRef()) { - if (!Iter.Skip()) { - Iter = NUdf::TUnboxedValue(); + while ((Index_ + 1) < Skip_.GetRef()) { + if (!Iter_.Skip()) { + Iter_ = NUdf::TUnboxedValue(); return false; } - ++Index; + ++Index_; } } - if (Take_ && ((Index + 1) - Skip_.GetOrElse(0)) >= Take_.GetRef()) { - Iter = NUdf::TUnboxedValue(); + if (Take_ && ((Index_ + 1) - Skip_.GetOrElse(0)) >= Take_.GetRef()) { + Iter_ = NUdf::TUnboxedValue(); return false; } - if (!Iter.Next(value)) { - Iter = NUdf::TUnboxedValue(); + if (!Iter_.Next(value)) { + Iter_ = NUdf::TUnboxedValue(); return false; } - ++Index; + ++Index_; return true; } bool Skip() override { - if (!Iter) { + if (!Iter_) { return false; } if (Skip_) { - while ((Index + 1) < Skip_.GetRef()) { - if (!Iter.Skip()) { - Iter = NUdf::TUnboxedValue(); + while ((Index_ + 1) < Skip_.GetRef()) { + if (!Iter_.Skip()) { + Iter_ = NUdf::TUnboxedValue(); return false; } - ++Index; + ++Index_; } } - if (Take_ && ((Index + 1) - Skip_.GetOrElse(0)) >= Take_.GetRef()) { - Iter = NUdf::TUnboxedValue(); + if (Take_ && ((Index_ + 1) - Skip_.GetOrElse(0)) >= Take_.GetRef()) { + Iter_ = NUdf::TUnboxedValue(); return false; } - if (!Iter.Skip()) { - Iter = NUdf::TUnboxedValue(); + if (!Iter_.Skip()) { + Iter_ = NUdf::TUnboxedValue(); return false; } - ++Index; + ++Index_; return true; } - NUdf::TUnboxedValue Iter; + NUdf::TUnboxedValue Iter_; const TMaybe<ui64> Skip_; const TMaybe<ui64> Take_; - ui64 Index; + ui64 Index_; }; TLimitedList(TMemoryUsageInfo* memInfo, NUdf::TRefCountedPtr<NUdf::IBoxedValue> parent, TMaybe<ui64> skip, TMaybe<ui64> take) : TComputationValue(memInfo) - , Parent(parent) - , Skip(skip) - , Take(take) + , Parent_(parent) + , Skip_(skip) + , Take_(take) { } private: bool HasFastListLength() const override { - return Length.Defined(); + return Length_.Defined(); } ui64 GetListLength() const override { - if (!Length) { - ui64 length = NUdf::TBoxedValueAccessor::GetListLength(*Parent); - if (Skip) { - if (Skip.GetRef() >= length) { + if (!Length_) { + ui64 length = NUdf::TBoxedValueAccessor::GetListLength(*Parent_); + if (Skip_) { + if (Skip_.GetRef() >= length) { length = 0; } else { - length -= Skip.GetRef(); + length -= Skip_.GetRef(); } } - if (Take) { - length = Min(length, Take.GetRef()); + if (Take_) { + length = Min(length, Take_.GetRef()); } - Length = length; + Length_ = length; } - return Length.GetRef(); + return Length_.GetRef(); } ui64 GetEstimatedListLength() const override { @@ -2576,21 +2576,21 @@ private: } bool HasListItems() const override { - if (HasItems) { - return *HasItems; + if (HasItems_) { + return *HasItems_; } - if (Length) { - HasItems = (*Length != 0); - return *HasItems; + if (Length_) { + HasItems_ = (*Length_ != 0); + return *HasItems_; } - HasItems = GetListIterator().Skip(); - return *HasItems; + HasItems_ = GetListIterator().Skip(); + return *HasItems_; } NUdf::TUnboxedValue GetListIterator() const override { - return NUdf::TUnboxedValuePod(new TIterator(GetMemInfo(), NUdf::TBoxedValueAccessor::GetListIterator(*Parent), Skip, Take)); + return NUdf::TUnboxedValuePod(new TIterator(GetMemInfo(), NUdf::TBoxedValueAccessor::GetListIterator(*Parent_), Skip_, Take_)); } NUdf::IBoxedValuePtr SkipListImpl(const NUdf::IValueBuilder& builder, ui64 count) const override { @@ -2598,19 +2598,19 @@ private: return const_cast<TLimitedList*>(this); } - if (Length) { - if (count >= Length.GetRef()) { + if (Length_) { + if (count >= Length_.GetRef()) { return builder.NewEmptyList().Release().AsBoxed(); } } - ui64 prevSkip = Skip.GetOrElse(0); + ui64 prevSkip = Skip_.GetOrElse(0); if (count > Max<ui64>() - prevSkip) { return builder.NewEmptyList().Release().AsBoxed(); } const ui64 newSkip = prevSkip + count; - TMaybe<ui64> newTake = Take; + TMaybe<ui64> newTake = Take_; if (newTake) { if (count >= newTake.GetRef()) { return builder.NewEmptyList().Release().AsBoxed(); @@ -2619,7 +2619,7 @@ private: newTake = newTake.GetRef() - count; } - return new TLimitedList(GetMemInfo(), Parent, newSkip, newTake); + return new TLimitedList(GetMemInfo(), Parent_, newSkip, newTake); } NUdf::IBoxedValuePtr TakeListImpl(const NUdf::IValueBuilder& builder, ui64 count) const override { @@ -2627,102 +2627,102 @@ private: return builder.NewEmptyList().Release().AsBoxed(); } - if (Length) { - if (count >= Length.GetRef()) { + if (Length_) { + if (count >= Length_.GetRef()) { return const_cast<TLimitedList*>(this); } } - TMaybe<ui64> newTake = Take; + TMaybe<ui64> newTake = Take_; if (newTake) { newTake = Min(count, newTake.GetRef()); } else { newTake = count; } - return new TLimitedList(GetMemInfo(), Parent, Skip, newTake); + return new TLimitedList(GetMemInfo(), Parent_, Skip_, newTake); } - NUdf::TRefCountedPtr<NUdf::IBoxedValue> Parent; - TMaybe<ui64> Skip; - TMaybe<ui64> Take; - mutable TMaybe<ui64> Length; - mutable TMaybe<bool> HasItems; + NUdf::TRefCountedPtr<NUdf::IBoxedValue> Parent_; + TMaybe<ui64> Skip_; + TMaybe<ui64> Take_; + mutable TMaybe<ui64> Length_; + mutable TMaybe<bool> HasItems_; }; class TLazyListDecorator : public TComputationValue<TLazyListDecorator> { public: TLazyListDecorator(TMemoryUsageInfo* memInfo, NUdf::IBoxedValuePtr&& list) - : TComputationValue(memInfo), List(std::move(list)) + : TComputationValue(memInfo), List_(std::move(list)) {} private: bool HasListItems() const final { - return NUdf::TBoxedValueAccessor::HasListItems(*List); + return NUdf::TBoxedValueAccessor::HasListItems(*List_); } bool HasDictItems() const final { - return NUdf::TBoxedValueAccessor::HasDictItems(*List); + return NUdf::TBoxedValueAccessor::HasDictItems(*List_); } bool HasFastListLength() const final { - return NUdf::TBoxedValueAccessor::HasFastListLength(*List); + return NUdf::TBoxedValueAccessor::HasFastListLength(*List_); } ui64 GetListLength() const final { - return NUdf::TBoxedValueAccessor::GetListLength(*List); + return NUdf::TBoxedValueAccessor::GetListLength(*List_); } ui64 GetDictLength() const final { - return NUdf::TBoxedValueAccessor::GetDictLength(*List); + return NUdf::TBoxedValueAccessor::GetDictLength(*List_); } ui64 GetEstimatedListLength() const final { - return NUdf::TBoxedValueAccessor::GetEstimatedListLength(*List); + return NUdf::TBoxedValueAccessor::GetEstimatedListLength(*List_); } NUdf::TUnboxedValue GetListIterator() const final { - return NUdf::TBoxedValueAccessor::GetListIterator(*List); + return NUdf::TBoxedValueAccessor::GetListIterator(*List_); } NUdf::TUnboxedValue GetDictIterator() const final { - return NUdf::TBoxedValueAccessor::GetDictIterator(*List); + return NUdf::TBoxedValueAccessor::GetDictIterator(*List_); } NUdf::TUnboxedValue GetPayloadsIterator() const final { - return NUdf::TBoxedValueAccessor::GetPayloadsIterator(*List); + return NUdf::TBoxedValueAccessor::GetPayloadsIterator(*List_); } NUdf::TUnboxedValue GetKeysIterator() const final { - return NUdf::TBoxedValueAccessor::GetKeysIterator(*List); + return NUdf::TBoxedValueAccessor::GetKeysIterator(*List_); } NUdf::IBoxedValuePtr ReverseListImpl(const NUdf::IValueBuilder& builder) const final { - return NUdf::TBoxedValueAccessor::ReverseListImpl(*List, builder); + return NUdf::TBoxedValueAccessor::ReverseListImpl(*List_, builder); } NUdf::IBoxedValuePtr SkipListImpl(const NUdf::IValueBuilder& builder, ui64 count) const final { - return NUdf::TBoxedValueAccessor::SkipListImpl(*List, builder, count); + return NUdf::TBoxedValueAccessor::SkipListImpl(*List_, builder, count); } NUdf::IBoxedValuePtr TakeListImpl(const NUdf::IValueBuilder& builder, ui64 count) const final { - return NUdf::TBoxedValueAccessor::TakeListImpl(*List, builder, count); + return NUdf::TBoxedValueAccessor::TakeListImpl(*List_, builder, count); } NUdf::IBoxedValuePtr ToIndexDictImpl(const NUdf::IValueBuilder& builder) const final { - return NUdf::TBoxedValueAccessor::ToIndexDictImpl(*List, builder); + return NUdf::TBoxedValueAccessor::ToIndexDictImpl(*List_, builder); } bool Contains(const NUdf::TUnboxedValuePod& key) const final { - return NUdf::TBoxedValueAccessor::Contains(*List, key); + return NUdf::TBoxedValueAccessor::Contains(*List_, key); } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const final { - return NUdf::TBoxedValueAccessor::Lookup(*List, key); + return NUdf::TBoxedValueAccessor::Lookup(*List_, key); } NUdf::TUnboxedValue GetElement(ui32 index) const final { - return NUdf::TBoxedValueAccessor::GetElement(*List, index); + return NUdf::TBoxedValueAccessor::GetElement(*List_, index); } const NUdf::TUnboxedValue* GetElements() const final { @@ -2730,10 +2730,10 @@ private: } bool IsSortedDict() const final { - return NUdf::TBoxedValueAccessor::IsSortedDict(*List); + return NUdf::TBoxedValueAccessor::IsSortedDict(*List_); } - const NUdf::IBoxedValuePtr List; + const NUdf::IBoxedValuePtr List_; }; } // namespace @@ -2950,36 +2950,36 @@ THolderFactory::THolderFactory( TAllocState& allocState, TMemoryUsageInfo& memInfo, const IFunctionRegistry* functionRegistry) - : CurrentAllocState(&allocState) - , MemInfo(memInfo) - , FunctionRegistry(functionRegistry) + : CurrentAllocState_(&allocState) + , MemInfo_(memInfo) + , FunctionRegistry_(functionRegistry) { } THolderFactory::~THolderFactory() { - if (EmptyContainer) { - CurrentAllocState->UnlockObject(*EmptyContainer); + if (EmptyContainer_) { + CurrentAllocState_->UnlockObject(*EmptyContainer_); } } NUdf::TUnboxedValuePod THolderFactory::GetEmptyContainerLazy() const { - if (!EmptyContainer) { - EmptyContainer.ConstructInPlace( - NUdf::TUnboxedValuePod(AllocateOn<TEmptyContainerHolder>(CurrentAllocState, &MemInfo))); - CurrentAllocState->LockObject(*EmptyContainer); + if (!EmptyContainer_) { + EmptyContainer_.ConstructInPlace( + NUdf::TUnboxedValuePod(AllocateOn<TEmptyContainerHolder>(CurrentAllocState_, &MemInfo_))); + CurrentAllocState_->LockObject(*EmptyContainer_); } - return *EmptyContainer; + return *EmptyContainer_; } NUdf::TUnboxedValuePod THolderFactory::CreateTypeHolder(TType* type) const { - return NUdf::TUnboxedValuePod(AllocateOn<TTypeHolder>(CurrentAllocState, &MemInfo, type)); + return NUdf::TUnboxedValuePod(AllocateOn<TTypeHolder>(CurrentAllocState_, &MemInfo_, type)); } NUdf::TUnboxedValuePod THolderFactory::CreateDirectListHolder(TDefaultListRepresentation&& items) const{ if (!items.GetLength()) return GetEmptyContainerLazy(); - return NUdf::TUnboxedValuePod(AllocateOn<TDirectListHolder>(CurrentAllocState, &MemInfo, std::move(items))); + return NUdf::TUnboxedValuePod(AllocateOn<TDirectListHolder>(CurrentAllocState_, &MemInfo_, std::move(items))); } NUdf::TUnboxedValuePod THolderFactory::CreateDirectArrayHolder(ui64 size, NUdf::TUnboxedValue*& itemsPtr) const { @@ -2989,8 +2989,8 @@ NUdf::TUnboxedValuePod THolderFactory::CreateDirectArrayHolder(ui64 size, NUdf:: } const auto buffer = MKQLAllocFastWithSize( - sizeof(TDirectArrayHolderInplace) + size * sizeof(NUdf::TUnboxedValue), CurrentAllocState, EMemorySubPool::Default); - const auto h = ::new(buffer) TDirectArrayHolderInplace(&MemInfo, size); + sizeof(TDirectArrayHolderInplace) + size * sizeof(NUdf::TUnboxedValue), CurrentAllocState_, EMemorySubPool::Default); + const auto h = ::new(buffer) TDirectArrayHolderInplace(&MemInfo_, size); auto res = NUdf::TUnboxedValuePod(h); itemsPtr = h->GetPtr(); @@ -3015,27 +3015,27 @@ NUdf::TUnboxedValuePod THolderFactory::VectorAsArray(TUnboxedValueVector& values } NUdf::TUnboxedValuePod THolderFactory::NewVectorHolder() const { - return NUdf::TUnboxedValuePod(new TVectorHolder(&MemInfo)); + return NUdf::TUnboxedValuePod(new TVectorHolder(&MemInfo_)); } NUdf::TUnboxedValuePod THolderFactory::NewTemporaryVectorHolder() const { - return NUdf::TUnboxedValuePod(new TTemporaryVectorHolder(&MemInfo)); + return NUdf::TUnboxedValuePod(new TTemporaryVectorHolder(&MemInfo_)); } const NUdf::IHash* THolderFactory::GetHash(TType& type, bool useIHash) const { - return useIHash ? HashRegistry.FindOrEmplace(type) : nullptr; + return useIHash ? HashRegistry_.FindOrEmplace(type) : nullptr; } const NUdf::IEquate* THolderFactory::GetEquate(TType& type, bool useIHash) const { - return useIHash ? EquateRegistry.FindOrEmplace(type) : nullptr; + return useIHash ? EquateRegistry_.FindOrEmplace(type) : nullptr; } const NUdf::ICompare* THolderFactory::GetCompare(TType& type, bool useIHash) const { - return useIHash ? CompareRegistry.FindOrEmplace(type) : nullptr; + return useIHash ? CompareRegistry_.FindOrEmplace(type) : nullptr; } NUdf::TUnboxedValuePod THolderFactory::VectorAsVectorHolder(TUnboxedValueVector&& list) const { - return NUdf::TUnboxedValuePod(new TVectorHolder(&MemInfo, std::move(list))); + return NUdf::TUnboxedValuePod(new TVectorHolder(&MemInfo_, std::move(list))); } NUdf::TUnboxedValuePod THolderFactory::CloneArray(const NUdf::TUnboxedValuePod list, NUdf::TUnboxedValue*& items) const { @@ -3110,7 +3110,7 @@ NUdf::TUnboxedValuePod THolderFactory::CreateLimitedList( return NUdf::TUnboxedValuePod(std::move(parent)); } - return NUdf::TUnboxedValuePod(AllocateOn<TLimitedList>(CurrentAllocState, &MemInfo, std::move(parent), skip, take)); + return NUdf::TUnboxedValuePod(AllocateOn<TLimitedList>(CurrentAllocState_, &MemInfo_, std::move(parent), skip, take)); } NUdf::TUnboxedValuePod THolderFactory::ReverseList(const NUdf::IValueBuilder* builder, const NUdf::TUnboxedValuePod list) const @@ -3194,7 +3194,7 @@ template NUdf::TUnboxedValuePod THolderFactory::Collect<true>(NUdf::TUnboxedValu template NUdf::TUnboxedValuePod THolderFactory::Collect<false>(NUdf::TUnboxedValuePod list) const; NUdf::TUnboxedValuePod THolderFactory::LazyList(NUdf::TUnboxedValuePod list) const { - return NUdf::TUnboxedValuePod(AllocateOn<TLazyListDecorator>(CurrentAllocState, &MemInfo, list.AsBoxed()));; + return NUdf::TUnboxedValuePod(AllocateOn<TLazyListDecorator>(CurrentAllocState_, &MemInfo_, list.AsBoxed()));; } NUdf::TUnboxedValuePod THolderFactory::Append(NUdf::TUnboxedValuePod list, NUdf::TUnboxedValuePod last) const { @@ -3325,15 +3325,15 @@ NUdf::TUnboxedValuePod THolderFactory::CreateVariantHolder(NUdf::TUnboxedValuePo } NUdf::TUnboxedValuePod THolderFactory::CreateBoxedVariantHolder(NUdf::TUnboxedValuePod item, ui32 index) const { - return NUdf::TUnboxedValuePod(AllocateOn<TVariantHolder>(CurrentAllocState, &MemInfo, std::move(item), index)); + return NUdf::TUnboxedValuePod(AllocateOn<TVariantHolder>(CurrentAllocState_, &MemInfo_, std::move(item), index)); } NUdf::TUnboxedValuePod THolderFactory::CreateIteratorOverList(NUdf::TUnboxedValuePod list) const { - return NUdf::TUnboxedValuePod(AllocateOn<TListIteratorHolder>(CurrentAllocState, &MemInfo, list)); + return NUdf::TUnboxedValuePod(AllocateOn<TListIteratorHolder>(CurrentAllocState_, &MemInfo_, list)); } NUdf::TUnboxedValuePod THolderFactory::CreateForwardList(NUdf::TUnboxedValuePod stream) const { - return NUdf::TUnboxedValuePod(AllocateOn<TForwardListValue>(CurrentAllocState, &MemInfo, stream)); + return NUdf::TUnboxedValuePod(AllocateOn<TForwardListValue>(CurrentAllocState_, &MemInfo_, stream)); } NUdf::TUnboxedValuePod THolderFactory::CreateDirectSortedSetHolder( @@ -3346,7 +3346,7 @@ NUdf::TUnboxedValuePod THolderFactory::CreateDirectSortedSetHolder( const NUdf::ICompare* compare, const NUdf::IEquate* equate) const { - return NUdf::TUnboxedValuePod(AllocateOn<TSortedSetHolder>(CurrentAllocState, &MemInfo, + return NUdf::TUnboxedValuePod(AllocateOn<TSortedSetHolder>(CurrentAllocState_, &MemInfo_, filler, types, isTuple, mode, eagerFill, encodedType, compare, equate, *this)); } @@ -3360,7 +3360,7 @@ NUdf::TUnboxedValuePod THolderFactory::CreateDirectSortedDictHolder( const NUdf::ICompare* compare, const NUdf::IEquate* equate) const { - return NUdf::TUnboxedValuePod(AllocateOn<TSortedDictHolder>(CurrentAllocState, &MemInfo, + return NUdf::TUnboxedValuePod(AllocateOn<TSortedDictHolder>(CurrentAllocState_, &MemInfo_, filler, types, isTuple, mode, eagerFill, encodedType, compare, equate, *this)); } @@ -3373,7 +3373,7 @@ NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedDictHolder( const NUdf::IHash* hash, const NUdf::IEquate* equate) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedDictHolder>(CurrentAllocState, &MemInfo, + return NUdf::TUnboxedValuePod(AllocateOn<THashedDictHolder>(CurrentAllocState_, &MemInfo_, filler, types, isTuple, eagerFill, encodedType, hash, equate, *this)); } @@ -3385,14 +3385,14 @@ NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedSetHolder( TType* encodedType, const NUdf::IHash* hash, const NUdf::IEquate* equate) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedSetHolder>(CurrentAllocState, &MemInfo, + return NUdf::TUnboxedValuePod(AllocateOn<THashedSetHolder>(CurrentAllocState_, &MemInfo_, filler, types, isTuple, eagerFill, encodedType, hash, equate, *this)); } template <typename T, bool OptionalKey> NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedSingleFixedSetHolder( TValuesDictHashSingleFixedSet<T>&& set, bool hasNull) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedSetHolder<T, OptionalKey>>(CurrentAllocState, &MemInfo, std::move(set), hasNull)); + return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedSetHolder<T, OptionalKey>>(CurrentAllocState_, &MemInfo_, std::move(set), hasNull)); } #define DEFINE_HASHED_SINGLE_FIXED_SET_OPT(xType) \ @@ -3412,7 +3412,7 @@ KNOWN_PRIMITIVE_VALUE_TYPES(DEFINE_HASHED_SINGLE_FIXED_SET_NONOPT) template <typename T, bool OptionalKey> NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedSingleFixedCompactSetHolder( TValuesDictHashSingleFixedCompactSet<T>&& set, bool hasNull) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedCompactSetHolder<T, OptionalKey>>(CurrentAllocState, &MemInfo, std::move(set), hasNull)); + return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedCompactSetHolder<T, OptionalKey>>(CurrentAllocState_, &MemInfo_, std::move(set), hasNull)); } #define DEFINE_HASHED_SINGLE_FIXED_COMPACT_SET_OPT(xType) \ @@ -3432,31 +3432,31 @@ KNOWN_PRIMITIVE_VALUE_TYPES(DEFINE_HASHED_SINGLE_FIXED_COMPACT_SET_NONOPT) template <typename T, bool OptionalKey> NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedSingleFixedMapHolder( TValuesDictHashSingleFixedMap<T>&& map, std::optional<NUdf::TUnboxedValue>&& nullPayload) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedMapHolder<T, OptionalKey>>(CurrentAllocState, &MemInfo, std::move(map), std::move(nullPayload))); + return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedMapHolder<T, OptionalKey>>(CurrentAllocState_, &MemInfo_, std::move(map), std::move(nullPayload))); } NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedCompactSetHolder( TValuesDictHashCompactSet&& set, TPagedArena&& pool, TType* keyType, TComputationContext* ctx) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedCompactSetHolder>(CurrentAllocState, &MemInfo, std::move(set), std::move(pool), keyType, ctx)); + return NUdf::TUnboxedValuePod(AllocateOn<THashedCompactSetHolder>(CurrentAllocState_, &MemInfo_, std::move(set), std::move(pool), keyType, ctx)); } NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedCompactMapHolder( TValuesDictHashCompactMap&& map, TPagedArena&& pool, TType* keyType, TType* payloadType, TComputationContext* ctx) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedCompactMapHolder>(CurrentAllocState, &MemInfo, std::move(map), std::move(pool), keyType, payloadType, ctx)); + return NUdf::TUnboxedValuePod(AllocateOn<THashedCompactMapHolder>(CurrentAllocState_, &MemInfo_, std::move(map), std::move(pool), keyType, payloadType, ctx)); } NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedCompactMultiMapHolder( TValuesDictHashCompactMultiMap&& map, TPagedArena&& pool, TType* keyType, TType* payloadType, TComputationContext* ctx) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedCompactMultiMapHolder>(CurrentAllocState, &MemInfo, std::move(map), std::move(pool), keyType, payloadType, ctx)); + return NUdf::TUnboxedValuePod(AllocateOn<THashedCompactMultiMapHolder>(CurrentAllocState_, &MemInfo_, std::move(map), std::move(pool), keyType, payloadType, ctx)); } template <typename T, bool OptionalKey> NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedSingleFixedCompactMapHolder( TValuesDictHashSingleFixedCompactMap<T>&& map, std::optional<ui64>&& nullPayload, TPagedArena&& pool, TType* payloadType, TComputationContext* ctx) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedCompactMapHolder<T, OptionalKey>>(CurrentAllocState, &MemInfo, + return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedCompactMapHolder<T, OptionalKey>>(CurrentAllocState_, &MemInfo_, std::move(map), std::move(nullPayload), std::move(pool), payloadType, ctx)); } @@ -3464,7 +3464,7 @@ template <typename T, bool OptionalKey> NUdf::TUnboxedValuePod THolderFactory::CreateDirectHashedSingleFixedCompactMultiMapHolder( TValuesDictHashSingleFixedCompactMultiMap<T>&& map, std::vector<ui64>&& nullPayloads, TPagedArena&& pool, TType* payloadType, TComputationContext* ctx) const { - return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedCompactMultiMapHolder<T, OptionalKey>>(CurrentAllocState, &MemInfo, + return NUdf::TUnboxedValuePod(AllocateOn<THashedSingleFixedCompactMultiMapHolder<T, OptionalKey>>(CurrentAllocState_, &MemInfo_, std::move(map), std::move(nullPayloads), std::move(pool), payloadType, ctx)); } @@ -3583,23 +3583,23 @@ TPlainContainerCache::TPlainContainerCache() { } void TPlainContainerCache::Clear() { - Cached.fill(NUdf::TUnboxedValue()); - CachedItems.fill(nullptr); + Cached_.fill(NUdf::TUnboxedValue()); + CachedItems_.fill(nullptr); } NUdf::TUnboxedValuePod TPlainContainerCache::NewArray(const THolderFactory& factory, ui64 size, NUdf::TUnboxedValue*& items) { - if (!CachedItems[CacheIndex] || !Cached[CacheIndex].UniqueBoxed()) { - CacheIndex ^= 1U; - if (!CachedItems[CacheIndex] || !Cached[CacheIndex].UniqueBoxed()) { - Cached[CacheIndex] = factory.CreateDirectArrayHolder(size, CachedItems[CacheIndex]); - items = CachedItems[CacheIndex]; - return static_cast<const NUdf::TUnboxedValuePod&>(Cached[CacheIndex]); + if (!CachedItems_[CacheIndex_] || !Cached_[CacheIndex_].UniqueBoxed()) { + CacheIndex_ ^= 1U; + if (!CachedItems_[CacheIndex_] || !Cached_[CacheIndex_].UniqueBoxed()) { + Cached_[CacheIndex_] = factory.CreateDirectArrayHolder(size, CachedItems_[CacheIndex_]); + items = CachedItems_[CacheIndex_]; + return static_cast<const NUdf::TUnboxedValuePod&>(Cached_[CacheIndex_]); } } - items = CachedItems[CacheIndex]; + items = CachedItems_[CacheIndex_]; std::fill_n(items, size, NUdf::TUnboxedValue()); - return static_cast<const NUdf::TUnboxedValuePod&>(Cached[CacheIndex]); + return static_cast<const NUdf::TUnboxedValuePod&>(Cached_[CacheIndex_]); } } // namespace NMiniKQL diff --git a/yql/essentials/minikql/computation/mkql_computation_node_holders.h b/yql/essentials/minikql/computation/mkql_computation_node_holders.h index 1eb4468a98b..9ed032632b4 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_holders.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_holders.h @@ -565,7 +565,7 @@ class TTypeHolder: public TComputationValue<TTypeHolder> { public: TTypeHolder(TMemoryUsageInfo* memInfo, TType* type) : TComputationValue(memInfo) - , Type(type) + , Type_(type) {} NUdf::TStringRef GetResourceTag() const override { @@ -573,11 +573,11 @@ public: } void* GetResource() override { - return Type; + return Type_; } private: - TType* const Type; + TType* const Type_; }; class TArrowBlock: public TComputationValue<TArrowBlock> { @@ -615,9 +615,9 @@ class TTypeOperationsRegistry { using TValuePtr = typename IFace::TPtr; public: IFace* FindOrEmplace(TType& type) const { - const TString serializedType = SerializeNode(&type, NodeStack); - auto it = Registry.find(serializedType); - if (it == Registry.end()) { + const TString serializedType = SerializeNode(&type, NodeStack_); + auto it = Registry_.find(serializedType); + if (it == Registry_.end()) { TValuePtr ptr; if constexpr (std::is_same_v<IFace, NUdf::IHash>) { ptr = MakeHashImpl(&type); @@ -629,14 +629,14 @@ public: static_assert(TDependentFalse<IFace>, "unexpected type"); } auto p = std::make_pair(std::move(serializedType), std::move(ptr)); - it = Registry.insert(std::move(p)).first; + it = Registry_.insert(std::move(p)).first; } return it->second.Get(); } private: - mutable std::vector<TNode*> NodeStack; - mutable THashMap<TString, TValuePtr> Registry; + mutable std::vector<TNode*> NodeStack_; + mutable THashMap<TString, TValuePtr> Registry_; }; class TDirectArrayHolderInplace : public TComputationValue<TDirectArrayHolderInplace> { @@ -652,22 +652,22 @@ public: TDirectArrayHolderInplace(TMemoryUsageInfo* memInfo, ui64 size) : TComputationValue(memInfo) - , Size(size) + , Size_(size) { - MKQL_ENSURE(Size > 0U, "Can't create empty array holder."); - MKQL_MEM_TAKE(GetMemInfo(), GetPtr(), Size * sizeof(NUdf::TUnboxedValue)); - std::memset(GetPtr(), 0, Size * sizeof(NUdf::TUnboxedValue)); + MKQL_ENSURE(Size_ > 0U, "Can't create empty array holder."); + MKQL_MEM_TAKE(GetMemInfo(), GetPtr(), Size_ * sizeof(NUdf::TUnboxedValue)); + std::memset(GetPtr(), 0, Size_ * sizeof(NUdf::TUnboxedValue)); } ~TDirectArrayHolderInplace() { - for (ui64 i = 0U; i < Size; ++i) { + for (ui64 i = 0U; i < Size_; ++i) { (GetPtr() + i)->~TUnboxedValue(); } - MKQL_MEM_RETURN(GetMemInfo(), GetPtr(), Size * sizeof(NUdf::TUnboxedValue)); + MKQL_MEM_RETURN(GetMemInfo(), GetPtr(), Size_ * sizeof(NUdf::TUnboxedValue)); } ui64 GetSize() const { - return Size; + return Size_; } NUdf::TUnboxedValue* GetPtr() const { @@ -678,51 +678,51 @@ private: class TIterator : public TTemporaryComputationValue<TIterator> { public: TIterator(const TDirectArrayHolderInplace* parent) - : TTemporaryComputationValue(parent->GetMemInfo()), Parent(const_cast<TDirectArrayHolderInplace*>(parent)) + : TTemporaryComputationValue(parent->GetMemInfo()), Parent_(const_cast<TDirectArrayHolderInplace*>(parent)) {} private: bool Skip() final { - return ++Current < Parent->GetSize(); + return ++Current_ < Parent_->GetSize(); } bool Next(NUdf::TUnboxedValue& value) final { if (!Skip()) return false; - value = Parent->GetPtr()[Current]; + value = Parent_->GetPtr()[Current_]; return true; } bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) final { if (!Next(payload)) return false; - key = NUdf::TUnboxedValuePod(Current); + key = NUdf::TUnboxedValuePod(Current_); return true; } - const NUdf::TRefCountedPtr<TDirectArrayHolderInplace> Parent; - ui64 Current = Max<ui64>(); + const NUdf::TRefCountedPtr<TDirectArrayHolderInplace> Parent_; + ui64 Current_ = Max<ui64>(); }; class TKeysIterator : public TTemporaryComputationValue<TKeysIterator> { public: TKeysIterator(const TDirectArrayHolderInplace& parent) - : TTemporaryComputationValue(parent.GetMemInfo()), Size(parent.GetSize()) + : TTemporaryComputationValue(parent.GetMemInfo()), Size_(parent.GetSize()) {} private: bool Skip() final { - return ++Current < Size; + return ++Current_ < Size_; } bool Next(NUdf::TUnboxedValue& key) final { if (!Skip()) return false; - key = NUdf::TUnboxedValuePod(Current); + key = NUdf::TUnboxedValuePod(Current_); return true; } - const ui64 Size; - ui64 Current = Max<ui64>(); + const ui64 Size_; + ui64 Current_ = Max<ui64>(); }; bool HasListItems() const final { @@ -738,15 +738,15 @@ private: } ui64 GetListLength() const final { - return Size; + return Size_; } ui64 GetDictLength() const final { - return Size; + return Size_; } ui64 GetEstimatedListLength() const final { - return Size; + return Size_; } NUdf::TUnboxedValue GetListIterator() const final { @@ -766,12 +766,12 @@ private: } NUdf::IBoxedValuePtr ReverseListImpl(const NUdf::IValueBuilder& builder) const final { - if (1U >= Size) + if (1U >= Size_) return const_cast<TDirectArrayHolderInplace*>(this); NUdf::TUnboxedValue* items = nullptr; - auto result = builder.NewArray(Size, items); - std::reverse_copy(GetPtr(), GetPtr() + Size, items); + auto result = builder.NewArray(Size_, items); + std::reverse_copy(GetPtr(), GetPtr() + Size_, items); return result.Release().AsBoxed(); } @@ -779,10 +779,10 @@ private: if (!count) return const_cast<TDirectArrayHolderInplace*>(this); - if (count >= Size) + if (count >= Size_) return builder.NewEmptyList().Release().AsBoxed(); - const auto newSize = Size - count; + const auto newSize = Size_ - count; NUdf::TUnboxedValue* items = nullptr; auto result = builder.NewArray(newSize, items); std::copy_n(GetPtr() + count, newSize, items); @@ -793,7 +793,7 @@ private: if (!count) return builder.NewEmptyList().Release().AsBoxed(); - if (count >= Size) + if (count >= Size_) return const_cast<TDirectArrayHolderInplace*>(this); const auto newSize = count; @@ -808,16 +808,16 @@ private: } bool Contains(const NUdf::TUnboxedValuePod& key) const final { - return key.Get<ui64>() < Size; + return key.Get<ui64>() < Size_; } NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const final { const auto index = key.Get<ui64>(); - return index < Size ? GetPtr()[index].MakeOptional() : NUdf::TUnboxedValuePod(); + return index < Size_ ? GetPtr()[index].MakeOptional() : NUdf::TUnboxedValuePod(); } NUdf::TUnboxedValue GetElement(ui32 index) const final { - Y_DEBUG_ABORT_UNLESS(index < Size); + Y_DEBUG_ABORT_UNLESS(index < Size_); return GetPtr()[index]; } @@ -829,7 +829,7 @@ private: return true; } - const ui64 Size; + const ui64 Size_; }; ////////////////////////////////////////////////////////////////////////////// @@ -847,7 +847,7 @@ public: template <typename T, typename... TArgs> NUdf::TUnboxedValuePod Create(TArgs&&... args) const { - return NUdf::TUnboxedValuePod(AllocateOn<T>(CurrentAllocState, &MemInfo, std::forward<TArgs>(args)...)); + return NUdf::TUnboxedValuePod(AllocateOn<T>(CurrentAllocState_, &MemInfo_, std::forward<TArgs>(args)...)); } NUdf::TUnboxedValuePod CreateTypeHolder(TType* type) const; @@ -988,27 +988,27 @@ public: NUdf::TUnboxedValuePod CloneArray(const NUdf::TUnboxedValuePod list, NUdf::TUnboxedValue*& itemsPtr) const; TMemoryUsageInfo& GetMemInfo() const { - return MemInfo; + return MemInfo_; } NUdf::TUnboxedValuePod GetEmptyContainerLazy() const; void CleanupModulesOnTerminate() const { - if (FunctionRegistry) { - FunctionRegistry->CleanupModulesOnTerminate(); + if (FunctionRegistry_) { + FunctionRegistry_->CleanupModulesOnTerminate(); } } TAlignedPagePool& GetPagePool() const { - return *CurrentAllocState; + return *CurrentAllocState_; } ui64 GetMemoryUsed() const { - return CurrentAllocState->GetUsed(); + return CurrentAllocState_->GetUsed(); } const IFunctionRegistry* GetFunctionRegistry() const { - return FunctionRegistry; + return FunctionRegistry_; } template<bool FromStreams> @@ -1016,14 +1016,14 @@ public: NUdf::TUnboxedValuePod ExtendStream(NUdf::TUnboxedValue* data, ui64 size) const; private: - TAllocState* const CurrentAllocState; - TMemoryUsageInfo& MemInfo; - const IFunctionRegistry* const FunctionRegistry; - mutable TMaybe<NUdf::TUnboxedValue> EmptyContainer; - - mutable TTypeOperationsRegistry<NUdf::IHash> HashRegistry; - mutable TTypeOperationsRegistry<NUdf::IEquate> EquateRegistry; - mutable TTypeOperationsRegistry<NUdf::ICompare> CompareRegistry; + TAllocState* const CurrentAllocState_; + TMemoryUsageInfo& MemInfo_; + const IFunctionRegistry* const FunctionRegistry_; + mutable TMaybe<NUdf::TUnboxedValue> EmptyContainer_; + + mutable TTypeOperationsRegistry<NUdf::IHash> HashRegistry_; + mutable TTypeOperationsRegistry<NUdf::IEquate> EquateRegistry_; + mutable TTypeOperationsRegistry<NUdf::ICompare> CompareRegistry_; }; constexpr const ui32 STEP_FOR_RSS_CHECK = 100U; @@ -1052,40 +1052,40 @@ public: TKeyTypeContanerHelper(const TType* type) { bool encoded; bool useIHash; - GetDictionaryKeyTypes(type, KeyTypes, IsTuple, encoded, useIHash); + GetDictionaryKeyTypes(type, KeyTypes_, IsTuple_, encoded, useIHash); if (useIHash || encoded) { if constexpr(SupportEqual) { - Equate = MakeEquateImpl(type); + Equate_ = MakeEquateImpl(type); } if constexpr(SupportHash) { - Hash = MakeHashImpl(type); + Hash_ = MakeHashImpl(type); } if constexpr(SupportLess) { - Compare = MakeCompareImpl(type); + Compare_ = MakeCompareImpl(type); } } } public: //unavailable getters may be eliminated at compile time, but it'd make code much less readable TValueEqual GetValueEqual() const{ Y_ABORT_UNLESS(SupportEqual); - return TValueEqual(KeyTypes, IsTuple, Equate.Get()); + return TValueEqual(KeyTypes_, IsTuple_, Equate_.Get()); } TValueHasher GetValueHash() const{ Y_ABORT_UNLESS(SupportHash); - return TValueHasher(KeyTypes, IsTuple, Hash.Get()); + return TValueHasher(KeyTypes_, IsTuple_, Hash_.Get()); } TValueLess GetValueLess() const{ Y_ABORT_UNLESS(SupportLess); - return TValueLess(KeyTypes, IsTuple , Compare.Get()); + return TValueLess(KeyTypes_, IsTuple_ , Compare_.Get()); } private: - TKeyTypes KeyTypes; - bool IsTuple = false; + TKeyTypes KeyTypes_; + bool IsTuple_ = false; //unsused pointers may be eliminated at compile time, but it'd make code much less readable - NUdf::IEquate::TPtr Equate; - NUdf::IHash::TPtr Hash; - NUdf::ICompare::TPtr Compare; + NUdf::IEquate::TPtr Equate_; + NUdf::IHash::TPtr Hash_; + NUdf::ICompare::TPtr Compare_; }; class TPlainContainerCache { @@ -1100,21 +1100,21 @@ public: NUdf::TUnboxedValuePod NewArray(const THolderFactory& factory, ui64 size, NUdf::TUnboxedValue*& items); private: - std::array<NUdf::TUnboxedValue, 2> Cached; - std::array<NUdf::TUnboxedValue*, 2> CachedItems; - ui8 CacheIndex = 0U; + std::array<NUdf::TUnboxedValue, 2> Cached_; + std::array<NUdf::TUnboxedValue*, 2> CachedItems_; + ui8 CacheIndex_ = 0U; }; template<class TObject> class TMutableObjectOverBoxedValue { public: TMutableObjectOverBoxedValue(TComputationMutables& mutables) - : ObjectIndex(mutables.CurValueIndex++) + : ObjectIndex_(mutables.CurValueIndex++) {} template <typename... Args> TObject& RefMutableObject(TComputationContext& ctx, Args&&... args) const { - auto& unboxed = ctx.MutableValues[ObjectIndex]; + auto& unboxed = ctx.MutableValues[ObjectIndex_]; if (!unboxed.HasValue()) { unboxed = ctx.HolderFactory.Create<TObject>(std::forward<Args>(args)...); } @@ -1122,7 +1122,7 @@ public: return *static_cast<TObject*>(boxed.Get()); } private: - const ui32 ObjectIndex; + const ui32 ObjectIndex_; }; } // namespace NMiniKQL diff --git a/yql/essentials/minikql/computation/mkql_computation_node_holders_codegen.cpp b/yql/essentials/minikql/computation/mkql_computation_node_holders_codegen.cpp index 72f21b0c0aa..5757c21ece5 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_holders_codegen.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_holders_codegen.cpp @@ -243,7 +243,7 @@ public: const auto type = ArrayType::get(valType, ValueNodes.size()); const auto ptrType = PointerType::getUnqual(type); /// TODO: how to get computation context or other workaround - const auto itms = *Stateless || ctx.AlwaysInline ? + const auto itms = *Stateless_ || ctx.AlwaysInline ? new AllocaInst(ptrType, 0U, "itms", &ctx.Func->getEntryBlock().back()): new AllocaInst(ptrType, 0U, "itms", block); const auto result = Cache.GenNewArray(ValueNodes.size(), itms, ctx, block); diff --git a/yql/essentials/minikql/computation/mkql_computation_node_impl.cpp b/yql/essentials/minikql/computation/mkql_computation_node_impl.cpp index 49f686dd9e0..8069acdb7ca 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_impl.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_impl.cpp @@ -31,26 +31,26 @@ template class TRefCountedComputationNode<IComputationWideFlowNode>; template class TRefCountedComputationNode<IComputationWideFlowProxyNode>; TUnboxedImmutableComputationNode::TUnboxedImmutableComputationNode(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& value) - : MemInfo(memInfo) - , UnboxedValue(std::move(value)) - , RepresentationKind(UnboxedValue.HasValue() ? (UnboxedValue.IsBoxed() ? EValueRepresentation::Boxed : (UnboxedValue.IsString() ? EValueRepresentation::String : EValueRepresentation::Embedded)) : EValueRepresentation::Embedded) + : MemInfo_(memInfo) + , UnboxedValue_(std::move(value)) + , RepresentationKind_(UnboxedValue_.HasValue() ? (UnboxedValue_.IsBoxed() ? EValueRepresentation::Boxed : (UnboxedValue_.IsString() ? EValueRepresentation::String : EValueRepresentation::Embedded)) : EValueRepresentation::Embedded) { - MKQL_MEM_TAKE(MemInfo, this, sizeof(*this), __MKQL_LOCATION__); - TlsAllocState->LockObject(UnboxedValue); + MKQL_MEM_TAKE(MemInfo_, this, sizeof(*this), __MKQL_LOCATION__); + TlsAllocState->LockObject(UnboxedValue_); } TUnboxedImmutableComputationNode::~TUnboxedImmutableComputationNode() { - MKQL_MEM_RETURN(MemInfo, this, sizeof(*this)); - TlsAllocState->UnlockObject(UnboxedValue); + MKQL_MEM_RETURN(MemInfo_, this, sizeof(*this)); + TlsAllocState->UnlockObject(UnboxedValue_); } NUdf::TUnboxedValue TUnboxedImmutableComputationNode::GetValue(TComputationContext& compCtx) const { Y_UNUSED(compCtx); - if (!TlsAllocState->UseRefLocking && RepresentationKind == EValueRepresentation::String) { + if (!TlsAllocState->UseRefLocking && RepresentationKind_ == EValueRepresentation::String) { /// TODO: YQL-4461 - return MakeString(UnboxedValue.AsStringRef()); + return MakeString(UnboxedValue_.AsStringRef()); } - return UnboxedValue; + return UnboxedValue_; } const IComputationNode* TUnboxedImmutableComputationNode::GetSource() const { return nullptr; } @@ -81,23 +81,23 @@ void TUnboxedImmutableComputationNode::PrepareStageOne() {} void TUnboxedImmutableComputationNode::PrepareStageTwo() {} TString TUnboxedImmutableComputationNode::DebugString() const { - return UnboxedValue ? (UnboxedValue.IsBoxed() ? "Boxed" : "Literal") : "Empty"; + return UnboxedValue_ ? (UnboxedValue_.IsBoxed() ? "Boxed" : "Literal") : "Empty"; } EValueRepresentation TUnboxedImmutableComputationNode::GetRepresentation() const { - return RepresentationKind; + return RepresentationKind_; } Y_NO_INLINE TStatefulComputationNodeBase::TStatefulComputationNodeBase(ui32 valueIndex, EValueRepresentation kind) - : ValueIndex(valueIndex) - , RepresentationKind(kind) + : ValueIndex_(valueIndex) + , RepresentationKind_(kind) {} Y_NO_INLINE TStatefulComputationNodeBase::~TStatefulComputationNodeBase() {} Y_NO_INLINE void TStatefulComputationNodeBase::AddDependenceImpl(const IComputationNode* node) { - Dependencies.emplace_back(node); + Dependencies_.emplace_back(node); } Y_NO_INLINE void TStatefulComputationNodeBase::CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, @@ -105,8 +105,8 @@ Y_NO_INLINE void TStatefulComputationNodeBase::CollectDependentIndexesImpl(const if (self == owner) return; - if (const auto ins = dependencies.emplace(ValueIndex, RepresentationKind); ins.second) { - std::for_each(Dependencies.cbegin(), Dependencies.cend(), std::bind(&IComputationNode::CollectDependentIndexes, std::placeholders::_1, owner, std::ref(dependencies))); + if (const auto ins = dependencies.emplace(ValueIndex_, RepresentationKind_); ins.second) { + std::for_each(Dependencies_.cbegin(), Dependencies_.cend(), std::bind(&IComputationNode::CollectDependentIndexes, std::placeholders::_1, owner, std::ref(dependencies))); if (stateless) { dependencies.erase(ins.first); @@ -122,14 +122,14 @@ Y_NO_INLINE TStatefulSourceComputationNodeBase::~TStatefulSourceComputationNodeB {} Y_NO_INLINE void TStatefulSourceComputationNodeBase::PrepareStageOneImpl(const TConstComputationNodePtrVector& dependencies) { - if (!Stateless) { - Stateless = std::accumulate(dependencies.cbegin(), dependencies.cend(), 0, + if (!Stateless_) { + Stateless_ = std::accumulate(dependencies.cbegin(), dependencies.cend(), 0, std::bind(std::plus<i32>(), std::placeholders::_1, std::bind(&IComputationNode::GetDependencyWeight, std::placeholders::_2))) <= 1; } } Y_NO_INLINE void TStatefulSourceComputationNodeBase::AddSource(IComputationNode* source) const { - Sources.emplace(source); + Sources_.emplace(source); } template <class IComputationNodeInterface, bool SerializableState> @@ -137,7 +137,7 @@ TStatefulComputationNode<IComputationNodeInterface, SerializableState>::TStatefu : TStatefulComputationNodeBase(mutables.CurValueIndex++, kind) { if constexpr (SerializableState) { - mutables.SerializableValues.push_back(ValueIndex); + mutables.SerializableValues.push_back(ValueIndex_); } } @@ -149,17 +149,17 @@ IComputationNode* TStatefulComputationNode<IComputationNodeInterface, Serializab template <class IComputationNodeInterface, bool SerializableState> EValueRepresentation TStatefulComputationNode<IComputationNodeInterface, SerializableState>::GetRepresentation() const { - return RepresentationKind; + return RepresentationKind_; } template <class IComputationNodeInterface, bool SerializableState> void TStatefulComputationNode<IComputationNodeInterface, SerializableState>::InitNode(TComputationContext&) const {} template <class IComputationNodeInterface, bool SerializableState> -ui32 TStatefulComputationNode<IComputationNodeInterface, SerializableState>::GetIndex() const { return ValueIndex; } +ui32 TStatefulComputationNode<IComputationNodeInterface, SerializableState>::GetIndex() const { return ValueIndex_; } template <class IComputationNodeInterface, bool SerializableState> -ui32 TStatefulComputationNode<IComputationNodeInterface, SerializableState>::GetDependencesCount() const { return Dependencies.size(); } +ui32 TStatefulComputationNode<IComputationNodeInterface, SerializableState>::GetDependencesCount() const { return Dependencies_.size(); } template class TStatefulComputationNode<IComputationNode, false>; template class TStatefulComputationNode<IComputationWideFlowNode, false>; @@ -184,8 +184,8 @@ Y_NO_INLINE void TStatelessFlowComputationNodeBase::CollectDependentIndexesImpl( } Y_NO_INLINE TStatefulFlowComputationNodeBase::TStatefulFlowComputationNodeBase(ui32 stateIndex, EValueRepresentation stateKind) - : StateIndex(stateIndex) - , StateKind(stateKind) + : StateIndex_(stateIndex) + , StateKind_(stateKind) {} Y_NO_INLINE void TStatefulFlowComputationNodeBase::CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, @@ -193,16 +193,16 @@ Y_NO_INLINE void TStatefulFlowComputationNodeBase::CollectDependentIndexesImpl(c if (self == owner) return; - const auto ins = dependencies.emplace(StateIndex, StateKind); + const auto ins = dependencies.emplace(StateIndex_, StateKind_); if (ins.second && dependence) { dependence->CollectDependentIndexes(owner, dependencies); } } Y_NO_INLINE TPairStateFlowComputationNodeBase::TPairStateFlowComputationNodeBase(ui32 stateIndex, EValueRepresentation firstKind, EValueRepresentation secondKind) - : StateIndex(stateIndex) - , FirstKind(firstKind) - , SecondKind(secondKind) + : StateIndex_(stateIndex) + , FirstKind_(firstKind) + , SecondKind_(secondKind) {} Y_NO_INLINE void TPairStateFlowComputationNodeBase::CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, @@ -210,8 +210,8 @@ Y_NO_INLINE void TPairStateFlowComputationNodeBase::CollectDependentIndexesImpl( if (self == owner) return; - const auto ins1 = dependencies.emplace(StateIndex, FirstKind); - const auto ins2 = dependencies.emplace(StateIndex + 1U, SecondKind); + const auto ins1 = dependencies.emplace(StateIndex_, FirstKind_); + const auto ins2 = dependencies.emplace(StateIndex_ + 1U, SecondKind_); if (ins1.second && ins2.second && dependence) { dependence->CollectDependentIndexes(owner, dependencies); } @@ -240,8 +240,8 @@ Y_NO_INLINE NUdf::TUnboxedValue TWideFlowBaseComputationNodeBase::GetValueImpl(T } Y_NO_INLINE TStatefulWideFlowComputationNodeBase::TStatefulWideFlowComputationNodeBase(ui32 stateIndex, EValueRepresentation stateKind) - : StateIndex(stateIndex) - , StateKind(stateKind) + : StateIndex_(stateIndex) + , StateKind_(stateKind) {} Y_NO_INLINE void TStatefulWideFlowComputationNodeBase::CollectDependentIndexesImpl(const IComputationNode* self, @@ -249,7 +249,7 @@ Y_NO_INLINE void TStatefulWideFlowComputationNodeBase::CollectDependentIndexesIm if (self == owner) return; - const auto ins = dependencies.emplace(StateIndex, StateKind); + const auto ins = dependencies.emplace(StateIndex_, StateKind_); if (ins.second && dependence) { dependence->CollectDependentIndexes(owner, dependencies); } @@ -257,9 +257,9 @@ Y_NO_INLINE void TStatefulWideFlowComputationNodeBase::CollectDependentIndexesIm Y_NO_INLINE TPairStateWideFlowComputationNodeBase::TPairStateWideFlowComputationNodeBase( ui32 stateIndex, EValueRepresentation firstKind, EValueRepresentation secondKind) - : StateIndex(stateIndex) - , FirstKind(firstKind) - , SecondKind(secondKind) + : StateIndex_(stateIndex) + , FirstKind_(firstKind) + , SecondKind_(secondKind) {} Y_NO_INLINE void TPairStateWideFlowComputationNodeBase::CollectDependentIndexesImpl( @@ -268,16 +268,16 @@ Y_NO_INLINE void TPairStateWideFlowComputationNodeBase::CollectDependentIndexesI if (self == owner) return; - const auto ins1 = dependencies.emplace(StateIndex, FirstKind); - const auto ins2 = dependencies.emplace(StateIndex + 1U, SecondKind); + const auto ins1 = dependencies.emplace(StateIndex_, FirstKind_); + const auto ins2 = dependencies.emplace(StateIndex_ + 1U, SecondKind_); if (ins1.second && ins2.second && dependence) { dependence->CollectDependentIndexes(owner, dependencies); } } Y_NO_INLINE TDecoratorComputationNodeBase::TDecoratorComputationNodeBase(IComputationNode* node, EValueRepresentation kind) - : Node(node) - , Kind(kind) + : Node_(node) + , Kind_(kind) {} Y_NO_INLINE ui32 TDecoratorComputationNodeBase::GetIndexImpl() const { @@ -285,13 +285,13 @@ Y_NO_INLINE ui32 TDecoratorComputationNodeBase::GetIndexImpl() const { } Y_NO_INLINE TString TDecoratorComputationNodeBase::DebugStringImpl(const TString& typeName) const { - return typeName + "(" + Node->DebugString() + ")"; + return typeName + "(" + Node_->DebugString() + ")"; } Y_NO_INLINE TBinaryComputationNodeBase::TBinaryComputationNodeBase(IComputationNode* left, IComputationNode* right, EValueRepresentation kind) - : Left(left) - , Right(right) - , Kind(kind) + : Left_(left) + , Right_(right) + , Kind_(kind) {} Y_NO_INLINE ui32 TBinaryComputationNodeBase::GetIndexImpl() const { @@ -299,21 +299,21 @@ Y_NO_INLINE ui32 TBinaryComputationNodeBase::GetIndexImpl() const { } Y_NO_INLINE TString TBinaryComputationNodeBase::DebugStringImpl(const TString& typeName) const { - return typeName + "(" + Left->DebugString() + "," + Right->DebugString() + ")"; + return typeName + "(" + Left_->DebugString() + "," + Right_->DebugString() + ")"; } void TExternalComputationNode::CollectDependentIndexes(const IComputationNode*, TIndexesMap& map) const { - map.emplace(ValueIndex, RepresentationKind); + map.emplace(ValueIndex_, RepresentationKind_); } TExternalComputationNode::TExternalComputationNode(TComputationMutables& mutables, EValueRepresentation kind) : TStatefulComputationNode(mutables, kind) { - mutables.CachedValues.push_back(ValueIndex); + mutables.CachedValues.push_back(ValueIndex_); } NUdf::TUnboxedValue TExternalComputationNode::GetValue(TComputationContext& ctx) const { - return Getter ? Getter(ctx) : ValueRef(ctx); + return Getter_ ? Getter_(ctx) : ValueRef(ctx); } NUdf::TUnboxedValue& TExternalComputationNode::RefValue(TComputationContext& ctx) const { @@ -333,22 +333,22 @@ TString TExternalComputationNode::DebugString() const { void TExternalComputationNode::RegisterDependencies() const {} void TExternalComputationNode::SetOwner(const IComputationNode* owner) { - Y_DEBUG_ABORT_UNLESS(!Owner); - Owner = owner; + Y_DEBUG_ABORT_UNLESS(!Owner_); + Owner_ = owner; } void TExternalComputationNode::PrepareStageOne() { - std::sort(Dependencies.begin(), Dependencies.end()); - Dependencies.erase(std::unique(Dependencies.begin(), Dependencies.end()), Dependencies.cend()); - if (const auto it = std::find(Dependencies.cbegin(), Dependencies.cend(), Owner); Dependencies.cend() != it) - Dependencies.erase(it); + std::sort(Dependencies_.begin(), Dependencies_.end()); + Dependencies_.erase(std::unique(Dependencies_.begin(), Dependencies_.end()), Dependencies_.cend()); + if (const auto it = std::find(Dependencies_.cbegin(), Dependencies_.cend(), Owner_); Dependencies_.cend() != it) + Dependencies_.erase(it); } void TExternalComputationNode::PrepareStageTwo() { TIndexesMap dependencies; - std::for_each(Dependencies.cbegin(), Dependencies.cend(), - std::bind(&IComputationNode::CollectDependentIndexes, std::placeholders::_1, Owner, std::ref(dependencies))); - InvalidationSet.assign(dependencies.cbegin(), dependencies.cend()); + std::for_each(Dependencies_.cbegin(), Dependencies_.cend(), + std::bind(&IComputationNode::CollectDependentIndexes, std::placeholders::_1, Owner_, std::ref(dependencies))); + InvalidationSet_.assign(dependencies.cbegin(), dependencies.cend()); } const IComputationNode* TExternalComputationNode::GetSource() const { return nullptr; } @@ -356,15 +356,15 @@ const IComputationNode* TExternalComputationNode::GetSource() const { return nul ui32 TExternalComputationNode::GetDependencyWeight() const { return 0U; } bool TExternalComputationNode::IsTemporaryValue() const { - return bool(Getter); + return bool(Getter_); } void TExternalComputationNode::SetGetter(TGetter&& getter) { - Getter = std::move(getter); + Getter_ = std::move(getter); } void TExternalComputationNode::InvalidateValue(TComputationContext& ctx) const { - for (const auto& index : InvalidationSet) { + for (const auto& index : InvalidationSet_) { ctx.MutableValues[index.first] = NUdf::TUnboxedValuePod::Invalid(); } } @@ -609,12 +609,12 @@ ui32 TWideFlowProxyComputationNode::GetDependencyWeight() const { } ui32 TWideFlowProxyComputationNode::GetDependencesCount() const { - return Dependence ? 1U : 0U; + return Dependence_ ? 1U : 0U; } IComputationNode* TWideFlowProxyComputationNode::AddDependence(const IComputationNode* node) { - Y_DEBUG_ABORT_UNLESS(!Dependence); - Dependence = node; + Y_DEBUG_ABORT_UNLESS(!Dependence_); + Dependence_ = node; return this; } @@ -627,16 +627,16 @@ void TWideFlowProxyComputationNode::RegisterDependencies() const {} void TWideFlowProxyComputationNode::PrepareStageOne() {} void TWideFlowProxyComputationNode::PrepareStageTwo() { - if (Dependence) { + if (Dependence_) { TIndexesMap dependencies; - Dependence->CollectDependentIndexes(Owner, dependencies); - InvalidationSet.assign(dependencies.cbegin(), dependencies.cend()); + Dependence_->CollectDependentIndexes(Owner_, dependencies); + InvalidationSet_.assign(dependencies.cbegin(), dependencies.cend()); } } void TWideFlowProxyComputationNode::SetOwner(const IComputationNode* owner) { - Y_DEBUG_ABORT_UNLESS(!Owner); - Owner = owner; + Y_DEBUG_ABORT_UNLESS(!Owner_); + Owner_ = owner; } void TWideFlowProxyComputationNode::CollectDependentIndexes(const IComputationNode*, TIndexesMap&) const { @@ -644,17 +644,17 @@ void TWideFlowProxyComputationNode::CollectDependentIndexes(const IComputationNo } void TWideFlowProxyComputationNode::InvalidateValue(TComputationContext& ctx) const { - for (const auto& index : InvalidationSet) { + for (const auto& index : InvalidationSet_) { ctx.MutableValues[index.first] = NUdf::TUnboxedValuePod::Invalid(); } } void TWideFlowProxyComputationNode::SetFetcher(TFetcher&& fetcher) { - Fetcher = std::move(fetcher); + Fetcher_ = std::move(fetcher); } EFetchResult TWideFlowProxyComputationNode::FetchValues(TComputationContext& ctx, NUdf::TUnboxedValue*const* values) const { - return Fetcher(ctx, values); + return Fetcher_(ctx, values); } IComputationNode* LocateNode(const TNodeLocator& nodeLocator, TCallable& callable, ui32 index, bool pop) { diff --git a/yql/essentials/minikql/computation/mkql_computation_node_impl.h b/yql/essentials/minikql/computation/mkql_computation_node_impl.h index 92e2c76c6e4..7093829ed27 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_impl.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_impl.h @@ -69,10 +69,10 @@ private: EValueRepresentation GetRepresentation() const final; - TMemoryUsageInfo *const MemInfo; + TMemoryUsageInfo *const MemInfo_; protected: - const NUdf::TUnboxedValue UnboxedValue; - const EValueRepresentation RepresentationKind; + const NUdf::TUnboxedValue UnboxedValue_; + const EValueRepresentation RepresentationKind_; }; class TStatefulComputationNodeBase { @@ -83,10 +83,10 @@ protected: void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies, bool stateless) const; - TConstComputationNodePtrVector Dependencies; + TConstComputationNodePtrVector Dependencies_; - const ui32 ValueIndex; - const EValueRepresentation RepresentationKind; + const ui32 ValueIndex_; + const EValueRepresentation RepresentationKind_; }; template <class IComputationNodeInterface, bool SerializableState = false> @@ -105,7 +105,7 @@ protected: EValueRepresentation GetRepresentation() const override; NUdf::TUnboxedValue& ValueRef(TComputationContext& compCtx) const { - return compCtx.MutableValues[ValueIndex]; + return compCtx.MutableValues[ValueIndex_]; } private: @@ -139,7 +139,7 @@ private: bool IsTemporaryValue() const final; - const IComputationNode* Owner = nullptr; + const IComputationNode* Owner_ = nullptr; void SetGetter(TGetter&& getter) final; @@ -147,8 +147,8 @@ private: const IComputationNode* GetSource() const final; protected: - std::vector<std::pair<ui32, EValueRepresentation>> InvalidationSet; - TGetter Getter; + std::vector<std::pair<ui32, EValueRepresentation>> InvalidationSet_; + TGetter Getter_; }; class TStatefulSourceComputationNodeBase { @@ -158,8 +158,8 @@ protected: void PrepareStageOneImpl(const TConstComputationNodePtrVector& dependencies); void AddSource(IComputationNode* source) const; - mutable std::unordered_set<const IComputationNode*> Sources; // TODO: remove const and mutable. - std::optional<bool> Stateless; + mutable std::unordered_set<const IComputationNode*> Sources_; // TODO: remove const and mutable. + std::optional<bool> Stateless_; }; template <typename TDerived, bool SerializableState = false> @@ -169,21 +169,21 @@ class TStatefulSourceComputationNode: public TStatefulComputationNode<IComputati using TStatefulComputationNode = TStatefulComputationNode<IComputationNode, SerializableState>; private: bool IsTemporaryValue() const final { - return *Stateless; + return *Stateless_; } ui32 GetDependencyWeight() const final { - return Sources.size(); + return Sources_.size(); } void PrepareStageOne() final { - PrepareStageOneImpl(this->Dependencies); + PrepareStageOneImpl(this->Dependencies_); } void PrepareStageTwo() final {} void CollectDependentIndexes(const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies) const final { - this->CollectDependentIndexesImpl(this, owner, dependencies, *Stateless); + this->CollectDependentIndexesImpl(this, owner, dependencies, *Stateless_); } const IComputationNode* GetSource() const final { return this; } @@ -217,7 +217,7 @@ protected: using TStatefulSourceComputationNode<TDerived>::TStatefulSourceComputationNode; NUdf::TUnboxedValue GetValue(TComputationContext& compCtx) const override { - if (*this->Stateless) + if (*this->Stateless_) return static_cast<const TDerived*>(this)->DoCalculate(compCtx); NUdf::TUnboxedValue& valueRef = this->ValueRef(compCtx); if (valueRef.IsInvalid()) { @@ -244,7 +244,7 @@ protected: void DependsOn(IComputationNode* node) const { if (node) { if (const auto source = node->AddDependence(this)) { - Sources.emplace(source); + Sources_.emplace(source); } } } @@ -260,7 +260,7 @@ private: } ui32 GetDependencyWeight() const final { - return this->Dependencies.size() + Sources.size(); + return this->Dependencies_.size() + Sources_.size(); } void CollectDependentIndexes(const IComputationNode* owner, IComputationExternalNode::TIndexesMap& dependencies) const final { @@ -272,7 +272,7 @@ private: const IComputationNode* GetSource() const final { return this; } - mutable std::unordered_set<const IComputationNode*> Sources; // TODO: remove const and mutable. + mutable std::unordered_set<const IComputationNode*> Sources_; // TODO: remove const and mutable. }; template <typename TDerived> @@ -281,19 +281,19 @@ class TFlowSourceComputationNode: public TFlowSourceBaseComputationNode<TDerived using TBase = TFlowSourceBaseComputationNode<TDerived, IComputationNode>; protected: TFlowSourceComputationNode(TComputationMutables& mutables, EValueRepresentation kind, EValueRepresentation stateKind) - : TBase(mutables, stateKind), RepresentationKind(kind) + : TBase(mutables, stateKind), RepresentationKind_(kind) {} private: EValueRepresentation GetRepresentation() const final { - return RepresentationKind; + return RepresentationKind_; } NUdf::TUnboxedValue GetValue(TComputationContext& compCtx) const final { return static_cast<const TDerived*>(this)->DoCalculate(this->ValueRef(compCtx), compCtx); } private: - const EValueRepresentation RepresentationKind; + const EValueRepresentation RepresentationKind_; }; template <typename TDerived> @@ -322,7 +322,7 @@ template <typename TDerived, typename IFlowInterface> class TFlowBaseComputationNode: public TRefCountedComputationNode<IFlowInterface> { protected: - TFlowBaseComputationNode(const IComputationNode* source) : Source(source) {} + TFlowBaseComputationNode(const IComputationNode* source) : Source_(source) {} void InitNode(TComputationContext&) const override {} @@ -395,12 +395,12 @@ private: ui32 GetDependencyWeight() const final { return 42U; } ui32 GetDependencesCount() const final { - return Dependence ? 1U : 0U; + return Dependence_ ? 1U : 0U; } IComputationNode* AddDependence(const IComputationNode* node) final { - if (!Dependence) { - Dependence = node; + if (!Dependence_) { + Dependence_ = node; } return this; } @@ -413,14 +413,14 @@ private: void PrepareStageTwo() final {} const IComputationNode* GetSource() const final { - if (Source && Source != this) - if (const auto s = Source->GetSource()) + if (Source_ && Source_ != this) + if (const auto s = Source_->GetSource()) return s; return this; } protected: - const IComputationNode *const Source; - const IComputationNode *Dependence = nullptr; + const IComputationNode *const Source_; + const IComputationNode *Dependence_ = nullptr; }; template <typename TDerived> @@ -428,20 +428,20 @@ class TBaseFlowBaseComputationNode: public TFlowBaseComputationNode<TDerived, IC { protected: TBaseFlowBaseComputationNode(const IComputationNode* source, EValueRepresentation kind) - : TFlowBaseComputationNode<TDerived, IComputationNode>(source), RepresentationKind(kind) + : TFlowBaseComputationNode<TDerived, IComputationNode>(source), RepresentationKind_(kind) {} private: EValueRepresentation GetRepresentation() const final { - return RepresentationKind; + return RepresentationKind_; } - const EValueRepresentation RepresentationKind; + const EValueRepresentation RepresentationKind_; }; class TStatelessFlowComputationNodeBase { protected: ui32 GetIndexImpl() const; - void CollectDependentIndexesImpl(const IComputationNode* self, + void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies, const IComputationNode* dependence) const; }; @@ -467,18 +467,18 @@ private: } void CollectDependentIndexes(const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies) const final { - CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence); + CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence_); } }; class TStatefulFlowComputationNodeBase { protected: TStatefulFlowComputationNodeBase(ui32 stateIndex, EValueRepresentation stateKind); - void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, + void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies, const IComputationNode* dependence) const; - const ui32 StateIndex; - const EValueRepresentation StateKind; + const ui32 StateIndex_; + const EValueRepresentation StateKind_; }; template <typename TDerived, bool SerializableState = false> @@ -489,7 +489,7 @@ protected: : TBaseFlowBaseComputationNode<TDerived>(source, kind), TStatefulFlowComputationNodeBase(mutables.CurValueIndex++, stateKind) { if constexpr (SerializableState) { - mutables.SerializableValues.push_back(StateIndex); + mutables.SerializableValues.push_back(StateIndex_); } } @@ -499,15 +499,15 @@ protected: private: ui32 GetIndex() const final { - return StateIndex; + return StateIndex_; } NUdf::TUnboxedValue GetValue(TComputationContext& compCtx) const final { - return static_cast<const TDerived*>(this)->DoCalculate(compCtx.MutableValues[StateIndex], compCtx); + return static_cast<const TDerived*>(this)->DoCalculate(compCtx.MutableValues[StateIndex_], compCtx); } void CollectDependentIndexes(const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies) const final { - CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence); + CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence_); } }; @@ -516,11 +516,11 @@ const IComputationNode* GetCommonSource(const IComputationNode* first, const ICo class TPairStateFlowComputationNodeBase { protected: TPairStateFlowComputationNodeBase(ui32 stateIndex, EValueRepresentation firstKind, EValueRepresentation secondKind); - void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, + void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies, const IComputationNode* dependence) const; - const ui32 StateIndex; - const EValueRepresentation FirstKind, SecondKind; + const ui32 StateIndex_; + const EValueRepresentation FirstKind_, SecondKind_; }; template <typename TDerived> @@ -535,15 +535,15 @@ protected: private: NUdf::TUnboxedValue GetValue(TComputationContext& compCtx) const final { - return static_cast<const TDerived*>(this)->DoCalculate(compCtx.MutableValues[StateIndex], compCtx.MutableValues[StateIndex + 1U], compCtx); + return static_cast<const TDerived*>(this)->DoCalculate(compCtx.MutableValues[StateIndex_], compCtx.MutableValues[StateIndex_ + 1U], compCtx); } ui32 GetIndex() const final { - return StateIndex; + return StateIndex_; } void CollectDependentIndexes(const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies) const final { - CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence); + CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence_); } }; @@ -589,10 +589,10 @@ private: EFetchResult FetchValues(TComputationContext& ctx, NUdf::TUnboxedValue*const* values) const final; protected: - const IComputationNode* Dependence = nullptr; - const IComputationNode* Owner = nullptr; - std::vector<std::pair<ui32, EValueRepresentation>> InvalidationSet; - TFetcher Fetcher; + const IComputationNode* Dependence_ = nullptr; + const IComputationNode* Owner_ = nullptr; + std::vector<std::pair<ui32, EValueRepresentation>> InvalidationSet_; + TFetcher Fetcher_; }; class TWideFlowBaseComputationNodeBase { @@ -602,7 +602,7 @@ protected: }; template <typename TDerived> -class TWideFlowBaseComputationNode: public TFlowBaseComputationNode<TDerived, IComputationWideFlowNode>, +class TWideFlowBaseComputationNode: public TFlowBaseComputationNode<TDerived, IComputationWideFlowNode>, protected TWideFlowBaseComputationNodeBase { protected: @@ -622,7 +622,7 @@ private: class TStatelessWideFlowComputationNodeBase { protected: ui32 GetIndexImpl() const; - void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, + void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies, const IComputationNode* dependence) const; }; @@ -644,7 +644,7 @@ private: } void CollectDependentIndexes(const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies) const final { - CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence); + CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence_); } }; @@ -654,8 +654,8 @@ protected: void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies, const IComputationNode* dependence) const; - const ui32 StateIndex; - const EValueRepresentation StateKind; + const ui32 StateIndex_; + const EValueRepresentation StateKind_; }; template <typename TDerived, bool SerializableState = false> @@ -666,7 +666,7 @@ protected: : TWideFlowBaseComputationNode<TDerived>(source), TStatefulWideFlowComputationNodeBase(mutables.CurValueIndex++, stateKind) { if constexpr (SerializableState) { - mutables.SerializableValues.push_back(StateIndex); + mutables.SerializableValues.push_back(StateIndex_); } } @@ -675,26 +675,26 @@ protected: } private: EFetchResult FetchValues(TComputationContext& compCtx, NUdf::TUnboxedValue*const* values) const final { - return static_cast<const TDerived*>(this)->DoCalculate(compCtx.MutableValues[StateIndex], compCtx, values); + return static_cast<const TDerived*>(this)->DoCalculate(compCtx.MutableValues[StateIndex_], compCtx, values); } ui32 GetIndex() const final { - return StateIndex; + return StateIndex_; } void CollectDependentIndexes(const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies) const final { - CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence); + CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence_); } }; class TPairStateWideFlowComputationNodeBase { protected: TPairStateWideFlowComputationNodeBase(ui32 stateIndex, EValueRepresentation firstKind, EValueRepresentation secondKind); - void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, - IComputationNode::TIndexesMap& dependencies, const IComputationNode* dependence) const; + void CollectDependentIndexesImpl(const IComputationNode* self, const IComputationNode* owner, + IComputationNode::TIndexesMap& dependencies, const IComputationNode* dependence) const; - const ui32 StateIndex; - const EValueRepresentation FirstKind, SecondKind; + const ui32 StateIndex_; + const EValueRepresentation FirstKind_, SecondKind_; }; template <typename TDerived> @@ -709,15 +709,15 @@ protected: private: EFetchResult FetchValues(TComputationContext& compCtx, NUdf::TUnboxedValue*const* values) const final { - return static_cast<const TDerived*>(this)->DoCalculate(compCtx.MutableValues[StateIndex], compCtx.MutableValues[StateIndex + 1U], compCtx, values); + return static_cast<const TDerived*>(this)->DoCalculate(compCtx.MutableValues[StateIndex_], compCtx.MutableValues[StateIndex_ + 1U], compCtx, values); } ui32 GetIndex() const final { - return StateIndex; + return StateIndex_; } void CollectDependentIndexes(const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies) const final { - CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence); + CollectDependentIndexesImpl(this, owner, dependencies, this->Dependence_); } }; @@ -727,8 +727,8 @@ protected: ui32 GetIndexImpl() const; TString DebugStringImpl(const TString& typeName) const; - IComputationNode *const Node; - const EValueRepresentation Kind; + IComputationNode *const Node_; + const EValueRepresentation Kind_; }; template <typename TDerived> @@ -737,26 +737,26 @@ class TDecoratorComputationNode: public TRefCountedComputationNode<IComputationN private: void InitNode(TComputationContext&) const final {} - const IComputationNode* GetSource() const final { return Node; } + const IComputationNode* GetSource() const final { return Node_; } IComputationNode* AddDependence(const IComputationNode* node) final { - return Node->AddDependence(node); + return Node_->AddDependence(node); } - EValueRepresentation GetRepresentation() const final { return Kind; } + EValueRepresentation GetRepresentation() const final { return Kind_; } bool IsTemporaryValue() const final { return true; } void PrepareStageOne() final {} void PrepareStageTwo() final {} - void RegisterDependencies() const final { Node->AddDependence(this); } + void RegisterDependencies() const final { Node_->AddDependence(this); } void CollectDependentIndexes(const IComputationNode*, TIndexesMap&) const final {} ui32 GetDependencyWeight() const final { return 0U; } ui32 GetDependencesCount() const final { - return Node->GetDependencesCount(); + return Node_->GetDependencesCount(); } ui32 GetIndex() const final { @@ -764,7 +764,7 @@ private: } NUdf::TUnboxedValue GetValue(TComputationContext& compCtx) const final { - return static_cast<const TDerived*>(this)->DoCalculate(compCtx, Node->GetValue(compCtx)); + return static_cast<const TDerived*>(this)->DoCalculate(compCtx, Node_->GetValue(compCtx)); } protected: @@ -788,9 +788,9 @@ protected: ui32 GetIndexImpl() const; TString DebugStringImpl(const TString& typeName) const; - IComputationNode *const Left; - IComputationNode *const Right; - const EValueRepresentation Kind; + IComputationNode *const Left_; + IComputationNode *const Right_; + const EValueRepresentation Kind_; }; template <typename TDerived> @@ -802,7 +802,7 @@ private: } const IComputationNode* GetSource() const final { - return GetCommonSource(Left, Right, this); + return GetCommonSource(Left_, Right_, this); } void InitNode(TComputationContext&) const final {} @@ -812,8 +812,8 @@ protected: } IComputationNode* AddDependence(const IComputationNode* node) final { - const auto l = Left->AddDependence(node); - const auto r = Right->AddDependence(node); + const auto l = Left_->AddDependence(node); + const auto r = Right_->AddDependence(node); if (!l) return r; if (!r) return l; @@ -822,7 +822,7 @@ protected: } EValueRepresentation GetRepresentation() const final { - return Kind; + return Kind_; } bool IsTemporaryValue() const final { return true; } @@ -831,8 +831,8 @@ protected: void PrepareStageTwo() final {} void RegisterDependencies() const final { - Left->AddDependence(this); - Right->AddDependence(this); + Left_->AddDependence(this); + Right_->AddDependence(this); } void CollectDependentIndexes(const IComputationNode*, TIndexesMap&) const final {} @@ -840,7 +840,7 @@ protected: ui32 GetDependencyWeight() const final { return 0U; } ui32 GetDependencesCount() const final { - return Left->GetDependencesCount() + Right->GetDependencesCount(); + return Left_->GetDependencesCount() + Right_->GetDependencesCount(); } ui32 GetIndex() const final { diff --git a/yql/essentials/minikql/computation/mkql_computation_node_list.h b/yql/essentials/minikql/computation/mkql_computation_node_list.h index 66faa760448..0e2a744deb6 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_list.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_list.h @@ -125,47 +125,47 @@ namespace NKikimr { struct TIterator { TIterator() - : Owner_(nullptr) - , Position_(nullptr) + : Owner(nullptr) + , Position(nullptr) {} TIterator(const TListRepresentation& owner) - : Owner_(&owner) - , Position_(owner.Begin_) + : Owner(&owner) + , Position(owner.Begin_) { } TIterator(const TIterator& other) - : Owner_(other.Owner_) - , Position_(other.Position_) + : Owner(other.Owner) + , Position(other.Position) {} TIterator& operator=(const TIterator& other) { - Owner_ = other.Owner_; - Position_ = other.Position_; + Owner = other.Owner; + Position = other.Position; return *this; } bool AtEnd() const { - return Position_ == Owner_->End_; + return Position == Owner->End_; } const T& Current() const { - return *Position_; + return *Position; } // use with care, list may be shared T& MutableCurrent() { - return *Position_; + return *Position; } void Next() { - Position_++; + Position++; } - const TListRepresentation* Owner_; - T* Position_; + const TListRepresentation* Owner; + T* Position; }; struct TReverseIterator { @@ -182,8 +182,8 @@ namespace NKikimr { } TReverseIterator(const TIterator& other) - : Owner_(other.Owner_) - , Position_(other.Position_) + : Owner_(other.Owner) + , Position_(other.Position) { } diff --git a/yql/essentials/minikql/computation/mkql_computation_node_pack_ut.cpp b/yql/essentials/minikql/computation/mkql_computation_node_pack_ut.cpp index 19bca68b95f..b13acb40a62 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_pack_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_pack_ut.cpp @@ -59,13 +59,13 @@ class TMiniKQLComputationNodePackTest: public TTestBase { using TValuePackerType = typename TPackerTraits<Fast, Transport>::TPackerType; protected: TMiniKQLComputationNodePackTest() - : FunctionRegistry(CreateFunctionRegistry(CreateBuiltinRegistry())) - , RandomProvider(CreateDefaultRandomProvider()) - , Alloc(__LOCATION__) - , Env(Alloc) - , PgmBuilder(Env, *FunctionRegistry) - , MemInfo("Memory") - , HolderFactory(Alloc.Ref(), MemInfo, FunctionRegistry.Get()) + : FunctionRegistry_(CreateFunctionRegistry(CreateBuiltinRegistry())) + , RandomProvider_(CreateDefaultRandomProvider()) + , Alloc_(__LOCATION__) + , Env_(Alloc_) + , PgmBuilder_(Env_, *FunctionRegistry_) + , MemInfo_("Memory") + , HolderFactory_(Alloc_.Ref(), MemInfo_, FunctionRegistry_.Get()) , ArrowPool_(NYql::NUdf::GetYqlMemoryPool()) { } @@ -111,8 +111,8 @@ protected: for (ui32 val: xrange(0, 10)) { listValues = listValues.Append(NUdf::TUnboxedValuePod(val)); } - TType* listType = PgmBuilder.NewListType(PgmBuilder.NewDataType(NUdf::TDataType<ui32>::Id)); - const NUdf::TUnboxedValue value = HolderFactory.CreateDirectListHolder(std::move(listValues)); + TType* listType = PgmBuilder_.NewListType(PgmBuilder_.NewDataType(NUdf::TDataType<ui32>::Id)); + const NUdf::TUnboxedValue value = HolderFactory_.CreateDirectListHolder(std::move(listValues)); const auto uValue = TestPackUnpack(listType, value, "Type:List(ui32)"); UNIT_ASSERT_VALUES_EQUAL(uValue.GetListLength(), 10); @@ -133,8 +133,8 @@ protected: } listValues = listValues.Append(std::move(uVal)); } - TType* listType = PgmBuilder.NewListType(PgmBuilder.NewOptionalType(PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id))); - const NUdf::TUnboxedValue value = HolderFactory.CreateDirectListHolder(std::move(listValues)); + TType* listType = PgmBuilder_.NewListType(PgmBuilder_.NewOptionalType(PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id))); + const NUdf::TUnboxedValue value = HolderFactory_.CreateDirectListHolder(std::move(listValues)); const auto uValue = TestPackUnpack(listType, value, "Type:List(Optional(utf8))"); UNIT_ASSERT_VALUES_EQUAL(uValue.GetListLength(), 10); @@ -153,13 +153,13 @@ protected: void TestTupleType() { std::vector<TType*> tupleElemenTypes; - tupleElemenTypes.push_back(PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[0])); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[0])); - tupleElemenTypes.push_back(PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id)); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[3])); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[3])); - TType* tupleType = PgmBuilder.NewTupleType(tupleElemenTypes); + tupleElemenTypes.push_back(PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[0])); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[0])); + tupleElemenTypes.push_back(PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id)); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[3])); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[3])); + TType* tupleType = PgmBuilder_.NewTupleType(tupleElemenTypes); TUnboxedValueVector tupleElemens; tupleElemens.push_back(MakeString("01234567890123456789")); @@ -169,7 +169,7 @@ protected: tupleElemens.push_back(NUdf::TUnboxedValuePod()); tupleElemens.push_back(NUdf::TUnboxedValuePod(ui64(12345))); - const NUdf::TUnboxedValue value = HolderFactory.VectorAsArray(tupleElemens); + const NUdf::TUnboxedValue value = HolderFactory_.VectorAsArray(tupleElemens); const auto uValue = TestPackUnpack(tupleType, value, "Type:Tuple"); { @@ -202,14 +202,14 @@ protected: void TestStructType() { const std::vector<std::pair<std::string_view, TType*>> structElemenTypes = { - {"a", PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)}, - {"b", PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id, true)}, - {"c", PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id, true)}, - {"d", PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id)}, - {"e", PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id, true)}, - {"f", PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id, true)} + {"a", PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)}, + {"b", PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id, true)}, + {"c", PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id, true)}, + {"d", PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id)}, + {"e", PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id, true)}, + {"f", PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id, true)} }; - TType* structType = PgmBuilder.NewStructType(structElemenTypes); + TType* structType = PgmBuilder_.NewStructType(structElemenTypes); TUnboxedValueVector structElemens; structElemens.push_back(MakeString("01234567890123456789")); @@ -219,7 +219,7 @@ protected: structElemens.push_back(NUdf::TUnboxedValuePod()); structElemens.push_back(NUdf::TUnboxedValuePod(ui64(12345))); - const NUdf::TUnboxedValue value = HolderFactory.VectorAsArray(structElemens); + const NUdf::TUnboxedValue value = HolderFactory_.VectorAsArray(structElemens); const auto uValue = TestPackUnpack(structType, value, "Type:Struct"); { @@ -251,10 +251,10 @@ protected: } void TestOptionalType() { - TType* type = PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id); - type = PgmBuilder.NewOptionalType(type); - type = PgmBuilder.NewOptionalType(type); - type = PgmBuilder.NewOptionalType(type); + TType* type = PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id); + type = PgmBuilder_.NewOptionalType(type); + type = PgmBuilder_.NewOptionalType(type); + type = PgmBuilder_.NewOptionalType(type); NUdf::TUnboxedValue uValue = NUdf::TUnboxedValuePod(); uValue = TestPackUnpack(type, uValue, "Type:Optional, Value:null"); @@ -280,15 +280,15 @@ protected: } void TestDictType() { - TType* keyType = PgmBuilder.NewDataType(NUdf::TDataType<ui32>::Id); - TType* payloadType = PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id); - TType* dictType = PgmBuilder.NewDictType(keyType, payloadType, false); + TType* keyType = PgmBuilder_.NewDataType(NUdf::TDataType<ui32>::Id); + TType* payloadType = PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id); + TType* dictType = PgmBuilder_.NewDictType(keyType, payloadType, false); TValuesDictHashSingleFixedMap<ui32> map; map[4] = NUdf::TUnboxedValuePod::Embedded("4"); map[10] = NUdf::TUnboxedValuePod::Embedded("10"); map[1] = NUdf::TUnboxedValuePod::Embedded("1"); - const NUdf::TUnboxedValue value = HolderFactory.CreateDirectHashedSingleFixedMapHolder<ui32, false>(std::move(map), std::nullopt); + const NUdf::TUnboxedValue value = HolderFactory_.CreateDirectHashedSingleFixedMapHolder<ui32, false>(std::move(map), std::nullopt); const auto uValue = TestPackUnpack(dictType, value, "Type:Dict"); @@ -301,21 +301,21 @@ protected: void TestVariantTypeOverStruct() { const std::vector<std::pair<std::string_view, TType*>> structElemenTypes = { - {"a", PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)}, - {"b", PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id, true)}, - {"d", PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id)} + {"a", PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)}, + {"b", PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id, true)}, + {"d", PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id)} }; - TType* structType = PgmBuilder.NewStructType(structElemenTypes); - TestVariantTypeImpl(PgmBuilder.NewVariantType(structType)); + TType* structType = PgmBuilder_.NewStructType(structElemenTypes); + TestVariantTypeImpl(PgmBuilder_.NewVariantType(structType)); } void TestVariantTypeOverTuple() { std::vector<TType*> tupleElemenTypes; - tupleElemenTypes.push_back(PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[0])); - tupleElemenTypes.push_back(PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id)); - TType* tupleType = PgmBuilder.NewTupleType(tupleElemenTypes); - TestVariantTypeImpl(PgmBuilder.NewVariantType(tupleType)); + tupleElemenTypes.push_back(PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[0])); + tupleElemenTypes.push_back(PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id)); + TType* tupleType = PgmBuilder_.NewTupleType(tupleElemenTypes); + TestVariantTypeImpl(PgmBuilder_.NewVariantType(tupleType)); } void ValidateEmbeddedLength(TChunkedBuffer buf, const TString& info) { @@ -359,13 +359,13 @@ protected: UNIT_ASSERT_VALUES_EQUAL_C(packedValue.Size(), *expectedLength, additionalMsg); } ValidateEmbeddedLength(packedValue, additionalMsg); - return packer.Unpack(std::move(packedValue), HolderFactory); + return packer.Unpack(std::move(packedValue), HolderFactory_); } else { if (expectedLength) { UNIT_ASSERT_VALUES_EQUAL_C(packedValue.Size(), *expectedLength, additionalMsg); } ValidateEmbeddedLength(packedValue, additionalMsg); - return packer.Unpack(packedValue, HolderFactory); + return packer.Unpack(packedValue, HolderFactory_); } } @@ -386,7 +386,7 @@ protected: template <typename T> void TestNumericType(NUdf::TDataTypeId schemeType) { TString typeDesc = TStringBuilder() << ", Type:" << NUdf::GetDataTypeInfo(NUdf::GetDataSlot(schemeType)).Name; - TValuePackerType packer(false, PgmBuilder.NewDataType(schemeType)); + TValuePackerType packer(false, PgmBuilder_.NewDataType(schemeType)); TestNumericValue<T>(Max<T>(), packer, typeDesc); TestNumericValue<T>(Min<T>(), packer, typeDesc); @@ -411,7 +411,7 @@ protected: template <typename T> void TestOptionalNumericType(NUdf::TDataTypeId schemeType) { TString typeDesc = TStringBuilder() << ", Type:Optional(" << NUdf::GetDataTypeInfo(NUdf::GetDataSlot(schemeType)).Name; - TValuePackerType packer(false, PgmBuilder.NewOptionalType(PgmBuilder.NewDataType(schemeType))); + TValuePackerType packer(false, PgmBuilder_.NewOptionalType(PgmBuilder_.NewDataType(schemeType))); TestOptionalNumericValue<T>(std::optional<T>(Max<T>()), packer, typeDesc); TestOptionalNumericValue<T>(std::optional<T>(Min<T>()), packer, typeDesc); TestOptionalNumericValue<T>(std::optional<T>(), packer, typeDesc, 1); @@ -428,7 +428,7 @@ protected: void TestStringType(NUdf::TDataTypeId schemeType) { TString typeDesc = TStringBuilder() << ", Type:" << NUdf::GetDataTypeInfo(NUdf::GetDataSlot(schemeType)).Name; - TValuePackerType packer(false, PgmBuilder.NewDataType(schemeType)); + TValuePackerType packer(false, PgmBuilder_.NewDataType(schemeType)); TestStringValue("0123456789012345678901234567890123456789", packer, typeDesc, 40 + 4); TestStringValue("[]", packer, typeDesc, Fast ? (2 + 4) : (2 + 1)); TestStringValue("1234567", packer, typeDesc, Fast ? (7 + 4) : (7 + 1)); @@ -442,7 +442,7 @@ protected: void TestUuidType() { auto schemeType = NUdf::TDataType<NUdf::TUuid>::Id; TString typeDesc = TStringBuilder() << ", Type:" << NUdf::GetDataTypeInfo(NUdf::GetDataSlot(schemeType)).Name; - TValuePackerType packer(false, PgmBuilder.NewDataType(schemeType)); + TValuePackerType packer(false, PgmBuilder_.NewDataType(schemeType)); TestStringValue("0123456789abcdef", packer, typeDesc, Fast ? 16 : (16 + 4)); } @@ -459,7 +459,7 @@ protected: void TestOptionalStringType(NUdf::TDataTypeId schemeType) { TString typeDesc = TStringBuilder() << ", Type:Optional(" << NUdf::GetDataTypeInfo(NUdf::GetDataSlot(schemeType)).Name; - TValuePackerType packer(false, PgmBuilder.NewOptionalType(PgmBuilder.NewDataType(schemeType))); + TValuePackerType packer(false, PgmBuilder_.NewOptionalType(PgmBuilder_.NewDataType(schemeType))); TestOptionalStringValue("0123456789012345678901234567890123456789", packer, typeDesc, Fast ? (40 + 4 + 1) : (40 + 4)); TestOptionalStringValue(std::nullopt, packer, typeDesc, 1); TestOptionalStringValue("[]", packer, typeDesc, Fast ? (2 + 4 + 1) : (2 + 1)); @@ -472,7 +472,7 @@ protected: TString descr = TStringBuilder() << "Type:Variant(" << static_cast<TVariantType*>(variantType)->GetUnderlyingType()->GetKindAsStr() << ')'; { - const NUdf::TUnboxedValue value = HolderFactory.CreateVariantHolder(MakeString("01234567890123456789"), 0); + const NUdf::TUnboxedValue value = HolderFactory_.CreateVariantHolder(MakeString("01234567890123456789"), 0); const auto uValue = TestPackUnpack(variantType, value, descr); UNIT_ASSERT_VALUES_EQUAL(uValue.GetVariantIndex(), 0); @@ -480,7 +480,7 @@ protected: UNIT_ASSERT_VALUES_EQUAL(std::string_view(e.AsStringRef()), "01234567890123456789"); } { - const NUdf::TUnboxedValue value = HolderFactory.CreateVariantHolder(NUdf::TUnboxedValuePod(), 1); + const NUdf::TUnboxedValue value = HolderFactory_.CreateVariantHolder(NUdf::TUnboxedValuePod(), 1); const auto uValue = TestPackUnpack(variantType, value, descr); UNIT_ASSERT_VALUES_EQUAL(uValue.GetVariantIndex(), 1); @@ -488,7 +488,7 @@ protected: UNIT_ASSERT(!e); } { - const NUdf::TUnboxedValue value = HolderFactory.CreateVariantHolder(NUdf::TUnboxedValuePod(ui64(12345)), 2); + const NUdf::TUnboxedValue value = HolderFactory_.CreateVariantHolder(NUdf::TUnboxedValuePod(ui64(12345)), 2); const auto uValue = TestPackUnpack(variantType, value, descr); UNIT_ASSERT_VALUES_EQUAL(uValue.GetVariantIndex(), 2); @@ -499,19 +499,19 @@ protected: NUdf::TUnboxedValue MakeTupleValue(TType*& tupleType, bool forPerf = false) { std::vector<TType*> tupleElemenTypes; - tupleElemenTypes.push_back(PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[0])); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[0])); - tupleElemenTypes.push_back(PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id)); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[3])); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(tupleElemenTypes[3])); + tupleElemenTypes.push_back(PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id)); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[0])); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[0])); + tupleElemenTypes.push_back(PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id)); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[3])); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(tupleElemenTypes[3])); if (!forPerf) { - tupleElemenTypes.push_back(PgmBuilder.NewDecimalType(16, 8)); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(PgmBuilder.NewDecimalType(22, 3))); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(PgmBuilder.NewDecimalType(35, 2))); - tupleElemenTypes.push_back(PgmBuilder.NewOptionalType(PgmBuilder.NewDecimalType(29, 0))); + tupleElemenTypes.push_back(PgmBuilder_.NewDecimalType(16, 8)); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(PgmBuilder_.NewDecimalType(22, 3))); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(PgmBuilder_.NewDecimalType(35, 2))); + tupleElemenTypes.push_back(PgmBuilder_.NewOptionalType(PgmBuilder_.NewDecimalType(29, 0))); } - tupleType = PgmBuilder.NewTupleType(tupleElemenTypes); + tupleType = PgmBuilder_.NewTupleType(tupleElemenTypes); auto inf = NYql::NDecimal::FromString("inf", 16, 8); auto dec1 = NYql::NDecimal::FromString("12345.673", 22, 3); @@ -531,7 +531,7 @@ protected: tupleElemens.push_back(NUdf::TUnboxedValuePod()); } - return HolderFactory.VectorAsArray(tupleElemens); + return HolderFactory_.VectorAsArray(tupleElemens); } void ValidateTupleValue(const NUdf::TUnboxedValue& value, bool forPerf = false) { @@ -562,27 +562,27 @@ protected: void TestPairPackPerformance() { std::vector<TType*> tupleElemenTypes; - tupleElemenTypes.push_back(PgmBuilder.NewDataType(NUdf::TDataType<ui32>::Id)); - tupleElemenTypes.push_back(PgmBuilder.NewDataType(NUdf::TDataType<ui32>::Id)); - TType* tupleType = PgmBuilder.NewTupleType(tupleElemenTypes); + tupleElemenTypes.push_back(PgmBuilder_.NewDataType(NUdf::TDataType<ui32>::Id)); + tupleElemenTypes.push_back(PgmBuilder_.NewDataType(NUdf::TDataType<ui32>::Id)); + TType* tupleType = PgmBuilder_.NewTupleType(tupleElemenTypes); TUnboxedValueVector tupleElemens; tupleElemens.push_back(NUdf::TUnboxedValuePod(ui32(12345))); tupleElemens.push_back(NUdf::TUnboxedValuePod(ui32(67890))); - const NUdf::TUnboxedValue value = HolderFactory.VectorAsArray(tupleElemens); + const NUdf::TUnboxedValue value = HolderFactory_.VectorAsArray(tupleElemens); TestPackPerformance(tupleType, value); } void TestShortStringPackPerformance() { const auto v = NUdf::TUnboxedValuePod::Embedded("01234"); - TType* type = PgmBuilder.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id); + TType* type = PgmBuilder_.NewDataType(NUdf::TDataType<NUdf::TUtf8>::Id); TestPackPerformance(type, v); } void TestIntegerPackPerformance() { const auto& v = NUdf::TUnboxedValuePod(ui64("123456789ULL")); - TType* type = PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id); + TType* type = PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id); TestPackPerformance(type, v); } @@ -616,15 +616,15 @@ protected: UNIT_ASSERT_VALUES_EQUAL(result.Size(), packed.size()); UNIT_ASSERT(result.Size() != result.ContigousSize()); - ValidateTupleValue(packer.Unpack(std::move(result), HolderFactory)); + ValidateTupleValue(packer.Unpack(std::move(result), HolderFactory_)); } } } void TestIncrementalPacking() { if constexpr (Transport) { - auto itemType = PgmBuilder.NewDataType(NUdf::TDataType<char *>::Id); - auto listType = PgmBuilder.NewListType(itemType); + auto itemType = PgmBuilder_.NewDataType(NUdf::TDataType<char *>::Id); + auto listType = PgmBuilder_.NewListType(itemType); TValuePackerType packer(false, itemType); TValuePackerType listPacker(false, listType); @@ -639,7 +639,7 @@ protected: auto serialized = packer.Finish(); - auto listObj = listPacker.Unpack(TChunkedBuffer(serialized), HolderFactory); + auto listObj = listPacker.Unpack(TChunkedBuffer(serialized), HolderFactory_); UNIT_ASSERT_VALUES_EQUAL(listObj.GetListLength(), count); const auto iter = listObj.GetListIterator(); for (NUdf::TUnboxedValue uVal; iter.Next(uVal);) { @@ -648,7 +648,7 @@ protected: } TUnboxedValueBatch items; - packer.UnpackBatch(std::move(serialized), HolderFactory, items); + packer.UnpackBatch(std::move(serialized), HolderFactory_, items); UNIT_ASSERT_VALUES_EQUAL(items.RowCount(), count); items.ForEachRow([&](const NUdf::TUnboxedValue& value) { UNIT_ASSERT(value); @@ -685,24 +685,24 @@ protected: class TArgsDispatcher : public IArgsDispatcher { public: TArgsDispatcher(TValue& dst, const std::vector<TValue>& choices) - : Dst(dst) - , Choices(choices) + : Dst_(dst) + , Choices_(choices) { UNIT_ASSERT_C(!choices.empty(), "Choices should not be empty"); } ui64 GetSize() const { - return Choices.size(); + return Choices_.size(); } void Set(ui64 index) { - UNIT_ASSERT_LE_C(index + 1, Choices.size(), "Invalid args dispatcher index"); - Dst = Choices[index]; + UNIT_ASSERT_LE_C(index + 1, Choices_.size(), "Invalid args dispatcher index"); + Dst_ = Choices_[index]; } private: - TValue& Dst; - const std::vector<TValue> Choices; + TValue& Dst_; + const std::vector<TValue> Choices_; }; void DoTestBlockPacking(const TBlockTestArgs& args) { @@ -710,29 +710,29 @@ protected: ui64 offset = args.Offset; ui64 len = args.Len; if constexpr (Transport) { - auto strType = PgmBuilder.NewDataType(NUdf::TDataType<char*>::Id); - auto ui32Type = PgmBuilder.NewDataType(NUdf::TDataType<ui32>::Id); - auto ui64Type = PgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id); - auto optStrType = PgmBuilder.NewOptionalType(strType); - auto optUi32Type = PgmBuilder.NewOptionalType(ui32Type); - - auto tupleOptUi32StrType = PgmBuilder.NewTupleType({ optUi32Type, strType }); - auto optTupleOptUi32StrType = PgmBuilder.NewOptionalType(tupleOptUi32StrType); - - auto blockUi32Type = PgmBuilder.NewBlockType(ui32Type, TBlockType::EShape::Many); - auto blockOptStrType = PgmBuilder.NewBlockType(optStrType, TBlockType::EShape::Many); - auto scalarOptStrType = PgmBuilder.NewBlockType(optStrType, TBlockType::EShape::Scalar); - auto blockOptTupleOptUi32StrType = PgmBuilder.NewBlockType(optTupleOptUi32StrType, TBlockType::EShape::Many); - auto scalarUi64Type = PgmBuilder.NewBlockType(ui64Type, TBlockType::EShape::Scalar); - - auto tzDateType = PgmBuilder.NewDataType(NUdf::EDataSlot::TzDate); - auto blockTzDateType = PgmBuilder.NewBlockType(tzDateType, TBlockType::EShape::Many); - auto nullType = PgmBuilder.NewNullType(); - auto blockNullType = PgmBuilder.NewBlockType(nullType, TBlockType::EShape::Many); + auto strType = PgmBuilder_.NewDataType(NUdf::TDataType<char*>::Id); + auto ui32Type = PgmBuilder_.NewDataType(NUdf::TDataType<ui32>::Id); + auto ui64Type = PgmBuilder_.NewDataType(NUdf::TDataType<ui64>::Id); + auto optStrType = PgmBuilder_.NewOptionalType(strType); + auto optUi32Type = PgmBuilder_.NewOptionalType(ui32Type); + + auto tupleOptUi32StrType = PgmBuilder_.NewTupleType({ optUi32Type, strType }); + auto optTupleOptUi32StrType = PgmBuilder_.NewOptionalType(tupleOptUi32StrType); + + auto blockUi32Type = PgmBuilder_.NewBlockType(ui32Type, TBlockType::EShape::Many); + auto blockOptStrType = PgmBuilder_.NewBlockType(optStrType, TBlockType::EShape::Many); + auto scalarOptStrType = PgmBuilder_.NewBlockType(optStrType, TBlockType::EShape::Scalar); + auto blockOptTupleOptUi32StrType = PgmBuilder_.NewBlockType(optTupleOptUi32StrType, TBlockType::EShape::Many); + auto scalarUi64Type = PgmBuilder_.NewBlockType(ui64Type, TBlockType::EShape::Scalar); + + auto tzDateType = PgmBuilder_.NewDataType(NUdf::EDataSlot::TzDate); + auto blockTzDateType = PgmBuilder_.NewBlockType(tzDateType, TBlockType::EShape::Many); + auto nullType = PgmBuilder_.NewNullType(); + auto blockNullType = PgmBuilder_.NewBlockType(nullType, TBlockType::EShape::Many); auto rowType = legacyStruct - ? PgmBuilder.NewStructType({ + ? PgmBuilder_.NewStructType({ {"A", blockUi32Type}, {"B", blockOptStrType}, {"_yql_block_length", scalarUi64Type}, @@ -741,7 +741,7 @@ protected: {"c", blockTzDateType}, {"nill", blockNullType}, }) - : PgmBuilder.NewMultiType( + : PgmBuilder_.NewMultiType( {blockUi32Type, blockOptStrType, scalarOptStrType, blockOptTupleOptUi32StrType, blockTzDateType, blockNullType, scalarUi64Type}); @@ -820,13 +820,13 @@ protected: } TUnboxedValueVector columns; for (auto& datum : datums) { - columns.emplace_back(HolderFactory.CreateArrowBlock(std::move(datum))); + columns.emplace_back(HolderFactory_.CreateArrowBlock(std::move(datum))); } TValuePackerType packer(false, rowType, {}, ArrowPool_, args.MinFillPercentage); if (legacyStruct) { TUnboxedValueVector columnsCopy = columns; - NUdf::TUnboxedValue row = HolderFactory.VectorAsArray(columnsCopy); + NUdf::TUnboxedValue row = HolderFactory_.VectorAsArray(columnsCopy); packer.AddItem(row); } else { packer.AddWideItem(columns.data(), columns.size()); @@ -834,7 +834,7 @@ protected: TChunkedBuffer packed = packer.Finish(); TUnboxedValueBatch unpacked(rowType); - packer.UnpackBatch(std::move(packed), HolderFactory, unpacked); + packer.UnpackBatch(std::move(packed), HolderFactory_, unpacked); UNIT_ASSERT_VALUES_EQUAL(unpacked.RowCount(), 1); @@ -939,13 +939,13 @@ protected: } private: - TIntrusivePtr<NMiniKQL::IFunctionRegistry> FunctionRegistry; - TIntrusivePtr<IRandomProvider> RandomProvider; - TScopedAlloc Alloc; - TTypeEnvironment Env; - TProgramBuilder PgmBuilder; - TMemoryUsageInfo MemInfo; - THolderFactory HolderFactory; + TIntrusivePtr<NMiniKQL::IFunctionRegistry> FunctionRegistry_; + TIntrusivePtr<IRandomProvider> RandomProvider_; + TScopedAlloc Alloc_; + TTypeEnvironment Env_; + TProgramBuilder PgmBuilder_; + TMemoryUsageInfo MemInfo_; + THolderFactory HolderFactory_; arrow::MemoryPool* const ArrowPool_; }; diff --git a/yql/essentials/minikql/computation/mkql_computation_pattern_cache.cpp b/yql/essentials/minikql/computation/mkql_computation_pattern_cache.cpp index 49d34766317..fefeffa49e8 100644 --- a/yql/essentials/minikql/computation/mkql_computation_pattern_cache.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_pattern_cache.cpp @@ -11,31 +11,31 @@ public: size_t maxPatternsSizeBytes, size_t maxCompiledPatternsSize, size_t maxCompiledPatternsSizeBytes) - : MaxPatternsSize(maxPatternsSize) - , MaxPatternsSizeBytes(maxPatternsSizeBytes) - , MaxCompiledPatternsSize(maxCompiledPatternsSize) - , MaxCompiledPatternsSizeBytes(maxCompiledPatternsSizeBytes) + : MaxPatternsSize_(maxPatternsSize) + , MaxPatternsSizeBytes_(maxPatternsSizeBytes) + , MaxCompiledPatternsSize_(maxCompiledPatternsSize) + , MaxCompiledPatternsSizeBytes_(maxCompiledPatternsSizeBytes) {} size_t PatternsSize() const { - return SerializedProgramToPatternCacheHolder.size(); + return SerializedProgramToPatternCacheHolder_.size(); } size_t PatternsSizeInBytes() const { - return CurrentPatternsSizeBytes; + return CurrentPatternsSizeBytes_; } size_t CompiledPatternsSize() const { - return CurrentCompiledPatternsSize; + return CurrentCompiledPatternsSize_; } size_t PatternsCompiledCodeSizeInBytes() const { - return CurrentPatternsCompiledCodeSizeInBytes; + return CurrentPatternsCompiledCodeSizeInBytes_; } std::shared_ptr<TPatternCacheEntry> Find(const TString& serializedProgram) { - auto it = SerializedProgramToPatternCacheHolder.find(serializedProgram); - if (it == SerializedProgramToPatternCacheHolder.end()) { + auto it = SerializedProgramToPatternCacheHolder_.find(serializedProgram); + if (it == SerializedProgramToPatternCacheHolder_.end()) { return {}; } @@ -45,7 +45,7 @@ public: } void Insert(const TString& serializedProgram, TPatternCacheEntryPtr entry) { - auto [it, inserted] = SerializedProgramToPatternCacheHolder.emplace(std::piecewise_construct, + auto [it, inserted] = SerializedProgramToPatternCacheHolder_.emplace(std::piecewise_construct, std::forward_as_tuple(serializedProgram), std::forward_as_tuple(serializedProgram, entry)); @@ -56,13 +56,13 @@ public: } /// New item is inserted, insert it in the back of both LRU lists and recalculate sizes - CurrentPatternsSizeBytes += it->second.Entry->SizeForCache; - LRUPatternList.PushBack(&it->second); + CurrentPatternsSizeBytes_ += it->second.Entry->SizeForCache; + LruPatternList_.PushBack(&it->second); if (it->second.Entry->Pattern->IsCompiled()) { - ++CurrentCompiledPatternsSize; - CurrentPatternsCompiledCodeSizeInBytes += it->second.Entry->Pattern->CompiledCodeSize(); - LRUCompiledPatternList.PushBack(&it->second); + ++CurrentCompiledPatternsSize_; + CurrentPatternsCompiledCodeSizeInBytes_ += it->second.Entry->Pattern->CompiledCodeSize(); + LruCompiledPatternList_.PushBack(&it->second); } it->second.Entry->IsInCache.store(true); @@ -70,8 +70,8 @@ public: } void NotifyPatternCompiled(const TString& serializedProgram) { - auto it = SerializedProgramToPatternCacheHolder.find(serializedProgram); - if (it == SerializedProgramToPatternCacheHolder.end()) { + auto it = SerializedProgramToPatternCacheHolder_.find(serializedProgram); + if (it == SerializedProgramToPatternCacheHolder_.end()) { return; } @@ -90,25 +90,25 @@ public: PromoteEntry(&it->second); - ++CurrentCompiledPatternsSize; - CurrentPatternsCompiledCodeSizeInBytes += entry->Pattern->CompiledCodeSize(); - LRUCompiledPatternList.PushBack(&it->second); + ++CurrentCompiledPatternsSize_; + CurrentPatternsCompiledCodeSizeInBytes_ += entry->Pattern->CompiledCodeSize(); + LruCompiledPatternList_.PushBack(&it->second); ClearIfNeeded(); } void Clear() { - CurrentPatternsSizeBytes = 0; - CurrentCompiledPatternsSize = 0; - CurrentPatternsCompiledCodeSizeInBytes = 0; + CurrentPatternsSizeBytes_ = 0; + CurrentCompiledPatternsSize_ = 0; + CurrentPatternsCompiledCodeSizeInBytes_ = 0; - SerializedProgramToPatternCacheHolder.clear(); - for (auto & holder : LRUPatternList) { + SerializedProgramToPatternCacheHolder_.clear(); + for (auto & holder : LruPatternList_) { holder.Entry->IsInCache.store(false); } - LRUPatternList.Clear(); - LRUCompiledPatternList.Clear(); + LruPatternList_.Clear(); + LruCompiledPatternList_.Clear(); } private: struct TPatternLRUListTag {}; @@ -137,96 +137,96 @@ private: void PromoteEntry(TPatternCacheHolder* holder) { Y_ASSERT(holder->LinkedInPatternLRUList()); - LRUPatternList.Remove(holder); - LRUPatternList.PushBack(holder); + LruPatternList_.Remove(holder); + LruPatternList_.PushBack(holder); if (!holder->LinkedInCompiledPatternLRUList()) { return; } - LRUCompiledPatternList.Remove(holder); - LRUCompiledPatternList.PushBack(holder); + LruCompiledPatternList_.Remove(holder); + LruCompiledPatternList_.PushBack(holder); } void RemoveEntryFromLists(TPatternCacheHolder* holder) { Y_ASSERT(holder->LinkedInPatternLRUList()); - LRUPatternList.Remove(holder); + LruPatternList_.Remove(holder); - Y_ASSERT(holder->Entry->SizeForCache <= CurrentPatternsSizeBytes); - CurrentPatternsSizeBytes -= holder->Entry->SizeForCache; + Y_ASSERT(holder->Entry->SizeForCache <= CurrentPatternsSizeBytes_); + CurrentPatternsSizeBytes_ -= holder->Entry->SizeForCache; if (!holder->LinkedInCompiledPatternLRUList()) { return; } - Y_ASSERT(CurrentCompiledPatternsSize > 0); - --CurrentCompiledPatternsSize; + Y_ASSERT(CurrentCompiledPatternsSize_ > 0); + --CurrentCompiledPatternsSize_; size_t patternCompiledCodeSize = holder->Entry->Pattern->CompiledCodeSize(); - Y_ASSERT(patternCompiledCodeSize <= CurrentPatternsCompiledCodeSizeInBytes); - CurrentPatternsCompiledCodeSizeInBytes -= patternCompiledCodeSize; + Y_ASSERT(patternCompiledCodeSize <= CurrentPatternsCompiledCodeSizeInBytes_); + CurrentPatternsCompiledCodeSizeInBytes_ -= patternCompiledCodeSize; - LRUCompiledPatternList.Remove(holder); + LruCompiledPatternList_.Remove(holder); holder->Entry->IsInCache.store(false); } void ClearIfNeeded() { /// Remove from pattern LRU list and compiled pattern LRU list - while (SerializedProgramToPatternCacheHolder.size() > MaxPatternsSize || CurrentPatternsSizeBytes > MaxPatternsSizeBytes) { - TPatternCacheHolder* holder = LRUPatternList.Front(); + while (SerializedProgramToPatternCacheHolder_.size() > MaxPatternsSize_ || CurrentPatternsSizeBytes_ > MaxPatternsSizeBytes_) { + TPatternCacheHolder* holder = LruPatternList_.Front(); RemoveEntryFromLists(holder); - SerializedProgramToPatternCacheHolder.erase(holder->SerializedProgram); + SerializedProgramToPatternCacheHolder_.erase(holder->SerializedProgram); } /// Only remove from compiled pattern LRU list - while (CurrentCompiledPatternsSize > MaxCompiledPatternsSize || CurrentPatternsCompiledCodeSizeInBytes > MaxCompiledPatternsSizeBytes) { - TPatternCacheHolder* holder = LRUCompiledPatternList.PopFront(); + while (CurrentCompiledPatternsSize_ > MaxCompiledPatternsSize_ || CurrentPatternsCompiledCodeSizeInBytes_ > MaxCompiledPatternsSizeBytes_) { + TPatternCacheHolder* holder = LruCompiledPatternList_.PopFront(); - Y_ASSERT(CurrentCompiledPatternsSize > 0); - --CurrentCompiledPatternsSize; + Y_ASSERT(CurrentCompiledPatternsSize_ > 0); + --CurrentCompiledPatternsSize_; auto & pattern = holder->Entry->Pattern; size_t patternCompiledSize = pattern->CompiledCodeSize(); - Y_ASSERT(patternCompiledSize <= CurrentPatternsCompiledCodeSizeInBytes); - CurrentPatternsCompiledCodeSizeInBytes -= patternCompiledSize; + Y_ASSERT(patternCompiledSize <= CurrentPatternsCompiledCodeSizeInBytes_); + CurrentPatternsCompiledCodeSizeInBytes_ -= patternCompiledSize; pattern->RemoveCompiledCode(); holder->Entry->AccessTimes.store(0); } } - const size_t MaxPatternsSize; - const size_t MaxPatternsSizeBytes; - const size_t MaxCompiledPatternsSize; - const size_t MaxCompiledPatternsSizeBytes; + const size_t MaxPatternsSize_; + const size_t MaxPatternsSizeBytes_; + const size_t MaxCompiledPatternsSize_; + const size_t MaxCompiledPatternsSizeBytes_; - size_t CurrentPatternsSizeBytes = 0; - size_t CurrentCompiledPatternsSize = 0; - size_t CurrentPatternsCompiledCodeSizeInBytes = 0; + size_t CurrentPatternsSizeBytes_ = 0; + size_t CurrentCompiledPatternsSize_ = 0; + size_t CurrentPatternsCompiledCodeSizeInBytes_ = 0; - THashMap<TString, TPatternCacheHolder> SerializedProgramToPatternCacheHolder; - TIntrusiveList<TPatternCacheHolder, TPatternLRUListTag> LRUPatternList; - TIntrusiveList<TPatternCacheHolder, TCompiledPatternLRUListTag> LRUCompiledPatternList; + THashMap<TString, TPatternCacheHolder> SerializedProgramToPatternCacheHolder_; + TIntrusiveList<TPatternCacheHolder, TPatternLRUListTag> LruPatternList_; + TIntrusiveList<TPatternCacheHolder, TCompiledPatternLRUListTag> LruCompiledPatternList_; }; TComputationPatternLRUCache::TComputationPatternLRUCache(const TComputationPatternLRUCache::Config& configuration, NMonitoring::TDynamicCounterPtr counters) - : Cache(std::make_unique<TLRUPatternCacheImpl>(CacheMaxElementsSize, configuration.MaxSizeBytes, CacheMaxElementsSize, configuration.MaxCompiledSizeBytes)) - , Configuration(configuration) - , Hits(counters->GetCounter("PatternCache/Hits", true)) - , HitsCompiled(counters->GetCounter("PatternCache/HitsCompiled", true)) - , Waits(counters->GetCounter("PatternCache/Waits", true)) - , Misses(counters->GetCounter("PatternCache/Misses", true)) - , NotSuitablePattern(counters->GetCounter("PatternCache/NotSuitablePattern", true)) - , SizeItems(counters->GetCounter("PatternCache/SizeItems", false)) - , SizeCompiledItems(counters->GetCounter("PatternCache/SizeCompiledItems", false)) - , SizeBytes(counters->GetCounter("PatternCache/SizeBytes", false)) - , SizeCompiledBytes(counters->GetCounter("PatternCache/SizeCompiledBytes", false)) - , MaxSizeBytesCounter(counters->GetCounter("PatternCache/MaxSizeBytes", false)) - , MaxCompiledSizeBytesCounter(counters->GetCounter("PatternCache/MaxCompiledSizeBytes", false)) + : Cache_(std::make_unique<TLRUPatternCacheImpl>(CacheMaxElementsSize, configuration.MaxSizeBytes, CacheMaxElementsSize, configuration.MaxCompiledSizeBytes)) + , Configuration_(configuration) + , Hits_(counters->GetCounter("PatternCache/Hits", true)) + , HitsCompiled_(counters->GetCounter("PatternCache/HitsCompiled", true)) + , Waits_(counters->GetCounter("PatternCache/Waits", true)) + , Misses_(counters->GetCounter("PatternCache/Misses", true)) + , NotSuitablePattern_(counters->GetCounter("PatternCache/NotSuitablePattern", true)) + , SizeItems_(counters->GetCounter("PatternCache/SizeItems", false)) + , SizeCompiledItems_(counters->GetCounter("PatternCache/SizeCompiledItems", false)) + , SizeBytes_(counters->GetCounter("PatternCache/SizeBytes", false)) + , SizeCompiledBytes_(counters->GetCounter("PatternCache/SizeCompiledBytes", false)) + , MaxSizeBytesCounter_(counters->GetCounter("PatternCache/MaxSizeBytes", false)) + , MaxCompiledSizeBytesCounter_(counters->GetCounter("PatternCache/MaxCompiledSizeBytes", false)) { - *MaxSizeBytesCounter = Configuration.MaxSizeBytes; - *MaxCompiledSizeBytesCounter = Configuration.MaxCompiledSizeBytes; + *MaxSizeBytesCounter_ = Configuration_.MaxSizeBytes; + *MaxCompiledSizeBytesCounter_ = Configuration_.MaxCompiledSizeBytes; } TComputationPatternLRUCache::~TComputationPatternLRUCache() { @@ -234,36 +234,36 @@ TComputationPatternLRUCache::~TComputationPatternLRUCache() { } TPatternCacheEntryPtr TComputationPatternLRUCache::Find(const TString& serializedProgram) { - std::lock_guard<std::mutex> lock(Mutex); - if (auto it = Cache->Find(serializedProgram)) { - ++*Hits; + std::lock_guard<std::mutex> lock(Mutex_); + if (auto it = Cache_->Find(serializedProgram)) { + ++*Hits_; if (it->Pattern->IsCompiled()) - ++*HitsCompiled; + ++*HitsCompiled_; return it; } - ++*Misses; + ++*Misses_; return {}; } TPatternCacheEntryFuture TComputationPatternLRUCache::FindOrSubscribe(const TString& serializedProgram) { - std::lock_guard lock(Mutex); - if (auto it = Cache->Find(serializedProgram)) { - ++*Hits; + std::lock_guard lock(Mutex_); + if (auto it = Cache_->Find(serializedProgram)) { + ++*Hits_; AccessPattern(serializedProgram, it); return NThreading::MakeFuture<TPatternCacheEntryPtr>(it); } - auto [notifyIt, isNew] = Notify.emplace(std::piecewise_construct, std::forward_as_tuple(serializedProgram), std::forward_as_tuple()); + auto [notifyIt, isNew] = Notify_.emplace(std::piecewise_construct, std::forward_as_tuple(serializedProgram), std::forward_as_tuple()); if (isNew) { - ++*Misses; + ++*Misses_; // First future is empty - so the subscriber can initiate the entry creation. return {}; } - ++*Waits; + ++*Waits_; auto promise = NThreading::NewPromise<TPatternCacheEntryPtr>(); auto& subscribers = notifyIt->second; subscribers.push_back(promise); @@ -277,19 +277,19 @@ void TComputationPatternLRUCache::EmplacePattern(const TString& serializedProgra TVector<NThreading::TPromise<TPatternCacheEntryPtr>> subscribers; { - std::lock_guard lock(Mutex); - Cache->Insert(serializedProgram, patternWithEnv); + std::lock_guard lock(Mutex_); + Cache_->Insert(serializedProgram, patternWithEnv); - auto notifyIt = Notify.find(serializedProgram); - if (notifyIt != Notify.end()) { + auto notifyIt = Notify_.find(serializedProgram); + if (notifyIt != Notify_.end()) { subscribers.swap(notifyIt->second); - Notify.erase(notifyIt); + Notify_.erase(notifyIt); } - *SizeItems = Cache->PatternsSize(); - *SizeBytes = Cache->PatternsSizeInBytes(); - *SizeCompiledItems = Cache->CompiledPatternsSize(); - *SizeCompiledBytes = Cache->PatternsCompiledCodeSizeInBytes(); + *SizeItems_ = Cache_->PatternsSize(); + *SizeBytes_ = Cache_->PatternsSizeInBytes(); + *SizeCompiledItems_ = Cache_->CompiledPatternsSize(); + *SizeCompiledBytes_ = Cache_->PatternsCompiledCodeSizeInBytes(); } for (auto& subscriber : subscribers) { @@ -298,19 +298,19 @@ void TComputationPatternLRUCache::EmplacePattern(const TString& serializedProgra } void TComputationPatternLRUCache::NotifyPatternCompiled(const TString& serializedProgram) { - std::lock_guard lock(Mutex); - Cache->NotifyPatternCompiled(serializedProgram); + std::lock_guard lock(Mutex_); + Cache_->NotifyPatternCompiled(serializedProgram); } void TComputationPatternLRUCache::NotifyPatternMissing(const TString& serializedProgram) { TVector<NThreading::TPromise<std::shared_ptr<TPatternCacheEntry>>> subscribers; { - std::lock_guard lock(Mutex); + std::lock_guard lock(Mutex_); - auto notifyIt = Notify.find(serializedProgram); - if (notifyIt != Notify.end()) { + auto notifyIt = Notify_.find(serializedProgram); + if (notifyIt != Notify_.end()) { subscribers.swap(notifyIt->second); - Notify.erase(notifyIt); + Notify_.erase(notifyIt); } } @@ -321,28 +321,28 @@ void TComputationPatternLRUCache::NotifyPatternMissing(const TString& serialized } size_t TComputationPatternLRUCache::GetSize() const { - std::lock_guard lock(Mutex); - return Cache->PatternsSize(); + std::lock_guard lock(Mutex_); + return Cache_->PatternsSize(); } void TComputationPatternLRUCache::CleanCache() { - *SizeItems = 0; - *SizeBytes = 0; - *MaxSizeBytesCounter = 0; - std::lock_guard lock(Mutex); - PatternsToCompile.clear(); - Cache->Clear(); + *SizeItems_ = 0; + *SizeBytes_ = 0; + *MaxSizeBytesCounter_ = 0; + std::lock_guard lock(Mutex_); + PatternsToCompile_.clear(); + Cache_->Clear(); } void TComputationPatternLRUCache::AccessPattern(const TString& serializedProgram, TPatternCacheEntryPtr entry) { - if (!Configuration.PatternAccessTimesBeforeTryToCompile || entry->Pattern->IsCompiled()) { + if (!Configuration_.PatternAccessTimesBeforeTryToCompile || entry->Pattern->IsCompiled()) { return; } size_t PatternAccessTimes = entry->AccessTimes.fetch_add(1) + 1; - if (PatternAccessTimes == *Configuration.PatternAccessTimesBeforeTryToCompile || - (*Configuration.PatternAccessTimesBeforeTryToCompile == 0 && PatternAccessTimes == 1)) { - PatternsToCompile.emplace(serializedProgram, entry); + if (PatternAccessTimes == *Configuration_.PatternAccessTimesBeforeTryToCompile || + (*Configuration_.PatternAccessTimesBeforeTryToCompile == 0 && PatternAccessTimes == 1)) { + PatternsToCompile_.emplace(serializedProgram, entry); } } diff --git a/yql/essentials/minikql/computation/mkql_computation_pattern_cache.h b/yql/essentials/minikql/computation/mkql_computation_pattern_cache.h index c6120f85c6b..433bb842f6e 100644 --- a/yql/essentials/minikql/computation/mkql_computation_pattern_cache.h +++ b/yql/essentials/minikql/computation/mkql_computation_pattern_cache.h @@ -105,31 +105,31 @@ public: void CleanCache(); Config GetConfiguration() const { - std::lock_guard lock(Mutex); - return Configuration; + std::lock_guard lock(Mutex_); + return Configuration_; } size_t GetMaxSizeBytes() const { - std::lock_guard lock(Mutex); - return Configuration.MaxSizeBytes; + std::lock_guard lock(Mutex_); + return Configuration_.MaxSizeBytes; } i64 GetCacheHits() const { - return *Hits; + return *Hits_; } void IncNotSuitablePattern() { - ++*NotSuitablePattern; + ++*NotSuitablePattern_; } size_t GetPatternsToCompileSize() const { - std::lock_guard lock(Mutex); - return PatternsToCompile.size(); + std::lock_guard lock(Mutex_); + return PatternsToCompile_.size(); } void GetPatternsToCompile(THashMap<TString, TPatternCacheEntryPtr> & result) { - std::lock_guard lock(Mutex); - result.swap(PatternsToCompile); + std::lock_guard lock(Mutex_); + result.swap(PatternsToCompile_); } private: @@ -139,24 +139,24 @@ private: void AccessPattern(const TString& serializedProgram, TPatternCacheEntryPtr entry); - mutable std::mutex Mutex; - THashMap<TString, TVector<NThreading::TPromise<TPatternCacheEntryPtr>>> Notify; // protected by Mutex - std::unique_ptr<TLRUPatternCacheImpl> Cache; // protected by Mutex - THashMap<TString, TPatternCacheEntryPtr> PatternsToCompile; // protected by Mutex - - const Config Configuration; - - NMonitoring::TDynamicCounters::TCounterPtr Hits; - NMonitoring::TDynamicCounters::TCounterPtr HitsCompiled; - NMonitoring::TDynamicCounters::TCounterPtr Waits; - NMonitoring::TDynamicCounters::TCounterPtr Misses; - NMonitoring::TDynamicCounters::TCounterPtr NotSuitablePattern; - NMonitoring::TDynamicCounters::TCounterPtr SizeItems; - NMonitoring::TDynamicCounters::TCounterPtr SizeCompiledItems; - NMonitoring::TDynamicCounters::TCounterPtr SizeBytes; - NMonitoring::TDynamicCounters::TCounterPtr SizeCompiledBytes; - NMonitoring::TDynamicCounters::TCounterPtr MaxSizeBytesCounter; - NMonitoring::TDynamicCounters::TCounterPtr MaxCompiledSizeBytesCounter; + mutable std::mutex Mutex_; + THashMap<TString, TVector<NThreading::TPromise<TPatternCacheEntryPtr>>> Notify_; // protected by Mutex + std::unique_ptr<TLRUPatternCacheImpl> Cache_; // protected by Mutex + THashMap<TString, TPatternCacheEntryPtr> PatternsToCompile_; // protected by Mutex + + const Config Configuration_; + + NMonitoring::TDynamicCounters::TCounterPtr Hits_; + NMonitoring::TDynamicCounters::TCounterPtr HitsCompiled_; + NMonitoring::TDynamicCounters::TCounterPtr Waits_; + NMonitoring::TDynamicCounters::TCounterPtr Misses_; + NMonitoring::TDynamicCounters::TCounterPtr NotSuitablePattern_; + NMonitoring::TDynamicCounters::TCounterPtr SizeItems_; + NMonitoring::TDynamicCounters::TCounterPtr SizeCompiledItems_; + NMonitoring::TDynamicCounters::TCounterPtr SizeBytes_; + NMonitoring::TDynamicCounters::TCounterPtr SizeCompiledBytes_; + NMonitoring::TDynamicCounters::TCounterPtr MaxSizeBytesCounter_; + NMonitoring::TDynamicCounters::TCounterPtr MaxCompiledSizeBytesCounter_; }; } // namespace NKikimr::NMiniKQL diff --git a/yql/essentials/minikql/computation/mkql_custom_list.cpp b/yql/essentials/minikql/computation/mkql_custom_list.cpp index 6f8d68013bc..26f4c8ca204 100644 --- a/yql/essentials/minikql/computation/mkql_custom_list.cpp +++ b/yql/essentials/minikql/computation/mkql_custom_list.cpp @@ -5,50 +5,50 @@ namespace NMiniKQL { TForwardListValue::TForwardListValue(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& stream) : TCustomListValue(memInfo) - , Stream(std::move(stream)) + , Stream_(std::move(stream)) { - MKQL_ENSURE(Stream, "Empty stream."); + MKQL_ENSURE(Stream_, "Empty stream."); } TForwardListValue::TIterator::TIterator(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& stream) - : TComputationValue(memInfo), Stream(std::move(stream)) + : TComputationValue(memInfo), Stream_(std::move(stream)) {} bool TForwardListValue::TIterator::Next(NUdf::TUnboxedValue& value) { - const auto status = Stream.Fetch(value); + const auto status = Stream_.Fetch(value); MKQL_ENSURE(status != NUdf::EFetchStatus::Yield, "Unexpected stream status."); return status == NUdf::EFetchStatus::Ok; } NUdf::TUnboxedValue TForwardListValue::GetListIterator() const { - MKQL_ENSURE(Stream, "Second pass for ForwardList"); - return NUdf::TUnboxedValuePod(new TIterator(GetMemInfo(), std::move(Stream))); + MKQL_ENSURE(Stream_, "Second pass for ForwardList"); + return NUdf::TUnboxedValuePod(new TIterator(GetMemInfo(), std::move(Stream_))); } TExtendListValue::TExtendListValue(TMemoryUsageInfo* memInfo, TUnboxedValueVector&& lists) : TCustomListValue(memInfo) - , Lists(std::move(lists)) + , Lists_(std::move(lists)) { - MKQL_MEM_TAKE(memInfo, Lists.data(), Lists.capacity() * sizeof(NUdf::TUnboxedValue)); - Y_ASSERT(!Lists.empty()); + MKQL_MEM_TAKE(memInfo, Lists_.data(), Lists_.capacity() * sizeof(NUdf::TUnboxedValue)); + Y_ASSERT(!Lists_.empty()); } TExtendListValue::TIterator::TIterator(TMemoryUsageInfo* memInfo, TUnboxedValueVector&& iters) : TComputationValue(memInfo) - , Iters(std::move(iters)) - , Index(0) + , Iters_(std::move(iters)) + , Index_(0) { - MKQL_MEM_TAKE(memInfo, Iters.data(), Iters.capacity() * sizeof(NUdf::TUnboxedValue)); + MKQL_MEM_TAKE(memInfo, Iters_.data(), Iters_.capacity() * sizeof(NUdf::TUnboxedValue)); } TExtendListValue::TIterator::~TIterator() { - MKQL_MEM_RETURN(GetMemInfo(), Iters.data(), Iters.capacity() * sizeof(NUdf::TUnboxedValue)); + MKQL_MEM_RETURN(GetMemInfo(), Iters_.data(), Iters_.capacity() * sizeof(NUdf::TUnboxedValue)); } bool TExtendListValue::TIterator::Next(NUdf::TUnboxedValue& value) { - for (; Index < Iters.size(); ++Index) { - if (Iters[Index].Next(value)) { + for (; Index_ < Iters_.size(); ++Index_) { + if (Iters_[Index_].Next(value)) { return true; } } @@ -56,8 +56,8 @@ bool TExtendListValue::TIterator::Next(NUdf::TUnboxedValue& value) { } bool TExtendListValue::TIterator::Skip() { - for (; Index < Iters.size(); ++Index) { - if (Iters[Index].Skip()) { + for (; Index_ < Iters_.size(); ++Index_) { + if (Iters_[Index_].Skip()) { return true; } } @@ -66,8 +66,8 @@ bool TExtendListValue::TIterator::Skip() { NUdf::TUnboxedValue TExtendListValue::GetListIterator() const { TUnboxedValueVector iters; - iters.reserve(Lists.size()); - for (const auto& list : Lists) { + iters.reserve(Lists_.size()); + for (const auto& list : Lists_) { iters.emplace_back(list.GetListIterator()); } @@ -75,55 +75,55 @@ NUdf::TUnboxedValue TExtendListValue::GetListIterator() const { } TExtendListValue::~TExtendListValue() { - MKQL_MEM_RETURN(GetMemInfo(), Lists.data(), Lists.capacity() * sizeof(NUdf::TUnboxedValue)); + MKQL_MEM_RETURN(GetMemInfo(), Lists_.data(), Lists_.capacity() * sizeof(NUdf::TUnboxedValue)); } ui64 TExtendListValue::GetListLength() const { - if (!Length) { + if (!Length_) { ui64 length = 0ULL; - for (const auto& list : Lists) { + for (const auto& list : Lists_) { ui64 partialLength = list.GetListLength(); length += partialLength; } - Length = length; + Length_ = length; } - return *Length; + return *Length_; } bool TExtendListValue::HasListItems() const { - if (!HasItems) { - for (const auto& list : Lists) { + if (!HasItems_) { + for (const auto& list : Lists_) { if (list.HasListItems()) { - HasItems = true; + HasItems_ = true; break; } } - if (!HasItems) { - HasItems = false; + if (!HasItems_) { + HasItems_ = false; } } - return *HasItems; + return *HasItems_; } TExtendStreamValue::TExtendStreamValue(TMemoryUsageInfo* memInfo, TUnboxedValueVector&& lists) : TBase(memInfo) - , Lists(std::move(lists)) + , Lists_(std::move(lists)) { - MKQL_MEM_TAKE(memInfo, Lists.data(), Lists.capacity() * sizeof(NUdf::TUnboxedValue)); - Y_ASSERT(!Lists.empty()); + MKQL_MEM_TAKE(memInfo, Lists_.data(), Lists_.capacity() * sizeof(NUdf::TUnboxedValue)); + Y_ASSERT(!Lists_.empty()); } TExtendStreamValue::~TExtendStreamValue() { - MKQL_MEM_RETURN(GetMemInfo(), Lists.data(), Lists.capacity() * sizeof(NUdf::TUnboxedValue)); + MKQL_MEM_RETURN(GetMemInfo(), Lists_.data(), Lists_.capacity() * sizeof(NUdf::TUnboxedValue)); } NUdf::EFetchStatus TExtendStreamValue::Fetch(NUdf::TUnboxedValue& value) { - for (; Index < Lists.size(); ++Index) { - const auto status = Lists[Index].Fetch(value); + for (; Index_ < Lists_.size(); ++Index_) { + const auto status = Lists_[Index_].Fetch(value); if (status != NUdf::EFetchStatus::Finish) { return status; } diff --git a/yql/essentials/minikql/computation/mkql_custom_list.h b/yql/essentials/minikql/computation/mkql_custom_list.h index 0d36156efad..56060c0a832 100644 --- a/yql/essentials/minikql/computation/mkql_custom_list.h +++ b/yql/essentials/minikql/computation/mkql_custom_list.h @@ -9,25 +9,27 @@ class TCustomListValue : public TComputationValue<TCustomListValue> { public: TCustomListValue(TMemoryUsageInfo* memInfo) : TComputationValue(memInfo) + , Length(Length_) + , HasItems(HasItems_) { } private: bool HasFastListLength() const override { - return bool(Length); + return bool(Length_); } ui64 GetListLength() const override { - if (!Length) { - ui64 length = Iterator ? 1ULL : 0ULL; - for (const auto it = Iterator ? std::move(Iterator) : NUdf::TBoxedValueAccessor::GetListIterator(*this); it.Skip();) { + if (!Length_) { + ui64 length = Iterator_ ? 1ULL : 0ULL; + for (const auto it = Iterator_ ? std::move(Iterator_) : NUdf::TBoxedValueAccessor::GetListIterator(*this); it.Skip();) { ++length; } - Length = length; + Length_ = length; } - return *Length; + return *Length_; } ui64 GetEstimatedListLength() const override { @@ -35,27 +37,31 @@ private: } bool HasListItems() const override { - if (HasItems) { - return *HasItems; + if (HasItems_) { + return *HasItems_; } - if (Length) { - HasItems = (*Length != 0); - return *HasItems; + if (Length_) { + HasItems_ = (*Length_ != 0); + return *HasItems_; } auto iter = NUdf::TBoxedValueAccessor::GetListIterator(*this); - HasItems = iter.Skip(); - if (*HasItems) { - Iterator = std::move(iter); + HasItems_ = iter.Skip(); + if (*HasItems_) { + Iterator_ = std::move(iter); } - return *HasItems; + return *HasItems_; } protected: - mutable std::optional<ui64> Length; - mutable std::optional<bool> HasItems; - mutable NUdf::TUnboxedValue Iterator; + mutable std::optional<ui64> Length_; + mutable std::optional<bool> HasItems_; + mutable NUdf::TUnboxedValue Iterator_; + + //FIXME Remove + std::optional<ui64>& Length; // NOLINT(readability-identifier-naming) + std::optional<bool>& HasItems; // NOLINT(readability-identifier-naming) }; class TForwardListValue : public TCustomListValue { @@ -67,7 +73,7 @@ public: private: bool Next(NUdf::TUnboxedValue& value) override; - const NUdf::TUnboxedValue Stream; + const NUdf::TUnboxedValue Stream_; }; TForwardListValue(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& stream); @@ -75,7 +81,7 @@ public: private: NUdf::TUnboxedValue GetListIterator() const override; - mutable NUdf::TUnboxedValue Stream; + mutable NUdf::TUnboxedValue Stream_; }; class TExtendListValue : public TCustomListValue { @@ -89,8 +95,8 @@ public: bool Next(NUdf::TUnboxedValue& value) override; bool Skip() override; - const TUnboxedValueVector Iters; - ui32 Index; + const TUnboxedValueVector Iters_; + ui32 Index_; }; TExtendListValue(TMemoryUsageInfo* memInfo, TUnboxedValueVector&& lists); @@ -102,7 +108,7 @@ private: ui64 GetListLength() const override; bool HasListItems() const override; - const TUnboxedValueVector Lists; + const TUnboxedValueVector Lists_; }; class TExtendStreamValue : public TComputationValue<TExtendStreamValue> { @@ -116,8 +122,8 @@ public: private: NUdf::EFetchStatus Fetch(NUdf::TUnboxedValue& value); - const TUnboxedValueVector Lists; - ui32 Index = 0; + const TUnboxedValueVector Lists_; + ui32 Index_ = 0; }; } diff --git a/yql/essentials/minikql/computation/mkql_key_payload_value_lru_cache.h b/yql/essentials/minikql/computation/mkql_key_payload_value_lru_cache.h index e8f8eb7d159..152a6db90a8 100644 --- a/yql/essentials/minikql/computation/mkql_key_payload_value_lru_cache.h +++ b/yql/essentials/minikql/computation/mkql_key_payload_value_lru_cache.h @@ -32,41 +32,41 @@ class TUnboxedKeyValueLruCacheWithTtl { public: TUnboxedKeyValueLruCacheWithTtl(size_t maxSize, const NKikimr::NMiniKQL::TType* keyType) - : MaxSize(maxSize) - , KeyTypeHelper(keyType) - , Map( + : MaxSize_(maxSize) + , KeyTypeHelper_(keyType) + , Map_( 1000, - KeyTypeHelper.GetValueHash(), - KeyTypeHelper.GetValueEqual() + KeyTypeHelper_.GetValueHash(), + KeyTypeHelper_.GetValueEqual() ) { - Y_ABORT_UNLESS(MaxSize > 0); + Y_ABORT_UNLESS(MaxSize_ > 0); } TUnboxedKeyValueLruCacheWithTtl(const TUnboxedKeyValueLruCacheWithTtl&) = delete; //to prevent unintentional copy of a large object void Update(NUdf::TUnboxedValue&& key, NUdf::TUnboxedValue&& value, std::chrono::time_point<std::chrono::steady_clock>&& expiration) { - if (auto it = Map.find(key); it != Map.end()) { + if (auto it = Map_.find(key); it != Map_.end()) { Touch(it->second); auto& entry = *it->second; entry.Value = std::move(value); entry.Expiration = std::move(expiration); } else { - if (Map.size() == MaxSize) { + if (Map_.size() == MaxSize_) { RemoveLeastRecentlyUsedEntry(); } - UsageList.emplace_back(key, std::move(value), std::move(expiration)); - Map.emplace_hint(it, std::move(key), --UsageList.end()); + UsageList_.emplace_back(key, std::move(value), std::move(expiration)); + Map_.emplace_hint(it, std::move(key), --UsageList_.end()); } } std::optional<NUdf::TUnboxedValue> Get(const NUdf::TUnboxedValue key, const std::chrono::time_point<std::chrono::steady_clock>& now) { - if (auto it = Map.find(key); it != Map.end()) { + if (auto it = Map_.find(key); it != Map_.end()) { if (now < it->second->Expiration) { Touch(it->second); return it->second->Value; } else { - UsageList.erase(it->second); - Map.erase(it); + UsageList_.erase(it->second); + Map_.erase(it); return std::nullopt; } } @@ -76,10 +76,10 @@ public: // Perform garbage collection, single step, O(1) time. // Must be called periodically bool Tick(const std::chrono::time_point<std::chrono::steady_clock>& now) { - if (UsageList.empty()) { + if (UsageList_.empty()) { return false; } - if (now < UsageList.front().Expiration) { + if (now < UsageList_.front().Expiration) { return false; } RemoveLeastRecentlyUsedEntry(); @@ -93,8 +93,8 @@ public: } size_t Size() const { - Y_ABORT_UNLESS(Map.size() == UsageList.size()); - return Map.size(); + Y_ABORT_UNLESS(Map_.size() == UsageList_.size()); + return Map_.size(); } private: struct TKeyTypeHelpers { @@ -105,23 +105,23 @@ private: }; void Touch(TUsageList::iterator it) { - UsageList.splice(UsageList.end(), UsageList, it); //move accessed element to the end of Usage list + UsageList_.splice(UsageList_.end(), UsageList_, it); //move accessed element to the end of Usage list } void RemoveLeastRecentlyUsedEntry() { - Map.erase(UsageList.front().Key); - UsageList.pop_front(); + Map_.erase(UsageList_.front().Key); + UsageList_.pop_front(); } private: - const size_t MaxSize; - TUsageList UsageList; - const TKeyTypeContanerHelper<true, true, false> KeyTypeHelper; + const size_t MaxSize_; + TUsageList UsageList_; + const TKeyTypeContanerHelper<true, true, false> KeyTypeHelper_; std::unordered_map< - NUdf::TUnboxedValue, + NUdf::TUnboxedValue, TUsageList::iterator, TValueHasher, TValueEqual, NKikimr::NMiniKQL::TMKQLAllocator<std::pair<const NUdf::TUnboxedValue, TUsageList::iterator>> - > Map; + > Map_; }; diff --git a/yql/essentials/minikql/computation/mkql_optional_usage_mask.h b/yql/essentials/minikql/computation/mkql_optional_usage_mask.h index dab8bb257cb..335a2df8232 100644 --- a/yql/essentials/minikql/computation/mkql_optional_usage_mask.h +++ b/yql/essentials/minikql/computation/mkql_optional_usage_mask.h @@ -17,61 +17,61 @@ public: TOptionalUsageMask() = default; void Reset() { - CountOfOptional = 0U; - Mask.Clear(); + CountOfOptional_ = 0U; + Mask_.Clear(); } void Reset(TChunkedInputBuffer& buf) { Reset(); ui64 bytes = UnpackUInt64(buf); if (bytes) { - Mask.Reserve(bytes << 3ULL); - buf.CopyTo(reinterpret_cast<char*>(const_cast<ui8*>(Mask.GetChunks())), bytes); + Mask_.Reserve(bytes << 3ULL); + buf.CopyTo(reinterpret_cast<char*>(const_cast<ui8*>(Mask_.GetChunks())), bytes); } } void SetNextEmptyOptional(bool empty) { if (empty) { - Mask.Set(CountOfOptional); + Mask_.Set(CountOfOptional_); } - ++CountOfOptional; + ++CountOfOptional_; } bool IsNextEmptyOptional() { - return Mask.Test(CountOfOptional++); + return Mask_.Test(CountOfOptional_++); } bool IsEmptyMask() const { - return Mask.Empty(); + return Mask_.Empty(); } size_t CalcSerializedSize() { - if (!CountOfOptional || Mask.Empty()) { + if (!CountOfOptional_ || Mask_.Empty()) { return 1ULL; // One byte for size=0 } - const size_t usedBits = Mask.ValueBitCount(); + const size_t usedBits = Mask_.ValueBitCount(); const size_t usedBytes = (usedBits + 7ULL) >> 3ULL; return GetPack64Length(usedBytes) + usedBytes; } template<typename TBuf> void Serialize(TBuf& buf) const { - if (!CountOfOptional || Mask.Empty()) { + if (!CountOfOptional_ || Mask_.Empty()) { return buf.Append(0); } - const size_t usedBits = Mask.ValueBitCount(); + const size_t usedBits = Mask_.ValueBitCount(); const size_t usedBytes = (usedBits + 7ULL) >> 3ULL; buf.Advance(MAX_PACKED64_SIZE); // Note: usage of Pack64() is safe here - it won't overwrite useful data for small values of usedBytes buf.EraseBack(MAX_PACKED64_SIZE - Pack64(usedBytes, buf.Pos() - MAX_PACKED64_SIZE)); - buf.Append(reinterpret_cast<const char*>(Mask.GetChunks()), usedBytes); + buf.Append(reinterpret_cast<const char*>(Mask_.GetChunks()), usedBytes); } private: - ui32 CountOfOptional = 0U; - TBitMapOps<TDynamicBitMapTraits<ui8>> Mask; + ui32 CountOfOptional_ = 0U; + TBitMapOps<TDynamicBitMapTraits<ui8>> Mask_; }; } // NDetails diff --git a/yql/essentials/minikql/computation/mkql_validate.cpp b/yql/essentials/minikql/computation/mkql_validate.cpp index e7ae813f71e..d478852793a 100644 --- a/yql/essentials/minikql/computation/mkql_validate.cpp +++ b/yql/essentials/minikql/computation/mkql_validate.cpp @@ -20,32 +20,32 @@ struct TLazyVerifyListValue; template<class TValidateErrorPolicy> struct TLazyVerifyListIterator: public TBoxedValue { TLazyVerifyListIterator(const TLazyVerifyListValue<TValidateErrorPolicy>& lazyList, ui64 index = 0) - : LazyList(lazyList) - , OrigIter(TBoxedValueAccessor::GetListIterator(*lazyList.Orig)) - , Index(index) + : LazyList_(lazyList) + , OrigIter_(TBoxedValueAccessor::GetListIterator(*lazyList.Orig)) + , Index_(index) { - if (!OrigIter) { - TValidateErrorPolicy::Generate(TStringBuilder() << "TLazyVerifyListIterator constructor expect non empty result of GetListIterator" << VERIFY_DELIMITER << LazyList.Message); + if (!OrigIter_) { + TValidateErrorPolicy::Generate(TStringBuilder() << "TLazyVerifyListIterator constructor expect non empty result of GetListIterator" << VERIFY_DELIMITER << LazyList_.Message); } } private: - const TLazyVerifyListValue<TValidateErrorPolicy>& LazyList; - TUnboxedValue OrigIter; - ui64 Index; + const TLazyVerifyListValue<TValidateErrorPolicy>& LazyList_; + TUnboxedValue OrigIter_; + ui64 Index_; bool Next(NUdf::TUnboxedValue& item) final { - ++Index; - if (!OrigIter.Next(item)) + ++Index_; + if (!OrigIter_.Next(item)) return false; - TType* itemType = LazyList.ListType->GetItemType(); - item = TValidate<TValidateErrorPolicy, TValidateModeLazy<TValidateErrorPolicy>>::Value(LazyList.ValueBuilder, itemType, std::move(item), - TStringBuilder() << "LazyList[" << Index << "]" << VERIFY_DELIMITER << LazyList.Message); + TType* itemType = LazyList_.ListType->GetItemType(); + item = TValidate<TValidateErrorPolicy, TValidateModeLazy<TValidateErrorPolicy>>::Value(LazyList_.ValueBuilder, itemType, std::move(item), + TStringBuilder() << "LazyList[" << Index_ << "]" << VERIFY_DELIMITER << LazyList_.Message); return true; } bool Skip() final { - ++Index; - return OrigIter.Skip(); + ++Index_; + return OrigIter_.Skip(); } }; @@ -135,42 +135,42 @@ private: template<class TValidateErrorPolicy, bool Keys> struct TLazyVerifyDictIterator: public TBoxedValue { TLazyVerifyDictIterator(const TLazyVerifyDictValue<TValidateErrorPolicy>& lazyDict, ui64 index = 0) - : LazyDict(lazyDict) - , OrigIter((Keys ? &TBoxedValueAccessor::GetKeysIterator : &TBoxedValueAccessor::GetDictIterator)(*LazyDict.Orig)) - , Index(index) + : LazyDict_(lazyDict) + , OrigIter_((Keys ? &TBoxedValueAccessor::GetKeysIterator : &TBoxedValueAccessor::GetDictIterator)(*LazyDict_.Orig)) + , Index_(index) { - if (!OrigIter) { - TValidateErrorPolicy::Generate(TStringBuilder() << "TLazyVerifyDictIterator constructor expect non empty result of GetDictIterator" << VERIFY_DELIMITER << LazyDict.Message); + if (!OrigIter_) { + TValidateErrorPolicy::Generate(TStringBuilder() << "TLazyVerifyDictIterator constructor expect non empty result of GetDictIterator" << VERIFY_DELIMITER << LazyDict_.Message); } } private: - const TLazyVerifyDictValue<TValidateErrorPolicy>& LazyDict; - TUnboxedValue OrigIter; - ui64 Index; + const TLazyVerifyDictValue<TValidateErrorPolicy>& LazyDict_; + TUnboxedValue OrigIter_; + ui64 Index_; bool Skip() final { - ++Index; - return OrigIter.Skip(); + ++Index_; + return OrigIter_.Skip(); } bool Next(NUdf::TUnboxedValue& key) final { - ++Index; - if (!OrigIter.Next(key)) + ++Index_; + if (!OrigIter_.Next(key)) return false; - key = TValidate<TValidateErrorPolicy, TValidateModeLazy<TValidateErrorPolicy>>::Value(LazyDict.ValueBuilder, LazyDict.KeyType, std::move(key), - TStringBuilder() << "LazyDict[" << Index << "], validate key" << VERIFY_DELIMITER << LazyDict.Message); + key = TValidate<TValidateErrorPolicy, TValidateModeLazy<TValidateErrorPolicy>>::Value(LazyDict_.ValueBuilder, LazyDict_.KeyType, std::move(key), + TStringBuilder() << "LazyDict[" << Index_ << "], validate key" << VERIFY_DELIMITER << LazyDict_.Message); return true; } bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) final { - ++Index; - if (!OrigIter.NextPair(key, payload)) + ++Index_; + if (!OrigIter_.NextPair(key, payload)) return false; - key = TValidate<TValidateErrorPolicy, TValidateModeLazy<TValidateErrorPolicy>>::Value(LazyDict.ValueBuilder, LazyDict.KeyType, std::move(key), - TStringBuilder() << "LazyDict[" << Index << "], validate key" << VERIFY_DELIMITER << LazyDict.Message); - payload = TValidate<TValidateErrorPolicy, TValidateModeLazy<TValidateErrorPolicy>>::Value(LazyDict.ValueBuilder, LazyDict.PayloadType, std::move(payload), - TStringBuilder() << "LazyDict[" << Index << "], validate payload" << VERIFY_DELIMITER << LazyDict.Message); + key = TValidate<TValidateErrorPolicy, TValidateModeLazy<TValidateErrorPolicy>>::Value(LazyDict_.ValueBuilder, LazyDict_.KeyType, std::move(key), + TStringBuilder() << "LazyDict[" << Index_ << "], validate key" << VERIFY_DELIMITER << LazyDict_.Message); + payload = TValidate<TValidateErrorPolicy, TValidateModeLazy<TValidateErrorPolicy>>::Value(LazyDict_.ValueBuilder, LazyDict_.PayloadType, std::move(payload), + TStringBuilder() << "LazyDict[" << Index_ << "], validate payload" << VERIFY_DELIMITER << LazyDict_.Message); return true; } }; @@ -238,31 +238,31 @@ public: WrapCallableValue(const TCallableType* callableType, TUnboxedValue&& callable, const TString& message); private: - const TCallableType *const CallableType; - const TUnboxedValue Callable; - const TString Message; + const TCallableType *const CallableType_; + const TUnboxedValue Callable_; + const TString Message_; TUnboxedValue Run(const IValueBuilder* valueBuilder, const TUnboxedValuePod* args) const final; }; template<class TValidateErrorPolicy, class TValidateMode> WrapCallableValue<TValidateErrorPolicy, TValidateMode>::WrapCallableValue(const TCallableType* callableType, TUnboxedValue&& callable, const TString& message) - : CallableType(callableType) - , Callable(std::move(callable)) - , Message(message) + : CallableType_(callableType) + , Callable_(std::move(callable)) + , Message_(message) { } template<class TValidateErrorPolicy, class TValidateMode> TUnboxedValue WrapCallableValue<TValidateErrorPolicy, TValidateMode>::Run(const IValueBuilder* valueBuilder, const TUnboxedValuePod* args) const { - const ui32 argsCount = CallableType->GetArgumentsCount(); + const ui32 argsCount = CallableType_->GetArgumentsCount(); TSmallVec<TUnboxedValue> wrapArgs(argsCount); bool childWrapped = false; for (ui32 indexArg = 0; indexArg < argsCount; ++indexArg) { - const auto argType = CallableType->GetArgumentType(indexArg); - wrapArgs[indexArg] = TValidate<TValidateErrorPolicy, TValidateMode>::Value(valueBuilder, argType, TUnboxedValuePod(args[indexArg]), TStringBuilder() << "CallableWrapper<" << CallableType->GetName() << ">.arg[" << indexArg << "]" << VERIFY_DELIMITER << Message, &childWrapped); + const auto argType = CallableType_->GetArgumentType(indexArg); + wrapArgs[indexArg] = TValidate<TValidateErrorPolicy, TValidateMode>::Value(valueBuilder, argType, TUnboxedValuePod(args[indexArg]), TStringBuilder() << "CallableWrapper<" << CallableType_->GetName() << ">.arg[" << indexArg << "]" << VERIFY_DELIMITER << Message_, &childWrapped); } - return TValidate<TValidateErrorPolicy, TValidateMode>::Value(valueBuilder, CallableType->GetReturnType(), Callable.Run(valueBuilder, childWrapped ? wrapArgs.data() : args), TStringBuilder() << "CallableWrapper<" << CallableType->GetName() << ">.result" << VERIFY_DELIMITER << Message); + return TValidate<TValidateErrorPolicy, TValidateMode>::Value(valueBuilder, CallableType_->GetReturnType(), Callable_.Run(valueBuilder, childWrapped ? wrapArgs.data() : args), TStringBuilder() << "CallableWrapper<" << CallableType_->GetName() << ">.result" << VERIFY_DELIMITER << Message_); } } // anonymous namespace diff --git a/yql/essentials/minikql/computation/mkql_validate_ut.cpp b/yql/essentials/minikql/computation/mkql_validate_ut.cpp index b4e4d50670a..690fed7729d 100644 --- a/yql/essentials/minikql/computation/mkql_validate_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_validate_ut.cpp @@ -47,19 +47,19 @@ namespace NUdf { template<class TContainer> struct TListRefIterator: public TBoxedValue { TListRefIterator(const TContainer& listRef, ui32 holePos) - : ListRef(listRef) - , Index(-1) - , HolePos(holePos) + : ListRef_(listRef) + , Index_(-1) + , HolePos_(holePos) {} private: - const TContainer& ListRef; - ui32 Index; - ui32 HolePos; + const TContainer& ListRef_; + ui32 Index_; + ui32 HolePos_; bool Next(NUdf::TUnboxedValue& value) final { - if (++Index >= ListRef.size()) + if (++Index_ >= ListRef_.size()) return false; - value = Index == HolePos ? NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(42)) : ToUnboxedValue(ListRef[Index]); + value = Index_ == HolePos_ ? NUdf::TUnboxedValue(NUdf::TUnboxedValuePod(42)) : ToUnboxedValue(ListRef_[Index_]); return true; } }; @@ -67,34 +67,34 @@ namespace NUdf { template<class TContainer, ui32 TIndexDictBrokenHole = RAW_INDEX_NO_HOLE, bool TNoDictIndex = false> struct TListRef: public NUdf::TBoxedValue { TListRef(const TContainer& listRef, ui32 holePos = RAW_INDEX_NO_HOLE) - : ListRef(listRef) - , HolePos(holePos) + : ListRef_(listRef) + , HolePos_(holePos) {} private: - const TContainer& ListRef; - const NUdf::IValueBuilder* ValueBuilder; - ui32 HolePos; + const TContainer& ListRef_; + const NUdf::IValueBuilder* ValueBuilder_; + ui32 HolePos_; bool HasFastListLength() const override { return true; } ui64 GetListLength() const override { - return ListRef.size(); + return ListRef_.size(); } ui64 GetEstimatedListLength() const override { - return ListRef.size(); + return ListRef_.size(); } NUdf::TUnboxedValue GetListIterator() const override { - return NUdf::TUnboxedValuePod(new TListRefIterator<TContainer>(ListRef, HolePos)); + return NUdf::TUnboxedValuePod(new TListRefIterator<TContainer>(ListRef_, HolePos_)); } NUdf::IBoxedValuePtr ToIndexDictImpl(const IValueBuilder& builder) const override { return TNoDictIndex ? nullptr : builder.ToIndexDict(NUdf::TUnboxedValuePod( - new TListRef<TContainer, TIndexDictBrokenHole, true>(ListRef, TIndexDictBrokenHole))).AsBoxed(); + new TListRef<TContainer, TIndexDictBrokenHole, true>(ListRef_, TIndexDictBrokenHole))).AsBoxed(); } }; @@ -206,70 +206,70 @@ namespace NImpl { struct TBrokenSeqListIterator: public NUdf::TBoxedValue { TBrokenSeqListIterator(ui32 size, ui32 holePos) - : Size(size) - , HolePos(holePos) - , Index(-1) + : Size_(size) + , HolePos_(holePos) + , Index_(-1) {} private: - ui32 Size; - ui32 HolePos; - ui32 Index; + ui32 Size_; + ui32 HolePos_; + ui32 Index_; bool Skip() final { - return ++Index < Size; + return ++Index_ < Size_; } bool Next(NUdf::TUnboxedValue& value) final { if (!Skip()) return false; - value = Index == HolePos ? NUdf::TUnboxedValuePod() : NUdf::TUnboxedValuePod(Index); + value = Index_ == HolePos_ ? NUdf::TUnboxedValuePod() : NUdf::TUnboxedValuePod(Index_); return true; } }; struct TBrokenSeqListBoxedValue: public NUdf::TBoxedValue { TBrokenSeqListBoxedValue(ui32 size, ui32 holePos) - : ListSize(size) - , HolePos(holePos) + : ListSize_(size) + , HolePos_(holePos) {} private: - ui32 ListSize; - ui32 HolePos; + ui32 ListSize_; + ui32 HolePos_; bool HasFastListLength() const override { return true; } ui64 GetListLength() const override { - return ListSize; + return ListSize_; } ui64 GetEstimatedListLength() const override { - return ListSize; + return ListSize_; } NUdf::TUnboxedValue GetListIterator() const override { - return NUdf::TUnboxedValuePod(new TBrokenSeqListIterator(ListSize, HolePos)); + return NUdf::TUnboxedValuePod(new TBrokenSeqListIterator(ListSize_, HolePos_)); } }; template<class TStructType> struct TBrokenStructBoxedValue: public NUdf::TBoxedValue { TBrokenStructBoxedValue(const TStructType& data, ui32 holePos = RAW_INDEX_NO_HOLE) - : Struct(data) - , HolePos(holePos) + : Struct_(data) + , HolePos_(holePos) {} private: - const TStructType& Struct; - ui32 HolePos; + const TStructType& Struct_; + ui32 HolePos_; NUdf::TUnboxedValue GetElement(ui32 index) const override { - if (index == HolePos) { + if (index == HolePos_) { return NUdf::TUnboxedValuePod(); } - return Struct.GetByIndex(TStructType::MetaBackIndexes[index]); + return Struct_.GetByIndex(TStructType::MetaBackIndexes[index]); } }; @@ -288,23 +288,23 @@ namespace { template<class TTupleType> struct TBrokenTupleBoxedValue: public NUdf::TBoxedValue { TBrokenTupleBoxedValue(const TTupleType& tuple, ui32 holePos) - : Tuple(tuple) - , HolePos(holePos) + : Tuple_(tuple) + , HolePos_(holePos) {} private: - const TTupleType& Tuple; - ui32 HolePos; + const TTupleType& Tuple_; + ui32 HolePos_; NUdf::TUnboxedValue GetElement(ui32 index) const override { - if (index == HolePos) { + if (index == HolePos_) { return NUdf::TUnboxedValuePod(); } switch (index) { - case 0: return ToUnboxedValue(std::get<0>(Tuple)); - case 1: return ToUnboxedValue(std::get<1>(Tuple)); - case 2: return ToUnboxedValue(std::get<2>(Tuple)); - case 3: return ToUnboxedValue(std::get<3>(Tuple)); + case 0: return ToUnboxedValue(std::get<0>(Tuple_)); + case 1: return ToUnboxedValue(std::get<1>(Tuple_)); + case 2: return ToUnboxedValue(std::get<2>(Tuple_)); + case 3: return ToUnboxedValue(std::get<3>(Tuple_)); default: Y_ABORT("Unexpected"); } } @@ -315,31 +315,31 @@ namespace { template<class TKey, class TValue> struct TBrokenDictIterator: public NUdf::TBoxedValue { TBrokenDictIterator(const std::vector<std::pair<TKey, TValue>>& dictData, PosPair holePos) - : DictData(dictData) - , HolePos(holePos) - , Index(-1) + : DictData_(dictData) + , HolePos_(holePos) + , Index_(-1) {} private: - const std::vector<std::pair<TKey, TValue>>& DictData; - PosPair HolePos; - ui32 Index; + const std::vector<std::pair<TKey, TValue>>& DictData_; + PosPair HolePos_; + ui32 Index_; bool Skip() final { - return ++Index < DictData.size(); + return ++Index_ < DictData_.size(); } bool Next(NUdf::TUnboxedValue& key) final { if (!Skip()) return false; - key = Index == HolePos.first ? NUdf::TUnboxedValuePod() : NUdf::TUnboxedValuePod(DictData[Index].first); + key = Index_ == HolePos_.first ? NUdf::TUnboxedValuePod() : NUdf::TUnboxedValuePod(DictData_[Index_].first); return true; } bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) final { if (!Next(key)) return false; - payload = Index == HolePos.second ? NUdf::TUnboxedValue() : ToUnboxedValue(DictData[Index].second); + payload = Index_ == HolePos_.second ? NUdf::TUnboxedValue() : ToUnboxedValue(DictData_[Index_].second); return true; } }; @@ -348,33 +348,33 @@ namespace { struct TBrokenDictBoxedValue: public NUdf::TBoxedValue { TBrokenDictBoxedValue(const std::vector<std::pair<TKey, TValue>>& dictData, PosPair holePos, NUdf::TUnboxedValue&& hole = NUdf::TUnboxedValuePod()) - : DictData(dictData) - , HolePos(holePos) - , Hole(std::move(hole)) + : DictData_(dictData) + , HolePos_(holePos) + , Hole_(std::move(hole)) {} private: - const std::vector<std::pair<TKey, TValue>> DictData; - PosPair HolePos; - NUdf::TUnboxedValue Hole; + const std::vector<std::pair<TKey, TValue>> DictData_; + PosPair HolePos_; + NUdf::TUnboxedValue Hole_; NUdf::TUnboxedValue GetKeysIterator() const override { - return NUdf::TUnboxedValuePod(new TBrokenDictIterator<TKey, TValue>(DictData, HolePos)); + return NUdf::TUnboxedValuePod(new TBrokenDictIterator<TKey, TValue>(DictData_, HolePos_)); } NUdf::TUnboxedValue GetDictIterator() const override { - return NUdf::TUnboxedValuePod(new TBrokenDictIterator<TKey, TValue>(DictData, HolePos)); + return NUdf::TUnboxedValuePod(new TBrokenDictIterator<TKey, TValue>(DictData_, HolePos_)); } }; struct TThrowerValue: public NUdf::TBoxedValue { static long Count; TThrowerValue(NUdf::IBoxedValuePtr&& owner = NUdf::IBoxedValuePtr()) - : Owner(std::move(owner)) + : Owner_(std::move(owner)) { ++Count; } ~TThrowerValue() { --Count; } private: - const NUdf::IBoxedValuePtr Owner; + const NUdf::IBoxedValuePtr Owner_; bool Skip() override { ythrow yexception() << "Throw"; @@ -571,7 +571,7 @@ namespace { const ui32 DICT_DIGIT2PERSON_BROKEN_PERSON_INDEX = 1; const ui32 DICT_DIGIT2PERSON_BROKEN_STRUCT_INDEX = 2; - const std::vector<std::pair<ui32, NUdf::IBoxedValuePtr>> MAKE_DICT_DIGIT2PERSON_BROKEN() { + const std::vector<std::pair<ui32, NUdf::IBoxedValuePtr>> MakeDictDigiT2PersonBroken() { std::vector<std::pair<ui32, NUdf::IBoxedValuePtr>> DICT_DIGIT2PERSON_BROKEN = { { 333, new TBrokenStructBoxedValue<NUdf::PersonStruct>(STRUCT_PERSON_HITHCOCK, RAW_INDEX_NO_HOLE) }, { 5, new TBrokenStructBoxedValue<NUdf::PersonStruct>(STRUCT_PERSON_JONNIE, DICT_DIGIT2PERSON_BROKEN_STRUCT_INDEX) }, @@ -583,7 +583,7 @@ namespace { typedef NUdf::TDict<ui32,NUdf::PersonStruct> NUdfDictDigPerson; - std::vector<std::pair<ui32, NUdf::IBoxedValuePtr>> MAKE_DICT_DIGIT2PERSON() { + std::vector<std::pair<ui32, NUdf::IBoxedValuePtr>> MakeDictDigiT2Person() { const std::vector<std::pair<ui32, NUdf::IBoxedValuePtr>> DICT_DIGIT2PERSON = { { 333, new TBrokenStructBoxedValue<NUdf::PersonStruct>(STRUCT_PERSON_HITHCOCK, RAW_INDEX_NO_HOLE) }, { 5, new TBrokenStructBoxedValue<NUdf::PersonStruct>(STRUCT_PERSON_JONNIE, RAW_INDEX_NO_HOLE) }, @@ -597,7 +597,7 @@ namespace { Y_UNUSED(args); Y_UNUSED(valueBuilder); NUdf::IBoxedValuePtr boxed(new TBrokenDictBoxedValue<ui32, NUdf::IBoxedValuePtr>( - MAKE_DICT_DIGIT2PERSON(), std::make_pair(RAW_INDEX_NO_HOLE, RAW_INDEX_NO_HOLE))); + MakeDictDigiT2Person(), std::make_pair(RAW_INDEX_NO_HOLE, RAW_INDEX_NO_HOLE))); return NUdf::TUnboxedValuePod(std::move(boxed)); } @@ -605,7 +605,7 @@ namespace { Y_UNUSED(args); Y_UNUSED(valueBuilder); NUdf::IBoxedValuePtr boxed(new TBrokenDictBoxedValue<ui32, NUdf::IBoxedValuePtr>( - MAKE_DICT_DIGIT2PERSON_BROKEN(), std::make_pair(RAW_INDEX_NO_HOLE, RAW_INDEX_NO_HOLE))); + MakeDictDigiT2PersonBroken(), std::make_pair(RAW_INDEX_NO_HOLE, RAW_INDEX_NO_HOLE))); return NUdf::TUnboxedValuePod(std::move(boxed)); } @@ -1120,7 +1120,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLValidateTest) { auto dictIter = value.GetDictIterator(); NUdf::TUnboxedValue key, payload; for (ui32 index = 0; dictIter.NextPair(key, payload); ++index) { - UNIT_ASSERT_VALUES_EQUAL(key.Get<ui32>(), MAKE_DICT_DIGIT2PERSON()[index].first); + UNIT_ASSERT_VALUES_EQUAL(key.Get<ui32>(), MakeDictDigiT2Person()[index].first); auto person = payload; auto firstName = person.GetElement(NUdf::PersonStruct::MetaIndexes[0]); UNIT_ASSERT_VALUES_EQUAL(TString(firstName.AsStringRef()), DICT_DIGIT2PERSON_BROKEN_CONTENT_BY_INDEX[index]->FirstName); @@ -1137,7 +1137,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLValidateTest) { auto dictIter = value.GetDictIterator(); NUdf::TUnboxedValue key, payload; for (ui32 index = 0; index < DICT_DIGIT2PERSON_BROKEN_PERSON_INDEX && dictIter.NextPair(key, payload); ++index) { - UNIT_ASSERT_VALUES_EQUAL(key.Get<ui32>(), MAKE_DICT_DIGIT2PERSON_BROKEN()[index].first); + UNIT_ASSERT_VALUES_EQUAL(key.Get<ui32>(), MakeDictDigiT2PersonBroken()[index].first); auto person = payload; auto firstName = person.GetElement(NUdf::PersonStruct::MetaIndexes[0]); UNIT_ASSERT_VALUES_EQUAL(TString(firstName.AsStringRef()), DICT_DIGIT2PERSON_BROKEN_CONTENT_BY_INDEX[index]->FirstName); diff --git a/yql/essentials/minikql/computation/mkql_value_builder_ut.cpp b/yql/essentials/minikql/computation/mkql_value_builder_ut.cpp index 127c55bc9b2..a22800590ec 100644 --- a/yql/essentials/minikql/computation/mkql_value_builder_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_value_builder_ut.cpp @@ -37,32 +37,32 @@ namespace { class TMiniKQLValueBuilderTest: public TTestBase { public: TMiniKQLValueBuilderTest() - : FunctionRegistry(CreateFunctionRegistry(CreateBuiltinRegistry())) - , Alloc(__LOCATION__) - , Env(Alloc) - , MemInfo("Memory") - , HolderFactory(Alloc.Ref(), MemInfo, FunctionRegistry.Get()) - , Builder(HolderFactory, NUdf::EValidatePolicy::Exception) - , TypeInfoHelper(new TTypeInfoHelper()) - , FunctionTypeInfoBuilder(NYql::UnknownLangVersion, Env, TypeInfoHelper, "", nullptr, {}) + : FunctionRegistry_(CreateFunctionRegistry(CreateBuiltinRegistry())) + , Alloc_(__LOCATION__) + , Env_(Alloc_) + , MemInfo_("Memory") + , HolderFactory_(Alloc_.Ref(), MemInfo_, FunctionRegistry_.Get()) + , Builder_(HolderFactory_, NUdf::EValidatePolicy::Exception) + , TypeInfoHelper_(new TTypeInfoHelper()) + , FunctionTypeInfoBuilder_(NYql::UnknownLangVersion, Env_, TypeInfoHelper_, "", nullptr, {}) { - BoolOid = NYql::NPg::LookupType("bool").TypeId; + BoolOid_ = NYql::NPg::LookupType("bool").TypeId; } const IPgBuilder& GetPgBuilder() const { - return Builder.GetPgBuilder(); + return Builder_.GetPgBuilder(); } private: - TIntrusivePtr<NMiniKQL::IFunctionRegistry> FunctionRegistry; - TScopedAlloc Alloc; - TTypeEnvironment Env; - TMemoryUsageInfo MemInfo; - THolderFactory HolderFactory; - TDefaultValueBuilder Builder; - NUdf::ITypeInfoHelper::TPtr TypeInfoHelper; - TFunctionTypeInfoBuilder FunctionTypeInfoBuilder; - ui32 BoolOid = 0; + TIntrusivePtr<NMiniKQL::IFunctionRegistry> FunctionRegistry_; + TScopedAlloc Alloc_; + TTypeEnvironment Env_; + TMemoryUsageInfo MemInfo_; + THolderFactory HolderFactory_; + TDefaultValueBuilder Builder_; + NUdf::ITypeInfoHelper::TPtr TypeInfoHelper_; + TFunctionTypeInfoBuilder FunctionTypeInfoBuilder_; + ui32 BoolOid_ = 0; UNIT_TEST_SUITE(TMiniKQLValueBuilderTest); UNIT_TEST(TestEmbeddedVariant); @@ -79,7 +79,7 @@ private: void TestEmbeddedVariant() { - const auto v = Builder.NewVariant(62, TUnboxedValuePod((ui64) 42)); + const auto v = Builder_.NewVariant(62, TUnboxedValuePod((ui64) 42)); UNIT_ASSERT(v); UNIT_ASSERT(!v.IsBoxed()); UNIT_ASSERT_VALUES_EQUAL(62, v.GetVariantIndex()); @@ -87,7 +87,7 @@ private: } void TestBoxedVariant() { - const auto v = Builder.NewVariant(63, TUnboxedValuePod((ui64) 42)); + const auto v = Builder_.NewVariant(63, TUnboxedValuePod((ui64) 42)); UNIT_ASSERT(v); UNIT_ASSERT(v.IsBoxed()); UNIT_ASSERT_VALUES_EQUAL(63, v.GetVariantIndex()); @@ -95,137 +95,137 @@ private: } void TestSubstring() { - const auto string = Builder.NewString("0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"); + const auto string = Builder_.NewString("0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"); UNIT_ASSERT(string); - const auto zero = Builder.SubString(string, 7, 0); + const auto zero = Builder_.SubString(string, 7, 0); UNIT_ASSERT_VALUES_EQUAL(TStringBuf(""), TStringBuf(zero.AsStringRef())); - const auto tail = Builder.SubString(string, 60, 8); + const auto tail = Builder_.SubString(string, 60, 8); UNIT_ASSERT_VALUES_EQUAL(TStringBuf("NM"), TStringBuf(tail.AsStringRef())); - const auto small = Builder.SubString(string, 2, 14); + const auto small = Builder_.SubString(string, 2, 14); UNIT_ASSERT_VALUES_EQUAL(TStringBuf("23456789qwerty"), TStringBuf(small.AsStringRef())); - const auto one = Builder.SubString(string, 3, 15); + const auto one = Builder_.SubString(string, 3, 15); UNIT_ASSERT_VALUES_EQUAL(TStringBuf("3456789qwertyui"), TStringBuf(one.AsStringRef())); UNIT_ASSERT_VALUES_EQUAL(string.AsStringValue().Data(), one.AsStringValue().Data()); - const auto two = Builder.SubString(string, 10, 30); + const auto two = Builder_.SubString(string, 10, 30); UNIT_ASSERT_VALUES_EQUAL(TStringBuf("qwertyuiopasdfghjklzxcvbnmQWER"), TStringBuf(two.AsStringRef())); UNIT_ASSERT_VALUES_EQUAL(string.AsStringValue().Data(), two.AsStringValue().Data()); } void TestPgValueFromErrors() { - const TBindTerminator bind(&Builder); // to raise exception instead of abort + const TBindTerminator bind(&Builder_); // to raise exception instead of abort { TStringValue error(""); - auto r = GetPgBuilder().ValueFromText(BoolOid, "", error); + auto r = GetPgBuilder().ValueFromText(BoolOid_, "", error); UNIT_ASSERT(!r); UNIT_ASSERT_STRING_CONTAINS(AsString(error), "ERROR: invalid input syntax for type boolean: \"\""); } { TStringValue error(""); - auto r = GetPgBuilder().ValueFromText(BoolOid, "zzzz", error); + auto r = GetPgBuilder().ValueFromText(BoolOid_, "zzzz", error); UNIT_ASSERT(!r); UNIT_ASSERT_STRING_CONTAINS(AsString(error), "ERROR: invalid input syntax for type boolean: \"zzzz\""); } { TStringValue error(""); - auto r = GetPgBuilder().ValueFromBinary(BoolOid, "", error); + auto r = GetPgBuilder().ValueFromBinary(BoolOid_, "", error); UNIT_ASSERT(!r); UNIT_ASSERT_STRING_CONTAINS(AsString(error), "ERROR: no data left in message"); } { TStringValue error(""); - auto r = GetPgBuilder().ValueFromBinary(BoolOid, "zzzz", error); + auto r = GetPgBuilder().ValueFromBinary(BoolOid_, "zzzz", error); UNIT_ASSERT(!r); UNIT_ASSERT_STRING_CONTAINS(AsString(error), "Not all data has been consumed by 'recv' function: boolrecv, data size: 4, consumed size: 1"); } } void TestPgValueFromText() { - const TBindTerminator bind(&Builder); + const TBindTerminator bind(&Builder_); for (auto validTrue : { "t"sv, "true"sv }) { TStringValue error(""); - auto r = GetPgBuilder().ValueFromText(BoolOid, validTrue, error); + auto r = GetPgBuilder().ValueFromText(BoolOid_, validTrue, error); UNIT_ASSERT(r); UNIT_ASSERT_VALUES_EQUAL(AsString(error), ""); - auto s = PgValueToNativeText(r, BoolOid); + auto s = PgValueToNativeText(r, BoolOid_); UNIT_ASSERT_VALUES_EQUAL(s, "t"); } for (auto validFalse : { "f"sv, "false"sv }) { TStringValue error(""); - auto r = GetPgBuilder().ValueFromText(BoolOid, validFalse, error); + auto r = GetPgBuilder().ValueFromText(BoolOid_, validFalse, error); UNIT_ASSERT(r); UNIT_ASSERT_VALUES_EQUAL(AsString(error), ""); - auto s = PgValueToNativeText(r, BoolOid); + auto s = PgValueToNativeText(r, BoolOid_); UNIT_ASSERT_VALUES_EQUAL(s, "f"); } } void TestPgValueFromBinary() { - const TBindTerminator bind(&Builder); + const TBindTerminator bind(&Builder_); TStringValue error(""); - auto t = GetPgBuilder().ValueFromText(BoolOid, "true", error); + auto t = GetPgBuilder().ValueFromText(BoolOid_, "true", error); UNIT_ASSERT(t); - auto f = GetPgBuilder().ValueFromText(BoolOid, "false", error); + auto f = GetPgBuilder().ValueFromText(BoolOid_, "false", error); UNIT_ASSERT(f); - auto ts = PgValueToNativeBinary(t, BoolOid); - auto fs = PgValueToNativeBinary(f, BoolOid); + auto ts = PgValueToNativeBinary(t, BoolOid_); + auto fs = PgValueToNativeBinary(f, BoolOid_); { - auto r = GetPgBuilder().ValueFromBinary(BoolOid, ts, error); + auto r = GetPgBuilder().ValueFromBinary(BoolOid_, ts, error); UNIT_ASSERT(r); - auto s = PgValueToNativeText(r, BoolOid); + auto s = PgValueToNativeText(r, BoolOid_); UNIT_ASSERT_VALUES_EQUAL(s, "t"); } { - auto r = GetPgBuilder().ValueFromBinary(BoolOid, fs, error); + auto r = GetPgBuilder().ValueFromBinary(BoolOid_, fs, error); UNIT_ASSERT(r); - auto s = PgValueToNativeText(r, BoolOid); + auto s = PgValueToNativeText(r, BoolOid_); UNIT_ASSERT_VALUES_EQUAL(s, "f"); } } void TestConvertToFromPg() { - const TBindTerminator bind(&Builder); - auto boolType = FunctionTypeInfoBuilder.SimpleType<bool>(); + const TBindTerminator bind(&Builder_); + auto boolType = FunctionTypeInfoBuilder_.SimpleType<bool>(); { - auto v = GetPgBuilder().ConvertToPg(TUnboxedValuePod(true), boolType, BoolOid); - auto s = PgValueToNativeText(v, BoolOid); + auto v = GetPgBuilder().ConvertToPg(TUnboxedValuePod(true), boolType, BoolOid_); + auto s = PgValueToNativeText(v, BoolOid_); UNIT_ASSERT_VALUES_EQUAL(s, "t"); - auto from = GetPgBuilder().ConvertFromPg(v, BoolOid, boolType); + auto from = GetPgBuilder().ConvertFromPg(v, BoolOid_, boolType); UNIT_ASSERT_VALUES_EQUAL(from.Get<bool>(), true); } { - auto v = GetPgBuilder().ConvertToPg(TUnboxedValuePod(false), boolType, BoolOid); - auto s = PgValueToNativeText(v, BoolOid); + auto v = GetPgBuilder().ConvertToPg(TUnboxedValuePod(false), boolType, BoolOid_); + auto s = PgValueToNativeText(v, BoolOid_); UNIT_ASSERT_VALUES_EQUAL(s, "f"); - auto from = GetPgBuilder().ConvertFromPg(v, BoolOid, boolType); + auto from = GetPgBuilder().ConvertFromPg(v, BoolOid_, boolType); UNIT_ASSERT_VALUES_EQUAL(from.Get<bool>(), false); } } void TestConvertToFromPgNulls() { - const TBindTerminator bind(&Builder); - auto boolOptionalType = FunctionTypeInfoBuilder.Optional()->Item<bool>().Build(); + const TBindTerminator bind(&Builder_); + auto boolOptionalType = FunctionTypeInfoBuilder_.Optional()->Item<bool>().Build(); { - auto v = GetPgBuilder().ConvertToPg(TUnboxedValuePod(), boolOptionalType, BoolOid); + auto v = GetPgBuilder().ConvertToPg(TUnboxedValuePod(), boolOptionalType, BoolOid_); UNIT_ASSERT(!v); } { - auto v = GetPgBuilder().ConvertFromPg(TUnboxedValuePod(), BoolOid, boolOptionalType); + auto v = GetPgBuilder().ConvertFromPg(TUnboxedValuePod(), BoolOid_, boolOptionalType); UNIT_ASSERT(!v); } } @@ -236,7 +236,7 @@ private: UNIT_ASSERT_VALUES_EQUAL(pgText.TypeLen, -1); auto s = GetPgBuilder().NewString(pgText.TypeLen, pgText.TypeId, "ABC"); - auto utf8Type = FunctionTypeInfoBuilder.SimpleType<TUtf8>(); + auto utf8Type = FunctionTypeInfoBuilder_.SimpleType<TUtf8>(); auto from = GetPgBuilder().ConvertFromPg(s, pgText.TypeId, utf8Type); UNIT_ASSERT_VALUES_EQUAL((TStringBuf)from.AsStringRef(), "ABC"sv); } @@ -246,7 +246,7 @@ private: UNIT_ASSERT_VALUES_EQUAL(pgCString.TypeLen, -2); auto s = GetPgBuilder().NewString(pgCString.TypeLen, pgCString.TypeId, "ABC"); - auto utf8Type = FunctionTypeInfoBuilder.SimpleType<TUtf8>(); + auto utf8Type = FunctionTypeInfoBuilder_.SimpleType<TUtf8>(); auto from = GetPgBuilder().ConvertFromPg(s, pgCString.TypeId, utf8Type); UNIT_ASSERT_VALUES_EQUAL((TStringBuf)from.AsStringRef(), "ABC"sv); } @@ -256,29 +256,29 @@ private: UNIT_ASSERT_VALUES_EQUAL(byteaString.TypeLen, -1); auto s = GetPgBuilder().NewString(byteaString.TypeLen, byteaString.TypeId, "ABC"); - auto stringType = FunctionTypeInfoBuilder.SimpleType<char*>(); + auto stringType = FunctionTypeInfoBuilder_.SimpleType<char*>(); auto from = GetPgBuilder().ConvertFromPg(s, byteaString.TypeId, stringType); UNIT_ASSERT_VALUES_EQUAL((TStringBuf)from.AsStringRef(), "ABC"sv); } } void TestArrowBlock() { - auto type = FunctionTypeInfoBuilder.SimpleType<ui64>(); - auto atype = TypeInfoHelper->MakeArrowType(type); + auto type = FunctionTypeInfoBuilder_.SimpleType<ui64>(); + auto atype = TypeInfoHelper_->MakeArrowType(type); { arrow::Datum d1(std::make_shared<arrow::UInt64Scalar>(123)); - NUdf::TUnboxedValue val1 = HolderFactory.CreateArrowBlock(std::move(d1)); + NUdf::TUnboxedValue val1 = HolderFactory_.CreateArrowBlock(std::move(d1)); bool isScalar; ui64 length; - auto chunks = Builder.GetArrowBlockChunks(val1, isScalar, length); + auto chunks = Builder_.GetArrowBlockChunks(val1, isScalar, length); UNIT_ASSERT_VALUES_EQUAL(chunks, 1); UNIT_ASSERT(isScalar); UNIT_ASSERT_VALUES_EQUAL(length, 1); ArrowArray arr1; - Builder.ExportArrowBlock(val1, 0, &arr1); - NUdf::TUnboxedValue val2 = Builder.ImportArrowBlock(&arr1, 1, isScalar, *atype); + Builder_.ExportArrowBlock(val1, 0, &arr1); + NUdf::TUnboxedValue val2 = Builder_.ImportArrowBlock(&arr1, 1, isScalar, *atype); const auto& d2 = TArrowBlock::From(val2).GetDatum(); UNIT_ASSERT(d2.is_scalar()); UNIT_ASSERT_VALUES_EQUAL(d2.scalar_as<arrow::UInt64Scalar>().value, 123); @@ -293,18 +293,18 @@ private: std::shared_ptr<arrow::ArrayData> builderResult; UNIT_ASSERT(builder.FinishInternal(&builderResult).ok()); arrow::Datum d1(builderResult); - NUdf::TUnboxedValue val1 = HolderFactory.CreateArrowBlock(std::move(d1)); + NUdf::TUnboxedValue val1 = HolderFactory_.CreateArrowBlock(std::move(d1)); bool isScalar; ui64 length; - auto chunks = Builder.GetArrowBlockChunks(val1, isScalar, length); + auto chunks = Builder_.GetArrowBlockChunks(val1, isScalar, length); UNIT_ASSERT_VALUES_EQUAL(chunks, 1); UNIT_ASSERT(!isScalar); UNIT_ASSERT_VALUES_EQUAL(length, 3); ArrowArray arr1; - Builder.ExportArrowBlock(val1, 0, &arr1); - NUdf::TUnboxedValue val2 = Builder.ImportArrowBlock(&arr1, 1, isScalar, *atype); + Builder_.ExportArrowBlock(val1, 0, &arr1); + NUdf::TUnboxedValue val2 = Builder_.ImportArrowBlock(&arr1, 1, isScalar, *atype); const auto& d2 = TArrowBlock::From(val2).GetDatum(); UNIT_ASSERT(d2.is_array()); UNIT_ASSERT_VALUES_EQUAL(d2.array()->length, 3); @@ -333,19 +333,19 @@ private: auto chunked = arrow::ChunkedArray::Make({ builder1Result, builder2Result }).ValueOrDie(); arrow::Datum d1(chunked); - NUdf::TUnboxedValue val1 = HolderFactory.CreateArrowBlock(std::move(d1)); + NUdf::TUnboxedValue val1 = HolderFactory_.CreateArrowBlock(std::move(d1)); bool isScalar; ui64 length; - auto chunks = Builder.GetArrowBlockChunks(val1, isScalar, length); + auto chunks = Builder_.GetArrowBlockChunks(val1, isScalar, length); UNIT_ASSERT_VALUES_EQUAL(chunks, 2); UNIT_ASSERT(!isScalar); UNIT_ASSERT_VALUES_EQUAL(length, 5); ArrowArray arrs[2]; - Builder.ExportArrowBlock(val1, 0, &arrs[0]); - Builder.ExportArrowBlock(val1, 1, &arrs[1]); - NUdf::TUnboxedValue val2 = Builder.ImportArrowBlock(arrs, 2, isScalar, *atype); + Builder_.ExportArrowBlock(val1, 0, &arrs[0]); + Builder_.ExportArrowBlock(val1, 1, &arrs[1]); + NUdf::TUnboxedValue val2 = Builder_.ImportArrowBlock(arrs, 2, isScalar, *atype); const auto& d2 = TArrowBlock::From(val2).GetDatum(); UNIT_ASSERT(d2.is_arraylike() && !d2.is_array()); UNIT_ASSERT_VALUES_EQUAL(d2.length(), 5); diff --git a/yql/essentials/minikql/computation/mkql_vector_spiller_adapter.h b/yql/essentials/minikql/computation/mkql_vector_spiller_adapter.h index 8c9896cf98d..e39c29154fb 100644 --- a/yql/essentials/minikql/computation/mkql_vector_spiller_adapter.h +++ b/yql/essentials/minikql/computation/mkql_vector_spiller_adapter.h @@ -23,41 +23,41 @@ public: }; TVectorSpillerAdapter(ISpiller::TPtr spiller, size_t sizeLimit) - : Spiller(spiller) - , SizeLimit(sizeLimit) + : Spiller_(spiller) + , SizeLimit_(sizeLimit) { } ///Returns current stete of the adapter EState GetState() const { - return State; + return State_; } ///Is adapter ready to spill next vector via AddData method. ///Returns false in case when there are async operations in progress. bool IsAcceptingData() { - return State == EState::AcceptingData; + return State_ == EState::AcceptingData; } ///When data is ready ExtractVector() is expected to be called. bool IsDataReady() { - return State == EState::DataReady; + return State_ == EState::DataReady; } ///Adapter is ready to accept requests for vectors. bool IsAcceptingDataRequests() { - return State == EState::AcceptingDataRequests; + return State_ == EState::AcceptingDataRequests; } ///Adds new vector to storage. Will not launch real disk operation if case of small vectors ///(if inner buffer is not full). void AddData(std::vector<T, Alloc>&& vec) { - MKQL_ENSURE(CurrentVector.empty(), "Internal logic error"); - MKQL_ENSURE(State == EState::AcceptingData, "Internal logic error"); + MKQL_ENSURE(CurrentVector_.empty(), "Internal logic error"); + MKQL_ENSURE(State_ == EState::AcceptingData, "Internal logic error"); - StoredChunksElementsCount.push(vec.size()); - CurrentVector = std::move(vec); - NextVectorPositionToSave = 0; + StoredChunksElementsCount_.push(vec.size()); + CurrentVector_ = std::move(vec); + NextVectorPositionToSave_ = 0; SaveNextPartOfVector(); } @@ -66,31 +66,31 @@ public: ///For SpillingData state it will try to spill more content of inner buffer. ///ForRestoringData state it will try to load more content of requested vector. void Update() { - switch (State) { + switch (State_) { case EState::SpillingData: - MKQL_ENSURE(WriteOperation.has_value(), "Internal logic error"); - if (!WriteOperation->HasValue()) return; + MKQL_ENSURE(WriteOperation_.has_value(), "Internal logic error"); + if (!WriteOperation_->HasValue()) return; - StoredChunks.push(WriteOperation->ExtractValue()); - WriteOperation = std::nullopt; - if (IsFinalizing) { - State = EState::AcceptingDataRequests; + StoredChunks_.push(WriteOperation_->ExtractValue()); + WriteOperation_ = std::nullopt; + if (IsFinalizing_) { + State_ = EState::AcceptingDataRequests; return; } - if (CurrentVector.empty()) { - State = EState::AcceptingData; + if (CurrentVector_.empty()) { + State_ = EState::AcceptingData; return; } SaveNextPartOfVector(); return; case EState::RestoringData: - MKQL_ENSURE(ReadOperation.has_value(), "Internal logic error"); - if (!ReadOperation->HasValue()) return; - Buffer = std::move(ReadOperation->ExtractValue().value()); - ReadOperation = std::nullopt; - StoredChunks.pop(); + MKQL_ENSURE(ReadOperation_.has_value(), "Internal logic error"); + if (!ReadOperation_->HasValue()) return; + Buffer_ = std::move(ReadOperation_->ExtractValue().value()); + ReadOperation_ = std::nullopt; + StoredChunks_.pop(); LoadNextVector(); return; @@ -101,21 +101,21 @@ public: ///Get requested vector. std::vector<T, Alloc>&& ExtractVector() { - StoredChunksElementsCount.pop(); - State = EState::AcceptingDataRequests; - return std::move(CurrentVector); + StoredChunksElementsCount_.pop(); + State_ = EState::AcceptingDataRequests; + return std::move(CurrentVector_); } ///Start restoring next vector. If th eentire contents of the vector are in memory ///State will be changed to DataREady without any async read operation. ExtractVector is expected ///to be called immediately. void RequestNextVector() { - MKQL_ENSURE(State == EState::AcceptingDataRequests, "Internal logic error"); - MKQL_ENSURE(CurrentVector.empty(), "Internal logic error"); - MKQL_ENSURE(!StoredChunksElementsCount.empty(), "Internal logic error"); + MKQL_ENSURE(State_ == EState::AcceptingDataRequests, "Internal logic error"); + MKQL_ENSURE(CurrentVector_.empty(), "Internal logic error"); + MKQL_ENSURE(!StoredChunksElementsCount_.empty(), "Internal logic error"); - CurrentVector.reserve(StoredChunksElementsCount.front()); - State = EState::RestoringData; + CurrentVector_.reserve(StoredChunksElementsCount_.front()); + State_ = EState::RestoringData; LoadNextVector(); } @@ -123,14 +123,14 @@ public: ///Finalize will spill all the contents of inner buffer if any. ///Is case if buffer is not ready async write operation will be started. void Finalize() { - MKQL_ENSURE(CurrentVector.empty(), "Internal logic error"); - if (Buffer.Empty()) { - State = EState::AcceptingDataRequests; + MKQL_ENSURE(CurrentVector_.empty(), "Internal logic error"); + if (Buffer_.Empty()) { + State_ = EState::AcceptingDataRequests; return; } SaveBuffer(); - IsFinalizing = true; + IsFinalizing_ = true; } private: @@ -155,71 +155,71 @@ private: } void LoadNextVector() { - auto requestedVectorSize= StoredChunksElementsCount.front(); - MKQL_ENSURE(requestedVectorSize >= CurrentVector.size(), "Internal logic error"); - size_t sizeToLoad = (requestedVectorSize - CurrentVector.size()) * sizeof(T); + auto requestedVectorSize= StoredChunksElementsCount_.front(); + MKQL_ENSURE(requestedVectorSize >= CurrentVector_.size(), "Internal logic error"); + size_t sizeToLoad = (requestedVectorSize - CurrentVector_.size()) * sizeof(T); - if (Buffer.Size() >= sizeToLoad) { + if (Buffer_.Size() >= sizeToLoad) { // if all the data for requested vector is ready - CopyRopeToTheEndOfVector(CurrentVector, Buffer, sizeToLoad); - Buffer.Erase(sizeToLoad); - State = EState::DataReady; + CopyRopeToTheEndOfVector(CurrentVector_, Buffer_, sizeToLoad); + Buffer_.Erase(sizeToLoad); + State_ = EState::DataReady; } else { - CopyRopeToTheEndOfVector(CurrentVector, Buffer); - ReadOperation = Spiller->Extract(StoredChunks.front()); + CopyRopeToTheEndOfVector(CurrentVector_, Buffer_); + ReadOperation_ = Spiller_->Extract(StoredChunks_.front()); } } void SaveBuffer() { - State = EState::SpillingData; - WriteOperation = Spiller->Put(std::move(Buffer)); + State_ = EState::SpillingData; + WriteOperation_ = Spiller_->Put(std::move(Buffer_)); } void AddDataToRope(const T* data, size_t count) { auto owner = std::make_shared<std::vector<T>>(data, data + count); TStringBuf buf(reinterpret_cast<const char *>(owner->data()), count * sizeof(T)); - Buffer.Append(buf, owner); + Buffer_.Append(buf, owner); } void SaveNextPartOfVector() { - size_t maxFittingElemets = (SizeLimit - Buffer.Size()) / sizeof(T); - size_t remainingElementsInVector = CurrentVector.size() - NextVectorPositionToSave; + size_t maxFittingElemets = (SizeLimit_ - Buffer_.Size()) / sizeof(T); + size_t remainingElementsInVector = CurrentVector_.size() - NextVectorPositionToSave_; size_t elementsToCopyFromVector = std::min(maxFittingElemets, remainingElementsInVector); - AddDataToRope(CurrentVector.data() + NextVectorPositionToSave, elementsToCopyFromVector); + AddDataToRope(CurrentVector_.data() + NextVectorPositionToSave_, elementsToCopyFromVector); - NextVectorPositionToSave += elementsToCopyFromVector; - if (NextVectorPositionToSave >= CurrentVector.size()) { - CurrentVector.resize(0); - NextVectorPositionToSave = 0; + NextVectorPositionToSave_ += elementsToCopyFromVector; + if (NextVectorPositionToSave_ >= CurrentVector_.size()) { + CurrentVector_.resize(0); + NextVectorPositionToSave_ = 0; } - if (SizeLimit - Buffer.Size() < sizeof(T)) { + if (SizeLimit_ - Buffer_.Size() < sizeof(T)) { SaveBuffer(); return; } - State = EState::AcceptingData; + State_ = EState::AcceptingData; } private: - EState State = EState::AcceptingData; + EState State_ = EState::AcceptingData; - ISpiller::TPtr Spiller; - const size_t SizeLimit; - NYql::TChunkedBuffer Buffer; + ISpiller::TPtr Spiller_; + const size_t SizeLimit_; + NYql::TChunkedBuffer Buffer_; // Used to store vector while spilling and also used while restoring the data - std::vector<T, Alloc> CurrentVector; - size_t NextVectorPositionToSave = 0; + std::vector<T, Alloc> CurrentVector_; + size_t NextVectorPositionToSave_ = 0; - std::queue<ISpiller::TKey> StoredChunks; - std::queue<size_t> StoredChunksElementsCount; + std::queue<ISpiller::TKey> StoredChunks_; + std::queue<size_t> StoredChunksElementsCount_; - std::optional<NThreading::TFuture<ISpiller::TKey>> WriteOperation = std::nullopt; - std::optional<NThreading::TFuture<std::optional<NYql::TChunkedBuffer>>> ReadOperation = std::nullopt; + std::optional<NThreading::TFuture<ISpiller::TKey>> WriteOperation_ = std::nullopt; + std::optional<NThreading::TFuture<std::optional<NYql::TChunkedBuffer>>> ReadOperation_ = std::nullopt; - bool IsFinalizing = false; + bool IsFinalizing_ = false; }; }//namespace NKikimr::NMiniKQL diff --git a/yql/essentials/minikql/computation/mkql_vector_spiller_adapter_ut.cpp b/yql/essentials/minikql/computation/mkql_vector_spiller_adapter_ut.cpp index 43ed19f4897..53fc5f137cd 100644 --- a/yql/essentials/minikql/computation/mkql_vector_spiller_adapter_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_vector_spiller_adapter_ut.cpp @@ -37,7 +37,7 @@ namespace { while (!spiller.IsAcceptingDataRequests()) { spiller.Update(); } - + for (const auto& vec : vectors) { spiller.RequestNextVector(); @@ -48,7 +48,7 @@ namespace { auto extractedVector = spiller.ExtractVector(); UNIT_ASSERT_VALUES_EQUAL(vec, extractedVector); - } + } } template <typename T> @@ -100,9 +100,9 @@ Y_UNIT_TEST_SUITE(TVectorSpillerAdapterTest_SingleVector) { Y_UNIT_TEST_SUITE(TVectorSpillerAdapterTest_MultipleVectors) { template <typename T> - void ManyDifferentSizes_TestRunner() { + void ManyDifferentSizesTestRunner() { std::vector<std::vector<T, TMKQLAllocator<T>>> vectors; - + for (int vectorSize = 0; vectorSize <= 100; ++vectorSize) { vectors.push_back(CreateSimpleVectorOfSize<T>(vectorSize)); } @@ -112,14 +112,14 @@ Y_UNIT_TEST_SUITE(TVectorSpillerAdapterTest_MultipleVectors) { Y_UNIT_TEST(ManyDifferentSizes) { TScopedAlloc Alloc(__LOCATION__); - ManyDifferentSizes_TestRunner<int>(); - ManyDifferentSizes_TestRunner<char>(); + ManyDifferentSizesTestRunner<int>(); + ManyDifferentSizesTestRunner<char>(); } template <typename T> - void ManyDifferentSizesReversed_TestRunner() { + void ManyDifferentSizesReversedTestRunner() { std::vector<std::vector<T, TMKQLAllocator<T>>> vectors; - + for (int vectorSize = 100; vectorSize >= 0; --vectorSize) { vectors.push_back(CreateSimpleVectorOfSize<T>(vectorSize)); } @@ -129,14 +129,14 @@ Y_UNIT_TEST_SUITE(TVectorSpillerAdapterTest_MultipleVectors) { Y_UNIT_TEST(ManyDifferentSizesReversed) { TScopedAlloc Alloc(__LOCATION__); - ManyDifferentSizesReversed_TestRunner<int>(); - ManyDifferentSizesReversed_TestRunner<char>(); + ManyDifferentSizesReversedTestRunner<int>(); + ManyDifferentSizesReversedTestRunner<char>(); } template <typename T> - void VectorsInOneChunk_TestRunner() { + void VectorsInOneChunkTestRunner() { std::vector<std::vector<T, TMKQLAllocator<T>>> vectors; - + size_t totalSize = 0; for (int vectorSize = 1; vectorSize < 5; ++vectorSize) { @@ -150,14 +150,14 @@ Y_UNIT_TEST_SUITE(TVectorSpillerAdapterTest_MultipleVectors) { Y_UNIT_TEST(VectorsInOneChunk) { TScopedAlloc Alloc(__LOCATION__); - VectorsInOneChunk_TestRunner<int>(); - VectorsInOneChunk_TestRunner<char>(); + VectorsInOneChunkTestRunner<int>(); + VectorsInOneChunkTestRunner<char>(); } template <typename T> - void EmptyVectorsInTheMiddle_TestRunner() { + void EmptyVectorsInTheMiddleTestRunner() { std::vector<std::vector<T,TMKQLAllocator<T>>> vectors; - + size_t totalSize = 0; for (int vectorSize = 1; vectorSize < 5; ++vectorSize) { @@ -179,12 +179,12 @@ Y_UNIT_TEST_SUITE(TVectorSpillerAdapterTest_MultipleVectors) { Y_UNIT_TEST(EmptyVectorsInTheMiddle) { TScopedAlloc Alloc(__LOCATION__); - EmptyVectorsInTheMiddle_TestRunner<int>(); - EmptyVectorsInTheMiddle_TestRunner<char>(); + EmptyVectorsInTheMiddleTestRunner<int>(); + EmptyVectorsInTheMiddleTestRunner<char>(); } template <typename T> - void RequestedVectorPartlyInMemory_TestRunner() { + void RequestedVectorPartlyInMemoryTestRunner() { std::vector<std::vector<T, TMKQLAllocator<T>>> vectors; std::vector<T, TMKQLAllocator<T>> small = CreateSimpleVectorOfSize<T>(1); std::vector<T, TMKQLAllocator<T>> big = CreateSimpleVectorOfSize<T>(10); @@ -200,8 +200,8 @@ Y_UNIT_TEST_SUITE(TVectorSpillerAdapterTest_MultipleVectors) { Y_UNIT_TEST(RequestedVectorPartlyInMemory) { TScopedAlloc Alloc(__LOCATION__); - RequestedVectorPartlyInMemory_TestRunner<int>(); - RequestedVectorPartlyInMemory_TestRunner<char>(); + RequestedVectorPartlyInMemoryTestRunner<int>(); + RequestedVectorPartlyInMemoryTestRunner<char>(); } } diff --git a/yql/essentials/minikql/computation/presort.cpp b/yql/essentials/minikql/computation/presort.cpp index 0f3cb95d55e..b05bbd3ba68 100644 --- a/yql/essentials/minikql/computation/presort.cpp +++ b/yql/essentials/minikql/computation/presort.cpp @@ -568,107 +568,107 @@ NUdf::TUnboxedValue DecodeImpl(TType* type, TStringBuf& input, const THolderFact } // NDetail void TPresortCodec::AddType(NUdf::EDataSlot slot, bool isOptional, bool isDesc) { - Types.push_back({slot, isOptional, isDesc}); + Types_.push_back({slot, isOptional, isDesc}); } void TPresortEncoder::Start() { - Output.clear(); - Current = 0; + Output_.clear(); + Current_ = 0; } void TPresortEncoder::Start(TStringBuf prefix) { - Output.clear(); + Output_.clear(); auto data = reinterpret_cast<const ui8*>(prefix.data()); - Output.insert(Output.begin(), data, data + prefix.size()); - Current = 0; + Output_.insert(Output_.begin(), data, data + prefix.size()); + Current_ = 0; } void TPresortEncoder::Encode(const NUdf::TUnboxedValuePod& value) { - auto& type = Types[Current++]; + auto& type = Types_[Current_++]; if (type.IsDesc) { if (type.IsOptional) { auto hasValue = (bool)value; - NDetail::EncodeBool<true>(Output, hasValue); + NDetail::EncodeBool<true>(Output_, hasValue); if (!hasValue) { return; } } - NDetail::Encode<true>(Output, type.Slot, value); + NDetail::Encode<true>(Output_, type.Slot, value); } else { if (type.IsOptional) { auto hasValue = (bool)value; - NDetail::EncodeBool<false>(Output, hasValue); + NDetail::EncodeBool<false>(Output_, hasValue); if (!hasValue) { return; } } - NDetail::Encode<false>(Output, type.Slot, value); + NDetail::Encode<false>(Output_, type.Slot, value); } } TStringBuf TPresortEncoder::Finish() { - MKQL_ENSURE(Current == Types.size(), "not all fields were encoded"); - return TStringBuf((const char*)Output.data(), Output.size()); + MKQL_ENSURE(Current_ == Types_.size(), "not all fields were encoded"); + return TStringBuf((const char*)Output_.data(), Output_.size()); } void TPresortDecoder::Start(TStringBuf input) { - Input = input; - Current = 0; + Input_ = input; + Current_ = 0; } NUdf::TUnboxedValue TPresortDecoder::Decode() { - auto& type = Types[Current++]; + auto& type = Types_[Current_++]; if (type.IsDesc) { - if (type.IsOptional && !NDetail::DecodeBool<true>(Input)) { + if (type.IsOptional && !NDetail::DecodeBool<true>(Input_)) { return NUdf::TUnboxedValuePod(); } - return NDetail::Decode<true>(Input, type.Slot, Buffer); + return NDetail::Decode<true>(Input_, type.Slot, Buffer_); } else { - if (type.IsOptional && !NDetail::DecodeBool<false>(Input)) { + if (type.IsOptional && !NDetail::DecodeBool<false>(Input_)) { return NUdf::TUnboxedValuePod(); } - return NDetail::Decode<false>(Input, type.Slot, Buffer); + return NDetail::Decode<false>(Input_, type.Slot, Buffer_); } } void TPresortDecoder::Finish() { - MKQL_ENSURE(Current == Types.size(), "not all fields were decoded"); - MKQL_ENSURE(Input.empty(), "buffer is not empty"); + MKQL_ENSURE(Current_ == Types_.size(), "not all fields were decoded"); + MKQL_ENSURE(Input_.empty(), "buffer is not empty"); } TGenericPresortEncoder::TGenericPresortEncoder(TType* type) - : Type(type) + : Type_(type) {} TStringBuf TGenericPresortEncoder::Encode(const NUdf::TUnboxedValue& value, bool desc) { - Output.clear(); - NDetail::EncodeValue(Type, value, Output); + Output_.clear(); + NDetail::EncodeValue(Type_, value, Output_); if (desc) { - for (auto& x : Output) { + for (auto& x : Output_) { x = ~x; } } - return TStringBuf((const char*)Output.data(), Output.size()); + return TStringBuf((const char*)Output_.data(), Output_.size()); } NUdf::TUnboxedValue TGenericPresortEncoder::Decode(TStringBuf buf, bool desc, const THolderFactory& factory) { if (desc) { - Output.assign(buf.begin(), buf.end()); - for (auto& x : Output) { + Output_.assign(buf.begin(), buf.end()); + for (auto& x : Output_) { x = ~x; } - auto newBuf = TStringBuf(reinterpret_cast<const char*>(Output.data()), Output.size()); - auto ret = NDetail::DecodeImpl(Type, newBuf, factory, Buffer); - Output.clear(); + auto newBuf = TStringBuf(reinterpret_cast<const char*>(Output_.data()), Output_.size()); + auto ret = NDetail::DecodeImpl(Type_, newBuf, factory, Buffer_); + Output_.clear(); MKQL_ENSURE(newBuf.empty(), "buffer must be empty"); return ret; } else { - auto ret = NDetail::DecodeImpl(Type, buf, factory, Buffer); + auto ret = NDetail::DecodeImpl(Type_, buf, factory, Buffer_); MKQL_ENSURE(buf.empty(), "buffer is not empty"); return ret; } diff --git a/yql/essentials/minikql/computation/presort.h b/yql/essentials/minikql/computation/presort.h index b8fc93333cf..6d8a66e78cf 100644 --- a/yql/essentials/minikql/computation/presort.h +++ b/yql/essentials/minikql/computation/presort.h @@ -22,8 +22,8 @@ public: void AddType(NUdf::EDataSlot slot, bool isOptional = false, bool isDesc = false); protected: - size_t Current = 0; - TVector<TTypeInfo> Types; + size_t Current_ = 0; + TVector<TTypeInfo> Types_; }; class TPresortEncoder : public TPresortCodec { @@ -36,7 +36,7 @@ public: TStringBuf Finish(); // user must copy private: - TVector<ui8> Output; + TVector<ui8> Output_; }; class TPresortDecoder : public TPresortCodec { @@ -48,8 +48,8 @@ public: void Finish(); private: - TVector<ui8> Buffer; - TStringBuf Input; + TVector<ui8> Buffer_; + TStringBuf Input_; }; class THolderFactory; @@ -60,9 +60,9 @@ public: TStringBuf Encode(const NUdf::TUnboxedValue& value, bool desc); // user must copy NUdf::TUnboxedValue Decode(TStringBuf buf, bool desc, const THolderFactory& factory); private: - TType* Type; - TVector<ui8> Output; - TVector<ui8> Buffer; + TType* Type_; + TVector<ui8> Output_; + TVector<ui8> Buffer_; }; } // NMiniKQL diff --git a/yql/essentials/minikql/computation/presort_impl.h b/yql/essentials/minikql/computation/presort_impl.h index 5e3cfe09221..9cca291ca42 100644 --- a/yql/essentials/minikql/computation/presort_impl.h +++ b/yql/essentials/minikql/computation/presort_impl.h @@ -189,31 +189,31 @@ namespace NDetail { while (!value.empty()) { union { - ui8 buffer[BlockSize + 1]; - ui64 buffer64[BlockSizeUi64]; + ui8 Buffer[BlockSize + 1]; + ui64 Buffer64[BlockSizeUi64]; }; part = std::min(value.size(), BlockSize); if (part == BlockSize) { - std::memcpy(buffer + 1, value.data(), BlockSize); + std::memcpy(Buffer + 1, value.data(), BlockSize); } else { for (size_t i = 0; i < BlockSizeUi64; ++i) { - buffer64[i] = 0; + Buffer64[i] = 0; } - std::memcpy(buffer + 1, value.data(), part); + std::memcpy(Buffer + 1, value.data(), part); } value.Skip(part); - buffer[0] = BlockCode; + Buffer[0] = BlockCode; if (Desc) { for (size_t i = 0; i < BlockSizeUi64; ++i) { - buffer64[i] ^= std::numeric_limits<ui64>::max(); + Buffer64[i] ^= std::numeric_limits<ui64>::max(); } } - output.insert(output.end(), buffer, buffer + BlockSize + 1); + output.insert(output.end(), Buffer, Buffer + BlockSize + 1); } auto lastLength = ui8(part); @@ -234,22 +234,22 @@ namespace NDetail { while (code == BlockCode) { union { - ui8 buffer[BlockSize + 1]; - ui64 buffer64[BlockSizeUi64]; + ui8 Buffer[BlockSize + 1]; + ui64 Buffer64[BlockSizeUi64]; }; EnsureInputSize(input, BlockSize + 1); - std::memcpy(buffer, input.data(), BlockSize + 1); + std::memcpy(Buffer, input.data(), BlockSize + 1); input.Skip(BlockSize + 1); if (Desc) { for (size_t i = 0; i < BlockSizeUi64; ++i) { - buffer64[i] ^= std::numeric_limits<ui64>::max(); + Buffer64[i] ^= std::numeric_limits<ui64>::max(); } } - value.insert(value.end(), buffer, buffer + BlockSize); - code = buffer[BlockSize]; + value.insert(value.end(), Buffer, Buffer + BlockSize); + code = Buffer[BlockSize]; } auto begin = (const char*)value.begin(); diff --git a/yql/essentials/minikql/dom/convert.h b/yql/essentials/minikql/dom/convert.h index e562d0381f8..4d484f346a3 100644 --- a/yql/essentials/minikql/dom/convert.h +++ b/yql/essentials/minikql/dom/convert.h @@ -288,25 +288,25 @@ public: using TConverter = std::function<TUnboxedValuePod(TUnboxedValuePod)>; TLazyConveter(TUnboxedValue&& original, TConverter&& converter) - : Original(std::move(original)), Converter(std::move(converter)) + : Original_(std::move(original)), Converter_(std::move(converter)) {} private: template <bool NoSwap> class TIterator: public TManagedBoxedValue { public: TIterator(TUnboxedValue&& original, const TConverter& converter) - : Original(std::move(original)), Converter(converter) + : Original_(std::move(original)), Converter_(converter) {} private: bool Skip() final { - return Original.Skip(); + return Original_.Skip(); } bool Next(TUnboxedValue& value) final { - if (Original.Next(value)) { + if (Original_.Next(value)) { if constexpr (!NoSwap) { - value = Converter(value.Release()); + value = Converter_(value.Release()); } return true; } @@ -314,75 +314,75 @@ private: } bool NextPair(TUnboxedValue& key, TUnboxedValue& payload) final { - if (Original.NextPair(key, payload)) { + if (Original_.NextPair(key, payload)) { if constexpr (NoSwap) { - payload = Converter(payload.Release()); + payload = Converter_(payload.Release()); } else { - key = Converter(key.Release()); + key = Converter_(key.Release()); } return true; } return false; } - const TUnboxedValue Original; - const TConverter Converter; + const TUnboxedValue Original_; + const TConverter Converter_; }; ui64 GetDictLength() const final { - return Original.GetDictLength(); + return Original_.GetDictLength(); } ui64 GetListLength() const final { - return Original.GetListLength(); + return Original_.GetListLength(); } bool HasFastListLength() const final { - return Original.HasFastListLength(); + return Original_.HasFastListLength(); } bool HasDictItems() const final { - return Original.HasDictItems(); + return Original_.HasDictItems(); } bool HasListItems() const final { - return Original.HasListItems(); + return Original_.HasListItems(); } TUnboxedValue GetListIterator() const final { - return TUnboxedValuePod(new TIterator<false>(Original.GetListIterator(), Converter)); + return TUnboxedValuePod(new TIterator<false>(Original_.GetListIterator(), Converter_)); } TUnboxedValue GetDictIterator() const final { - return TUnboxedValuePod(new TIterator<true>(Original.GetDictIterator(), Converter)); + return TUnboxedValuePod(new TIterator<true>(Original_.GetDictIterator(), Converter_)); } TUnboxedValue GetKeysIterator() const final { - return TUnboxedValuePod(new TIterator<true>(Original.GetKeysIterator(), Converter)); + return TUnboxedValuePod(new TIterator<true>(Original_.GetKeysIterator(), Converter_)); } TUnboxedValue GetPayloadsIterator() const { - return TUnboxedValuePod(new TIterator<false>(Original.GetPayloadsIterator(), Converter)); + return TUnboxedValuePod(new TIterator<false>(Original_.GetPayloadsIterator(), Converter_)); } bool Contains(const TUnboxedValuePod& key) const final { - return Original.Contains(key); + return Original_.Contains(key); } TUnboxedValue Lookup(const TUnboxedValuePod& key) const final { - if (auto lookup = Original.Lookup(key)) { - return Converter(lookup.Release().GetOptionalValue()).MakeOptional(); + if (auto lookup = Original_.Lookup(key)) { + return Converter_(lookup.Release().GetOptionalValue()).MakeOptional(); } return {}; } bool IsSortedDict() const final { - return Original.IsSortedDict(); + return Original_.IsSortedDict(); } private: - const TUnboxedValue Original; - const TConverter Converter; + const TUnboxedValue Original_; + const TConverter Converter_; }; } diff --git a/yql/essentials/minikql/dom/json.cpp b/yql/essentials/minikql/dom/json.cpp index a29d044adf7..acd70667cc6 100644 --- a/yql/essentials/minikql/dom/json.cpp +++ b/yql/essentials/minikql/dom/json.cpp @@ -68,9 +68,9 @@ class TDomCallbacks : public TJsonCallbacks { public: TDomCallbacks(const IValueBuilder* valueBuilder, bool throwException) : TJsonCallbacks(throwException) - , ValueBuilder(valueBuilder) + , ValueBuilder_(valueBuilder) { - Result.push({}); + Result_.push({}); } bool OnNull() override { @@ -100,10 +100,10 @@ public: bool OnString(const TStringBuf& value) override { if constexpr (DecodeUtf8) { if (const auto from = AsciiSize(value); from < value.size()) { - return PushToCurrentCollection(MakeString(DecodeUtf(value, from), ValueBuilder)); + return PushToCurrentCollection(MakeString(DecodeUtf(value, from), ValueBuilder_)); } } - return PushToCurrentCollection(MakeString(value, ValueBuilder)); + return PushToCurrentCollection(MakeString(value, ValueBuilder_)); } bool OnOpenMap() override { @@ -115,8 +115,8 @@ public: } bool OnCloseMap() override { - Y_DEBUG_ABORT_UNLESS(!Result.empty()); - auto& items = Result.top(); + Y_DEBUG_ABORT_UNLESS(!Result_.empty()); + auto& items = Result_.top(); Y_DEBUG_ABORT_UNLESS(items.size() % 2 == 0); TSmallVec<TPair, TStdAllocatorForUdf<TPair>> pairs; @@ -124,7 +124,7 @@ public: pairs.emplace_back(std::move(items[i]), std::move(items[i + 1])); } - Result.pop(); + Result_.pop(); return PushToCurrentCollection(MakeDict(pairs.data(), pairs.size())); } @@ -133,10 +133,10 @@ public: } bool OnCloseArray() override { - Y_DEBUG_ABORT_UNLESS(!Result.empty()); - auto& items = Result.top(); - TUnboxedValue list = MakeList(items.data(), items.size(), ValueBuilder); - Result.pop(); + Y_DEBUG_ABORT_UNLESS(!Result_.empty()); + auto& items = Result_.top(); + TUnboxedValue list = MakeList(items.data(), items.size(), ValueBuilder_); + Result_.pop(); return PushToCurrentCollection(std::move(list)); } @@ -146,29 +146,29 @@ public: TUnboxedValue GetResult() && { Y_DEBUG_ABORT_UNLESS(IsResultSingle()); - return std::move(Result.top()[0]); + return std::move(Result_.top()[0]); } private: bool OnCollectionOpen() { - Result.emplace(); + Result_.emplace(); return true; } bool PushToCurrentCollection(TUnboxedValue&& value) { - Y_DEBUG_ABORT_UNLESS(!Result.empty()); - Result.top().emplace_back(std::move(value)); + Y_DEBUG_ABORT_UNLESS(!Result_.empty()); + Result_.top().emplace_back(std::move(value)); return true; } bool IsResultSingle() { - return Result.size() == 1 && Result.top().size() == 1; + return Result_.size() == 1 && Result_.top().size() == 1; } - const IValueBuilder* ValueBuilder; + const IValueBuilder* ValueBuilder_; using TUnboxedValues = TSmallVec<TUnboxedValue, TStdAllocatorForUdf<TUnboxedValue>>; - std::stack<TUnboxedValues, TSmallVec<TUnboxedValues, TStdAllocatorForUdf<TUnboxedValues>>> Result; + std::stack<TUnboxedValues, TSmallVec<TUnboxedValues, TStdAllocatorForUdf<TUnboxedValues>>> Result_; }; class TTestCallbacks : public TJsonCallbacks { @@ -200,14 +200,14 @@ public: bool OnCloseArray() final { return true; } bool OnEnd() final { - if (HasResult) + if (HasResult_) return false; - return HasResult = true; + return HasResult_ = true; } private: - bool HasResult = false; + bool HasResult_ = false; }; bool IsEntity(const TUnboxedValuePod value) { @@ -329,7 +329,7 @@ TString SerializeJsonDom(const NUdf::TUnboxedValuePod dom, bool skipMapEntity, b config.SetFormatOutput(false); config.WriteNanAsString = writeNanAsString; - + config.FloatToStringMode = EFloatToStringMode::PREC_AUTO; TJsonWriter writer(&output, config); if (skipMapEntity) diff --git a/yql/essentials/minikql/dom/node.cpp b/yql/essentials/minikql/dom/node.cpp index 64458dea8d5..2f04bf59173 100644 --- a/yql/essentials/minikql/dom/node.cpp +++ b/yql/essentials/minikql/dom/node.cpp @@ -22,17 +22,17 @@ inline bool StringEquals(const TPair& x, const TPair& y) { template <bool NoSwap> TMapNode::TIterator<NoSwap>::TIterator(const TMapNode* parent) - : Parent(const_cast<TMapNode*>(parent)) - , Index(-1) + : Parent_(const_cast<TMapNode*>(parent)) + , Index_(-1) {} template <bool NoSwap> bool TMapNode::TIterator<NoSwap>::Skip() { - if (Index + 1 == Parent->UniqueCount_) { + if (Index_ + 1 == Parent_->UniqueCount_) { return false; } - ++Index; + ++Index_; return true; } @@ -41,9 +41,9 @@ bool TMapNode::TIterator<NoSwap>::Next(TUnboxedValue& key) { if (!Skip()) return false; if constexpr (NoSwap) { - key = Parent->Items_[Index].first; + key = Parent_->Items_[Index_].first; } else { - key = Parent->Items_[Index].second; + key = Parent_->Items_[Index_].second; } return true; } @@ -53,9 +53,9 @@ bool TMapNode::TIterator<NoSwap>::NextPair(TUnboxedValue& key, TUnboxedValue& pa if (!Next(key)) return false; if constexpr (NoSwap) { - payload = Parent->Items_[Index].second; + payload = Parent_->Items_[Index_].second; } else { - payload = Parent->Items_[Index].first; + payload = Parent_->Items_[Index_].first; } return true; } diff --git a/yql/essentials/minikql/dom/node.h b/yql/essentials/minikql/dom/node.h index 5719709655b..4c3dd6acae7 100644 --- a/yql/essentials/minikql/dom/node.h +++ b/yql/essentials/minikql/dom/node.h @@ -66,8 +66,8 @@ public: bool Next(TUnboxedValue& key) final; bool NextPair(TUnboxedValue& key, TUnboxedValue& payload) final; - const TRefCountedPtr<TMapNode> Parent; - ui32 Index; + const TRefCountedPtr<TMapNode> Parent_; + ui32 Index_; }; TMapNode(const TPair* items, ui32 count); diff --git a/yql/essentials/minikql/jsonpath/executor.cpp b/yql/essentials/minikql/jsonpath/executor.cpp index 786e25aaf14..54a82cefcb1 100644 --- a/yql/essentials/minikql/jsonpath/executor.cpp +++ b/yql/essentials/minikql/jsonpath/executor.cpp @@ -35,34 +35,34 @@ TIssue MakeError(const TJsonPathItem& item, TIssueCode code, const TStringBuf me } TResult::TResult(TJsonNodes&& nodes) - : Result(std::move(nodes)) + : Result_(std::move(nodes)) { } TResult::TResult(const TJsonNodes& nodes) - : Result(nodes) + : Result_(nodes) { } TResult::TResult(TIssue&& issue) - : Result(std::move(issue)) + : Result_(std::move(issue)) { } const TJsonNodes& TResult::GetNodes() const { - return std::get<TJsonNodes>(Result); + return std::get<TJsonNodes>(Result_); } TJsonNodes& TResult::GetNodes() { - return std::get<TJsonNodes>(Result); + return std::get<TJsonNodes>(Result_); } const TIssue& TResult::GetError() const { - return std::get<TIssue>(Result); + return std::get<TIssue>(Result_); } bool TResult::IsError() const { - return std::holds_alternative<TIssue>(Result); + return std::holds_alternative<TIssue>(Result_); } TExecutor::TExecutor( @@ -70,10 +70,10 @@ TExecutor::TExecutor( const TJsonNodes& input, const TVariablesMap& variables, const IValueBuilder* valueBuilder) - : Reader(path) - , Input(input) - , Variables(variables) - , ValueBuilder(valueBuilder) + : Reader_(path) + , Input_(input) + , Variables_(variables) + , ValueBuilder_(valueBuilder) { } @@ -94,15 +94,15 @@ bool TExecutor::IsEqual(double a, double b) { } bool TExecutor::IsStrict() const { - return Reader.GetMode() == EJsonPathMode::Strict; + return Reader_.GetMode() == EJsonPathMode::Strict; } bool TExecutor::IsLax() const { - return Reader.GetMode() == EJsonPathMode::Lax; + return Reader_.GetMode() == EJsonPathMode::Lax; } TResult TExecutor::Execute() { - return Execute(Reader.ReadFirst()); + return Execute(Reader_.ReadFirst()); } TResult TExecutor::Execute(const TJsonPathItem& item) { @@ -178,12 +178,12 @@ TResult TExecutor::Execute(const TJsonPathItem& item) { } TResult TExecutor::ContextObject() { - return Input; + return Input_; } TResult TExecutor::Variable(const TJsonPathItem& item) { - const auto it = Variables.find(item.GetString()); - if (it == Variables.end()) { + const auto it = Variables_.find(item.GetString()); + if (it == Variables_.end()) { return MakeError(item, TIssuesIds::JSONPATH_UNDEFINED_VARIABLE, TStringBuilder() << "Undefined variable '" << item.GetString() << "'"); } @@ -191,11 +191,11 @@ TResult TExecutor::Variable(const TJsonPathItem& item) { } TResult TExecutor::LastArrayIndex(const TJsonPathItem& item) { - if (ArraySubscriptSource.empty()) { + if (ArraySubscriptSource_.empty()) { return MakeError(item, TIssuesIds::JSONPATH_LAST_OUTSIDE_OF_ARRAY_SUBSCRIPT, "'last' is only allowed inside array subscripts"); } - const auto& array = ArraySubscriptSource.top(); + const auto& array = ArraySubscriptSource_.top(); const i64 arraySize = array.GetSize(); // NOTE: For empty arrays `last` equals `-1`. This is intended, PostgreSQL 12 has the same behaviour @@ -207,7 +207,7 @@ TResult TExecutor::NumberLiteral(const TJsonPathItem& item) { } TResult TExecutor::MemberAccess(const TJsonPathItem& item) { - const auto input = Execute(Reader.ReadInput(item)); + const auto input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -235,7 +235,7 @@ TResult TExecutor::MemberAccess(const TJsonPathItem& item) { } TResult TExecutor::WildcardMemberAccess(const TJsonPathItem& item) { - const auto input = Execute(Reader.ReadInput(item)); + const auto input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -276,7 +276,7 @@ TMaybe<TIssue> TExecutor::EnsureSingleSubscript(TPosition pos, const TJsonNodes& TMaybe<TIssue> TExecutor::EnsureArraySubscripts(const TJsonPathItem& item, TVector<TArraySubscript>& result) { for (const auto& subscript : item.GetSubscripts()) { - const auto& fromItem = Reader.ReadFromSubscript(subscript); + const auto& fromItem = Reader_.ReadFromSubscript(subscript); const auto fromResult = Execute(fromItem); if (fromResult.IsError()) { return fromResult.GetError(); @@ -293,7 +293,7 @@ TMaybe<TIssue> TExecutor::EnsureArraySubscripts(const TJsonPathItem& item, TVect continue; } - const auto& toItem = Reader.ReadToSubscript(subscript); + const auto& toItem = Reader_.ReadToSubscript(subscript); const auto toResult = Execute(toItem); if (toResult.IsError()) { return toResult.GetError(); @@ -311,7 +311,7 @@ TMaybe<TIssue> TExecutor::EnsureArraySubscripts(const TJsonPathItem& item, TVect } TResult TExecutor::ArrayAccess(const TJsonPathItem& item) { - const auto input = Execute(Reader.ReadInput(item)); + const auto input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -321,9 +321,9 @@ TResult TExecutor::ArrayAccess(const TJsonPathItem& item) { return MakeError(item, TIssuesIds::JSONPATH_EXPECTED_ARRAY, "Expected array"); } - ArraySubscriptSource.push(node); + ArraySubscriptSource_.push(node); Y_DEFER { - ArraySubscriptSource.pop(); + ArraySubscriptSource_.pop(); }; // Check for "hard" errors in array subscripts. These are forbidden even in lax mode @@ -375,7 +375,7 @@ TResult TExecutor::ArrayAccess(const TJsonPathItem& item) { } TResult TExecutor::WildcardArrayAccess(const TJsonPathItem& item) { - const auto input = Execute(Reader.ReadInput(item)); + const auto input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -395,7 +395,7 @@ TResult TExecutor::WildcardArrayAccess(const TJsonPathItem& item) { } TResult TExecutor::UnaryArithmeticOp(const TJsonPathItem& item) { - const auto& operandItem = Reader.ReadInput(item); + const auto& operandItem = Reader_.ReadInput(item); const auto operandsResult = Execute(operandItem); if (operandsResult.IsError()) { return operandsResult; @@ -442,7 +442,7 @@ TMaybe<TIssue> TExecutor::EnsureBinaryArithmeticOpArgument(TPosition pos, const } TResult TExecutor::BinaryArithmeticOp(const TJsonPathItem& item) { - const auto& leftItem = Reader.ReadLeftOperand(item); + const auto& leftItem = Reader_.ReadLeftOperand(item); const auto leftResult = Execute(leftItem); if (leftResult.IsError()) { return leftResult; @@ -454,7 +454,7 @@ TResult TExecutor::BinaryArithmeticOp(const TJsonPathItem& item) { return std::move(*error); } - const auto& rightItem = Reader.ReadRightOperand(item); + const auto& rightItem = Reader_.ReadRightOperand(item); const auto rightResult = Execute(rightItem); if (rightResult.IsError()) { return rightResult; @@ -518,7 +518,7 @@ TMaybe<TIssue> TExecutor::EnsureLogicalOpArgument(TPosition pos, const TJsonNode } TResult TExecutor::BinaryLogicalOp(const TJsonPathItem& item) { - const auto& leftItem = Reader.ReadLeftOperand(item); + const auto& leftItem = Reader_.ReadLeftOperand(item); const auto leftResult = Execute(leftItem); if (leftResult.IsError()) { return leftResult; @@ -530,7 +530,7 @@ TResult TExecutor::BinaryLogicalOp(const TJsonPathItem& item) { return std::move(*error); } - const auto& rightItem = Reader.ReadRightOperand(item); + const auto& rightItem = Reader_.ReadRightOperand(item); const auto rightResult = Execute(rightItem); if (rightResult.IsError()) { return rightResult; @@ -600,7 +600,7 @@ TResult TExecutor::UnaryLogicalOp(const TJsonPathItem& item) { | false | true | | null | null | */ - const auto& operandItem = Reader.ReadInput(item); + const auto& operandItem = Reader_.ReadInput(item); const auto operandResult = Execute(operandItem); if (operandResult.IsError()) { return operandResult; @@ -628,7 +628,7 @@ TResult TExecutor::NullLiteral() { } TResult TExecutor::StringLiteral(const TJsonPathItem& item) { - return TJsonNodes({TValue(MakeString(item.GetString(), ValueBuilder))}); + return TJsonNodes({TValue(MakeString(item.GetString(), ValueBuilder_))}); } TMaybe<bool> TExecutor::CompareValues(const TValue& left, const TValue& right, EJsonPathItemType operation) { @@ -706,13 +706,13 @@ TMaybe<bool> TExecutor::CompareValues(const TValue& left, const TValue& right, E } TResult TExecutor::CompareOp(const TJsonPathItem& item) { - const auto& leftItem = Reader.ReadLeftOperand(item); + const auto& leftItem = Reader_.ReadLeftOperand(item); const auto leftResult = Execute(leftItem); if (leftResult.IsError()) { return TJsonNodes({TValue(MakeEntity())}); } - const auto& rightItem = Reader.ReadRightOperand(item); + const auto& rightItem = Reader_.ReadRightOperand(item); const auto rightResult = Execute(rightItem); if (rightResult.IsError()) { return TJsonNodes({TValue(MakeEntity())}); @@ -748,24 +748,24 @@ TResult TExecutor::CompareOp(const TJsonPathItem& item) { } TResult TExecutor::FilterObject(const TJsonPathItem& item) { - if (CurrentFilterObject.empty()) { + if (CurrentFilterObject_.empty()) { return MakeError(item, TIssuesIds::JSONPATH_FILTER_OBJECT_OUTSIDE_OF_FILTER, "'@' is only allowed inside filters"); } - return TJsonNodes({CurrentFilterObject.top()}); + return TJsonNodes({CurrentFilterObject_.top()}); } TResult TExecutor::FilterPredicate(const TJsonPathItem& item) { - const auto input = Execute(Reader.ReadInput(item)); + const auto input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } - const auto& predicateItem = Reader.ReadFilterPredicate(item); + const auto& predicateItem = Reader_.ReadFilterPredicate(item); TJsonNodes result; for (const auto& node : OptionalUnwrapArrays(input.GetNodes())) { - CurrentFilterObject.push(node); + CurrentFilterObject_.push(node); Y_DEFER { - CurrentFilterObject.pop(); + CurrentFilterObject_.pop(); }; const auto predicateResult = Execute(predicateItem); @@ -788,7 +788,7 @@ TResult TExecutor::FilterPredicate(const TJsonPathItem& item) { } TResult TExecutor::NumericMethod(const TJsonPathItem& item) { - const auto& input = Execute(Reader.ReadInput(item)); + const auto& input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -818,7 +818,7 @@ TResult TExecutor::NumericMethod(const TJsonPathItem& item) { } TResult TExecutor::DoubleMethod(const TJsonPathItem& item) { - const auto& input = Execute(Reader.ReadInput(item)); + const auto& input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -843,7 +843,7 @@ TResult TExecutor::DoubleMethod(const TJsonPathItem& item) { } TResult TExecutor::TypeMethod(const TJsonPathItem& item) { - const auto& input = Execute(Reader.ReadInput(item)); + const auto& input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -870,13 +870,13 @@ TResult TExecutor::TypeMethod(const TJsonPathItem& item) { type = "object"; break; } - result.push_back(TValue(MakeString(type, ValueBuilder))); + result.push_back(TValue(MakeString(type, ValueBuilder_))); } return std::move(result); } TResult TExecutor::SizeMethod(const TJsonPathItem& item) { - const auto& input = Execute(Reader.ReadInput(item)); + const auto& input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -892,7 +892,7 @@ TResult TExecutor::SizeMethod(const TJsonPathItem& item) { } TResult TExecutor::KeyValueMethod(const TJsonPathItem& item) { - const auto& input = Execute(Reader.ReadInput(item)); + const auto& input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -909,11 +909,11 @@ TResult TExecutor::KeyValueMethod(const TJsonPathItem& item) { TValue value; auto it = node.GetObjectIterator(); while (it.Next(key, value)) { - nameEntry.first = MakeString("name", ValueBuilder); - nameEntry.second = key.ConvertToUnboxedValue(ValueBuilder); + nameEntry.first = MakeString("name", ValueBuilder_); + nameEntry.second = key.ConvertToUnboxedValue(ValueBuilder_); - valueEntry.first = MakeString("value", ValueBuilder); - valueEntry.second = value.ConvertToUnboxedValue(ValueBuilder); + valueEntry.first = MakeString("value", ValueBuilder_); + valueEntry.second = value.ConvertToUnboxedValue(ValueBuilder_); result.push_back(TValue(MakeDict(row, 2))); } @@ -922,7 +922,7 @@ TResult TExecutor::KeyValueMethod(const TJsonPathItem& item) { } TResult TExecutor::StartsWithPredicate(const TJsonPathItem& item) { - const auto& input = Execute(Reader.ReadInput(item)); + const auto& input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -937,7 +937,7 @@ TResult TExecutor::StartsWithPredicate(const TJsonPathItem& item) { return MakeError(item, TIssuesIds::JSONPATH_INVALID_STARTS_WITH_ARGUMENT, "Type of input argument for starts with predicate must be string"); } - const auto prefix = Execute(Reader.ReadPrefix(item)); + const auto prefix = Execute(Reader_.ReadPrefix(item)); if (prefix.IsError()) { return prefix; } @@ -963,7 +963,7 @@ TResult TExecutor::StartsWithPredicate(const TJsonPathItem& item) { } TResult TExecutor::IsUnknownPredicate(const TJsonPathItem& item) { - const auto input = Execute(Reader.ReadInput(item)); + const auto input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -985,7 +985,7 @@ TResult TExecutor::IsUnknownPredicate(const TJsonPathItem& item) { } TResult TExecutor::ExistsPredicate(const TJsonPathItem& item) { - const auto input = Execute(Reader.ReadInput(item)); + const auto input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return TJsonNodes({TValue(MakeEntity())}); } @@ -995,7 +995,7 @@ TResult TExecutor::ExistsPredicate(const TJsonPathItem& item) { } TResult TExecutor::LikeRegexPredicate(const TJsonPathItem& item) { - const auto input = Execute(Reader.ReadInput(item)); + const auto input = Execute(Reader_.ReadInput(item)); if (input.IsError()) { return input; } @@ -1054,8 +1054,8 @@ TJsonNodes TExecutor::OptionalArrayWrapNodes(const TJsonNodes& input) { continue; } - TUnboxedValue nodeCopy(node.ConvertToUnboxedValue(ValueBuilder)); - result.push_back(TValue(MakeList(&nodeCopy, 1, ValueBuilder))); + TUnboxedValue nodeCopy(node.ConvertToUnboxedValue(ValueBuilder_)); + result.push_back(TValue(MakeList(&nodeCopy, 1, ValueBuilder_))); } return result; } diff --git a/yql/essentials/minikql/jsonpath/executor.h b/yql/essentials/minikql/jsonpath/executor.h index d09f7ee4437..f591abed7ae 100644 --- a/yql/essentials/minikql/jsonpath/executor.h +++ b/yql/essentials/minikql/jsonpath/executor.h @@ -40,54 +40,54 @@ public: bool IsError() const; private: - std::variant<TJsonNodes, TIssue> Result; + std::variant<TJsonNodes, TIssue> Result_; }; class TArraySubscript { public: TArraySubscript(i64 from, TPosition fromPos) - : From(from) - , FromPos(fromPos) - , HasTo(false) + : From_(from) + , FromPos_(fromPos) + , HasTo_(false) { } TArraySubscript(i64 from, TPosition fromPos, i64 to, TPosition toPos) - : From(from) - , FromPos(fromPos) - , To(to) - , ToPos(toPos) - , HasTo(true) + : From_(from) + , FromPos_(fromPos) + , To_(to) + , ToPos_(toPos) + , HasTo_(true) { } i64 GetFrom() const { - return From; + return From_; } TPosition GetFromPos() const { - return FromPos; + return FromPos_; } i64 GetTo() const { YQL_ENSURE(IsRange()); - return To; + return To_; } TPosition GetToPos() const { - return ToPos; + return ToPos_; } bool IsRange() const { - return HasTo; + return HasTo_; } private: - i64 From = 0; - TPosition FromPos; - i64 To = 0; - TPosition ToPos; - bool HasTo; + i64 From_ = 0; + TPosition FromPos_; + i64 To_ = 0; + TPosition ToPos_; + bool HasTo_; }; using TVariablesMap = THashMap<TString, TValue>; @@ -187,12 +187,12 @@ private: TJsonNodes OptionalArrayWrapNodes(const TJsonNodes& input); - TStack<TValue> ArraySubscriptSource; - TStack<TValue> CurrentFilterObject; - TJsonPathReader Reader; - TJsonNodes Input; - const TVariablesMap& Variables; - const NUdf::IValueBuilder* ValueBuilder; + TStack<TValue> ArraySubscriptSource_; + TStack<TValue> CurrentFilterObject_; + TJsonPathReader Reader_; + TJsonNodes Input_; + const TVariablesMap& Variables_; + const NUdf::IValueBuilder* ValueBuilder_; }; } diff --git a/yql/essentials/minikql/jsonpath/parser/ast_builder.cpp b/yql/essentials/minikql/jsonpath/parser/ast_builder.cpp index 2cfecb94310..2b630fda8b7 100644 --- a/yql/essentials/minikql/jsonpath/parser/ast_builder.cpp +++ b/yql/essentials/minikql/jsonpath/parser/ast_builder.cpp @@ -63,13 +63,13 @@ bool TryStringContent(const TString& str, TString& result, TString& error, bool } TAstBuilder::TAstBuilder(TIssues& issues) - : Issues(issues) + : Issues_(issues) { } void TAstBuilder::Error(TPosition pos, const TStringBuf message) { - Issues.AddIssue(pos, message); - Issues.back().SetCode(TIssuesIds::JSONPATH_PARSE_ERROR, TSeverityIds::S_ERROR); + Issues_.AddIssue(pos, message); + Issues_.back().SetCode(TIssuesIds::JSONPATH_PARSE_ERROR, TSeverityIds::S_ERROR); } TArrayAccessNode::TSubscript TAstBuilder::BuildArraySubscript(const TRule_array_subscript& node) { diff --git a/yql/essentials/minikql/jsonpath/parser/ast_builder.h b/yql/essentials/minikql/jsonpath/parser/ast_builder.h index 66a47483b34..6f5e2d72c7b 100644 --- a/yql/essentials/minikql/jsonpath/parser/ast_builder.h +++ b/yql/essentials/minikql/jsonpath/parser/ast_builder.h @@ -46,7 +46,7 @@ private: void Error(TPosition pos, const TStringBuf message); - TIssues& Issues; + TIssues& Issues_; }; } diff --git a/yql/essentials/minikql/jsonpath/parser/ast_nodes.cpp b/yql/essentials/minikql/jsonpath/parser/ast_nodes.cpp index 5a51c2e90e2..b89bc87ddb8 100644 --- a/yql/essentials/minikql/jsonpath/parser/ast_nodes.cpp +++ b/yql/essentials/minikql/jsonpath/parser/ast_nodes.cpp @@ -3,12 +3,12 @@ namespace NYql::NJsonPath { TAstNode::TAstNode(TPosition pos) - : Pos(pos) + : Pos_(pos) { } TPosition TAstNode::GetPos() const { - return Pos; + return Pos_; } EReturnType TAstNode::GetReturnType() const { @@ -17,17 +17,17 @@ EReturnType TAstNode::GetReturnType() const { TRootNode::TRootNode(TPosition pos, TAstNodePtr expr, EJsonPathMode mode) : TAstNode(pos) - , Expr(expr) - , Mode(mode) + , Expr_(expr) + , Mode_(mode) { } const TAstNodePtr TRootNode::GetExpr() const { - return Expr; + return Expr_; } EJsonPathMode TRootNode::GetMode() const { - return Mode; + return Mode_; } void TRootNode::Accept(IAstNodeVisitor& visitor) const { @@ -35,7 +35,7 @@ void TRootNode::Accept(IAstNodeVisitor& visitor) const { } EReturnType TRootNode::GetReturnType() const { - return Expr->GetReturnType(); + return Expr_->GetReturnType(); } TContextObjectNode::TContextObjectNode(TPosition pos) @@ -49,12 +49,12 @@ void TContextObjectNode::Accept(IAstNodeVisitor& visitor) const { TVariableNode::TVariableNode(TPosition pos, const TString& name) : TAstNode(pos) - , Name(name) + , Name_(name) { } const TString& TVariableNode::GetName() const { - return Name; + return Name_; } void TVariableNode::Accept(IAstNodeVisitor& visitor) const { @@ -72,12 +72,12 @@ void TLastArrayIndexNode::Accept(IAstNodeVisitor& visitor) const { TNumberLiteralNode::TNumberLiteralNode(TPosition pos, double value) : TAstNode(pos) - , Value(value) + , Value_(value) { } double TNumberLiteralNode::GetValue() const { - return Value; + return Value_; } void TNumberLiteralNode::Accept(IAstNodeVisitor& visitor) const { @@ -86,17 +86,17 @@ void TNumberLiteralNode::Accept(IAstNodeVisitor& visitor) const { TMemberAccessNode::TMemberAccessNode(TPosition pos, const TString& member, TAstNodePtr input) : TAstNode(pos) - , Member(member) - , Input(input) + , Member_(member) + , Input_(input) { } const TStringBuf TMemberAccessNode::GetMember() const { - return Member; + return Member_; } const TAstNodePtr TMemberAccessNode::GetInput() const { - return Input; + return Input_; } void TMemberAccessNode::Accept(IAstNodeVisitor& visitor) const { @@ -105,12 +105,12 @@ void TMemberAccessNode::Accept(IAstNodeVisitor& visitor) const { TWildcardMemberAccessNode::TWildcardMemberAccessNode(TPosition pos, TAstNodePtr input) : TAstNode(pos) - , Input(input) + , Input_(input) { } const TAstNodePtr TWildcardMemberAccessNode::GetInput() const { - return Input; + return Input_; } void TWildcardMemberAccessNode::Accept(IAstNodeVisitor& visitor) const { @@ -119,17 +119,17 @@ void TWildcardMemberAccessNode::Accept(IAstNodeVisitor& visitor) const { TArrayAccessNode::TArrayAccessNode(TPosition pos, TVector<TSubscript> subscripts, TAstNodePtr input) : TAstNode(pos) - , Subscripts(subscripts) - , Input(input) + , Subscripts_(subscripts) + , Input_(input) { } const TVector<TArrayAccessNode::TSubscript>& TArrayAccessNode::GetSubscripts() const { - return Subscripts; + return Subscripts_; } const TAstNodePtr TArrayAccessNode::GetInput() const { - return Input; + return Input_; } void TArrayAccessNode::Accept(IAstNodeVisitor& visitor) const { @@ -138,12 +138,12 @@ void TArrayAccessNode::Accept(IAstNodeVisitor& visitor) const { TWildcardArrayAccessNode::TWildcardArrayAccessNode(TPosition pos, TAstNodePtr input) : TAstNode(pos) - , Input(input) + , Input_(input) { } const TAstNodePtr TWildcardArrayAccessNode::GetInput() const { - return Input; + return Input_; } void TWildcardArrayAccessNode::Accept(IAstNodeVisitor& visitor) const { @@ -152,17 +152,17 @@ void TWildcardArrayAccessNode::Accept(IAstNodeVisitor& visitor) const { TUnaryOperationNode::TUnaryOperationNode(TPosition pos, EUnaryOperation op, TAstNodePtr expr) : TAstNode(pos) - , Operation(op) - , Expr(expr) + , Operation_(op) + , Expr_(expr) { } EUnaryOperation TUnaryOperationNode::GetOp() const { - return Operation; + return Operation_; } const TAstNodePtr TUnaryOperationNode::GetExpr() const { - return Expr; + return Expr_; } void TUnaryOperationNode::Accept(IAstNodeVisitor& visitor) const { @@ -170,27 +170,27 @@ void TUnaryOperationNode::Accept(IAstNodeVisitor& visitor) const { } EReturnType TUnaryOperationNode::GetReturnType() const { - return Operation == EUnaryOperation::Not ? EReturnType::Bool : EReturnType::Any; + return Operation_ == EUnaryOperation::Not ? EReturnType::Bool : EReturnType::Any; } TBinaryOperationNode::TBinaryOperationNode(TPosition pos, EBinaryOperation op, TAstNodePtr leftExpr, TAstNodePtr rightExpr) : TAstNode(pos) - , Operation(op) - , LeftExpr(leftExpr) - , RightExpr(rightExpr) + , Operation_(op) + , LeftExpr_(leftExpr) + , RightExpr_(rightExpr) { } EBinaryOperation TBinaryOperationNode::GetOp() const { - return Operation; + return Operation_; } const TAstNodePtr TBinaryOperationNode::GetLeftExpr() const { - return LeftExpr; + return LeftExpr_; } const TAstNodePtr TBinaryOperationNode::GetRightExpr() const { - return RightExpr; + return RightExpr_; } void TBinaryOperationNode::Accept(IAstNodeVisitor& visitor) const { @@ -198,7 +198,7 @@ void TBinaryOperationNode::Accept(IAstNodeVisitor& visitor) const { } EReturnType TBinaryOperationNode::GetReturnType() const { - switch (Operation) { + switch (Operation_) { case EBinaryOperation::Less: case EBinaryOperation::LessEqual: case EBinaryOperation::Greater: @@ -216,12 +216,12 @@ EReturnType TBinaryOperationNode::GetReturnType() const { TBooleanLiteralNode::TBooleanLiteralNode(TPosition pos, bool value) : TAstNode(pos) - , Value(value) + , Value_(value) { } bool TBooleanLiteralNode::GetValue() const { - return Value; + return Value_; } void TBooleanLiteralNode::Accept(IAstNodeVisitor& visitor) const { @@ -239,12 +239,12 @@ void TNullLiteralNode::Accept(IAstNodeVisitor& visitor) const { TStringLiteralNode::TStringLiteralNode(TPosition pos, const TString& value) : TAstNode(pos) - , Value(value) + , Value_(value) { } const TString& TStringLiteralNode::GetValue() const { - return Value; + return Value_; } void TStringLiteralNode::Accept(IAstNodeVisitor& visitor) const { @@ -262,17 +262,17 @@ void TFilterObjectNode::Accept(IAstNodeVisitor& visitor) const { TFilterPredicateNode::TFilterPredicateNode(TPosition pos, TAstNodePtr predicate, TAstNodePtr input) : TAstNode(pos) - , Predicate(predicate) - , Input(input) + , Predicate_(predicate) + , Input_(input) { } const TAstNodePtr TFilterPredicateNode::GetPredicate() const { - return Predicate; + return Predicate_; } const TAstNodePtr TFilterPredicateNode::GetInput() const { - return Input; + return Input_; } void TFilterPredicateNode::Accept(IAstNodeVisitor& visitor) const { @@ -281,17 +281,17 @@ void TFilterPredicateNode::Accept(IAstNodeVisitor& visitor) const { TMethodCallNode::TMethodCallNode(TPosition pos, EMethodType type, TAstNodePtr input) : TAstNode(pos) - , Type(type) - , Input(input) + , Type_(type) + , Input_(input) { } EMethodType TMethodCallNode::GetType() const { - return Type; + return Type_; } const TAstNodePtr TMethodCallNode::GetInput() const { - return Input; + return Input_; } void TMethodCallNode::Accept(IAstNodeVisitor& visitor) const { @@ -300,17 +300,17 @@ void TMethodCallNode::Accept(IAstNodeVisitor& visitor) const { TStartsWithPredicateNode::TStartsWithPredicateNode(TPosition pos, TAstNodePtr input, TAstNodePtr prefix) : TAstNode(pos) - , Input(input) - , Prefix(prefix) + , Input_(input) + , Prefix_(prefix) { } const TAstNodePtr TStartsWithPredicateNode::GetInput() const { - return Input; + return Input_; } const TAstNodePtr TStartsWithPredicateNode::GetPrefix() const { - return Prefix; + return Prefix_; } EReturnType TStartsWithPredicateNode::GetReturnType() const { @@ -323,12 +323,12 @@ void TStartsWithPredicateNode::Accept(IAstNodeVisitor& visitor) const { TExistsPredicateNode::TExistsPredicateNode(TPosition pos, TAstNodePtr input) : TAstNode(pos) - , Input(input) + , Input_(input) { } const TAstNodePtr TExistsPredicateNode::GetInput() const { - return Input; + return Input_; } EReturnType TExistsPredicateNode::GetReturnType() const { @@ -341,12 +341,12 @@ void TExistsPredicateNode::Accept(IAstNodeVisitor& visitor) const { TIsUnknownPredicateNode::TIsUnknownPredicateNode(TPosition pos, TAstNodePtr input) : TAstNode(pos) - , Input(input) + , Input_(input) { } const TAstNodePtr TIsUnknownPredicateNode::GetInput() const { - return Input; + return Input_; } EReturnType TIsUnknownPredicateNode::GetReturnType() const { @@ -359,17 +359,17 @@ void TIsUnknownPredicateNode::Accept(IAstNodeVisitor& visitor) const { TLikeRegexPredicateNode::TLikeRegexPredicateNode(TPosition pos, TAstNodePtr input, NReWrapper::IRePtr&& regex) : TAstNode(pos) - , Input(input) - , Regex(std::move(regex)) + , Input_(input) + , Regex_(std::move(regex)) { } const TAstNodePtr TLikeRegexPredicateNode::GetInput() const { - return Input; + return Input_; } const NReWrapper::IRePtr& TLikeRegexPredicateNode::GetRegex() const { - return Regex; + return Regex_; } EReturnType TLikeRegexPredicateNode::GetReturnType() const { diff --git a/yql/essentials/minikql/jsonpath/parser/ast_nodes.h b/yql/essentials/minikql/jsonpath/parser/ast_nodes.h index 6ccb8a56ea8..07021d973ce 100644 --- a/yql/essentials/minikql/jsonpath/parser/ast_nodes.h +++ b/yql/essentials/minikql/jsonpath/parser/ast_nodes.h @@ -80,7 +80,7 @@ public: virtual ~TAstNode() = default; private: - TPosition Pos; + TPosition Pos_; }; using TAstNodePtr = TIntrusivePtr<TAstNode>; @@ -98,8 +98,8 @@ public: EReturnType GetReturnType() const override; private: - TAstNodePtr Expr; - EJsonPathMode Mode; + TAstNodePtr Expr_; + EJsonPathMode Mode_; }; class TContextObjectNode : public TAstNode { @@ -118,7 +118,7 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TString Name; + TString Name_; }; class TLastArrayIndexNode : public TAstNode { @@ -137,7 +137,7 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - double Value; + double Value_; }; class TMemberAccessNode : public TAstNode { @@ -151,8 +151,8 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TString Member; - TAstNodePtr Input; + TString Member_; + TAstNodePtr Input_; }; class TWildcardMemberAccessNode : public TAstNode { @@ -164,7 +164,7 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TAstNodePtr Input; + TAstNodePtr Input_; }; class TArrayAccessNode : public TAstNode { @@ -183,8 +183,8 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TVector<TSubscript> Subscripts; - TAstNodePtr Input; + TVector<TSubscript> Subscripts_; + TAstNodePtr Input_; }; class TWildcardArrayAccessNode : public TAstNode { @@ -196,7 +196,7 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TAstNodePtr Input; + TAstNodePtr Input_; }; enum class EUnaryOperation { @@ -218,8 +218,8 @@ public: EReturnType GetReturnType() const override; private: - EUnaryOperation Operation; - TAstNodePtr Expr; + EUnaryOperation Operation_; + TAstNodePtr Expr_; }; enum class EBinaryOperation { @@ -253,9 +253,9 @@ public: EReturnType GetReturnType() const override; private: - EBinaryOperation Operation; - TAstNodePtr LeftExpr; - TAstNodePtr RightExpr; + EBinaryOperation Operation_; + TAstNodePtr LeftExpr_; + TAstNodePtr RightExpr_; }; class TBooleanLiteralNode : public TAstNode { @@ -267,7 +267,7 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - bool Value; + bool Value_; }; class TNullLiteralNode : public TAstNode { @@ -286,7 +286,7 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TString Value; + TString Value_; }; class TFilterObjectNode : public TAstNode { @@ -307,8 +307,8 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TAstNodePtr Predicate; - TAstNodePtr Input; + TAstNodePtr Predicate_; + TAstNodePtr Input_; }; enum class EMethodType { @@ -332,8 +332,8 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - EMethodType Type; - TAstNodePtr Input; + EMethodType Type_; + TAstNodePtr Input_; }; class TStartsWithPredicateNode : public TAstNode { @@ -349,8 +349,8 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TAstNodePtr Input; - TAstNodePtr Prefix; + TAstNodePtr Input_; + TAstNodePtr Prefix_; }; class TExistsPredicateNode : public TAstNode { @@ -364,7 +364,7 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TAstNodePtr Input; + TAstNodePtr Input_; }; class TIsUnknownPredicateNode : public TAstNode { @@ -378,7 +378,7 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TAstNodePtr Input; + TAstNodePtr Input_; }; class TLikeRegexPredicateNode : public TAstNode { @@ -394,8 +394,8 @@ public: void Accept(IAstNodeVisitor& visitor) const override; private: - TAstNodePtr Input; - NReWrapper::IRePtr Regex; + TAstNodePtr Input_; + NReWrapper::IRePtr Regex_; }; } diff --git a/yql/essentials/minikql/jsonpath/parser/binary.cpp b/yql/essentials/minikql/jsonpath/parser/binary.cpp index 8d75a6d3b90..cf966e29a63 100644 --- a/yql/essentials/minikql/jsonpath/parser/binary.cpp +++ b/yql/essentials/minikql/jsonpath/parser/binary.cpp @@ -41,14 +41,14 @@ const NReWrapper::IRePtr& TJsonPathItem::GetRegex() const { } TJsonPathReader::TJsonPathReader(const TJsonPathPtr path) - : Path(path) - , InitialPos(0) - , Mode(ReadMode(InitialPos)) + : Path_(path) + , InitialPos_(0) + , Mode_(ReadMode(InitialPos_)) { } const TJsonPathItem& TJsonPathReader::ReadFirst() { - return ReadFromPos(InitialPos); + return ReadFromPos(InitialPos_); } const TJsonPathItem& TJsonPathReader::ReadInput(const TJsonPathItem& item) { @@ -82,18 +82,18 @@ const TJsonPathItem& TJsonPathReader::ReadPrefix(const TJsonPathItem& node) { } EJsonPathMode TJsonPathReader::GetMode() const { - return Mode; + return Mode_; } const TJsonPathItem& TJsonPathReader::ReadFromPos(TUint pos) { - YQL_ENSURE(pos < Path->Size()); + YQL_ENSURE(pos < Path_->Size()); - const auto it = ItemCache.find(pos); - if (it != ItemCache.end()) { + const auto it = ItemCache_.find(pos); + if (it != ItemCache_.end()) { return it->second; } - TJsonPathItem& result = ItemCache[pos]; + TJsonPathItem& result = ItemCache_[pos]; result.Type = ReadType(pos); const auto row = ReadUint(pos); @@ -214,7 +214,7 @@ EJsonPathMode TJsonPathReader::ReadMode(TUint& pos) { const TStringBuf TJsonPathReader::ReadString(TUint& pos) { TUint length = ReadUint(pos); - TStringBuf result(Path->Begin() + pos, length); + TStringBuf result(Path_->Begin() + pos, length); pos += length; return result; } @@ -448,8 +448,8 @@ void TJsonPathBuilder::VisitMethodCall(const TMethodCallNode& node) { } TJsonPathPtr TJsonPathBuilder::ShrinkAndGetResult() { - Result->ShrinkToFit(); - return Result; + Result_->ShrinkToFit(); + return Result_; } void TJsonPathBuilder::VisitStartsWithPredicate(const TStartsWithPredicateNode& node) { @@ -563,25 +563,25 @@ void TJsonPathBuilder::WriteFinishPosition() { void TJsonPathBuilder::WriteString(TStringBuf value) { WriteUint(value.size()); - Result->Append(value.data(), value.size()); + Result_->Append(value.data(), value.size()); } void TJsonPathBuilder::RewriteUintSequence(const TVector<TUint>& sequence, TUint offset) { const auto length = sequence.size() * sizeof(TUint); Y_ASSERT(offset + length < CurrentEndPos()); - MemCopy(Result->Data() + offset, reinterpret_cast<const char*>(sequence.data()), length); + MemCopy(Result_->Data() + offset, reinterpret_cast<const char*>(sequence.data()), length); } void TJsonPathBuilder::WriteUintSequence(const TVector<TUint>& sequence) { const auto length = sequence.size() * sizeof(TUint); - Result->Append(reinterpret_cast<const char*>(sequence.data()), length); + Result_->Append(reinterpret_cast<const char*>(sequence.data()), length); } void TJsonPathBuilder::RewriteUint(TUint value, TUint offset) { Y_ASSERT(offset + sizeof(TUint) < CurrentEndPos()); - MemCopy(Result->Data() + offset, reinterpret_cast<const char*>(&value), sizeof(TUint)); + MemCopy(Result_->Data() + offset, reinterpret_cast<const char*>(&value), sizeof(TUint)); } void TJsonPathBuilder::WriteUint(TUint value) { @@ -597,7 +597,7 @@ void TJsonPathBuilder::WriteBool(bool value) { } TUint TJsonPathBuilder::CurrentEndPos() const { - return Result->Size(); + return Result_->Size(); } diff --git a/yql/essentials/minikql/jsonpath/parser/binary.h b/yql/essentials/minikql/jsonpath/parser/binary.h index 7ce26261527..4390996fb30 100644 --- a/yql/essentials/minikql/jsonpath/parser/binary.h +++ b/yql/essentials/minikql/jsonpath/parser/binary.h @@ -129,7 +129,7 @@ struct TJsonPathItem { class TJsonPathBuilder : public IAstNodeVisitor { public: TJsonPathBuilder() - : Result(new TJsonPath()) + : Result_(new TJsonPath()) { } @@ -211,12 +211,12 @@ private: template <typename T> void WritePOD(const T& value) { static_assert(std::is_pod_v<T>, "Type must be POD"); - Result->Append(reinterpret_cast<const char*>(&value), sizeof(T)); + Result_->Append(reinterpret_cast<const char*>(&value), sizeof(T)); } TUint CurrentEndPos() const; - TJsonPathPtr Result; + TJsonPathPtr Result_; }; class TJsonPathReader { @@ -261,15 +261,15 @@ private: template <typename T> T ReadPOD(TUint& pos) { static_assert(std::is_pod_v<T>, "Type must be POD"); - T value = ReadUnaligned<T>(Path->Begin() + pos); + T value = ReadUnaligned<T>(Path_->Begin() + pos); pos += sizeof(T); return std::move(value); } - const TJsonPathPtr Path; - TUint InitialPos; - EJsonPathMode Mode; - THashMap<TUint, TJsonPathItem> ItemCache; + const TJsonPathPtr Path_; + TUint InitialPos_; + EJsonPathMode Mode_; + THashMap<TUint, TJsonPathItem> ItemCache_; }; } diff --git a/yql/essentials/minikql/jsonpath/parser/parser.cpp b/yql/essentials/minikql/jsonpath/parser/parser.cpp index 105305ea3c5..39105a0c731 100644 --- a/yql/essentials/minikql/jsonpath/parser/parser.cpp +++ b/yql/essentials/minikql/jsonpath/parser/parser.cpp @@ -29,17 +29,17 @@ class TParseErrorsCollector : public NProtoAST::IErrorCollector { public: TParseErrorsCollector(TIssues& issues, size_t maxErrors) : IErrorCollector(maxErrors) - , Issues(issues) + , Issues_(issues) { } private: void AddError(ui32 line, ui32 column, const TString& message) override { - Issues.AddIssue(TPosition(column, line, "jsonpath"), StripString(message)); - Issues.back().SetCode(TIssuesIds::JSONPATH_PARSE_ERROR, TSeverityIds::S_ERROR); + Issues_.AddIssue(TPosition(column, line, "jsonpath"), StripString(message)); + Issues_.back().SetCode(TIssuesIds::JSONPATH_PARSE_ERROR, TSeverityIds::S_ERROR); } - TIssues& Issues; + TIssues& Issues_; }; } diff --git a/yql/essentials/minikql/jsonpath/parser/type_check.cpp b/yql/essentials/minikql/jsonpath/parser/type_check.cpp index f6ef00c9b24..db1c2cb5866 100644 --- a/yql/essentials/minikql/jsonpath/parser/type_check.cpp +++ b/yql/essentials/minikql/jsonpath/parser/type_check.cpp @@ -5,7 +5,7 @@ namespace NYql::NJsonPath { TJsonPathTypeChecker::TJsonPathTypeChecker(TIssues& issues) - : Issues(issues) + : Issues_(issues) { } @@ -125,8 +125,8 @@ void TJsonPathTypeChecker::VisitLikeRegexPredicate(const TLikeRegexPredicateNode } void TJsonPathTypeChecker::Error(const TAstNodePtr node, const TStringBuf message) { - Issues.AddIssue(node->GetPos(), message); - Issues.back().SetCode(TIssuesIds::JSONPATH_TYPE_CHECK_ERROR, TSeverityIds::S_ERROR); + Issues_.AddIssue(node->GetPos(), message); + Issues_.back().SetCode(TIssuesIds::JSONPATH_TYPE_CHECK_ERROR, TSeverityIds::S_ERROR); } } diff --git a/yql/essentials/minikql/jsonpath/parser/type_check.h b/yql/essentials/minikql/jsonpath/parser/type_check.h index 4c56a8a72ae..6565b59182c 100644 --- a/yql/essentials/minikql/jsonpath/parser/type_check.h +++ b/yql/essentials/minikql/jsonpath/parser/type_check.h @@ -53,7 +53,7 @@ public: void Error(const TAstNodePtr node, const TStringBuf message); private: - TIssues& Issues; + TIssues& Issues_; }; } diff --git a/yql/essentials/minikql/jsonpath/rewrapper/hyperscan/hyperscan.cpp b/yql/essentials/minikql/jsonpath/rewrapper/hyperscan/hyperscan.cpp index 2fc490b6f41..a4c0fa3a13a 100644 --- a/yql/essentials/minikql/jsonpath/rewrapper/hyperscan/hyperscan.cpp +++ b/yql/essentials/minikql/jsonpath/rewrapper/hyperscan/hyperscan.cpp @@ -12,19 +12,19 @@ namespace { class THyperscan : public IRe { public: THyperscan(::NHyperscan::TDatabase&& db) - : Database(std::move(db)) + : Database_(std::move(db)) { } bool Matches(const TStringBuf& text) const override { - if (!Scratch) { - Scratch = ::NHyperscan::MakeScratch(Database); + if (!Scratch_) { + Scratch_ = ::NHyperscan::MakeScratch(Database_); } - return ::NHyperscan::Matches(Database, Scratch, text); + return ::NHyperscan::Matches(Database_, Scratch_, text); } TString Serialize() const override { // Compatibility with old versions - return ::NHyperscan::Serialize(Database); + return ::NHyperscan::Serialize(Database_); /* * TSerialization proto; * proto.SetHyperscan(::NHyperscan::Serialize(Database)); @@ -35,8 +35,8 @@ public: */ } private: - ::NHyperscan::TDatabase Database; - mutable ::NHyperscan::TScratch Scratch; + ::NHyperscan::TDatabase Database_; + mutable ::NHyperscan::TScratch Scratch_; }; } diff --git a/yql/essentials/minikql/jsonpath/rewrapper/re2/re2.cpp b/yql/essentials/minikql/jsonpath/rewrapper/re2/re2.cpp index 694472f6326..42deaa1835e 100644 --- a/yql/essentials/minikql/jsonpath/rewrapper/re2/re2.cpp +++ b/yql/essentials/minikql/jsonpath/rewrapper/re2/re2.cpp @@ -27,44 +27,44 @@ RE2::Options CreateOptions(const TStringBuf& regex, unsigned int flags) { class TRe2 : public IRe { public: TRe2(const TStringBuf& regex, unsigned int flags) - : Regexp(StringPiece(regex.data(), regex.size()), CreateOptions(regex, flags)) + : Regexp_(StringPiece(regex.data(), regex.size()), CreateOptions(regex, flags)) { - auto re2 = RawRegexp.MutableRe2(); + auto re2 = RawRegexp_.MutableRe2(); re2->set_regexp(TString(regex)); re2->set_flags(flags); } TRe2(const TSerialization& proto) - : Regexp(StringPiece(proto.GetRe2().GetRegexp().data(), proto.GetRe2().GetRegexp().size()), + : Regexp_(StringPiece(proto.GetRe2().GetRegexp().data(), proto.GetRe2().GetRegexp().size()), CreateOptions(proto.GetRe2().GetRegexp(), proto.GetRe2().GetFlags())) - , RawRegexp(proto) + , RawRegexp_(proto) { } bool Matches(const TStringBuf& text) const override { const StringPiece piece(text.data(), text.size()); RE2::Anchor anchor = RE2::UNANCHORED; - return Regexp.Match(piece, 0, text.size(), anchor, nullptr, 0); + return Regexp_.Match(piece, 0, text.size(), anchor, nullptr, 0); } TString Serialize() const override { TString data; - auto res = RawRegexp.SerializeToString(&data); + auto res = RawRegexp_.SerializeToString(&data); Y_ABORT_UNLESS(res); return data; } bool Ok(TString* error) const { - if (Regexp.ok()) { + if (Regexp_.ok()) { return true; } else { - *error = Regexp.error(); + *error = Regexp_.error(); return false; } } private: - RE2 Regexp; - TSerialization RawRegexp; + RE2 Regexp_; + TSerialization RawRegexp_; }; } diff --git a/yql/essentials/minikql/jsonpath/ut/common_ut.cpp b/yql/essentials/minikql/jsonpath/ut/common_ut.cpp index a32389a7689..36308d013cd 100644 --- a/yql/essentials/minikql/jsonpath/ut/common_ut.cpp +++ b/yql/essentials/minikql/jsonpath/ut/common_ut.cpp @@ -95,7 +95,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -130,7 +130,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -158,7 +158,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -204,7 +204,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -247,7 +247,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -259,7 +259,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -277,7 +277,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -298,7 +298,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -343,7 +343,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -357,7 +357,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -391,7 +391,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -409,7 +409,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -466,7 +466,7 @@ public: {"123", {{"to", "1"}, {"strict", "2"}}, "$to + $strict", {"3"}}, }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunVariablesTestCase(testCase.Json, testCase.Variables, mode + testCase.JsonPath, testCase.Result); } } @@ -479,7 +479,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -505,7 +505,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -549,7 +549,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -658,7 +658,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -726,7 +726,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -738,7 +738,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -753,7 +753,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -767,7 +767,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -788,7 +788,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -801,7 +801,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -824,7 +824,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -847,7 +847,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -872,7 +872,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -885,7 +885,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -899,7 +899,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -912,7 +912,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -928,7 +928,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -943,7 +943,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -962,7 +962,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : ALL_MODES) { + for (const auto mode : AllModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } diff --git a/yql/essentials/minikql/jsonpath/ut/lax_ut.cpp b/yql/essentials/minikql/jsonpath/ut/lax_ut.cpp index 4d5dda83ac9..0fe3ed15a6c 100644 --- a/yql/essentials/minikql/jsonpath/ut/lax_ut.cpp +++ b/yql/essentials/minikql/jsonpath/ut/lax_ut.cpp @@ -52,7 +52,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -65,7 +65,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -109,7 +109,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -127,7 +127,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -156,7 +156,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -174,7 +174,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -189,7 +189,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -210,7 +210,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -227,7 +227,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -241,7 +241,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -258,7 +258,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -273,11 +273,12 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : LAX_MODES) { + for (const auto mode : LaxModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } } }; -UNIT_TEST_SUITE_REGISTRATION(TJsonPathLaxTest);
\ No newline at end of file +UNIT_TEST_SUITE_REGISTRATION(TJsonPathLaxTest); + diff --git a/yql/essentials/minikql/jsonpath/ut/strict_ut.cpp b/yql/essentials/minikql/jsonpath/ut/strict_ut.cpp index c8414581e4a..54a9f6c4fd2 100644 --- a/yql/essentials/minikql/jsonpath/ut/strict_ut.cpp +++ b/yql/essentials/minikql/jsonpath/ut/strict_ut.cpp @@ -61,7 +61,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : STRICT_MODES) { + for (const auto mode : StrictModes_) { RunRuntimeErrorTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Error); } } @@ -80,7 +80,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : STRICT_MODES) { + for (const auto mode : StrictModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -93,7 +93,7 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : STRICT_MODES) { + for (const auto mode : StrictModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } @@ -108,11 +108,12 @@ public: }; for (const auto& testCase : testCases) { - for (const auto mode : STRICT_MODES) { + for (const auto mode : StrictModes_) { RunTestCase(testCase.Json, mode + testCase.JsonPath, testCase.Result); } } } }; -UNIT_TEST_SUITE_REGISTRATION(TJsonPathStrictTest);
\ No newline at end of file +UNIT_TEST_SUITE_REGISTRATION(TJsonPathStrictTest); + diff --git a/yql/essentials/minikql/jsonpath/ut/test_base.cpp b/yql/essentials/minikql/jsonpath/ut/test_base.cpp index c9b4f5669d1..1882f137190 100644 --- a/yql/essentials/minikql/jsonpath/ut/test_base.cpp +++ b/yql/essentials/minikql/jsonpath/ut/test_base.cpp @@ -5,12 +5,12 @@ using namespace NKikimr::NBinaryJson; TJsonPathTestBase::TJsonPathTestBase() - : FunctionRegistry(CreateFunctionRegistry(CreateBuiltinRegistry())) - , Alloc(__LOCATION__) - , Env(Alloc) - , MemInfo("Memory") - , HolderFactory(Alloc.Ref(), MemInfo, FunctionRegistry.Get()) - , ValueBuilder(HolderFactory) + : FunctionRegistry_(CreateFunctionRegistry(CreateBuiltinRegistry())) + , Alloc_(__LOCATION__) + , Env_(Alloc_) + , MemInfo_("Memory") + , HolderFactory_(Alloc_.Ref(), MemInfo_, FunctionRegistry_.Get()) + , ValueBuilder_(HolderFactory_) { } @@ -19,7 +19,7 @@ TIssueCode TJsonPathTestBase::C(TIssuesIds::EIssueCode code) { } TUnboxedValue TJsonPathTestBase::ParseJson(TStringBuf raw) { - return TryParseJsonDom(raw, &ValueBuilder); + return TryParseJsonDom(raw, &ValueBuilder_); } void TJsonPathTestBase::RunTestCase(const TString& rawJson, const TString& rawJsonPath, const TVector<TString>& expectedResult) { @@ -31,17 +31,17 @@ void TJsonPathTestBase::RunTestCase(const TString& rawJson, const TString& rawJs auto binaryJsonRoot = TValue(reader->GetRootCursor()); TIssues issues; - const TJsonPathPtr jsonPath = ParseJsonPath(rawJsonPath, issues, MAX_PARSE_ERRORS); + const TJsonPathPtr jsonPath = ParseJsonPath(rawJsonPath, issues, MaxParseErrors_); UNIT_ASSERT_C(issues.Empty(), "Parse errors found"); for (const auto& json : {unboxedValueJson, binaryJsonRoot}) { - const auto result = ExecuteJsonPath(jsonPath, json, TVariablesMap{}, &ValueBuilder); + const auto result = ExecuteJsonPath(jsonPath, json, TVariablesMap{}, &ValueBuilder_); UNIT_ASSERT_C(!result.IsError(), "Runtime errors found"); const auto& nodes = result.GetNodes(); UNIT_ASSERT_VALUES_EQUAL(nodes.size(), expectedResult.size()); for (size_t i = 0; i < nodes.size(); i++) { - const auto converted = nodes[i].ConvertToUnboxedValue(&ValueBuilder); + const auto converted = nodes[i].ConvertToUnboxedValue(&ValueBuilder_); UNIT_ASSERT_VALUES_EQUAL(SerializeJsonDom(converted), expectedResult[i]); } } @@ -82,11 +82,11 @@ void TJsonPathTestBase::RunRuntimeErrorTestCase(const TString& rawJson, const TS auto binaryJsonRoot = TValue(reader->GetRootCursor()); TIssues issues; - const TJsonPathPtr jsonPath = ParseJsonPath(rawJsonPath, issues, MAX_PARSE_ERRORS); + const TJsonPathPtr jsonPath = ParseJsonPath(rawJsonPath, issues, MaxParseErrors_); UNIT_ASSERT_C(issues.Empty(), "Parse errors found"); for (const auto& json : {unboxedValueJson, binaryJsonRoot}) { - const auto result = ExecuteJsonPath(jsonPath, json, TVariablesMap{}, &ValueBuilder); + const auto result = ExecuteJsonPath(jsonPath, json, TVariablesMap{}, &ValueBuilder_); UNIT_ASSERT_C(result.IsError(), "Expected runtime error"); UNIT_ASSERT_VALUES_EQUAL(result.GetError().GetCode(), error); } @@ -126,7 +126,7 @@ void TJsonPathTestBase::RunVariablesTestCase(const TString& rawJson, const THash } TIssues issues; - const TJsonPathPtr jsonPath = ParseJsonPath(rawJsonPath, issues, MAX_PARSE_ERRORS); + const TJsonPathPtr jsonPath = ParseJsonPath(rawJsonPath, issues, MaxParseErrors_); UNIT_ASSERT_C(issues.Empty(), "Parse errors found"); TVector<std::pair<TValue, TVariablesMap>> testCases = { @@ -134,13 +134,13 @@ void TJsonPathTestBase::RunVariablesTestCase(const TString& rawJson, const THash {binaryJsonRoot, binaryJsonVariables}, }; for (const auto& testCase : testCases) { - const auto result = ExecuteJsonPath(jsonPath, testCase.first, testCase.second, &ValueBuilder); + const auto result = ExecuteJsonPath(jsonPath, testCase.first, testCase.second, &ValueBuilder_); UNIT_ASSERT_C(!result.IsError(), "Runtime errors found"); const auto& nodes = result.GetNodes(); UNIT_ASSERT_VALUES_EQUAL(nodes.size(), expectedResult.size()); for (size_t i = 0; i < nodes.size(); i++) { - const auto converted = nodes[i].ConvertToUnboxedValue(&ValueBuilder); + const auto converted = nodes[i].ConvertToUnboxedValue(&ValueBuilder_); UNIT_ASSERT_VALUES_EQUAL(SerializeJsonDom(converted), expectedResult[i]); } } diff --git a/yql/essentials/minikql/jsonpath/ut/test_base.h b/yql/essentials/minikql/jsonpath/ut/test_base.h index dbc4686ed8b..98e12c3cdce 100644 --- a/yql/essentials/minikql/jsonpath/ut/test_base.h +++ b/yql/essentials/minikql/jsonpath/ut/test_base.h @@ -29,18 +29,18 @@ public: TJsonPathTestBase(); protected: - const TVector<TStringBuf> LAX_MODES = {"", "lax "}; - const TVector<TStringBuf> STRICT_MODES = {"strict "}; - const TVector<TStringBuf> ALL_MODES = {"", "lax ", "strict "}; - - TIntrusivePtr<IFunctionRegistry> FunctionRegistry; - TScopedAlloc Alloc; - TTypeEnvironment Env; - TMemoryUsageInfo MemInfo; - THolderFactory HolderFactory; - TDefaultValueBuilder ValueBuilder; - - const int MAX_PARSE_ERRORS = 100; + const TVector<TStringBuf> LaxModes_ = {"", "lax "}; + const TVector<TStringBuf> StrictModes_ = {"strict "}; + const TVector<TStringBuf> AllModes_ = {"", "lax ", "strict "}; + + TIntrusivePtr<IFunctionRegistry> FunctionRegistry_; + TScopedAlloc Alloc_; + TTypeEnvironment Env_; + TMemoryUsageInfo MemInfo_; + THolderFactory HolderFactory_; + TDefaultValueBuilder ValueBuilder_; + + const int MaxParseErrors_ = 100; TIssueCode C(TIssuesIds::EIssueCode code); diff --git a/yql/essentials/minikql/jsonpath/value.cpp b/yql/essentials/minikql/jsonpath/value.cpp index 356543baf8b..bb06dea990f 100644 --- a/yql/essentials/minikql/jsonpath/value.cpp +++ b/yql/essentials/minikql/jsonpath/value.cpp @@ -10,40 +10,40 @@ using namespace NKikimr; using namespace NKikimr::NBinaryJson; TArrayIterator::TArrayIterator() - : Iterator(TEmptyMarker()) + : Iterator_(TEmptyMarker()) { } TArrayIterator::TArrayIterator(const TUnboxedValue& iterator) - : Iterator(iterator) + : Iterator_(iterator) { } TArrayIterator::TArrayIterator(TUnboxedValue&& iterator) - : Iterator(std::move(iterator)) + : Iterator_(std::move(iterator)) { } TArrayIterator::TArrayIterator(const NBinaryJson::TArrayIterator& iterator) - : Iterator(iterator) + : Iterator_(iterator) { } TArrayIterator::TArrayIterator(NBinaryJson::TArrayIterator&& iterator) - : Iterator(std::move(iterator)) + : Iterator_(std::move(iterator)) { } bool TArrayIterator::Next(TValue& value) { - if (std::holds_alternative<TEmptyMarker>(Iterator)) { + if (std::holds_alternative<TEmptyMarker>(Iterator_)) { return false; - } else if (auto* iterator = std::get_if<NBinaryJson::TArrayIterator>(&Iterator)) { + } else if (auto* iterator = std::get_if<NBinaryJson::TArrayIterator>(&Iterator_)) { if (!iterator->HasNext()) { return false; } value = TValue(iterator->Next()); return true; - } else if (auto* iterator = std::get_if<TUnboxedValue>(&Iterator)) { + } else if (auto* iterator = std::get_if<TUnboxedValue>(&Iterator_)) { TUnboxedValue result; const bool success = iterator->Next(result); if (success) { @@ -56,34 +56,34 @@ bool TArrayIterator::Next(TValue& value) { } TObjectIterator::TObjectIterator() - : Iterator(TEmptyMarker()) + : Iterator_(TEmptyMarker()) { } TObjectIterator::TObjectIterator(const TUnboxedValue& iterator) - : Iterator(iterator) + : Iterator_(iterator) { } TObjectIterator::TObjectIterator(TUnboxedValue&& iterator) - : Iterator(std::move(iterator)) + : Iterator_(std::move(iterator)) { } TObjectIterator::TObjectIterator(const NBinaryJson::TObjectIterator& iterator) - : Iterator(iterator) + : Iterator_(iterator) { } TObjectIterator::TObjectIterator(NBinaryJson::TObjectIterator&& iterator) - : Iterator(std::move(iterator)) + : Iterator_(std::move(iterator)) { } bool TObjectIterator::Next(TValue& key, TValue& value) { - if (std::holds_alternative<TEmptyMarker>(Iterator)) { + if (std::holds_alternative<TEmptyMarker>(Iterator_)) { return false; - } else if (auto* iterator = std::get_if<NBinaryJson::TObjectIterator>(&Iterator)) { + } else if (auto* iterator = std::get_if<NBinaryJson::TObjectIterator>(&Iterator_)) { if (!iterator->HasNext()) { return false; } @@ -91,7 +91,7 @@ bool TObjectIterator::Next(TValue& key, TValue& value) { key = TValue(itKey); value = TValue(itValue); return true; - } else if (auto* iterator = std::get_if<TUnboxedValue>(&Iterator)) { + } else if (auto* iterator = std::get_if<TUnboxedValue>(&Iterator_)) { TUnboxedValue itKey; TUnboxedValue itValue; const bool success = iterator->NextPair(itKey, itValue); @@ -106,46 +106,46 @@ bool TObjectIterator::Next(TValue& key, TValue& value) { } TValue::TValue() - : Value(MakeEntity()) + : Value_(MakeEntity()) { } TValue::TValue(const TUnboxedValue& value) - : Value(value) + : Value_(value) { } TValue::TValue(TUnboxedValue&& value) - : Value(std::move(value)) + : Value_(std::move(value)) { } TValue::TValue(const TEntryCursor& value) - : Value(value) + : Value_(value) { UnpackInnerValue(); } TValue::TValue(TEntryCursor&& value) - : Value(std::move(value)) + : Value_(std::move(value)) { UnpackInnerValue(); } TValue::TValue(const TContainerCursor& value) - : Value(value) + : Value_(value) { UnpackInnerValue(); } TValue::TValue(TContainerCursor&& value) - : Value(std::move(value)) + : Value_(std::move(value)) { UnpackInnerValue(); } EValueType TValue::GetType() const { - if (const auto* value = std::get_if<TEntryCursor>(&Value)) { + if (const auto* value = std::get_if<TEntryCursor>(&Value_)) { switch (value->GetType()) { case EEntryType::BoolFalse: case EEntryType::BoolTrue: @@ -159,7 +159,7 @@ EValueType TValue::GetType() const { case EEntryType::Container: Y_ABORT("Logical error: TEntryCursor with Container type must be converted to TContainerCursor"); } - } else if (const auto* value = std::get_if<TContainerCursor>(&Value)) { + } else if (const auto* value = std::get_if<TContainerCursor>(&Value_)) { switch (value->GetType()) { case EContainerType::Array: return EValueType::Array; @@ -168,7 +168,7 @@ EValueType TValue::GetType() const { case EContainerType::TopLevelScalar: Y_ABORT("Logical error: TContainerCursor with TopLevelScalar type must be converted to TEntryCursor"); } - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { switch (GetNodeType(*value)) { case ENodeType::Bool: return EValueType::Bool; @@ -222,9 +222,9 @@ bool TValue::IsArray() const { double TValue::GetNumber() const { Y_DEBUG_ABORT_UNLESS(IsNumber()); - if (const auto* value = std::get_if<TEntryCursor>(&Value)) { + if (const auto* value = std::get_if<TEntryCursor>(&Value_)) { return value->GetNumber(); - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { if (IsNodeType(*value, ENodeType::Double)) { return value->Get<double>(); } else if (IsNodeType(*value, ENodeType::Int64)) { @@ -240,9 +240,9 @@ double TValue::GetNumber() const { bool TValue::GetBool() const { Y_DEBUG_ABORT_UNLESS(IsBool()); - if (const auto* value = std::get_if<TEntryCursor>(&Value)) { + if (const auto* value = std::get_if<TEntryCursor>(&Value_)) { return value->GetType() == EEntryType::BoolTrue; - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { return value->Get<bool>(); } else { Y_ABORT("Unexpected variant case in GetBool"); @@ -252,9 +252,9 @@ bool TValue::GetBool() const { const TStringBuf TValue::GetString() const { Y_DEBUG_ABORT_UNLESS(IsString()); - if (const auto* value = std::get_if<TEntryCursor>(&Value)) { + if (const auto* value = std::get_if<TEntryCursor>(&Value_)) { return value->GetString(); - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { return value->AsStringRef(); } else { Y_ABORT("Unexpected variant case in GetString"); @@ -264,9 +264,9 @@ const TStringBuf TValue::GetString() const { ui32 TValue::GetSize() const { Y_DEBUG_ABORT_UNLESS(IsArray() || IsObject()); - if (const auto* value = std::get_if<TContainerCursor>(&Value)) { + if (const auto* value = std::get_if<TContainerCursor>(&Value_)) { return value->GetSize(); - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { if (value->IsEmbedded()) { return 0; } @@ -284,9 +284,9 @@ ui32 TValue::GetSize() const { TValue TValue::GetElement(ui32 index) const { Y_DEBUG_ABORT_UNLESS(IsArray()); - if (const auto* value = std::get_if<TContainerCursor>(&Value)) { + if (const auto* value = std::get_if<TContainerCursor>(&Value_)) { return TValue(value->GetElement(index)); - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { return TValue(value->Lookup(TUnboxedValuePod(index))); } else { Y_ABORT("Unexpected variant case in GetElement"); @@ -296,9 +296,9 @@ TValue TValue::GetElement(ui32 index) const { TArrayIterator TValue::GetArrayIterator() const { Y_DEBUG_ABORT_UNLESS(IsArray()); - if (const auto* value = std::get_if<TContainerCursor>(&Value)) { + if (const auto* value = std::get_if<TContainerCursor>(&Value_)) { return TArrayIterator(value->GetArrayIterator()); - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { if (value->IsEmbedded()) { return TArrayIterator(); } @@ -311,13 +311,13 @@ TArrayIterator TValue::GetArrayIterator() const { TMaybe<TValue> TValue::Lookup(const TStringBuf key) const { Y_DEBUG_ABORT_UNLESS(IsObject()); - if (const auto* value = std::get_if<TContainerCursor>(&Value)) { + if (const auto* value = std::get_if<TContainerCursor>(&Value_)) { const auto payload = value->Lookup(key); if (!payload.Defined()) { return Nothing(); } return TValue(*payload); - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { if (value->IsEmbedded()) { return Nothing(); } @@ -339,9 +339,9 @@ TMaybe<TValue> TValue::Lookup(const TStringBuf key) const { TObjectIterator TValue::GetObjectIterator() const { Y_DEBUG_ABORT_UNLESS(IsObject()); - if (const auto* value = std::get_if<TContainerCursor>(&Value)) { + if (const auto* value = std::get_if<TContainerCursor>(&Value_)) { return TObjectIterator(value->GetObjectIterator()); - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { if (value->IsEmbedded()) { return TObjectIterator(); } @@ -352,11 +352,11 @@ TObjectIterator TValue::GetObjectIterator() const { } TUnboxedValue TValue::ConvertToUnboxedValue(const NUdf::IValueBuilder* valueBuilder) const { - if (const auto* value = std::get_if<TEntryCursor>(&Value)) { + if (const auto* value = std::get_if<TEntryCursor>(&Value_)) { return ReadElementToJsonDom(*value, valueBuilder); - } else if (const auto* value = std::get_if<TContainerCursor>(&Value)) { + } else if (const auto* value = std::get_if<TContainerCursor>(&Value_)) { return ReadContainerToJsonDom(*value, valueBuilder); - } else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) { + } else if (const auto* value = std::get_if<TUnboxedValue>(&Value_)) { return *value; } else { Y_ABORT("Unexpected variant case in ConvertToUnboxedValue"); @@ -365,16 +365,16 @@ TUnboxedValue TValue::ConvertToUnboxedValue(const NUdf::IValueBuilder* valueBuil void TValue::UnpackInnerValue() { // If TEntryCursor points to container, we need to extract TContainerCursor - if (const auto* value = std::get_if<TEntryCursor>(&Value)) { + if (const auto* value = std::get_if<TEntryCursor>(&Value_)) { if (value->GetType() == EEntryType::Container) { - Value = value->GetContainer(); + Value_ = value->GetContainer(); } } // If TContainerCursor points to top level scalar, we need to extract TEntryCursor - if (const auto* value = std::get_if<TContainerCursor>(&Value)) { + if (const auto* value = std::get_if<TContainerCursor>(&Value_)) { if (value->GetType() == EContainerType::TopLevelScalar) { - Value = value->GetElement(0); + Value_ = value->GetElement(0); } } } diff --git a/yql/essentials/minikql/jsonpath/value.h b/yql/essentials/minikql/jsonpath/value.h index ca663ad5c43..cc5b98e9912 100644 --- a/yql/essentials/minikql/jsonpath/value.h +++ b/yql/essentials/minikql/jsonpath/value.h @@ -36,7 +36,7 @@ public: bool Next(TValue& value); private: - std::variant<TEmptyMarker, NUdf::TUnboxedValue, NKikimr::NBinaryJson::TArrayIterator> Iterator; + std::variant<TEmptyMarker, NUdf::TUnboxedValue, NKikimr::NBinaryJson::TArrayIterator> Iterator_; }; class TObjectIterator { @@ -51,7 +51,7 @@ public: bool Next(TValue& key, TValue& value); private: - std::variant<TEmptyMarker, NUdf::TUnboxedValue, NKikimr::NBinaryJson::TObjectIterator> Iterator; + std::variant<TEmptyMarker, NUdf::TUnboxedValue, NKikimr::NBinaryJson::TObjectIterator> Iterator_; }; class TValue { @@ -95,7 +95,7 @@ public: private: void UnpackInnerValue(); - std::variant<NUdf::TUnboxedValue, NKikimr::NBinaryJson::TEntryCursor, NKikimr::NBinaryJson::TContainerCursor> Value; + std::variant<NUdf::TUnboxedValue, NKikimr::NBinaryJson::TEntryCursor, NKikimr::NBinaryJson::TContainerCursor> Value_; }; } diff --git a/yql/essentials/minikql/mkql_alloc.cpp b/yql/essentials/minikql/mkql_alloc.cpp index febddcc84d2..f0f9c07d2eb 100644 --- a/yql/essentials/minikql/mkql_alloc.cpp +++ b/yql/essentials/minikql/mkql_alloc.cpp @@ -124,7 +124,7 @@ void TAllocState::InvalidateMemInfo() { Y_NO_SANITIZE("address") Y_NO_SANITIZE("memory") size_t TAllocState::GetDeallocatedInPages() const { size_t deallocated = 0; - for (auto x : AllPages) { + for (auto x : AllPages_) { auto currPage = (TAllocPageHeader*)x; if (currPage->UseCount) { deallocated += currPage->Deallocated; diff --git a/yql/essentials/minikql/mkql_alloc.h b/yql/essentials/minikql/mkql_alloc.h index 488f4c05a8f..4315987c495 100644 --- a/yql/essentials/minikql/mkql_alloc.h +++ b/yql/essentials/minikql/mkql_alloc.h @@ -132,7 +132,7 @@ extern Y_POD_THREAD(TAllocState*) TlsAllocState; class TPAllocScope { public: TPAllocScope() { - PAllocList.InitLinks(); + PAllocList_.InitLinks(); Attach(); } @@ -142,27 +142,27 @@ public: } void Attach() { - Y_ABORT_UNLESS(!Prev); - Prev = TlsAllocState->CurrentPAllocList; - Y_ABORT_UNLESS(Prev); - TlsAllocState->CurrentPAllocList = &PAllocList; + Y_ABORT_UNLESS(!Prev_); + Prev_ = TlsAllocState->CurrentPAllocList; + Y_ABORT_UNLESS(Prev_); + TlsAllocState->CurrentPAllocList = &PAllocList_; } void Detach() { - if (Prev) { - Y_ABORT_UNLESS(TlsAllocState->CurrentPAllocList == &PAllocList); - TlsAllocState->CurrentPAllocList = Prev; - Prev = nullptr; + if (Prev_) { + Y_ABORT_UNLESS(TlsAllocState->CurrentPAllocList == &PAllocList_); + TlsAllocState->CurrentPAllocList = Prev_; + Prev_ = nullptr; } } void Cleanup() { - TAllocState::CleanupPAllocList(&PAllocList); + TAllocState::CleanupPAllocList(&PAllocList_); } private: - TAllocState::TListEntry PAllocList; - TAllocState::TListEntry* Prev = nullptr; + TAllocState::TListEntry PAllocList_; + TAllocState::TListEntry* Prev_ = nullptr; }; // TListEntry and IBoxedValue use the same place @@ -553,16 +553,16 @@ struct TMKQLAllocator ~TMKQLAllocator() noexcept = default; template<typename U> TMKQLAllocator(const TMKQLAllocator<U, MemoryPool>&) noexcept {} - template<typename U> struct rebind { typedef TMKQLAllocator<U, MemoryPool> other; }; + template<typename U> struct rebind { typedef TMKQLAllocator<U, MemoryPool> other; }; // NOLINT(readability-identifier-naming) template<typename U> bool operator==(const TMKQLAllocator<U, MemoryPool>&) const { return true; } template<typename U> bool operator!=(const TMKQLAllocator<U, MemoryPool>&) const { return false; } - static pointer allocate(size_type n, const void* = nullptr) + static pointer allocate(size_type n, const void* = nullptr) // NOLINT(readability-identifier-naming) { return static_cast<pointer>(MKQLAllocWithSize(n * sizeof(value_type), MemoryPool)); } - static void deallocate(const_pointer p, size_type n) noexcept + static void deallocate(const_pointer p, size_type n) noexcept // NOLINT(readability-identifier-naming) { MKQLFreeWithSize(p, n * sizeof(value_type), MemoryPool); } @@ -586,34 +586,34 @@ struct TMKQLHugeAllocator ~TMKQLHugeAllocator() noexcept = default; template<typename U> TMKQLHugeAllocator(const TMKQLHugeAllocator<U>&) noexcept {} - template<typename U> struct rebind { typedef TMKQLHugeAllocator<U> other; }; + template<typename U> struct Rebind { typedef TMKQLHugeAllocator<U> other; }; template<typename U> bool operator==(const TMKQLHugeAllocator<U>&) const { return true; } template<typename U> bool operator!=(const TMKQLHugeAllocator<U>&) const { return false; } - static pointer allocateImpl(size_type n, const void* = nullptr) + static pointer AllocateImpl(size_type n, const void* = nullptr) { size_t size = Max(n * sizeof(value_type), TAllocState::POOL_PAGE_SIZE); return static_cast<pointer>(TlsAllocState->GetBlock(size)); } - static pointer allocate(size_type n, const void* = nullptr) + static pointer allocate(size_type n, const void* = nullptr) // NOLINT(readability-identifier-naming) { n = NYql::NUdf::GetSizeToAlloc(n); - void* mem = allocateImpl(n); + void* mem = AllocateImpl(n); return static_cast<pointer>(NYql::NUdf::WrapPointerWithRedZones(mem, n)); } - static void deallocateImpl(const_pointer p, size_type n) noexcept + static void DeallocateImpl(const_pointer p, size_type n) noexcept { size_t size = Max(n * sizeof(value_type), TAllocState::POOL_PAGE_SIZE); TlsAllocState->ReturnBlock(const_cast<pointer>(p), size); } - static void deallocate(const_pointer p, size_type n) noexcept + static void deallocate(const_pointer p, size_type n) noexcept // NOLINT(readability-identifier-naming) { p = static_cast<const_pointer>(NYql::NUdf::UnwrapPointerWithRedZones(p, n)); n = NYql::NUdf::GetSizeToAlloc(n); - return deallocateImpl(p, n); + return DeallocateImpl(p, n); } }; @@ -628,8 +628,8 @@ public: class TConstIterator; TPagedList(TAlignedPagePool& pool) - : Pool(pool) - , IndexInLastPage(OBJECTS_PER_PAGE) + : Pool_(pool) + , IndexInLastPage_(OBJECTS_PER_PAGE) {} TPagedList(const TPagedList&) = delete; @@ -640,48 +640,48 @@ public: } void Add(T&& value) { - if (IndexInLastPage < OBJECTS_PER_PAGE) { - auto ptr = ObjectAt(Pages.back(), IndexInLastPage); + if (IndexInLastPage_ < OBJECTS_PER_PAGE) { + auto ptr = ObjectAt(Pages_.back(), IndexInLastPage_); new(ptr) T(std::move(value)); - ++IndexInLastPage; + ++IndexInLastPage_; return; } - auto ptr = NYql::NUdf::SanitizerMakeRegionAccessible(Pool.GetPage(), TAlignedPagePool::POOL_PAGE_SIZE); - IndexInLastPage = 1; - Pages.push_back(ptr); + auto ptr = NYql::NUdf::SanitizerMakeRegionAccessible(Pool_.GetPage(), TAlignedPagePool::POOL_PAGE_SIZE); + IndexInLastPage_ = 1; + Pages_.push_back(ptr); new(ptr) T(std::move(value)); } void Clear() { - for (ui32 i = 0; i + 1 < Pages.size(); ++i) { + for (ui32 i = 0; i + 1 < Pages_.size(); ++i) { for (ui32 objIndex = 0; objIndex < OBJECTS_PER_PAGE; ++objIndex) { - ObjectAt(Pages[i], objIndex)->~T(); + ObjectAt(Pages_[i], objIndex)->~T(); } - Pool.ReturnPage(Pages[i]); + Pool_.ReturnPage(Pages_[i]); } - if (!Pages.empty()) { - for (ui32 objIndex = 0; objIndex < IndexInLastPage; ++objIndex) { - ObjectAt(Pages.back(), objIndex)->~T(); + if (!Pages_.empty()) { + for (ui32 objIndex = 0; objIndex < IndexInLastPage_; ++objIndex) { + ObjectAt(Pages_.back(), objIndex)->~T(); } - Pool.ReturnPage(Pages.back()); + Pool_.ReturnPage(Pages_.back()); } - TPages().swap(Pages); - IndexInLastPage = OBJECTS_PER_PAGE; + TPages().swap(Pages_); + IndexInLastPage_ = OBJECTS_PER_PAGE; } const T& operator[](size_t i) const { const auto table = i / OBJECTS_PER_PAGE; const auto index = i % OBJECTS_PER_PAGE; - return *ObjectAt(Pages[table], index); + return *ObjectAt(Pages_[table], index); } size_t Size() const { - return Pages.empty() ? 0 : ((Pages.size() - 1) * OBJECTS_PER_PAGE + IndexInLastPage); + return Pages_.empty() ? 0 : ((Pages_.size() - 1) * OBJECTS_PER_PAGE + IndexInLastPage_); } TConstIterator Begin() const { @@ -693,11 +693,11 @@ public: } TConstIterator End() const { - if (IndexInLastPage == OBJECTS_PER_PAGE) { - return TConstIterator(this, Pages.size(), 0); + if (IndexInLastPage_ == OBJECTS_PER_PAGE) { + return TConstIterator(this, Pages_.size(), 0); } - return TConstIterator(this, Pages.size() - 1, IndexInLastPage); + return TConstIterator(this, Pages_.size() - 1, IndexInLastPage_); } TConstIterator end() const { @@ -713,11 +713,11 @@ public: } TIterator End() { - if (IndexInLastPage == OBJECTS_PER_PAGE) { - return TIterator(this, Pages.size(), 0); + if (IndexInLastPage_ == OBJECTS_PER_PAGE) { + return TIterator(this, Pages_.size(), 0); } - return TIterator(this, Pages.size() - 1, IndexInLastPage); + return TIterator(this, Pages_.size() - 1, IndexInLastPage_); } TIterator end() { @@ -730,38 +730,38 @@ public: using TOwner = TPagedList<T>; TIterator() - : Owner(nullptr) - , PageNo(0) - , PageIndex(0) + : Owner_(nullptr) + , PageNo_(0) + , PageIndex_(0) {} TIterator(const TIterator&) = default; TIterator& operator=(const TIterator&) = default; TIterator(TOwner* owner, size_t pageNo, size_t pageIndex) - : Owner(owner) - , PageNo(pageNo) - , PageIndex(pageIndex) + : Owner_(owner) + , PageNo_(pageNo) + , PageIndex_(pageIndex) {} T& operator*() { - Y_DEBUG_ABORT_UNLESS(PageIndex < OBJECTS_PER_PAGE); - Y_DEBUG_ABORT_UNLESS(PageNo < Owner->Pages.size()); - Y_DEBUG_ABORT_UNLESS(PageNo + 1 < Owner->Pages.size() || PageIndex < Owner->IndexInLastPage); - return *Owner->ObjectAt(Owner->Pages[PageNo], PageIndex); + Y_DEBUG_ABORT_UNLESS(PageIndex_ < OBJECTS_PER_PAGE); + Y_DEBUG_ABORT_UNLESS(PageNo_ < Owner_->Pages_.size()); + Y_DEBUG_ABORT_UNLESS(PageNo_ + 1 < Owner_->Pages_.size() || PageIndex_ < Owner_->IndexInLastPage_); + return *Owner_->ObjectAt(Owner_->Pages_[PageNo_], PageIndex_); } TIterator& operator++() { - if (++PageIndex == OBJECTS_PER_PAGE) { - ++PageNo; - PageIndex = 0; + if (++PageIndex_ == OBJECTS_PER_PAGE) { + ++PageNo_; + PageIndex_ = 0; } return *this; } bool operator==(const TIterator& other) const { - return PageNo == other.PageNo && PageIndex == other.PageIndex; + return PageNo_ == other.PageNo_ && PageIndex_ == other.PageIndex_; } bool operator!=(const TIterator& other) const { @@ -769,9 +769,9 @@ public: } private: - TOwner* Owner; - size_t PageNo; - size_t PageIndex; + TOwner* Owner_; + size_t PageNo_; + size_t PageIndex_; }; class TConstIterator @@ -780,38 +780,38 @@ public: using TOwner = TPagedList<T>; TConstIterator() - : Owner(nullptr) - , PageNo(0) - , PageIndex(0) + : Owner_(nullptr) + , PageNo_(0) + , PageIndex_(0) {} TConstIterator(const TConstIterator&) = default; TConstIterator& operator=(const TConstIterator&) = default; TConstIterator(const TOwner* owner, size_t pageNo, size_t pageIndex) - : Owner(owner) - , PageNo(pageNo) - , PageIndex(pageIndex) + : Owner_(owner) + , PageNo_(pageNo) + , PageIndex_(pageIndex) {} const T& operator*() { - Y_DEBUG_ABORT_UNLESS(PageIndex < OBJECTS_PER_PAGE); - Y_DEBUG_ABORT_UNLESS(PageNo < Owner->Pages.size()); - Y_DEBUG_ABORT_UNLESS(PageNo + 1 < Owner->Pages.size() || PageIndex < Owner->IndexInLastPage); - return *Owner->ObjectAt(Owner->Pages[PageNo], PageIndex); + Y_DEBUG_ABORT_UNLESS(PageIndex_ < OBJECTS_PER_PAGE); + Y_DEBUG_ABORT_UNLESS(PageNo_ < Owner_->Pages_.size()); + Y_DEBUG_ABORT_UNLESS(PageNo_ + 1 < Owner_->Pages_.size() || PageIndex_ < Owner_->IndexInLastPage_); + return *Owner_->ObjectAt(Owner_->Pages_[PageNo_], PageIndex_); } TConstIterator& operator++() { - if (++PageIndex == OBJECTS_PER_PAGE) { - ++PageNo; - PageIndex = 0; + if (++PageIndex_ == OBJECTS_PER_PAGE) { + ++PageNo_; + PageIndex_ = 0; } return *this; } bool operator==(const TConstIterator& other) const { - return PageNo == other.PageNo && PageIndex == other.PageIndex; + return PageNo_ == other.PageNo_ && PageIndex_ == other.PageIndex_; } bool operator!=(const TConstIterator& other) const { @@ -819,9 +819,9 @@ public: } private: - const TOwner* Owner; - size_t PageNo; - size_t PageIndex; + const TOwner* Owner_; + size_t PageNo_; + size_t PageIndex_; }; private: @@ -833,10 +833,10 @@ private: return reinterpret_cast<T*>(static_cast<char*>(page) + objectIndex * sizeof(T)); } - TAlignedPagePool& Pool; + TAlignedPagePool& Pool_; using TPages = std::vector<void*, TMKQLAllocator<void*>>; - TPages Pages; - size_t IndexInLastPage; + TPages Pages_; + size_t IndexInLastPage_; }; inline void TBoxedValueWithFree::operator delete(void *mem) noexcept { diff --git a/yql/essentials/minikql/mkql_buffer.cpp b/yql/essentials/minikql/mkql_buffer.cpp index 8948dbe1b7c..d1c3eff07d9 100644 --- a/yql/essentials/minikql/mkql_buffer.cpp +++ b/yql/essentials/minikql/mkql_buffer.cpp @@ -47,14 +47,14 @@ void TPagedBuffer::AppendPage() { page = next; page->Clear(); } else { - page = TBufferPage::Allocate(PageAllocSize); + page = TBufferPage::Allocate(PageAllocSize_); tailPage->Next_ = page; } tailPage->Size_ = TailSize_; ClosedPagesSize_ += TailSize_; } else { Y_DEBUG_ABORT_UNLESS(Head_ == nullptr); - page = TBufferPage::Allocate(PageAllocSize); + page = TBufferPage::Allocate(PageAllocSize_); Head_ = page->Data(); } TailSize_ = 0; diff --git a/yql/essentials/minikql/mkql_buffer.h b/yql/essentials/minikql/mkql_buffer.h index 5eef3da65b8..f085a2dde0c 100644 --- a/yql/essentials/minikql/mkql_buffer.h +++ b/yql/essentials/minikql/mkql_buffer.h @@ -85,8 +85,8 @@ class TPagedBuffer : private TNonCopyable { TPagedBuffer() = default; explicit TPagedBuffer(size_t pageAllocSize) - : PageAllocSize(pageAllocSize) - , PageCapacity(pageAllocSize - sizeof(TBufferPage)) + : PageAllocSize_(pageAllocSize) + , PageCapacity_(pageAllocSize - sizeof(TBufferPage)) { Y_ENSURE(IsValidPageAllocSize(pageAllocSize)); } @@ -100,7 +100,7 @@ class TPagedBuffer : private TNonCopyable { while (curr) { auto drop = curr; curr = curr->Next_; - TBufferPage::Free(drop, PageAllocSize); + TBufferPage::Free(drop, PageAllocSize_); } } } @@ -194,7 +194,7 @@ class TPagedBuffer : private TNonCopyable { // TODO: not wasted or never called? Tail_ = Head_; ClosedPagesSize_ = HeadReserve_ = 0; - TailSize_ = (-size_t(Tail_ == nullptr)) & PageCapacity; + TailSize_ = (-size_t(Tail_ == nullptr)) & PageCapacity_; } inline void EraseBack(size_t len) { @@ -206,7 +206,7 @@ class TPagedBuffer : private TNonCopyable { } inline void Advance(size_t len) { - if (Y_LIKELY(TailSize_ + len <= PageCapacity)) { + if (Y_LIKELY(TailSize_ + len <= PageCapacity_)) { TailSize_ += len; #if defined(PROFILE_MEMORY_ALLOCATIONS) TotalBytesWastedCounter->Sub(len); @@ -214,7 +214,7 @@ class TPagedBuffer : private TNonCopyable { return; } - MKQL_ENSURE(len <= PageCapacity, "Advance() size too big"); + MKQL_ENSURE(len <= PageCapacity_, "Advance() size too big"); AppendPage(); TailSize_ = len; #if defined(PROFILE_MEMORY_ALLOCATIONS) @@ -229,12 +229,12 @@ class TPagedBuffer : private TNonCopyable { inline void Append(const char* data, size_t size) { while (size) { - if (TailSize_ == PageCapacity) { + if (TailSize_ == PageCapacity_) { AppendPage(); } - Y_DEBUG_ABORT_UNLESS(TailSize_ < PageCapacity); + Y_DEBUG_ABORT_UNLESS(TailSize_ < PageCapacity_); - size_t avail = PageCapacity - TailSize_; + size_t avail = PageCapacity_ - TailSize_; size_t chunk = std::min(avail, size); std::memcpy(Pos(), data, chunk); TailSize_ += chunk; @@ -250,14 +250,14 @@ class TPagedBuffer : private TNonCopyable { private: void AppendPage(); - const size_t PageAllocSize = TBufferPage::DefaultPageAllocSize; - const size_t PageCapacity = TBufferPage::DefaultPageCapacity; + const size_t PageAllocSize_ = TBufferPage::DefaultPageAllocSize; + const size_t PageCapacity_ = TBufferPage::DefaultPageCapacity; char* Head_ = nullptr; char* Tail_ = nullptr; // TailSize_ is initialized as if last page is full, this way we can simplifiy check in Advance() - size_t TailSize_ = PageCapacity; + size_t TailSize_ = PageCapacity_; size_t HeadReserve_ = 0; size_t ClosedPagesSize_ = 0; }; diff --git a/yql/essentials/minikql/mkql_function_metadata.cpp b/yql/essentials/minikql/mkql_function_metadata.cpp index 0d9e821b951..7e0e4643242 100644 --- a/yql/essentials/minikql/mkql_function_metadata.cpp +++ b/yql/essentials/minikql/mkql_function_metadata.cpp @@ -10,8 +10,8 @@ TKernelFamilyBase::TKernelFamilyBase(const arrow::compute::FunctionOptions* func const TKernel* TKernelFamilyBase::FindKernel(const NUdf::TDataTypeId* argTypes, size_t argTypesCount, NUdf::TDataTypeId returnType) const { std::vector<NUdf::TDataTypeId> args(argTypes, argTypes + argTypesCount); - auto it = KernelMap.find({ args, returnType }); - if (it == KernelMap.end()) { + auto it = KernelMap_.find({ args, returnType }); + if (it == KernelMap_.end()) { return nullptr; } @@ -20,7 +20,7 @@ const TKernel* TKernelFamilyBase::FindKernel(const NUdf::TDataTypeId* argTypes, TVector<const TKernel*> TKernelFamilyBase::GetAllKernels() const { TVector<const TKernel*> ret; - for (const auto& k : KernelMap) { + for (const auto& k : KernelMap_) { ret.emplace_back(k.second.get()); } @@ -28,7 +28,7 @@ TVector<const TKernel*> TKernelFamilyBase::GetAllKernels() const { } void TKernelFamilyBase::Adopt(const std::vector<NUdf::TDataTypeId>& argTypes, NUdf::TDataTypeId returnType, std::unique_ptr<TKernel>&& kernel) { - KernelMap.emplace(std::make_pair(argTypes, returnType), std::move(kernel)); + KernelMap_.emplace(std::make_pair(argTypes, returnType), std::move(kernel)); } } diff --git a/yql/essentials/minikql/mkql_function_metadata.h b/yql/essentials/minikql/mkql_function_metadata.h index 45c677a0998..97a7041546f 100644 --- a/yql/essentials/minikql/mkql_function_metadata.h +++ b/yql/essentials/minikql/mkql_function_metadata.h @@ -123,7 +123,7 @@ public: void Adopt(const std::vector<NUdf::TDataTypeId>& argTypes, NUdf::TDataTypeId returnType, std::unique_ptr<TKernel>&& kernel); private: - TKernelMap KernelMap; + TKernelMap KernelMap_; }; class IBuiltinFunctionRegistry: public TThrRefBase, private TNonCopyable diff --git a/yql/essentials/minikql/mkql_function_registry.cpp b/yql/essentials/minikql/mkql_function_registry.cpp index 355b5a4e7e8..83d58e83d56 100644 --- a/yql/essentials/minikql/mkql_function_registry.cpp +++ b/yql/essentials/minikql/mkql_function_registry.cpp @@ -54,12 +54,12 @@ class TMutableFunctionRegistry: public IMutableFunctionRegistry const TUdfModuleRemappings& remappings, ui32 abiVersion, const TString& customUdfPrefix = {}) - : ModulesMap(modulesMap) - , NewModules(newModules) - , LibraryPath(libraryPath) - , Remappings(remappings) - , AbiVersion(NUdf::AbiVersionToStr(abiVersion)) - , CustomUdfPrefix(customUdfPrefix) + : ModulesMap_(modulesMap) + , NewModules_(newModules) + , LibraryPath_(libraryPath) + , Remappings_(remappings) + , AbiVersion_(NUdf::AbiVersionToStr(abiVersion)) + , CustomUdfPrefix_(customUdfPrefix) { } @@ -71,40 +71,40 @@ class TMutableFunctionRegistry: public IMutableFunctionRegistry if (!HasError()) { TUdfModule m; - m.LibraryPath = LibraryPath; + m.LibraryPath = LibraryPath_; m.Impl.reset(module.Release()); - auto it = Remappings.find(name); - const TString& newName = CustomUdfPrefix - + ((it == Remappings.end()) + auto it = Remappings_.find(name); + const TString& newName = CustomUdfPrefix_ + + ((it == Remappings_.end()) ? TString(name) : it->second); - auto i = ModulesMap.insert({ newName, std::move(m) }); + auto i = ModulesMap_.insert({ newName, std::move(m) }); if (!i.second) { - TUdfModule* oldModule = ModulesMap.FindPtr(newName); + TUdfModule* oldModule = ModulesMap_.FindPtr(newName); Y_DEBUG_ABORT_UNLESS(oldModule != nullptr); - Error = (TStringBuilder() + Error_ = (TStringBuilder() << "UDF module duplication: name " << TStringBuf(name) << ", already loaded from " << oldModule->LibraryPath - << ", trying to load from " << LibraryPath); - } else if (NewModules) { - NewModules->insert(newName); + << ", trying to load from " << LibraryPath_); + } else if (NewModules_) { + NewModules_->insert(newName); } } } - const TString& GetError() const { return Error; } - bool HasError() const { return !Error.empty(); } + const TString& GetError() const { return Error_; } + bool HasError() const { return !Error_.empty(); } private: - TUdfModulesMap& ModulesMap; - THashSet<TString>* NewModules; - const TString LibraryPath; - const TUdfModuleRemappings& Remappings; - const TString AbiVersion; - TString Error; - const TString CustomUdfPrefix; + TUdfModulesMap& ModulesMap_; + THashSet<TString>* NewModules_; + const TString LibraryPath_; + const TUdfModuleRemappings& Remappings_; + const TString AbiVersion_; + TString Error_; + const TString CustomUdfPrefix_; }; public: @@ -336,15 +336,15 @@ public: class TFuncDescriptor : public NUdf::IFunctionDescriptor { public: TFuncDescriptor(TFunctionProperties& properties) - : Properties(properties) + : Properties_(properties) {} private: void SetTypeAwareness() final { - Properties.IsTypeAwareness = true; + Properties_.IsTypeAwareness = true; } - TFunctionProperties& Properties; + TFunctionProperties& Properties_; }; NUdf::IFunctionDescriptor::TPtr Add(const NUdf::TStringRef& name) final { diff --git a/yql/essentials/minikql/mkql_node.cpp b/yql/essentials/minikql/mkql_node.cpp index cee619ae07d..febb4c89868 100644 --- a/yql/essentials/minikql/mkql_node.cpp +++ b/yql/essentials/minikql/mkql_node.cpp @@ -18,10 +18,10 @@ namespace NMiniKQL { using namespace NDetail; TTypeEnvironment::TTypeEnvironment(TScopedAlloc& alloc) - : Alloc(alloc) - , Arena(&Alloc.Ref()) - , EmptyStruct(nullptr) - , EmptyTuple(nullptr) + : Alloc_(alloc) + , Arena_(&Alloc_.Ref()) + , EmptyStruct_(nullptr) + , EmptyTuple_(nullptr) { } @@ -29,167 +29,167 @@ TTypeEnvironment::~TTypeEnvironment() { } void TTypeEnvironment::ClearCookies() const { - if (TypeOfType) { - TypeOfType->SetCookie(0); + if (TypeOfType_) { + TypeOfType_->SetCookie(0); } - if (TypeOfVoid) { - TypeOfVoid->SetCookie(0); + if (TypeOfVoid_) { + TypeOfVoid_->SetCookie(0); } - if (Void) { - Void->SetCookie(0); + if (Void_) { + Void_->SetCookie(0); } - if (TypeOfNull) { - TypeOfNull->SetCookie(0); + if (TypeOfNull_) { + TypeOfNull_->SetCookie(0); } - if (Null) { - Null->SetCookie(0); + if (Null_) { + Null_->SetCookie(0); } - if (TypeOfEmptyList) { - TypeOfEmptyList->SetCookie(0); + if (TypeOfEmptyList_) { + TypeOfEmptyList_->SetCookie(0); } - if (EmptyList) { - EmptyList->SetCookie(0); + if (EmptyList_) { + EmptyList_->SetCookie(0); } - if (TypeOfEmptyDict) { - TypeOfEmptyDict->SetCookie(0); + if (TypeOfEmptyDict_) { + TypeOfEmptyDict_->SetCookie(0); } - if (EmptyDict) { - EmptyDict->SetCookie(0); + if (EmptyDict_) { + EmptyDict_->SetCookie(0); } - if (EmptyStruct) { - EmptyStruct->SetCookie(0); + if (EmptyStruct_) { + EmptyStruct_->SetCookie(0); } - if (ListOfVoid) { - ListOfVoid->SetCookie(0); + if (ListOfVoid_) { + ListOfVoid_->SetCookie(0); } - if (AnyType) { - AnyType->SetCookie(0); + if (AnyType_) { + AnyType_->SetCookie(0); } - if (EmptyTuple) { - EmptyTuple->SetCookie(0); + if (EmptyTuple_) { + EmptyTuple_->SetCookie(0); } } TTypeType* TTypeEnvironment::GetTypeOfTypeLazy() const { - if (!TypeOfType) { - TypeOfType = TTypeType::Create(*this); - TypeOfType->Type = TypeOfType; + if (!TypeOfType_) { + TypeOfType_ = TTypeType::Create(*this); + TypeOfType_->Type_ = TypeOfType_; } - return TypeOfType; + return TypeOfType_; } TVoidType* TTypeEnvironment::GetTypeOfVoidLazy() const { - if (!TypeOfVoid) { - TypeOfVoid = TVoidType::Create(GetTypeOfTypeLazy(), *this); + if (!TypeOfVoid_) { + TypeOfVoid_ = TVoidType::Create(GetTypeOfTypeLazy(), *this); } - return TypeOfVoid; + return TypeOfVoid_; } TVoid* TTypeEnvironment::GetVoidLazy() const { - if (!Void) { - Void = TVoid::Create(*this); + if (!Void_) { + Void_ = TVoid::Create(*this); } - return Void; + return Void_; } TNullType* TTypeEnvironment::GetTypeOfNullLazy() const { - if (!TypeOfNull) { - TypeOfNull = TNullType::Create(GetTypeOfTypeLazy(), *this); + if (!TypeOfNull_) { + TypeOfNull_ = TNullType::Create(GetTypeOfTypeLazy(), *this); } - return TypeOfNull; + return TypeOfNull_; } TNull* TTypeEnvironment::GetNullLazy() const { - if (!Null) { - Null = TNull::Create(*this); + if (!Null_) { + Null_ = TNull::Create(*this); } - return Null; + return Null_; } TEmptyListType* TTypeEnvironment::GetTypeOfEmptyListLazy() const { - if (!TypeOfEmptyList) { - TypeOfEmptyList = TEmptyListType::Create(GetTypeOfTypeLazy(), *this); + if (!TypeOfEmptyList_) { + TypeOfEmptyList_ = TEmptyListType::Create(GetTypeOfTypeLazy(), *this); } - return TypeOfEmptyList; + return TypeOfEmptyList_; } TEmptyList* TTypeEnvironment::GetEmptyListLazy() const { - if (!EmptyList) { - EmptyList = TEmptyList::Create(*this); + if (!EmptyList_) { + EmptyList_ = TEmptyList::Create(*this); } - return EmptyList; + return EmptyList_; } TEmptyDictType* TTypeEnvironment::GetTypeOfEmptyDictLazy() const { - if (!TypeOfEmptyDict) { - TypeOfEmptyDict = TEmptyDictType::Create(GetTypeOfTypeLazy(), *this); + if (!TypeOfEmptyDict_) { + TypeOfEmptyDict_ = TEmptyDictType::Create(GetTypeOfTypeLazy(), *this); } - return TypeOfEmptyDict; + return TypeOfEmptyDict_; } TEmptyDict* TTypeEnvironment::GetEmptyDictLazy() const { - if (!EmptyDict) { - EmptyDict = TEmptyDict::Create(*this); + if (!EmptyDict_) { + EmptyDict_ = TEmptyDict::Create(*this); } - return EmptyDict; + return EmptyDict_; } TStructLiteral* TTypeEnvironment::GetEmptyStructLazy() const { - if (!EmptyStruct) { - EmptyStruct = TStructLiteral::Create( + if (!EmptyStruct_) { + EmptyStruct_ = TStructLiteral::Create( 0, nullptr, TStructType::Create(0, nullptr, *this), *this, false); } - return EmptyStruct; + return EmptyStruct_; } TListLiteral* TTypeEnvironment::GetListOfVoidLazy() const { - if (!ListOfVoid) { - ListOfVoid = TListLiteral::Create(nullptr, 0, TListType::Create(GetVoidLazy()->GetGenericType(), *this), *this); + if (!ListOfVoid_) { + ListOfVoid_ = TListLiteral::Create(nullptr, 0, TListType::Create(GetVoidLazy()->GetGenericType(), *this), *this); } - return ListOfVoid; + return ListOfVoid_; } TAnyType* TTypeEnvironment::GetAnyTypeLazy() const { - if (!AnyType) { - AnyType = TAnyType::Create(GetTypeOfTypeLazy(), *this); + if (!AnyType_) { + AnyType_ = TAnyType::Create(GetTypeOfTypeLazy(), *this); } - return AnyType; + return AnyType_; } TTupleLiteral* TTypeEnvironment::GetEmptyTupleLazy() const { - if (!EmptyTuple) { - EmptyTuple = TTupleLiteral::Create(0, nullptr, TTupleType::Create(0, nullptr, *this), *this, false); + if (!EmptyTuple_) { + EmptyTuple_ = TTupleLiteral::Create(0, nullptr, TTupleType::Create(0, nullptr, *this), *this, false); } - return EmptyTuple; + return EmptyTuple_; } TDataType* TTypeEnvironment::GetUi32Lazy() const { - if (!Ui32) { - Ui32 = TDataType::Create(NUdf::TDataType<ui32>::Id, *this); + if (!Ui32_) { + Ui32_ = TDataType::Create(NUdf::TDataType<ui32>::Id, *this); } - return Ui32; + return Ui32_; } TDataType* TTypeEnvironment::GetUi64Lazy() const { - if (!Ui64) { - Ui64 = TDataType::Create(NUdf::TDataType<ui64>::Id, *this); + if (!Ui64_) { + Ui64_ = TDataType::Create(NUdf::TDataType<ui64>::Id, *this); } - return Ui64; + return Ui64_; } std::vector<TNode*>& TTypeEnvironment::GetNodeStack() const { - return Stack; + return Stack_; } TInternName TTypeEnvironment::InternName(const TStringBuf& name) const { - if (NamesPool.empty()) { - NamesPool.reserve(64); + if (NamesPool_.empty()) { + NamesPool_.reserve(64); } - auto it = NamesPool.find(name); - if (it != NamesPool.end()) { + auto it = NamesPool_.find(name); + if (it != NamesPool_.end()) { return TInternName(*it); } @@ -198,7 +198,7 @@ TInternName TTypeEnvironment::InternName(const TStringBuf& name) const { memcpy(data, name.data(), name.size()); data[name.size()] = 0; - return TInternName(*NamesPool.insert(TStringBuf(data, name.size())).first); + return TInternName(*NamesPool_.insert(TStringBuf(data, name.size())).first); } #define LITERALS_LIST(xx) \ @@ -217,7 +217,7 @@ TInternName TTypeEnvironment::InternName(const TStringBuf& name) const { xx(Variant, TVariantLiteral) void TNode::Accept(INodeVisitor& visitor) { - const auto kind = Type->GetKind(); + const auto kind = Type_->GetKind(); switch (kind) { case TType::EKind::Type: return static_cast<TType&>(*this).Accept(visitor); @@ -238,10 +238,10 @@ bool TNode::Equals(const TNode& nodeToCompare) const { if (this == &nodeToCompare) return true; - if (!Type->IsSameType(*nodeToCompare.Type)) + if (!Type_->IsSameType(*nodeToCompare.Type_)) return false; - const auto kind = Type->GetKind(); + const auto kind = Type_->GetKind(); switch (kind) { case TType::EKind::Type: return static_cast<const TType&>(*this).IsSameType(static_cast<const TType&>(nodeToCompare)); @@ -259,7 +259,7 @@ bool TNode::Equals(const TNode& nodeToCompare) const { } void TNode::UpdateLinks(const THashMap<TNode*, TNode*>& links) { - const auto kind = Type->GetKind(); + const auto kind = Type_->GetKind(); switch (kind) { case TType::EKind::Type: return static_cast<TType&>(*this).UpdateLinks(links); @@ -277,7 +277,7 @@ void TNode::UpdateLinks(const THashMap<TNode*, TNode*>& links) { } TNode* TNode::CloneOnCallableWrite(const TTypeEnvironment& env) const { - const auto kind = Type->GetKind(); + const auto kind = Type_->GetKind(); switch (kind) { case TType::EKind::Type: return static_cast<const TType&>(*this).CloneOnCallableWrite(env); @@ -295,7 +295,7 @@ TNode* TNode::CloneOnCallableWrite(const TTypeEnvironment& env) const { } void TNode::Freeze(const TTypeEnvironment& env) { - const auto kind = Type->GetKind(); + const auto kind = Type_->GetKind(); switch (kind) { case TType::EKind::Type: return static_cast<TType&>(*this).Freeze(env); @@ -313,7 +313,7 @@ void TNode::Freeze(const TTypeEnvironment& env) { } bool TNode::IsMergeable() const { - if (!Type->IsCallable()) { + if (!Type_->IsCallable()) { return true; } @@ -512,8 +512,8 @@ void TTypeType::DoFreeze(const TTypeEnvironment& env) { TDataType::TDataType(NUdf::TDataTypeId schemeType, const TTypeEnvironment& env) : TType(EKind::Data, env.GetTypeOfTypeLazy(), true) - , SchemeType(schemeType) - , DataSlot(NUdf::FindDataSlot(schemeType)) + , SchemeType_(schemeType) + , DataSlot_(NUdf::FindDataSlot(schemeType)) { } @@ -525,16 +525,16 @@ TDataType* TDataType::Create(NUdf::TDataTypeId schemeType, const TTypeEnvironmen } bool TDataType::IsSameType(const TDataType& typeToCompare) const { - if (SchemeType != typeToCompare.SchemeType) + if (SchemeType_ != typeToCompare.SchemeType_) return false; - if (SchemeType != NUdf::TDataType<NUdf::TDecimal>::Id) + if (SchemeType_ != NUdf::TDataType<NUdf::TDecimal>::Id) return true; return static_cast<const TDataDecimalType&>(*this).IsSameType(static_cast<const TDataDecimalType&>(typeToCompare)); } size_t TDataType::CalcHash() const { size_t hash = IntHash((size_t)GetSchemeType()); - if (SchemeType == NUdf::TDataType<NUdf::TDecimal>::Id) { + if (SchemeType_ == NUdf::TDataType<NUdf::TDecimal>::Id) { hash = CombineHashes(hash, static_cast<const TDataDecimalType&>(*this).CalcHash()); } return hash; @@ -559,10 +559,10 @@ void TDataType::DoFreeze(const TTypeEnvironment& env) { } TDataDecimalType::TDataDecimalType(ui8 precision, ui8 scale, const TTypeEnvironment& env) - : TDataType(NUdf::TDataType<NUdf::TDecimal>::Id, env), Precision(precision), Scale(scale) + : TDataType(NUdf::TDataType<NUdf::TDecimal>::Id, env), Precision_(precision), Scale_(scale) { - MKQL_ENSURE(Precision > 0, "Precision must be positive."); - MKQL_ENSURE(Scale <= Precision, "Scale too large."); + MKQL_ENSURE(Precision_ > 0, "Precision must be positive."); + MKQL_ENSURE(Scale_ <= Precision_, "Scale too large."); } TDataDecimalType* TDataDecimalType::Create(ui8 precision, ui8 scale, const TTypeEnvironment& env) { @@ -570,20 +570,20 @@ TDataDecimalType* TDataDecimalType::Create(ui8 precision, ui8 scale, const TType } bool TDataDecimalType::IsSameType(const TDataDecimalType& typeToCompare) const { - return Precision == typeToCompare.Precision && Scale == typeToCompare.Scale; + return Precision_ == typeToCompare.Precision_ && Scale_ == typeToCompare.Scale_; } size_t TDataDecimalType::CalcHash() const { - return CombineHashes(IntHash((size_t)Precision), IntHash((size_t)Scale)); + return CombineHashes(IntHash((size_t)Precision_), IntHash((size_t)Scale_)); } bool TDataDecimalType::IsConvertableTo(const TDataDecimalType& typeToCompare, bool ignoreTagged) const { Y_UNUSED(ignoreTagged); - return Precision == typeToCompare.Precision && Scale == typeToCompare.Scale; + return Precision_ == typeToCompare.Precision_ && Scale_ == typeToCompare.Scale_; } std::pair<ui8, ui8> TDataDecimalType::GetParams() const { - return std::make_pair(Precision, Scale); + return std::make_pair(Precision_, Scale_); } TDataLiteral::TDataLiteral(const TUnboxedValuePod& value, TDataType* type) @@ -595,11 +595,11 @@ TDataLiteral* TDataLiteral::Create(const NUdf::TUnboxedValuePod& value, TDataTyp } void TDataLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto typeIt = links.find(Type); + auto typeIt = links.find(Type_); if (typeIt != links.end()) { TNode* newNode = typeIt->second; - Y_DEBUG_ABORT_UNLESS(Type->Equals(*newNode)); - Type = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(Type_->Equals(*newNode)); + Type_ = static_cast<TType*>(newNode); } } @@ -658,7 +658,7 @@ static const THashSet<TStringBuf> PG_SUPPORTED_PRESORT = { TPgType::TPgType(ui32 typeId, const TTypeEnvironment& env) : TType(EKind::Pg, env.GetTypeOfTypeLazy(), NYql::NPg::HasType(typeId) && PG_SUPPORTED_PRESORT.contains(NYql::NPg::LookupType(typeId).Name)) - , TypeId(typeId) + , TypeId_(typeId) { } @@ -668,11 +668,11 @@ TPgType* TPgType::Create(ui32 typeId, const TTypeEnvironment& env) { } bool TPgType::IsSameType(const TPgType& typeToCompare) const { - return TypeId == typeToCompare.TypeId; + return TypeId_ == typeToCompare.TypeId_; } size_t TPgType::CalcHash() const { - return IntHash((size_t)TypeId); + return IntHash((size_t)TypeId_); } bool TPgType::IsConvertableTo(const TPgType& typeToCompare, bool ignoreTagged) const { @@ -694,21 +694,21 @@ void TPgType::DoFreeze(const TTypeEnvironment& env) { } const TString& TPgType::GetName() const { - return NYql::NPg::LookupType(TypeId).Name; + return NYql::NPg::LookupType(TypeId_).Name; } TStructType::TStructType(ui32 membersCount, std::pair<TInternName, TType*>* members, const TTypeEnvironment& env, bool validate) : TType(EKind::Struct, env.GetTypeOfTypeLazy(), CalculatePresortSupport(membersCount, members)) - , MembersCount(membersCount) - , Members(members) + , MembersCount_(membersCount) + , Members_(members) { if (!validate) return; TInternName lastMemberName; for (size_t index = 0; index < membersCount; ++index) { - const auto& name = Members[index].first; + const auto& name = Members_[index].first; MKQL_ENSURE(!name.Str().empty(), "Empty member name is not allowed"); MKQL_ENSURE(name.Str() > lastMemberName.Str(), "Member names are not sorted: " @@ -746,13 +746,13 @@ bool TStructType::IsSameType(const TStructType& typeToCompare) const { if (this == &typeToCompare) return true; - if (MembersCount != typeToCompare.MembersCount) + if (MembersCount_ != typeToCompare.MembersCount_) return false; - for (size_t index = 0; index < MembersCount; ++index) { - if (Members[index].first != typeToCompare.Members[index].first) + for (size_t index = 0; index < MembersCount_; ++index) { + if (Members_[index].first != typeToCompare.Members_[index].first) return false; - if (!Members[index].second->IsSameType(*typeToCompare.Members[index].second)) + if (!Members_[index].second->IsSameType(*typeToCompare.Members_[index].second)) return false; } @@ -761,9 +761,9 @@ bool TStructType::IsSameType(const TStructType& typeToCompare) const { size_t TStructType::CalcHash() const { size_t hash = 0; - for (size_t i = 0; i < MembersCount; ++i) { - hash = CombineHashes(hash, Members[i].first.Hash()); - hash = CombineHashes(hash, Members[i].second->CalcHash()); + for (size_t i = 0; i < MembersCount_; ++i) { + hash = CombineHashes(hash, Members_[i].first.Hash()); + hash = CombineHashes(hash, Members_[i].second->CalcHash()); } return hash; } @@ -772,13 +772,13 @@ bool TStructType::IsConvertableTo(const TStructType& typeToCompare, bool ignoreT if (this == &typeToCompare) return true; - if (MembersCount != typeToCompare.MembersCount) + if (MembersCount_ != typeToCompare.MembersCount_) return false; - for (size_t index = 0; index < MembersCount; ++index) { - if (Members[index].first != typeToCompare.Members[index].first) + for (size_t index = 0; index < MembersCount_; ++index) { + if (Members_[index].first != typeToCompare.Members_[index].first) return false; - if (!Members[index].second->IsConvertableTo(*typeToCompare.Members[index].second, ignoreTagged)) + if (!Members_[index].second->IsConvertableTo(*typeToCompare.Members_[index].second, ignoreTagged)) return false; } @@ -786,8 +786,8 @@ bool TStructType::IsConvertableTo(const TStructType& typeToCompare, bool ignoreT } void TStructType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - for (ui32 i = 0; i < MembersCount; ++i) { - auto& member = Members[i]; + for (ui32 i = 0; i < MembersCount_; ++i) { + auto& member = Members_[i]; auto memberIt = links.find(member.second); if (memberIt != links.end()) { TNode* newNode = memberIt->second; @@ -799,8 +799,8 @@ void TStructType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { TNode* TStructType::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { bool needClone = false; - for (ui32 i = 0; i < MembersCount; ++i) { - if (Members[i].second->GetCookie()) { + for (ui32 i = 0; i < MembersCount_; ++i) { + if (Members_[i].second->GetCookie()) { needClone = true; break; } @@ -810,20 +810,20 @@ TNode* TStructType::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { return const_cast<TStructType*>(this); std::pair<TInternName, TType*>* allocatedMembers = nullptr; - if (MembersCount) { - allocatedMembers = static_cast<std::pair<TInternName, TType*>*>(env.AllocateBuffer(MembersCount * sizeof(*allocatedMembers))); - for (ui32 i = 0; i < MembersCount; ++i) { - allocatedMembers[i].first = Members[i].first; - auto newNode = (TNode*)Members[i].second->GetCookie(); + if (MembersCount_) { + allocatedMembers = static_cast<std::pair<TInternName, TType*>*>(env.AllocateBuffer(MembersCount_ * sizeof(*allocatedMembers))); + for (ui32 i = 0; i < MembersCount_; ++i) { + allocatedMembers[i].first = Members_[i].first; + auto newNode = (TNode*)Members_[i].second->GetCookie(); if (newNode) { allocatedMembers[i].second = static_cast<TType*>(newNode); } else { - allocatedMembers[i].second = Members[i].second; + allocatedMembers[i].second = Members_[i].second; } } } - return ::new(env.Allocate<TStructType>()) TStructType(MembersCount, allocatedMembers, env, false); + return ::new(env.Allocate<TStructType>()) TStructType(MembersCount_, allocatedMembers, env, false); } void TStructType::DoFreeze(const TTypeEnvironment& env) { @@ -847,16 +847,16 @@ ui32 TStructType::GetMemberIndex(const TStringBuf& name) const { } TStringStream ss; - for (ui32 i = 0; i < MembersCount; ++i) { - ss << " " << Members[i].first.Str(); + for (ui32 i = 0; i < MembersCount_; ++i) { + ss << " " << Members_[i].first.Str(); } THROW yexception() << "Member with name '" << name << "' not found; " << " known members: " << ss.Str() << "."; } TMaybe<ui32> TStructType::FindMemberIndex(const TStringBuf& name) const { - for (ui32 i = 0; i < MembersCount; ++i) { - if (Members[i].first == name) + for (ui32 i = 0; i < MembersCount_; ++i) { + if (Members_[i].first == name) return i; } @@ -865,11 +865,11 @@ TMaybe<ui32> TStructType::FindMemberIndex(const TStringBuf& name) const { TStructLiteral::TStructLiteral(TRuntimeNode* values, TStructType* type, bool validate) : TNode(type) - , Values(values) + , Values_(values) { if (!validate) { for (size_t index = 0; index < GetValuesCount(); ++index) { - auto& value = Values[index]; + auto& value = Values_[index]; value.Freeze(); } @@ -879,7 +879,7 @@ TStructLiteral::TStructLiteral(TRuntimeNode* values, TStructType* type, bool val for (size_t index = 0; index < GetValuesCount(); ++index) { MKQL_ENSURE(!type->GetMemberName(index).empty(), "Empty struct member name is not allowed"); - auto& value = Values[index]; + auto& value = Values_[index]; MKQL_ENSURE(value.GetStaticType()->IsSameType(*type->GetMemberType(index)), "Wrong type of member"); value.Freeze(); @@ -902,15 +902,15 @@ TStructLiteral* TStructLiteral::Create(ui32 valuesCount, const TRuntimeNode* val } void TStructLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto typeIt = links.find(Type); + auto typeIt = links.find(Type_); if (typeIt != links.end()) { TNode* newNode = typeIt->second; - Y_DEBUG_ABORT_UNLESS(Type->Equals(*newNode)); - Type = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(Type_->Equals(*newNode)); + Type_ = static_cast<TType*>(newNode); } for (ui32 i = 0; i < GetValuesCount(); ++i) { - auto& value = Values[i]; + auto& value = Values_[i]; auto valueIt = links.find(value.GetNode()); if (valueIt != links.end()) { TNode* newNode = valueIt->second; @@ -921,13 +921,13 @@ void TStructLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { } TNode* TStructLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto typeNewNode = (TNode*)Type->GetCookie(); + auto typeNewNode = (TNode*)Type_->GetCookie(); bool needClone = false; if (typeNewNode) { needClone = true; } else { for (ui32 i = 0; i < GetValuesCount(); ++i) { - if (Values[i].GetNode()->GetCookie()) { + if (Values_[i].GetNode()->GetCookie()) { needClone = true; break; } @@ -941,10 +941,10 @@ TNode* TStructLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const if (GetValuesCount()) { allocatedValues = static_cast<TRuntimeNode*>(env.AllocateBuffer(GetValuesCount() * sizeof(*allocatedValues))); for (ui32 i = 0; i < GetValuesCount(); ++i) { - allocatedValues[i] = Values[i]; - auto newNode = (TNode*)Values[i].GetNode()->GetCookie(); + allocatedValues[i] = Values_[i]; + auto newNode = (TNode*)Values_[i].GetNode()->GetCookie(); if (newNode) { - allocatedValues[i] = TRuntimeNode(newNode, Values[i].IsImmediate()); + allocatedValues[i] = TRuntimeNode(newNode, Values_[i].IsImmediate()); } } } @@ -956,7 +956,7 @@ TNode* TStructLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const void TStructLiteral::DoFreeze(const TTypeEnvironment& env) { Y_UNUSED(env); for (ui32 i = 0; i < GetValuesCount(); ++i) { - Values[i].Freeze(); + Values_[i].Freeze(); } } @@ -965,7 +965,7 @@ bool TStructLiteral::Equals(const TStructLiteral& nodeToCompare) const { return false; for (size_t i = 0; i < GetValuesCount(); ++i) { - if (Values[i] != nodeToCompare.Values[i]) + if (Values_[i] != nodeToCompare.Values_[i]) return false; } @@ -974,8 +974,8 @@ bool TStructLiteral::Equals(const TStructLiteral& nodeToCompare) const { TListType::TListType(TType* itemType, const TTypeEnvironment& env, bool validate) : TType(EKind::List, env.GetTypeOfTypeLazy(), itemType->IsPresortSupported()) - , Data(itemType) - , IndexDictKey(env.GetUi64Lazy()) + , Data_(itemType) + , IndexDictKey_(env.GetUi64Lazy()) { Y_UNUSED(validate); } @@ -989,7 +989,7 @@ bool TListType::IsSameType(const TListType& typeToCompare) const { } size_t TListType::CalcHash() const { - return CombineHashes(IndexDictKey->CalcHash(), Data->CalcHash()); + return CombineHashes(IndexDictKey_->CalcHash(), Data_->CalcHash()); } bool TListType::IsConvertableTo(const TListType& typeToCompare, bool ignoreTagged) const { @@ -1001,7 +1001,7 @@ void TListType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; Y_DEBUG_ABORT_UNLESS(GetItemType()->Equals(*newNode)); - Data = static_cast<TType*>(newNode); + Data_ = static_cast<TType*>(newNode); } } @@ -1019,8 +1019,8 @@ void TListType::DoFreeze(const TTypeEnvironment& env) { TListLiteral::TListLiteral(TRuntimeNode* items, ui32 count, TListType* type, const TTypeEnvironment& env, bool validate) : TNode(type) - , Items(items) - , Count(count) + , Items_(items) + , Count_(count) { for (ui32 i = 0; i < count; ++i) { Y_DEBUG_ABORT_UNLESS(items[i].GetNode()); @@ -1031,8 +1031,8 @@ TListLiteral::TListLiteral(TRuntimeNode* items, ui32 count, TListType* type, con return; } - for (ui32 i = 0; i < Count; ++i) { - auto& item = Items[i]; + for (ui32 i = 0; i < Count_; ++i) { + auto& item = Items_[i]; MKQL_ENSURE(item.GetStaticType()->IsSameType(*type->GetItemType()), "Wrong type of item"); } @@ -1052,15 +1052,15 @@ TListLiteral* TListLiteral::Create(TRuntimeNode* items, ui32 count, TListType* t } void TListLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto typeIt = links.find(Type); + auto typeIt = links.find(Type_); if (typeIt != links.end()) { TNode* newNode = typeIt->second; - Y_DEBUG_ABORT_UNLESS(Type->Equals(*newNode)); - Type = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(Type_->Equals(*newNode)); + Type_ = static_cast<TType*>(newNode); } - for (ui32 i = 0; i < Count; ++i) { - auto& item = Items[i]; + for (ui32 i = 0; i < Count_; ++i) { + auto& item = Items_[i]; auto itemIt = links.find(item.GetNode()); if (itemIt != links.end()) { TNode* newNode = itemIt->second; @@ -1071,13 +1071,13 @@ void TListLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { } TNode* TListLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newTypeNode = (TNode*)Type->GetCookie(); + auto newTypeNode = (TNode*)Type_->GetCookie(); bool needClone = false; if (newTypeNode) { needClone = true; } else { - for (ui32 i = 0; i < Count; ++i) { - if (Items[i].GetNode()->GetCookie()) { + for (ui32 i = 0; i < Count_; ++i) { + if (Items_[i].GetNode()->GetCookie()) { needClone = true; break; } @@ -1088,13 +1088,13 @@ TNode* TListLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { return const_cast<TListLiteral*>(this); TVector<TRuntimeNode> newList; - newList.reserve(Count); - for (ui32 i = 0; i < Count; ++i) { - auto newNode = (TNode*)Items[i].GetNode()->GetCookie(); + newList.reserve(Count_); + for (ui32 i = 0; i < Count_; ++i) { + auto newNode = (TNode*)Items_[i].GetNode()->GetCookie(); if (newNode) { - newList.push_back(TRuntimeNode(newNode, Items[i].IsImmediate())); + newList.push_back(TRuntimeNode(newNode, Items_[i].IsImmediate())); } else { - newList.push_back(Items[i]); + newList.push_back(Items_[i]); } } @@ -1112,8 +1112,8 @@ TNode* TListLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { void TListLiteral::DoFreeze(const TTypeEnvironment&) { ui32 voidCount = 0; - for (ui32 i = 0; i < Count; ++i) { - auto& node = Items[i]; + for (ui32 i = 0; i < Count_; ++i) { + auto& node = Items_[i]; node.Freeze(); if (node.HasValue() && node.GetValue()->GetType()->IsVoid()) { ++voidCount; @@ -1123,9 +1123,9 @@ void TListLiteral::DoFreeze(const TTypeEnvironment&) { if (!voidCount) return; - TRuntimeNode* newItems = Items; - for (ui32 i = 0; i < Count; ++i) { - auto node = Items[i]; + TRuntimeNode* newItems = Items_; + for (ui32 i = 0; i < Count_; ++i) { + auto node = Items_[i]; if (node.HasValue() && node.GetValue()->GetType()->IsVoid()) { continue; } @@ -1133,15 +1133,15 @@ void TListLiteral::DoFreeze(const TTypeEnvironment&) { *newItems++ = node; } - Count = newItems - Items; + Count_ = newItems - Items_; } bool TListLiteral::Equals(const TListLiteral& nodeToCompare) const { - if (Count != nodeToCompare.Count) + if (Count_ != nodeToCompare.Count_) return false; - for (ui32 i = 0; i < Count; ++i) { - if (Items[i] != nodeToCompare.Items[i]) + for (ui32 i = 0; i < Count_; ++i) { + if (Items_[i] != nodeToCompare.Items_[i]) return false; } @@ -1150,7 +1150,7 @@ bool TListLiteral::Equals(const TListLiteral& nodeToCompare) const { TStreamType::TStreamType(TType* itemType, const TTypeEnvironment& env, bool validate) : TType(EKind::Stream, env.GetTypeOfTypeLazy(), false) - , Data(itemType) + , Data_(itemType) { Y_UNUSED(validate); } @@ -1164,7 +1164,7 @@ bool TStreamType::IsSameType(const TStreamType& typeToCompare) const { } size_t TStreamType::CalcHash() const { - return Data->CalcHash(); + return Data_->CalcHash(); } bool TStreamType::IsConvertableTo(const TStreamType& typeToCompare, bool ignoreTagged) const { @@ -1176,7 +1176,7 @@ void TStreamType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; Y_DEBUG_ABORT_UNLESS(GetItemType()->Equals(*newNode)); - Data = static_cast<TType*>(newNode); + Data_ = static_cast<TType*>(newNode); } } @@ -1194,7 +1194,7 @@ void TStreamType::DoFreeze(const TTypeEnvironment& env) { TFlowType::TFlowType(TType* itemType, const TTypeEnvironment& env, bool validate) : TType(EKind::Flow, env.GetTypeOfTypeLazy(), false) - , Data(itemType) + , Data_(itemType) { Y_UNUSED(validate); } @@ -1208,7 +1208,7 @@ bool TFlowType::IsSameType(const TFlowType& typeToCompare) const { } size_t TFlowType::CalcHash() const { - return Data->CalcHash(); + return Data_->CalcHash(); } bool TFlowType::IsConvertableTo(const TFlowType& typeToCompare, bool ignoreTagged) const { @@ -1220,7 +1220,7 @@ void TFlowType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; Y_DEBUG_ABORT_UNLESS(GetItemType()->Equals(*newNode)); - Data = static_cast<TType*>(newNode); + Data_ = static_cast<TType*>(newNode); } } @@ -1238,7 +1238,7 @@ void TFlowType::DoFreeze(const TTypeEnvironment& env) { TOptionalType::TOptionalType(TType* itemType, const TTypeEnvironment& env, bool validate) : TType(EKind::Optional, env.GetTypeOfTypeLazy(), itemType->IsPresortSupported()) - , Data(itemType) + , Data_(itemType) { Y_UNUSED(validate); } @@ -1252,7 +1252,7 @@ bool TOptionalType::IsSameType(const TOptionalType& typeToCompare) const { } size_t TOptionalType::CalcHash() const { - return Data->CalcHash(); + return Data_->CalcHash(); } bool TOptionalType::IsConvertableTo(const TOptionalType& typeToCompare, bool ignoreTagged) const { @@ -1264,7 +1264,7 @@ void TOptionalType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; Y_DEBUG_ABORT_UNLESS(GetItemType()->Equals(*newNode)); - Data = static_cast<TType*>(newNode); + Data_ = static_cast<TType*>(newNode); } } @@ -1282,8 +1282,8 @@ void TOptionalType::DoFreeze(const TTypeEnvironment& env) { TTaggedType::TTaggedType(TType* baseType, TInternName tag, const TTypeEnvironment& env) : TType(EKind::Tagged, env.GetTypeOfTypeLazy(), baseType->IsPresortSupported()) - , BaseType(baseType) - , Tag(tag) + , BaseType_(baseType) + , Tag_(tag) { } @@ -1292,15 +1292,15 @@ TTaggedType* TTaggedType::Create(TType* baseType, const TStringBuf& tag, const T } bool TTaggedType::IsSameType(const TTaggedType& typeToCompare) const { - return Tag == typeToCompare.Tag && GetBaseType()->IsSameType(*typeToCompare.GetBaseType()); + return Tag_ == typeToCompare.Tag_ && GetBaseType()->IsSameType(*typeToCompare.GetBaseType()); } size_t TTaggedType::CalcHash() const { - return CombineHashes(BaseType->CalcHash(), Tag.Hash()); + return CombineHashes(BaseType_->CalcHash(), Tag_.Hash()); } bool TTaggedType::IsConvertableTo(const TTaggedType& typeToCompare, bool ignoreTagged) const { - return Tag == typeToCompare.Tag && GetBaseType()->IsConvertableTo(*typeToCompare.GetBaseType(), ignoreTagged); + return Tag_ == typeToCompare.Tag_ && GetBaseType()->IsConvertableTo(*typeToCompare.GetBaseType(), ignoreTagged); } void TTaggedType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { @@ -1308,7 +1308,7 @@ void TTaggedType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; Y_DEBUG_ABORT_UNLESS(GetBaseType()->Equals(*newNode)); - BaseType = static_cast<TType*>(newNode); + BaseType_ = static_cast<TType*>(newNode); } } @@ -1317,7 +1317,7 @@ TNode* TTaggedType::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { if (!newTypeNode) return const_cast<TTaggedType*>(this); - return ::new(env.Allocate<TTaggedType>()) TTaggedType(static_cast<TType*>(newTypeNode), Tag, env); + return ::new(env.Allocate<TTaggedType>()) TTaggedType(static_cast<TType*>(newTypeNode), Tag_, env); } void TTaggedType::DoFreeze(const TTypeEnvironment& env) { @@ -1332,18 +1332,18 @@ TOptionalLiteral::TOptionalLiteral(TOptionalType* type, bool validate) TOptionalLiteral::TOptionalLiteral(TRuntimeNode item, TOptionalType* type, bool validate) : TNode(type) - , Item(item) + , Item_(item) { if (!validate) { - Item.Freeze(); + Item_.Freeze(); return; } - Y_DEBUG_ABORT_UNLESS(Item.GetNode()); + Y_DEBUG_ABORT_UNLESS(Item_.GetNode()); - MKQL_ENSURE(Item.GetStaticType()->IsSameType(*type->GetItemType()), "Wrong type of item"); + MKQL_ENSURE(Item_.GetStaticType()->IsSameType(*type->GetItemType()), "Wrong type of item"); - Item.Freeze(); + Item_.Freeze(); } TOptionalLiteral* TOptionalLiteral::Create(TOptionalType* type, const TTypeEnvironment& env) { @@ -1355,52 +1355,52 @@ TOptionalLiteral* TOptionalLiteral::Create(TRuntimeNode item, TOptionalType* typ } void TOptionalLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto typeIt = links.find(Type); + auto typeIt = links.find(Type_); if (typeIt != links.end()) { TNode* newNode = typeIt->second; - Y_DEBUG_ABORT_UNLESS(Type->Equals(*newNode)); - Type = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(Type_->Equals(*newNode)); + Type_ = static_cast<TType*>(newNode); } - if (Item.GetNode()) { - auto itemIt = links.find(Item.GetNode()); + if (Item_.GetNode()) { + auto itemIt = links.find(Item_.GetNode()); if (itemIt != links.end()) { TNode* newNode = itemIt->second; - Y_DEBUG_ABORT_UNLESS(Item.GetNode()->Equals(*newNode)); - Item = TRuntimeNode(newNode, Item.IsImmediate()); + Y_DEBUG_ABORT_UNLESS(Item_.GetNode()->Equals(*newNode)); + Item_ = TRuntimeNode(newNode, Item_.IsImmediate()); } } } TNode* TOptionalLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newTypeNode = (TNode*)Type->GetCookie(); - auto newItemNode = Item.GetNode() ? (TNode*)Item.GetNode()->GetCookie() : nullptr; + auto newTypeNode = (TNode*)Type_->GetCookie(); + auto newItemNode = Item_.GetNode() ? (TNode*)Item_.GetNode()->GetCookie() : nullptr; if (!newTypeNode && !newItemNode) { return const_cast<TOptionalLiteral*>(this); } - if (!Item.GetNode()) { + if (!Item_.GetNode()) { return ::new(env.Allocate<TOptionalLiteral>()) TOptionalLiteral( newTypeNode ? static_cast<TOptionalType*>(newTypeNode) : GetType(), false); } else { return ::new(env.Allocate<TOptionalLiteral>()) TOptionalLiteral( - newItemNode ? TRuntimeNode(newItemNode, Item.IsImmediate()) : Item, + newItemNode ? TRuntimeNode(newItemNode, Item_.IsImmediate()) : Item_, newTypeNode ? static_cast<TOptionalType*>(newTypeNode) : GetType(), false); } } void TOptionalLiteral::DoFreeze(const TTypeEnvironment& env) { Y_UNUSED(env); - if (Item.GetNode()) { - Item.Freeze(); + if (Item_.GetNode()) { + Item_.Freeze(); } } bool TOptionalLiteral::Equals(const TOptionalLiteral& nodeToCompare) const { - if (!Item.GetNode() != !nodeToCompare.Item.GetNode()) + if (!Item_.GetNode() != !nodeToCompare.Item_.GetNode()) return false; - return !Item.GetNode() || Item.GetNode()->Equals(*nodeToCompare.Item.GetNode()); + return !Item_.GetNode() || Item_.GetNode()->Equals(*nodeToCompare.Item_.GetNode()); } TDictType* TDictType::Create(TType* keyType, TType* payloadType, const TTypeEnvironment& env) { @@ -1408,45 +1408,45 @@ TDictType* TDictType::Create(TType* keyType, TType* payloadType, const TTypeEnvi } bool TDictType::IsSameType(const TDictType& typeToCompare) const { - return KeyType->IsSameType(*typeToCompare.KeyType) - && PayloadType->IsSameType(*typeToCompare.PayloadType); + return KeyType_->IsSameType(*typeToCompare.KeyType_) + && PayloadType_->IsSameType(*typeToCompare.PayloadType_); } size_t TDictType::CalcHash() const { - return CombineHashes(KeyType->CalcHash(), PayloadType->CalcHash()); + return CombineHashes(KeyType_->CalcHash(), PayloadType_->CalcHash()); } bool TDictType::IsConvertableTo(const TDictType& typeToCompare, bool ignoreTagged) const { - return KeyType->IsConvertableTo(*typeToCompare.KeyType, ignoreTagged) - && PayloadType->IsConvertableTo(*typeToCompare.PayloadType, ignoreTagged); + return KeyType_->IsConvertableTo(*typeToCompare.KeyType_, ignoreTagged) + && PayloadType_->IsConvertableTo(*typeToCompare.PayloadType_, ignoreTagged); } void TDictType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto keyTypeIt = links.find(KeyType); + auto keyTypeIt = links.find(KeyType_); if (keyTypeIt != links.end()) { TNode* newNode = keyTypeIt->second; - Y_DEBUG_ABORT_UNLESS(KeyType->Equals(*newNode)); - KeyType = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(KeyType_->Equals(*newNode)); + KeyType_ = static_cast<TType*>(newNode); } - auto payloadTypeIt = links.find(PayloadType); + auto payloadTypeIt = links.find(PayloadType_); if (payloadTypeIt != links.end()) { TNode* newNode = payloadTypeIt->second; - Y_DEBUG_ABORT_UNLESS(PayloadType->Equals(*newNode)); - PayloadType = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(PayloadType_->Equals(*newNode)); + PayloadType_ = static_cast<TType*>(newNode); } } TNode* TDictType::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newKeyType = (TNode*)KeyType->GetCookie(); - auto newPayloadType = (TNode*)PayloadType->GetCookie(); + auto newKeyType = (TNode*)KeyType_->GetCookie(); + auto newPayloadType = (TNode*)PayloadType_->GetCookie(); if (!newKeyType && !newPayloadType) { return const_cast<TDictType*>(this); } return ::new(env.Allocate<TDictType>()) TDictType( - newKeyType ? static_cast<TType*>(newKeyType) : KeyType, - newPayloadType ? static_cast<TType*>(newPayloadType) : PayloadType, env, false); + newKeyType ? static_cast<TType*>(newKeyType) : KeyType_, + newPayloadType ? static_cast<TType*>(newPayloadType) : PayloadType_, env, false); } void TDictType::DoFreeze(const TTypeEnvironment& env) { @@ -1456,8 +1456,8 @@ void TDictType::DoFreeze(const TTypeEnvironment& env) { TDictType::TDictType(TType* keyType, TType* payloadType, const TTypeEnvironment& env, bool validate) : TType(EKind::Dict, env.GetTypeOfTypeLazy(), keyType->IsPresortSupported() && payloadType->IsPresortSupported()) - , KeyType(keyType) - , PayloadType(payloadType) + , KeyType_(keyType) + , PayloadType_(payloadType) { if (!validate) return; @@ -1471,12 +1471,12 @@ void TDictType::EnsureValidDictKey(TType* keyType) { TDictLiteral::TDictLiteral(ui32 itemsCount, std::pair<TRuntimeNode, TRuntimeNode>* items, TDictType* type, bool validate) : TNode(type) - , ItemsCount(itemsCount) - , Items(items) + , ItemsCount_(itemsCount) + , Items_(items) { if (!validate) { for (size_t index = 0; index < itemsCount; ++index) { - auto& item = Items[index]; + auto& item = Items_[index]; item.first.Freeze(); item.second.Freeze(); } @@ -1485,7 +1485,7 @@ TDictLiteral::TDictLiteral(ui32 itemsCount, std::pair<TRuntimeNode, TRuntimeNode } for (size_t index = 0; index < itemsCount; ++index) { - auto& item = Items[index]; + auto& item = Items_[index]; MKQL_ENSURE(item.first.GetStaticType()->IsSameType(*type->GetKeyType()), "Wrong type of key"); MKQL_ENSURE(item.second.GetStaticType()->IsSameType(*type->GetPayloadType()), "Wrong type of payload"); @@ -1509,15 +1509,15 @@ TDictLiteral* TDictLiteral::Create(ui32 itemsCount, const std::pair<TRuntimeNode } void TDictLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto typeIt = links.find(Type); + auto typeIt = links.find(Type_); if (typeIt != links.end()) { TNode* newNode = typeIt->second; - Y_DEBUG_ABORT_UNLESS(Type->Equals(*newNode)); - Type = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(Type_->Equals(*newNode)); + Type_ = static_cast<TType*>(newNode); } - for (ui32 i = 0; i < ItemsCount; ++i) { - auto& item = Items[i]; + for (ui32 i = 0; i < ItemsCount_; ++i) { + auto& item = Items_[i]; auto itemKeyIt = links.find(item.first.GetNode()); if (itemKeyIt != links.end()) { TNode* newNode = itemKeyIt->second; @@ -1535,18 +1535,18 @@ void TDictLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { } TNode* TDictLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newTypeNode = (TNode*)Type->GetCookie(); + auto newTypeNode = (TNode*)Type_->GetCookie(); bool needClone = false; if (newTypeNode) { needClone = true; } else { - for (ui32 i = 0; i < ItemsCount; ++i) { - if (Items[i].first.GetNode()->GetCookie()) { + for (ui32 i = 0; i < ItemsCount_; ++i) { + if (Items_[i].first.GetNode()->GetCookie()) { needClone = true; break; } - if (Items[i].second.GetNode()->GetCookie()) { + if (Items_[i].second.GetNode()->GetCookie()) { needClone = true; break; } @@ -1557,40 +1557,40 @@ TNode* TDictLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { return const_cast<TDictLiteral*>(this); std::pair<TRuntimeNode, TRuntimeNode>* allocatedItems = nullptr; - if (ItemsCount) { - allocatedItems = static_cast<std::pair<TRuntimeNode, TRuntimeNode>*>(env.AllocateBuffer(ItemsCount * sizeof(*allocatedItems))); - for (ui32 i = 0; i < ItemsCount; ++i) { - allocatedItems[i] = Items[i]; - auto newKeyNode = (TNode*)Items[i].first.GetNode()->GetCookie(); + if (ItemsCount_) { + allocatedItems = static_cast<std::pair<TRuntimeNode, TRuntimeNode>*>(env.AllocateBuffer(ItemsCount_ * sizeof(*allocatedItems))); + for (ui32 i = 0; i < ItemsCount_; ++i) { + allocatedItems[i] = Items_[i]; + auto newKeyNode = (TNode*)Items_[i].first.GetNode()->GetCookie(); if (newKeyNode) { - allocatedItems[i].first = TRuntimeNode(newKeyNode, Items[i].first.IsImmediate()); + allocatedItems[i].first = TRuntimeNode(newKeyNode, Items_[i].first.IsImmediate()); } - auto newPayloadNode = (TNode*)Items[i].second.GetNode()->GetCookie(); + auto newPayloadNode = (TNode*)Items_[i].second.GetNode()->GetCookie(); if (newPayloadNode) { - allocatedItems[i].second = TRuntimeNode(newPayloadNode, Items[i].second.IsImmediate()); + allocatedItems[i].second = TRuntimeNode(newPayloadNode, Items_[i].second.IsImmediate()); } } } - return ::new(env.Allocate<TDictLiteral>()) TDictLiteral(ItemsCount, allocatedItems, + return ::new(env.Allocate<TDictLiteral>()) TDictLiteral(ItemsCount_, allocatedItems, newTypeNode ? static_cast<TDictType*>(newTypeNode) : GetType(), false); } void TDictLiteral::DoFreeze(const TTypeEnvironment& env) { Y_UNUSED(env); - for (ui32 i = 0; i < ItemsCount; ++i) { - Items[i].first.Freeze(); - Items[i].second.Freeze(); + for (ui32 i = 0; i < ItemsCount_; ++i) { + Items_[i].first.Freeze(); + Items_[i].second.Freeze(); } } bool TDictLiteral::Equals(const TDictLiteral& nodeToCompare) const { - if (ItemsCount != nodeToCompare.ItemsCount) + if (ItemsCount_ != nodeToCompare.ItemsCount_) return false; - for (size_t i = 0; i < ItemsCount; ++i) { - if (Items[i] != nodeToCompare.Items[i]) + for (size_t i = 0; i < ItemsCount_; ++i) { + if (Items_[i] != nodeToCompare.Items_[i]) return false; } @@ -1600,13 +1600,13 @@ bool TDictLiteral::Equals(const TDictLiteral& nodeToCompare) const { TCallableType::TCallableType(const TInternName &name, TType* returnType, ui32 argumentsCount, TType **arguments, TNode* payload, const TTypeEnvironment& env) : TType(EKind::Callable, env.GetTypeOfTypeLazy(), false) - , IsMergeDisabled0(false) - , ArgumentsCount(argumentsCount) - , Name(name) - , ReturnType(returnType) - , Arguments(arguments) - , Payload(payload) - , OptionalArgs(0) + , IsMergeDisabled0_(false) + , ArgumentsCount_(argumentsCount) + , Name_(name) + , ReturnType_(returnType) + , Arguments_(arguments) + , Payload_(payload) + , OptionalArgs_(0) { } @@ -1644,40 +1644,40 @@ bool TCallableType::IsSameType(const TCallableType& typeToCompare) const { if (this == &typeToCompare) return true; - if (Name != typeToCompare.Name || IsMergeDisabled0 != typeToCompare.IsMergeDisabled0) + if (Name_ != typeToCompare.Name_ || IsMergeDisabled0_ != typeToCompare.IsMergeDisabled0_) return false; - if (ArgumentsCount != typeToCompare.ArgumentsCount) + if (ArgumentsCount_ != typeToCompare.ArgumentsCount_) return false; - if (OptionalArgs != typeToCompare.OptionalArgs) + if (OptionalArgs_ != typeToCompare.OptionalArgs_) return false; - for (size_t index = 0; index < ArgumentsCount; ++index) { - const auto arg = Arguments[index]; - const auto otherArg = typeToCompare.Arguments[index]; + for (size_t index = 0; index < ArgumentsCount_; ++index) { + const auto arg = Arguments_[index]; + const auto otherArg = typeToCompare.Arguments_[index]; if (!arg->IsSameType(*otherArg)) return false; } - if (!ReturnType->IsSameType(*typeToCompare.ReturnType)) + if (!ReturnType_->IsSameType(*typeToCompare.ReturnType_)) return false; - if (!Payload != !typeToCompare.Payload) + if (!Payload_ != !typeToCompare.Payload_) return false; - return !Payload || Payload->Equals(*typeToCompare.Payload); + return !Payload_ || Payload_->Equals(*typeToCompare.Payload_); } size_t TCallableType::CalcHash() const { size_t hash = 0; - hash = CombineHashes(hash, IntHash<size_t>(ArgumentsCount)); - hash = CombineHashes(hash, Name.Hash()); - hash = CombineHashes(hash, ReturnType->CalcHash()); - for (size_t index = 0; index < ArgumentsCount; ++index) { - hash = CombineHashes(hash, Arguments[index]->CalcHash()); + hash = CombineHashes(hash, IntHash<size_t>(ArgumentsCount_)); + hash = CombineHashes(hash, Name_.Hash()); + hash = CombineHashes(hash, ReturnType_->CalcHash()); + for (size_t index = 0; index < ArgumentsCount_; ++index) { + hash = CombineHashes(hash, Arguments_[index]->CalcHash()); } - hash = CombineHashes(hash, IntHash<size_t>(OptionalArgs)); + hash = CombineHashes(hash, IntHash<size_t>(OptionalArgs_)); return hash; } @@ -1687,37 +1687,37 @@ bool TCallableType::IsConvertableTo(const TCallableType& typeToCompare, bool ign if (this == &typeToCompare) return true; - if (IsMergeDisabled0 != typeToCompare.IsMergeDisabled0) + if (IsMergeDisabled0_ != typeToCompare.IsMergeDisabled0_) return false; - if (ArgumentsCount < typeToCompare.ArgumentsCount) + if (ArgumentsCount_ < typeToCompare.ArgumentsCount_) return false; // function with fewer optional args can't be converted to function // with more optional args - if (ArgumentsCount - OptionalArgs > typeToCompare.ArgumentsCount - typeToCompare.OptionalArgs) + if (ArgumentsCount_ - OptionalArgs_ > typeToCompare.ArgumentsCount_ - typeToCompare.OptionalArgs_) return false; - for (size_t index = 0; index < typeToCompare.ArgumentsCount; ++index) { - const auto arg = Arguments[index]; - const auto otherArg = typeToCompare.Arguments[index]; + for (size_t index = 0; index < typeToCompare.ArgumentsCount_; ++index) { + const auto arg = Arguments_[index]; + const auto otherArg = typeToCompare.Arguments_[index]; if (!arg->IsConvertableTo(*otherArg, ignoreTagged)) return false; } - if (!ReturnType->IsConvertableTo(*typeToCompare.ReturnType, ignoreTagged)) + if (!ReturnType_->IsConvertableTo(*typeToCompare.ReturnType_, ignoreTagged)) return false; - if (!Payload) { + if (!Payload_) { return true; } - if (!typeToCompare.Payload) { + if (!typeToCompare.Payload_) { return false; } - TCallablePayload parsedPayload(Payload), parsedPayloadToCompare(typeToCompare.Payload); - for (size_t index = 0; index < typeToCompare.ArgumentsCount; ++index) { + TCallablePayload parsedPayload(Payload_), parsedPayloadToCompare(typeToCompare.Payload_); + for (size_t index = 0; index < typeToCompare.ArgumentsCount_; ++index) { if (parsedPayload.GetArgumentName(index) != parsedPayloadToCompare.GetArgumentName(index)) { return false; } @@ -1730,24 +1730,24 @@ bool TCallableType::IsConvertableTo(const TCallableType& typeToCompare, bool ign } void TCallableType::SetOptionalArgumentsCount(ui32 count) { - MKQL_ENSURE(count <= ArgumentsCount, "Wrong optional arguments count: " << count << ", function has only " << - ArgumentsCount << " arguments"); - OptionalArgs = count; - for (ui32 index = ArgumentsCount - OptionalArgs; index < ArgumentsCount; ++index) { - MKQL_ENSURE(Arguments[index]->IsOptional(), "Optional argument #" << (index + 1) << " must be an optional"); + MKQL_ENSURE(count <= ArgumentsCount_, "Wrong optional arguments count: " << count << ", function has only " << + ArgumentsCount_ << " arguments"); + OptionalArgs_ = count; + for (ui32 index = ArgumentsCount_ - OptionalArgs_; index < ArgumentsCount_; ++index) { + MKQL_ENSURE(Arguments_[index]->IsOptional(), "Optional argument #" << (index + 1) << " must be an optional"); } } void TCallableType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto returnTypeIt = links.find(ReturnType); + auto returnTypeIt = links.find(ReturnType_); if (returnTypeIt != links.end()) { TNode* newNode = returnTypeIt->second; - Y_DEBUG_ABORT_UNLESS(ReturnType->Equals(*newNode)); - ReturnType = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(ReturnType_->Equals(*newNode)); + ReturnType_ = static_cast<TType*>(newNode); } - for (ui32 i = 0; i < ArgumentsCount; ++i) { - auto& arg = Arguments[i]; + for (ui32 i = 0; i < ArgumentsCount_; ++i) { + auto& arg = Arguments_[i]; auto argIt = links.find(arg); if (argIt != links.end()) { TNode* newNode = argIt->second; @@ -1756,25 +1756,25 @@ void TCallableType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { } } - if (Payload) { - auto payloadIt = links.find(Payload); + if (Payload_) { + auto payloadIt = links.find(Payload_); if (payloadIt != links.end()) { TNode* newNode = payloadIt->second; - Y_DEBUG_ABORT_UNLESS(Payload->Equals(*newNode)); - Payload = newNode; + Y_DEBUG_ABORT_UNLESS(Payload_->Equals(*newNode)); + Payload_ = newNode; } } } TNode* TCallableType::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newReturnTypeNode = (TNode*)ReturnType->GetCookie(); - auto newPayloadNode = Payload ? (TNode*)Payload->GetCookie() : nullptr; + auto newReturnTypeNode = (TNode*)ReturnType_->GetCookie(); + auto newPayloadNode = Payload_ ? (TNode*)Payload_->GetCookie() : nullptr; bool needClone = false; if (newReturnTypeNode || newPayloadNode) { needClone = true; } else { - for (ui32 i = 0; i < ArgumentsCount; ++i) { - if (Arguments[i]->GetCookie()) { + for (ui32 i = 0; i < ArgumentsCount_; ++i) { + if (Arguments_[i]->GetCookie()) { needClone = true; break; } @@ -1785,20 +1785,20 @@ TNode* TCallableType::DoCloneOnCallableWrite(const TTypeEnvironment& env) const return const_cast<TCallableType*>(this); TType** allocatedArguments = nullptr; - if (ArgumentsCount) { - allocatedArguments = static_cast<TType**>(env.AllocateBuffer(ArgumentsCount * sizeof(*allocatedArguments))); - for (ui32 i = 0; i < ArgumentsCount; ++i) { - allocatedArguments[i] = Arguments[i]; - auto newArgNode = (TNode*)Arguments[i]->GetCookie(); + if (ArgumentsCount_) { + allocatedArguments = static_cast<TType**>(env.AllocateBuffer(ArgumentsCount_ * sizeof(*allocatedArguments))); + for (ui32 i = 0; i < ArgumentsCount_; ++i) { + allocatedArguments[i] = Arguments_[i]; + auto newArgNode = (TNode*)Arguments_[i]->GetCookie(); if (newArgNode) { allocatedArguments[i] = static_cast<TType*>(newArgNode); } } } - return ::new(env.Allocate<TCallableType>()) TCallableType(Name, - newReturnTypeNode ? static_cast<TType*>(newReturnTypeNode) : ReturnType, - ArgumentsCount, allocatedArguments, newPayloadNode ? newPayloadNode : Payload, env); + return ::new(env.Allocate<TCallableType>()) TCallableType(Name_, + newReturnTypeNode ? static_cast<TType*>(newReturnTypeNode) : ReturnType_, + ArgumentsCount_, allocatedArguments, newPayloadNode ? newPayloadNode : Payload_, env); } void TCallableType::DoFreeze(const TTypeEnvironment& env) { @@ -1807,13 +1807,13 @@ void TCallableType::DoFreeze(const TTypeEnvironment& env) { TCallable::TCallable(ui32 inputsCount, TRuntimeNode* inputs, TCallableType* type, bool validate) : TNode(type) - , InputsCount(inputsCount) - , UniqueId(0) - , Inputs(inputs) + , InputsCount_(inputsCount) + , UniqueId_(0) + , Inputs_(inputs) { if (!validate) { for (size_t index = 0; index < inputsCount; ++index) { - auto& node = Inputs[index]; + auto& node = Inputs_[index]; node.Freeze(); } @@ -1823,7 +1823,7 @@ TCallable::TCallable(ui32 inputsCount, TRuntimeNode* inputs, TCallableType* type MKQL_ENSURE(inputsCount == type->GetArgumentsCount(), "Wrong count of inputs"); for (size_t index = 0; index < inputsCount; ++index) { - auto& node = Inputs[index]; + auto& node = Inputs_[index]; const auto argType = type->GetArgumentType(index); MKQL_ENSURE(node.GetStaticType()->IsSameType(*argType), "Wrong type of input"); @@ -1833,19 +1833,19 @@ TCallable::TCallable(ui32 inputsCount, TRuntimeNode* inputs, TCallableType* type TCallable::TCallable(TRuntimeNode result, TCallableType* type, bool validate) : TNode(type) - , InputsCount(0) - , UniqueId(0) - , Inputs(nullptr) - , Result(result) + , InputsCount_(0) + , UniqueId_(0) + , Inputs_(nullptr) + , Result_(result) { if (!validate) { - Result.Freeze(); + Result_.Freeze(); return; } MKQL_ENSURE(result.GetStaticType()->IsSameType(*type->GetReturnType()), "incorrect result type for callable: " << GetType()->GetName()); - Result.Freeze(); + Result_.Freeze(); } TCallable* TCallable::Create(ui32 inputsCount, const TRuntimeNode* inputs, TCallableType* type, const TTypeEnvironment& env) { @@ -1865,15 +1865,15 @@ TCallable* TCallable::Create(TRuntimeNode result, TCallableType* type, const TTy } void TCallable::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto typeIt = links.find(Type); + auto typeIt = links.find(Type_); if (typeIt != links.end()) { TNode* newNode = typeIt->second; - Y_DEBUG_ABORT_UNLESS(Type->Equals(*newNode)); - Type = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(Type_->Equals(*newNode)); + Type_ = static_cast<TType*>(newNode); } - for (ui32 i = 0; i < InputsCount; ++i) { - auto& input = Inputs[i]; + for (ui32 i = 0; i < InputsCount_; ++i) { + auto& input = Inputs_[i]; auto inputIt = links.find(input.GetNode()); if (inputIt != links.end()) { TNode* newNode = inputIt->second; @@ -1882,25 +1882,25 @@ void TCallable::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { } } - if (Result.GetNode()) { - auto resultIt = links.find(Result.GetNode()); + if (Result_.GetNode()) { + auto resultIt = links.find(Result_.GetNode()); if (resultIt != links.end()) { TNode* newNode = resultIt->second; - Y_DEBUG_ABORT_UNLESS(Result.GetNode()->Equals(*newNode)); - Result = TRuntimeNode(newNode, Result.IsImmediate()); + Y_DEBUG_ABORT_UNLESS(Result_.GetNode()->Equals(*newNode)); + Result_ = TRuntimeNode(newNode, Result_.IsImmediate()); } } } TNode* TCallable::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newTypeNode = (TNode*)Type->GetCookie(); - auto newResultNode = Result.GetNode() ? (TNode*)Result.GetNode()->GetCookie() : nullptr; + auto newTypeNode = (TNode*)Type_->GetCookie(); + auto newResultNode = Result_.GetNode() ? (TNode*)Result_.GetNode()->GetCookie() : nullptr; bool needClone = false; if (newTypeNode || newResultNode) { needClone = true; } else { - for (ui32 i = 0; i < InputsCount; ++i) { - if (Inputs[i].GetNode()->GetCookie()) { + for (ui32 i = 0; i < InputsCount_; ++i) { + if (Inputs_[i].GetNode()->GetCookie()) { needClone = true; break; } @@ -1911,26 +1911,26 @@ TNode* TCallable::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { return const_cast<TCallable*>(this); TRuntimeNode* allocatedInputs = nullptr; - if (!Result.GetNode()) { - if (InputsCount) { - allocatedInputs = static_cast<TRuntimeNode*>(env.AllocateBuffer(InputsCount * sizeof(*allocatedInputs))); - for (ui32 i = 0; i < InputsCount; ++i) { - allocatedInputs[i] = Inputs[i]; - auto newNode = (TNode*)Inputs[i].GetNode()->GetCookie(); + if (!Result_.GetNode()) { + if (InputsCount_) { + allocatedInputs = static_cast<TRuntimeNode*>(env.AllocateBuffer(InputsCount_ * sizeof(*allocatedInputs))); + for (ui32 i = 0; i < InputsCount_; ++i) { + allocatedInputs[i] = Inputs_[i]; + auto newNode = (TNode*)Inputs_[i].GetNode()->GetCookie(); if (newNode) { - allocatedInputs[i] = TRuntimeNode(newNode, Inputs[i].IsImmediate()); + allocatedInputs[i] = TRuntimeNode(newNode, Inputs_[i].IsImmediate()); } } } } TCallable* newCallable; - if (Result.GetNode()) { + if (Result_.GetNode()) { newCallable = ::new(env.Allocate<TCallable>()) TCallable( - newResultNode ? TRuntimeNode(newResultNode, Result.IsImmediate()) : Result, + newResultNode ? TRuntimeNode(newResultNode, Result_.IsImmediate()) : Result_, newTypeNode ? static_cast<TCallableType*>(newTypeNode) : GetType(), false); } else { - newCallable = ::new(env.Allocate<TCallable>()) TCallable(InputsCount, allocatedInputs, + newCallable = ::new(env.Allocate<TCallable>()) TCallable(InputsCount_, allocatedInputs, newTypeNode ? static_cast<TCallableType*>(newTypeNode) : GetType(), false); } @@ -1940,8 +1940,8 @@ TNode* TCallable::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { void TCallable::DoFreeze(const TTypeEnvironment& env) { Y_UNUSED(env); - for (ui32 i = 0; i < InputsCount; ++i) { - Inputs[i].Freeze(); + for (ui32 i = 0; i < InputsCount_; ++i) { + Inputs_[i].Freeze(); } } @@ -1949,18 +1949,18 @@ bool TCallable::Equals(const TCallable& nodeToCompare) const { if (GetType()->IsMergeDisabled() && (this != &nodeToCompare)) return false; - if (InputsCount != nodeToCompare.InputsCount) + if (InputsCount_ != nodeToCompare.InputsCount_) return false; - if (!Result.GetNode() != !nodeToCompare.Result.GetNode()) + if (!Result_.GetNode() != !nodeToCompare.Result_.GetNode()) return false; - for (size_t i = 0; i < InputsCount; ++i) { - if (Inputs[i] != nodeToCompare.Inputs[i]) + for (size_t i = 0; i < InputsCount_; ++i) { + if (Inputs_[i] != nodeToCompare.Inputs_[i]) return false; } - if (Result.GetNode() && Result != nodeToCompare.Result) + if (Result_.GetNode() && Result_ != nodeToCompare.Result_) return false; return true; @@ -1968,17 +1968,17 @@ bool TCallable::Equals(const TCallable& nodeToCompare) const { void TCallable::SetResult(TRuntimeNode result, const TTypeEnvironment& env) { Y_UNUSED(env); - MKQL_ENSURE(!Result.GetNode(), "result is already set"); + MKQL_ENSURE(!Result_.GetNode(), "result is already set"); MKQL_ENSURE(result.GetStaticType()->IsSameType(*GetType()->GetReturnType()), "incorrect result type of function " << GetType()->GetName() << ", left: " << PrintNode(result.GetStaticType(), true) << ", right: " << PrintNode(GetType()->GetReturnType(), true)); - Result = result; - InputsCount = 0; - Inputs = nullptr; - Result.Freeze(); + Result_ = result; + InputsCount_ = 0; + Inputs_ = nullptr; + Result_.Freeze(); } TCallablePayload::TCallablePayload(NMiniKQL::TNode* node) @@ -2078,61 +2078,61 @@ TAny* TAny::Create(const TTypeEnvironment& env) { } void TAny::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - if (Item.GetNode()) { - auto itemIt = links.find(Item.GetNode()); + if (Item_.GetNode()) { + auto itemIt = links.find(Item_.GetNode()); if (itemIt != links.end()) { TNode* newNode = itemIt->second; - Y_DEBUG_ABORT_UNLESS(Item.GetNode()->Equals(*newNode)); - Item = TRuntimeNode(newNode, Item.IsImmediate()); + Y_DEBUG_ABORT_UNLESS(Item_.GetNode()->Equals(*newNode)); + Item_ = TRuntimeNode(newNode, Item_.IsImmediate()); } } } TNode* TAny::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - if (!Item.GetNode()) + if (!Item_.GetNode()) return const_cast<TAny*>(this); - auto newItemNode = (TNode*)Item.GetNode()->GetCookie(); + auto newItemNode = (TNode*)Item_.GetNode()->GetCookie(); if (!newItemNode) { return const_cast<TAny*>(this); } auto any = TAny::Create(env); - any->SetItem(TRuntimeNode(newItemNode, Item.IsImmediate())); + any->SetItem(TRuntimeNode(newItemNode, Item_.IsImmediate())); return any; } void TAny::DoFreeze(const TTypeEnvironment& env) { Y_UNUSED(env); - if (Item.GetNode()) { - Item.Freeze(); + if (Item_.GetNode()) { + Item_.Freeze(); } } void TAny::SetItem(TRuntimeNode newItem) { - MKQL_ENSURE(!Item.GetNode(), "item is already set"); + MKQL_ENSURE(!Item_.GetNode(), "item is already set"); - Item = newItem; - Item.Freeze(); + Item_ = newItem; + Item_.Freeze(); } bool TAny::Equals(const TAny& nodeToCompare) const { - if (!Item.GetNode() || !nodeToCompare.Item.GetNode()) + if (!Item_.GetNode() || !nodeToCompare.Item_.GetNode()) return false; - if (!Item.IsImmediate() != !nodeToCompare.Item.IsImmediate()) + if (!Item_.IsImmediate() != !nodeToCompare.Item_.IsImmediate()) return false; - return Item.GetNode()->Equals(*nodeToCompare.Item.GetNode()); + return Item_.GetNode()->Equals(*nodeToCompare.Item_.GetNode()); } TTupleLiteral::TTupleLiteral(TRuntimeNode* values, TTupleType* type, bool validate) : TNode(type) - , Values(values) + , Values_(values) { if (!validate) { for (size_t index = 0; index < GetValuesCount(); ++index) { - auto& value = Values[index]; + auto& value = Values_[index]; value.Freeze(); } @@ -2140,7 +2140,7 @@ TTupleLiteral::TTupleLiteral(TRuntimeNode* values, TTupleType* type, bool valida } for (size_t index = 0; index < GetValuesCount(); ++index) { - auto& value = Values[index]; + auto& value = Values_[index]; MKQL_ENSURE(value.GetStaticType()->IsSameType(*type->GetElementType(index)), "Wrong type of element"); value.Freeze(); @@ -2163,15 +2163,15 @@ TTupleLiteral* TTupleLiteral::Create(ui32 valuesCount, const TRuntimeNode* value } void TTupleLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto typeIt = links.find(Type); + auto typeIt = links.find(Type_); if (typeIt != links.end()) { TNode* newNode = typeIt->second; - Y_DEBUG_ABORT_UNLESS(Type->Equals(*newNode)); - Type = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(Type_->Equals(*newNode)); + Type_ = static_cast<TType*>(newNode); } for (ui32 i = 0; i < GetValuesCount(); ++i) { - auto& value = Values[i]; + auto& value = Values_[i]; auto valueIt = links.find(value.GetNode()); if (valueIt != links.end()) { TNode* newNode = valueIt->second; @@ -2182,13 +2182,13 @@ void TTupleLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { } TNode* TTupleLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newTypeNode = (TNode*)Type->GetCookie(); + auto newTypeNode = (TNode*)Type_->GetCookie(); bool needClone = false; if (newTypeNode) { needClone = true; } else { for (ui32 i = 0; i < GetValuesCount(); ++i) { - if (Values[i].GetNode()->GetCookie()) { + if (Values_[i].GetNode()->GetCookie()) { needClone = true; break; } @@ -2202,10 +2202,10 @@ TNode* TTupleLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const if (GetValuesCount()) { allocatedValues = static_cast<TRuntimeNode*>(env.AllocateBuffer(GetValuesCount() * sizeof(*allocatedValues))); for (ui32 i = 0; i < GetValuesCount(); ++i) { - allocatedValues[i] = Values[i]; - auto newNode = (TNode*)Values[i].GetNode()->GetCookie(); + allocatedValues[i] = Values_[i]; + auto newNode = (TNode*)Values_[i].GetNode()->GetCookie(); if (newNode) { - allocatedValues[i] = TRuntimeNode(newNode, Values[i].IsImmediate()); + allocatedValues[i] = TRuntimeNode(newNode, Values_[i].IsImmediate()); } } } @@ -2217,7 +2217,7 @@ TNode* TTupleLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const void TTupleLiteral::DoFreeze(const TTypeEnvironment& env) { Y_UNUSED(env); for (ui32 i = 0; i < GetValuesCount(); ++i) { - Values[i].Freeze(); + Values_[i].Freeze(); } } @@ -2226,7 +2226,7 @@ bool TTupleLiteral::Equals(const TTupleLiteral& nodeToCompare) const { return false; for (size_t i = 0; i < GetValuesCount(); ++i) { - if (Values[i] != nodeToCompare.Values[i]) + if (Values_[i] != nodeToCompare.Values_[i]) return false; } @@ -2234,11 +2234,11 @@ bool TTupleLiteral::Equals(const TTupleLiteral& nodeToCompare) const { } bool TResourceType::IsSameType(const TResourceType& typeToCompare) const { - return Tag == typeToCompare.Tag; + return Tag_ == typeToCompare.Tag_; } size_t TResourceType::CalcHash() const { - return Tag.Hash(); + return Tag_.Hash(); } bool TResourceType::IsConvertableTo(const TResourceType& typeToCompare, bool ignoreTagged) const { @@ -2272,7 +2272,7 @@ bool TVariantType::IsSameType(const TVariantType& typeToCompare) const { } size_t TVariantType::CalcHash() const { - return Data->CalcHash(); + return Data_->CalcHash(); } bool TVariantType::IsConvertableTo(const TVariantType& typeToCompare, bool ignoreTagged) const { @@ -2281,7 +2281,7 @@ bool TVariantType::IsConvertableTo(const TVariantType& typeToCompare, bool ignor TVariantType::TVariantType(TType* underlyingType, const TTypeEnvironment& env, bool validate) : TType(EKind::Variant, env.GetTypeOfTypeLazy(), underlyingType->IsPresortSupported()) - , Data(underlyingType) + , Data_(underlyingType) { if (validate) { MKQL_ENSURE(underlyingType->IsTuple() || underlyingType->IsStruct(), @@ -2300,7 +2300,7 @@ void TVariantType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; Y_DEBUG_ABORT_UNLESS(GetUnderlyingType()->Equals(*newNode)); - Data = static_cast<TType*>(newNode); + Data_ = static_cast<TType*>(newNode); } } @@ -2323,10 +2323,10 @@ TVariantLiteral* TVariantLiteral::Create(TRuntimeNode item, ui32 index, TVariant TVariantLiteral::TVariantLiteral(TRuntimeNode item, ui32 index, TVariantType* type, bool validate) : TNode(type) - , Item(item) - , Index(index) + , Item_(item) + , Index_(index) { - Item.Freeze(); + Item_.Freeze(); if (validate) { MKQL_ENSURE(index < type->GetAlternativesCount(), "Index out of range: " << index << " alt. count: " << type->GetAlternativesCount()); @@ -2334,59 +2334,59 @@ TVariantLiteral::TVariantLiteral(TRuntimeNode item, ui32 index, TVariantType* ty auto underlyingType = type->GetUnderlyingType(); if (underlyingType->IsTuple()) { auto expectedType = AS_TYPE(TTupleType, underlyingType)->GetElementType(index); - MKQL_ENSURE(Item.GetStaticType()->IsSameType(*expectedType), "Wrong type of item"); + MKQL_ENSURE(Item_.GetStaticType()->IsSameType(*expectedType), "Wrong type of item"); } else { auto expectedType = AS_TYPE(TStructType, underlyingType)->GetMemberType(index); - MKQL_ENSURE(Item.GetStaticType()->IsSameType(*expectedType), "Wrong type of item"); + MKQL_ENSURE(Item_.GetStaticType()->IsSameType(*expectedType), "Wrong type of item"); } } } bool TVariantLiteral::Equals(const TVariantLiteral& nodeToCompare) const { - if (Index != nodeToCompare.GetIndex()) { + if (Index_ != nodeToCompare.GetIndex()) { return false; } - return Item.GetNode()->Equals(*nodeToCompare.GetItem().GetNode()); + return Item_.GetNode()->Equals(*nodeToCompare.GetItem().GetNode()); } void TVariantLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - auto typeIt = links.find(Type); + auto typeIt = links.find(Type_); if (typeIt != links.end()) { TNode* newNode = typeIt->second; - Y_DEBUG_ABORT_UNLESS(Type->Equals(*newNode)); - Type = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(Type_->Equals(*newNode)); + Type_ = static_cast<TType*>(newNode); } - auto itemIt = links.find(Item.GetNode()); + auto itemIt = links.find(Item_.GetNode()); if (itemIt != links.end()) { TNode* newNode = itemIt->second; - Y_DEBUG_ABORT_UNLESS(Item.GetNode()->Equals(*newNode)); - Item = TRuntimeNode(newNode, Item.IsImmediate()); + Y_DEBUG_ABORT_UNLESS(Item_.GetNode()->Equals(*newNode)); + Item_ = TRuntimeNode(newNode, Item_.IsImmediate()); } } TNode* TVariantLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newTypeNode = (TNode*)Type->GetCookie(); - auto newItemNode = (TNode*)Item.GetNode()->GetCookie(); + auto newTypeNode = (TNode*)Type_->GetCookie(); + auto newItemNode = (TNode*)Item_.GetNode()->GetCookie(); if (!newTypeNode && !newItemNode) { return const_cast<TVariantLiteral*>(this); } return ::new(env.Allocate<TVariantLiteral>()) TVariantLiteral( - newItemNode ? TRuntimeNode(newItemNode, Item.IsImmediate()) : Item, Index, + newItemNode ? TRuntimeNode(newItemNode, Item_.IsImmediate()) : Item_, Index_, newTypeNode ? static_cast<TVariantType*>(newTypeNode) : GetType(), false); } void TVariantLiteral::DoFreeze(const TTypeEnvironment& env) { Y_UNUSED(env); - Item.Freeze(); + Item_.Freeze(); } TBlockType::TBlockType(TType* itemType, EShape shape, const TTypeEnvironment& env) : TType(EKind::Block, env.GetTypeOfTypeLazy(), false) - , ItemType(itemType) - , Shape(shape) + , ItemType_(itemType) + , Shape_(shape) { } @@ -2395,34 +2395,34 @@ TBlockType* TBlockType::Create(TType* itemType, EShape shape, const TTypeEnviron } bool TBlockType::IsSameType(const TBlockType& typeToCompare) const { - return GetItemType()->IsSameType(*typeToCompare.GetItemType()) && Shape == typeToCompare.Shape; + return GetItemType()->IsSameType(*typeToCompare.GetItemType()) && Shape_ == typeToCompare.Shape_; } size_t TBlockType::CalcHash() const { - return CombineHashes(ItemType->CalcHash(), IntHash((size_t)Shape)); + return CombineHashes(ItemType_->CalcHash(), IntHash((size_t)Shape_)); } bool TBlockType::IsConvertableTo(const TBlockType& typeToCompare, bool ignoreTagged) const { - return Shape == typeToCompare.Shape && + return Shape_ == typeToCompare.Shape_ && GetItemType()->IsConvertableTo(*typeToCompare.GetItemType(), ignoreTagged); } void TBlockType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - const auto itemTypeIt = links.find(ItemType); + const auto itemTypeIt = links.find(ItemType_); if (itemTypeIt != links.end()) { auto* newNode = itemTypeIt->second; - Y_DEBUG_ABORT_UNLESS(ItemType->Equals(*newNode)); - ItemType = static_cast<TType*>(newNode); + Y_DEBUG_ABORT_UNLESS(ItemType_->Equals(*newNode)); + ItemType_ = static_cast<TType*>(newNode); } } TNode* TBlockType::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { - auto newTypeNode = (TNode*)ItemType->GetCookie(); + auto newTypeNode = (TNode*)ItemType_->GetCookie(); if (!newTypeNode) { return const_cast<TBlockType*>(this); } - return ::new(env.Allocate<TBlockType>()) TBlockType(static_cast<TType*>(newTypeNode), Shape, env); + return ::new(env.Allocate<TBlockType>()) TBlockType(static_cast<TType*>(newTypeNode), Shape_, env); } void TBlockType::DoFreeze(const TTypeEnvironment& env) { diff --git a/yql/essentials/minikql/mkql_node.h b/yql/essentials/minikql/mkql_node.h index ab87008f247..abe346c98a6 100644 --- a/yql/essentials/minikql/mkql_node.h +++ b/yql/essentials/minikql/mkql_node.h @@ -26,19 +26,19 @@ public: TTaggedPointer() {} TTaggedPointer(T* ptr, bool mark) { Y_DEBUG_ABORT_UNLESS((uintptr_t(ptr) & 1) == 0); - Raw = (void*)(uintptr_t(ptr) | (mark ? 1 : 0)); + Raw_ = (void*)(uintptr_t(ptr) | (mark ? 1 : 0)); } T* GetPtr() const { - return (T*)(uintptr_t(Raw) & ~uintptr_t(1)); + return (T*)(uintptr_t(Raw_) & ~uintptr_t(1)); } bool GetMark() const { - return (uintptr_t(Raw) & 1) != 0; + return (uintptr_t(Raw_) & 1) != 0; } private: - void* Raw; + void* Raw_; }; struct TRuntimeNode { @@ -90,20 +90,20 @@ class TNode : private TNonCopyable { friend class TTypeEnvironment; public: TType* GetType() const { - return Type; + return Type_; } TType* GetGenericType() const { - return Type; + return Type_; } // may be used only as temporary storage, should be zero before visitation ui64 GetCookie() const { - return Cookie; + return Cookie_; } void SetCookie(ui64 cookie) { - Cookie = cookie; + Cookie_ = cookie; } void Accept(INodeVisitor& visitor); @@ -116,12 +116,12 @@ public: protected: TNode(TType* type) - : Type(type) - , Cookie(0) + : Type_(type) + , Cookie_(0) {} - TType* Type; - ui64 Cookie; + TType* Type_; + ui64 Cookie_; }; class TTypeType; @@ -166,9 +166,9 @@ public: size_t CalcHash() const; TTypeBase(const TTypeBase& other) - : TNode(other.Type) + : TNode(other.Type_) , Kind(other.Kind) - , SupportsPresort(other.SupportsPresort) + , SupportsPresort_(other.SupportsPresort_) {} protected: @@ -176,11 +176,11 @@ protected: TTypeBase() : TNode(nullptr) , Kind(EKind::Type) - , SupportsPresort(false) + , SupportsPresort_(false) {} const EKind Kind; - const bool SupportsPresort; + const bool SupportsPresort_; }; class TType: public TTypeBase { @@ -212,7 +212,7 @@ public: TNode* CloneOnCallableWrite(const TTypeEnvironment& env) const; void Freeze(const TTypeEnvironment& env); bool IsPresortSupported() const { - return SupportsPresort; + return SupportsPresort_; } }; @@ -322,31 +322,31 @@ public: {} TInternName(const TInternName& other) - : StrBuf(other.StrBuf) + : StrBuf_(other.StrBuf_) {} const TInternName& operator = (const TInternName& other) { - StrBuf = other.StrBuf; + StrBuf_ = other.StrBuf_; return *this; } size_t Hash() const { - return (size_t)StrBuf.data(); + return (size_t)StrBuf_.data(); } operator bool() const { - return (bool)StrBuf; + return (bool)StrBuf_; } const TStringBuf& Str() const { - return StrBuf; + return StrBuf_; } // Optimized comparison (only by pointer) bool operator == (const TInternName& other) const { - Y_DEBUG_ABORT_UNLESS(StrBuf.data() != other.StrBuf.data() || StrBuf.size() == other.StrBuf.size(), + Y_DEBUG_ABORT_UNLESS(StrBuf_.data() != other.StrBuf_.data() || StrBuf_.size() == other.StrBuf_.size(), "Lengths must be equal if pointers are equal"); - return StrBuf.data() == other.StrBuf.data(); + return StrBuf_.data() == other.StrBuf_.data(); } bool operator != (const TInternName& other) const { @@ -355,7 +355,7 @@ public: // Regular comparison (by content) bool operator == (const TStringBuf& other) const { - return StrBuf == other; + return StrBuf_ == other; } bool operator != (const TStringBuf& other) const { @@ -366,11 +366,11 @@ private: friend class TTypeEnvironment; explicit TInternName(const TStringBuf& strBuf) - : StrBuf(strBuf) + : StrBuf_(strBuf) {} private: - TStringBuf StrBuf; + TStringBuf StrBuf_; }; }} // namespaces @@ -393,11 +393,11 @@ public: template <typename T> T* Allocate() const { - return (T*)Arena.Alloc(sizeof(T)); + return (T*)Arena_.Alloc(sizeof(T)); } void* AllocateBuffer(ui64 size) const { - return Arena.Alloc(size); + return Arena_.Alloc(size); } TInternName InternName(const TStringBuf& name) const; @@ -424,8 +424,8 @@ public: NUdf::TUnboxedValuePod NewStringValue(const NUdf::TStringRef& data) const { Y_DEBUG_ABORT_UNLESS(TlsAllocState); - Y_DEBUG_ABORT_UNLESS(&Alloc.Ref() == TlsAllocState, "%s", (TStringBuilder() - << "typeEnv's: " << Alloc.Ref().GetDebugInfo() << " Tls: " << TlsAllocState->GetDebugInfo() + Y_DEBUG_ABORT_UNLESS(&Alloc_.Ref() == TlsAllocState, "%s", (TStringBuilder() + << "typeEnv's: " << Alloc_.Ref().GetDebugInfo() << " Tls: " << TlsAllocState->GetDebugInfo() ).data()); if (data.Size() > NUdf::TUnboxedValue::InternalBufferSize) { auto value = NewString(data.Size()); @@ -437,42 +437,42 @@ public: } TGuard<TScopedAlloc> BindAllocator() const { - return Guard(Alloc); + return Guard(Alloc_); } - TScopedAlloc& GetAllocator() const { return Alloc; } + TScopedAlloc& GetAllocator() const { return Alloc_; } const NUdf::TStringValue& NewString(ui32 size) const { Y_DEBUG_ABORT_UNLESS(TlsAllocState); - Y_DEBUG_ABORT_UNLESS(&Alloc.Ref() == TlsAllocState, "%s", (TStringBuilder() - << "typeEnv's: " << Alloc.Ref().GetDebugInfo() << " Tls: " << TlsAllocState->GetDebugInfo() + Y_DEBUG_ABORT_UNLESS(&Alloc_.Ref() == TlsAllocState, "%s", (TStringBuilder() + << "typeEnv's: " << Alloc_.Ref().GetDebugInfo() << " Tls: " << TlsAllocState->GetDebugInfo() ).data()); - Strings.emplace(size); - return Strings.top(); + Strings_.emplace(size); + return Strings_.top(); } private: - TScopedAlloc& Alloc; - mutable TPagedArena Arena; - mutable std::stack<NUdf::TStringValue> Strings; - mutable THashSet<TStringBuf> NamesPool; - mutable std::vector<TNode*> Stack; - - mutable TTypeType* TypeOfType = nullptr; - mutable TVoidType* TypeOfVoid = nullptr; - mutable TVoid* Void = nullptr; - mutable TNullType* TypeOfNull = nullptr; - mutable TNull* Null = nullptr; - mutable TEmptyListType* TypeOfEmptyList = nullptr; - mutable TEmptyList* EmptyList = nullptr; - mutable TEmptyDictType* TypeOfEmptyDict = nullptr; - mutable TEmptyDict* EmptyDict = nullptr; - mutable TDataType* Ui32 = nullptr; - mutable TDataType* Ui64 = nullptr; - mutable TAnyType* AnyType = nullptr; - mutable TStructLiteral* EmptyStruct = nullptr; - mutable TTupleLiteral* EmptyTuple = nullptr; - mutable TListLiteral* ListOfVoid = nullptr; + TScopedAlloc& Alloc_; + mutable TPagedArena Arena_; + mutable std::stack<NUdf::TStringValue> Strings_; + mutable THashSet<TStringBuf> NamesPool_; + mutable std::vector<TNode*> Stack_; + + mutable TTypeType* TypeOfType_ = nullptr; + mutable TVoidType* TypeOfVoid_ = nullptr; + mutable TVoid* Void_ = nullptr; + mutable TNullType* TypeOfNull_ = nullptr; + mutable TNull* Null_ = nullptr; + mutable TEmptyListType* TypeOfEmptyList_ = nullptr; + mutable TEmptyList* EmptyList_ = nullptr; + mutable TEmptyDictType* TypeOfEmptyDict_ = nullptr; + mutable TEmptyDict* EmptyDict_ = nullptr; + mutable TDataType* Ui32_ = nullptr; + mutable TDataType* Ui64_ = nullptr; + mutable TAnyType* AnyType_ = nullptr; + mutable TStructLiteral* EmptyStruct_ = nullptr; + mutable TTupleLiteral* EmptyTuple_ = nullptr; + mutable TListLiteral* ListOfVoid_ = nullptr; }; template <> @@ -513,11 +513,11 @@ public: bool IsConvertableTo(const TDataType& typeToCompare, bool ignoreTagged = false) const; NUdf::TDataTypeId GetSchemeType() const { - return SchemeType; + return SchemeType_; } TMaybe<NUdf::EDataSlot> GetDataSlot() const { - return DataSlot; + return DataSlot_; } protected: @@ -528,8 +528,8 @@ protected: void DoFreeze(const TTypeEnvironment& env); private: - const NUdf::TDataTypeId SchemeType; - const TMaybe<NUdf::EDataSlot> DataSlot; + const NUdf::TDataTypeId SchemeType_; + const TMaybe<NUdf::EDataSlot> DataSlot_; }; class TDataDecimalType : public TDataType { @@ -546,8 +546,8 @@ public: private: TDataDecimalType(ui8 precision, ui8 scale, const TTypeEnvironment& env); - const ui8 Precision; - const ui8 Scale; + const ui8 Precision_; + const ui8 Scale_; }; class TDataLiteral : public TNode, private NUdf::TUnboxedValuePod { @@ -586,7 +586,7 @@ public: bool IsConvertableTo(const TPgType& typeToCompare, bool ignoreTagged = false) const; ui32 GetTypeId() const { - return TypeId; + return TypeId_; } const TString& GetName() const; @@ -599,7 +599,7 @@ protected: void DoFreeze(const TTypeEnvironment& env); private: - const ui32 TypeId; + const ui32 TypeId_; }; struct TStructMember { @@ -639,22 +639,22 @@ public: bool IsConvertableTo(const TStructType& typeToCompare, bool ignoreTagged = false) const; ui32 GetMembersCount() const { - return MembersCount; + return MembersCount_; } TStringBuf GetMemberName(ui32 index) const { - Y_DEBUG_ABORT_UNLESS(index < MembersCount); - return Members[index].first.Str(); + Y_DEBUG_ABORT_UNLESS(index < MembersCount_); + return Members_[index].first.Str(); } TInternName GetMemberNameStr(ui32 index) const { - Y_DEBUG_ABORT_UNLESS(index < MembersCount); - return Members[index].first; + Y_DEBUG_ABORT_UNLESS(index < MembersCount_); + return Members_[index].first; } TType* GetMemberType(ui32 index) const { - Y_DEBUG_ABORT_UNLESS(index < MembersCount); - return Members[index].second; + Y_DEBUG_ABORT_UNLESS(index < MembersCount_); + return Members_[index].second; } ui32 GetMemberIndex(const TStringBuf& name) const; @@ -669,8 +669,8 @@ private: static bool CalculatePresortSupport(ui32 membersCount, std::pair<TInternName, TType*>* members); private: - ui32 MembersCount; - std::pair<TInternName, TType*>* Members; + ui32 MembersCount_; + std::pair<TInternName, TType*>* Members_; }; class TStructLiteral : public TNode { @@ -689,7 +689,7 @@ public: TRuntimeNode GetValue(ui32 index) const { Y_DEBUG_ABORT_UNLESS(index < GetValuesCount()); - return Values[index]; + return Values_[index]; } private: @@ -702,7 +702,7 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TRuntimeNode* Values; + TRuntimeNode* Values_; }; class TListType : public TType { @@ -718,11 +718,11 @@ public: bool IsConvertableTo(const TListType& typeToCompare, bool ignoreTagged = false) const; TType* GetItemType() const { - return Data; + return Data_; } TDataType* IndexDictKeyType() const { - return IndexDictKey; + return IndexDictKey_; } private: @@ -733,8 +733,8 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TType* Data; - TDataType* IndexDictKey; + TType* Data_; + TDataType* IndexDictKey_; }; class TListLiteral : public TNode { @@ -746,11 +746,11 @@ public: } ui32 GetItemsCount() const { - return Count; + return Count_; } TRuntimeNode* GetItems() const { - return Items; + return Items_; } private: @@ -764,8 +764,8 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TRuntimeNode* Items; - ui32 Count; + TRuntimeNode* Items_; + ui32 Count_; }; class TStreamType : public TType { @@ -781,7 +781,7 @@ public: bool IsConvertableTo(const TStreamType& typeToCompare, bool ignoreTagged = false) const; TType* GetItemType() const { - return Data; + return Data_; } private: @@ -792,7 +792,7 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TType* Data; + TType* Data_; }; class TFlowType : public TType { @@ -808,7 +808,7 @@ public: bool IsConvertableTo(const TFlowType& typeToCompare, bool ignoreTagged = false) const; TType* GetItemType() const { - return Data; + return Data_; } private: @@ -819,7 +819,7 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TType* Data; + TType* Data_; }; class TOptionalType : public TType { @@ -835,7 +835,7 @@ public: bool IsConvertableTo(const TOptionalType& typeToCompare, bool ignoreTagged = false) const; TType* GetItemType() const { - return Data; + return Data_; } private: @@ -846,7 +846,7 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TType* Data; + TType* Data_; }; class TOptionalLiteral : public TNode { @@ -860,12 +860,12 @@ public: } bool HasItem() const { - return !!Item.GetNode(); + return !!Item_.GetNode(); } TRuntimeNode GetItem() const { - Y_DEBUG_ABORT_UNLESS(Item.GetNode()); - return Item; + Y_DEBUG_ABORT_UNLESS(Item_.GetNode()); + return Item_; } private: @@ -879,7 +879,7 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TRuntimeNode Item; + TRuntimeNode Item_; }; class TDictType : public TType { @@ -895,11 +895,11 @@ public: bool IsConvertableTo(const TDictType& typeToCompare, bool ignoreTagged = false) const; TType* GetKeyType() const { - return KeyType; + return KeyType_; } TType* GetPayloadType() const { - return PayloadType; + return PayloadType_; } static void EnsureValidDictKey(TType* keyType); @@ -912,8 +912,8 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TType* KeyType; - TType* PayloadType; + TType* KeyType_; + TType* PayloadType_; }; class TDictLiteral : public TNode { @@ -925,12 +925,12 @@ public: } ui32 GetItemsCount() const { - return ItemsCount; + return ItemsCount_; } std::pair<TRuntimeNode, TRuntimeNode> GetItem(ui32 index) const { - Y_DEBUG_ABORT_UNLESS(index < ItemsCount); - return Items[index]; + Y_DEBUG_ABORT_UNLESS(index < ItemsCount_); + return Items_[index]; } private: @@ -943,8 +943,8 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - ui32 ItemsCount; - std::pair<TRuntimeNode, TRuntimeNode>* Items; + ui32 ItemsCount_; + std::pair<TRuntimeNode, TRuntimeNode>* Items_; }; class TCallableType : public TType { @@ -956,7 +956,7 @@ public: TType** arguments, TNode* payload, const TTypeEnvironment& env); void SetOptionalArgumentsCount(ui32 count); ui32 GetOptionalArgumentsCount() const { - return OptionalArgs; + return OptionalArgs_; } using TType::IsSameType; @@ -967,36 +967,36 @@ public: bool IsConvertableTo(const TCallableType& typeToCompare, bool ignoreTagged = false) const; TStringBuf GetName() const { - return Name.Str(); + return Name_.Str(); } TInternName GetNameStr() const { - return Name; + return Name_; } TType* GetReturnType() const { - return ReturnType; + return ReturnType_; } ui32 GetArgumentsCount() const { - return ArgumentsCount; + return ArgumentsCount_; } TType* GetArgumentType(ui32 index) const { - Y_DEBUG_ABORT_UNLESS(index < ArgumentsCount); - return Arguments[index]; + Y_DEBUG_ABORT_UNLESS(index < ArgumentsCount_); + return Arguments_[index]; } void DisableMerge() { - IsMergeDisabled0 = true; + IsMergeDisabled0_ = true; } bool IsMergeDisabled() const { - return IsMergeDisabled0; + return IsMergeDisabled0_; } TNode* GetPayload() const { - return Payload; + return Payload_; } private: @@ -1008,13 +1008,13 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - bool IsMergeDisabled0; - ui32 ArgumentsCount; - TInternName Name; - TType* ReturnType; - TType** Arguments; - TNode* Payload; - ui32 OptionalArgs; + bool IsMergeDisabled0_; + ui32 ArgumentsCount_; + TInternName Name_; + TType* ReturnType_; + TType** Arguments_; + TNode* Payload_; + ui32 OptionalArgs_; }; class TCallablePayload : public NUdf::ICallablePayload { @@ -1049,30 +1049,30 @@ public: } ui32 GetInputsCount() const { - return InputsCount; + return InputsCount_; } TRuntimeNode GetInput(ui32 index) const { - Y_DEBUG_ABORT_UNLESS(index < InputsCount); - return Inputs[index]; + Y_DEBUG_ABORT_UNLESS(index < InputsCount_); + return Inputs_[index]; } bool HasResult() const { - return !!Result.GetNode(); + return !!Result_.GetNode(); } TRuntimeNode GetResult() const { - Y_DEBUG_ABORT_UNLESS(!!Result.GetNode()); - return Result; + Y_DEBUG_ABORT_UNLESS(!!Result_.GetNode()); + return Result_; } void SetResult(TRuntimeNode result, const TTypeEnvironment& env); ui32 GetUniqueId() const { - return UniqueId; + return UniqueId_; } void SetUniqueId(ui32 uniqueId) { - UniqueId = uniqueId; + UniqueId_ = uniqueId; } private: @@ -1086,16 +1086,16 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - ui32 InputsCount; - ui32 UniqueId; - TRuntimeNode* Inputs; - TRuntimeNode Result; + ui32 InputsCount_; + ui32 UniqueId_; + TRuntimeNode* Inputs_; + TRuntimeNode Result_; }; inline TTypeBase::TTypeBase(EKind kind, TTypeType* type, bool supportsPresort) : TNode(type) , Kind(kind) - , SupportsPresort(supportsPresort) + , SupportsPresort_(supportsPresort) { Y_DEBUG_ABORT_UNLESS(kind != EKind::Type); } @@ -1146,12 +1146,12 @@ public: } bool HasItem() const { - return !!Item.GetNode(); + return !!Item_.GetNode(); } TRuntimeNode GetItem() const { - Y_DEBUG_ABORT_UNLESS(Item.GetNode()); - return Item; + Y_DEBUG_ABORT_UNLESS(Item_.GetNode()); + return Item_; } void SetItem(TRuntimeNode newItem); @@ -1167,7 +1167,7 @@ private: TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); private: - TRuntimeNode Item; + TRuntimeNode Item_; }; template<typename TDerived, TType::EKind DerivedKind> @@ -1193,12 +1193,12 @@ public: return true; } - if (ElementsCount != typeToCompare.ElementsCount) { + if (ElementsCount_ != typeToCompare.ElementsCount_) { return false; } - for (size_t index = 0; index < ElementsCount; ++index) { - if (!Elements[index]->IsSameType(*typeToCompare.Elements[index])) { + for (size_t index = 0; index < ElementsCount_; ++index) { + if (!Elements_[index]->IsSameType(*typeToCompare.Elements_[index])) { return false; } } @@ -1208,8 +1208,8 @@ public: size_t CalcHash() const { size_t hash = 0; - for (size_t index = 0; index < ElementsCount; ++index) { - hash = CombineHashes(hash, Elements[index]->CalcHash()); + for (size_t index = 0; index < ElementsCount_; ++index) { + hash = CombineHashes(hash, Elements_[index]->CalcHash()); } return hash; } @@ -1220,12 +1220,12 @@ public: return true; } - if (ElementsCount != typeToCompare.GetElementsCount()) { + if (ElementsCount_ != typeToCompare.GetElementsCount()) { return false; } - for (size_t index = 0; index < ElementsCount; ++index) { - if (!Elements[index]->IsConvertableTo(*typeToCompare.GetElementType(index), ignoreTagged)) { + for (size_t index = 0; index < ElementsCount_; ++index) { + if (!Elements_[index]->IsConvertableTo(*typeToCompare.GetElementType(index), ignoreTagged)) { return false; } } @@ -1234,30 +1234,30 @@ public: } ui32 GetElementsCount() const { - return ElementsCount; + return ElementsCount_; } TType* GetElementType(ui32 index) const { - Y_DEBUG_ABORT_UNLESS(index < ElementsCount); - return Elements[index]; + Y_DEBUG_ABORT_UNLESS(index < ElementsCount_); + return Elements_[index]; } TArrayRef<TType* const> GetElements() const { - return TArrayRef<TType* const>(Elements, ElementsCount); + return TArrayRef<TType* const>(Elements_, ElementsCount_); } protected: TTupleLikeType(ui32 elementsCount, TType** elements, const TTypeEnvironment& env) : TType(DerivedKind, env.GetTypeOfTypeLazy(), CalculatePresortSupport(elementsCount, elements)) - , ElementsCount(elementsCount) - , Elements(elements) + , ElementsCount_(elementsCount) + , Elements_(elements) { } private: void DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { - for (ui32 i = 0; i < ElementsCount; ++i) { - auto &element = Elements[i]; + for (ui32 i = 0; i < ElementsCount_; ++i) { + auto &element = Elements_[i]; auto elementIt = links.find(element); if (elementIt != links.end()) { TNode* newNode = elementIt->second; @@ -1269,8 +1269,8 @@ private: TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const { bool needClone = false; - for (ui32 i = 0; i < ElementsCount; ++i) { - if (Elements[i]->GetCookie()) { + for (ui32 i = 0; i < ElementsCount_; ++i) { + if (Elements_[i]->GetCookie()) { needClone = true; break; } @@ -1281,18 +1281,18 @@ private: } TType** allocatedElements = nullptr; - if (ElementsCount) { - allocatedElements = static_cast<TType**>(env.AllocateBuffer(ElementsCount * sizeof(*allocatedElements))); - for (ui32 i = 0; i < ElementsCount; ++i) { - allocatedElements[i] = Elements[i]; - auto newNode = (TNode *)Elements[i]->GetCookie(); + if (ElementsCount_) { + allocatedElements = static_cast<TType**>(env.AllocateBuffer(ElementsCount_ * sizeof(*allocatedElements))); + for (ui32 i = 0; i < ElementsCount_; ++i) { + allocatedElements[i] = Elements_[i]; + auto newNode = (TNode *)Elements_[i]->GetCookie(); if (newNode) { allocatedElements[i] = static_cast<TType*>(newNode); } } } - return ::new (env.Allocate<TDerived>()) TDerived(ElementsCount, allocatedElements, env); + return ::new (env.Allocate<TDerived>()) TDerived(ElementsCount_, allocatedElements, env); } void DoFreeze(const TTypeEnvironment& env) { @@ -1309,8 +1309,8 @@ private: } private: - ui32 ElementsCount; - TType** Elements; + ui32 ElementsCount_; + TType** Elements_; }; class TTupleType : public TTupleLikeType<TTupleType, TType::EKind::Tuple> { @@ -1354,7 +1354,7 @@ public: TRuntimeNode GetValue(ui32 index) const { Y_DEBUG_ABORT_UNLESS(index < GetValuesCount()); - return Values[index]; + return Values_[index]; } private: @@ -1367,7 +1367,7 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TRuntimeNode* Values; + TRuntimeNode* Values_; }; class TResourceType : public TType { @@ -1382,11 +1382,11 @@ public: bool IsConvertableTo(const TResourceType& typeToCompare, bool ignoreTagged = false) const; TStringBuf GetTag() const { - return Tag.Str(); + return Tag_.Str(); } TInternName GetTagStr() const { - return Tag; + return Tag_; } static TResourceType* Create(const TStringBuf& tag, const TTypeEnvironment& env); @@ -1394,7 +1394,7 @@ public: private: TResourceType(TTypeType* type, TInternName tag) : TType(EKind::Resource, type, false) - , Tag(tag) + , Tag_(tag) {} void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); @@ -1402,7 +1402,7 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TInternName const Tag; + TInternName const Tag_; }; class TTaggedType : public TType { @@ -1418,15 +1418,15 @@ public: bool IsConvertableTo(const TTaggedType& typeToCompare, bool ignoreTagged = false) const; TType* GetBaseType() const { - return BaseType; + return BaseType_; } TStringBuf GetTag() const { - return Tag.Str(); + return Tag_.Str(); } TInternName GetTagStr() const { - return Tag; + return Tag_; } private: @@ -1437,8 +1437,8 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TType* BaseType; - TInternName const Tag; + TType* BaseType_; + TInternName const Tag_; }; class TVariantType : public TType { @@ -1454,23 +1454,23 @@ public: bool IsConvertableTo(const TVariantType& typeToCompare, bool ignoreTagged = false) const; TType* GetUnderlyingType() const { - return Data; + return Data_; } ui32 GetAlternativesCount() const { - if (Data->IsStruct()) { - return static_cast<TStructType*>(Data)->GetMembersCount(); + if (Data_->IsStruct()) { + return static_cast<TStructType*>(Data_)->GetMembersCount(); } else { - return static_cast<TTupleType*>(Data)->GetElementsCount(); + return static_cast<TTupleType*>(Data_)->GetElementsCount(); } } TType* GetAlternativeType(ui32 index) const { MKQL_ENSURE(index < GetAlternativesCount(), "Wrong index"); - if (Data->IsStruct()) { - return static_cast<TStructType*>(Data)->GetMemberType(index); + if (Data_->IsStruct()) { + return static_cast<TStructType*>(Data_)->GetMemberType(index); } else { - return static_cast<TTupleType*>(Data)->GetElementType(index); + return static_cast<TTupleType*>(Data_)->GetElementType(index); } } @@ -1482,7 +1482,7 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TType* Data; + TType* Data_; }; class TVariantLiteral : public TNode { @@ -1495,11 +1495,11 @@ public: } ui32 GetIndex() const { - return Index; + return Index_; } TRuntimeNode GetItem() const { - return Item; + return Item_; } private: @@ -1512,8 +1512,8 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TRuntimeNode Item; - ui32 Index; + TRuntimeNode Item_; + ui32 Index_; }; class TBlockType : public TType { @@ -1536,11 +1536,11 @@ public: bool IsConvertableTo(const TBlockType& typeToCompare, bool ignoreTagged = false) const; inline TType* GetItemType() const noexcept { - return ItemType; + return ItemType_; } inline EShape GetShape() const noexcept { - return Shape; + return Shape_; } private: @@ -1551,8 +1551,8 @@ private: void DoFreeze(const TTypeEnvironment& env); private: - TType* ItemType; - EShape Shape; + TType* ItemType_; + EShape Shape_; }; inline bool TRuntimeNode::operator==(const TRuntimeNode& other) const { diff --git a/yql/essentials/minikql/mkql_node_builder.cpp b/yql/essentials/minikql/mkql_node_builder.cpp index de027eb30c8..e1485c2ac1c 100644 --- a/yql/essentials/minikql/mkql_node_builder.cpp +++ b/yql/essentials/minikql/mkql_node_builder.cpp @@ -106,55 +106,55 @@ TBlockType::EShape GetResultShape(const TVector<TType*>& types) { return result; } -TTupleLiteralBuilder::TTupleLiteralBuilder(const TTypeEnvironment& env) : Env(env) +TTupleLiteralBuilder::TTupleLiteralBuilder(const TTypeEnvironment& env) : Env_(env) {} void TTupleLiteralBuilder::Reserve(ui32 size) { - Types.reserve(size); - Values.reserve(size); + Types_.reserve(size); + Values_.reserve(size); } TTupleLiteralBuilder& TTupleLiteralBuilder::Add(TRuntimeNode value) { - Types.push_back(value.GetRuntimeType()); - Values.push_back(value); + Types_.push_back(value.GetRuntimeType()); + Values_.push_back(value); return *this; } TTupleLiteral* TTupleLiteralBuilder::Build() { - const auto& type = TTupleType::Create(Types.size(), Types.data(), Env); - return TTupleLiteral::Create(Values.size(), Values.data(), type, Env); + const auto& type = TTupleType::Create(Types_.size(), Types_.data(), Env_); + return TTupleLiteral::Create(Values_.size(), Values_.data(), type, Env_); } void TTupleLiteralBuilder::Clear() { - Values.clear(); - Types.clear(); + Values_.clear(); + Types_.clear(); } TStructTypeBuilder::TStructTypeBuilder(const TTypeEnvironment& env) - : Env(&env) + : Env_(&env) { } void TStructTypeBuilder::Reserve(ui32 size) { - Members.reserve(size); + Members_.reserve(size); } TStructTypeBuilder& TStructTypeBuilder::Add(const TStringBuf& name, TType* type, ui32* index) { - Members.push_back(TStructMember(Env->InternName(name).Str(), type, index)); + Members_.push_back(TStructMember(Env_->InternName(name).Str(), type, index)); return *this; } TStructType* TStructTypeBuilder::Build() { - if (Members.empty()) - return Env->GetEmptyStructLazy()->GetType(); + if (Members_.empty()) + return Env_->GetEmptyStructLazy()->GetType(); - Sort(Members.begin(), Members.end()); - return TStructType::Create(Members.size(), Members.data(), *Env); + Sort(Members_.begin(), Members_.end()); + return TStructType::Create(Members_.size(), Members_.data(), *Env_); } void TStructTypeBuilder::FillIndexes() { ui32 index = 0; - for (const TStructMember& member: Members) { + for (const TStructMember& member: Members_) { if (member.Index) { *(member.Index) = index++; } @@ -162,34 +162,34 @@ void TStructTypeBuilder::FillIndexes() { } void TStructTypeBuilder::Clear() { - Members.clear(); + Members_.clear(); } TStructLiteralBuilder::TStructLiteralBuilder(const TTypeEnvironment& env) - : Env(&env) + : Env_(&env) { } void TStructLiteralBuilder::Reserve(ui32 size) { - Members.reserve(size); - Values.reserve(size); + Members_.reserve(size); + Values_.reserve(size); } TStructLiteralBuilder& TStructLiteralBuilder::Add(const TStringBuf& name, TRuntimeNode value) { TType* valueType = value.GetStaticType(); - Members.push_back(TStructMember(Env->InternName(name).Str(), valueType)); - Values.push_back(value); + Members_.push_back(TStructMember(Env_->InternName(name).Str(), valueType)); + Values_.push_back(value); return *this; } TStructLiteral* TStructLiteralBuilder::Build() { - Y_DEBUG_ABORT_UNLESS(Members.size() == Values.size()); - if (Members.empty()) - return Env->GetEmptyStructLazy(); + Y_DEBUG_ABORT_UNLESS(Members_.size() == Values_.size()); + if (Members_.empty()) + return Env_->GetEmptyStructLazy(); - TVector<std::pair<TStringBuf, ui32>> sortedIndicies(Members.size()); - for (ui32 i = 0, e = Members.size(); i < e; ++i) { - sortedIndicies[i] = std::make_pair(Members[i].Name, i); + TVector<std::pair<TStringBuf, ui32>> sortedIndicies(Members_.size()); + for (ui32 i = 0, e = Members_.size(); i < e; ++i) { + sortedIndicies[i] = std::make_pair(Members_[i].Name, i); } Sort(sortedIndicies.begin(), sortedIndicies.end(), @@ -197,202 +197,202 @@ TStructLiteral* TStructLiteralBuilder::Build() { return x.first < y.first; }); - TVector<TStructMember> sortedMembers(Members.size()); - TVector<TRuntimeNode> sortedValues(Members.size()); + TVector<TStructMember> sortedMembers(Members_.size()); + TVector<TRuntimeNode> sortedValues(Members_.size()); - for (ui32 i = 0, e = Members.size(); i < e; ++i) { - sortedMembers[i] = Members[sortedIndicies[i].second]; - sortedValues[i] = Values[sortedIndicies[i].second]; + for (ui32 i = 0, e = Members_.size(); i < e; ++i) { + sortedMembers[i] = Members_[sortedIndicies[i].second]; + sortedValues[i] = Values_[sortedIndicies[i].second]; } - auto type = TStructType::Create(sortedMembers.size(), sortedMembers.data(), *Env); - return TStructLiteral::Create(sortedValues.size(), sortedValues.data(), type, *Env); + auto type = TStructType::Create(sortedMembers.size(), sortedMembers.data(), *Env_); + return TStructLiteral::Create(sortedValues.size(), sortedValues.data(), type, *Env_); } void TStructLiteralBuilder::Clear() { - Members.clear(); + Members_.clear(); } TListLiteralBuilder::TListLiteralBuilder(const TTypeEnvironment& env, TType* type) - : Env(&env) - , Type(type) + : Env_(&env) + , Type_(type) {} TListLiteralBuilder& TListLiteralBuilder::Add(TRuntimeNode item) { - Items.push_back(item); + Items_.push_back(item); return *this; } TListLiteral* TListLiteralBuilder::Build() { - auto type = TListType::Create(Type, *Env); - return TListLiteral::Create(Items.data(), Items.size(), type, *Env); + auto type = TListType::Create(Type_, *Env_); + return TListLiteral::Create(Items_.data(), Items_.size(), type, *Env_); } void TListLiteralBuilder::Clear() { - Items.clear(); + Items_.clear(); } TDictLiteralBuilder::TDictLiteralBuilder(const TTypeEnvironment& env, TType* keyType, TType* payloadType) - : Env(&env) - , KeyType(keyType) - , PayloadType(payloadType) + : Env_(&env) + , KeyType_(keyType) + , PayloadType_(payloadType) { } void TDictLiteralBuilder::Reserve(ui32 size) { - Items.reserve(size); + Items_.reserve(size); } TDictLiteralBuilder& TDictLiteralBuilder::Add(TRuntimeNode key, TRuntimeNode payload) { - Items.push_back(std::make_pair(key, payload)); + Items_.push_back(std::make_pair(key, payload)); return *this; } TDictLiteral* TDictLiteralBuilder::Build() { - auto type = TDictType::Create(KeyType, PayloadType, *Env); - return TDictLiteral::Create(Items.size(), Items.data(), type, *Env); + auto type = TDictType::Create(KeyType_, PayloadType_, *Env_); + return TDictLiteral::Create(Items_.size(), Items_.data(), type, *Env_); } void TDictLiteralBuilder::Clear() { - Items.clear(); + Items_.clear(); } TCallableTypeBuilder::TCallableTypeBuilder(const TTypeEnvironment& env, const TStringBuf& name, TType* returnType) - : Env(&env) - , Name(Env->InternName(name)) - , ReturnType(returnType) - , OptionalArgsCount(0) - , HasPayload(false) + : Env_(&env) + , Name_(Env_->InternName(name)) + , ReturnType_(returnType) + , OptionalArgsCount_(0) + , HasPayload_(false) {} void TCallableTypeBuilder::Reserve(ui32 size) { - Arguments.reserve(size); - ArgNames.reserve(size); - ArgFlags.reserve(size); + Arguments_.reserve(size); + ArgNames_.reserve(size); + ArgFlags_.reserve(size); } TCallableTypeBuilder& TCallableTypeBuilder::Add(TType *type) { - Arguments.push_back(type); - ArgNames.emplace_back(); - ArgFlags.emplace_back(); + Arguments_.push_back(type); + ArgNames_.emplace_back(); + ArgFlags_.emplace_back(); return *this; } TCallableTypeBuilder& TCallableTypeBuilder::SetArgumentName(const TStringBuf& name) { - MKQL_ENSURE(!ArgNames.empty(), "No arguments"); - HasPayload = true; - ArgNames.back() = name; + MKQL_ENSURE(!ArgNames_.empty(), "No arguments"); + HasPayload_ = true; + ArgNames_.back() = name; return *this; } TCallableTypeBuilder& TCallableTypeBuilder::SetArgumentFlags(ui64 flags) { - MKQL_ENSURE(!ArgFlags.empty(), "No arguments"); - HasPayload = true; - ArgFlags.back() = flags; + MKQL_ENSURE(!ArgFlags_.empty(), "No arguments"); + HasPayload_ = true; + ArgFlags_.back() = flags; return *this; } TCallableTypeBuilder& TCallableTypeBuilder::SetOptionalArgs(ui32 count) { - OptionalArgsCount = count; + OptionalArgsCount_ = count; return *this; } TCallableTypeBuilder& TCallableTypeBuilder::SetPayload(const TStringBuf& data) { - HasPayload = true; - FuncPayload = data; + HasPayload_ = true; + FuncPayload_ = data; return *this; } TCallableType* TCallableTypeBuilder::Build() { TNode* payload = nullptr; - if (HasPayload) { - payload = BuildCallableTypePayload(ArgNames, ArgFlags, FuncPayload, *Env); + if (HasPayload_) { + payload = BuildCallableTypePayload(ArgNames_, ArgFlags_, FuncPayload_, *Env_); } - auto ret = TCallableType::Create(ReturnType, Name.Str(), Arguments.size(), Arguments.data(), payload, *Env); - ret->SetOptionalArgumentsCount(OptionalArgsCount); + auto ret = TCallableType::Create(ReturnType_, Name_.Str(), Arguments_.size(), Arguments_.data(), payload, *Env_); + ret->SetOptionalArgumentsCount(OptionalArgsCount_); return ret; } void TCallableTypeBuilder::Clear() { - Arguments.clear(); - ArgNames.clear(); - ArgFlags.clear(); - OptionalArgsCount = 0; - HasPayload = false; - FuncPayload = TStringBuf(); + Arguments_.clear(); + ArgNames_.clear(); + ArgFlags_.clear(); + OptionalArgsCount_ = 0; + HasPayload_ = false; + FuncPayload_ = TStringBuf(); } TCallableBuilder::TCallableBuilder(const TTypeEnvironment& env, const TStringBuf& name, TType* returnType, bool disableMerge) - : Env(&env) - , Name(Env->InternName(name)) - , ReturnType(returnType) - , DisableMerge(disableMerge) - , OptionalArgsCount(0) - , HasPayload(false) + : Env_(&env) + , Name_(Env_->InternName(name)) + , ReturnType_(returnType) + , DisableMerge_(disableMerge) + , OptionalArgsCount_(0) + , HasPayload_(false) {} void TCallableBuilder::Reserve(ui32 size) { - Arguments.reserve(size); - Inputs.reserve(size); - ArgNames.reserve(size); - ArgFlags.reserve(size); + Arguments_.reserve(size); + Inputs_.reserve(size); + ArgNames_.reserve(size); + ArgFlags_.reserve(size); } TCallableBuilder& TCallableBuilder::Add(TRuntimeNode input) { TType* inputType = input.GetStaticType(); - Arguments.push_back(inputType); - Inputs.push_back(input); - ArgNames.emplace_back(); - ArgFlags.emplace_back(); + Arguments_.push_back(inputType); + Inputs_.push_back(input); + ArgNames_.emplace_back(); + ArgFlags_.emplace_back(); return *this; } TCallableBuilder& TCallableBuilder::SetOptionalArgs(ui32 count) { - OptionalArgsCount = count; + OptionalArgsCount_ = count; return *this; } TCallableBuilder& TCallableBuilder::SetTypePayload(const TStringBuf& data) { - HasPayload = true; - FuncPayload = data; + HasPayload_ = true; + FuncPayload_ = data; return *this; } TCallableBuilder& TCallableBuilder::SetArgumentName(const TStringBuf& name) { - MKQL_ENSURE(!ArgNames.empty(), "No arguments"); - HasPayload = true; - ArgNames.back() = name; + MKQL_ENSURE(!ArgNames_.empty(), "No arguments"); + HasPayload_ = true; + ArgNames_.back() = name; return *this; } TCallableBuilder& TCallableBuilder::SetArgumentFlags(ui64 flags) { - MKQL_ENSURE(!ArgFlags.empty(), "No arguments"); - HasPayload = true; - ArgFlags.back() = flags; + MKQL_ENSURE(!ArgFlags_.empty(), "No arguments"); + HasPayload_ = true; + ArgFlags_.back() = flags; return *this; } TCallable* TCallableBuilder::Build() { TNode* payload = nullptr; - if (HasPayload) { - payload = BuildCallableTypePayload(ArgNames, ArgFlags, FuncPayload, *Env); + if (HasPayload_) { + payload = BuildCallableTypePayload(ArgNames_, ArgFlags_, FuncPayload_, *Env_); } - auto type = TCallableType::Create(ReturnType, Name.Str(), Arguments.size(), Arguments.data(), payload, *Env); - type->SetOptionalArgumentsCount(OptionalArgsCount); - if (DisableMerge) + auto type = TCallableType::Create(ReturnType_, Name_.Str(), Arguments_.size(), Arguments_.data(), payload, *Env_); + type->SetOptionalArgumentsCount(OptionalArgsCount_); + if (DisableMerge_) type->DisableMerge(); - return TCallable::Create(Inputs.size(), Inputs.data(), type, *Env); + return TCallable::Create(Inputs_.size(), Inputs_.data(), type, *Env_); } void TCallableBuilder::Clear() { - Arguments.clear(); - Inputs.clear(); - ArgNames.clear(); - ArgFlags.clear(); - OptionalArgsCount = 0; - FuncPayload = TStringBuf(); + Arguments_.clear(); + Inputs_.clear(); + ArgNames_.clear(); + ArgFlags_.clear(); + OptionalArgsCount_ = 0; + FuncPayload_ = TStringBuf(); } } diff --git a/yql/essentials/minikql/mkql_node_builder.h b/yql/essentials/minikql/mkql_node_builder.h index ae4ea9a8b83..d5e22f3f6ab 100644 --- a/yql/essentials/minikql/mkql_node_builder.h +++ b/yql/essentials/minikql/mkql_node_builder.h @@ -35,9 +35,9 @@ public: TTupleLiteral* Build(); void Clear(); private: - const TTypeEnvironment& Env; - TVector<TType*> Types; - TVector<TRuntimeNode> Values; + const TTypeEnvironment& Env_; + TVector<TType*> Types_; + TVector<TRuntimeNode> Values_; }; class TStructTypeBuilder { @@ -52,8 +52,8 @@ public: void Clear(); private: - const TTypeEnvironment* Env; - TVector<TStructMember> Members; + const TTypeEnvironment* Env_; + TVector<TStructMember> Members_; }; class TListLiteralBuilder { @@ -66,9 +66,9 @@ public: void Clear(); private: - const TTypeEnvironment* Env; - TType* Type; - TVector<TRuntimeNode> Items; + const TTypeEnvironment* Env_; + TType* Type_; + TVector<TRuntimeNode> Items_; }; class TStructLiteralBuilder { @@ -82,9 +82,9 @@ public: void Clear(); private: - const TTypeEnvironment* Env; - TVector<TStructMember> Members; - TVector<TRuntimeNode> Values; + const TTypeEnvironment* Env_; + TVector<TStructMember> Members_; + TVector<TRuntimeNode> Values_; }; class TDictLiteralBuilder { @@ -98,10 +98,10 @@ public: void Clear(); private: - const TTypeEnvironment* Env; - TType* KeyType; - TType* PayloadType; - TVector<std::pair<TRuntimeNode, TRuntimeNode>> Items; + const TTypeEnvironment* Env_; + TType* KeyType_; + TType* PayloadType_; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> Items_; }; class TCallableTypeBuilder { @@ -119,15 +119,15 @@ public: void Clear(); private: - const TTypeEnvironment* Env; - TInternName Name; - TType* ReturnType; - TVector<TType*> Arguments; - ui32 OptionalArgsCount; - TVector<TStringBuf> ArgNames; - TVector<ui64> ArgFlags; - TStringBuf FuncPayload; - bool HasPayload; + const TTypeEnvironment* Env_; + TInternName Name_; + TType* ReturnType_; + TVector<TType*> Arguments_; + ui32 OptionalArgsCount_; + TVector<TStringBuf> ArgNames_; + TVector<ui64> ArgFlags_; + TStringBuf FuncPayload_; + bool HasPayload_; }; class TCallableBuilder { @@ -146,17 +146,17 @@ public: void Clear(); private: - const TTypeEnvironment* Env; - TInternName Name; - TType* ReturnType; - bool DisableMerge; - TVector<TType*> Arguments; - TVector<TRuntimeNode> Inputs; - ui32 OptionalArgsCount; - TVector<TStringBuf> ArgNames; - TVector<ui64> ArgFlags; - TStringBuf FuncPayload; - bool HasPayload; + const TTypeEnvironment* Env_; + TInternName Name_; + TType* ReturnType_; + bool DisableMerge_; + TVector<TType*> Arguments_; + TVector<TRuntimeNode> Inputs_; + ui32 OptionalArgsCount_; + TVector<TStringBuf> ArgNames_; + TVector<ui64> ArgFlags_; + TStringBuf FuncPayload_; + bool HasPayload_; }; } diff --git a/yql/essentials/minikql/mkql_node_cast_ut.cpp b/yql/essentials/minikql/mkql_node_cast_ut.cpp index 60c563888d5..672e6e88d73 100644 --- a/yql/essentials/minikql/mkql_node_cast_ut.cpp +++ b/yql/essentials/minikql/mkql_node_cast_ut.cpp @@ -35,9 +35,9 @@ class TMiniKQLNodeCast: public TTestBase TCallableType* ctype = TCallableType::Create( "callable", dataNode.GetStaticType(), - 0, nullptr, nullptr, Env); + 0, nullptr, nullptr, Env_); - TCallable* callable = TCallable::Create(dataNode, ctype, Env); + TCallable* callable = TCallable::Create(dataNode, ctype, Env_); TRuntimeNode node(callable, false); node.Freeze(); @@ -53,18 +53,18 @@ class TMiniKQLNodeCast: public TTestBase } TMiniKQLNodeCast() - : Alloc(__LOCATION__) - , Env(Alloc) + : Alloc_(__LOCATION__) + , Env_(Alloc_) {} private: TRuntimeNode Uint32AsNode(ui32 value) { - return TRuntimeNode(BuildDataLiteral(NUdf::TUnboxedValuePod(value), NUdf::EDataSlot::Uint32, Env), true); + return TRuntimeNode(BuildDataLiteral(NUdf::TUnboxedValuePod(value), NUdf::EDataSlot::Uint32, Env_), true); } private: - TScopedAlloc Alloc; - TTypeEnvironment Env; + TScopedAlloc Alloc_; + TTypeEnvironment Env_; }; UNIT_TEST_SUITE_REGISTRATION(TMiniKQLNodeCast); diff --git a/yql/essentials/minikql/mkql_node_printer.cpp b/yql/essentials/minikql/mkql_node_printer.cpp index 8eddb69ce61..88e64a1c1f4 100644 --- a/yql/essentials/minikql/mkql_node_printer.cpp +++ b/yql/essentials/minikql/mkql_node_printer.cpp @@ -15,91 +15,91 @@ namespace { TIndentScope(TPrintVisitor* self) : Self(self) { - ++Self->Indent; + ++Self->Indent_; } ~TIndentScope() { - --Self->Indent; + --Self->Indent_; } TPrintVisitor* Self; }; TPrintVisitor(bool singleLine) - : SingleLine(singleLine) - , Indent(0) + : SingleLine_(singleLine) + , Indent_(0) {} void Visit(TTypeType& node) override { Y_UNUSED(node); WriteIndentation(); - Out << "Type (Type)"; + Out_ << "Type (Type)"; WriteNewline(); } void Visit(TVoidType& node) override { Y_UNUSED(node); WriteIndentation(); - Out << "Type (Void) "; + Out_ << "Type (Void) "; WriteNewline(); } void Visit(TNullType& node) override { Y_UNUSED(node); WriteIndentation(); - Out << "Type (Null) "; + Out_ << "Type (Null) "; WriteNewline(); } void Visit(TEmptyListType& node) override { Y_UNUSED(node); WriteIndentation(); - Out << "Type (EmptyList) "; + Out_ << "Type (EmptyList) "; WriteNewline(); } void Visit(TEmptyDictType& node) override { Y_UNUSED(node); WriteIndentation(); - Out << "Type (EmptyDict) "; + Out_ << "Type (EmptyDict) "; WriteNewline(); } void Visit(TDataType& node) override { WriteIndentation(); auto slot = NUdf::FindDataSlot(node.GetSchemeType()); - Out << "Type (Data), schemeType: "; + Out_ << "Type (Data), schemeType: "; if (slot) { - Out << GetDataTypeInfo(*slot).Name; + Out_ << GetDataTypeInfo(*slot).Name; if (node.GetSchemeType() == NUdf::TDataType<NUdf::TDecimal>::Id) { const auto params = static_cast<TDataDecimalType&>(node).GetParams(); - Out << '(' << int(params.first) << ',' << int(params.second) << ')'; + Out_ << '(' << int(params.first) << ',' << int(params.second) << ')'; } } else { - Out << "<" << node.GetSchemeType() << ">"; + Out_ << "<" << node.GetSchemeType() << ">"; } - Out << ", schemeTypeId: "; - Out << node.GetSchemeType(); + Out_ << ", schemeTypeId: "; + Out_ << node.GetSchemeType(); WriteNewline(); } void Visit(TPgType& node) override { WriteIndentation(); - Out << "Type (Pg), name: " << NYql::NPg::LookupType(node.GetTypeId()).Name; + Out_ << "Type (Pg), name: " << NYql::NPg::LookupType(node.GetTypeId()).Name; WriteNewline(); } void Visit(TStructType& node) override { WriteIndentation(); - Out << "Type (Struct) with " << node.GetMembersCount() << " members {"; + Out_ << "Type (Struct) with " << node.GetMembersCount() << " members {"; WriteNewline(); { TIndentScope scope(this); for (ui32 index = 0; index < node.GetMembersCount(); ++index) { WriteIndentation(); - Out << "Member [" << node.GetMemberName(index) << "] : {"; + Out_ << "Member [" << node.GetMemberName(index) << "] : {"; WriteNewline(); { @@ -108,25 +108,25 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TListType& node) override { WriteIndentation(); - Out << "Type (List) {"; + Out_ << "Type (List) {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "List item type: {"; + Out_ << "List item type: {"; WriteNewline(); { @@ -135,24 +135,24 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TStreamType& node) override { WriteIndentation(); - Out << "Type (Stream) {"; + Out_ << "Type (Stream) {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "Stream item type: {"; + Out_ << "Stream item type: {"; WriteNewline(); { @@ -161,24 +161,24 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TFlowType& node) override { WriteIndentation(); - Out << "Type (Flow) {"; + Out_ << "Type (Flow) {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "Flow item type: {"; + Out_ << "Flow item type: {"; WriteNewline(); { @@ -187,24 +187,24 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TBlockType& node) override { WriteIndentation(); - Out << "Type (Block) {"; + Out_ << "Type (Block) {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "Block item type: {"; + Out_ << "Block item type: {"; WriteNewline(); { @@ -213,28 +213,28 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); WriteIndentation(); - Out << "Block shape: " << (node.GetShape() == TBlockType::EShape::Scalar ? "Scalar" : "Many"); + Out_ << "Block shape: " << (node.GetShape() == TBlockType::EShape::Scalar ? "Scalar" : "Many"); WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TOptionalType& node) override { WriteIndentation(); - Out << "Type (Optional) {"; + Out_ << "Type (Optional) {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "Optional item type: {"; + Out_ << "Optional item type: {"; WriteNewline(); { @@ -243,24 +243,24 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TDictType& node) override { WriteIndentation(); - Out << "Type (Dict) {"; + Out_ << "Type (Dict) {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "Key type: {"; + Out_ << "Key type: {"; WriteNewline(); { @@ -269,11 +269,11 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); WriteIndentation(); - Out << "Payload type: {"; + Out_ << "Payload type: {"; WriteNewline(); { @@ -282,29 +282,29 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TCallableType& node) override { WriteIndentation(); - Out << "Type (Callable), name: [" << node.GetName() << "] with " << node.GetArgumentsCount() << " args {"; + Out_ << "Type (Callable), name: [" << node.GetName() << "] with " << node.GetArgumentsCount() << " args {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "Return type"; + Out_ << "Return type"; if (node.IsMergeDisabled()) - Out << ", merge disabled"; + Out_ << ", merge disabled"; if (node.GetOptionalArgumentsCount() != 0) - Out << ", optional args: " << node.GetOptionalArgumentsCount(); - Out << " : {"; + Out_ << ", optional args: " << node.GetOptionalArgumentsCount(); + Out_ << " : {"; WriteNewline(); { @@ -313,12 +313,12 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); for (ui32 index = 0; index < node.GetArgumentsCount(); ++index) { WriteIndentation(); const auto& type = node.GetArgumentType(index); - Out << "Argument #" << index << " : {"; + Out_ << "Argument #" << index << " : {"; WriteNewline(); { @@ -327,13 +327,13 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } if (node.GetPayload()) { WriteIndentation(); - Out << "Payload: {"; + Out_ << "Payload: {"; WriteNewline(); { @@ -342,34 +342,34 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TAnyType& node) override { Y_UNUSED(node); WriteIndentation(); - Out << "Type (Any) "; + Out_ << "Type (Any) "; WriteNewline(); } template<typename T> void VisitTupleLike(T& node, std::string_view name) { WriteIndentation(); - Out << "Type (" << name << ") with " << node.GetElementsCount() << " elements {"; + Out_ << "Type (" << name << ") with " << node.GetElementsCount() << " elements {"; WriteNewline(); { TIndentScope scope(this); for (ui32 index = 0; index < node.GetElementsCount(); ++index) { WriteIndentation(); - Out << "#" << index << " : {"; + Out_ << "#" << index << " : {"; WriteNewline(); { @@ -378,13 +378,13 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } @@ -399,19 +399,19 @@ namespace { void Visit(TResourceType& node) override { Y_UNUSED(node); WriteIndentation(); - Out << "Type (Resource) (" << node.GetTag() << ")"; + Out_ << "Type (Resource) (" << node.GetTag() << ")"; WriteNewline(); } void Visit(TVariantType& node) override { WriteIndentation(); - Out << "Type (Variant) {"; + Out_ << "Type (Variant) {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "Underlying type: {"; + Out_ << "Underlying type: {"; WriteNewline(); { @@ -420,18 +420,18 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TVoid& node) override { WriteIndentation(); - Out << "Void {"; + Out_ << "Void {"; WriteNewline(); { @@ -440,13 +440,13 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TNull& node) override { WriteIndentation(); - Out << "Null {"; + Out_ << "Null {"; WriteNewline(); { @@ -455,13 +455,13 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TEmptyList& node) override { WriteIndentation(); - Out << "EmptyList {"; + Out_ << "EmptyList {"; WriteNewline(); { @@ -470,13 +470,13 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TEmptyDict& node) override { WriteIndentation(); - Out << "EmptyDict {"; + Out_ << "EmptyDict {"; WriteNewline(); { @@ -485,13 +485,13 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TDataLiteral& node) override { WriteIndentation(); - Out << "Data {"; + Out_ << "Data {"; WriteNewline(); { @@ -500,22 +500,22 @@ namespace { WriteIndentation(); if (node.GetType()->GetSchemeType() == 0) { - Out << "null"; + Out_ << "null"; WriteNewline(); } else { - Out << TString(node.AsValue().AsStringRef()).Quote(); + Out_ << TString(node.AsValue().AsStringRef()).Quote(); WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TStructLiteral& node) override { WriteIndentation(); - Out << "Struct {"; + Out_ << "Struct {"; WriteNewline(); { @@ -523,7 +523,7 @@ namespace { for (ui32 index = 0; index < node.GetValuesCount(); ++index) { WriteIndentation(); const auto& value = node.GetValue(index); - Out << "Member [" << node.GetType()->GetMemberName(index) << "], " + Out_ << "Member [" << node.GetType()->GetMemberName(index) << "], " << (value.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); @@ -533,19 +533,19 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TListLiteral& node) override { WriteIndentation(); - Out << "List with " << node.GetItemsCount() << " items {"; + Out_ << "List with " << node.GetItemsCount() << " items {"; WriteNewline(); { @@ -555,7 +555,7 @@ namespace { for (ui32 i = 0; i < node.GetItemsCount(); ++i) { WriteIndentation(); const auto& item = node.GetItems()[i]; - Out << "Item #" << index << ", " << (item.IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "Item #" << index << ", " << (item.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -564,19 +564,19 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TOptionalLiteral& node) override { WriteIndentation(); - Out << "Optional " << (node.HasItem() ? "with data" : "empty") << " {"; + Out_ << "Optional " << (node.HasItem() ? "with data" : "empty") << " {"; WriteNewline(); { @@ -585,7 +585,7 @@ namespace { if (node.HasItem()) { WriteIndentation(); const auto& item = node.GetItem(); - Out << "Item " << (item.IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "Item " << (item.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -594,19 +594,19 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TDictLiteral& node) override { WriteIndentation(); - Out << "Dict with " << node.GetItemsCount() << " items {"; + Out_ << "Dict with " << node.GetItemsCount() << " items {"; WriteNewline(); { @@ -615,7 +615,7 @@ namespace { for (ui32 index = 0; index < node.GetItemsCount(); ++index) { WriteIndentation(); const auto& item = node.GetItem(index); - Out << "Key of item #" << index << ", " << (item.first.IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "Key of item #" << index << ", " << (item.first.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -624,11 +624,11 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); WriteIndentation(); - Out << "Payload of item #" << index << ", " << (item.second.IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "Payload of item #" << index << ", " << (item.second.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -637,22 +637,22 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TCallable& node) override { WriteIndentation(); - Out << "Callable"; + Out_ << "Callable"; if (node.GetUniqueId() != 0) - Out << ", uniqueId: " << node.GetUniqueId(); - Out << " {"; + Out_ << ", uniqueId: " << node.GetUniqueId(); + Out_ << " {"; WriteNewline(); { @@ -662,7 +662,7 @@ namespace { for (ui32 index = 0; index < node.GetInputsCount(); ++index) { WriteIndentation(); const auto& input = node.GetInput(index); - Out << "Input #" << index << ", " << (input.IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "Input #" << index << ", " << (input.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -671,13 +671,13 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } if (node.HasResult()) { WriteIndentation(); - Out << "Result, " << (node.GetResult().IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "Result, " << (node.GetResult().IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -686,19 +686,19 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TAny& node) override { WriteIndentation(); - Out << "Any " << (node.HasItem() ? "with data" : "empty") << " {"; + Out_ << "Any " << (node.HasItem() ? "with data" : "empty") << " {"; WriteNewline(); { @@ -707,7 +707,7 @@ namespace { if (node.HasItem()) { WriteIndentation(); const auto& item = node.GetItem(); - Out << "Item " << (item.IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "Item " << (item.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -716,19 +716,19 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TTupleLiteral& node) override { WriteIndentation(); - Out << "Tuple {"; + Out_ << "Tuple {"; WriteNewline(); { @@ -736,7 +736,7 @@ namespace { for (ui32 index = 0; index < node.GetValuesCount(); ++index) { WriteIndentation(); const auto& value = node.GetValue(index); - Out << "#" << index << " " << (value.IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "#" << index << " " << (value.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -745,19 +745,19 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TVariantLiteral& node) override { WriteIndentation(); - Out << "Variant with alternative " << node.GetIndex() << " {"; + Out_ << "Variant with alternative " << node.GetIndex() << " {"; WriteNewline(); { @@ -765,7 +765,7 @@ namespace { node.GetType()->Accept(*this); WriteIndentation(); const auto& item = node.GetItem(); - Out << "Item " << (item.IsImmediate() ? "immediate" : "not immediate") << " {"; + Out_ << "Item " << (item.IsImmediate() ? "immediate" : "not immediate") << " {"; WriteNewline(); { @@ -774,24 +774,24 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } void Visit(TTaggedType& node) override { WriteIndentation(); - Out << "Type (Tagged) (" << node.GetTag() << ") {"; + Out_ << "Type (Tagged) (" << node.GetTag() << ") {"; WriteNewline(); { TIndentScope scope(this); WriteIndentation(); - Out << "Tagged base type: {"; + Out_ << "Tagged base type: {"; WriteNewline(); { @@ -800,41 +800,41 @@ namespace { } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } WriteIndentation(); - Out << "}"; + Out_ << "}"; WriteNewline(); } TString ToString() { - return Out.Str(); + return Out_.Str(); } private: void WriteIndentation() { - if (SingleLine) { + if (SingleLine_) { } else { - for (ui32 i = 0; i < 2 * Indent; ++i) { - Out << ' '; + for (ui32 i = 0; i < 2 * Indent_; ++i) { + Out_ << ' '; } } } void WriteNewline() { - if (SingleLine) { - Out << ' '; + if (SingleLine_) { + Out_ << ' '; } else { - Out << '\n'; + Out_ << '\n'; } } private: - const bool SingleLine; - TStringStream Out; - ui32 Indent; + const bool SingleLine_; + TStringStream Out_; + ui32 Indent_; }; } diff --git a/yql/essentials/minikql/mkql_node_serialization.cpp b/yql/essentials/minikql/mkql_node_serialization.cpp index 1697d528064..7ad35cce959 100644 --- a/yql/essentials/minikql/mkql_node_serialization.cpp +++ b/yql/essentials/minikql/mkql_node_serialization.cpp @@ -72,26 +72,26 @@ namespace { } THashMap<TInternName, ui32>& GetNames() { - return Names; + return Names_; } TVector<TInternName>& GetNameOrder() { - return NameOrder; + return NameOrder_; } private: void AddName(const TInternName& name) { - auto iter = Names.emplace(name, 0); + auto iter = Names_.emplace(name, 0); if (iter.second) { - NameOrder.emplace_back(name); + NameOrder_.emplace_back(name); } ++iter.first->second; } private: - THashMap<TInternName, ui32> Names; - TVector<TInternName> NameOrder; + THashMap<TInternName, ui32> Names_; + TVector<TInternName> NameOrder_; }; class TWriter { @@ -102,350 +102,350 @@ namespace { class TPreVisitor : public INodeVisitor { public: TPreVisitor(TWriter& owner) - : Owner(owner) - , IsProcessed0(false) + : Owner_(owner) + , IsProcessed0_(false) { } void Visit(TTypeType& node) override { Y_UNUSED(node); - Owner.Write(TypeMarker | (char)TType::EKind::Type); - IsProcessed0 = true; + Owner_.Write(TypeMarker | (char)TType::EKind::Type); + IsProcessed0_ = true; } void Visit(TVoidType& node) override { Y_UNUSED(node); - Owner.Write(TypeMarker | (char)TType::EKind::Void); - IsProcessed0 = true; + Owner_.Write(TypeMarker | (char)TType::EKind::Void); + IsProcessed0_ = true; } void Visit(TNullType& node) override { Y_UNUSED(node); - Owner.Write(TypeMarker | (char)TType::EKind::Null); - IsProcessed0 = true; + Owner_.Write(TypeMarker | (char)TType::EKind::Null); + IsProcessed0_ = true; } void Visit(TEmptyListType& node) override { Y_UNUSED(node); - Owner.Write(TypeMarker | (char)TType::EKind::EmptyList); - IsProcessed0 = true; + Owner_.Write(TypeMarker | (char)TType::EKind::EmptyList); + IsProcessed0_ = true; } void Visit(TEmptyDictType& node) override { Y_UNUSED(node); - Owner.Write(TypeMarker | (char)TType::EKind::EmptyDict); - IsProcessed0 = true; + Owner_.Write(TypeMarker | (char)TType::EKind::EmptyDict); + IsProcessed0_ = true; } void Visit(TDataType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Data); - Owner.WriteVar32(node.GetSchemeType()); + Owner_.Write(TypeMarker | (char)TType::EKind::Data); + Owner_.WriteVar32(node.GetSchemeType()); if (NUdf::TDataType<NUdf::TDecimal>::Id == node.GetSchemeType()) { const auto& params = static_cast<TDataDecimalType&>(node).GetParams(); - Owner.Write(params.first); - Owner.Write(params.second); + Owner_.Write(params.first); + Owner_.Write(params.second); } - IsProcessed0 = false; + IsProcessed0_ = false; } void Visit(TPgType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Pg); - Owner.WriteVar32(node.GetTypeId()); - IsProcessed0 = false; + Owner_.Write(TypeMarker | (char)TType::EKind::Pg); + Owner_.WriteVar32(node.GetTypeId()); + IsProcessed0_ = false; } void Visit(TStructType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Struct); - Owner.WriteVar32(node.GetMembersCount()); + Owner_.Write(TypeMarker | (char)TType::EKind::Struct); + Owner_.WriteVar32(node.GetMembersCount()); for (ui32 i = node.GetMembersCount(); i-- > 0;) { auto memberType = node.GetMemberType(i); - Owner.AddChildNode(*memberType); + Owner_.AddChildNode(*memberType); } - IsProcessed0 = false; + IsProcessed0_ = false; } void Visit(TListType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::List); + Owner_.Write(TypeMarker | (char)TType::EKind::List); auto itemType = node.GetItemType(); - Owner.AddChildNode(*itemType); - IsProcessed0 = false; + Owner_.AddChildNode(*itemType); + IsProcessed0_ = false; } void Visit(TStreamType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Stream); + Owner_.Write(TypeMarker | (char)TType::EKind::Stream); auto itemType = node.GetItemType(); - Owner.AddChildNode(*itemType); - IsProcessed0 = false; + Owner_.AddChildNode(*itemType); + IsProcessed0_ = false; } void Visit(TFlowType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Flow); + Owner_.Write(TypeMarker | (char)TType::EKind::Flow); auto itemType = node.GetItemType(); - Owner.AddChildNode(*itemType); - IsProcessed0 = false; + Owner_.AddChildNode(*itemType); + IsProcessed0_ = false; } void Visit(TBlockType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Block); + Owner_.Write(TypeMarker | (char)TType::EKind::Block); auto itemType = node.GetItemType(); - Owner.AddChildNode(*itemType); - IsProcessed0 = false; + Owner_.AddChildNode(*itemType); + IsProcessed0_ = false; } void Visit(TMultiType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Multi); - Owner.WriteVar32(node.GetElementsCount()); + Owner_.Write(TypeMarker | (char)TType::EKind::Multi); + Owner_.WriteVar32(node.GetElementsCount()); for (ui32 i = node.GetElementsCount(); i-- > 0;) { auto elementType = node.GetElementType(i); - Owner.AddChildNode(*elementType); + Owner_.AddChildNode(*elementType); } - IsProcessed0 = false; + IsProcessed0_ = false; } void Visit(TTaggedType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Tagged); + Owner_.Write(TypeMarker | (char)TType::EKind::Tagged); auto baseType = node.GetBaseType(); - Owner.AddChildNode(*baseType); - IsProcessed0 = false; + Owner_.AddChildNode(*baseType); + IsProcessed0_ = false; } void Visit(TOptionalType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Optional); + Owner_.Write(TypeMarker | (char)TType::EKind::Optional); auto itemType = node.GetItemType(); - Owner.AddChildNode(*itemType); - IsProcessed0 = false; + Owner_.AddChildNode(*itemType); + IsProcessed0_ = false; } void Visit(TDictType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Dict); + Owner_.Write(TypeMarker | (char)TType::EKind::Dict); auto keyType = node.GetKeyType(); auto payloadType = node.GetPayloadType(); - Owner.AddChildNode(*payloadType); - Owner.AddChildNode(*keyType); - IsProcessed0 = false; + Owner_.AddChildNode(*payloadType); + Owner_.AddChildNode(*keyType); + IsProcessed0_ = false; } void Visit(TCallableType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Callable + Owner_.Write(TypeMarker | (char)TType::EKind::Callable | (node.IsMergeDisabled() ? UserMarker2 : 0) | (node.GetPayload() ? UserMarker3 : 0)); - Owner.WriteVar32(node.GetArgumentsCount()); + Owner_.WriteVar32(node.GetArgumentsCount()); auto returnType = node.GetReturnType(); if (node.GetPayload()) { - Owner.AddChildNode(*node.GetPayload()); + Owner_.AddChildNode(*node.GetPayload()); } for (ui32 i = node.GetArgumentsCount(); i-- > 0;) { auto argumentType = node.GetArgumentType(i); - Owner.AddChildNode(*argumentType); + Owner_.AddChildNode(*argumentType); } - Owner.AddChildNode(*returnType); - IsProcessed0 = false; + Owner_.AddChildNode(*returnType); + IsProcessed0_ = false; } void Visit(TAnyType& node) override { Y_UNUSED(node); - Owner.Write(TypeMarker | (char)TType::EKind::Any); - IsProcessed0 = true; + Owner_.Write(TypeMarker | (char)TType::EKind::Any); + IsProcessed0_ = true; } void Visit(TTupleType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Tuple); - Owner.WriteVar32(node.GetElementsCount()); + Owner_.Write(TypeMarker | (char)TType::EKind::Tuple); + Owner_.WriteVar32(node.GetElementsCount()); for (ui32 i = node.GetElementsCount(); i-- > 0;) { auto elementType = node.GetElementType(i); - Owner.AddChildNode(*elementType); + Owner_.AddChildNode(*elementType); } - IsProcessed0 = false; + IsProcessed0_ = false; } void Visit(TResourceType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Resource); + Owner_.Write(TypeMarker | (char)TType::EKind::Resource); auto tag = node.GetTagStr(); - Owner.WriteName(tag); - IsProcessed0 = false; + Owner_.WriteName(tag); + IsProcessed0_ = false; } void Visit(TVariantType& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write(TypeMarker | (char)TType::EKind::Variant); + Owner_.Write(TypeMarker | (char)TType::EKind::Variant); auto underlyingType = node.GetUnderlyingType(); - Owner.AddChildNode(*underlyingType); - IsProcessed0 = false; + Owner_.AddChildNode(*underlyingType); + IsProcessed0_ = false; } void Visit(TVoid& node) override { Y_UNUSED(node); - Owner.Write((char)TType::EKind::Void); - IsProcessed0 = true; + Owner_.Write((char)TType::EKind::Void); + IsProcessed0_ = true; } void Visit(TNull& node) override { Y_UNUSED(node); - Owner.Write((char)TType::EKind::Null); - IsProcessed0 = true; + Owner_.Write((char)TType::EKind::Null); + IsProcessed0_ = true; } void Visit(TEmptyList& node) override { Y_UNUSED(node); - Owner.Write((char)TType::EKind::EmptyList); - IsProcessed0 = true; + Owner_.Write((char)TType::EKind::EmptyList); + IsProcessed0_ = true; } void Visit(TEmptyDict& node) override { Y_UNUSED(node); - Owner.Write((char)TType::EKind::EmptyDict); - IsProcessed0 = true; + Owner_.Write((char)TType::EKind::EmptyDict); + IsProcessed0_ = true; } void Visit(TDataLiteral& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write((char)TType::EKind::Data); + Owner_.Write((char)TType::EKind::Data); auto type = node.GetType(); - Owner.AddChildNode(*type); - IsProcessed0 = false; + Owner_.AddChildNode(*type); + IsProcessed0_ = false; } void Visit(TStructLiteral& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write((char)TType::EKind::Struct); + Owner_.Write((char)TType::EKind::Struct); auto type = node.GetType(); Y_DEBUG_ABORT_UNLESS(node.GetValuesCount() == type->GetMembersCount()); for (ui32 i = node.GetValuesCount(); i-- > 0; ) { auto value = node.GetValue(i); - Owner.AddChildNode(*value.GetNode()); + Owner_.AddChildNode(*value.GetNode()); } - Owner.AddChildNode(*type); - IsProcessed0 = false; + Owner_.AddChildNode(*type); + IsProcessed0_ = false; } void Visit(TListLiteral& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write((char)TType::EKind::List); + Owner_.Write((char)TType::EKind::List); auto type = node.GetType(); - Owner.WriteVar32(node.GetItemsCount()); + Owner_.WriteVar32(node.GetItemsCount()); for (ui32 i = node.GetItemsCount(); i > 0; --i) { auto item = node.GetItems()[i - 1]; - Owner.AddChildNode(*item.GetNode()); + Owner_.AddChildNode(*item.GetNode()); } - Owner.AddChildNode(*type); - IsProcessed0 = false; + Owner_.AddChildNode(*type); + IsProcessed0_ = false; } void Visit(TOptionalLiteral& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } @@ -453,66 +453,66 @@ namespace { if (node.HasItem()) item = node.GetItem(); - Owner.Write((char)TType::EKind::Optional | (item.GetNode() ? UserMarker1 : 0) | (item.IsImmediate() ? UserMarker2 : 0)); + Owner_.Write((char)TType::EKind::Optional | (item.GetNode() ? UserMarker1 : 0) | (item.IsImmediate() ? UserMarker2 : 0)); auto type = node.GetType(); if (item.GetNode()) { - Owner.AddChildNode(*item.GetNode()); + Owner_.AddChildNode(*item.GetNode()); } - Owner.AddChildNode(*type); - IsProcessed0 = false; + Owner_.AddChildNode(*type); + IsProcessed0_ = false; } void Visit(TDictLiteral& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write((char)TType::EKind::Dict); + Owner_.Write((char)TType::EKind::Dict); auto type = node.GetType(); - Owner.WriteVar32(node.GetItemsCount()); + Owner_.WriteVar32(node.GetItemsCount()); for (ui32 i = node.GetItemsCount(); i-- > 0;) { auto item = node.GetItem(i); - Owner.AddChildNode(*item.second.GetNode()); - Owner.AddChildNode(*item.first.GetNode()); + Owner_.AddChildNode(*item.second.GetNode()); + Owner_.AddChildNode(*item.first.GetNode()); } - Owner.AddChildNode(*type); - IsProcessed0 = false; + Owner_.AddChildNode(*type); + IsProcessed0_ = false; } void Visit(TCallable& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write((char)TType::EKind::Callable | (node.HasResult() ? UserMarker1 : 0) | + Owner_.Write((char)TType::EKind::Callable | (node.HasResult() ? UserMarker1 : 0) | ((node.GetUniqueId() != 0) ? UserMarker2 : 0)); auto type = node.GetType(); if (node.HasResult()) { auto result = node.GetResult(); - Owner.AddChildNode(*result.GetNode()); + Owner_.AddChildNode(*result.GetNode()); } else { Y_DEBUG_ABORT_UNLESS(node.GetInputsCount() == type->GetArgumentsCount()); for (ui32 i = node.GetInputsCount(); i-- > 0;) { auto input = node.GetInput(i); - Owner.AddChildNode(*input.GetNode()); + Owner_.AddChildNode(*input.GetNode()); } } - Owner.AddChildNode(*type); - IsProcessed0 = false; + Owner_.AddChildNode(*type); + IsProcessed0_ = false; } void Visit(TAny& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } @@ -520,63 +520,63 @@ namespace { if (node.HasItem()) item = node.GetItem(); - Owner.Write((char)TType::EKind::Any | (item.GetNode() ? UserMarker1 : 0) | (item.IsImmediate() ? UserMarker2 : 0)); + Owner_.Write((char)TType::EKind::Any | (item.GetNode() ? UserMarker1 : 0) | (item.IsImmediate() ? UserMarker2 : 0)); if (item.GetNode()) { - Owner.AddChildNode(*item.GetNode()); + Owner_.AddChildNode(*item.GetNode()); } - IsProcessed0 = false; + IsProcessed0_ = false; } void Visit(TTupleLiteral& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } - Owner.Write((char)TType::EKind::Tuple); + Owner_.Write((char)TType::EKind::Tuple); auto type = node.GetType(); Y_DEBUG_ABORT_UNLESS(node.GetValuesCount() == type->GetElementsCount()); for (ui32 i = node.GetValuesCount(); i-- > 0;) { auto value = node.GetValue(i); - Owner.AddChildNode(*value.GetNode()); + Owner_.AddChildNode(*value.GetNode()); } - Owner.AddChildNode(*type); - IsProcessed0 = false; + Owner_.AddChildNode(*type); + IsProcessed0_ = false; } void Visit(TVariantLiteral& node) override { if (node.GetCookie() != 0) { - Owner.WriteReference(node); - IsProcessed0 = true; + Owner_.WriteReference(node); + IsProcessed0_ = true; return; } TRuntimeNode item = node.GetItem(); - Owner.Write((char)TType::EKind::Variant | (item.IsImmediate() ? UserMarker1 : 0)); + Owner_.Write((char)TType::EKind::Variant | (item.IsImmediate() ? UserMarker1 : 0)); auto type = node.GetType(); - Owner.AddChildNode(*item.GetNode()); + Owner_.AddChildNode(*item.GetNode()); - Owner.AddChildNode(*type); - IsProcessed0 = false; + Owner_.AddChildNode(*type); + IsProcessed0_ = false; } bool IsProcessed() const { - return IsProcessed0; + return IsProcessed0_; } private: - TWriter& Owner; - bool IsProcessed0; + TWriter& Owner_; + bool IsProcessed0_; }; class TPostVisitor : public INodeVisitor { public: TPostVisitor(TWriter& owner) - : Owner(owner) + : Owner_(owner) { } @@ -601,62 +601,62 @@ namespace { } void Visit(TDataType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TPgType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TStructType& node) override { for (ui32 i = 0, e = node.GetMembersCount(); i < e; ++i) { auto memberName = node.GetMemberNameStr(i); - Owner.WriteName(memberName); + Owner_.WriteName(memberName); } - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TListType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TStreamType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TFlowType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TBlockType& node) override { - Owner.Write(static_cast<ui8>(node.GetShape())); - Owner.RegisterReference(node); + Owner_.Write(static_cast<ui8>(node.GetShape())); + Owner_.RegisterReference(node); } void Visit(TMultiType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TTaggedType& node) override { auto tag = node.GetTagStr(); - Owner.WriteName(tag); - Owner.RegisterReference(node); + Owner_.WriteName(tag); + Owner_.RegisterReference(node); } void Visit(TOptionalType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TDictType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TCallableType& node) override { auto name = node.GetNameStr(); - Owner.WriteName(name); - Owner.WriteVar32(node.GetOptionalArgumentsCount()); - Owner.RegisterReference(node); + Owner_.WriteName(name); + Owner_.WriteVar32(node.GetOptionalArgumentsCount()); + Owner_.RegisterReference(node); } void Visit(TAnyType& node) override { @@ -664,15 +664,15 @@ namespace { } void Visit(TTupleType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TResourceType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TVariantType& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TVoid& node) override { @@ -697,113 +697,113 @@ namespace { const auto& value = node.AsValue(); switch (type->GetSchemeType()) { case NUdf::TDataType<bool>::Id: - Owner.Write(value.Get<bool>()); + Owner_.Write(value.Get<bool>()); break; case NUdf::TDataType<ui8>::Id: - Owner.Write(value.Get<ui8>()); + Owner_.Write(value.Get<ui8>()); break; case NUdf::TDataType<i8>::Id: - Owner.Write((ui8)value.Get<i8>()); + Owner_.Write((ui8)value.Get<i8>()); break; case NUdf::TDataType<i16>::Id: - Owner.WriteVar32(ZigZagEncode(value.Get<i16>())); + Owner_.WriteVar32(ZigZagEncode(value.Get<i16>())); break; case NUdf::TDataType<ui16>::Id: - Owner.WriteVar32(value.Get<ui16>()); + Owner_.WriteVar32(value.Get<ui16>()); break; case NUdf::TDataType<i32>::Id: - Owner.WriteVar32(ZigZagEncode(value.Get<i32>())); + Owner_.WriteVar32(ZigZagEncode(value.Get<i32>())); break; case NUdf::TDataType<ui32>::Id: - Owner.WriteVar32(value.Get<ui32>()); + Owner_.WriteVar32(value.Get<ui32>()); break; case NUdf::TDataType<float>::Id: { const auto v = value.Get<float>(); - Owner.WriteMany(&v, sizeof(v)); + Owner_.WriteMany(&v, sizeof(v)); break; } case NUdf::TDataType<i64>::Id: - Owner.WriteVar64(ZigZagEncode(value.Get<i64>())); + Owner_.WriteVar64(ZigZagEncode(value.Get<i64>())); break; case NUdf::TDataType<ui64>::Id: - Owner.WriteVar64(value.Get<ui64>()); + Owner_.WriteVar64(value.Get<ui64>()); break; case NUdf::TDataType<double>::Id: { const auto v = value.Get<double>(); - Owner.WriteMany(&v, sizeof(v)); + Owner_.WriteMany(&v, sizeof(v)); break; } case NUdf::TDataType<NUdf::TDate>::Id: - Owner.WriteVar32(value.Get<NUdf::TDataType<NUdf::TDate>::TLayout>()); + Owner_.WriteVar32(value.Get<NUdf::TDataType<NUdf::TDate>::TLayout>()); break; case NUdf::TDataType<NUdf::TDatetime>::Id: - Owner.WriteVar32(value.Get<NUdf::TDataType<NUdf::TDatetime>::TLayout>()); + Owner_.WriteVar32(value.Get<NUdf::TDataType<NUdf::TDatetime>::TLayout>()); break; case NUdf::TDataType<NUdf::TTimestamp>::Id: - Owner.WriteVar64(value.Get<NUdf::TDataType<NUdf::TTimestamp>::TLayout>()); + Owner_.WriteVar64(value.Get<NUdf::TDataType<NUdf::TTimestamp>::TLayout>()); break; case NUdf::TDataType<NUdf::TTzDate>::Id: { - Owner.WriteVar32(value.Get<NUdf::TDataType<NUdf::TTzDate>::TLayout>()); - Owner.WriteVar32(value.GetTimezoneId()); + Owner_.WriteVar32(value.Get<NUdf::TDataType<NUdf::TTzDate>::TLayout>()); + Owner_.WriteVar32(value.GetTimezoneId()); break; } case NUdf::TDataType<NUdf::TTzDatetime>::Id: { - Owner.WriteVar32(value.Get<NUdf::TDataType<NUdf::TTzDatetime>::TLayout>()); - Owner.WriteVar32(value.GetTimezoneId()); + Owner_.WriteVar32(value.Get<NUdf::TDataType<NUdf::TTzDatetime>::TLayout>()); + Owner_.WriteVar32(value.GetTimezoneId()); break; } case NUdf::TDataType<NUdf::TTzTimestamp>::Id: { - Owner.WriteVar64(value.Get<NUdf::TDataType<NUdf::TTzTimestamp>::TLayout>()); - Owner.WriteVar32(value.GetTimezoneId()); + Owner_.WriteVar64(value.Get<NUdf::TDataType<NUdf::TTzTimestamp>::TLayout>()); + Owner_.WriteVar32(value.GetTimezoneId()); break; } case NUdf::TDataType<NUdf::TInterval>::Id: - Owner.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TInterval>::TLayout>())); + Owner_.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TInterval>::TLayout>())); break; case NUdf::TDataType<NUdf::TDate32>::Id: - Owner.WriteVar32(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TDate32>::TLayout>())); + Owner_.WriteVar32(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TDate32>::TLayout>())); break; case NUdf::TDataType<NUdf::TDatetime64>::Id: - Owner.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TDatetime64>::TLayout>())); + Owner_.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TDatetime64>::TLayout>())); break; case NUdf::TDataType<NUdf::TTimestamp64>::Id: - Owner.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TTimestamp64>::TLayout>())); + Owner_.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TTimestamp64>::TLayout>())); break; case NUdf::TDataType<NUdf::TInterval64>::Id: - Owner.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TInterval64>::TLayout>())); + Owner_.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TInterval64>::TLayout>())); break; case NUdf::TDataType<NUdf::TTzDate32>::Id: { - Owner.WriteVar32(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TTzDate32>::TLayout>())); - Owner.WriteVar32(value.GetTimezoneId()); + Owner_.WriteVar32(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TTzDate32>::TLayout>())); + Owner_.WriteVar32(value.GetTimezoneId()); break; } case NUdf::TDataType<NUdf::TTzDatetime64>::Id: { - Owner.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TTzDatetime64>::TLayout>())); - Owner.WriteVar32(value.GetTimezoneId()); + Owner_.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TTzDatetime64>::TLayout>())); + Owner_.WriteVar32(value.GetTimezoneId()); break; } case NUdf::TDataType<NUdf::TTzTimestamp64>::Id: { - Owner.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TTzTimestamp64>::TLayout>())); - Owner.WriteVar32(value.GetTimezoneId()); + Owner_.WriteVar64(ZigZagEncode(value.Get<NUdf::TDataType<NUdf::TTzTimestamp64>::TLayout>())); + Owner_.WriteVar32(value.GetTimezoneId()); break; } case NUdf::TDataType<NUdf::TUuid>::Id: { const auto v = value.AsStringRef(); - Owner.WriteMany(v.Data(), v.Size()); + Owner_.WriteMany(v.Data(), v.Size()); break; } case NUdf::TDataType<NUdf::TDecimal>::Id: - Owner.WriteMany(static_cast<const char*>(value.GetRawPtr()), sizeof(NYql::NDecimal::TInt128) - 1U); + Owner_.WriteMany(static_cast<const char*>(value.GetRawPtr()), sizeof(NYql::NDecimal::TInt128) - 1U); break; default: { const auto& buffer = value.AsStringRef(); - Owner.WriteVar32(buffer.Size()); - Owner.WriteMany(buffer.Data(), buffer.Size()); + Owner_.WriteVar32(buffer.Size()); + Owner_.WriteMany(buffer.Data(), buffer.Size()); } } } - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TStructLiteral& node) override { @@ -817,8 +817,8 @@ namespace { } } - Owner.WriteMany(immediateFlags.data(), immediateFlags.size()); - Owner.RegisterReference(node); + Owner_.WriteMany(immediateFlags.data(), immediateFlags.size()); + Owner_.RegisterReference(node); } void Visit(TListLiteral& node) override { @@ -830,12 +830,12 @@ namespace { } } - Owner.WriteMany(immediateFlags.data(), immediateFlags.size()); - Owner.RegisterReference(node); + Owner_.WriteMany(immediateFlags.data(), immediateFlags.size()); + Owner_.RegisterReference(node); } void Visit(TOptionalLiteral& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TDictLiteral& node) override { @@ -851,13 +851,13 @@ namespace { } } - Owner.WriteMany(immediateFlags.data(), immediateFlags.size()); - Owner.RegisterReference(node); + Owner_.WriteMany(immediateFlags.data(), immediateFlags.size()); + Owner_.RegisterReference(node); } void Visit(TCallable& node) override { if (node.HasResult()) { - Owner.Write(node.GetResult().IsImmediate() ? 1 : 0); + Owner_.Write(node.GetResult().IsImmediate() ? 1 : 0); } else { auto type = node.GetType(); Y_DEBUG_ABORT_UNLESS(node.GetInputsCount() == type->GetArgumentsCount()); @@ -869,17 +869,17 @@ namespace { } } - Owner.WriteMany(immediateFlags.data(), immediateFlags.size()); + Owner_.WriteMany(immediateFlags.data(), immediateFlags.size()); } if (node.GetUniqueId() != 0) - Owner.WriteVar32(node.GetUniqueId()); + Owner_.WriteVar32(node.GetUniqueId()); - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TAny& node) override { - Owner.RegisterReference(node); + Owner_.RegisterReference(node); } void Visit(TTupleLiteral& node) override { @@ -893,48 +893,48 @@ namespace { } } - Owner.WriteMany(immediateFlags.data(), immediateFlags.size()); - Owner.RegisterReference(node); + Owner_.WriteMany(immediateFlags.data(), immediateFlags.size()); + Owner_.RegisterReference(node); } void Visit(TVariantLiteral& node) override { - Owner.WriteVar32(node.GetIndex()); - Owner.RegisterReference(node); + Owner_.WriteVar32(node.GetIndex()); + Owner_.RegisterReference(node); } private: - TWriter& Owner; + TWriter& Owner_; }; TWriter(THashMap<TInternName, ui32>& names, TVector<TInternName>& nameOrder) { - Names.swap(names); - NameOrder.swap(nameOrder); + Names_.swap(names); + NameOrder_.swap(nameOrder); } void Write(TRuntimeNode node) { Begin(node.IsImmediate()); TPreVisitor preVisitor(*this); TPostVisitor postVisitor(*this); - Stack.push_back(std::make_pair(node.GetNode(), false)); - while (!Stack.empty()) { - auto& nodeAndFlag = Stack.back(); + Stack_.push_back(std::make_pair(node.GetNode(), false)); + while (!Stack_.empty()) { + auto& nodeAndFlag = Stack_.back(); if (!nodeAndFlag.second) { nodeAndFlag.second = true; - auto prevSize = Stack.size(); + auto prevSize = Stack_.size(); nodeAndFlag.first->Accept(preVisitor); if (preVisitor.IsProcessed()) { // ref or small node, some nodes have been added - Y_DEBUG_ABORT_UNLESS(prevSize == Stack.size()); - Stack.pop_back(); + Y_DEBUG_ABORT_UNLESS(prevSize == Stack_.size()); + Stack_.pop_back(); continue; } - Y_DEBUG_ABORT_UNLESS(prevSize <= Stack.size()); + Y_DEBUG_ABORT_UNLESS(prevSize <= Stack_.size()); } else { - auto prevSize = Stack.size(); + auto prevSize = Stack_.size(); nodeAndFlag.first->Accept(postVisitor); - Y_DEBUG_ABORT_UNLESS(prevSize == Stack.size()); - Stack.pop_back(); + Y_DEBUG_ABORT_UNLESS(prevSize == Stack_.size()); + Stack_.pop_back(); } } @@ -942,25 +942,25 @@ namespace { } TString GetOutput() const { - return Out; + return Out_; } private: void Begin(bool isImmediate) { Write(SystemMask | (isImmediate ? (char)ESystemCommand::Begin : (char)ESystemCommand::BeginNotImmediate)); - for (auto it = Names.begin(); it != Names.end();) { + for (auto it = Names_.begin(); it != Names_.end();) { if (it->second <= 1) { - Names.erase(it++); + Names_.erase(it++); } else { ++it; } } - WriteVar32(Names.size()); + WriteVar32(Names_.size()); ui32 nameIndex = 0; - for (const auto& orderedName: NameOrder) { - auto it = Names.find(orderedName); - if (it == Names.end()) { + for (const auto& orderedName: NameOrder_) { + auto it = Names_.find(orderedName); + if (it == Names_.end()) { continue; } const auto& name = it->first; @@ -969,7 +969,7 @@ namespace { it->second = nameIndex++; } - Y_DEBUG_ABORT_UNLESS(nameIndex == Names.size()); + Y_DEBUG_ABORT_UNLESS(nameIndex == Names_.size()); } void End() { @@ -977,24 +977,24 @@ namespace { } void AddChildNode(TNode& node) { - Stack.push_back(std::make_pair(&node, false)); + Stack_.push_back(std::make_pair(&node, false)); } void RegisterReference(TNode& node) { Y_DEBUG_ABORT_UNLESS(node.GetCookie() == 0); - node.SetCookie(++ReferenceCount); + node.SetCookie(++ReferenceCount_); } void WriteReference(TNode& node) { Write(SystemMask | (char)ESystemCommand::Ref); Y_DEBUG_ABORT_UNLESS(node.GetCookie() != 0); - Y_DEBUG_ABORT_UNLESS(node.GetCookie() <= ReferenceCount); + Y_DEBUG_ABORT_UNLESS(node.GetCookie() <= ReferenceCount_); WriteVar32(node.GetCookie() - 1); } void WriteName(TInternName name) { - auto it = Names.find(name); - if (it == Names.end()) { + auto it = Names_.find(name); + if (it == Names_.end()) { WriteVar32(name.Str().size() << 1); WriteMany(name.Str().data(), name.Str().size()); } else { @@ -1003,37 +1003,37 @@ namespace { } Y_FORCE_INLINE void Write(char c) { - Out.append(c); + Out_.append(c); } Y_FORCE_INLINE void WriteMany(const void* buf, size_t len) { - Out.AppendNoAlias((const char*)buf, len); + Out_.AppendNoAlias((const char*)buf, len); } Y_FORCE_INLINE void WriteVar32(ui32 value) { char buf[MAX_PACKED32_SIZE]; - Out.AppendNoAlias(buf, Pack32(value, buf)); + Out_.AppendNoAlias(buf, Pack32(value, buf)); } Y_FORCE_INLINE void WriteVar64(ui64 value) { char buf[MAX_PACKED64_SIZE]; - Out.AppendNoAlias(buf, Pack64(value, buf)); + Out_.AppendNoAlias(buf, Pack64(value, buf)); } private: - TString Out; - ui32 ReferenceCount = 0; - THashMap<TInternName, ui32> Names; - TVector<TInternName> NameOrder; - TVector<std::pair<TNode*, bool>> Stack; + TString Out_; + ui32 ReferenceCount_ = 0; + THashMap<TInternName, ui32> Names_; + TVector<TInternName> NameOrder_; + TVector<std::pair<TNode*, bool>> Stack_; }; class TReader { public: TReader(const TStringBuf& buffer, const TTypeEnvironment& env) - : Current(buffer.data()) - , End(buffer.data() + buffer.size()) - , Env(env) + : Current_(buffer.data()) + , End_(buffer.data() + buffer.size()) + , Env_(env) { } @@ -1052,26 +1052,26 @@ namespace { LoadName(); } - const char* lastPos = Current; - CtxStack.push_back(TNodeContext()); - while (!CtxStack.empty()) { - auto& last = CtxStack.back(); + const char* lastPos = Current_; + CtxStack_.push_back(TNodeContext()); + while (!CtxStack_.empty()) { + auto& last = CtxStack_.back(); if (!last.Start) { - last.Start = Current; + last.Start = Current_; } else { - Current = last.Start; + Current_ = last.Start; } if (last.NextPass == AllPassesDone) { - Y_DEBUG_ABORT_UNLESS(last.ChildCount <= NodeStack.size()); - Reverse(NodeStack.end() - last.ChildCount, NodeStack.end()); + Y_DEBUG_ABORT_UNLESS(last.ChildCount <= NodeStack_.size()); + Reverse(NodeStack_.end() - last.ChildCount, NodeStack_.end()); auto newNode = ReadNode(); - if (Current > lastPos) { - lastPos = Current; + if (Current_ > lastPos) { + lastPos = Current_; } - NodeStack.push_back(std::make_pair(newNode, Current)); - CtxStack.pop_back(); + NodeStack_.push_back(std::make_pair(newNode, Current_)); + CtxStack_.pop_back(); continue; } @@ -1085,14 +1085,14 @@ namespace { const ui32 childCount = res & ~RequiresNextPass; last.ChildCount += childCount; if (childCount != 0) { - CtxStack.insert(CtxStack.end(), childCount, TNodeContext()); + CtxStack_.insert(CtxStack_.end(), childCount, TNodeContext()); } else { Y_DEBUG_ABORT_UNLESS(res == 0); } } - Current = lastPos; - if (NodeStack.size() != 1) + Current_ = lastPos; + if (NodeStack_.size() != 1) ThrowCorrupted(); TNode* node = PopNode(); @@ -1101,7 +1101,7 @@ namespace { if (footer != (SystemMask | (char)ESystemCommand::End)) ThrowCorrupted(); - if (Current != End) + if (Current_ != End_) ThrowCorrupted(); return TRuntimeNode(node, !notImmediate); @@ -1117,38 +1117,38 @@ namespace { } Y_FORCE_INLINE char Read() { - if (Current == End) + if (Current_ == End_) ThrowNoData(); - return *Current++; + return *Current_++; } Y_FORCE_INLINE const char* ReadMany(ui32 count) { - if (Current + count > End) + if (Current_ + count > End_) ThrowNoData(); - const char* result = Current; - Current += count; + const char* result = Current_; + Current_ += count; return result; } Y_FORCE_INLINE ui32 ReadVar32() { ui32 result = 0; - size_t count = Unpack32(Current, End - Current, result); + size_t count = Unpack32(Current_, End_ - Current_, result); if (!count) { ThrowCorrupted(); } - Current += count; + Current_ += count; return result; } Y_FORCE_INLINE ui64 ReadVar64() { ui64 result = 0; - size_t count = Unpack64(Current, End - Current, result); + size_t count = Unpack64(Current_, End_ - Current_, result); if (!count) { ThrowCorrupted(); } - Current += count; + Current_ += count; return result; } @@ -1165,21 +1165,21 @@ namespace { } TNode* PopNode() { - if (NodeStack.empty()) + if (NodeStack_.empty()) ThrowCorrupted(); - auto nodeAndFinish = NodeStack.back(); - NodeStack.pop_back(); - Current = nodeAndFinish.second; + auto nodeAndFinish = NodeStack_.back(); + NodeStack_.pop_back(); + Current_ = nodeAndFinish.second; return nodeAndFinish.first; } TNode* PeekNode(ui32 index) { - if (index >= NodeStack.size()) + if (index >= NodeStack_.size()) ThrowCorrupted(); - auto nodeAndFinish = NodeStack[NodeStack.size() - 1 - index]; - Current = nodeAndFinish.second; + auto nodeAndFinish = NodeStack_[NodeStack_.size() - 1 - index]; + Current_ = nodeAndFinish.second; return nodeAndFinish.first; } @@ -1269,22 +1269,22 @@ namespace { } TNode* ReadTypeType() { - auto node = Env.GetTypeOfTypeLazy(); + auto node = Env_.GetTypeOfTypeLazy(); return node; } TNode* ReadVoidOrEmptyListOrEmptyDictType(char code) { switch ((TType::EKind)(code & TypeMask)) { - case TType::EKind::Void: return Env.GetTypeOfVoidLazy(); - case TType::EKind::EmptyList: return Env.GetTypeOfEmptyListLazy(); - case TType::EKind::EmptyDict: return Env.GetTypeOfEmptyDictLazy(); + case TType::EKind::Void: return Env_.GetTypeOfVoidLazy(); + case TType::EKind::EmptyList: return Env_.GetTypeOfEmptyListLazy(); + case TType::EKind::EmptyDict: return Env_.GetTypeOfEmptyDictLazy(); default: ThrowCorrupted(); } } TNode* ReadNullType() { - auto node = Env.GetTypeOfNullLazy(); + auto node = Env_.GetTypeOfNullLazy(); return node; } @@ -1293,17 +1293,17 @@ namespace { if (NUdf::TDataType<NUdf::TDecimal>::Id == schemeType) { const ui8 precision = Read(); const ui8 scale = Read(); - Nodes.emplace_back(TDataDecimalType::Create(precision, scale, Env)); + Nodes_.emplace_back(TDataDecimalType::Create(precision, scale, Env_)); } else { - Nodes.emplace_back(TDataType::Create(static_cast<NUdf::TDataTypeId>(schemeType), Env)); + Nodes_.emplace_back(TDataType::Create(static_cast<NUdf::TDataTypeId>(schemeType), Env_)); } - return Nodes.back(); + return Nodes_.back(); } TNode* ReadPgType() { const auto typeId = ReadVar32(); - Nodes.emplace_back(TPgType::Create(typeId, Env)); - return Nodes.back(); + Nodes_.emplace_back(TPgType::Create(typeId, Env_)); + return Nodes_.back(); } ui32 TryReadKeyType(char code) { @@ -1340,8 +1340,8 @@ namespace { members[i].Name = ReadName(); } - auto node = TStructType::Create(membersCount, members.data(), Env); - Nodes.push_back(node); + auto node = TStructType::Create(membersCount, members.data(), Env_); + Nodes_.push_back(node); return node; } @@ -1359,16 +1359,16 @@ namespace { TNode* node = nullptr; switch ((TType::EKind)(code & TypeMask)) { case TType::EKind::Tuple: - node = TTupleType::Create(elementsCount, elements.data(), Env); + node = TTupleType::Create(elementsCount, elements.data(), Env_); break; case TType::EKind::Multi: - node = TMultiType::Create(elementsCount, elements.data(), Env); + node = TMultiType::Create(elementsCount, elements.data(), Env_); break; default: ThrowCorrupted(); } - Nodes.push_back(node); + Nodes_.push_back(node); return node; } @@ -1378,8 +1378,8 @@ namespace { ThrowCorrupted(); auto itemType = static_cast<TType*>(itemTypeNode); - auto node = TListType::Create(itemType, Env); - Nodes.push_back(node); + auto node = TListType::Create(itemType, Env_); + Nodes_.push_back(node); return node; } @@ -1389,8 +1389,8 @@ namespace { ThrowCorrupted(); auto itemType = static_cast<TType*>(itemTypeNode); - auto node = TStreamType::Create(itemType, Env); - Nodes.push_back(node); + auto node = TStreamType::Create(itemType, Env_); + Nodes_.push_back(node); return node; } @@ -1409,8 +1409,8 @@ namespace { ThrowCorrupted(); auto itemType = static_cast<TType*>(itemTypeNode); - auto node = TFlowType::Create(itemType, Env); - Nodes.push_back(node); + auto node = TFlowType::Create(itemType, Env_); + Nodes_.push_back(node); return node; } @@ -1429,8 +1429,8 @@ namespace { const auto shape = static_cast<TBlockType::EShape>(shapeChar); auto itemType = static_cast<TType*>(itemTypeNode); - auto node = TBlockType::Create(itemType, shape, Env); - Nodes.push_back(node); + auto node = TBlockType::Create(itemType, shape, Env_); + Nodes_.push_back(node); return node; } @@ -1441,8 +1441,8 @@ namespace { auto tag = ReadName(); auto baseType = static_cast<TType*>(baseTypeNode); - auto node = TTaggedType::Create(baseType, tag, Env); - Nodes.push_back(node); + auto node = TTaggedType::Create(baseType, tag, Env_); + Nodes_.push_back(node); return node; } @@ -1452,8 +1452,8 @@ namespace { ThrowCorrupted(); auto itemType = static_cast<TType*>(itemTypeNode); - auto node = TOptionalType::Create(itemType, Env); - Nodes.push_back(node); + auto node = TOptionalType::Create(itemType, Env_); + Nodes_.push_back(node); return node; } @@ -1486,8 +1486,8 @@ namespace { ThrowCorrupted(); auto payloadType = static_cast<TType*>(payloadTypeNode); - auto node = TDictType::Create(keyType, payloadType, Env); - Nodes.push_back(node); + auto node = TDictType::Create(keyType, payloadType, Env_); + Nodes_.push_back(node); return node; } @@ -1524,24 +1524,24 @@ namespace { auto name = ReadName(); const ui32 optArgsCount = ReadVar32(); - auto node = TCallableType::Create(returnType, name, argumentsCount, arguments.data(), payload, Env); + auto node = TCallableType::Create(returnType, name, argumentsCount, arguments.data(), payload, Env_); if (isMergeDisabled) node->DisableMerge(); node->SetOptionalArgumentsCount(optArgsCount); - Nodes.push_back(node); + Nodes_.push_back(node); return node; } TNode* ReadAnyType() { - auto node = Env.GetAnyTypeLazy(); + auto node = Env_.GetAnyTypeLazy(); return node; } TNode* ReadResourceType() { auto tag = ReadName(); - auto node = TResourceType::Create(tag, Env); - Nodes.push_back(node); + auto node = TResourceType::Create(tag, Env_); + Nodes_.push_back(node); return node; } @@ -1551,8 +1551,8 @@ namespace { ThrowCorrupted(); auto underlyingType = static_cast<TType*>(underlyingTypeNode); - auto node = TVariantType::Create(underlyingType, Env); - Nodes.push_back(node); + auto node = TVariantType::Create(underlyingType, Env_); + Nodes_.push_back(node); return node; } @@ -1622,16 +1622,16 @@ namespace { TNode* ReadVoid(char code) { switch ((TType::EKind)(code & TypeMask)) { - case TType::EKind::Void: return Env.GetVoidLazy(); - case TType::EKind::EmptyList: return Env.GetEmptyListLazy(); - case TType::EKind::EmptyDict: return Env.GetEmptyDictLazy(); + case TType::EKind::Void: return Env_.GetVoidLazy(); + case TType::EKind::EmptyList: return Env_.GetEmptyListLazy(); + case TType::EKind::EmptyDict: return Env_.GetEmptyDictLazy(); default: ThrowCorrupted(); } } TNode* ReadNull() { - auto node = Env.GetNullLazy(); + auto node = Env_.GetNullLazy(); return node; } @@ -1792,7 +1792,7 @@ namespace { case NUdf::TDataType<NUdf::TUuid>::Id: { const char* buffer = ReadMany(16); - value = Env.NewStringValue(NUdf::TStringRef(buffer, 16)); + value = Env_.NewStringValue(NUdf::TStringRef(buffer, 16)); break; } case NUdf::TDataType<NUdf::TDecimal>::Id: @@ -1805,12 +1805,12 @@ namespace { default: const ui32 size = ReadVar32(); const char* buffer = ReadMany(size); - value = Env.NewStringValue(NUdf::TStringRef(buffer, size)); + value = Env_.NewStringValue(NUdf::TStringRef(buffer, size)); break; } - const auto node = TDataLiteral::Create(value, dataType, Env); - Nodes.emplace_back(node); + const auto node = TDataLiteral::Create(value, dataType, Env_); + Nodes_.emplace_back(node); return node; } @@ -1863,8 +1863,8 @@ namespace { values[i] = TRuntimeNode(values[i].GetNode(), GetBitmapBit(immediateFlags, i)); } - auto node = TStructLiteral::Create(valuesCount, values.data(), structType, Env); - Nodes.push_back(node); + auto node = TStructLiteral::Create(valuesCount, values.data(), structType, Env_); + Nodes_.push_back(node); return node; } @@ -1906,8 +1906,8 @@ namespace { values[i] = TRuntimeNode(values[i].GetNode(), GetBitmapBit(immediateFlags, i)); } - auto node = TTupleLiteral::Create(valuesCount, values.data(), tupleType, Env); - Nodes.push_back(node); + auto node = TTupleLiteral::Create(valuesCount, values.data(), tupleType, Env_); + Nodes_.push_back(node); return node; } @@ -1939,8 +1939,8 @@ namespace { x = TRuntimeNode(x.GetNode(), GetBitmapBit(immediateFlags, i)); } - auto node = TListLiteral::Create(items.data(), items.size(), listType, Env); - Nodes.push_back(node); + auto node = TListLiteral::Create(items.data(), items.size(), listType, Env_); + Nodes_.push_back(node); return node; } @@ -1963,12 +1963,12 @@ namespace { TNode* node; if (hasItem) { auto item = PopNode(); - node = TOptionalLiteral::Create(TRuntimeNode(item, isItemImmediate), optionalType, Env); + node = TOptionalLiteral::Create(TRuntimeNode(item, isItemImmediate), optionalType, Env_); } else { - node = TOptionalLiteral::Create(optionalType, Env); + node = TOptionalLiteral::Create(optionalType, Env_); } - Nodes.push_back(node); + Nodes_.push_back(node); return node; } @@ -2001,8 +2001,8 @@ namespace { items[i].second = TRuntimeNode(items[i].second.GetNode(), GetBitmapBit(immediateFlags, 2 * i + 1)); } - auto node = TDictLiteral::Create(itemsCount, items.data(), dictType, Env); - Nodes.push_back(node); + auto node = TDictLiteral::Create(itemsCount, items.data(), dictType, Env_); + Nodes_.push_back(node); return node; } @@ -2044,7 +2044,7 @@ namespace { auto resultNode = PopNode(); const bool isResultImmediate = (Read() != 0); - node = TCallable::Create(TRuntimeNode(resultNode, isResultImmediate), callableType, Env); + node = TCallable::Create(TRuntimeNode(resultNode, isResultImmediate), callableType, Env_); } else { const ui32 inputsCount = callableType->GetArgumentsCount(); TStackVec<TRuntimeNode> inputs(inputsCount); @@ -2058,14 +2058,14 @@ namespace { inputs[i] = TRuntimeNode(inputs[i].GetNode(), GetBitmapBit(immediateFlags, i)); } - node = TCallable::Create(inputsCount, inputs.data(), callableType, Env); + node = TCallable::Create(inputsCount, inputs.data(), callableType, Env_); } if (hasUniqueId) { node->SetUniqueId(ReadVar32()); } - Nodes.push_back(node); + Nodes_.push_back(node); return node; } @@ -2077,13 +2077,13 @@ namespace { TNode* ReadAny(char code) { const bool hasItem = (code & UserMarker1) != 0; const bool isItemImmediate = (code & UserMarker2) != 0; - TAny* node = TAny::Create(Env); + TAny* node = TAny::Create(Env_); if (hasItem) { auto item = PopNode(); node->SetItem(TRuntimeNode(item, isItemImmediate)); } - Nodes.push_back(node); + Nodes_.push_back(node); return node; } @@ -2099,9 +2099,9 @@ namespace { auto variantType = static_cast<TVariantType*>(type); auto item = PopNode(); ui32 index = ReadVar32(); - TNode* node = TVariantLiteral::Create(TRuntimeNode(item, isItemImmediate), index, variantType, Env); + TNode* node = TVariantLiteral::Create(TRuntimeNode(item, isItemImmediate), index, variantType, Env_); - Nodes.push_back(node); + Nodes_.push_back(node); return node; } @@ -2125,26 +2125,26 @@ namespace { TNode* ReadReference() { const ui32 index = ReadVar32(); - if (index >= Nodes.size()) + if (index >= Nodes_.size()) ThrowCorrupted(); - return Nodes[index]; + return Nodes_[index]; } void LoadName() { const ui32 length = ReadVar32(); const char* buffer = ReadMany(length); TStringBuf name(buffer, buffer + length); - Names.push_back(name); + Names_.push_back(name); } TStringBuf ReadName() { const ui32 nameDescriptor = ReadVar32(); if (nameDescriptor & NameRefMark) { const ui32 nameIndex = nameDescriptor >> 1; - if (nameIndex >= Names.size()) + if (nameIndex >= Names_.size()) ThrowCorrupted(); - return Names[nameIndex]; + return Names_[nameIndex]; } else { const ui32 length = nameDescriptor >> 1; const char* buffer = ReadMany(length); @@ -2166,13 +2166,13 @@ namespace { } }; - const char* Current; - const char* const End; - const TTypeEnvironment& Env; - TVector<TNode*> Nodes; - TVector<TStringBuf> Names; - TVector<TNodeContext> CtxStack; - TVector<std::pair<TNode*, const char*>> NodeStack; + const char* Current_; + const char* const End_; + const TTypeEnvironment& Env_; + TVector<TNode*> Nodes_; + TVector<TStringBuf> Names_; + TVector<TNodeContext> CtxStack_; + TVector<std::pair<TNode*, const char*>> NodeStack_; }; } diff --git a/yql/essentials/minikql/mkql_node_visitor.cpp b/yql/essentials/minikql/mkql_node_visitor.cpp index 5f1ea4c36d5..40c55520dbe 100644 --- a/yql/essentials/minikql/mkql_node_visitor.cpp +++ b/yql/essentials/minikql/mkql_node_visitor.cpp @@ -511,39 +511,39 @@ void TExploringNodeVisitor::Visit(TMultiType& node) { } void TExploringNodeVisitor::AddChildNode(TNode* parent, TNode& child) { - Stack->push_back(&child); + Stack_->push_back(&child); - if (BuildConsumersMap) { + if (BuildConsumersMap_) { if (parent != nullptr) { - ConsumersMap[&child].push_back(parent); + ConsumersMap_[&child].push_back(parent); } else { - ConsumersMap[&child] = {}; + ConsumersMap_[&child] = {}; } } } void TExploringNodeVisitor::Clear() { - NodeList.clear(); - Stack = nullptr; - ConsumersMap.clear(); + NodeList_.clear(); + Stack_ = nullptr; + ConsumersMap_.clear(); } void TExploringNodeVisitor::Walk(TNode* root, std::vector<TNode*>& nodeStack, const std::vector<TNode*>& terminalNodes, bool buildConsumersMap, size_t nodesCountHint) { - BuildConsumersMap = buildConsumersMap; + BuildConsumersMap_ = buildConsumersMap; Clear(); - if (BuildConsumersMap && nodesCountHint) { - ConsumersMap.reserve(nodesCountHint); + if (BuildConsumersMap_ && nodesCountHint) { + ConsumersMap_.reserve(nodesCountHint); } - Stack = &nodeStack; - Stack->clear(); + Stack_ = &nodeStack; + Stack_->clear(); AddChildNode(nullptr, *root); - while (!Stack->empty()) { - auto node = Stack->back(); + while (!Stack_->empty()) { + auto node = Stack_->back(); if (node->GetCookie() == 0) { node->SetCookie(IS_NODE_ENTERED); @@ -553,22 +553,22 @@ void TExploringNodeVisitor::Walk(TNode* root, std::vector<TNode*>& nodeStack, co } } else { if (node->GetCookie() == IS_NODE_ENTERED) { - NodeList.push_back(node); + NodeList_.push_back(node); node->SetCookie(IS_NODE_EXITED); } else { Y_ABORT_UNLESS(node->GetCookie() <= IS_NODE_EXITED, "TNode graph should not be reused"); } - Stack->pop_back(); + Stack_->pop_back(); continue; } } - for (auto node : NodeList) { + for (auto node : NodeList_) { node->SetCookie(0); } - Stack = nullptr; + Stack_ = nullptr; } void TExploringNodeVisitor::Walk(TNode* root, const TTypeEnvironment& env, const std::vector<TNode*>& terminalNodes, @@ -577,13 +577,13 @@ void TExploringNodeVisitor::Walk(TNode* root, const TTypeEnvironment& env, const } const std::vector<TNode*>& TExploringNodeVisitor::GetNodes() { - return NodeList; + return NodeList_; } const TExploringNodeVisitor::TNodesVec& TExploringNodeVisitor::GetConsumerNodes(TNode& node) { - Y_ABORT_UNLESS(BuildConsumersMap); - const auto consumers = ConsumersMap.find(&node); - Y_ABORT_UNLESS(consumers != ConsumersMap.cend()); + Y_ABORT_UNLESS(BuildConsumersMap_); + const auto consumers = ConsumersMap_.find(&node); + Y_ABORT_UNLESS(consumers != ConsumersMap_.cend()); return consumers->second; } diff --git a/yql/essentials/minikql/mkql_node_visitor.h b/yql/essentials/minikql/mkql_node_visitor.h index 0c6885b2fb3..df4982c2e96 100644 --- a/yql/essentials/minikql/mkql_node_visitor.h +++ b/yql/essentials/minikql/mkql_node_visitor.h @@ -182,10 +182,10 @@ private: void AddChildNode(TNode* parent, TNode& child); private: - std::vector<TNode*> NodeList; - std::vector<TNode*>* Stack = nullptr; - bool BuildConsumersMap = false; - std::unordered_map<TNode*, TNodesVec> ConsumersMap; + std::vector<TNode*> NodeList_; + std::vector<TNode*>* Stack_ = nullptr; + bool BuildConsumersMap_ = false; + std::unordered_map<TNode*, TNodesVec> ConsumersMap_; }; class TTypeEnvironment; diff --git a/yql/essentials/minikql/mkql_program_builder.cpp b/yql/essentials/minikql/mkql_program_builder.cpp index ce74bfdcbeb..cebc1dc1cb4 100644 --- a/yql/essentials/minikql/mkql_program_builder.cpp +++ b/yql/essentials/minikql/mkql_program_builder.cpp @@ -341,17 +341,17 @@ std::vector<TType*> ValidateBlockFlowType(const TType* flowType, bool unwrap) { TProgramBuilder::TProgramBuilder(const TTypeEnvironment& env, const IFunctionRegistry& functionRegistry, bool voidWithEffects, NYql::TLangVersion langver) : TTypeBuilder(env) - , FunctionRegistry(functionRegistry) - , VoidWithEffects(voidWithEffects) - , LangVer(langver) + , FunctionRegistry_(functionRegistry) + , VoidWithEffects_(voidWithEffects) + , LangVer_(langver) {} const TTypeEnvironment& TProgramBuilder::GetTypeEnvironment() const { - return Env; + return Env_; } const IFunctionRegistry& TProgramBuilder::GetFunctionRegistry() const { - return FunctionRegistry; + return FunctionRegistry_; } TType* TProgramBuilder::ChooseCommonType(TType* type1, TType* type2) { @@ -402,12 +402,12 @@ TType* TProgramBuilder::BuildArithmeticCommonType(TType* type1, TType* type2) { } TRuntimeNode TProgramBuilder::Arg(TType* type) const { - TCallableBuilder builder(Env, __func__, type, true); + TCallableBuilder builder(Env_, __func__, type, true); return TRuntimeNode(builder.Build(), false); } TRuntimeNode TProgramBuilder::WideFlowArg(TType* type) const { - TCallableBuilder builder(Env, __func__, type, true); + TCallableBuilder builder(Env_, __func__, type, true); return TRuntimeNode(builder.Build(), false); } @@ -420,7 +420,7 @@ TRuntimeNode TProgramBuilder::Member(TRuntimeNode structObj, const std::string_v memberType = NewOptionalType(memberType); } - TCallableBuilder callableBuilder(Env, __func__, memberType); + TCallableBuilder callableBuilder(Env_, __func__, memberType); callableBuilder.Add(structObj); callableBuilder.Add(NewDataLiteral<ui32>(memberIndex)); return TRuntimeNode(callableBuilder.Build(), false); @@ -435,7 +435,7 @@ TRuntimeNode TProgramBuilder::AddMember(TRuntimeNode structObj, const std::strin MKQL_ENSURE(oldType->IsStruct(), "Expected struct"); const auto& oldTypeDetailed = static_cast<const TStructType&>(*oldType); - TStructTypeBuilder newTypeBuilder(Env); + TStructTypeBuilder newTypeBuilder(Env_); newTypeBuilder.Reserve(oldTypeDetailed.GetMembersCount() + 1); for (ui32 i = 0, e = oldTypeDetailed.GetMembersCount(); i < e; ++i) { newTypeBuilder.Add(oldTypeDetailed.GetMemberName(i), oldTypeDetailed.GetMemberType(i)); @@ -446,7 +446,7 @@ TRuntimeNode TProgramBuilder::AddMember(TRuntimeNode structObj, const std::strin for (ui32 i = 0, e = newType->GetMembersCount(); i < e; ++i) { if (newType->GetMemberName(i) == memberName) { // insert at position i in the struct - TCallableBuilder callableBuilder(Env, __func__, newType); + TCallableBuilder callableBuilder(Env_, __func__, newType); callableBuilder.Add(structObj); callableBuilder.Add(memberValue); callableBuilder.Add(NewDataLiteral<ui32>(i)); @@ -464,7 +464,7 @@ TRuntimeNode TProgramBuilder::RemoveMember(TRuntimeNode structObj, const std::st const auto& oldTypeDetailed = static_cast<const TStructType&>(*oldType); MKQL_ENSURE(oldTypeDetailed.GetMembersCount() > 0, "Expected non-empty struct"); - TStructTypeBuilder newTypeBuilder(Env); + TStructTypeBuilder newTypeBuilder(Env_); newTypeBuilder.Reserve(oldTypeDetailed.GetMembersCount() - 1); std::optional<ui32> memberIndex; for (ui32 i = 0, e = oldTypeDetailed.GetMembersCount(); i < e; ++i) { @@ -483,7 +483,7 @@ TRuntimeNode TProgramBuilder::RemoveMember(TRuntimeNode structObj, const std::st // remove at position i in the struct auto newType = newTypeBuilder.Build(); - TCallableBuilder callableBuilder(Env, __func__, newType); + TCallableBuilder callableBuilder(Env_, __func__, newType); callableBuilder.Add(structObj); callableBuilder.Add(NewDataLiteral<ui32>(*memberIndex)); return TRuntimeNode(callableBuilder.Build(), false); @@ -491,14 +491,14 @@ TRuntimeNode TProgramBuilder::RemoveMember(TRuntimeNode structObj, const std::st TRuntimeNode TProgramBuilder::Zip(const TArrayRef<const TRuntimeNode>& lists) { if (lists.empty()) { - return NewEmptyList(Env.GetEmptyTupleLazy()->GetGenericType()); + return NewEmptyList(Env_.GetEmptyTupleLazy()->GetGenericType()); } std::vector<TType*> tupleTypes; tupleTypes.reserve(lists.size()); for (auto& list : lists) { if (list.GetStaticType()->IsEmptyList()) { - tupleTypes.push_back(Env.GetTypeOfVoidLazy()); + tupleTypes.push_back(Env_.GetTypeOfVoidLazy()); continue; } @@ -507,8 +507,8 @@ TRuntimeNode TProgramBuilder::Zip(const TArrayRef<const TRuntimeNode>& lists) { tupleTypes.push_back(itemType); } - auto returnType = TListType::Create(TTupleType::Create(tupleTypes.size(), tupleTypes.data(), Env), Env); - TCallableBuilder callableBuilder(Env, __func__, returnType); + auto returnType = TListType::Create(TTupleType::Create(tupleTypes.size(), tupleTypes.data(), Env_), Env_); + TCallableBuilder callableBuilder(Env_, __func__, returnType); for (auto& list : lists) { callableBuilder.Add(list); } @@ -518,24 +518,24 @@ TRuntimeNode TProgramBuilder::Zip(const TArrayRef<const TRuntimeNode>& lists) { TRuntimeNode TProgramBuilder::ZipAll(const TArrayRef<const TRuntimeNode>& lists) { if (lists.empty()) { - return NewEmptyList(Env.GetEmptyTupleLazy()->GetGenericType()); + return NewEmptyList(Env_.GetEmptyTupleLazy()->GetGenericType()); } std::vector<TType*> tupleTypes; tupleTypes.reserve(lists.size()); for (auto& list : lists) { if (list.GetStaticType()->IsEmptyList()) { - tupleTypes.push_back(TOptionalType::Create(Env.GetTypeOfVoidLazy(), Env)); + tupleTypes.push_back(TOptionalType::Create(Env_.GetTypeOfVoidLazy(), Env_)); continue; } AS_TYPE(TListType, list.GetStaticType()); auto itemType = static_cast<const TListType&>(*list.GetStaticType()).GetItemType(); - tupleTypes.push_back(TOptionalType::Create(itemType, Env)); + tupleTypes.push_back(TOptionalType::Create(itemType, Env_)); } - auto returnType = TListType::Create(TTupleType::Create(tupleTypes.size(), tupleTypes.data(), Env), Env); - TCallableBuilder callableBuilder(Env, __func__, returnType); + auto returnType = TListType::Create(TTupleType::Create(tupleTypes.size(), tupleTypes.data(), Env_), Env_); + TCallableBuilder callableBuilder(Env_, __func__, returnType); for (auto& list : lists) { callableBuilder.Add(list); } @@ -553,7 +553,7 @@ TRuntimeNode TProgramBuilder::Enumerate(TRuntimeNode list, TRuntimeNode start, T const std::array<TType*, 2U> tupleTypes = {{ NewDataType(NUdf::EDataSlot::Uint64), itemType }}; const auto returnType = NewListType(NewTupleType(tupleTypes)); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(list); callableBuilder.Add(start); callableBuilder.Add(step); @@ -573,7 +573,7 @@ TRuntimeNode TProgramBuilder::Fold(TRuntimeNode list, TRuntimeNode state, const const auto newState = handler(itemArg, stateNodeArg); MKQL_ENSURE(newState.GetStaticType()->IsSameType(*state.GetStaticType()), "State type is changed by the handler"); - TCallableBuilder callableBuilder(Env, __func__, state.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, state.GetStaticType()); callableBuilder.Add(list); callableBuilder.Add(state); callableBuilder.Add(itemArg); @@ -593,7 +593,7 @@ TRuntimeNode TProgramBuilder::Fold1(TRuntimeNode list, const TUnaryLambda& init, MKQL_ENSURE(newState.GetStaticType()->IsSameType(*initState.GetStaticType()), "State type is changed by the handler"); - TCallableBuilder callableBuilder(Env, __func__, NewOptionalType(newState.GetStaticType())); + TCallableBuilder callableBuilder(Env_, __func__, NewOptionalType(newState.GetStaticType())); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(initState); @@ -626,7 +626,7 @@ TRuntimeNode TProgramBuilder::Reduce(TRuntimeNode list, TRuntimeNode state1, const auto newState3 = handler3(itemState2Arg, state3NodeArg); MKQL_ENSURE(newState3.GetStaticType()->IsSameType(*state3.GetStaticType()), "State 3 type is changed by the handler"); - TCallableBuilder callableBuilder(Env, __func__, newState3.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, newState3.GetStaticType()); callableBuilder.Add(list); callableBuilder.Add(state1); callableBuilder.Add(state3); @@ -662,7 +662,7 @@ TRuntimeNode TProgramBuilder::Condense(TRuntimeNode flow, TRuntimeNode state, const auto newState = handler(itemArg, stateArg); MKQL_ENSURE(newState.GetStaticType()->IsSameType(*state.GetStaticType()), "State type is changed by the handler"); - TCallableBuilder callableBuilder(Env, __func__, flowType->IsFlow() ? NewFlowType(state.GetStaticType()) : NewStreamType(state.GetStaticType())); + TCallableBuilder callableBuilder(Env_, __func__, flowType->IsFlow() ? NewFlowType(state.GetStaticType()) : NewStreamType(state.GetStaticType())); callableBuilder.Add(flow); callableBuilder.Add(state); callableBuilder.Add(itemArg); @@ -700,7 +700,7 @@ TRuntimeNode TProgramBuilder::Condense1(TRuntimeNode flow, const TUnaryLambda& i MKQL_ENSURE(newState.GetStaticType()->IsSameType(*initState.GetStaticType()), "State type is changed by the handler"); - TCallableBuilder callableBuilder(Env, __func__, flowType->IsFlow() ? NewFlowType(newState.GetStaticType()) : NewStreamType(newState.GetStaticType())); + TCallableBuilder callableBuilder(Env_, __func__, flowType->IsFlow() ? NewFlowType(newState.GetStaticType()) : NewStreamType(newState.GetStaticType())); callableBuilder.Add(flow); callableBuilder.Add(itemArg); callableBuilder.Add(initState); @@ -740,7 +740,7 @@ TRuntimeNode TProgramBuilder::Squeeze(TRuntimeNode stream, TRuntimeNode state, saveArg = outSave = loadArg = outLoad = NewVoid(); } - TCallableBuilder callableBuilder(Env, __func__, TStreamType::Create(state.GetStaticType(), Env)); + TCallableBuilder callableBuilder(Env_, __func__, TStreamType::Create(state.GetStaticType(), Env_)); callableBuilder.Add(stream); callableBuilder.Add(state); callableBuilder.Add(itemArg); @@ -780,7 +780,7 @@ TRuntimeNode TProgramBuilder::Squeeze1(TRuntimeNode stream, const TUnaryLambda& saveArg = outSave = loadArg = outLoad = NewVoid(); } - TCallableBuilder callableBuilder(Env, __func__, NewStreamType(newState.GetStaticType())); + TCallableBuilder callableBuilder(Env_, __func__, NewStreamType(newState.GetStaticType())); callableBuilder.Add(stream); callableBuilder.Add(itemArg); callableBuilder.Add(initState); @@ -797,7 +797,7 @@ TRuntimeNode TProgramBuilder::Discard(TRuntimeNode stream) { const auto streamType = stream.GetStaticType(); MKQL_ENSURE(streamType->IsStream() || streamType->IsFlow(), "Expected stream or flow."); - TCallableBuilder callableBuilder(Env, __func__, streamType); + TCallableBuilder callableBuilder(Env_, __func__, streamType); callableBuilder.Add(stream); return TRuntimeNode(callableBuilder.Build(), false); } @@ -820,7 +820,7 @@ TRuntimeNode TProgramBuilder::MapNext(TRuntimeNode list, const TBinaryLambda& ha ThrowIfListOfVoid(itemType); - TType* nextItemType = TOptionalType::Create(itemType, Env); + TType* nextItemType = TOptionalType::Create(itemType, Env_); const auto itemArg = Arg(itemType); const auto nextItemArg = Arg(nextItemType); @@ -828,10 +828,10 @@ TRuntimeNode TProgramBuilder::MapNext(TRuntimeNode list, const TBinaryLambda& ha const auto newItem = handler(itemArg, nextItemArg); const auto resultListType = listType->IsFlow() ? - (TType*)TFlowType::Create(newItem.GetStaticType(), Env): - (TType*)TStreamType::Create(newItem.GetStaticType(), Env); + (TType*)TFlowType::Create(newItem.GetStaticType(), Env_): + (TType*)TStreamType::Create(newItem.GetStaticType(), Env_); - TCallableBuilder callableBuilder(Env, __func__, resultListType); + TCallableBuilder callableBuilder(Env_, __func__, resultListType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(nextItemArg); @@ -890,14 +890,14 @@ TRuntimeNode TProgramBuilder::ChainMap(TRuntimeNode list, TRuntimeNode state, co const auto resultItemType = std::get<0U>(newItemAndState).GetStaticType(); TType* resultListType = nullptr; if (listType->IsFlow()) { - resultListType = TFlowType::Create(resultItemType, Env); + resultListType = TFlowType::Create(resultItemType, Env_); } else if (listType->IsList()) { - resultListType = TListType::Create(resultItemType, Env); + resultListType = TListType::Create(resultItemType, Env_); } else if (listType->IsStream()) { - resultListType = TStreamType::Create(resultItemType, Env); + resultListType = TStreamType::Create(resultItemType, Env_); } - TCallableBuilder callableBuilder(Env, __func__, resultListType); + TCallableBuilder callableBuilder(Env_, __func__, resultListType); callableBuilder.Add(list); callableBuilder.Add(state); callableBuilder.Add(itemArg); @@ -938,11 +938,11 @@ TRuntimeNode TProgramBuilder::Chain1Map(TRuntimeNode list, const TUnarySplitLamb const auto stateType = std::get<1U>(initItemAndState).GetStaticType();; TType* resultListType = nullptr; if (listType->IsFlow()) { - resultListType = TFlowType::Create(resultItemType, Env); + resultListType = TFlowType::Create(resultItemType, Env_); } else if (listType->IsList()) { - resultListType = TListType::Create(resultItemType, Env); + resultListType = TListType::Create(resultItemType, Env_); } else if (listType->IsStream()) { - resultListType = TStreamType::Create(resultItemType, Env); + resultListType = TStreamType::Create(resultItemType, Env_); } const auto stateArg = Arg(stateType); @@ -950,7 +950,7 @@ TRuntimeNode TProgramBuilder::Chain1Map(TRuntimeNode list, const TUnarySplitLamb MKQL_ENSURE(std::get<0U>(updateItemAndState).GetStaticType()->IsSameType(*resultItemType), "Item type is changed by the handler"); MKQL_ENSURE(std::get<1U>(updateItemAndState).GetStaticType()->IsSameType(*stateType), "State type is changed by the handler"); - TCallableBuilder callableBuilder(Env, __func__, resultListType); + TCallableBuilder callableBuilder(Env_, __func__, resultListType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(std::get<0U>(initItemAndState)); @@ -974,7 +974,7 @@ TRuntimeNode TProgramBuilder::Iterable(TZeroLambda lambda) { const auto itemArg = Arg(NewNull().GetStaticType()); auto lambdaRes = lambda(); const auto resultType = NewListType(AS_TYPE(TStreamType, lambdaRes.GetStaticType())->GetItemType()); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(lambdaRes); callableBuilder.Add(itemArg); return TRuntimeNode(callableBuilder.Build(), false); @@ -986,14 +986,14 @@ TRuntimeNode TProgramBuilder::ToOptional(TRuntimeNode list) { TRuntimeNode TProgramBuilder::Head(TRuntimeNode list) { const auto resultType = NewOptionalType(AS_TYPE(TListType, list.GetStaticType())->GetItemType()); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::Last(TRuntimeNode list) { const auto resultType = NewOptionalType(AS_TYPE(TListType, list.GetStaticType())->GetItemType()); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1080,7 +1080,7 @@ TRuntimeNode TProgramBuilder::BuildListSort(const std::string_view& callableName } } - TCallableBuilder callableBuilder(Env, callableName, listType); + TCallableBuilder callableBuilder(Env_, callableName, listType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(key); @@ -1117,7 +1117,7 @@ TRuntimeNode TProgramBuilder::BuildListNth(const std::string_view& callableName, } } - TCallableBuilder callableBuilder(Env, callableName, listType); + TCallableBuilder callableBuilder(Env_, callableName, listType); callableBuilder.Add(list); callableBuilder.Add(n); callableBuilder.Add(itemArg); @@ -1190,7 +1190,7 @@ TRuntimeNode TProgramBuilder::BuildTake(const std::string_view& callableName, TR MKQL_ENSURE(count.GetStaticType()->IsData(), "Expected data"); MKQL_ENSURE(static_cast<const TDataType&>(*count.GetStaticType()).GetSchemeType() == NUdf::TDataType<ui64>::Id, "Expected ui64"); - TCallableBuilder callableBuilder(Env, callableName, listType); + TCallableBuilder callableBuilder(Env_, callableName, listType); callableBuilder.Add(flow); callableBuilder.Add(count); return TRuntimeNode(callableBuilder.Build(), false); @@ -1369,7 +1369,7 @@ TRuntimeNode TProgramBuilder::BuildContainerProperty(const std::string_view& cal ThrowIfListOfVoid(itemType); } - TCallableBuilder callableBuilder(Env, callableName, NewDataType(NUdf::TDataType<ResultType>::Id)); + TCallableBuilder callableBuilder(Env_, callableName, NewDataType(NUdf::TDataType<ResultType>::Id)); callableBuilder.Add(listOrDict); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1380,7 +1380,7 @@ TRuntimeNode TProgramBuilder::Length(TRuntimeNode listOrDict) { TRuntimeNode TProgramBuilder::Iterator(TRuntimeNode list, const TArrayRef<const TRuntimeNode>& dependentNodes) { const auto streamType = NewStreamType(AS_TYPE(TListType, list.GetStaticType())->GetItemType()); - TCallableBuilder callableBuilder(Env, __func__, streamType); + TCallableBuilder callableBuilder(Env_, __func__, streamType); callableBuilder.Add(list); for (auto node : dependentNodes) { callableBuilder.Add(node); @@ -1390,7 +1390,7 @@ TRuntimeNode TProgramBuilder::Iterator(TRuntimeNode list, const TArrayRef<const TRuntimeNode TProgramBuilder::EmptyIterator(TType* streamType) { MKQL_ENSURE(streamType->IsStream() || streamType->IsFlow(), "Expected stream or flow."); - TCallableBuilder callableBuilder(Env, __func__, streamType); + TCallableBuilder callableBuilder(Env_, __func__, streamType); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1407,7 +1407,7 @@ TRuntimeNode TProgramBuilder::Collect(TRuntimeNode flow) { THROW yexception() << "Expected flow, list or stream."; } - TCallableBuilder callableBuilder(Env, __func__, NewListType(itemType)); + TCallableBuilder callableBuilder(Env_, __func__, NewListType(itemType)); callableBuilder.Add(flow); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1417,7 +1417,7 @@ TRuntimeNode TProgramBuilder::LazyList(TRuntimeNode list) { bool isOptional; const auto listType = UnpackOptional(type, isOptional); MKQL_ENSURE(listType->IsList(), "Expected list"); - TCallableBuilder callableBuilder(Env, __func__, type); + TCallableBuilder callableBuilder(Env_, __func__, type); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1425,7 +1425,7 @@ TRuntimeNode TProgramBuilder::LazyList(TRuntimeNode list) { TRuntimeNode TProgramBuilder::ForwardList(TRuntimeNode stream) { const auto type = stream.GetStaticType(); MKQL_ENSURE(type->IsStream() || type->IsFlow(), "Expected flow or stream."); - TCallableBuilder callableBuilder(Env, __func__, NewListType(type->IsFlow() ? AS_TYPE(TFlowType, stream)->GetItemType() : AS_TYPE(TStreamType, stream)->GetItemType())); + TCallableBuilder callableBuilder(Env_, __func__, NewListType(type->IsFlow() ? AS_TYPE(TFlowType, stream)->GetItemType() : AS_TYPE(TStreamType, stream)->GetItemType())); callableBuilder.Add(stream); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1435,20 +1435,20 @@ TRuntimeNode TProgramBuilder::ToFlow(TRuntimeNode stream) { MKQL_ENSURE(type->IsStream() || type->IsList() || type->IsOptional(), "Expected stream, list or optional."); const auto itemType = type->IsStream() ? AS_TYPE(TStreamType, stream)->GetItemType() : type->IsList() ? AS_TYPE(TListType, stream)->GetItemType() : AS_TYPE(TOptionalType, stream)->GetItemType(); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(itemType)); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(itemType)); callableBuilder.Add(stream); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::FromFlow(TRuntimeNode flow) { MKQL_ENSURE(flow.GetStaticType()->IsFlow(), "Expected flow."); - TCallableBuilder callableBuilder(Env, __func__, NewStreamType(AS_TYPE(TFlowType, flow)->GetItemType())); + TCallableBuilder callableBuilder(Env_, __func__, NewStreamType(AS_TYPE(TFlowType, flow)->GetItemType())); callableBuilder.Add(flow); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::Steal(TRuntimeNode input) { - TCallableBuilder callableBuilder(Env, __func__, input.GetStaticType(), true); + TCallableBuilder callableBuilder(Env_, __func__, input.GetStaticType(), true); callableBuilder.Add(input); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1457,7 +1457,7 @@ TRuntimeNode TProgramBuilder::ToBlocks(TRuntimeNode flow) { auto* flowType = AS_TYPE(TFlowType, flow.GetStaticType()); auto* blockType = NewBlockType(flowType->GetItemType(), TBlockType::EShape::Many); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(blockType)); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(blockType)); callableBuilder.Add(flow); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1483,14 +1483,14 @@ TRuntimeNode TProgramBuilder::WideToBlocks(TRuntimeNode stream) { const auto inputFlow = ToFlow(stream); const auto wideComponents = GetWideComponents(AS_TYPE(TFlowType, inputFlow.GetStaticType())); TType* outputMultiType = BuildWideBlockType(wideComponents); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(outputMultiType)); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(outputMultiType)); callableBuilder.Add(inputFlow); const auto outputFlow = TRuntimeNode(callableBuilder.Build(), false); return FromFlow(outputFlow); } const auto wideComponents = GetWideComponents(AS_TYPE(TStreamType, stream.GetStaticType())); TType* outputMultiType = BuildWideBlockType(wideComponents); - TCallableBuilder callableBuilder(Env, __func__, NewStreamType(outputMultiType)); + TCallableBuilder callableBuilder(Env_, __func__, NewStreamType(outputMultiType)); callableBuilder.Add(stream); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1508,7 +1508,7 @@ TRuntimeNode TProgramBuilder::ListToBlocks(TRuntimeNode list) { const auto itemBlockStructType = BuildBlockStructType(itemStructType); - TCallableBuilder callableBuilder(Env, __func__, NewListType(itemBlockStructType)); + TCallableBuilder callableBuilder(Env_, __func__, NewListType(itemBlockStructType)); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1517,7 +1517,7 @@ TRuntimeNode TProgramBuilder::FromBlocks(TRuntimeNode flow) { auto* flowType = AS_TYPE(TFlowType, flow.GetStaticType()); auto* blockType = AS_TYPE(TBlockType, flowType->GetItemType()); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(blockType->GetItemType())); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(blockType->GetItemType())); callableBuilder.Add(flow); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1534,7 +1534,7 @@ TRuntimeNode TProgramBuilder::WideFromBlocks(TRuntimeNode stream) { auto outputItems = ValidateBlockFlowType(inputFlow.GetStaticType()); outputItems.pop_back(); TType* outputMultiType = NewMultiType(outputItems); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(outputMultiType)); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(outputMultiType)); callableBuilder.Add(inputFlow); const auto outputFlow = TRuntimeNode(callableBuilder.Build(), false); return FromFlow(outputFlow); @@ -1542,7 +1542,7 @@ TRuntimeNode TProgramBuilder::WideFromBlocks(TRuntimeNode stream) { auto outputItems = ValidateBlockStreamType(stream.GetStaticType()); outputItems.pop_back(); TType* outputMultiType = NewMultiType(outputItems); - TCallableBuilder callableBuilder(Env, __func__, NewStreamType(outputMultiType)); + TCallableBuilder callableBuilder(Env_, __func__, NewStreamType(outputMultiType)); callableBuilder.Add(stream); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1560,7 +1560,7 @@ TRuntimeNode TProgramBuilder::ListFromBlocks(TRuntimeNode list) { const auto itemStructType = ValidateBlockStructType(itemBlockStructType); - TCallableBuilder callableBuilder(Env, __func__, NewListType(itemStructType)); + TCallableBuilder callableBuilder(Env_, __func__, NewListType(itemStructType)); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1586,7 +1586,7 @@ TRuntimeNode TProgramBuilder::WideSortBlocks(TRuntimeNode flow, const std::vecto } TRuntimeNode TProgramBuilder::AsScalar(TRuntimeNode value) { - TCallableBuilder callableBuilder(Env, __func__, NewBlockType(value.GetStaticType(), TBlockType::EShape::Scalar)); + TCallableBuilder callableBuilder(Env_, __func__, NewBlockType(value.GetStaticType(), TBlockType::EShape::Scalar)); callableBuilder.Add(value); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1604,7 +1604,7 @@ TRuntimeNode TProgramBuilder::ReplicateScalar(TRuntimeNode value, TRuntimeNode c auto outputType = NewBlockType(valueType->GetItemType(), TBlockType::EShape::Many); - TCallableBuilder callableBuilder(Env, __func__, outputType); + TCallableBuilder callableBuilder(Env_, __func__, outputType); callableBuilder.Add(value); callableBuilder.Add(count); return TRuntimeNode(callableBuilder.Build(), false); @@ -1628,7 +1628,7 @@ TRuntimeNode TProgramBuilder::BlockCompress(TRuntimeNode flow, ui32 bitmapIndex) flowItems.push_back(wideComponents[i]); } - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(NewMultiType(flowItems))); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(NewMultiType(flowItems))); callableBuilder.Add(flow); callableBuilder.Add(NewDataLiteral<ui32>(bitmapIndex)); return TRuntimeNode(callableBuilder.Build(), false); @@ -1640,7 +1640,7 @@ TRuntimeNode TProgramBuilder::BlockExpandChunked(TRuntimeNode comp) { } else { ValidateBlockFlowType(comp.GetStaticType()); } - TCallableBuilder callableBuilder(Env, __func__, comp.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, comp.GetStaticType()); callableBuilder.Add(comp); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1662,7 +1662,7 @@ TRuntimeNode TProgramBuilder::BlockCoalesce(TRuntimeNode first, TRuntimeNode sec auto outputType = NewBlockType(secondType->GetItemType(), GetResultShape({firstType, secondType})); - TCallableBuilder callableBuilder(Env, __func__, outputType); + TCallableBuilder callableBuilder(Env_, __func__, outputType); callableBuilder.Add(first); callableBuilder.Add(second); return TRuntimeNode(callableBuilder.Build(), false); @@ -1672,7 +1672,7 @@ TRuntimeNode TProgramBuilder::BlockExists(TRuntimeNode data) { auto dataType = AS_TYPE(TBlockType, data.GetStaticType()); auto outputType = NewBlockType(NewDataType(NUdf::TDataType<bool>::Id), dataType->GetShape()); - TCallableBuilder callableBuilder(Env, __func__, outputType); + TCallableBuilder callableBuilder(Env_, __func__, outputType); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1689,7 +1689,7 @@ TRuntimeNode TProgramBuilder::BlockMember(TRuntimeNode structObj, const std::str } auto returnType = NewBlockType(memberType, blockType->GetShape()); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(structObj); callableBuilder.Add(NewDataLiteral<ui32>(memberIndex)); return TRuntimeNode(callableBuilder.Build(), false); @@ -1704,11 +1704,11 @@ TRuntimeNode TProgramBuilder::BlockNth(TRuntimeNode tuple, ui32 index) { " is not less than " << type->GetElementsCount()); auto itemType = type->GetElementType(index); if (isOptional && !itemType->IsOptional() && !itemType->IsNull() && !itemType->IsPg()) { - itemType = TOptionalType::Create(itemType, Env); + itemType = TOptionalType::Create(itemType, Env_); } auto returnType = NewBlockType(itemType, blockType->GetShape()); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(tuple); callableBuilder.Add(NewDataLiteral<ui32>(index)); return TRuntimeNode(callableBuilder.Build(), false); @@ -1728,7 +1728,7 @@ TRuntimeNode TProgramBuilder::BlockAsStruct(const TArrayRef<std::pair<std::strin } auto returnType = NewBlockType(NewStructType(members), resultShape); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); for (const auto& x : args) { callableBuilder.Add(x.second); } @@ -1751,7 +1751,7 @@ TRuntimeNode TProgramBuilder::BlockAsTuple(const TArrayRef<const TRuntimeNode>& auto tupleType = NewTupleType(types); auto returnType = NewBlockType(tupleType, resultShape); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); for (const auto& x : args) { callableBuilder.Add(x); } @@ -1760,13 +1760,13 @@ TRuntimeNode TProgramBuilder::BlockAsTuple(const TArrayRef<const TRuntimeNode>& } TRuntimeNode TProgramBuilder::BlockToPg(TRuntimeNode input, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(input); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::BlockFromPg(TRuntimeNode input, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(input); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1777,7 +1777,7 @@ TRuntimeNode TProgramBuilder::BlockNot(TRuntimeNode data) { bool isOpt; MKQL_ENSURE(UnpackOptionalData(dataType->GetItemType(), isOpt)->GetSchemeType() == NUdf::TDataType<bool>::Id, "Requires boolean args."); - TCallableBuilder callableBuilder(Env, __func__, data.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, data.GetStaticType()); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1821,7 +1821,7 @@ TRuntimeNode TProgramBuilder::ListFromRange(TRuntimeNode start, TRuntimeNode end MKQL_ENSURE(IsIntervalType(AS_TYPE(TDataType, step)->GetSchemeType()), "Expected interval"); } - TCallableBuilder callableBuilder(Env, __func__, TListType::Create(start.GetStaticType(), Env)); + TCallableBuilder callableBuilder(Env_, __func__, TListType::Create(start.GetStaticType(), Env_)); callableBuilder.Add(start); callableBuilder.Add(end); callableBuilder.Add(step); @@ -1841,7 +1841,7 @@ TRuntimeNode TProgramBuilder::Switch(TRuntimeNode stream, outputNodes[i] = handler(i, arg); } - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(stream); callableBuilder.Add(NewDataLiteral<ui64>(memoryLimitBytes)); for (ui32 i = 0; i < handlerInputs.size(); ++i) { @@ -1880,7 +1880,7 @@ TRuntimeNode TProgramBuilder::Reverse(TRuntimeNode list) { const auto itemType = listDetailedType->GetItemType(); ThrowIfListOfVoid(itemType); - TCallableBuilder callableBuilder(Env, __func__, listType); + TCallableBuilder callableBuilder(Env_, __func__, listType); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); } @@ -1917,7 +1917,7 @@ TRuntimeNode TProgramBuilder::BuildWideTopOrSort(const std::string_view& callabl const auto width = GetWideComponentsCount(AS_TYPE(TFlowType, flow.GetStaticType())); MKQL_ENSURE(!keys.empty() && keys.size() <= width, "Unexpected keys count: " << keys.size()); - TCallableBuilder callableBuilder(Env, callableName, flow.GetStaticType()); + TCallableBuilder callableBuilder(Env_, callableName, flow.GetStaticType()); callableBuilder.Add(flow); if (count) { callableBuilder.Add(*count); @@ -2005,7 +2005,7 @@ TRuntimeNode TProgramBuilder::KeepTop(TRuntimeNode count, TRuntimeNode list, TRu } } - TCallableBuilder callableBuilder(Env, __func__, listType); + TCallableBuilder callableBuilder(Env_, __func__, listType); callableBuilder.Add(count); callableBuilder.Add(list); callableBuilder.Add(item); @@ -2023,7 +2023,7 @@ TRuntimeNode TProgramBuilder::Contains(TRuntimeNode dict, TRuntimeNode key) { const auto keyType = AS_TYPE(TDictType, dict.GetStaticType())->GetKeyType(); MKQL_ENSURE(keyType->IsSameType(*key.GetStaticType()), "Key type mismatch. Requred: " << *keyType << ", but got: " << *key.GetStaticType()); - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::TDataType<bool>::Id)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::TDataType<bool>::Id)); callableBuilder.Add(dict); callableBuilder.Add(key); return TRuntimeNode(callableBuilder.Build(), false); @@ -2034,7 +2034,7 @@ TRuntimeNode TProgramBuilder::Lookup(TRuntimeNode dict, TRuntimeNode key) { const auto keyType = dictType->GetKeyType(); MKQL_ENSURE(keyType->IsSameType(*key.GetStaticType()), "Key type mismatch. Requred: " << *keyType << ", but got: " << *key.GetStaticType()); - TCallableBuilder callableBuilder(Env, __func__, NewOptionalType(dictType->GetPayloadType())); + TCallableBuilder callableBuilder(Env_, __func__, NewOptionalType(dictType->GetPayloadType())); callableBuilder.Add(dict); callableBuilder.Add(key); return TRuntimeNode(callableBuilder.Build(), false); @@ -2043,21 +2043,21 @@ TRuntimeNode TProgramBuilder::Lookup(TRuntimeNode dict, TRuntimeNode key) { TRuntimeNode TProgramBuilder::DictItems(TRuntimeNode dict) { const auto dictTypeChecked = AS_TYPE(TDictType, dict.GetStaticType()); const auto itemType = NewTupleType({ dictTypeChecked->GetKeyType(), dictTypeChecked->GetPayloadType() }); - TCallableBuilder callableBuilder(Env, __func__, NewListType(itemType)); + TCallableBuilder callableBuilder(Env_, __func__, NewListType(itemType)); callableBuilder.Add(dict); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::DictKeys(TRuntimeNode dict) { const auto dictTypeChecked = AS_TYPE(TDictType, dict.GetStaticType()); - TCallableBuilder callableBuilder(Env, __func__, NewListType(dictTypeChecked->GetKeyType())); + TCallableBuilder callableBuilder(Env_, __func__, NewListType(dictTypeChecked->GetKeyType())); callableBuilder.Add(dict); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::DictPayloads(TRuntimeNode dict) { const auto dictTypeChecked = AS_TYPE(TDictType, dict.GetStaticType()); - TCallableBuilder callableBuilder(Env, __func__, NewListType(dictTypeChecked->GetPayloadType())); + TCallableBuilder callableBuilder(Env_, __func__, NewListType(dictTypeChecked->GetPayloadType())); callableBuilder.Add(dict); return TRuntimeNode(callableBuilder.Build(), false); } @@ -2067,7 +2067,7 @@ TRuntimeNode TProgramBuilder::ToIndexDict(TRuntimeNode list) { ThrowIfListOfVoid(itemType); const auto keyType = NewDataType(NUdf::TDataType<ui64>::Id); const auto dictType = NewDictType(keyType, itemType, false); - TCallableBuilder callableBuilder(Env, __func__, dictType); + TCallableBuilder callableBuilder(Env_, __func__, dictType); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); } @@ -2109,7 +2109,7 @@ TRuntimeNode TProgramBuilder::JoinDict(TRuntimeNode dict1, bool isMulti1, TRunti itemType = NewTupleType(tupleItems); const auto returnType = NewListType(itemType); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(dict1); callableBuilder.Add(dict2); callableBuilder.Add(NewDataLiteral(isMulti1)); @@ -2142,7 +2142,7 @@ TRuntimeNode TProgramBuilder::GraceJoinCommon(const TStringBuf& funcName, TRunti std::transform(rightRenames.cbegin(), rightRenames.cend(), std::back_inserter(rightRenamesNodes), [this](const ui32 idx) { return NewDataLiteral(idx); }); - TCallableBuilder callableBuilder(Env, funcName, returnType); + TCallableBuilder callableBuilder(Env_, funcName, returnType); callableBuilder.Add(flowLeft); if (flowRight) { callableBuilder.Add(flowRight); @@ -2202,7 +2202,7 @@ TRuntimeNode TProgramBuilder::NarrowSqueezeToHashedDict(TRuntimeNode stream, boo TRuntimeNode TProgramBuilder::SqueezeToList(TRuntimeNode flow, TRuntimeNode limit) { const auto itemType = AS_TYPE(TFlowType, flow.GetStaticType())->GetItemType(); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(NewListType(itemType))); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(NewListType(itemType))); callableBuilder.Add(flow); callableBuilder.Add(limit); return TRuntimeNode(callableBuilder.Build(), false); @@ -2216,7 +2216,7 @@ TRuntimeNode TProgramBuilder::Append(TRuntimeNode list, TRuntimeNode item) { auto itemType = item.GetStaticType(); MKQL_ENSURE(itemType->IsSameType(*listDetailedType.GetItemType()), "Types of list and item are different"); - TCallableBuilder callableBuilder(Env, __func__, listType); + TCallableBuilder callableBuilder(Env_, __func__, listType); callableBuilder.Add(list); callableBuilder.Add(item); return TRuntimeNode(callableBuilder.Build(), false); @@ -2230,7 +2230,7 @@ TRuntimeNode TProgramBuilder::Prepend(TRuntimeNode item, TRuntimeNode list) { auto itemType = item.GetStaticType(); MKQL_ENSURE(itemType->IsSameType(*listDetailedType.GetItemType()), "Types of list and item are different"); - TCallableBuilder callableBuilder(Env, __func__, listType); + TCallableBuilder callableBuilder(Env_, __func__, listType); callableBuilder.Add(item); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); @@ -2251,7 +2251,7 @@ TRuntimeNode TProgramBuilder::BuildExtend(const std::string_view& callableName, PrintNode(listType2, true)); } - TCallableBuilder callableBuilder(Env, callableName, listType); + TCallableBuilder callableBuilder(Env_, callableName, listType); for (auto list : lists) { callableBuilder.Add(list); } @@ -2269,117 +2269,117 @@ TRuntimeNode TProgramBuilder::OrderedExtend(const TArrayRef<const TRuntimeNode>& template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::String>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<const char*>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<const char*>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Utf8>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TUtf8>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TUtf8>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Yson>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TYson>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TYson>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Json>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TJson>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TJson>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::JsonDocument>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TJsonDocument>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TJsonDocument>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Uuid>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TUuid>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TUuid>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Date>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDate>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDate>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Datetime>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDatetime>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDatetime>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Timestamp>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TTimestamp>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TTimestamp>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Interval>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TInterval>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TInterval>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::DyNumber>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDyNumber>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDyNumber>::Id, Env_), true); } TRuntimeNode TProgramBuilder::NewDecimalLiteral(NYql::NDecimal::TInt128 data, ui8 precision, ui8 scale) const { - return TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod(data), TDataDecimalType::Create(precision, scale, Env), Env), true); + return TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod(data), TDataDecimalType::Create(precision, scale, Env_), Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Date32>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDate32>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDate32>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Datetime64>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDatetime64>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TDatetime64>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Timestamp64>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TTimestamp64>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TTimestamp64>::Id, Env_), true); } template<> TRuntimeNode TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Interval64>(const NUdf::TStringRef& data) const { - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TInterval64>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<NUdf::TInterval64>::Id, Env_), true); } TRuntimeNode TProgramBuilder::NewOptional(TRuntimeNode data) { - auto type = TOptionalType::Create(data.GetStaticType(), Env); - return TRuntimeNode(TOptionalLiteral::Create(data, type, Env), true); + auto type = TOptionalType::Create(data.GetStaticType(), Env_); + return TRuntimeNode(TOptionalLiteral::Create(data, type, Env_), true); } TRuntimeNode TProgramBuilder::NewOptional(TType* optionalType, TRuntimeNode data) { auto type = AS_TYPE(TOptionalType, optionalType); - return TRuntimeNode(TOptionalLiteral::Create(data, type, Env), true); + return TRuntimeNode(TOptionalLiteral::Create(data, type, Env_), true); } TRuntimeNode TProgramBuilder::NewVoid() { - return TRuntimeNode(Env.GetVoidLazy(), true); + return TRuntimeNode(Env_.GetVoidLazy(), true); } TRuntimeNode TProgramBuilder::NewEmptyListOfVoid() { - return TRuntimeNode(Env.GetListOfVoidLazy(), true); + return TRuntimeNode(Env_.GetListOfVoidLazy(), true); } TRuntimeNode TProgramBuilder::NewEmptyOptional(TType* optionalOrPgType) { MKQL_ENSURE(optionalOrPgType->IsOptional() || optionalOrPgType->IsPg(), "Expected optional or pg type"); if (optionalOrPgType->IsOptional()) { - return TRuntimeNode(TOptionalLiteral::Create(static_cast<TOptionalType*>(optionalOrPgType), Env), true); + return TRuntimeNode(TOptionalLiteral::Create(static_cast<TOptionalType*>(optionalOrPgType), Env_), true); } return PgCast(NewNull(), optionalOrPgType); } TRuntimeNode TProgramBuilder::NewEmptyOptionalDataLiteral(NUdf::TDataTypeId schemeType) { - return TRuntimeNode(BuildEmptyOptionalDataLiteral(schemeType, Env), true); + return TRuntimeNode(BuildEmptyOptionalDataLiteral(schemeType, Env_), true); } TRuntimeNode TProgramBuilder::NewEmptyStruct() { - return TRuntimeNode(Env.GetEmptyStructLazy(), true); + return TRuntimeNode(Env_.GetEmptyStructLazy(), true); } TRuntimeNode TProgramBuilder::NewStruct(const TArrayRef<const std::pair<std::string_view, TRuntimeNode>>& members) { @@ -2387,7 +2387,7 @@ TRuntimeNode TProgramBuilder::NewStruct(const TArrayRef<const std::pair<std::str return NewEmptyStruct(); } - TStructLiteralBuilder builder(Env); + TStructLiteralBuilder builder(Env_); for (auto x : members) { builder.Add(x.first, x.second); } @@ -2410,20 +2410,20 @@ TRuntimeNode TProgramBuilder::NewStruct(TType* structType, const TArrayRef<const values[index] = members[i].second; } - return TRuntimeNode(TStructLiteral::Create(values.size(), values.data(), detailedStructType, Env), true); + return TRuntimeNode(TStructLiteral::Create(values.size(), values.data(), detailedStructType, Env_), true); } TRuntimeNode TProgramBuilder::NewEmptyList() { - return TRuntimeNode(Env.GetEmptyListLazy(), true); + return TRuntimeNode(Env_.GetEmptyListLazy(), true); } TRuntimeNode TProgramBuilder::NewEmptyList(TType* itemType) { - TListLiteralBuilder builder(Env, itemType); + TListLiteralBuilder builder(Env_, itemType); return TRuntimeNode(builder.Build(), true); } TRuntimeNode TProgramBuilder::NewList(TType* itemType, const TArrayRef<const TRuntimeNode>& items) { - TListLiteralBuilder builder(Env, itemType); + TListLiteralBuilder builder(Env_, itemType); for (auto item : items) { builder.Add(item); } @@ -2432,24 +2432,24 @@ TRuntimeNode TProgramBuilder::NewList(TType* itemType, const TArrayRef<const TRu } TRuntimeNode TProgramBuilder::NewEmptyDict() { - return TRuntimeNode(Env.GetEmptyDictLazy(), true); + return TRuntimeNode(Env_.GetEmptyDictLazy(), true); } TRuntimeNode TProgramBuilder::NewDict(TType* dictType, const TArrayRef<const std::pair<TRuntimeNode, TRuntimeNode>>& items) { MKQL_ENSURE(dictType->IsDict(), "Expected dict type"); - return TRuntimeNode(TDictLiteral::Create(items.size(), items.data(), static_cast<TDictType*>(dictType), Env), true); + return TRuntimeNode(TDictLiteral::Create(items.size(), items.data(), static_cast<TDictType*>(dictType), Env_), true); } TRuntimeNode TProgramBuilder::NewEmptyTuple() { - return TRuntimeNode(Env.GetEmptyTupleLazy(), true); + return TRuntimeNode(Env_.GetEmptyTupleLazy(), true); } TRuntimeNode TProgramBuilder::NewTuple(TType* tupleType, const TArrayRef<const TRuntimeNode>& elements) { MKQL_ENSURE(tupleType->IsTuple(), "Expected tuple type"); - return TRuntimeNode(TTupleLiteral::Create(elements.size(), elements.data(), static_cast<TTupleType*>(tupleType), Env), true); + return TRuntimeNode(TTupleLiteral::Create(elements.size(), elements.data(), static_cast<TTupleType*>(tupleType), Env_), true); } TRuntimeNode TProgramBuilder::NewTuple(const TArrayRef<const TRuntimeNode>& elements) { @@ -2466,14 +2466,14 @@ TRuntimeNode TProgramBuilder::NewTuple(const TArrayRef<const TRuntimeNode>& elem TRuntimeNode TProgramBuilder::NewVariant(TRuntimeNode item, ui32 index, TType* variantType) { const auto type = AS_TYPE(TVariantType, variantType); MKQL_ENSURE(type->GetUnderlyingType()->IsTuple(), "Expected tuple as underlying type"); - return TRuntimeNode(TVariantLiteral::Create(item, index, type, Env), true); + return TRuntimeNode(TVariantLiteral::Create(item, index, type, Env_), true); } TRuntimeNode TProgramBuilder::NewVariant(TRuntimeNode item, const std::string_view& member, TType* variantType) { const auto type = AS_TYPE(TVariantType, variantType); MKQL_ENSURE(type->GetUnderlyingType()->IsStruct(), "Expected struct as underlying type"); ui32 index = AS_TYPE(TStructType, type->GetUnderlyingType())->GetMemberIndex(member); - return TRuntimeNode(TVariantLiteral::Create(item, index, type, Env), true); + return TRuntimeNode(TVariantLiteral::Create(item, index, type, Env_), true); } TRuntimeNode TProgramBuilder::Coalesce(TRuntimeNode data, TRuntimeNode defaultData) { @@ -2490,7 +2490,7 @@ TRuntimeNode TProgramBuilder::Coalesce(TRuntimeNode data, TRuntimeNode defaultDa MKQL_ENSURE(dataType->IsSameType(*defaultDataType), "Mismatch operand types"); } - TCallableBuilder callableBuilder(Env, __func__, defaultData.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, defaultData.GetStaticType()); callableBuilder.Add(data); callableBuilder.Add(defaultData); return TRuntimeNode(callableBuilder.Build(), false); @@ -2507,7 +2507,7 @@ TRuntimeNode TProgramBuilder::Unwrap(TRuntimeNode optional, TRuntimeNode message const auto& messageTypeData = static_cast<const TDataType&>(*messageType); MKQL_ENSURE(messageTypeData.GetSchemeType() == NUdf::TDataType<char*>::Id || messageTypeData.GetSchemeType() == NUdf::TDataType<NUdf::TUtf8>::Id, "Expected string or utf8."); - TCallableBuilder callableBuilder(Env, __func__, underlyingType); + TCallableBuilder callableBuilder(Env_, __func__, underlyingType); callableBuilder.Add(optional); callableBuilder.Add(message); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(file)); @@ -2613,7 +2613,7 @@ TRuntimeNode TProgramBuilder::DecimalDiv(TRuntimeNode data1, TRuntimeNode data2) const auto returnType = isOptionalLeft || isOptionalRight ? NewOptionalType(leftType) : leftType; - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(data1); callableBuilder.Add(data2); return TRuntimeNode(callableBuilder.Build(), false); @@ -2631,7 +2631,7 @@ TRuntimeNode TProgramBuilder::DecimalMod(TRuntimeNode data1, TRuntimeNode data2) const auto returnType = isOptionalLeft || isOptionalRight ? NewOptionalType(leftType) : leftType; - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(data1); callableBuilder.Add(data2); return TRuntimeNode(callableBuilder.Build(), false); @@ -2649,7 +2649,7 @@ TRuntimeNode TProgramBuilder::DecimalMul(TRuntimeNode data1, TRuntimeNode data2) const auto returnType = isOptionalLeft || isOptionalRight ? NewOptionalType(leftType) : leftType; - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(data1); callableBuilder.Add(data2); return TRuntimeNode(callableBuilder.Build(), false); @@ -2736,7 +2736,7 @@ TRuntimeNode TProgramBuilder::BuildWideSkipTakeBlocks(const std::string_view& ca MKQL_ENSURE(count.GetStaticType()->IsData(), "Expected data"); MKQL_ENSURE(static_cast<const TDataType&>(*count.GetStaticType()).GetSchemeType() == NUdf::TDataType<ui64>::Id, "Expected ui64"); - TCallableBuilder callableBuilder(Env, callableName, flow.GetStaticType()); + TCallableBuilder callableBuilder(Env_, callableName, flow.GetStaticType()); callableBuilder.Add(flow); callableBuilder.Add(count); return TRuntimeNode(callableBuilder.Build(), false); @@ -2753,7 +2753,7 @@ TRuntimeNode TProgramBuilder::BuildBlockLogical(const std::string_view& callable const auto itemType = NewDataType(NUdf::TDataType<bool>::Id, isOpt1 || isOpt2); auto outputType = NewBlockType(itemType, GetResultShape({firstType, secondType})); - TCallableBuilder callableBuilder(Env, callableName, outputType); + TCallableBuilder callableBuilder(Env_, callableName, outputType); callableBuilder.Add(first); callableBuilder.Add(second); return TRuntimeNode(callableBuilder.Build(), false); @@ -2773,13 +2773,13 @@ TRuntimeNode TProgramBuilder::BuildBlockDecimalBinary(const std::string_view& ca auto [precision, scale] = lParams; - TType* outputType = TDataDecimalType::Create(precision, scale, Env); + TType* outputType = TDataDecimalType::Create(precision, scale, Env_); if (isOpt1 || isOpt2) { - outputType = TOptionalType::Create(outputType, Env); + outputType = TOptionalType::Create(outputType, Env_); } outputType = NewBlockType(outputType, TBlockType::EShape::Many); - TCallableBuilder callableBuilder(Env, callableName, outputType); + TCallableBuilder callableBuilder(Env_, callableName, outputType); callableBuilder.Add(first); callableBuilder.Add(second); return TRuntimeNode(callableBuilder.Build(), false); @@ -2873,7 +2873,7 @@ TRuntimeNode TProgramBuilder::BuildRangeLogical(const std::string_view& callable MKQL_ENSURE(list.GetStaticType()->IsSameType(*lists.front().GetStaticType()), "Expecting arguments of same type"); } - TCallableBuilder callableBuilder(Env, callableName, lists.front().GetStaticType()); + TCallableBuilder callableBuilder(Env_, callableName, lists.front().GetStaticType()); for (auto& list : lists) { callableBuilder.Add(list); } @@ -2916,7 +2916,7 @@ TRuntimeNode TProgramBuilder::If(TRuntimeNode condition, TRuntimeNode thenBranch const bool isOptional = condOpt || thenOpt || elseOpt; - TCallableBuilder callableBuilder(Env, __func__, isOptional ? NewOptionalType(thenUnpacked) : thenUnpacked); + TCallableBuilder callableBuilder(Env_, __func__, isOptional ? NewOptionalType(thenUnpacked) : thenUnpacked); callableBuilder.Add(condition); callableBuilder.Add(thenBranch); callableBuilder.Add(elseBranch); @@ -2934,7 +2934,7 @@ TRuntimeNode TProgramBuilder::If(TRuntimeNode condition, TRuntimeNode thenBranch const auto conditionType = UnpackOptionalData(condition, condOpt); MKQL_ENSURE(conditionType->GetSchemeType() == NUdf::TDataType<bool>::Id, "Expected bool"); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(condition); callableBuilder.Add(thenBranch); callableBuilder.Add(elseBranch); @@ -2952,7 +2952,7 @@ TRuntimeNode TProgramBuilder::Ensure(TRuntimeNode value, TRuntimeNode predicate, const auto& messageTypeData = static_cast<const TDataType&>(*messageType); MKQL_ENSURE(messageTypeData.GetSchemeType() == NUdf::TDataType<char*>::Id || messageTypeData.GetSchemeType() == NUdf::TDataType<NUdf::TUtf8>::Id, "Expected string or utf8."); - TCallableBuilder callableBuilder(Env, __func__, value.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, value.GetStaticType()); callableBuilder.Add(value); callableBuilder.Add(predicate); callableBuilder.Add(message); @@ -2964,12 +2964,12 @@ TRuntimeNode TProgramBuilder::Ensure(TRuntimeNode value, TRuntimeNode predicate, TRuntimeNode TProgramBuilder::SourceOf(TType* returnType) { MKQL_ENSURE(returnType->IsFlow() || returnType->IsStream(), "Expected flow or stream."); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::Source() { - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(NewMultiType({}))); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(NewMultiType({}))); return TRuntimeNode(callableBuilder.Build(), false); } @@ -2988,7 +2988,7 @@ TRuntimeNode TProgramBuilder::IfPresent(TRuntimeNode optional, const TUnaryLambd MKQL_ENSURE(thenUnpacked->IsSameType(*elseUnpacked), "Different return types in branches."); - TCallableBuilder callableBuilder(Env, __func__, (thenOpt || elseOpt) ? NewOptionalType(thenUnpacked) : thenUnpacked); + TCallableBuilder callableBuilder(Env_, __func__, (thenOpt || elseOpt) ? NewOptionalType(thenUnpacked) : thenUnpacked); callableBuilder.Add(optional); callableBuilder.Add(itemArg); callableBuilder.Add(then); @@ -3032,7 +3032,7 @@ TRuntimeNode TProgramBuilder::BuildBinaryLogical(const std::string_view& callabl MKQL_ENSURE(UnpackOptionalData(data1, isOpt1)->GetSchemeType() == NUdf::TDataType<bool>::Id, "Requires boolean args."); MKQL_ENSURE(UnpackOptionalData(data2, isOpt2)->GetSchemeType() == NUdf::TDataType<bool>::Id, "Requires boolean args."); const auto resultType = NewDataType(NUdf::TDataType<bool>::Id, isOpt1 || isOpt2); - TCallableBuilder callableBuilder(Env, callableName, resultType); + TCallableBuilder callableBuilder(Env_, callableName, resultType); callableBuilder.Add(data1); callableBuilder.Add(data2); return TRuntimeNode(callableBuilder.Build(), false); @@ -3073,7 +3073,7 @@ TRuntimeNode TProgramBuilder::Exists(TRuntimeNode data) { return NewDataLiteral(true); } - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::TDataType<bool>::Id)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::TDataType<bool>::Id)); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } @@ -3081,7 +3081,7 @@ TRuntimeNode TProgramBuilder::Exists(TRuntimeNode data) { TRuntimeNode TProgramBuilder::NewMTRand(TRuntimeNode seed) { auto seedData = AS_TYPE(TDataType, seed); MKQL_ENSURE(seedData->GetSchemeType() == NUdf::TDataType<ui64>::Id, "seed must be ui64"); - TCallableBuilder callableBuilder(Env, __func__, NewResourceType(RandomMTResource), true); + TCallableBuilder callableBuilder(Env_, __func__, NewResourceType(RandomMTResource), true); callableBuilder.Add(seed); return TRuntimeNode(callableBuilder.Build(), false); } @@ -3093,20 +3093,20 @@ TRuntimeNode TProgramBuilder::NextMTRand(TRuntimeNode rand) { const std::array<TType*, 2U> tupleTypes = {{ NewDataType(NUdf::TDataType<ui64>::Id), rand.GetStaticType() }}; auto returnType = NewTupleType(tupleTypes); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(rand); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::AggrCountInit(TRuntimeNode value) { - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::TDataType<ui64>::Id)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::TDataType<ui64>::Id)); callableBuilder.Add(value); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::AggrCountUpdate(TRuntimeNode value, TRuntimeNode state) { MKQL_ENSURE(AS_TYPE(TDataType, state)->GetSchemeType() == NUdf::TDataType<ui64>::Id, "Expected ui64 type"); - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::TDataType<ui64>::Id)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::TDataType<ui64>::Id)); callableBuilder.Add(value); callableBuilder.Add(state); return TRuntimeNode(callableBuilder.Build(), false); @@ -3151,7 +3151,7 @@ TRuntimeNode TProgramBuilder::QueueCreate(TRuntimeNode initCapacity, TRuntimeNod auto initSizeType = AS_TYPE(TDataType, initSize); MKQL_ENSURE(initSizeType->GetSchemeType() == NUdf::TDataType<ui64>::Id, "init size must be ui64"); - TCallableBuilder callableBuilder(Env, __func__, returnType, true); + TCallableBuilder callableBuilder(Env_, __func__, returnType, true); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(tag)); callableBuilder.Add(initCapacity); callableBuilder.Add(initSize); @@ -3165,7 +3165,7 @@ TRuntimeNode TProgramBuilder::QueuePush(TRuntimeNode resource, TRuntimeNode valu auto resType = AS_TYPE(TResourceType, resource); const auto tag = resType->GetTag(); MKQL_ENSURE(tag.StartsWith(ResourceQueuePrefix), "Expected Queue resource"); - TCallableBuilder callableBuilder(Env, __func__, resource.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, resource.GetStaticType()); callableBuilder.Add(resource); callableBuilder.Add(value); return TRuntimeNode(callableBuilder.Build(), false); @@ -3175,7 +3175,7 @@ TRuntimeNode TProgramBuilder::QueuePop(TRuntimeNode resource) { auto resType = AS_TYPE(TResourceType, resource); const auto tag = resType->GetTag(); MKQL_ENSURE(tag.StartsWith(ResourceQueuePrefix), "Expected Queue resource"); - TCallableBuilder callableBuilder(Env, __func__, resource.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, resource.GetStaticType()); callableBuilder.Add(resource); return TRuntimeNode(callableBuilder.Build(), false); } @@ -3187,7 +3187,7 @@ TRuntimeNode TProgramBuilder::QueuePeek(TRuntimeNode resource, TRuntimeNode inde MKQL_ENSURE(indexType->GetSchemeType() == NUdf::TDataType<ui64>::Id, "index size must be ui64"); const auto tag = resType->GetTag(); MKQL_ENSURE(tag.StartsWith(ResourceQueuePrefix), "Expected Queue resource"); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(resource); callableBuilder.Add(index); for (auto node : dependentNodes) { @@ -3208,7 +3208,7 @@ TRuntimeNode TProgramBuilder::QueueRange(TRuntimeNode resource, TRuntimeNode beg const auto tag = resType->GetTag(); MKQL_ENSURE(tag.StartsWith(ResourceQueuePrefix), "Expected Queue resource"); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(resource); callableBuilder.Add(begin); callableBuilder.Add(end); @@ -3225,7 +3225,7 @@ TRuntimeNode TProgramBuilder::PreserveStream(TRuntimeNode stream, TRuntimeNode q MKQL_ENSURE(outpaceType->GetSchemeType() == NUdf::TDataType<ui64>::Id, "PreserveStream: outpace size must be ui64"); const auto tag = resType->GetTag(); MKQL_ENSURE(tag.StartsWith(ResourceQueuePrefix), "PreserveStream: Expected Queue resource"); - TCallableBuilder callableBuilder(Env, __func__, streamType); + TCallableBuilder callableBuilder(Env_, __func__, streamType); callableBuilder.Add(stream); callableBuilder.Add(queue); callableBuilder.Add(outpace); @@ -3233,7 +3233,7 @@ TRuntimeNode TProgramBuilder::PreserveStream(TRuntimeNode stream, TRuntimeNode q } TRuntimeNode TProgramBuilder::Seq(const TArrayRef<const TRuntimeNode>& args, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); for (auto node : args) { callableBuilder.Add(node); } @@ -3248,7 +3248,7 @@ TRuntimeNode TProgramBuilder::FromYsonSimpleType(TRuntimeNode input, NUdf::TData MKQL_ENSURE(type->IsData(), "Expected data type"); auto resDataType = NewDataType(schemeType); auto resultType = NewOptionalType(resDataType); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(input); callableBuilder.Add(NewDataLiteral(static_cast<ui32>(schemeType))); return TRuntimeNode(callableBuilder.Build(), false); @@ -3258,7 +3258,7 @@ TRuntimeNode TProgramBuilder::TryWeakMemberFromDict(TRuntimeNode other, TRuntime auto resDataType = NewDataType(schemeType); auto resultType = NewOptionalType(resDataType); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(other); callableBuilder.Add(rest); callableBuilder.Add(NewDataLiteral(static_cast<ui32>(schemeType))); @@ -3271,7 +3271,7 @@ TRuntimeNode TProgramBuilder::TimezoneId(TRuntimeNode name) { auto dataType = UnpackOptionalData(name, isOptional); MKQL_ENSURE(dataType->GetSchemeType() == NUdf::TDataType<char*>::Id, "Expected string"); auto resultType = NewOptionalType(NewDataType(NUdf::EDataSlot::Uint16)); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(name); return TRuntimeNode(callableBuilder.Build(), false); } @@ -3281,7 +3281,7 @@ TRuntimeNode TProgramBuilder::TimezoneName(TRuntimeNode id) { auto dataType = UnpackOptionalData(id, isOptional); MKQL_ENSURE(dataType->GetSchemeType() == NUdf::TDataType<ui16>::Id, "Expected ui32"); auto resultType = NewOptionalType(NewDataType(NUdf::EDataSlot::String)); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(id); return TRuntimeNode(callableBuilder.Build(), false); } @@ -3307,7 +3307,7 @@ TRuntimeNode TProgramBuilder::AddTimezone(TRuntimeNode utc, TRuntimeNode id) { } auto resultType = NewOptionalType(NewDataType(tzType)); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(utc); callableBuilder.Add(id); return TRuntimeNode(callableBuilder.Build(), false); @@ -3341,10 +3341,10 @@ TRuntimeNode TProgramBuilder::Nth(TRuntimeNode tuple, ui32 index) { " is not less than " << type->GetElementsCount()); auto itemType = type->GetElementType(index); if (isOptional && !itemType->IsOptional() && !itemType->IsNull() && !itemType->IsPg()) { - itemType = TOptionalType::Create(itemType, Env); + itemType = TOptionalType::Create(itemType, Env_); } - TCallableBuilder callableBuilder(Env, __func__, itemType); + TCallableBuilder callableBuilder(Env_, __func__, itemType); callableBuilder.Add(tuple); callableBuilder.Add(NewDataLiteral<ui32>(index)); return TRuntimeNode(callableBuilder.Build(), false); @@ -3360,9 +3360,9 @@ TRuntimeNode TProgramBuilder::Guess(TRuntimeNode variant, ui32 tupleIndex) { auto type = AS_TYPE(TVariantType, unpacked); auto underlyingType = AS_TYPE(TTupleType, type->GetUnderlyingType()); MKQL_ENSURE(tupleIndex < underlyingType->GetElementsCount(), "Wrong tuple index"); - auto resType = TOptionalType::Create(underlyingType->GetElementType(tupleIndex), Env); + auto resType = TOptionalType::Create(underlyingType->GetElementType(tupleIndex), Env_); - TCallableBuilder callableBuilder(Env, __func__, resType); + TCallableBuilder callableBuilder(Env_, __func__, resType); callableBuilder.Add(variant); callableBuilder.Add(NewDataLiteral<ui32>(tupleIndex)); return TRuntimeNode(callableBuilder.Build(), false); @@ -3374,9 +3374,9 @@ TRuntimeNode TProgramBuilder::Guess(TRuntimeNode variant, const std::string_view auto type = AS_TYPE(TVariantType, unpacked); auto underlyingType = AS_TYPE(TStructType, type->GetUnderlyingType()); auto structIndex = underlyingType->GetMemberIndex(memberName); - auto resType = TOptionalType::Create(underlyingType->GetMemberType(structIndex), Env); + auto resType = TOptionalType::Create(underlyingType->GetMemberType(structIndex), Env_); - TCallableBuilder callableBuilder(Env, __func__, resType); + TCallableBuilder callableBuilder(Env_, __func__, resType); callableBuilder.Add(variant); callableBuilder.Add(NewDataLiteral<ui32>(structIndex)); return TRuntimeNode(callableBuilder.Build(), false); @@ -3388,9 +3388,9 @@ TRuntimeNode TProgramBuilder::Way(TRuntimeNode variant) { auto type = AS_TYPE(TVariantType, unpacked); auto underlyingType = type->GetUnderlyingType(); auto dataType = NewDataType(underlyingType->IsTuple() ? NUdf::EDataSlot::Uint32 : NUdf::EDataSlot::Utf8); - auto resType = isOptional ? TOptionalType::Create(dataType, Env) : dataType; + auto resType = isOptional ? TOptionalType::Create(dataType, Env_) : dataType; - TCallableBuilder callableBuilder(Env, __func__, resType); + TCallableBuilder callableBuilder(Env_, __func__, resType); callableBuilder.Add(variant); return TRuntimeNode(callableBuilder.Build(), false); } @@ -3400,9 +3400,9 @@ TRuntimeNode TProgramBuilder::VariantItem(TRuntimeNode variant) { auto unpacked = UnpackOptional(variant, isOptional); auto type = AS_TYPE(TVariantType, unpacked); auto underlyingType = type->GetAlternativeType(0); - auto resType = isOptional ? TOptionalType::Create(underlyingType, Env) : underlyingType; + auto resType = isOptional ? TOptionalType::Create(underlyingType, Env_) : underlyingType; - TCallableBuilder callableBuilder(Env, __func__, resType); + TCallableBuilder callableBuilder(Env_, __func__, resType); callableBuilder.Add(variant); return TRuntimeNode(callableBuilder.Build(), false); } @@ -3418,9 +3418,9 @@ TRuntimeNode TProgramBuilder::DynamicVariant(TRuntimeNode item, TRuntimeNode ind auto indexType = UnpackOptionalData(index.GetStaticType(), isOptional); MKQL_ENSURE(indexType->GetDataSlot() == expectedIndexSlot, "Mismatch type of index"); - auto resType = TOptionalType::Create(type, Env); + auto resType = TOptionalType::Create(type, Env_); - TCallableBuilder callableBuilder(Env, __func__, resType); + TCallableBuilder callableBuilder(Env_, __func__, resType); callableBuilder.Add(item); callableBuilder.Add(index); callableBuilder.Add(TRuntimeNode(variantType, true)); @@ -3461,7 +3461,7 @@ TRuntimeNode TProgramBuilder::VisitAll(TRuntimeNode variant, std::function<TRunt } } - TCallableBuilder callableBuilder(Env, __func__, newItems.front().GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, newItems.front().GetStaticType()); callableBuilder.Add(variant); for (ui32 i = 0; i < type->GetAlternativesCount(); ++i) { callableBuilder.Add(items[i]); @@ -3491,22 +3491,22 @@ TRuntimeNode TProgramBuilder::UnaryDataFunction(TRuntimeNode data, const std::st TType* resultType; if (flags & TDataFunctionFlags::HasBooleanResult) { - resultType = TDataType::Create(NUdf::TDataType<bool>::Id, Env); + resultType = TDataType::Create(NUdf::TDataType<bool>::Id, Env_); } else if (flags & TDataFunctionFlags::HasUi32Result) { - resultType = TDataType::Create(NUdf::TDataType<ui32>::Id, Env); + resultType = TDataType::Create(NUdf::TDataType<ui32>::Id, Env_); } else if (flags & TDataFunctionFlags::HasStringResult) { - resultType = TDataType::Create(NUdf::TDataType<char*>::Id, Env); + resultType = TDataType::Create(NUdf::TDataType<char*>::Id, Env_); } else if (flags & TDataFunctionFlags::HasOptionalResult) { - resultType = TOptionalType::Create(type, Env); + resultType = TOptionalType::Create(type, Env_); } else { resultType = type; } if ((flags & TDataFunctionFlags::CommonOptionalResult) && isOptional) { - resultType = TOptionalType::Create(resultType, Env); + resultType = TOptionalType::Create(resultType, Env_); } - TCallableBuilder callableBuilder(Env, callableName, resultType); + TCallableBuilder callableBuilder(Env_, callableName, resultType); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } @@ -3532,11 +3532,11 @@ TRuntimeNode TProgramBuilder::ToDict(TRuntimeNode list, bool multi, const TUnary auto payload = payloadSelector(itemArg); auto payloadType = payload.GetStaticType(); if (multi) { - payloadType = TListType::Create(payloadType, Env); + payloadType = TListType::Create(payloadType, Env_); } - auto dictType = TDictType::Create(keyType, payloadType, Env); - TCallableBuilder callableBuilder(Env, callableName, dictType); + auto dictType = TDictType::Create(keyType, payloadType, Env_); + TCallableBuilder callableBuilder(Env_, callableName, dictType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(key); @@ -3563,14 +3563,14 @@ TRuntimeNode TProgramBuilder::SqueezeToDict(TRuntimeNode stream, bool multi, con auto payload = payloadSelector(itemArg); auto payloadType = payload.GetStaticType(); if (multi) { - payloadType = TListType::Create(payloadType, Env); + payloadType = TListType::Create(payloadType, Env_); } - auto dictType = TDictType::Create(keyType, payloadType, Env); + auto dictType = TDictType::Create(keyType, payloadType, Env_); auto returnType = type->IsFlow() - ? (TType*) TFlowType::Create(dictType, Env) - : (TType*) TStreamType::Create(dictType, Env); - TCallableBuilder callableBuilder(Env, callableName, returnType); + ? (TType*) TFlowType::Create(dictType, Env_) + : (TType*) TStreamType::Create(dictType, Env_); + TCallableBuilder callableBuilder(Env_, callableName, returnType); callableBuilder.Add(stream); callableBuilder.Add(itemArg); callableBuilder.Add(key); @@ -3597,12 +3597,12 @@ TRuntimeNode TProgramBuilder::NarrowSqueezeToDict(TRuntimeNode flow, bool multi, auto payload = payloadSelector(itemArgs); auto payloadType = payload.GetStaticType(); if (multi) { - payloadType = TListType::Create(payloadType, Env); + payloadType = TListType::Create(payloadType, Env_); } - const auto dictType = TDictType::Create(keyType, payloadType, Env); - const auto returnType = TFlowType::Create(dictType, Env); - TCallableBuilder callableBuilder(Env, callableName, returnType); + const auto dictType = TDictType::Create(keyType, payloadType, Env_); + const auto returnType = TFlowType::Create(dictType, Env_); + TCallableBuilder callableBuilder(Env_, callableName, returnType); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); callableBuilder.Add(key); @@ -3614,7 +3614,7 @@ TRuntimeNode TProgramBuilder::NarrowSqueezeToDict(TRuntimeNode flow, bool multi, } void TProgramBuilder::ThrowIfListOfVoid(TType* type) { - MKQL_ENSURE(!VoidWithEffects || !type->IsVoid(), "List of void is forbidden for current function"); + MKQL_ENSURE(!VoidWithEffects_ || !type->IsVoid(), "List of void is forbidden for current function"); } TRuntimeNode TProgramBuilder::BuildFlatMap(const std::string_view& callableName, TRuntimeNode list, const TUnaryLambda& handler) @@ -3657,11 +3657,11 @@ TRuntimeNode TProgramBuilder::BuildFlatMap(const std::string_view& callableName, } const auto resultListType = listType->IsFlow() || type->IsFlow() ? - TFlowType::Create(retItemType, Env): + TFlowType::Create(retItemType, Env_): listType->IsList() ? - (TType*)TListType::Create(retItemType, Env): - (TType*)TStreamType::Create(retItemType, Env); - TCallableBuilder callableBuilder(Env, callableName, resultListType); + (TType*)TListType::Create(retItemType, Env_): + (TType*)TStreamType::Create(retItemType, Env_); + TCallableBuilder callableBuilder(Env_, callableName, resultListType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(newList); @@ -3683,8 +3683,8 @@ TRuntimeNode TProgramBuilder::MultiMap(TRuntimeNode list, const TExpandLambda& h MKQL_ENSURE(retItemType->IsSameType(*newList.back().GetStaticType()), "Must be same type."); const auto resultListType = listType->IsFlow() ? - (TType*)TFlowType::Create(retItemType, Env) : (TType*)TListType::Create(retItemType, Env); - TCallableBuilder callableBuilder(Env, __func__, resultListType); + (TType*)TFlowType::Create(retItemType, Env_) : (TType*)TListType::Create(retItemType, Env_); + TCallableBuilder callableBuilder(Env_, __func__, resultListType); callableBuilder.Add(list); callableBuilder.Add(itemArg); std::for_each(newList.cbegin(), newList.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); @@ -3705,7 +3705,7 @@ TRuntimeNode TProgramBuilder::NarrowMultiMap(TRuntimeNode flow, const TWideLambd const auto retItemType = newList.front().GetStaticType(); MKQL_ENSURE(retItemType->IsSameType(*newList.back().GetStaticType()), "Must be same type."); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(newList.front().GetStaticType())); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(newList.front().GetStaticType())); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); std::for_each(newList.cbegin(), newList.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); @@ -3721,7 +3721,7 @@ TRuntimeNode TProgramBuilder::ExpandMap(TRuntimeNode flow, const TExpandLambda& tupleItems.reserve(newItems.size()); std::transform(newItems.cbegin(), newItems.cend(), std::back_inserter(tupleItems), std::bind(&TRuntimeNode::GetStaticType, std::placeholders::_1)); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(NewMultiType(tupleItems))); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(NewMultiType(tupleItems))); callableBuilder.Add(flow); callableBuilder.Add(itemArg); std::for_each(newItems.cbegin(), newItems.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); @@ -3742,7 +3742,7 @@ TRuntimeNode TProgramBuilder::WideMap(TRuntimeNode flow, const TWideLambda& hand tupleItems.reserve(newItems.size()); std::transform(newItems.cbegin(), newItems.cend(), std::back_inserter(tupleItems), std::bind(&TRuntimeNode::GetStaticType, std::placeholders::_1)); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(NewMultiType(tupleItems))); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(NewMultiType(tupleItems))); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); std::for_each(newItems.cbegin(), newItems.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); @@ -3771,7 +3771,7 @@ TRuntimeNode TProgramBuilder::WideChain1Map(TRuntimeNode flow, const TWideLambda MKQL_ENSURE(initItems.size() == updateItems.size(), "Expected same width."); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(NewMultiType(tupleItems))); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(NewMultiType(tupleItems))); callableBuilder.Add(flow); std::for_each(inputArgs.cbegin(), inputArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); std::for_each(initItems.cbegin(), initItems.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); @@ -3790,7 +3790,7 @@ TRuntimeNode TProgramBuilder::NarrowMap(TRuntimeNode flow, const TNarrowLambda& const auto newItem = handler(itemArgs); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(newItem.GetStaticType())); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(newItem.GetStaticType())); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); callableBuilder.Add(newItem); @@ -3821,7 +3821,7 @@ TRuntimeNode TProgramBuilder::NarrowFlatMap(TRuntimeNode flow, const TNarrowLamb THROW yexception() << "Expected flow, list or stream."; } - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(retItemType)); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(retItemType)); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); callableBuilder.Add(newList); @@ -3838,7 +3838,7 @@ TRuntimeNode TProgramBuilder::BuildWideFilter(const std::string_view& callableNa const auto predicate = handler(itemArgs); - TCallableBuilder callableBuilder(Env, callableName, flow.GetStaticType()); + TCallableBuilder callableBuilder(Env_, callableName, flow.GetStaticType()); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); callableBuilder.Add(predicate); @@ -3875,7 +3875,7 @@ TRuntimeNode TProgramBuilder::WideFilter(TRuntimeNode flow, TRuntimeNode limit, const auto predicate = handler(itemArgs); - TCallableBuilder callableBuilder(Env, __func__, flow.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, flow.GetStaticType()); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); callableBuilder.Add(predicate); @@ -3904,7 +3904,7 @@ TRuntimeNode TProgramBuilder::BuildFilter(const std::string_view& callableName, const auto& detailedPredicateType = static_cast<const TDataType&>(*predicate.GetStaticType()); MKQL_ENSURE(detailedPredicateType.GetSchemeType() == NUdf::TDataType<bool>::Id, "Expected boolean data"); - TCallableBuilder callableBuilder(Env, callableName, outputType); + TCallableBuilder callableBuilder(Env_, callableName, outputType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(predicate); @@ -3933,7 +3933,7 @@ TRuntimeNode TProgramBuilder::BuildFilter(const std::string_view& callableName, const auto& detailedPredicateType = static_cast<const TDataType&>(*predicate.GetStaticType()); MKQL_ENSURE(detailedPredicateType.GetSchemeType() == NUdf::TDataType<bool>::Id, "Expected boolean data"); - TCallableBuilder callableBuilder(Env, callableName, outputType); + TCallableBuilder callableBuilder(Env_, callableName, outputType); callableBuilder.Add(list); callableBuilder.Add(limit); callableBuilder.Add(itemArg); @@ -3967,7 +3967,7 @@ TRuntimeNode TProgramBuilder::BuildHeap(const std::string_view& callableName, TR const auto rightArg = Arg(itemType); const auto predicate = comparator(leftArg, rightArg); - TCallableBuilder callableBuilder(Env, callableName, listType); + TCallableBuilder callableBuilder(Env_, callableName, listType); callableBuilder.Add(list); callableBuilder.Add(leftArg); callableBuilder.Add(rightArg); @@ -3987,7 +3987,7 @@ TRuntimeNode TProgramBuilder::BuildNth(const std::string_view& callableName, TRu const auto rightArg = Arg(itemType); const auto predicate = comparator(leftArg, rightArg); - TCallableBuilder callableBuilder(Env, callableName, listType); + TCallableBuilder callableBuilder(Env_, callableName, listType); callableBuilder.Add(list); callableBuilder.Add(n); callableBuilder.Add(leftArg); @@ -4051,11 +4051,11 @@ TRuntimeNode TProgramBuilder::BuildMap(const std::string_view& callableName, TRu const auto newItem = handler(itemArg); const auto resultListType = listType->IsFlow() ? - (TType*)TFlowType::Create(newItem.GetStaticType(), Env): + (TType*)TFlowType::Create(newItem.GetStaticType(), Env_): listType->IsList() ? - (TType*)TListType::Create(newItem.GetStaticType(), Env): - (TType*)TStreamType::Create(newItem.GetStaticType(), Env); - TCallableBuilder callableBuilder(Env, callableName, resultListType); + (TType*)TListType::Create(newItem.GetStaticType(), Env_): + (TType*)TStreamType::Create(newItem.GetStaticType(), Env_); + TCallableBuilder callableBuilder(Env_, callableName, resultListType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(newItem); @@ -4072,9 +4072,9 @@ TRuntimeNode TProgramBuilder::Invoke(const std::string_view& funcName, TType* re argTypes[i].first = UnpackOptionalData(arg, argTypes[i].second)->GetSchemeType(); } - FunctionRegistry.GetBuiltins()->GetBuiltin(funcName, argTypes.data(), 1U + args.size()); + FunctionRegistry_.GetBuiltins()->GetBuiltin(funcName, argTypes.data(), 1U + args.size()); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(funcName)); for (const auto& arg : args) { callableBuilder.Add(arg); @@ -4090,22 +4090,22 @@ TRuntimeNode TProgramBuilder::Udf( const std::string_view& typeConfig ) { - TRuntimeNode userTypeNode = userType ? TRuntimeNode(userType, true) : TRuntimeNode(Env.GetVoidLazy()->GetType(), true); + TRuntimeNode userTypeNode = userType ? TRuntimeNode(userType, true) : TRuntimeNode(Env_.GetVoidLazy()->GetType(), true); const ui32 flags = NUdf::IUdfModule::TFlags::TypesOnly; - if (!TypeInfoHelper) { - TypeInfoHelper = new TTypeInfoHelper(); + if (!TypeInfoHelper_) { + TypeInfoHelper_ = new TTypeInfoHelper(); } TFunctionTypeInfo funcInfo; - TStatus status = FunctionRegistry.FindFunctionTypeInfo( - LangVer, Env, TypeInfoHelper, nullptr, funcName, userType, typeConfig, flags, {}, nullptr, nullptr, &funcInfo); + TStatus status = FunctionRegistry_.FindFunctionTypeInfo( + LangVer_, Env_, TypeInfoHelper_, nullptr, funcName, userType, typeConfig, flags, {}, nullptr, nullptr, &funcInfo); MKQL_ENSURE(status.IsOk(), status.GetError()); - if (funcInfo.MinLangVer != NYql::UnknownLangVersion && LangVer != NYql::UnknownLangVersion && LangVer < funcInfo.MinLangVer) { + if (funcInfo.MinLangVer != NYql::UnknownLangVersion && LangVer_ != NYql::UnknownLangVersion && LangVer_ < funcInfo.MinLangVer) { throw yexception() << "UDF " << funcName << " is not available in given language version yet"; } - if (funcInfo.MaxLangVer != NYql::UnknownLangVersion && LangVer != NYql::UnknownLangVersion && LangVer > funcInfo.MaxLangVer) { + if (funcInfo.MaxLangVer != NYql::UnknownLangVersion && LangVer_ != NYql::UnknownLangVersion && LangVer_ > funcInfo.MaxLangVer) { throw yexception() << "UDF " << funcName << " is not available in given language version anymore"; } @@ -4125,7 +4125,7 @@ TRuntimeNode TProgramBuilder::Udf( auto funNameNode = NewDataLiteral<NUdf::EDataSlot::String>(funcName); auto typeConfigNode = NewDataLiteral<NUdf::EDataSlot::String>(typeConfig); - TCallableBuilder callableBuilder(Env, __func__, funcInfo.FunctionType); + TCallableBuilder callableBuilder(Env_, __func__, funcInfo.FunctionType); callableBuilder.Add(funNameNode); callableBuilder.Add(userTypeNode); callableBuilder.Add(typeConfigNode); @@ -4146,9 +4146,9 @@ TRuntimeNode TProgramBuilder::TypedUdf( { auto funNameNode = NewDataLiteral<NUdf::EDataSlot::String>(funcName); auto typeConfigNode = NewDataLiteral<NUdf::EDataSlot::String>(typeConfig); - TRuntimeNode userTypeNode = userType ? TRuntimeNode(userType, true) : TRuntimeNode(Env.GetVoidLazy(), true); + TRuntimeNode userTypeNode = userType ? TRuntimeNode(userType, true) : TRuntimeNode(Env_.GetVoidLazy(), true); - TCallableBuilder callableBuilder(Env, "Udf", funcType); + TCallableBuilder callableBuilder(Env_, "Udf", funcType); callableBuilder.Add(funNameNode); callableBuilder.Add(userTypeNode); callableBuilder.Add(typeConfigNode); @@ -4173,7 +4173,7 @@ TRuntimeNode TProgramBuilder::ScriptUdf( MKQL_ENSURE(funcType->IsCallable(), "type must be callable"); auto scriptType = NKikimr::NMiniKQL::ScriptTypeFromStr(moduleName); MKQL_ENSURE(scriptType != EScriptType::Unknown, "unknown script type '" << moduleName << "'"); - EnsureScriptSpecificTypes(scriptType, static_cast<TCallableType*>(funcType), Env.GetNodeStack()); + EnsureScriptSpecificTypes(scriptType, static_cast<TCallableType*>(funcType), Env_.GetNodeStack()); auto scriptTypeStr = IsCustomPython(scriptType) ? moduleName : ScriptTypeAsStr(CanonizeScriptType(scriptType)); @@ -4184,7 +4184,7 @@ TRuntimeNode TProgramBuilder::ScriptUdf( TRuntimeNode userTypeNode(funcType, true); auto typeConfigNode = NewDataLiteral<NUdf::EDataSlot::String>(""); - TCallableBuilder callableBuilder(Env, __func__, funcType); + TCallableBuilder callableBuilder(Env_, __func__, funcType); callableBuilder.Add(funcNameNode); callableBuilder.Add(userTypeNode); callableBuilder.Add(typeConfigNode); @@ -4219,7 +4219,7 @@ TRuntimeNode TProgramBuilder::Apply(TRuntimeNode callableNode, const TArrayRef<c << " with static " << arg.GetStaticType()->GetKindAsStr()); } - TCallableBuilder callableBuilder(Env, "Apply2", callableType->GetReturnType()); + TCallableBuilder callableBuilder(Env_, "Apply2", callableType->GetReturnType()); callableBuilder.Add(callableNode); callableBuilder.Add(NewDataLiteral<ui32>(dependentCount)); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(file)); @@ -4249,7 +4249,7 @@ TRuntimeNode TProgramBuilder::Callable(TType* callableType, const TArrayLambda& } auto res = handler(args); - TCallableBuilder callableBuilder(Env, __func__, callableType); + TCallableBuilder callableBuilder(Env_, __func__, callableType); for (ui32 i = 0; i < castedCallableType->GetArgumentsCount(); ++i) { callableBuilder.Add(args[i]); } @@ -4259,10 +4259,10 @@ TRuntimeNode TProgramBuilder::Callable(TType* callableType, const TArrayLambda& } TRuntimeNode TProgramBuilder::NewNull() { - if (UseNullType) { - return TRuntimeNode(Env.GetNullLazy(), true); + if (UseNullType_) { + return TRuntimeNode(Env_.GetNullLazy(), true); } - TCallableBuilder callableBuilder(Env, "Null", NewOptionalType(Env.GetVoidLazy()->GetType())); + TCallableBuilder callableBuilder(Env_, "Null", NewOptionalType(Env_.GetVoidLazy()->GetType())); return TRuntimeNode(callableBuilder.Build(), false); } @@ -4329,7 +4329,7 @@ TRuntimeNode TProgramBuilder::ToString(TRuntimeNode data) { UnpackOptionalData(data, isOptional); const auto resultType = NewDataType(Utf8 ? NUdf::EDataSlot::Utf8 : NUdf::EDataSlot::String, isOptional); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } @@ -4340,7 +4340,7 @@ TRuntimeNode TProgramBuilder::FromString(TRuntimeNode data, TType* type) { const auto targetType = UnpackOptionalData(type, isOptional); MKQL_ENSURE(sourceType->GetSchemeType() == NUdf::TDataType<char*>::Id || sourceType->GetSchemeType() == NUdf::TDataType<NUdf::TUtf8>::Id, "Expected String"); MKQL_ENSURE(targetType->GetSchemeType() != 0, "Null is not allowed"); - TCallableBuilder callableBuilder(Env, __func__, type); + TCallableBuilder callableBuilder(Env_, __func__, type); callableBuilder.Add(data); callableBuilder.Add(NewDataLiteral(static_cast<ui32>(targetType->GetSchemeType()))); if (targetType->GetSchemeType() == NUdf::TDataType<NUdf::TDecimal>::Id) { @@ -4357,7 +4357,7 @@ TRuntimeNode TProgramBuilder::StrictFromString(TRuntimeNode data, TType* type) { const auto targetType = UnpackOptionalData(type, isOptional); MKQL_ENSURE(sourceType->GetSchemeType() == NUdf::TDataType<char*>::Id || sourceType->GetSchemeType() == NUdf::TDataType<NUdf::TUtf8>::Id, "Expected String"); MKQL_ENSURE(targetType->GetSchemeType() != 0, "Null is not allowed"); - TCallableBuilder callableBuilder(Env, __func__, type); + TCallableBuilder callableBuilder(Env_, __func__, type); callableBuilder.Add(data); callableBuilder.Add(NewDataLiteral(static_cast<ui32>(targetType->GetSchemeType()))); if (targetType->GetSchemeType() == NUdf::TDataType<NUdf::TDecimal>::Id) { @@ -4379,7 +4379,7 @@ TRuntimeNode TProgramBuilder::FromBytes(TRuntimeNode data, TType* targetType) { MKQL_ENSURE(dataType->GetSchemeType() == NUdf::TDataType<char*>::Id, "Expected String"); auto resultType = NewOptionalType(targetType); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(data); auto targetDataType = AS_TYPE(TDataType, targetType); callableBuilder.Add(NewDataLiteral(static_cast<ui32>(targetDataType->GetSchemeType()))); @@ -4403,7 +4403,7 @@ TRuntimeNode TProgramBuilder::InverseString(TRuntimeNode data) { } TRuntimeNode TProgramBuilder::Random(const TArrayRef<const TRuntimeNode>& dependentNodes) { - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::TDataType<double>::Id)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::TDataType<double>::Id)); for (auto& x : dependentNodes) { callableBuilder.Add(x); } @@ -4412,7 +4412,7 @@ TRuntimeNode TProgramBuilder::Random(const TArrayRef<const TRuntimeNode>& depend } TRuntimeNode TProgramBuilder::RandomNumber(const TArrayRef<const TRuntimeNode>& dependentNodes) { - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::TDataType<ui64>::Id)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::TDataType<ui64>::Id)); for (auto& x : dependentNodes) { callableBuilder.Add(x); } @@ -4421,7 +4421,7 @@ TRuntimeNode TProgramBuilder::RandomNumber(const TArrayRef<const TRuntimeNode>& } TRuntimeNode TProgramBuilder::RandomUuid(const TArrayRef<const TRuntimeNode>& dependentNodes) { - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::TDataType<NUdf::TUuid>::Id)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::TDataType<NUdf::TUuid>::Id)); for (auto& x : dependentNodes) { callableBuilder.Add(x); } @@ -4430,7 +4430,7 @@ TRuntimeNode TProgramBuilder::RandomUuid(const TArrayRef<const TRuntimeNode>& de } TRuntimeNode TProgramBuilder::Now(const TArrayRef<const TRuntimeNode>& args) { - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::TDataType<ui64>::Id)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::TDataType<ui64>::Id)); for (const auto& x : args) { callableBuilder.Add(x); } @@ -4448,24 +4448,24 @@ TRuntimeNode TProgramBuilder::CurrentUtcDatetime(const TArrayRef<const TRuntimeN TRuntimeNode TProgramBuilder::CurrentUtcTimestamp(const TArrayRef<const TRuntimeNode>& args) { return Coalesce(ToIntegral(Now(args), NewDataType(NUdf::TDataType<NUdf::TTimestamp>::Id, true)), - TRuntimeNode(BuildDataLiteral(NUdf::TUnboxedValuePod(ui64(NUdf::MAX_TIMESTAMP - 1ULL)), NUdf::TDataType<NUdf::TTimestamp>::Id, Env), true)); + TRuntimeNode(BuildDataLiteral(NUdf::TUnboxedValuePod(ui64(NUdf::MAX_TIMESTAMP - 1ULL)), NUdf::TDataType<NUdf::TTimestamp>::Id, Env_), true)); } TRuntimeNode TProgramBuilder::Pickle(TRuntimeNode data) { - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::EDataSlot::String)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::EDataSlot::String)); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::StablePickle(TRuntimeNode data) { - TCallableBuilder callableBuilder(Env, __func__, NewDataType(NUdf::EDataSlot::String)); + TCallableBuilder callableBuilder(Env_, __func__, NewDataType(NUdf::EDataSlot::String)); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::Unpickle(TType* type, TRuntimeNode serialized) { MKQL_ENSURE(AS_TYPE(TDataType, serialized)->GetSchemeType() == NUdf::TDataType<char*>::Id, "Expected String"); - TCallableBuilder callableBuilder(Env, __func__, type); + TCallableBuilder callableBuilder(Env_, __func__, type); callableBuilder.Add(TRuntimeNode(type, true)); callableBuilder.Add(serialized); return TRuntimeNode(callableBuilder.Build(), false); @@ -4473,14 +4473,14 @@ TRuntimeNode TProgramBuilder::Unpickle(TType* type, TRuntimeNode serialized) { TRuntimeNode TProgramBuilder::Ascending(TRuntimeNode data) { auto dataType = NewDataType(NUdf::EDataSlot::String); - TCallableBuilder callableBuilder(Env, __func__, dataType); + TCallableBuilder callableBuilder(Env_, __func__, dataType); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::Descending(TRuntimeNode data) { auto dataType = NewDataType(NUdf::EDataSlot::String); - TCallableBuilder callableBuilder(Env, __func__, dataType); + TCallableBuilder callableBuilder(Env_, __func__, dataType); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } @@ -4510,9 +4510,9 @@ TRuntimeNode TProgramBuilder::ToDecimal(TRuntimeNode data, ui8 precision, ui8 sc bool isOptional; auto dataType = UnpackOptionalData(data, isOptional); - TType* decimal = TDataDecimalType::Create(precision, scale, Env); + TType* decimal = TDataDecimalType::Create(precision, scale, Env_); if (isOptional) - decimal = TOptionalType::Create(decimal, Env); + decimal = TOptionalType::Create(decimal, Env_); const std::array<TRuntimeNode, 1> args = {{ data }}; if (dataType->GetSchemeType() == NUdf::TDataType<NUdf::TDecimal>::Id) { @@ -4560,14 +4560,14 @@ TRuntimeNode TProgramBuilder::ListIf(TRuntimeNode predicate, TRuntimeNode item) } TRuntimeNode TProgramBuilder::AsList(TRuntimeNode item) { - TListLiteralBuilder builder(Env, item.GetStaticType()); + TListLiteralBuilder builder(Env_, item.GetStaticType()); builder.Add(item); return TRuntimeNode(builder.Build(), true); } TRuntimeNode TProgramBuilder::AsList(const TArrayRef<const TRuntimeNode>& items) { MKQL_ENSURE(!items.empty(), "required not empty list of items"); - TListLiteralBuilder builder(Env, items[0].GetStaticType()); + TListLiteralBuilder builder(Env_, items[0].GetStaticType()); for (auto item : items) { builder.Add(item); } @@ -4595,7 +4595,7 @@ TRuntimeNode TProgramBuilder::MapJoinCore(TRuntimeNode flow, TRuntimeNode dict, rightRenamesNodes.reserve(rightRenames.size()); std::transform(rightRenames.cbegin(), rightRenames.cend(), std::back_inserter(rightRenamesNodes), [this](const ui32 idx) { return NewDataLiteral(idx); }); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(flow); callableBuilder.Add(dict); callableBuilder.Add(NewDataLiteral((ui32)joinKind)); @@ -4641,7 +4641,7 @@ TRuntimeNode TProgramBuilder::CommonJoinCore(TRuntimeNode flow, EJoinKind joinKi std::transform(keyColumns.cbegin(), keyColumns.cend(), std::back_inserter(keyColumnsNodes), std::bind(&TProgramBuilder::NewDataLiteral<ui32>, this, std::placeholders::_1)); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(flow); callableBuilder.Add(NewDataLiteral((ui32)joinKind)); callableBuilder.Add(NewTuple(leftInputColumnsNodes)); @@ -4695,7 +4695,7 @@ TRuntimeNode TProgramBuilder::WideCombiner(TRuntimeNode flow, i64 memLimit, cons tupleItems.reserve(output.size()); std::transform(output.cbegin(), output.cend(), std::back_inserter(tupleItems), std::bind(&TRuntimeNode::GetStaticType, std::placeholders::_1)); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(NewMultiType(tupleItems))); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(NewMultiType(tupleItems))); callableBuilder.Add(flow); callableBuilder.Add(NewDataLiteral(memLimit)); callableBuilder.Add(NewDataLiteral(ui32(keyArgs.size()))); @@ -4750,7 +4750,7 @@ TRuntimeNode TProgramBuilder::WideLastCombinerCommon(const TStringBuf& funcName, tupleItems.reserve(output.size()); std::transform(output.cbegin(), output.cend(), std::back_inserter(tupleItems), std::bind(&TRuntimeNode::GetStaticType, std::placeholders::_1)); - TCallableBuilder callableBuilder(Env, funcName, NewFlowType(NewMultiType(tupleItems))); + TCallableBuilder callableBuilder(Env_, funcName, NewFlowType(NewMultiType(tupleItems))); callableBuilder.Add(flow); callableBuilder.Add(NewDataLiteral(ui32(keyArgs.size()))); callableBuilder.Add(NewDataLiteral(ui32(stateArgs.size()))); @@ -4802,7 +4802,7 @@ TRuntimeNode TProgramBuilder::WideCondense1(TRuntimeNode flow, const TWideLambda tupleItems.reserve(next.size()); std::transform(next.cbegin(), next.cend(), std::back_inserter(tupleItems), std::bind(&TRuntimeNode::GetStaticType, std::placeholders::_1)); - TCallableBuilder callableBuilder(Env, __func__, NewFlowType(NewMultiType(tupleItems))); + TCallableBuilder callableBuilder(Env_, __func__, NewFlowType(NewMultiType(tupleItems))); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); std::for_each(first.cbegin(), first.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); @@ -4854,7 +4854,7 @@ TRuntimeNode TProgramBuilder::CombineCore(TRuntimeNode stream, } const auto resultStreamType = isStream ? NewStreamType(retItemType) : NewFlowType(retItemType); - TCallableBuilder callableBuilder(Env, __func__, resultStreamType); + TCallableBuilder callableBuilder(Env_, __func__, resultStreamType); callableBuilder.Add(stream); callableBuilder.Add(itemArg); callableBuilder.Add(key); @@ -4897,7 +4897,7 @@ TRuntimeNode TProgramBuilder::GroupingCore(TRuntimeNode stream, const std::array<TType*, 2U> tupleItems = {{ keyExtractorResult.GetStaticType(), NewStreamType(itemType) }}; const auto finishType = NewStreamType(NewTupleType(tupleItems)); - TCallableBuilder callableBuilder(Env, __func__, finishType); + TCallableBuilder callableBuilder(Env_, __func__, finishType); callableBuilder.Add(stream); callableBuilder.Add(keyExtractorResult); callableBuilder.Add(groupSwitchResult); @@ -4927,7 +4927,7 @@ TRuntimeNode TProgramBuilder::Chopper(TRuntimeNode flow, const TUnaryLambda& key const auto input = Arg(flowType); const auto output = groupHandler(keyArg, input); - TCallableBuilder callableBuilder(Env, __func__, output.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, output.GetStaticType()); callableBuilder.Add(flow); callableBuilder.Add(itemArg); @@ -4962,7 +4962,7 @@ TRuntimeNode TProgramBuilder::WideChopper(TRuntimeNode flow, const TWideLambda& const auto input = WideFlowArg(flow.GetStaticType()); const auto output = groupHandler(keyArgs, input); - TCallableBuilder callableBuilder(Env, __func__, output.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, output.GetStaticType()); callableBuilder.Add(flow); std::for_each(itemArgs.cbegin(), itemArgs.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); std::for_each(keys.cbegin(), keys.cend(), std::bind(&TCallableBuilder::Add, std::ref(callableBuilder), std::placeholders::_1)); @@ -4985,7 +4985,7 @@ TRuntimeNode TProgramBuilder::HoppingCore(TRuntimeNode list, { auto streamType = AS_TYPE(TStreamType, list); auto itemType = AS_TYPE(TStructType, streamType->GetItemType()); - auto timestampType = TOptionalType::Create(TDataType::Create(NUdf::TDataType<NUdf::TTimestamp>::Id, Env), Env); + auto timestampType = TOptionalType::Create(TDataType::Create(NUdf::TDataType<NUdf::TTimestamp>::Id, Env_), Env_); TRuntimeNode itemArg = Arg(itemType); @@ -5020,9 +5020,9 @@ TRuntimeNode TProgramBuilder::HoppingCore(TRuntimeNode list, auto finishType = outItemFinish.GetStaticType(); MKQL_ENSURE(finishType->IsStruct(), "Expected struct type as finish lambda output"); - auto resultType = TStreamType::Create(outItemFinish.GetStaticType(), Env); + auto resultType = TStreamType::Create(outItemFinish.GetStaticType(), Env_); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(stateArg); @@ -5058,7 +5058,7 @@ TRuntimeNode TProgramBuilder::MultiHoppingCore(TRuntimeNode list, { auto streamType = AS_TYPE(TStreamType, list); auto itemType = AS_TYPE(TStructType, streamType->GetItemType()); - auto timestampType = TOptionalType::Create(TDataType::Create(NUdf::TDataType<NUdf::TTimestamp>::Id, Env), Env); + auto timestampType = TOptionalType::Create(TDataType::Create(NUdf::TDataType<NUdf::TTimestamp>::Id, Env_), Env_); TRuntimeNode itemArg = Arg(itemType); @@ -5097,9 +5097,9 @@ TRuntimeNode TProgramBuilder::MultiHoppingCore(TRuntimeNode list, auto finishType = outItemFinish.GetStaticType(); MKQL_ENSURE(finishType->IsStruct(), "Expected struct type as finish lambda output"); - auto resultType = TStreamType::Create(outItemFinish.GetStaticType(), Env); + auto resultType = TStreamType::Create(outItemFinish.GetStaticType(), Env_); - TCallableBuilder callableBuilder(Env, __func__, resultType); + TCallableBuilder callableBuilder(Env_, __func__, resultType); callableBuilder.Add(list); callableBuilder.Add(itemArg); callableBuilder.Add(keyArg); @@ -5134,9 +5134,9 @@ TRuntimeNode TProgramBuilder::Default(TType* type) { const auto scheme = targetType->GetSchemeType(); const auto value = scheme == NUdf::TDataType<NUdf::TUuid>::Id ? - Env.NewStringValue("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv) : + Env_.NewStringValue("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv) : scheme == NUdf::TDataType<NUdf::TDyNumber>::Id ? NUdf::TUnboxedValuePod::Embedded("\1") : NUdf::TUnboxedValuePod::Zero(); - return TRuntimeNode(TDataLiteral::Create(value, targetType, Env), true); + return TRuntimeNode(TDataLiteral::Create(value, targetType, Env_), true); } TRuntimeNode TProgramBuilder::Cast(TRuntimeNode arg, TType* type) { @@ -5217,11 +5217,11 @@ TRuntimeNode TProgramBuilder::RangeCreate(TRuntimeNode list) { } outputComponents.push_back(lastComp); - auto outputBoundary = TTupleType::Create(outputComponents.size(), &outputComponents.front(), Env); + auto outputBoundary = TTupleType::Create(outputComponents.size(), &outputComponents.front(), Env_); std::vector<TType*> outputRangeComps(2, outputBoundary); - auto outputRange = TTupleType::Create(outputRangeComps.size(), &outputRangeComps.front(), Env); + auto outputRange = TTupleType::Create(outputRangeComps.size(), &outputRangeComps.front(), Env_); - TCallableBuilder callableBuilder(Env, __func__, TListType::Create(outputRange, Env)); + TCallableBuilder callableBuilder(Env_, __func__, TListType::Create(outputRange, Env_)); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); @@ -5269,13 +5269,13 @@ TRuntimeNode TProgramBuilder::RangeMultiply(const TArrayRef<const TRuntimeNode>& outputComponents.push_back(boundaryType->GetElementType(j)); } } - outputComponents.push_back(TDataType::Create(NUdf::TDataType<i32>::Id, Env)); + outputComponents.push_back(TDataType::Create(NUdf::TDataType<i32>::Id, Env_)); - auto outputBoundary = TTupleType::Create(outputComponents.size(), &outputComponents.front(), Env); + auto outputBoundary = TTupleType::Create(outputComponents.size(), &outputComponents.front(), Env_); std::vector<TType*> outputRangeComps(2, outputBoundary); - auto outputRange = TTupleType::Create(outputRangeComps.size(), &outputRangeComps.front(), Env); + auto outputRange = TTupleType::Create(outputRangeComps.size(), &outputRangeComps.front(), Env_); - TCallableBuilder callableBuilder(Env, __func__, TListType::Create(outputRange, Env)); + TCallableBuilder callableBuilder(Env_, __func__, TListType::Create(outputRange, Env_)); if (unlimited) { callableBuilder.Add(NewDataLiteral<ui64>(std::numeric_limits<ui64>::max())); } else { @@ -5311,11 +5311,11 @@ TRuntimeNode TProgramBuilder::RangeFinalize(TRuntimeNode list) { } } - auto outputBoundary = TTupleType::Create(outputComponents.size(), &outputComponents.front(), Env); + auto outputBoundary = TTupleType::Create(outputComponents.size(), &outputComponents.front(), Env_); std::vector<TType*> outputRangeComps(2, outputBoundary); - auto outputRange = TTupleType::Create(outputRangeComps.size(), &outputRangeComps.front(), Env); + auto outputRange = TTupleType::Create(outputRangeComps.size(), &outputRangeComps.front(), Env_); - TCallableBuilder callableBuilder(Env, __func__, TListType::Create(outputRange, Env)); + TCallableBuilder callableBuilder(Env_, __func__, TListType::Create(outputRange, Env_)); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); @@ -5339,7 +5339,7 @@ TRuntimeNode TProgramBuilder::Round(const std::string_view& callableName, TRunti NKikimr::NUdf::ECastOptions::AnywayLoseData), "Rounding from " << *sourceType << " to " << *targetType << " is trivial"); - TCallableBuilder callableBuilder(Env, callableName, TOptionalType::Create(targetType, Env)); + TCallableBuilder callableBuilder(Env_, callableName, TOptionalType::Create(targetType, Env_)); callableBuilder.Add(source); return TRuntimeNode(callableBuilder.Build(), false); @@ -5353,14 +5353,14 @@ TRuntimeNode TProgramBuilder::NextValue(TRuntimeNode value) { MKQL_ENSURE(slot == NUdf::EDataSlot::String || slot == NUdf::EDataSlot::Utf8, "Unsupported type: " << *valueType); - TCallableBuilder callableBuilder(Env, __func__, TOptionalType::Create(valueType, Env)); + TCallableBuilder callableBuilder(Env_, __func__, TOptionalType::Create(valueType, Env_)); callableBuilder.Add(value); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::Nop(TRuntimeNode value, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(value); return TRuntimeNode(callableBuilder.Build(), false); } @@ -5373,8 +5373,8 @@ TRuntimeNode TProgramBuilder::Replicate(TRuntimeNode item, TRuntimeNode count, c MKQL_ENSURE(count.GetStaticType()->IsData(), "Expected data"); MKQL_ENSURE(static_cast<const TDataType&>(*count.GetStaticType()).GetSchemeType() == NUdf::TDataType<ui64>::Id, "Expected ui64"); - const auto listType = TListType::Create(item.GetStaticType(), Env); - TCallableBuilder callableBuilder(Env, __func__, listType); + const auto listType = TListType::Create(item.GetStaticType(), Env_); + TCallableBuilder callableBuilder(Env_, __func__, listType); callableBuilder.Add(item); callableBuilder.Add(count); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(file)); @@ -5385,7 +5385,7 @@ TRuntimeNode TProgramBuilder::Replicate(TRuntimeNode item, TRuntimeNode count, c } TRuntimeNode TProgramBuilder::PgConst(TPgType* pgType, const std::string_view& value, TRuntimeNode typeMod) { - TCallableBuilder callableBuilder(Env, __func__, pgType); + TCallableBuilder callableBuilder(Env_, __func__, pgType); callableBuilder.Add(NewDataLiteral(pgType->GetTypeId())); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(value)); if (typeMod) { @@ -5398,7 +5398,7 @@ TRuntimeNode TProgramBuilder::PgConst(TPgType* pgType, const std::string_view& v TRuntimeNode TProgramBuilder::PgResolvedCall(bool useContext, const std::string_view& name, ui32 id, const TArrayRef<const TRuntimeNode>& args, TType* returnType, bool rangeFunction) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(NewDataLiteral(useContext)); callableBuilder.Add(NewDataLiteral(rangeFunction)); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(name)); @@ -5411,7 +5411,7 @@ TRuntimeNode TProgramBuilder::PgResolvedCall(bool useContext, const std::string_ TRuntimeNode TProgramBuilder::BlockPgResolvedCall(const std::string_view& name, ui32 id, const TArrayRef<const TRuntimeNode>& args, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(name)); callableBuilder.Add(NewDataLiteral(id)); for (const auto& arg : args) { @@ -5421,7 +5421,7 @@ TRuntimeNode TProgramBuilder::BlockPgResolvedCall(const std::string_view& name, } TRuntimeNode TProgramBuilder::PgArray(const TArrayRef<const TRuntimeNode>& args, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); for (const auto& arg : args) { callableBuilder.Add(arg); } @@ -5433,7 +5433,7 @@ TRuntimeNode TProgramBuilder::PgTableContent( const std::string_view& cluster, const std::string_view& table, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(cluster)); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(table)); return TRuntimeNode(callableBuilder.Build(), false); @@ -5452,7 +5452,7 @@ TRuntimeNode TProgramBuilder::PgToRecord(TRuntimeNode input, const TArrayRef<std } auto returnType = NewPgType(NYql::NPg::LookupType("record").TypeId); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(input); TVector<TRuntimeNode> names; for (const auto& x : members) { @@ -5465,7 +5465,7 @@ TRuntimeNode TProgramBuilder::PgToRecord(TRuntimeNode input, const TArrayRef<std } TRuntimeNode TProgramBuilder::PgCast(TRuntimeNode input, TType* returnType, TRuntimeNode typeMod) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(input); if (typeMod) { callableBuilder.Add(typeMod); @@ -5475,19 +5475,19 @@ TRuntimeNode TProgramBuilder::PgCast(TRuntimeNode input, TType* returnType, TRun } TRuntimeNode TProgramBuilder::FromPg(TRuntimeNode input, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(input); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::ToPg(TRuntimeNode input, TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(input); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::PgClone(TRuntimeNode input, const TArrayRef<const TRuntimeNode>& dependentNodes) { - TCallableBuilder callableBuilder(Env, __func__, input.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, input.GetStaticType()); callableBuilder.Add(input); for (const auto& node : dependentNodes) { callableBuilder.Add(node); @@ -5497,14 +5497,14 @@ TRuntimeNode TProgramBuilder::PgClone(TRuntimeNode input, const TArrayRef<const } TRuntimeNode TProgramBuilder::WithContext(TRuntimeNode input, const std::string_view& contextType) { - TCallableBuilder callableBuilder(Env, __func__, input.GetStaticType()); + TCallableBuilder callableBuilder(Env_, __func__, input.GetStaticType()); callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(contextType)); callableBuilder.Add(input); return TRuntimeNode(callableBuilder.Build(), false); } TRuntimeNode TProgramBuilder::PgInternal0(TType* returnType) { - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); return TRuntimeNode(callableBuilder.Build(), false); } @@ -5518,7 +5518,7 @@ TRuntimeNode TProgramBuilder::BlockIf(TRuntimeNode condition, TRuntimeNode thenB MKQL_ENSURE(thenType->GetItemType()->IsSameType(*elseType->GetItemType()), "Different return types in branches."); auto returnType = NewBlockType(thenType->GetItemType(), GetResultShape({conditionType, thenType, elseType})); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(condition); callableBuilder.Add(thenBranch); callableBuilder.Add(elseBranch); @@ -5528,7 +5528,7 @@ TRuntimeNode TProgramBuilder::BlockIf(TRuntimeNode condition, TRuntimeNode thenB TRuntimeNode TProgramBuilder::BlockJust(TRuntimeNode data) { const auto initialType = AS_TYPE(TBlockType, data.GetStaticType()); auto returnType = NewBlockType(NewOptionalType(initialType->GetItemType()), initialType->GetShape()); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(data); return TRuntimeNode(callableBuilder.Build(), false); } @@ -5538,7 +5538,7 @@ TRuntimeNode TProgramBuilder::BlockFunc(const std::string_view& funcName, TType* MKQL_ENSURE(arg.GetStaticType()->IsBlock(), "Expected Block type"); } - TCallableBuilder builder(Env, __func__, returnType); + TCallableBuilder builder(Env_, __func__, returnType); builder.Add(NewDataLiteral<NUdf::EDataSlot::String>(funcName)); for (const auto& arg : args) { builder.Add(arg); @@ -5553,7 +5553,7 @@ TRuntimeNode TProgramBuilder::BuildBlockCombineAll(const std::string_view& calla MKQL_ENSURE(inputType->IsStream() || inputType->IsFlow(), "Expected either stream or flow as input type"); MKQL_ENSURE(returnType->IsStream() || returnType->IsFlow(), "Expected either stream or flow as return type"); - TCallableBuilder builder(Env, callableName, returnType); + TCallableBuilder builder(Env_, callableName, returnType); builder.Add(input); if (!filterColumn) { @@ -5596,7 +5596,7 @@ TRuntimeNode TProgramBuilder::BuildBlockCombineHashed(const std::string_view& ca MKQL_ENSURE(inputType->IsStream() || inputType->IsFlow(), "Expected either stream or flow as input type"); MKQL_ENSURE(returnType->IsStream() || returnType->IsFlow(), "Expected either stream or flow as return type"); - TCallableBuilder builder(Env, callableName, returnType); + TCallableBuilder builder(Env_, callableName, returnType); builder.Add(input); if (!filterColumn) { @@ -5645,7 +5645,7 @@ TRuntimeNode TProgramBuilder::BuildBlockMergeFinalizeHashed(const std::string_vi MKQL_ENSURE(inputType->IsStream() || inputType->IsFlow(), "Expected either stream or flow as input type"); MKQL_ENSURE(returnType->IsStream() || returnType->IsFlow(), "Expected either stream or flow as return type"); - TCallableBuilder builder(Env, callableName, returnType); + TCallableBuilder builder(Env_, callableName, returnType); builder.Add(input); TVector<TRuntimeNode> keyNodes; @@ -5688,7 +5688,7 @@ TRuntimeNode TProgramBuilder::BuildBlockMergeManyFinalizeHashed(const std::strin MKQL_ENSURE(inputType->IsStream() || inputType->IsFlow(), "Expected either stream or flow as input type"); MKQL_ENSURE(returnType->IsStream() || returnType->IsFlow(), "Expected either stream or flow as return type"); - TCallableBuilder builder(Env, callableName, returnType); + TCallableBuilder builder(Env_, callableName, returnType); builder.Add(input); TVector<TRuntimeNode> keyNodes; @@ -5752,7 +5752,7 @@ TRuntimeNode TProgramBuilder::ScalarApply(const TArrayRef<const TRuntimeNode>& a auto ret = handler(lambdaArgs); MKQL_ENSURE(ConvertArrowType(ret.GetStaticType(), arrowType), "Unsupported arrow type"); auto returnType = NewBlockType(ret.GetStaticType(), scalarOnly ? TBlockType::EShape::Scalar : TBlockType::EShape::Many); - TCallableBuilder builder(Env, __func__, returnType); + TCallableBuilder builder(Env_, __func__, returnType); for (const auto& arg : args) { builder.Add(arg); } @@ -5781,7 +5781,7 @@ TRuntimeNode TProgramBuilder::BlockStorage(TRuntimeNode list, TType* returnType) auto returnResourceType = AS_TYPE(TResourceType, returnType); MKQL_ENSURE(returnResourceType->GetTag().StartsWith(BlockStorageResourcePrefix), "Expected block storage resource"); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(list); return TRuntimeNode(callableBuilder.Build(), false); @@ -5811,7 +5811,7 @@ TRuntimeNode TProgramBuilder::BlockMapJoinIndex(TRuntimeNode blockStorage, TType return NewDataLiteral(idx); }); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(blockStorage); callableBuilder.Add(TRuntimeNode(listItemType, true)); callableBuilder.Add(NewTuple(keyColumnsNodes)); @@ -5881,7 +5881,7 @@ TRuntimeNode TProgramBuilder::BlockMapJoinCore(TRuntimeNode leftStream, TRuntime return NewDataLiteral(idx); }); - TCallableBuilder callableBuilder(Env, __func__, returnType); + TCallableBuilder callableBuilder(Env_, __func__, returnType); callableBuilder.Add(leftStream); callableBuilder.Add(rightBlockStorage); callableBuilder.Add(TRuntimeNode(rightListItemType, true)); @@ -5947,7 +5947,7 @@ TRuntimeNode TProgramBuilder::MatchRecognizeCore( {"From", NewDataType(NUdf::EDataSlot::Uint64)}, {"To", NewDataType(NUdf::EDataSlot::Uint64)} })); - TStructTypeBuilder matchedVarsTypeBuilder(Env); + TStructTypeBuilder matchedVarsTypeBuilder(Env_); for (const auto& var: GetPatternVars(pattern)) { matchedVarsTypeBuilder.Add(var, rangeList); } @@ -5960,11 +5960,11 @@ TRuntimeNode TProgramBuilder::MatchRecognizeCore( TVector<TRuntimeNode> measures; //--- if (getMeasures.empty()) { - measureInputDataArg = Arg(Env.GetTypeOfVoidLazy()); + measureInputDataArg = Arg(Env_.GetTypeOfVoidLazy()); } else { measures.reserve(getMeasures.size()); specialColumnIndexesInMeasureInputDataRow.resize(static_cast<size_t>(NYql::NMatchRecognize::EMeasureInputDataSpecialColumns::Last)); - TStructTypeBuilder measureInputDataRowTypeBuilder(Env); + TStructTypeBuilder measureInputDataRowTypeBuilder(Env_); for (ui32 i = 0; i < inputRowType->GetMembersCount(); ++i) { measureInputDataRowTypeBuilder.Add(inputRowType->GetMemberName(i), inputRowType->GetMemberType(i)); } @@ -5994,7 +5994,7 @@ TRuntimeNode TProgramBuilder::MatchRecognizeCore( } } - TStructTypeBuilder outputRowTypeBuilder(Env); + TStructTypeBuilder outputRowTypeBuilder(Env_); THashMap<TStringBuf, size_t> partitionColumnLookup; THashMap<TStringBuf, size_t> measureColumnLookup; THashMap<TStringBuf, size_t> otherColumnLookup; @@ -6126,17 +6126,17 @@ TRuntimeNode TProgramBuilder::TimeOrderRecover( { auto& inputRowType = *static_cast<TStructType*>(AS_TYPE(TStructType, AS_TYPE(TFlowType, inputStream.GetStaticType())->GetItemType())); const auto inputRowArg = Arg(&inputRowType); - TStructTypeBuilder outputRowTypeBuilder(Env); + TStructTypeBuilder outputRowTypeBuilder(Env_); outputRowTypeBuilder.Reserve(inputRowType.GetMembersCount() + 1); const ui32 inputRowColumnCount = inputRowType.GetMembersCount(); for (ui32 i = 0; i != inputRowColumnCount; ++i) { outputRowTypeBuilder.Add(inputRowType.GetMemberName(i), inputRowType.GetMemberType(i)); } using NYql::NTimeOrderRecover::OUT_OF_ORDER_MARKER; - outputRowTypeBuilder.Add(OUT_OF_ORDER_MARKER, TDataType::Create(NUdf::TDataType<bool>::Id, Env)); + outputRowTypeBuilder.Add(OUT_OF_ORDER_MARKER, TDataType::Create(NUdf::TDataType<bool>::Id, Env_)); const auto outputRowType = outputRowTypeBuilder.Build(); const auto outOfOrderColumnIndex = outputRowType->GetMemberIndex(OUT_OF_ORDER_MARKER); - TCallableBuilder callableBuilder(GetTypeEnvironment(), "TimeOrderRecover", TFlowType::Create(outputRowType, Env)); + TCallableBuilder callableBuilder(GetTypeEnvironment(), "TimeOrderRecover", TFlowType::Create(outputRowType, Env_)); callableBuilder.Add(inputStream); callableBuilder.Add(inputRowArg); diff --git a/yql/essentials/minikql/mkql_program_builder.h b/yql/essentials/minikql/mkql_program_builder.h index 67a74dd48b6..f5a6fc28e73 100644 --- a/yql/essentials/minikql/mkql_program_builder.h +++ b/yql/essentials/minikql/mkql_program_builder.h @@ -160,7 +160,7 @@ public: template <typename T, typename = std::enable_if_t<NUdf::TKnownDataType<T>::Result>> TRuntimeNode NewDataLiteral(T data) const { - return TRuntimeNode(BuildDataLiteral(NUdf::TUnboxedValuePod(data), NUdf::TDataType<T>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(NUdf::TUnboxedValuePod(data), NUdf::TDataType<T>::Id, Env_), true); } @@ -168,7 +168,7 @@ public: TRuntimeNode NewTzDataLiteral(typename NUdf::TDataType<T>::TLayout value, ui16 tzId) const { auto data = NUdf::TUnboxedValuePod(value); data.SetTimezoneId(tzId); - return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<T>::Id, Env), true); + return TRuntimeNode(BuildDataLiteral(data, NUdf::TDataType<T>::Id, Env_), true); } template <NUdf::EDataSlot Type> @@ -868,10 +868,10 @@ private: bool IsNull(TRuntimeNode arg); protected: - const IFunctionRegistry& FunctionRegistry; - const bool VoidWithEffects; - const NYql::TLangVersion LangVer; - NUdf::ITypeInfoHelper::TPtr TypeInfoHelper; + const IFunctionRegistry& FunctionRegistry_; + const bool VoidWithEffects_; + const NYql::TLangVersion LangVer_; + NUdf::ITypeInfoHelper::TPtr TypeInfoHelper_; }; bool CanExportType(TType* type, const TTypeEnvironment& env); diff --git a/yql/essentials/minikql/mkql_terminator.cpp b/yql/essentials/minikql/mkql_terminator.cpp index a889d76d0a8..6cb9db03b84 100644 --- a/yql/essentials/minikql/mkql_terminator.cpp +++ b/yql/essentials/minikql/mkql_terminator.cpp @@ -16,14 +16,14 @@ TTerminateException::TTerminateException() thread_local ITerminator* TBindTerminator::Terminator = nullptr; TBindTerminator::TBindTerminator(ITerminator* terminator) - : PreviousTerminator(Terminator) + : PreviousTerminator_(Terminator) { Terminator = terminator; } TBindTerminator::~TBindTerminator() { - Terminator = PreviousTerminator; + Terminator = PreviousTerminator_; } TThrowingBindTerminator::TThrowingBindTerminator() diff --git a/yql/essentials/minikql/mkql_terminator.h b/yql/essentials/minikql/mkql_terminator.h index 3bfaa3f20b9..0aa758e414f 100644 --- a/yql/essentials/minikql/mkql_terminator.h +++ b/yql/essentials/minikql/mkql_terminator.h @@ -31,7 +31,7 @@ struct TBindTerminator : private TNonCopyable { static thread_local ITerminator* Terminator; private: - ITerminator* PreviousTerminator; + ITerminator* PreviousTerminator_; }; struct TThrowingBindTerminator : public TBindTerminator, public ITerminator { diff --git a/yql/essentials/minikql/mkql_type_builder.cpp b/yql/essentials/minikql/mkql_type_builder.cpp index cc70d26e5ee..51181edbd7f 100644 --- a/yql/essentials/minikql/mkql_type_builder.cpp +++ b/yql/essentials/minikql/mkql_type_builder.cpp @@ -62,7 +62,7 @@ private: class TPgTypeIndex { using TUdfTypes = TVector<NYql::NUdf::TPgTypeDescription>; - TUdfTypes Types; + TUdfTypes Types_; public: TPgTypeIndex() { @@ -70,15 +70,15 @@ public: } void Rebuild() { - Types.clear(); + Types_.clear(); ui32 maxTypeId = 0; NYql::NPg::EnumTypes([&](ui32 typeId, const NYql::NPg::TTypeDesc&) { maxTypeId = Max(maxTypeId, typeId); }); - Types.resize(maxTypeId + 1); + Types_.resize(maxTypeId + 1); NYql::NPg::EnumTypes([&](ui32 typeId, const NYql::NPg::TTypeDesc& t) { - auto& e = Types[typeId]; + auto& e = Types_[typeId]; e.Name = t.Name; e.TypeId = t.TypeId; e.Typelen = t.TypeLen; @@ -89,10 +89,10 @@ public: } const NYql::NUdf::TPgTypeDescription* Resolve(ui32 typeId) const { - if (typeId >= Types.size()) { + if (typeId >= Types_.size()) { return nullptr; } - auto& e = Types[typeId]; + auto& e = Types_[typeId]; if (!e.TypeId) { return nullptr; } @@ -547,13 +547,13 @@ public: NUdf::ICallableTypeBuilder& Arg(NUdf::TDataTypeId typeId) override { auto type = NMiniKQL::TDataType::Create(typeId, Env_); - Args_.emplace_back().Type_ = type; + Args_.emplace_back().Type = type; return *this; } NUdf::ICallableTypeBuilder& Arg(const NUdf::TType* type) override { auto mkqlType = const_cast<NMiniKQL::TType*>(static_cast<const NMiniKQL::TType*>(type)); - Args_.emplace_back().Type_ = mkqlType; + Args_.emplace_back().Type = mkqlType; return *this; } @@ -561,17 +561,17 @@ public: const NUdf::ITypeBuilder& typeBuilder) override { auto type = static_cast<NMiniKQL::TType*>(typeBuilder.Build()); - Args_.emplace_back().Type_ = type; + Args_.emplace_back().Type = type; return *this; } NUdf::ICallableTypeBuilder& Name(const NUdf::TStringRef& name) override { - Args_.back().Name_ = Env_.InternName(name); + Args_.back().Name = Env_.InternName(name); return *this; } NUdf::ICallableTypeBuilder& Flags(ui64 flags) override { - Args_.back().Flags_ = flags; + Args_.back().Flags = flags; return *this; } @@ -585,13 +585,13 @@ public: NMiniKQL::TCallableTypeBuilder builder(Env_, UdfName, ReturnType_); for (const auto& arg : Args_) { - builder.Add(arg.Type_); - if (!arg.Name_.Str().empty()) { - builder.SetArgumentName(arg.Name_.Str()); + builder.Add(arg.Type); + if (!arg.Name.Str().empty()) { + builder.SetArgumentName(arg.Name.Str()); } - if (arg.Flags_ != 0) { - builder.SetArgumentFlags(arg.Flags_); + if (arg.Flags != 0) { + builder.SetArgumentFlags(arg.Flags); } } builder.SetOptionalArgs(OptionalArgs_); @@ -624,14 +624,14 @@ public: NUdf::IFunctionArgTypesBuilder& Add(NUdf::TDataTypeId typeId) override { auto type = NMiniKQL::TDataType::Create(typeId, Env_); Args_.emplace_back(); - Args_.back().Type_ = type; + Args_.back().Type = type; return *this; } NUdf::IFunctionArgTypesBuilder& Add(const NUdf::TType* type) override { auto mkqlType = static_cast<const NMiniKQL::TType*>(type); Args_.emplace_back(); - Args_.back().Type_ = const_cast<NMiniKQL::TType*>(mkqlType); + Args_.back().Type = const_cast<NMiniKQL::TType*>(mkqlType); return *this; } @@ -640,17 +640,17 @@ public: { auto type = static_cast<NMiniKQL::TType*>(typeBuilder.Build()); Args_.emplace_back(); - Args_.back().Type_ = type; + Args_.back().Type = type; return *this; } NUdf::IFunctionArgTypesBuilder& Name(const NUdf::TStringRef& name) override { - Args_.back().Name_ = Env_.InternName(name); + Args_.back().Name = Env_.InternName(name); return *this; } NUdf::IFunctionArgTypesBuilder& Flags(ui64 flags) override { - Args_.back().Flags_ = flags; + Args_.back().Flags = flags; return *this; } @@ -1703,7 +1703,7 @@ bool ConvertArrowOutputType(NUdf::EDataSlot slot, std::shared_ptr<arrow::DataTyp } void TArrowType::Export(ArrowSchema* out) const { - auto status = arrow::ExportType(*Type, out); + auto status = arrow::ExportType(*Type_, out); if (!status.ok()) { UdfTerminate(status.ToString().c_str()); } @@ -1806,7 +1806,7 @@ NUdf::IFunctionTypeInfoBuilder15& TFunctionTypeInfoBuilder::IsStrictImpl() { } const NUdf::IBlockTypeHelper& TFunctionTypeInfoBuilder::IBlockTypeHelper() const { - return BlockTypeHelper; + return BlockTypeHelper_; } bool TFunctionTypeInfoBuilder::GetSecureParam(NUdf::TStringRef key, NUdf::TStringRef& value) const { @@ -1933,13 +1933,13 @@ void TFunctionTypeInfoBuilder::Build(TFunctionTypeInfo* funcInfo) if (ReturnType_) { TCallableTypeBuilder builder(Env_, UdfName, const_cast<NMiniKQL::TType*>(ReturnType_)); for (const auto& arg : Args_) { - builder.Add(arg.Type_); - if (!arg.Name_.Str().empty()) { - builder.SetArgumentName(arg.Name_.Str()); + builder.Add(arg.Type); + if (!arg.Name.Str().empty()) { + builder.SetArgumentName(arg.Name.Str()); } - if (arg.Flags_ != 0) { - builder.SetArgumentFlags(arg.Flags_); + if (arg.Flags != 0) { + builder.SetArgumentFlags(arg.Flags); } } @@ -2713,26 +2713,26 @@ NUdf::IBlockItemHasher::TPtr TBlockTypeHelper::MakeHasher(NUdf::TType* type) con } TType* TTypeBuilder::NewVoidType() const { - return TRuntimeNode(Env.GetVoidLazy(), true).GetStaticType(); + return TRuntimeNode(Env_.GetVoidLazy(), true).GetStaticType(); } TType* TTypeBuilder::NewNullType() const { - if (UseNullType) { - return TRuntimeNode(Env.GetNullLazy(), true).GetStaticType(); + if (UseNullType_) { + return TRuntimeNode(Env_.GetNullLazy(), true).GetStaticType(); } - TCallableBuilder callableBuilder(Env, "Null", NewOptionalType(NewVoidType())); + TCallableBuilder callableBuilder(Env_, "Null", NewOptionalType(NewVoidType())); return TRuntimeNode(callableBuilder.Build(), false).GetStaticType(); } TType* TTypeBuilder::NewEmptyStructType() const { - return Env.GetEmptyStructLazy()->GetGenericType(); + return Env_.GetEmptyStructLazy()->GetGenericType(); } TType* TTypeBuilder::NewStructType(TType* baseStructType, const std::string_view& memberName, TType* memberType) const { MKQL_ENSURE(baseStructType->IsStruct(), "Expected struct type"); const auto& detailedBaseStructType = static_cast<const TStructType&>(*baseStructType); - TStructTypeBuilder builder(Env); + TStructTypeBuilder builder(Env_); builder.Reserve(detailedBaseStructType.GetMembersCount() + 1); for (ui32 i = 0, e = detailedBaseStructType.GetMembersCount(); i < e; ++i) { builder.Add(detailedBaseStructType.GetMemberName(i), detailedBaseStructType.GetMemberType(i)); @@ -2743,7 +2743,7 @@ TType* TTypeBuilder::NewStructType(TType* baseStructType, const std::string_view } TType* TTypeBuilder::NewStructType(const TArrayRef<const std::pair<std::string_view, TType*>>& memberTypes) const { - TStructTypeBuilder builder(Env); + TStructTypeBuilder builder(Env_); builder.Reserve(memberTypes.size()); for (auto& x : memberTypes) { builder.Add(x.first, x.second); @@ -2757,51 +2757,51 @@ TType* TTypeBuilder::NewArrayType(const TArrayRef<const std::pair<std::string_vi } TType* TTypeBuilder::NewDataType(NUdf::TDataTypeId schemeType, bool optional) const { - return optional ? NewOptionalType(TDataType::Create(schemeType, Env)) : TDataType::Create(schemeType, Env); + return optional ? NewOptionalType(TDataType::Create(schemeType, Env_)) : TDataType::Create(schemeType, Env_); } TType* TTypeBuilder::NewPgType(ui32 typeId) const { - return TPgType::Create(typeId, Env); + return TPgType::Create(typeId, Env_); } TType* TTypeBuilder::NewDecimalType(ui8 precision, ui8 scale) const { - return TDataDecimalType::Create(precision, scale, Env); + return TDataDecimalType::Create(precision, scale, Env_); } TType* TTypeBuilder::NewOptionalType(TType* itemType) const { - return TOptionalType::Create(itemType, Env); + return TOptionalType::Create(itemType, Env_); } TType* TTypeBuilder::NewListType(TType* itemType) const { - return TListType::Create(itemType, Env); + return TListType::Create(itemType, Env_); } TType* TTypeBuilder::NewStreamType(TType* itemType) const { - return TStreamType::Create(itemType, Env); + return TStreamType::Create(itemType, Env_); } TType* TTypeBuilder::NewFlowType(TType* itemType) const { - return TFlowType::Create(itemType, Env); + return TFlowType::Create(itemType, Env_); } TType* TTypeBuilder::NewBlockType(TType* itemType, TBlockType::EShape shape) const { - return TBlockType::Create(itemType, shape, Env); + return TBlockType::Create(itemType, shape, Env_); } TType* TTypeBuilder::NewTaggedType(TType* baseType, const std::string_view& tag) const { - return TTaggedType::Create(baseType, tag, Env); + return TTaggedType::Create(baseType, tag, Env_); } TType* TTypeBuilder::NewDictType(TType* keyType, TType* payloadType, bool multi) const { - return TDictType::Create(keyType, multi ? NewListType(payloadType) : payloadType, Env); + return TDictType::Create(keyType, multi ? NewListType(payloadType) : payloadType, Env_); } TType* TTypeBuilder::NewEmptyTupleType() const { - return Env.GetEmptyTupleLazy()->GetGenericType(); + return Env_.GetEmptyTupleLazy()->GetGenericType(); } TType* TTypeBuilder::NewTupleType(const TArrayRef<TType* const>& elements) const { - return TTupleType::Create(elements.size(), elements.data(), Env); + return TTupleType::Create(elements.size(), elements.data(), Env_); } TType* TTypeBuilder::NewArrayType(const TArrayRef<TType* const>& elements) const { @@ -2809,19 +2809,19 @@ TType* TTypeBuilder::NewArrayType(const TArrayRef<TType* const>& elements) const } TType* TTypeBuilder::NewEmptyMultiType() const { - return TMultiType::Create(0, nullptr, Env); + return TMultiType::Create(0, nullptr, Env_); } TType* TTypeBuilder::NewMultiType(const TArrayRef<TType* const>& elements) const { - return TMultiType::Create(elements.size(), elements.data(), Env); + return TMultiType::Create(elements.size(), elements.data(), Env_); } TType* TTypeBuilder::NewResourceType(const std::string_view& tag) const { - return TResourceType::Create(tag, Env); + return TResourceType::Create(tag, Env_); } TType* TTypeBuilder::NewVariantType(TType* underlyingType) const { - return TVariantType::Create(underlyingType, Env); + return TVariantType::Create(underlyingType, Env_); } TType* TTypeBuilder::ValidateBlockStructType(const TStructType* structType) const { diff --git a/yql/essentials/minikql/mkql_type_builder.h b/yql/essentials/minikql/mkql_type_builder.h index cc145f0d25d..39ff3076420 100644 --- a/yql/essentials/minikql/mkql_type_builder.h +++ b/yql/essentials/minikql/mkql_type_builder.h @@ -53,17 +53,17 @@ std::shared_ptr<arrow::StructType> MakeTzDateArrowType() { class TArrowType : public NUdf::IArrowType { public: TArrowType(const std::shared_ptr<arrow::DataType>& type) - : Type(type) + : Type_(type) {} std::shared_ptr<arrow::DataType> GetType() const { - return Type; + return Type_; } void Export(ArrowSchema* out) const final; private: - const std::shared_ptr<arrow::DataType> Type; + const std::shared_ptr<arrow::DataType> Type_; }; ////////////////////////////////////////////////////////////////////////////// @@ -89,9 +89,9 @@ struct TFunctionTypeInfo // TArgInfo ////////////////////////////////////////////////////////////////////////////// struct TArgInfo { - NMiniKQL::TType* Type_ = nullptr; - TInternName Name_; - ui64 Flags_; + NMiniKQL::TType* Type = nullptr; + TInternName Name; + ui64 Flags; }; ////////////////////////////////////////////////////////////////////////////// @@ -206,7 +206,7 @@ private: ui32 OptionalArgs_ = 0; TString Payload_; NUdf::ITypeInfoHelper::TPtr TypeInfoHelper_; - TBlockTypeHelper BlockTypeHelper; + TBlockTypeHelper BlockTypeHelper_; TStringBuf ModuleName_; NUdf::ICountersProvider* CountersProvider_; NUdf::TSourcePosition Pos_; @@ -269,11 +269,13 @@ ui64 CalcMaxBlockLength(T beginIt, T endIt, const NUdf::ITypeInfoHelper& helper) class TTypeBuilder : public TMoveOnly { public: TTypeBuilder(const TTypeEnvironment& env) - : Env(env) + : Env_(env) + , Env(env) + , UseNullType(UseNullType_) {} const TTypeEnvironment& GetTypeEnvironment() const { - return Env; + return Env_; } TType* NewVoidType() const; @@ -317,8 +319,12 @@ public: TType* ValidateBlockStructType(const TStructType* structType) const; protected: - const TTypeEnvironment& Env; - bool UseNullType = true; + const TTypeEnvironment& Env_; + //FIXME Remove + const TTypeEnvironment& Env; // NOLINT(readability-identifier-naming) + bool UseNullType_ = true; + //FIXME Remove + bool& UseNullType; // NOLINT(readability-identifier-naming) }; void RebuildTypeIndex(); diff --git a/yql/essentials/minikql/mkql_type_builder_ut.cpp b/yql/essentials/minikql/mkql_type_builder_ut.cpp index f74808e4651..1fe14af5e69 100644 --- a/yql/essentials/minikql/mkql_type_builder_ut.cpp +++ b/yql/essentials/minikql/mkql_type_builder_ut.cpp @@ -13,17 +13,17 @@ namespace NMiniKQL { class TMiniKQLTypeBuilderTest : public TTestBase { public: TMiniKQLTypeBuilderTest() - : Alloc(__LOCATION__) - , Env(Alloc) - , TypeInfoHelper(new TTypeInfoHelper()) - , FunctionTypeInfoBuilder(NYql::UnknownLangVersion, Env, TypeInfoHelper, "", nullptr, {}) { + : Alloc_(__LOCATION__) + , Env_(Alloc_) + , TypeInfoHelper_(new TTypeInfoHelper()) + , FunctionTypeInfoBuilder_(NYql::UnknownLangVersion, Env_, TypeInfoHelper_, "", nullptr, {}) { } private: - TScopedAlloc Alloc; - TTypeEnvironment Env; - NUdf::ITypeInfoHelper::TPtr TypeInfoHelper; - TFunctionTypeInfoBuilder FunctionTypeInfoBuilder; + TScopedAlloc Alloc_; + TTypeEnvironment Env_; + NUdf::ITypeInfoHelper::TPtr TypeInfoHelper_; + TFunctionTypeInfoBuilder FunctionTypeInfoBuilder_; UNIT_TEST_SUITE(TMiniKQLTypeBuilderTest); UNIT_TEST(TestPgTypeFormat); @@ -45,56 +45,56 @@ private: TString FormatType(NUdf::TType* t) { TStringBuilder output; - NUdf::TTypePrinter p(*TypeInfoHelper, t); + NUdf::TTypePrinter p(*TypeInfoHelper_, t); p.Out(output.Out); return output; } void TestPgTypeFormat() { { - auto s = FormatType(FunctionTypeInfoBuilder.Pg(NYql::NPg::LookupType("bool").TypeId)); + auto s = FormatType(FunctionTypeInfoBuilder_.Pg(NYql::NPg::LookupType("bool").TypeId)); UNIT_ASSERT_VALUES_EQUAL(s, "pgbool"); } { - auto s = FormatType(FunctionTypeInfoBuilder.Pg(NYql::NPg::LookupType("_bool").TypeId)); + auto s = FormatType(FunctionTypeInfoBuilder_.Pg(NYql::NPg::LookupType("_bool").TypeId)); UNIT_ASSERT_VALUES_EQUAL(s, "_pgbool"); } } void TestBlockTypeFormat() { { - auto s = FormatType(FunctionTypeInfoBuilder.Block(true)->Item<ui32>().Build()); + auto s = FormatType(FunctionTypeInfoBuilder_.Block(true)->Item<ui32>().Build()); UNIT_ASSERT_VALUES_EQUAL(s, "Scalar<Uint32>"); } { - auto s = FormatType(FunctionTypeInfoBuilder.Block(false)->Item<ui32>().Build()); + auto s = FormatType(FunctionTypeInfoBuilder_.Block(false)->Item<ui32>().Build()); UNIT_ASSERT_VALUES_EQUAL(s, "Block<Uint32>"); } } void TestSingularTypeFormat() { { - auto s = FormatType(FunctionTypeInfoBuilder.Null()); + auto s = FormatType(FunctionTypeInfoBuilder_.Null()); UNIT_ASSERT_VALUES_EQUAL(s, "Null"); } { - auto s = FormatType(FunctionTypeInfoBuilder.Void()); + auto s = FormatType(FunctionTypeInfoBuilder_.Void()); UNIT_ASSERT_VALUES_EQUAL(s, "Void"); } { - auto s = FormatType(FunctionTypeInfoBuilder.EmptyList()); + auto s = FormatType(FunctionTypeInfoBuilder_.EmptyList()); UNIT_ASSERT_VALUES_EQUAL(s, "EmptyList"); } { - auto s = FormatType(FunctionTypeInfoBuilder.EmptyDict()); + auto s = FormatType(FunctionTypeInfoBuilder_.EmptyDict()); UNIT_ASSERT_VALUES_EQUAL(s, "EmptyDict"); } } void TestOptionalTypeFormat() { - auto optional1 = FunctionTypeInfoBuilder.Optional()->Item<i64>().Build(); - auto optional2 = FunctionTypeInfoBuilder.Optional()->Item(optional1).Build(); - auto optional3 = FunctionTypeInfoBuilder.Optional()->Item(optional2).Build(); + auto optional1 = FunctionTypeInfoBuilder_.Optional()->Item<i64>().Build(); + auto optional2 = FunctionTypeInfoBuilder_.Optional()->Item(optional1).Build(); + auto optional3 = FunctionTypeInfoBuilder_.Optional()->Item(optional2).Build(); { auto s = FormatType(optional1); UNIT_ASSERT_VALUES_EQUAL(s, "Int64?"); @@ -111,26 +111,26 @@ private: void TestContainerTypeFormat() { { - auto s = FormatType(FunctionTypeInfoBuilder.List()->Item<i8>().Build()); + auto s = FormatType(FunctionTypeInfoBuilder_.List()->Item<i8>().Build()); UNIT_ASSERT_VALUES_EQUAL(s, "List<Int8>"); } { - auto s = FormatType(FunctionTypeInfoBuilder.Dict()->Key<i8>().Value<bool>().Build()); + auto s = FormatType(FunctionTypeInfoBuilder_.Dict()->Key<i8>().Value<bool>().Build()); UNIT_ASSERT_VALUES_EQUAL(s, "Dict<Int8,Bool>"); } { - auto s = FormatType(FunctionTypeInfoBuilder.Set()->Key<char*>().Build()); + auto s = FormatType(FunctionTypeInfoBuilder_.Set()->Key<char*>().Build()); UNIT_ASSERT_VALUES_EQUAL(s, "Set<String>"); } { - auto s = FormatType(FunctionTypeInfoBuilder.Stream()->Item<ui64>().Build()); + auto s = FormatType(FunctionTypeInfoBuilder_.Stream()->Item<ui64>().Build()); UNIT_ASSERT_VALUES_EQUAL(s, "Stream<Uint64>"); } } void TestEnumTypeFormat() { ui32 index = 0; - auto t = FunctionTypeInfoBuilder.Enum(2) + auto t = FunctionTypeInfoBuilder_.Enum(2) ->AddField("RED", &index) .AddField("GREEN", &index) .AddField("BLUE", &index) @@ -142,26 +142,26 @@ private: void TestResourceTypeFormat() { { - auto s = FormatType(FunctionTypeInfoBuilder.Resource("my_resource")); + auto s = FormatType(FunctionTypeInfoBuilder_.Resource("my_resource")); UNIT_ASSERT_VALUES_EQUAL(s, "Resource<'my_resource'>"); } } void TestTaggedTypeFormat() { { - auto s = FormatType(FunctionTypeInfoBuilder.Tagged(FunctionTypeInfoBuilder.SimpleType<i8>(), "my_tag")); + auto s = FormatType(FunctionTypeInfoBuilder_.Tagged(FunctionTypeInfoBuilder_.SimpleType<i8>(), "my_tag")); UNIT_ASSERT_VALUES_EQUAL(s, "Tagged<Int8,'my_tag'>"); } } void TestStructTypeFormat() { ui32 index = 0; - auto s1 = FunctionTypeInfoBuilder.Struct(2) + auto s1 = FunctionTypeInfoBuilder_.Struct(2) ->AddField<bool>("is_ok", &index) .AddField<char*>("name", &index) .Build(); - auto s2 = FunctionTypeInfoBuilder.Struct(3) + auto s2 = FunctionTypeInfoBuilder_.Struct(3) ->AddField<char*>("country", &index) .AddField<ui64>("id", &index) .AddField("person", s1, &index) @@ -178,7 +178,7 @@ private: } void TestTupleTypeFormat() { - auto t = FunctionTypeInfoBuilder.Tuple(2) + auto t = FunctionTypeInfoBuilder_.Tuple(2) ->Add<bool>() .Add<char*>() .Build(); @@ -191,44 +191,44 @@ private: void TestVariantTypeFormat() { { ui32 index = 0; - auto t = FunctionTypeInfoBuilder.Struct(2) + auto t = FunctionTypeInfoBuilder_.Struct(2) ->AddField<bool>("is_ok", &index) .AddField<char*>("name", &index) .Build(); - auto s = FormatType(FunctionTypeInfoBuilder.Variant()->Over(t).Build()); + auto s = FormatType(FunctionTypeInfoBuilder_.Variant()->Over(t).Build()); UNIT_ASSERT_VALUES_EQUAL(s, "Variant<'is_ok':Bool,'name':String>"); } { - auto t = FunctionTypeInfoBuilder.Tuple(2) + auto t = FunctionTypeInfoBuilder_.Tuple(2) ->Add<bool>() .Add<char*>() .Build(); - auto s = FormatType(FunctionTypeInfoBuilder.Variant()->Over(t).Build()); + auto s = FormatType(FunctionTypeInfoBuilder_.Variant()->Over(t).Build()); UNIT_ASSERT_VALUES_EQUAL(s, "Variant<Bool,String>"); } } void TestCallableTypeFormat() { { - auto t = FunctionTypeInfoBuilder.Callable(0)->Returns<char*>().Build(); + auto t = FunctionTypeInfoBuilder_.Callable(0)->Returns<char*>().Build(); auto s = FormatType(t); UNIT_ASSERT_VALUES_EQUAL(s, "Callable<()->String>"); } { - auto t = FunctionTypeInfoBuilder.Callable(1)->Arg<i64>().Returns<char*>().Build(); + auto t = FunctionTypeInfoBuilder_.Callable(1)->Arg<i64>().Returns<char*>().Build(); auto s = FormatType(t); UNIT_ASSERT_VALUES_EQUAL(s, "Callable<(Int64)->String>"); } { - auto t = FunctionTypeInfoBuilder.Callable(2)->Arg<i64>().Arg<char*>().Returns<bool>().Build(); + auto t = FunctionTypeInfoBuilder_.Callable(2)->Arg<i64>().Arg<char*>().Returns<bool>().Build(); auto s = FormatType(t); UNIT_ASSERT_VALUES_EQUAL(s, "Callable<(Int64,String)->Bool>"); } { - auto arg3 = FunctionTypeInfoBuilder.Optional()->Item<char*>().Build(); - auto t = FunctionTypeInfoBuilder.Callable(3)->Arg<i64>().Arg<NUdf::TUtf8>().Arg(arg3).OptionalArgs(1).Returns<bool>().Build(); + auto arg3 = FunctionTypeInfoBuilder_.Optional()->Item<char*>().Build(); + auto t = FunctionTypeInfoBuilder_.Callable(3)->Arg<i64>().Arg<NUdf::TUtf8>().Arg(arg3).OptionalArgs(1).Returns<bool>().Build(); auto s = FormatType(t); UNIT_ASSERT_VALUES_EQUAL(s, "Callable<(Int64,Utf8,[String?])->Bool>"); } @@ -236,128 +236,128 @@ private: void TestDataTypeFormat() { { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<i8>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<i8>()); UNIT_ASSERT_VALUES_EQUAL(s, "Int8"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<i16>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<i16>()); UNIT_ASSERT_VALUES_EQUAL(s, "Int16"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<i32>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<i32>()); UNIT_ASSERT_VALUES_EQUAL(s, "Int32"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<i64>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<i64>()); UNIT_ASSERT_VALUES_EQUAL(s, "Int64"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<ui8>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<ui8>()); UNIT_ASSERT_VALUES_EQUAL(s, "Uint8"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<ui16>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<ui16>()); UNIT_ASSERT_VALUES_EQUAL(s, "Uint16"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<ui32>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<ui32>()); UNIT_ASSERT_VALUES_EQUAL(s, "Uint32"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<ui64>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<ui64>()); UNIT_ASSERT_VALUES_EQUAL(s, "Uint64"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<float>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<float>()); UNIT_ASSERT_VALUES_EQUAL(s, "Float"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<double>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<double>()); UNIT_ASSERT_VALUES_EQUAL(s, "Double"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<char*>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<char*>()); UNIT_ASSERT_VALUES_EQUAL(s, "String"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TUtf8>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TUtf8>()); UNIT_ASSERT_VALUES_EQUAL(s, "Utf8"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TYson>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TYson>()); UNIT_ASSERT_VALUES_EQUAL(s, "Yson"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TJson>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TJson>()); UNIT_ASSERT_VALUES_EQUAL(s, "Json"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TUuid>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TUuid>()); UNIT_ASSERT_VALUES_EQUAL(s, "Uuid"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TJsonDocument>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TJsonDocument>()); UNIT_ASSERT_VALUES_EQUAL(s, "JsonDocument"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TDate>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TDate>()); UNIT_ASSERT_VALUES_EQUAL(s, "Date"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TDatetime>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TDatetime>()); UNIT_ASSERT_VALUES_EQUAL(s, "Datetime"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TTimestamp>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TTimestamp>()); UNIT_ASSERT_VALUES_EQUAL(s, "Timestamp"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TInterval>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TInterval>()); UNIT_ASSERT_VALUES_EQUAL(s, "Interval"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TTzDate>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TTzDate>()); UNIT_ASSERT_VALUES_EQUAL(s, "TzDate"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TTzDatetime>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TTzDatetime>()); UNIT_ASSERT_VALUES_EQUAL(s, "TzDatetime"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TTzTimestamp>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TTzTimestamp>()); UNIT_ASSERT_VALUES_EQUAL(s, "TzTimestamp"); } { - auto s = FormatType(FunctionTypeInfoBuilder.SimpleType<NUdf::TDyNumber>()); + auto s = FormatType(FunctionTypeInfoBuilder_.SimpleType<NUdf::TDyNumber>()); UNIT_ASSERT_VALUES_EQUAL(s, "DyNumber"); } { - auto s = FormatType(FunctionTypeInfoBuilder.Decimal(7, 3)); + auto s = FormatType(FunctionTypeInfoBuilder_.Decimal(7, 3)); UNIT_ASSERT_VALUES_EQUAL(s, "Decimal(7,3)"); } } void TestArrowType() { - auto type = FunctionTypeInfoBuilder.SimpleType<ui64>(); - auto atype1 = TypeInfoHelper->MakeArrowType(type); + auto type = FunctionTypeInfoBuilder_.SimpleType<ui64>(); + auto atype1 = TypeInfoHelper_->MakeArrowType(type); UNIT_ASSERT(atype1); UNIT_ASSERT_VALUES_EQUAL(static_cast<TArrowType*>(atype1.Get())->GetType()->ToString(), std::string("uint64")); ArrowSchema s; atype1->Export(&s); - auto atype2 = TypeInfoHelper->ImportArrowType(&s); + auto atype2 = TypeInfoHelper_->ImportArrowType(&s); UNIT_ASSERT_VALUES_EQUAL(static_cast<TArrowType*>(atype2.Get())->GetType()->ToString(), std::string("uint64")); } void TestArrowTaggedType() { - auto type = FunctionTypeInfoBuilder.Tagged(FunctionTypeInfoBuilder.SimpleType<ui64>(), "my_tag"); - auto atype1 = TypeInfoHelper->MakeArrowType(type); + auto type = FunctionTypeInfoBuilder_.Tagged(FunctionTypeInfoBuilder_.SimpleType<ui64>(), "my_tag"); + auto atype1 = TypeInfoHelper_->MakeArrowType(type); UNIT_ASSERT(atype1); UNIT_ASSERT_VALUES_EQUAL(static_cast<TArrowType*>(atype1.Get())->GetType()->ToString(), std::string("uint64")); ArrowSchema s; atype1->Export(&s); - auto atype2 = TypeInfoHelper->ImportArrowType(&s); + auto atype2 = TypeInfoHelper_->ImportArrowType(&s); UNIT_ASSERT_VALUES_EQUAL(static_cast<TArrowType*>(atype2.Get())->GetType()->ToString(), std::string("uint64")); } }; diff --git a/yql/essentials/minikql/mkql_unboxed_value_stream.h b/yql/essentials/minikql/mkql_unboxed_value_stream.h index 6e534006d15..f238d3b8590 100644 --- a/yql/essentials/minikql/mkql_unboxed_value_stream.h +++ b/yql/essentials/minikql/mkql_unboxed_value_stream.h @@ -4,14 +4,16 @@ namespace NKikimr { namespace NMiniKQL { -struct TUnboxedValueStream : public IOutputStream { - NUdf::TUnboxedValue Value_; - +class TUnboxedValueStream : public IOutputStream { +public: TUnboxedValueStream(); NUdf::TUnboxedValuePod Value(); void DoWrite(const void* buf, size_t len) override; + +private: + NUdf::TUnboxedValue Value_; }; } diff --git a/yql/essentials/minikql/perf/block_groupby/block_groupby.cpp b/yql/essentials/minikql/perf/block_groupby/block_groupby.cpp index 99e04b7d5af..5aa6d8dfe02 100644 --- a/yql/essentials/minikql/perf/block_groupby/block_groupby.cpp +++ b/yql/essentials/minikql/perf/block_groupby/block_groupby.cpp @@ -41,7 +41,7 @@ arrow::Datum MakeIntColumn(ui32 len, EDistribution dist, EShape shape, ui32 buck val = (ui32)log(1 + i); break; } - + switch (dist) { case EDistribution::Const: builder.UnsafeAppend(0); @@ -110,10 +110,10 @@ private: public: TAggregate(const std::vector<IAggregator*>& aggs) - : Aggs(aggs) - , RH(sizeof(i64)) + : Aggs_(aggs) + , Rh_(sizeof(i64)) { - Cells.resize(1u << 8); + Cells_.resize(1u << 8); } void AddBatch(arrow::Datum keys, arrow::Datum payloads) { @@ -125,37 +125,37 @@ public: for (int64_t i = 0; i < len; ++i) { auto key = ptrKeys[i]; auto payload = ptrPayloads[i]; - if (!MoreThanOne) { - if (One.IsEmpty) { - One.IsEmpty = false; - One.Key = key; - for (const auto& a : Aggs) { - a->Init(&One.State, payload); + if (!MoreThanOne_) { + if (One_.IsEmpty) { + One_.IsEmpty = false; + One_.Key = key; + for (const auto& a : Aggs_) { + a->Init(&One_.State, payload); } - Size = 1; + Size_ = 1; continue; } else { - if (key == One.Key) { - for (const auto& a : Aggs) { - a->Update(&One.State, payload); + if (key == One_.Key) { + for (const auto& a : Aggs_) { + a->Update(&One_.State, payload); } continue; } else { - MoreThanOne = true; + MoreThanOne_ = true; if constexpr (UseRH) { bool isNew; - auto iter = RH.Insert(One.Key, isNew); + auto iter = Rh_.Insert(One_.Key, isNew); Y_ASSERT(isNew); - *(i64*)RH.GetPayload(iter) = One.State; + *(i64*)Rh_.GetPayload(iter) = One_.State; } else { bool isNew; - ui64 bucket = AddBucketFromKeyImpl(One.Key, Cells, isNew); - auto& c = Cells[bucket]; + ui64 bucket = AddBucketFromKeyImpl(One_.Key, Cells_, isNew); + auto& c = Cells_[bucket]; c.PSL = 0; - c.Key = One.Key; - c.State = One.State; + c.Key = One_.Key; + c.State = One_.State; } } } @@ -163,33 +163,33 @@ public: if constexpr (UseRH) { bool isNew = false; - auto iter = RH.Insert(key, isNew); + auto iter = Rh_.Insert(key, isNew); if (isNew) { - for (const auto& a : Aggs) { - a->Init((i64*)RH.GetPayload(iter), payload); + for (const auto& a : Aggs_) { + a->Init((i64*)Rh_.GetPayload(iter), payload); } - RH.CheckGrow(); + Rh_.CheckGrow(); } else { - for (const auto& a : Aggs) { - a->Update((i64*)RH.GetPayload(iter), payload); + for (const auto& a : Aggs_) { + a->Update((i64*)Rh_.GetPayload(iter), payload); } } } else { bool isNew = false; ui64 bucket = AddBucketFromKey(key, isNew); - auto& c = Cells[bucket]; + auto& c = Cells_[bucket]; if (isNew) { - Size += 1; - for (const auto& a : Aggs) { + Size_ += 1; + for (const auto& a : Aggs_) { a->Init(&c.State, payload); } - if (Size * 2 >= Cells.size()) { + if (Size_ * 2 >= Cells_.size()) { Grow(); } } else { - for (const auto& a : Aggs) { + for (const auto& a : Aggs_) { a->Update(&c.State, payload); } } @@ -206,14 +206,14 @@ public: } Y_FORCE_INLINE ui64 AddBucketFromKey(i32 key, bool& isNew) { - return AddBucketFromKeyImpl(key, Cells, isNew); + return AddBucketFromKeyImpl(key, Cells_, isNew); } Y_FORCE_INLINE ui64 AddBucketFromKeyImpl(i32 key, std::vector<TCell>& cells, bool& isNew) { isNew = false; ui32 chainLen = 0; if constexpr (CalculateHashStats) { - HashSearches++; + HashSearches_++; } ui64 bucket = MakeHash(key) & (cells.size() - 1); @@ -222,7 +222,7 @@ public: i64 oldState; for (;;) { if constexpr (CalculateHashStats) { - HashProbes++; + HashProbes_++; chainLen++; } @@ -232,7 +232,7 @@ public: cells[bucket].PSL = distance; if constexpr (CalculateHashStats) { - MaxHashChainLen = Max(MaxHashChainLen, chainLen); + MaxHashChainLen_ = Max(MaxHashChainLen_, chainLen); } return bucket; @@ -240,7 +240,7 @@ public: if (cells[bucket].Key == key) { if constexpr (CalculateHashStats) { - MaxHashChainLen = Max(MaxHashChainLen, chainLen); + MaxHashChainLen_ = Max(MaxHashChainLen_, chainLen); } return bucket; @@ -265,13 +265,13 @@ public: for (;;) { if constexpr (CalculateHashStats) { - HashProbes++; + HashProbes_++; chainLen++; } if (cells[bucket].PSL < 0) { if constexpr (CalculateHashStats) { - MaxHashChainLen = Max(MaxHashChainLen, chainLen); + MaxHashChainLen_ = Max(MaxHashChainLen_, chainLen); } cells[bucket].Key = key; @@ -295,8 +295,8 @@ public: void Grow() { std::vector<TCell> newCells; - newCells.resize(Cells.size() * 2); // must be power of 2 - for (const auto& c : Cells) { + newCells.resize(Cells_.size() * 2); // must be power of 2 + for (const auto& c : Cells_) { if (c.PSL < 0) { continue; } @@ -307,33 +307,33 @@ public: nc.State = c.State; } - Cells.swap(newCells); + Cells_.swap(newCells); } double GetAverageHashChainLen() { - return 1.0*HashProbes/HashSearches; + return 1.0*HashProbes_/HashSearches_; } ui32 GetMaxHashChainLen() { - return MaxHashChainLen; + return MaxHashChainLen_; } void GetResult(arrow::Datum& keys, arrow::Datum& sums) { arrow::Int32Builder keysBuilder; arrow::Int64Builder sumsBuilder; - if (!MoreThanOne) { - if (!One.IsEmpty) { + if (!MoreThanOne_) { + if (!One_.IsEmpty) { ARROW_OK(keysBuilder.Reserve(1)); ARROW_OK(sumsBuilder.Reserve(1)); - keysBuilder.UnsafeAppend(One.Key); - sumsBuilder.UnsafeAppend(One.State); + keysBuilder.UnsafeAppend(One_.Key); + sumsBuilder.UnsafeAppend(One_.State); } } else { ui64 size; if constexpr (UseRH) { - size = RH.GetSize(); + size = Rh_.GetSize(); } else { - size = Size; + size = Size_; } ARROW_OK(keysBuilder.Reserve(size)); @@ -341,19 +341,19 @@ public: i32 maxPSL = 0; i64 sumPSL = 0; if constexpr (UseRH) { - for (auto iter = RH.Begin(); iter != RH.End(); RH.Advance(iter)) { - auto& psl = RH.GetPSL(iter); + for (auto iter = Rh_.Begin(); iter != Rh_.End(); Rh_.Advance(iter)) { + auto& psl = Rh_.GetPSL(iter); if (psl.Distance < 0) { continue; } - keysBuilder.UnsafeAppend(RH.GetKey(iter)); - sumsBuilder.UnsafeAppend(*(i64*)RH.GetPayload(iter)); + keysBuilder.UnsafeAppend(Rh_.GetKey(iter)); + sumsBuilder.UnsafeAppend(*(i64*)Rh_.GetPayload(iter)); maxPSL = Max(psl.Distance, maxPSL); sumPSL += psl.Distance; } } else { - for (const auto& c : Cells) { + for (const auto& c : Cells_) { if (c.PSL < 0) { continue; } @@ -381,18 +381,18 @@ public: } private: - bool MoreThanOne = false; - TOneCell One; - std::vector<TCell> Cells; - ui64 Size = 0; - - const std::vector<IAggregator*> Aggs; - ui64 HashProbes = 0; - ui64 HashSearches = 0; - ui32 MaxHashChainLen = 0; - - NKikimr::NMiniKQL::TRobinHoodHashMap<i32> RH; - NKikimr::NMiniKQL::TRobinHoodHashSet<i32> RHS; + bool MoreThanOne_ = false; + TOneCell One_; + std::vector<TCell> Cells_; + ui64 Size_ = 0; + + const std::vector<IAggregator*> Aggs_; + ui64 HashProbes_ = 0; + ui64 HashSearches_ = 0; + ui32 MaxHashChainLen_ = 0; + + NKikimr::NMiniKQL::TRobinHoodHashMap<i32> Rh_; + NKikimr::NMiniKQL::TRobinHoodHashSet<i32> Rhs_; }; int main(int argc, char** argv) { diff --git a/yql/essentials/minikql/protobuf_udf/type_builder.cpp b/yql/essentials/minikql/protobuf_udf/type_builder.cpp index fc28bb1548c..48e529d3d3d 100644 --- a/yql/essentials/minikql/protobuf_udf/type_builder.cpp +++ b/yql/essentials/minikql/protobuf_udf/type_builder.cpp @@ -63,7 +63,7 @@ private: Builder_; TProtoInfo* Info_; TType* BasicTypes_[FieldDescriptor::Type::MAX_TYPE + 1]; - TType* YsonType; + TType* YsonType_; TSet<TString> KnownMessages_; TTypeMap Optionals_; TTypeMap Lists_; @@ -86,7 +86,7 @@ TTypeBuilder::TTypeBuilder(EEnumFormat enumFormat, , StringType_(stringType) , Builder_(builder) , Info_(nullptr) - , YsonType(nullptr) + , YsonType_(nullptr) { for (size_t i = 0; i < Y_ARRAY_SIZE(BasicTypes_); ++i) { BasicTypes_[i] = nullptr; @@ -319,10 +319,10 @@ TType* TTypeBuilder::GetInt64Type() { } TType* TTypeBuilder::GetYsonType() { - if (YsonType == nullptr) { - YsonType = Builder_.SimpleType<TYson>(); + if (YsonType_ == nullptr) { + YsonType_ = Builder_.SimpleType<TYson>(); } - return YsonType; + return YsonType_; } TType* TTypeBuilder::GetUnderlyingType(const FieldDescriptor* fd, bool defaultYtSerialize) { diff --git a/yql/essentials/minikql/watermark_tracker.cpp b/yql/essentials/minikql/watermark_tracker.cpp index 5d57364b367..8c359773b96 100644 --- a/yql/essentials/minikql/watermark_tracker.cpp +++ b/yql/essentials/minikql/watermark_tracker.cpp @@ -8,15 +8,15 @@ namespace NMiniKQL { TWatermarkTracker::TWatermarkTracker( ui64 delay, ui64 granularity) - : Delay(delay) - , Granularity(granularity) + : Delay_(delay) + , Granularity_(granularity) { Y_ABORT_UNLESS(granularity > 0); } std::optional<ui64> TWatermarkTracker::HandleNextEventTime(ui64 ts) { - if (Y_UNLIKELY(ts >= NextEventWithWatermark)) { - NextEventWithWatermark = CalcNextEventWithWatermark(ts); + if (Y_UNLIKELY(ts >= NextEventWithWatermark_)) { + NextEventWithWatermark_ = CalcNextEventWithWatermark(ts); return CalcLastWatermark(); } @@ -24,15 +24,15 @@ std::optional<ui64> TWatermarkTracker::HandleNextEventTime(ui64 ts) { } ui64 TWatermarkTracker::CalcNextEventWithWatermark(ui64 ts) { - return ts + Granularity - (ts - Delay) % Granularity; + return ts + Granularity_ - (ts - Delay_) % Granularity_; } std::optional<ui64> TWatermarkTracker::CalcLastWatermark() { - if (Y_UNLIKELY(Delay + Granularity > NextEventWithWatermark)) { + if (Y_UNLIKELY(Delay_ + Granularity_ > NextEventWithWatermark_)) { // Protect from negative values return std::nullopt; } - return NextEventWithWatermark - Delay - Granularity; + return NextEventWithWatermark_ - Delay_ - Granularity_; } } // NMiniKQL diff --git a/yql/essentials/minikql/watermark_tracker.h b/yql/essentials/minikql/watermark_tracker.h index aa06f614f4e..4ac8f461fcb 100644 --- a/yql/essentials/minikql/watermark_tracker.h +++ b/yql/essentials/minikql/watermark_tracker.h @@ -16,9 +16,9 @@ private: std::optional<ui64> CalcLastWatermark(); private: - ui64 NextEventWithWatermark = 0; - const ui64 Delay; - const ui64 Granularity; + ui64 NextEventWithWatermark_ = 0; + const ui64 Delay_; + const ui64 Granularity_; }; } // NMiniKQL |
