Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-28 08:27:07

0001 // Licensed to the Apache Software Foundation (ASF) under one
0002 // or more contributor license agreements.  See the NOTICE file
0003 // distributed with this work for additional information
0004 // regarding copyright ownership.  The ASF licenses this file
0005 // to you under the Apache License, Version 2.0 (the
0006 // "License"); you may not use this file except in compliance
0007 // with the License.  You may obtain a copy of the License at
0008 //
0009 //   http://www.apache.org/licenses/LICENSE-2.0
0010 //
0011 // Unless required by applicable law or agreed to in writing,
0012 // software distributed under the License is distributed on an
0013 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0014 // KIND, either express or implied.  See the License for the
0015 // specific language governing permissions and limitations
0016 // under the License.
0017 
0018 #pragma once
0019 
0020 #include <cstdint>
0021 
0022 #include "arrow/type_fwd.h"
0023 
0024 namespace arrow {
0025 
0026 namespace util {
0027 
0028 /// \brief The sum of bytes in each buffer referenced by the array
0029 ///
0030 /// Note: An array may only reference a portion of a buffer.
0031 ///       This method will overestimate in this case and return the
0032 ///       byte size of the entire buffer.
0033 /// Note: If a buffer is referenced multiple times then it will
0034 ///       only be counted once.
0035 ARROW_EXPORT int64_t TotalBufferSize(const ArrayData& array_data);
0036 /// \brief The sum of bytes in each buffer referenced by the array
0037 /// \see TotalBufferSize(const ArrayData& array_data) for details
0038 ARROW_EXPORT int64_t TotalBufferSize(const Array& array);
0039 /// \brief The sum of bytes in each buffer referenced by the array
0040 /// \see TotalBufferSize(const ArrayData& array_data) for details
0041 ARROW_EXPORT int64_t TotalBufferSize(const ChunkedArray& chunked_array);
0042 /// \brief The sum of bytes in each buffer referenced by the batch
0043 /// \see TotalBufferSize(const ArrayData& array_data) for details
0044 ARROW_EXPORT int64_t TotalBufferSize(const RecordBatch& record_batch);
0045 /// \brief The sum of bytes in each buffer referenced by the table
0046 /// \see TotalBufferSize(const ArrayData& array_data) for details
0047 ARROW_EXPORT int64_t TotalBufferSize(const Table& table);
0048 
0049 /// \brief Calculate the buffer ranges referenced by the array
0050 ///
0051 /// These ranges will take into account array offsets
0052 ///
0053 /// The ranges may contain duplicates
0054 ///
0055 /// Dictionary arrays will ignore the offset of their containing array
0056 ///
0057 /// The return value will be a struct array corresponding to the schema:
0058 /// schema({field("start", uint64()), field("offset", uint64()), field("length",
0059 /// uint64()))
0060 ARROW_EXPORT Result<std::shared_ptr<Array>> ReferencedRanges(const ArrayData& array_data);
0061 
0062 /// \brief Returns the sum of bytes from all buffer ranges referenced
0063 ///
0064 /// Unlike TotalBufferSize this method will account for array
0065 /// offsets.
0066 ///
0067 /// If buffers are shared between arrays then the shared
0068 /// portion will be counted multiple times.
0069 ///
0070 /// Dictionary arrays will always be counted in their entirety
0071 /// even if the array only references a portion of the dictionary.
0072 ARROW_EXPORT Result<int64_t> ReferencedBufferSize(const ArrayData& array_data);
0073 /// \brief Returns the sum of bytes from all buffer ranges referenced
0074 /// \see ReferencedBufferSize(const ArrayData& array_data) for details
0075 ARROW_EXPORT Result<int64_t> ReferencedBufferSize(const Array& array_data);
0076 /// \brief Returns the sum of bytes from all buffer ranges referenced
0077 /// \see ReferencedBufferSize(const ArrayData& array_data) for details
0078 ARROW_EXPORT Result<int64_t> ReferencedBufferSize(const ChunkedArray& array_data);
0079 /// \brief Returns the sum of bytes from all buffer ranges referenced
0080 /// \see ReferencedBufferSize(const ArrayData& array_data) for details
0081 ARROW_EXPORT Result<int64_t> ReferencedBufferSize(const RecordBatch& array_data);
0082 /// \brief Returns the sum of bytes from all buffer ranges referenced
0083 /// \see ReferencedBufferSize(const ArrayData& array_data) for details
0084 ARROW_EXPORT Result<int64_t> ReferencedBufferSize(const Table& array_data);
0085 
0086 }  // namespace util
0087 
0088 }  // namespace arrow