From 20e48078bcaed8b32e063f520692e89b35475b27 Mon Sep 17 00:00:00 2001 From: wypb Date: Wed, 5 Jun 2024 14:57:21 -0700 Subject: [PATCH] Use ByteOutputStream::size() in RowContainer::storeComplexType (#10055) Summary: PR https://github.com/facebookincubator/velox/issues/7520 fixed the semantics of ByteOutputStream::size() to return the length of the data written to the stream. Hence, we can use it directly in `RowContainer::storeComplexType`. Pull Request resolved: https://github.com/facebookincubator/velox/pull/10055 Reviewed By: kgpai Differential Revision: D58195597 Pulled By: kevinwilfong fbshipit-source-id: f7034ddb93a2d6f7e6e0640ffff65d83bb84f06d --- velox/exec/RowContainer.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/velox/exec/RowContainer.cpp b/velox/exec/RowContainer.cpp index dedb9e8001cd..f5957d1a6a0a 100644 --- a/velox/exec/RowContainer.cpp +++ b/velox/exec/RowContainer.cpp @@ -773,14 +773,7 @@ void RowContainer::storeComplexType( valueAt(row, offset) = std::string_view( reinterpret_cast(position.position), stream.size()); - - // TODO Fix ByteOutputStream::size() API. @oerling is looking into that. - // Fix the 'size' of the std::string_view. - // stream.size() is the capacity - // stream.size() - stream.remainingSize() is the size of the data + size of - // 'next' links (8 bytes per link). - auto readStream = prepareRead(row, offset); - const auto size = readStream.size(); + const auto size = stream.size(); valueAt(row, offset) = std::string_view(reinterpret_cast(position.position), size); }