Repository: duckdb/duckdb
File: src/main/client_data.cpp (C++)

Code before:
	void Unpin(shared_ptr<BlockHandle> &handle) override {
		return buffer_manager.Unpin(handle);
	}

	idx_t GetUsedMemory() const override {
		return buffer_manager.GetUsedMemory();
	}
	idx_t GetMaxMemory() const override {
		return buffer_manager.GetMaxMemory();
	}
	idx_t GetUsedSwap() const override {
		return buffer_manager.GetUsedSwap();
	}
	optional_idx GetMaxSwap() const override {
		return buffer_manager.GetMaxSwap();
	}
	idx_t GetBlockAllocSize() const override {
		return buffer_manager.GetBlockAllocSize();
	}
	idx_t GetBlockSize() const override {
		return buffer_manager.GetBlockSize();
	}
	idx_t GetQueryMaxMemory() const override {
		idx_t global_budget = buffer_manager.GetQueryMaxMemory();
		const auto &config = ClientConfig::GetConfig(context);
		if (config.query_memory_limit == DConstants::INVALID_INDEX) {
			return global_budget;
		}
		return MinValue(global_budget, config.query_memory_limit);
	}

	shared_ptr<BlockHandle> RegisterTransientMemory(const idx_t size, BlockManager &block_manager) override {
		auto result = buffer_manager.RegisterTransientMemory(size, block_manager);
		TrackMemoryAllocation(size);
		return result;
	}
	shared_ptr<BlockHandle> RegisterSmallMemory(const idx_t size) override {
		auto result = buffer_manager.RegisterSmallMemory(size);
		TrackMemoryAllocation(size);
		return result;
	}
	shared_ptr<BlockHandle> RegisterSmallMemory(MemoryTag tag, const idx_t size) override {
		auto result = buffer_manager.RegisterSmallMemory(tag, size);
		TrackMemoryAllocation(size);
		return result;
	}

	Allocator &GetBufferAllocator() override {
		return buffer_manager.GetBufferAllocator();
	}
	void ReserveMemory(idx_t size) override {

Review comment (suggestion):
We prefer to use `optional_idx` for indices where `DConstants::INVALID_INDEX` means that it has not been set

Code after:
	void Unpin(shared_ptr<BlockHandle> &handle) override {
		return buffer_manager.Unpin(handle);
	}

	idx_t GetUsedMemory() const override {
		return buffer_manager.GetUsedMemory();
	}
	idx_t GetMaxMemory() const override {
		return buffer_manager.GetMaxMemory();
	}
	idx_t GetUsedSwap() const override {
		return buffer_manager.GetUsedSwap();
	}
	optional_idx GetMaxSwap() const override {
		return buffer_manager.GetMaxSwap();
	}
	idx_t GetBlockAllocSize() const override {
		return buffer_manager.GetBlockAllocSize();
	}
	idx_t GetBlockSize() const override {
		return buffer_manager.GetBlockSize();
	}
	idx_t GetQueryMaxMemory() const override {
		idx_t global_budget = buffer_manager.GetQueryMaxMemory();
		const auto &config = ClientConfig::GetConfig(context);
		if (!config.operator_memory_limit.IsValid()) {
			return global_budget;
		}
		return MinValue(global_budget, config.operator_memory_limit.GetIndex());
	}

	shared_ptr<BlockHandle> RegisterTransientMemory(const idx_t size, BlockManager &block_manager) override {
		auto result = buffer_manager.RegisterTransientMemory(size, block_manager);
		TrackMemoryAllocation(size);
		return result;
	}
	shared_ptr<BlockHandle> RegisterSmallMemory(const idx_t size) override {
		auto result = buffer_manager.RegisterSmallMemory(size);
		TrackMemoryAllocation(size);
		return result;
	}
	shared_ptr<BlockHandle> RegisterSmallMemory(MemoryTag tag, const idx_t size) override {
		auto result = buffer_manager.RegisterSmallMemory(tag, size);
		TrackMemoryAllocation(size);
		return result;
	}

	Allocator &GetBufferAllocator() override {
		return buffer_manager.GetBufferAllocator();
	}
	void ReserveMemory(idx_t size) override {