Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +3 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/INSTALLER +1 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/METADATA +76 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/RECORD +854 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/WHEEL +5 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/top_level.txt +2 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/accumulation_queue.h +162 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/aggregate_node.h +58 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/api.h +32 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/asof_join_node.h +41 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/backpressure_handler.h +64 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/benchmark_util.h +48 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/bloom_filter.h +323 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/exec_plan.h +819 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/hash_join.h +75 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/hash_join_dict.h +318 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/hash_join_node.h +103 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/map_node.h +81 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/options.h +874 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/order_by_impl.h +56 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/partition_util.h +186 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/query_context.h +151 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/schema_util.h +226 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/task_util.h +102 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/test_nodes.h +86 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/time_series_util.h +31 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/tpch_node.h +65 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/type_fwd.h +36 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/util.h +184 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/visibility.h +50 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/adapters/orc/adapter.h +323 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/adapters/orc/options.h +120 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/adapters/tensorflow/convert.h +128 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/api.h +47 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array.h +49 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_base.h +323 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_binary.h +321 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_decimal.h +104 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_dict.h +182 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_nested.h +899 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_primitive.h +220 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_run_end.h +133 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_adaptive.h +215 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_base.h +371 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_binary.h +993 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_decimal.h +164 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_dict.h +728 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_nested.h +836 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_primitive.h +689 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_run_end.h +303 -0
.gitattributes
CHANGED
|
@@ -284,3 +284,6 @@ code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packag
|
|
| 284 |
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libarrow_python.so.2300.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 285 |
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libarrow_python_flight.so filter=lfs diff=lfs merge=lfs -text
|
| 286 |
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libarrow_python_flight.so.2300 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libarrow_python.so.2300.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 285 |
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libarrow_python_flight.so filter=lfs diff=lfs merge=lfs -text
|
| 286 |
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libarrow_python_flight.so.2300 filter=lfs diff=lfs merge=lfs -text
|
| 287 |
+
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libarrow_python_flight.so.2300.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 288 |
+
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libarrow_substrait.so.2300 filter=lfs diff=lfs merge=lfs -text
|
| 289 |
+
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/libparquet.so.2300 filter=lfs diff=lfs merge=lfs -text
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: pyarrow
|
| 3 |
+
Version: 23.0.0
|
| 4 |
+
Summary: Python library for Apache Arrow
|
| 5 |
+
Maintainer-email: Apache Arrow Developers <dev@arrow.apache.org>
|
| 6 |
+
License-Expression: Apache-2.0
|
| 7 |
+
Project-URL: Homepage, https://arrow.apache.org/
|
| 8 |
+
Project-URL: Documentation, https://arrow.apache.org/docs/python
|
| 9 |
+
Project-URL: Repository, https://github.com/apache/arrow
|
| 10 |
+
Project-URL: Issues, https://github.com/apache/arrow/issues
|
| 11 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 12 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 13 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 14 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 16 |
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
| 17 |
+
Requires-Python: >=3.10
|
| 18 |
+
Description-Content-Type: text/markdown
|
| 19 |
+
|
| 20 |
+
<!---
|
| 21 |
+
Licensed to the Apache Software Foundation (ASF) under one
|
| 22 |
+
or more contributor license agreements. See the NOTICE file
|
| 23 |
+
distributed with this work for additional information
|
| 24 |
+
regarding copyright ownership. The ASF licenses this file
|
| 25 |
+
to you under the Apache License, Version 2.0 (the
|
| 26 |
+
"License"); you may not use this file except in compliance
|
| 27 |
+
with the License. You may obtain a copy of the License at
|
| 28 |
+
|
| 29 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 30 |
+
|
| 31 |
+
Unless required by applicable law or agreed to in writing,
|
| 32 |
+
software distributed under the License is distributed on an
|
| 33 |
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 34 |
+
KIND, either express or implied. See the License for the
|
| 35 |
+
specific language governing permissions and limitations
|
| 36 |
+
under the License.
|
| 37 |
+
-->
|
| 38 |
+
|
| 39 |
+
## Python library for Apache Arrow
|
| 40 |
+
|
| 41 |
+
[](https://pypi.org/project/pyarrow/) [](https://anaconda.org/conda-forge/pyarrow)
|
| 42 |
+
|
| 43 |
+
This library provides a Python API for functionality provided by the Arrow C++
|
| 44 |
+
libraries, along with tools for Arrow integration and interoperability with
|
| 45 |
+
pandas, NumPy, and other software in the Python ecosystem.
|
| 46 |
+
|
| 47 |
+
## Installing
|
| 48 |
+
|
| 49 |
+
Across platforms, you can install a recent version of pyarrow with the conda
|
| 50 |
+
package manager:
|
| 51 |
+
|
| 52 |
+
```shell
|
| 53 |
+
conda install pyarrow -c conda-forge
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
On Linux, macOS, and Windows, you can also install binary wheels from PyPI with
|
| 57 |
+
pip:
|
| 58 |
+
|
| 59 |
+
```shell
|
| 60 |
+
pip install pyarrow
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
If you encounter any issues importing the pip wheels on Windows, you may need
|
| 64 |
+
to install the latest [Visual C++ Redistributable for Visual Studio][3].
|
| 65 |
+
|
| 66 |
+
## Development
|
| 67 |
+
|
| 68 |
+
See [Python Development][2] in the documentation subproject.
|
| 69 |
+
|
| 70 |
+
### Building the documentation
|
| 71 |
+
|
| 72 |
+
See [documentation build instructions][1] in the documentation subproject.
|
| 73 |
+
|
| 74 |
+
[1]: https://github.com/apache/arrow/blob/main/docs/source/developers/documentation.rst
|
| 75 |
+
[2]: https://arrow.apache.org/docs/developers/python/index.html
|
| 76 |
+
[3]: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,854 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pyarrow-23.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
pyarrow-23.0.0.dist-info/METADATA,sha256=ul9g1f0Qa1SLKADqOmZALWFjddOyGxOigKHukxPILyI,2980
|
| 3 |
+
pyarrow-23.0.0.dist-info/RECORD,,
|
| 4 |
+
pyarrow-23.0.0.dist-info/WHEEL,sha256=yzF9ixp0XVYLhnovZSdud9vspTPdVe52BzwI7Tv3jTM,113
|
| 5 |
+
pyarrow-23.0.0.dist-info/top_level.txt,sha256=Zuk_c1WeinXdMz20fXlEtGC67zfKOWuwU8adpEEU_nI,18
|
| 6 |
+
pyarrow/__init__.pxd,sha256=Wnar1phFqM_ZHnZmtbuqm6wJHsXlBoYKhV7Qmo2jUHA,2195
|
| 7 |
+
pyarrow/__init__.py,sha256=k2XINbsRZlOTmT0dYr7otJbKtGUJM5kFYKNYDk1f-30,18592
|
| 8 |
+
pyarrow/__pycache__/__init__.cpython-310.pyc,,
|
| 9 |
+
pyarrow/__pycache__/_compute_docstrings.cpython-310.pyc,,
|
| 10 |
+
pyarrow/__pycache__/_generated_version.cpython-310.pyc,,
|
| 11 |
+
pyarrow/__pycache__/acero.cpython-310.pyc,,
|
| 12 |
+
pyarrow/__pycache__/benchmark.cpython-310.pyc,,
|
| 13 |
+
pyarrow/__pycache__/cffi.cpython-310.pyc,,
|
| 14 |
+
pyarrow/__pycache__/compute.cpython-310.pyc,,
|
| 15 |
+
pyarrow/__pycache__/conftest.cpython-310.pyc,,
|
| 16 |
+
pyarrow/__pycache__/csv.cpython-310.pyc,,
|
| 17 |
+
pyarrow/__pycache__/cuda.cpython-310.pyc,,
|
| 18 |
+
pyarrow/__pycache__/dataset.cpython-310.pyc,,
|
| 19 |
+
pyarrow/__pycache__/feather.cpython-310.pyc,,
|
| 20 |
+
pyarrow/__pycache__/flight.cpython-310.pyc,,
|
| 21 |
+
pyarrow/__pycache__/fs.cpython-310.pyc,,
|
| 22 |
+
pyarrow/__pycache__/ipc.cpython-310.pyc,,
|
| 23 |
+
pyarrow/__pycache__/json.cpython-310.pyc,,
|
| 24 |
+
pyarrow/__pycache__/jvm.cpython-310.pyc,,
|
| 25 |
+
pyarrow/__pycache__/orc.cpython-310.pyc,,
|
| 26 |
+
pyarrow/__pycache__/pandas_compat.cpython-310.pyc,,
|
| 27 |
+
pyarrow/__pycache__/substrait.cpython-310.pyc,,
|
| 28 |
+
pyarrow/__pycache__/types.cpython-310.pyc,,
|
| 29 |
+
pyarrow/__pycache__/util.cpython-310.pyc,,
|
| 30 |
+
pyarrow/_acero.cpython-310-x86_64-linux-gnu.so,sha256=xdMgalbyoZVu-x1MFgBO3yv1OqACASvzaJ9AyxQKd3o,282872
|
| 31 |
+
pyarrow/_acero.pxd,sha256=5ish_GgGWvit4ebhzoZil7b-m0r2RuG5JwYoxsH34FI,1440
|
| 32 |
+
pyarrow/_acero.pyx,sha256=7Qo0ePiMF2tsytAj4t334f-32KA9XdJKU6LKye87usw,21586
|
| 33 |
+
pyarrow/_azurefs.cpython-310-x86_64-linux-gnu.so,sha256=V4kMp1cWfTunMtDnAGS2kmEBxOLGfBvZyQKYPU5-P1g,144928
|
| 34 |
+
pyarrow/_azurefs.pyx,sha256=mlieD3Ze2LeiQFAaq4ykjLAW7jCUiEtK_brgX5dvGCo,9148
|
| 35 |
+
pyarrow/_compute.cpython-310-x86_64-linux-gnu.so,sha256=RwQ03PEi4xv0GHgECquSs2VWf0UJTWii-QVI2jYA9kU,1288712
|
| 36 |
+
pyarrow/_compute.pxd,sha256=fhi87jkN6x4qG8JbAtRksx-4YTn3sFIw2zZxuK1flpM,2022
|
| 37 |
+
pyarrow/_compute.pyx,sha256=27FWJcYyU2xY6tKhWljYQlzIz5o0TJyPlJfM1LQq8vk,114180
|
| 38 |
+
pyarrow/_compute_docstrings.py,sha256=7_S5bqdASMSrndaEKSbr--ofVW4sbhT2iM24bGvvOYw,4936
|
| 39 |
+
pyarrow/_csv.cpython-310-x86_64-linux-gnu.so,sha256=dejRTRhDCRpqGVLvtMA7CICV0q3h6m23-BBXAfMG5CQ,353720
|
| 40 |
+
pyarrow/_csv.pxd,sha256=1Zk3Zpvvhy-Tb7c79Aqd4e7bBM21kc1JxWJkl02Y4DE,1638
|
| 41 |
+
pyarrow/_csv.pyx,sha256=MQ_b87VV18O9MifhdUm7TbBIdmnwhARfG4unidu1EYg,55449
|
| 42 |
+
pyarrow/_cuda.pxd,sha256=VzhM6j9dpNgrABlvFJKoMpRC0As55im-M3tgPTOuwEk,1922
|
| 43 |
+
pyarrow/_cuda.pyx,sha256=XPM0q9Cy-I0bcB5j9dpSkLfkxYvdfLv2UTJym9YAM8Q,35328
|
| 44 |
+
pyarrow/_dataset.cpython-310-x86_64-linux-gnu.so,sha256=_zArNF_dalTnUejSNjf5IXblJbLpiiFa9_rimL8sQSU,1007192
|
| 45 |
+
pyarrow/_dataset.pxd,sha256=Ag9rUhoBySU6ba3wFLeuZyWMJnz9VkAf9TQEzWG4hUU,4944
|
| 46 |
+
pyarrow/_dataset.pyx,sha256=tW56kG-2kD3jTTxwXjDGwfJ9wxpPhL7fWtsxnMBzueA,164256
|
| 47 |
+
pyarrow/_dataset_orc.cpython-310-x86_64-linux-gnu.so,sha256=BbBTJoGXShi4fPgdfKWIRpNwAF0ls77QnAEx1oB9Jdg,79544
|
| 48 |
+
pyarrow/_dataset_orc.pyx,sha256=JSFoRI0pfHtL2jeIuPg5TJHodcfuCNYmj_iEZ4xY87w,1499
|
| 49 |
+
pyarrow/_dataset_parquet.cpython-310-x86_64-linux-gnu.so,sha256=ACOpBFx6-88rqMwj-LS0kqwyIEv5w2fRjZo7W22ALig,354880
|
| 50 |
+
pyarrow/_dataset_parquet.pxd,sha256=y-3iKehyB_eB_oeqjtt4aQRbUpVGVN1oUMFGIY13brE,1572
|
| 51 |
+
pyarrow/_dataset_parquet.pyx,sha256=wdcEST6sLbbfKTrqjJpZEXpSZK0RA0h9sxkgsscNuHo,41608
|
| 52 |
+
pyarrow/_dataset_parquet_encryption.cpython-310-x86_64-linux-gnu.so,sha256=q3xqb-FoinZPpI-OGOXrufFQ8Z6N8Jh31SZG5UGLwkY,120336
|
| 53 |
+
pyarrow/_dataset_parquet_encryption.pyx,sha256=p7LDNUsp3jMVcWDcbOFp8a3CYJjASVPI_tfATpY-ePg,7229
|
| 54 |
+
pyarrow/_dlpack.pxi,sha256=clw0FkGoyZMEtUU8zPpO_DMtl2X-27kb2UtyhQuIc1s,1832
|
| 55 |
+
pyarrow/_feather.cpython-310-x86_64-linux-gnu.so,sha256=W0UcIxSe3qMd3PVicOI0lLq_fJE3xGDX9QUzzZOKg8M,108600
|
| 56 |
+
pyarrow/_feather.pyx,sha256=DWQI4U0uAWE1ZYUwPreBPJg1TGLEGmF3wPEIRL-PhPw,3773
|
| 57 |
+
pyarrow/_flight.cpython-310-x86_64-linux-gnu.so,sha256=Cjv2ENTUnUVS3t2ScK4IXFZ33G7OwS3dx0rvRrThAyI,1210952
|
| 58 |
+
pyarrow/_flight.pyx,sha256=Ru7II_UB8b8WWCcVRHt2QDJKmQQu7uD51en99VVL2kE,114764
|
| 59 |
+
pyarrow/_fs.cpython-310-x86_64-linux-gnu.so,sha256=cWez-p27EbxkFyILN_RknjW7vI9BRGMe-i3takFqFc8,433528
|
| 60 |
+
pyarrow/_fs.pxd,sha256=SmHS31eyYU7VUZlVuP613HKgpd7bENnQGApvX_g2Lfw,2439
|
| 61 |
+
pyarrow/_fs.pyx,sha256=kLqIoSXeovlPrWe8EShzzPC3z3EgSCaeq8cSNH_ZWm4,53271
|
| 62 |
+
pyarrow/_gcsfs.cpython-310-x86_64-linux-gnu.so,sha256=Tb5ptGO9pXrPCOC2oP20X-ahAHUKJP2o1IpIz7dVwGo,136080
|
| 63 |
+
pyarrow/_gcsfs.pyx,sha256=sooI3ztzEQXVVKcahgin0UGm_6Sgy-uwfcMrACP690w,9046
|
| 64 |
+
pyarrow/_generated_version.py,sha256=M2AAFh5i0xOQJ6jaO56Dgy34a-VI_WIxeKyQRW3HPUA,706
|
| 65 |
+
pyarrow/_hdfs.cpython-310-x86_64-linux-gnu.so,sha256=nnbYNQ6FfroBvNNQ0mcwDw-STxUsD0hvIb-0YXirBxo,138128
|
| 66 |
+
pyarrow/_hdfs.pyx,sha256=QVkMqzz2iGoipaNufk0GPZRzjy1JKJzuuqqk88MdYA4,5802
|
| 67 |
+
pyarrow/_json.cpython-310-x86_64-linux-gnu.so,sha256=6am50l5d844DLPI-4BLemO9Qw8pUEfRICp8JQnrpAVI,128720
|
| 68 |
+
pyarrow/_json.pxd,sha256=tECTP14M12-b_ja5QI3snQbd0uWPWmmC9FwkWq23Vg0,1206
|
| 69 |
+
pyarrow/_json.pyx,sha256=VCdkaxuO0Q0SzAp7zxqoG2e5GImXp1ZERYMM6jG_5EI,12532
|
| 70 |
+
pyarrow/_orc.cpython-310-x86_64-linux-gnu.so,sha256=G-RXK0gONsEsDzyIF9JqcM27hja5crk_EBN-4BvzbGI,213848
|
| 71 |
+
pyarrow/_orc.pxd,sha256=6hL0cq1RufqQD-B_bV3ne1rhu2g-h4rDOFNQsSb6qps,5689
|
| 72 |
+
pyarrow/_orc.pyx,sha256=Pn7r4dzagWaqMf8rymbXBIWisxonBaStZgXCi7pfrZI,15556
|
| 73 |
+
pyarrow/_parquet.cpython-310-x86_64-linux-gnu.so,sha256=cPvlTUG0GRJPdSy8RV8LXqx2c3o274QTnlkL7fdxKQU,612480
|
| 74 |
+
pyarrow/_parquet.pxd,sha256=pCqIo5UzwVmo2qe6Uo4zQwnRp8nRBjA8NJNxhhompQI,4947
|
| 75 |
+
pyarrow/_parquet.pyx,sha256=q0OcpBOR4WzcQqKxb3u-MiLxvBLcPK6h_eOSJUVOosg,80049
|
| 76 |
+
pyarrow/_parquet_encryption.cpython-310-x86_64-linux-gnu.so,sha256=ViAN_4O7WBsHjuaGVpmecgqJFvUeqG5S6nEjdTrBSf0,342392
|
| 77 |
+
pyarrow/_parquet_encryption.pxd,sha256=WUPm2Kj50f06y5IYzb9lVF64XREzqIZwqJSWPs-1VSE,2871
|
| 78 |
+
pyarrow/_parquet_encryption.pyx,sha256=Am9cy5u732B5KmcNLVb_ARy6cxiq2MIXUut6JU3e6X8,26983
|
| 79 |
+
pyarrow/_pyarrow_cpp_tests.cpython-310-x86_64-linux-gnu.so,sha256=iPoGRnYBNqqmoSN3ocnV7DhjiFYqWXtgVQECbKVZ3vA,88160
|
| 80 |
+
pyarrow/_pyarrow_cpp_tests.pxd,sha256=nPyRmNtFbOUvSXCwegAApQFfh8UI_K9Hq5dN4oPAxdo,1199
|
| 81 |
+
pyarrow/_pyarrow_cpp_tests.pyx,sha256=gLeMzB9RWodZgXEpipX65_0aqWu12SjMld0JZmZVRP0,1753
|
| 82 |
+
pyarrow/_s3fs.cpython-310-x86_64-linux-gnu.so,sha256=dE0bV0GML01TUd4_w6ZUtsnAbM106xaie4CLgi5rNMo,228512
|
| 83 |
+
pyarrow/_s3fs.pyx,sha256=I5MF6knp3tYnS0VlWK0enMavJ9r54RcjgHJMoi2t6EQ,20584
|
| 84 |
+
pyarrow/_substrait.cpython-310-x86_64-linux-gnu.so,sha256=WFwJGuH5OCjbZHRwMmo3nyu_aeny3HF-C_UFfAwm8HE,205216
|
| 85 |
+
pyarrow/_substrait.pyx,sha256=fZT496mzp1ssSKIzqtmPeGBKeYq5f0vm8cWlWqaC408,15666
|
| 86 |
+
pyarrow/acero.py,sha256=yus6kVAtfYVoSenfPZPHgmeEmnaySb5UCM1lVMkzF1M,15743
|
| 87 |
+
pyarrow/array.pxi,sha256=RqssOhLS8qkLpny_KpE98KTPNIF-QJ23p0dGPxYCPwo,159297
|
| 88 |
+
pyarrow/benchmark.pxi,sha256=DYXdu-jMSH7XcTohbc8x8NiKRLtpX9IULfY20ohkffA,869
|
| 89 |
+
pyarrow/benchmark.py,sha256=k9Z3yQyoojpYz4lTA6DkCfqT6fPG3N2fJtsHKjpbYFo,856
|
| 90 |
+
pyarrow/builder.pxi,sha256=9QE4KAiA4JpA7-2JLgX3xo32jRtuWZ3YqC-T9GzUVDc,4634
|
| 91 |
+
pyarrow/cffi.py,sha256=hEcrPH9KeG6NES3ZCpSbOVYhOgDOuBB_2LgMMucgw-8,2396
|
| 92 |
+
pyarrow/compat.pxi,sha256=Sq5c3CKq0uj5aDyOoHHkPEO_VsSpZ90JRaL2rAKHk5I,1920
|
| 93 |
+
pyarrow/compute.py,sha256=EweboAC1SgLDPyrY7zgMV6YThGp2pqhqT-C-w7QxhwQ,24379
|
| 94 |
+
pyarrow/config.pxi,sha256=59eukT2QdWZSHuOMJhXEUsXGqVcN9g68ZFPZXCMb-dw,3926
|
| 95 |
+
pyarrow/conftest.py,sha256=54Oim0WylDduwtVx7l7fTKSQsJyPUbP_duPSYicHXs8,9891
|
| 96 |
+
pyarrow/csv.py,sha256=S6tm31Bra9HPf9IsYwBLltZBLMvNzypWfeCLySsjmds,974
|
| 97 |
+
pyarrow/cuda.py,sha256=j--8HcBAm5Ib-kbhK4d2M6SVQmDWkr7Mt5fnwU2LzdQ,1087
|
| 98 |
+
pyarrow/dataset.py,sha256=S3g4O9G9IhjWByr7tZ5q8HwMC35InoBmgKsiX2aGCYc,40507
|
| 99 |
+
pyarrow/device.pxi,sha256=kx9WnmI2bAKgt9txyGVQWackkRj9NPZLsE5q5H1RFgU,5563
|
| 100 |
+
pyarrow/error.pxi,sha256=Wj7-NGUfdvlEwAwd8Ta_JqRC8IUOUpm_PmpvizCFvfY,8909
|
| 101 |
+
pyarrow/feather.py,sha256=fOJRqGWBWrVchVSwruTcbNqN_KHDpueQ4xdoaTaEVm8,9943
|
| 102 |
+
pyarrow/flight.py,sha256=HLB04A0SZ35MZJumPIuBu5I2dpetjEc-CGMEdjQeQRQ,2177
|
| 103 |
+
pyarrow/fs.py,sha256=qL7lXu2QSbD3JbOwJEQwf642Y5Nne56tpW5nQ8O9t5A,14972
|
| 104 |
+
pyarrow/gandiva.pyx,sha256=sNXorsDoKVbr7iI7fwXmQZxorZA77WyCRiJtSdF_Ev8,24280
|
| 105 |
+
pyarrow/include/arrow/acero/accumulation_queue.h,sha256=fz0okH6sZqcSpBl2w3vOU9wSa9QlOIAXzikmb3mINPE,5985
|
| 106 |
+
pyarrow/include/arrow/acero/aggregate_node.h,sha256=9fhmBQGUphsqLd7bNmiOJaEg5NJxVyWA5RGs9UaTxR0,2201
|
| 107 |
+
pyarrow/include/arrow/acero/api.h,sha256=fRuKEHbKDYWRCwSHLc7vSD-6mQavyOsztluCR7evFCk,1151
|
| 108 |
+
pyarrow/include/arrow/acero/asof_join_node.h,sha256=Ko6r1wDjxg01FE9-xKkttx7WzCAzf43GxbpvGHgKZp8,1490
|
| 109 |
+
pyarrow/include/arrow/acero/backpressure_handler.h,sha256=mbJYVYeFMQlg40j_k7f0jFXZ8kRjo5lrE2dndC54Z7s,2395
|
| 110 |
+
pyarrow/include/arrow/acero/benchmark_util.h,sha256=T5bNabF1TDAp28S7V_vt_VIDn6l5Be0zOVCHhcTcFf8,1943
|
| 111 |
+
pyarrow/include/arrow/acero/bloom_filter.h,sha256=bFzzAzQrs9ePp2tCPQIuk1Oa9gG_Nyp72M_HM0dhakM,11978
|
| 112 |
+
pyarrow/include/arrow/acero/exec_plan.h,sha256=U0KA3tnNvVb75G0XQFLVbGzXCGdddGyRhW3zMa8oWJc,35909
|
| 113 |
+
pyarrow/include/arrow/acero/hash_join.h,sha256=zjljUjH2AQlI54Vz2_7hvJIAjTgaT0BPC_LVD7xNd2k,3022
|
| 114 |
+
pyarrow/include/arrow/acero/hash_join_dict.h,sha256=_BKJmK3Z_KdJuYHh4KQCuT_1rXlUohrtEgGLtEJ4fgQ,15360
|
| 115 |
+
pyarrow/include/arrow/acero/hash_join_node.h,sha256=FXT-aeXL7nNTuV75f9oXgdGyqMK_72GnqGUm9cmBnko,4378
|
| 116 |
+
pyarrow/include/arrow/acero/map_node.h,sha256=Bd1HcW0N5azoIVth2ATeHxgTKd9XmmEkz42YBNw5eK0,2628
|
| 117 |
+
pyarrow/include/arrow/acero/options.h,sha256=sLrKayGLs0MVJKcopQrO3pAOrqmvd1j3EfloUCMKECI,37654
|
| 118 |
+
pyarrow/include/arrow/acero/order_by_impl.h,sha256=dQqplP-AZWPZRKio8LmTjYWlCYz9VmW-usUrtaLpd_w,1691
|
| 119 |
+
pyarrow/include/arrow/acero/partition_util.h,sha256=xS8hayuTRimyrOHzf1xRm1IVjkyIeVCGXY78B2rJaJc,7437
|
| 120 |
+
pyarrow/include/arrow/acero/query_context.h,sha256=D364aGRS3uWe8lgYqCNRjVvs5sKetLOOXzACdp5GZeg,6212
|
| 121 |
+
pyarrow/include/arrow/acero/schema_util.h,sha256=KA_hV2xy2TRccMyksSzQrdH9_rdGo3tQyHOIvrWWYBQ,7961
|
| 122 |
+
pyarrow/include/arrow/acero/task_util.h,sha256=6pqILuYfcVwt9HqVhRfXFVJoOC-Q_dtk8mQ5SxjgwbY,3706
|
| 123 |
+
pyarrow/include/arrow/acero/test_nodes.h,sha256=xKeLWZZC8iokveVXPjseO1MOvWMcby-0xiMISy0qw8E,2877
|
| 124 |
+
pyarrow/include/arrow/acero/time_series_util.h,sha256=W9yzoaTGkB2jtYm8w2CYknSw1EjMbsdTfmEuuL2zMtk,1210
|
| 125 |
+
pyarrow/include/arrow/acero/tpch_node.h,sha256=l3zocxHTfGmXTjywJxwoXCIk9tjzURgWdYKSgSk8DAQ,2671
|
| 126 |
+
pyarrow/include/arrow/acero/type_fwd.h,sha256=4zLhtLJf_7MSXgrhQIZVGeLxjT7JrEDAn9yW75DTFlc,1103
|
| 127 |
+
pyarrow/include/arrow/acero/util.h,sha256=byhMEj5XoAUy-93AjLrx_p9_iUZdYn5uJ_cDkCJQt5Q,6121
|
| 128 |
+
pyarrow/include/arrow/acero/visibility.h,sha256=E-4G2O4F2YabXnFNJYnsI2VbVoKBtO7AXqh_SPuJi6k,1616
|
| 129 |
+
pyarrow/include/arrow/adapters/orc/adapter.h,sha256=G5SSGGYMSREILC43kqL5fqo94c4tKgukitO15m217tY,11031
|
| 130 |
+
pyarrow/include/arrow/adapters/orc/options.h,sha256=FMxda5YSskRrB6h9FvcAuMxl5qdavWrNYHPlanjtk48,3696
|
| 131 |
+
pyarrow/include/arrow/adapters/tensorflow/convert.h,sha256=ZGFAodnwTJK0ZoXfgYJdjgi_F4vfEhI9E87zejxVb6E,3465
|
| 132 |
+
pyarrow/include/arrow/api.h,sha256=Gs6HiRBYU5N7-a79hjTl9WMSda551XdUKpWthFY2v1s,2491
|
| 133 |
+
pyarrow/include/arrow/array.h,sha256=P5oW6hvD2j97bLaSTE4_UHuV6Y38DTwJVww3Eb3xdTQ,1981
|
| 134 |
+
pyarrow/include/arrow/array/array_base.h,sha256=kq08hubpDlrIVgDRhL4MEqPyaEftgmoznQ91ZVrLnAQ,12371
|
| 135 |
+
pyarrow/include/arrow/array/array_binary.h,sha256=JvtB8DoR0_tqfSFS_9nMRrJ39lt1cTm5yXh-DLkhqjU,11247
|
| 136 |
+
pyarrow/include/arrow/array/array_decimal.h,sha256=xRfrZ1IFO09EmkHEolCwrJ4lsXjLo5DXdfH5_v2gSyw,3105
|
| 137 |
+
pyarrow/include/arrow/array/array_dict.h,sha256=6AMbSnZoMj-nhQhZhG4RNnxy9VVPk2DvZjVblwIUhgY,7611
|
| 138 |
+
pyarrow/include/arrow/array/array_nested.h,sha256=MRFllX_LO6AQXNkyAujEdax2gEYrnQALySwB9tuP85U,37717
|
| 139 |
+
pyarrow/include/arrow/array/array_primitive.h,sha256=_U8_pTHg-aHY5jaSFjHZ4hqRPXdYiyKTpr2y3OcJcdg,8184
|
| 140 |
+
pyarrow/include/arrow/array/array_run_end.h,sha256=4zs3tcUrIgDOhSEOywJ1vGY2lsH-5QuEBn87mxnDbi8,5101
|
| 141 |
+
pyarrow/include/arrow/array/builder_adaptive.h,sha256=92DpiIZDXSI_yOrMftj7P60zlCLjNmwfGM5ubdbXWM4,6861
|
| 142 |
+
pyarrow/include/arrow/array/builder_base.h,sha256=CP9kS8pDFd4XyJQdgIlBp3pTIX9mND1Lvh85re4IC8w,13723
|
| 143 |
+
pyarrow/include/arrow/array/builder_binary.h,sha256=cfrm-LnXOZ73pQpn_kXSXw0Bh252DpsfP4KGHlPNy3g,33744
|
| 144 |
+
pyarrow/include/arrow/array/builder_decimal.h,sha256=DFxyFlpzWRZS9zdBhsjII5fFUOMY9bXHn3EIrIvmOMo,5051
|
| 145 |
+
pyarrow/include/arrow/array/builder_dict.h,sha256=FZjvCRIDmVuwmzx_HCcDK6ZjNoZKCEsSV-fGI0K974Y,27899
|
| 146 |
+
pyarrow/include/arrow/array/builder_nested.h,sha256=_VB9EUamHQcxQtJM0FiSy8Rs4vhzpOuqFMRfKa4qE5U,31231
|
| 147 |
+
pyarrow/include/arrow/array/builder_primitive.h,sha256=WX_3Y-FeCvTtoE2kHJ9L2cew_IN5W4uyQFfjsJ2lMLk,26031
|
| 148 |
+
pyarrow/include/arrow/array/builder_run_end.h,sha256=SZIdsUKK1qAc9pdonPGf0A_aikZHcxxzicezRGR5hLs,11416
|
| 149 |
+
pyarrow/include/arrow/array/builder_time.h,sha256=eLhc7UP9ttNJDbTeDdsf-ihMFORksmh7A0ScA5hLROI,2503
|
| 150 |
+
pyarrow/include/arrow/array/builder_union.h,sha256=8BF532sAMc7JxWIbSN-yX6Z9fqY9jmmsIa054DPvbWE,10144
|
| 151 |
+
pyarrow/include/arrow/array/concatenate.h,sha256=wBy-CBTz9MeRCmcnfXGvkXnvSRApvPOcfCf64A42ys8,2059
|
| 152 |
+
pyarrow/include/arrow/array/data.h,sha256=65s-2w9lskJAzQYio59NBAa9TH78JU95mcTX3_XRCoc,28949
|
| 153 |
+
pyarrow/include/arrow/array/diff.h,sha256=bYNKy2oLAxtt6VYDWvCfq2bnJTVNjG5KMTsGl-gT_kM,3344
|
| 154 |
+
pyarrow/include/arrow/array/statistics.h,sha256=f0_4nJyk9Su-7u4B-HR6lfyKLe7e5E9J1HNqhgnRU28,6914
|
| 155 |
+
pyarrow/include/arrow/array/util.h,sha256=qVHvCaVlALz8WJwAjyMwsBm5J2iN89CSgj7NpmmqlkI,3652
|
| 156 |
+
pyarrow/include/arrow/array/validate.h,sha256=JdDb3XJg4TmAfpv_zgu2ITfL2H9no10TQit-HPj9Myw,1710
|
| 157 |
+
pyarrow/include/arrow/buffer.h,sha256=aDZgA8fFnizg61OPvgpWxftsGRAGNd-EW2BMjE233ZA,23226
|
| 158 |
+
pyarrow/include/arrow/buffer_builder.h,sha256=qaMgLKbycOSsn5e5_nlOj3tdPHu0i45if78ZrFN2Lmc,17468
|
| 159 |
+
pyarrow/include/arrow/builder.h,sha256=mBxMko271lJ7Xbku0hCixj943Yx-d2i4Q5Hm2WfwiGM,1546
|
| 160 |
+
pyarrow/include/arrow/c/abi.h,sha256=GCjxzmA2jNWQ0ZWVkQ-hnbCbMHKPikO1-JkzYj96cnY,20318
|
| 161 |
+
pyarrow/include/arrow/c/bridge.h,sha256=6e6ZoIsG-pE8FQ5aU4nRJ71vVL3U9k697g7PYKDsVz4,21789
|
| 162 |
+
pyarrow/include/arrow/c/dlpack.h,sha256=IXIuMdfqbHJ_AdT_25tzp0z48mWC65w4xZMjTP3yl7Q,1983
|
| 163 |
+
pyarrow/include/arrow/c/dlpack_abi.h,sha256=mjp9WWq8qv6gkGirT4y0o3BL_ZI9VyHQpJ5aEpPFetI,9920
|
| 164 |
+
pyarrow/include/arrow/c/helpers.h,sha256=f0Q519PwoliFHpxsHp-QvbP6fpVMN2Ha35Tk-RBK6Ws,6279
|
| 165 |
+
pyarrow/include/arrow/chunk_resolver.h,sha256=oVm7DpbWRmjJhexj_h6BtispCBxFZPIHK1kl9goBGG8,12841
|
| 166 |
+
pyarrow/include/arrow/chunked_array.h,sha256=z6LA9OB3uhtmn7ZZe5wfi3Am3icVQ-L_e8s3KEMuq18,10647
|
| 167 |
+
pyarrow/include/arrow/compare.h,sha256=yp4ganiaR6xXokExmFAauUyfSPwOM8DuBmmAtyK0NJg,8059
|
| 168 |
+
pyarrow/include/arrow/compute/api.h,sha256=6z6HdNH6S0Amop2GUfrsifxOvgupfTqFDZf76YREt-4,2139
|
| 169 |
+
pyarrow/include/arrow/compute/api_aggregate.h,sha256=GCPpIA6qz6XL2UI4SyxXjyjPeC68OoT1tttpiue8eMY,21945
|
| 170 |
+
pyarrow/include/arrow/compute/api_scalar.h,sha256=qR-K4zRkfJmINCF0vTp3rMWf7hdi4PU4haD59wGO9Xg,70099
|
| 171 |
+
pyarrow/include/arrow/compute/api_vector.h,sha256=axkl_2Kz-VqeZkQgAsGCy9spxV62PkgJKhTklQyWWWs,34507
|
| 172 |
+
pyarrow/include/arrow/compute/cast.h,sha256=y8v-EYs-1zJ5NhulMGNzagKc9CkU14ld36VIbYdV94g,4245
|
| 173 |
+
pyarrow/include/arrow/compute/exec.h,sha256=2baXvq1FWwyfQfTV4r6qhF818LEYOxyn_DiTqE5AMCk,17975
|
| 174 |
+
pyarrow/include/arrow/compute/expression.h,sha256=LBwjf1LTtfCfTT3RGUq_3PI_V0LRf2HxtZ-Ovqslw-c,11164
|
| 175 |
+
pyarrow/include/arrow/compute/function.h,sha256=rtEKbrMURIqOWo3JgdOxHsDMk1F-Kk5_Jz_xcpXavxg,16419
|
| 176 |
+
pyarrow/include/arrow/compute/function_options.h,sha256=Q9rjkXPrU9-Xi64_fMLPbBbW_byhjJFsvHppP1CumdA,3088
|
| 177 |
+
pyarrow/include/arrow/compute/initialize.h,sha256=ms8mtCSHTaStTrWdapbNyNSpM0PO4ox32O9colbBR7k,1193
|
| 178 |
+
pyarrow/include/arrow/compute/kernel.h,sha256=d3BIi5NtSBqPsh2gyCsfT03LvRmO2vM_XgoXip_HuKA,32283
|
| 179 |
+
pyarrow/include/arrow/compute/ordering.h,sha256=8Vw3VzDi1mGgVwKGQZakz9TVj0A40wxcL13EvuqNVjU,4129
|
| 180 |
+
pyarrow/include/arrow/compute/registry.h,sha256=x7LHiaNEVvZ0VUssZFsasB52Z1AxRflkdI5tR1hhzqc,4837
|
| 181 |
+
pyarrow/include/arrow/compute/row/grouper.h,sha256=ID9sFjFawulQC5T_f-TQttvohhsSAmNkHIj1iXzDY-0,7520
|
| 182 |
+
pyarrow/include/arrow/compute/type_fwd.h,sha256=tiG7MrLEfXAPF53JKlnFdJ7kzjhNP9a_xCb2Ept3ozc,1555
|
| 183 |
+
pyarrow/include/arrow/compute/util.h,sha256=l1y6P1hHsI-mQ7lB6KNn_8AzYCxCxuhaSBOOG_wqjcs,9376
|
| 184 |
+
pyarrow/include/arrow/compute/visibility.h,sha256=_h6gB6GG5YSF3aak6oAerylqtJvjhTN9Tq8MZccpO0M,1597
|
| 185 |
+
pyarrow/include/arrow/config.h,sha256=8liyKI0CJO0G-Fz5I--QjIAwh0m4hosfyAOwvVVs0sU,3044
|
| 186 |
+
pyarrow/include/arrow/csv/api.h,sha256=LbwWhPyIsi_73hvsSr77RNR9uUxrVyXM__hp7QcSom0,907
|
| 187 |
+
pyarrow/include/arrow/csv/chunker.h,sha256=nTs8hdy4D3Nz3oZWm2JMuA02noY_0pWRYWq_RptqzHY,1171
|
| 188 |
+
pyarrow/include/arrow/csv/column_builder.h,sha256=5t3842eXFsAHtrLGJ4LQkH2epUAr06PbnF7POwlgQQw,2889
|
| 189 |
+
pyarrow/include/arrow/csv/column_decoder.h,sha256=10idcPJE2V_TbvgjzPqmFy1dd_qSGWvu9eDkenTuCz0,2358
|
| 190 |
+
pyarrow/include/arrow/csv/converter.h,sha256=cjtnz_hZFxm_dWjAMjr1iqqk1egXI2Yb8Bd0xC8md5E,2789
|
| 191 |
+
pyarrow/include/arrow/csv/invalid_row.h,sha256=gTHjEbjkpee6syLGA8hFY7spx1ROMJmtMcwhXv21x5Q,1889
|
| 192 |
+
pyarrow/include/arrow/csv/options.h,sha256=0ShMt1PduP3K-n20HjxhWRQMORKP_q4rsIRYeWzoDR0,8202
|
| 193 |
+
pyarrow/include/arrow/csv/parser.h,sha256=8PplRh3Qxckk8VPyM70P_f1MBb4WMGnNVpoeJ9kOdHU,8616
|
| 194 |
+
pyarrow/include/arrow/csv/reader.h,sha256=416pt3yNQsgn4RhIyRMsmSJmvv1sw3ouQotubXG91gQ,4606
|
| 195 |
+
pyarrow/include/arrow/csv/test_common.h,sha256=uEYzw8EROvd1QMBQ98d4MaZ7BqMlw2e0flAyz-du0Z4,1972
|
| 196 |
+
pyarrow/include/arrow/csv/type_fwd.h,sha256=ptVbengmY_a7Yz1w0SKmKL16yyw9yEeym0Q0cnRCSV4,984
|
| 197 |
+
pyarrow/include/arrow/csv/writer.h,sha256=Y1zErZ5H1r2QzjAta3TXpFrdl2btoardCF8USCAGtGg,3549
|
| 198 |
+
pyarrow/include/arrow/dataset/api.h,sha256=p7i-bncJLhmfBkfjJWS7684vD9Lke1m6tb7HQq7Tpn4,1322
|
| 199 |
+
pyarrow/include/arrow/dataset/dataset.h,sha256=NsXdSFYrO4BpJSEV2e4yJRrN-hdLxMJepwAyyqFWt-0,20327
|
| 200 |
+
pyarrow/include/arrow/dataset/dataset_writer.h,sha256=TQV75b_UigfGjIpBnPk8teOncM5WroKfKV15oicBRRY,4589
|
| 201 |
+
pyarrow/include/arrow/dataset/discovery.h,sha256=x7-5NBAyEeQWGlWanJDLZAoWksKiMwM96tlDx_M6n5c,11236
|
| 202 |
+
pyarrow/include/arrow/dataset/file_base.h,sha256=nUMWLbhh7lt5c3iOw5edAtcy4jrCzpBUX5JZ29FW0Tk,20385
|
| 203 |
+
pyarrow/include/arrow/dataset/file_csv.h,sha256=7PlvQW_2FJ5RRN-VH4-OBw5cZ6nkd0KE0sj1TQvCZeo,5016
|
| 204 |
+
pyarrow/include/arrow/dataset/file_ipc.h,sha256=6-btvXhflZsAH90T3wMkwzZkte6T4ixzeCEUn_5uYW8,4083
|
| 205 |
+
pyarrow/include/arrow/dataset/file_json.h,sha256=sPjOeMOtbZZbvOivnOdb4MvYKHltpTnY8fONkhB9PZs,3523
|
| 206 |
+
pyarrow/include/arrow/dataset/file_orc.h,sha256=P7nAD9nacVngDEjH8ChQRt0AQmDg4Z1wBx360LDOoSg,2452
|
| 207 |
+
pyarrow/include/arrow/dataset/file_parquet.h,sha256=_mhpCrrLGn9XPKSt9lsdbG4wosPOkMiqkjXDz-2D_So,16935
|
| 208 |
+
pyarrow/include/arrow/dataset/parquet_encryption_config.h,sha256=Upo0k5MijZaMaRZjPp5Xg8TRt1p8Zwh2c2tdimjVe1A,3425
|
| 209 |
+
pyarrow/include/arrow/dataset/partition.h,sha256=3wrNekD_-fPO1YW91Za-T4muCfQeAX7SZRIcsCN_czI,16815
|
| 210 |
+
pyarrow/include/arrow/dataset/plan.h,sha256=IjuR9K2sWD85_2HpVVoJ-3YUCq--UPblHU46exX5qRg,1181
|
| 211 |
+
pyarrow/include/arrow/dataset/projector.h,sha256=KfZijq09Ht0Z2cJHsrjg-sE3SiZ4TKainflReK-39cg,1135
|
| 212 |
+
pyarrow/include/arrow/dataset/scanner.h,sha256=fWeW3NZF5zQYAjSIDU6wJsitzaVrSRbOmrMUnNQE1RA,26176
|
| 213 |
+
pyarrow/include/arrow/dataset/type_fwd.h,sha256=YOUSRwdNAlXJ7meFLolpAFQ_mSlObs2F81zcOy0DoI4,3170
|
| 214 |
+
pyarrow/include/arrow/dataset/visibility.h,sha256=ckmf_sEI0WBo4W7DIgH1QrOq82skOHtoksl9B3yYvzU,1586
|
| 215 |
+
pyarrow/include/arrow/datum.h,sha256=XYaZ_URrAtVqHMq-_2YtXk_ETeQ4yZWLVAnsi-k2Mac,11511
|
| 216 |
+
pyarrow/include/arrow/device.h,sha256=mLz99tb74VdjxXtKt6RZCYKJQ8TYz93uaCFJ1ZiItMw,15344
|
| 217 |
+
pyarrow/include/arrow/device_allocation_type_set.h,sha256=ynoZ-XyFlOAjh01PU-R11mE_EOxuw3xzc94v5OXa0u4,3306
|
| 218 |
+
pyarrow/include/arrow/engine/api.h,sha256=ORM0M5KQeurjEG8Eoa5IeV_ZgKBRPlWyicyv3ORWkAY,886
|
| 219 |
+
pyarrow/include/arrow/engine/substrait/api.h,sha256=W9NB1RAm0ZVxztRXYA-GD7H8XLQNXFoYT7TdGFHoNTE,1079
|
| 220 |
+
pyarrow/include/arrow/engine/substrait/extension_set.h,sha256=z1IIQVd4bat5kRngg91IyoE5UYTv7bar1JQ5ck63YbY,21552
|
| 221 |
+
pyarrow/include/arrow/engine/substrait/extension_types.h,sha256=x5ZIuynNh6WFt3wRjW--zUsuC3SeDLk1qRg9_xhswWM,3075
|
| 222 |
+
pyarrow/include/arrow/engine/substrait/options.h,sha256=dtvUty_zoDmcFwVflppiDzelYkeOhCO74uRF6izQSzk,5820
|
| 223 |
+
pyarrow/include/arrow/engine/substrait/relation.h,sha256=V3VKFlDdE61e1OS8LbJiwvm5w0uq5bzBLhKqmgmKaws,2385
|
| 224 |
+
pyarrow/include/arrow/engine/substrait/serde.h,sha256=mjxfuFo4aPhCiwefpKAJMIlknF4UOHSr6gWU__1SwCc,16528
|
| 225 |
+
pyarrow/include/arrow/engine/substrait/test_plan_builder.h,sha256=REFa79D1AOIIjp2Iez73iw5gEnzG9Rac9t8WwiGLsuI,3003
|
| 226 |
+
pyarrow/include/arrow/engine/substrait/test_util.h,sha256=IHZeYrk50Sx9anJfC25DWP6XesItKEywDWUqvUJcjEQ,1517
|
| 227 |
+
pyarrow/include/arrow/engine/substrait/type_fwd.h,sha256=P9YRjAQpSgoIjDC0siYyxoQzcPVo3r9y85qjiMtudBs,1028
|
| 228 |
+
pyarrow/include/arrow/engine/substrait/util.h,sha256=_dRiQBaIMWNbsYG7kuXhs3dMk4dI63-pM0uSxYPOvgE,3570
|
| 229 |
+
pyarrow/include/arrow/engine/substrait/visibility.h,sha256=GRzH6U-UCPT8d60cywOkFfcanPSgiZKCDP6X2rIpbMs,1740
|
| 230 |
+
pyarrow/include/arrow/extension/bool8.h,sha256=VsHTtVyrqk6UKgvifad7LouuieoAZuZs_uVvegdGq4Q,2145
|
| 231 |
+
pyarrow/include/arrow/extension/fixed_shape_tensor.h,sha256=VOqvTSnwDIvnhbstYX5nnqWfhtZ7MaD-lSF89BEqlhE,5610
|
| 232 |
+
pyarrow/include/arrow/extension/json.h,sha256=bNh6R9aP3MK-rbTON8IzVn7FIt9RGMmUHGpQkFGfOMw,2026
|
| 233 |
+
pyarrow/include/arrow/extension/opaque.h,sha256=uMVqSScey_13Ho6V86vfkuoByZni9ufh5BGKgX4bTZk,2920
|
| 234 |
+
pyarrow/include/arrow/extension/uuid.h,sha256=DBzTD83Mh3oacfZzfU6fQuGC87gvtnGGaDue8s9M0Ws,2364
|
| 235 |
+
pyarrow/include/arrow/extension_type.h,sha256=YUvUzPz-0QiG-jOjs__TfyPEpsHWGkGO5PMVG1vMjkY,6639
|
| 236 |
+
pyarrow/include/arrow/filesystem/api.h,sha256=Xgy2GOZtBVwDjTaXPDyPPlS9Bwt9gjWXm5I_QbyRbFo,1383
|
| 237 |
+
pyarrow/include/arrow/filesystem/azurefs.h,sha256=M-7jR8AqyPu8uTXbw4INLb9RsZKrPmZlPO7T7MskQ_8,15299
|
| 238 |
+
pyarrow/include/arrow/filesystem/filesystem.h,sha256=tjRP-ZEWzES6bMfmDQ2MwnYr_3OGV5ZyfbZr3JqWZXM,29604
|
| 239 |
+
pyarrow/include/arrow/filesystem/filesystem_library.h,sha256=f2_p4Odzvq7zrMePwNcWFFet8oolnDI8SF0t55Z6T_Y,1765
|
| 240 |
+
pyarrow/include/arrow/filesystem/gcsfs.h,sha256=5HSHqA9a1T2zVnZO1rNZKnXjLVyq1aAm6DRmQmg_v5w,10372
|
| 241 |
+
pyarrow/include/arrow/filesystem/hdfs.h,sha256=Jn91pjfk6RMx-MuAWsEAKLTyKQ7bDPNA5jMEVzafSgc,4133
|
| 242 |
+
pyarrow/include/arrow/filesystem/localfs.h,sha256=eIhPrpABheQz21WE845ULleTk83e4EtJnES4jALW6mM,4972
|
| 243 |
+
pyarrow/include/arrow/filesystem/mockfs.h,sha256=kohu7s9s9xtd75sGTE2K_rsHW89swDOtSSSFxBixMcc,4768
|
| 244 |
+
pyarrow/include/arrow/filesystem/path_util.h,sha256=hrDVHk4F9M7oGABB4x2wKfQMjSlSAIS0IaLVv2jHrl4,5698
|
| 245 |
+
pyarrow/include/arrow/filesystem/s3_test_util.h,sha256=22B600fr84Gq4rGALdidIP0IzDs9G3aOqkLN4y-6xrI,2962
|
| 246 |
+
pyarrow/include/arrow/filesystem/s3fs.h,sha256=q79pFbxFmsfA30LE78bOh6hj5Iszh01Vtw8LUpIa6T8,18221
|
| 247 |
+
pyarrow/include/arrow/filesystem/test_util.h,sha256=IcdXbz8kXaZDvUPN6Oc77UpWI2Psv1f_CKZxB3UGg-I,11738
|
| 248 |
+
pyarrow/include/arrow/filesystem/type_fwd.h,sha256=zztDER55Wbt4rVnkd-ReeDO-YnrpemftFeFtZ7ZGidY,1462
|
| 249 |
+
pyarrow/include/arrow/flight/api.h,sha256=YotLTQn-KCl6y5BIg8coEFZ9n7PMtJ02ly7Pc5gmX7U,1257
|
| 250 |
+
pyarrow/include/arrow/flight/client.h,sha256=MdHgubO7ExcWgp8S-CP9B4UfJ_aRLgLat0yz0pXQEdg,17936
|
| 251 |
+
pyarrow/include/arrow/flight/client_auth.h,sha256=a3Dkm_jPOuqzNsDA4eejuMUwCEBMavM8uS7w81ihbRY,2216
|
| 252 |
+
pyarrow/include/arrow/flight/client_cookie_middleware.h,sha256=5zkCP2SxMFQuTX8N9NHxOve5J_ef2rFO6-xY4Tfnygk,1204
|
| 253 |
+
pyarrow/include/arrow/flight/client_middleware.h,sha256=aAZwCahuiBhP85iMPe7xNWvidBR9KeHGto2YAqJioI4,2948
|
| 254 |
+
pyarrow/include/arrow/flight/client_tracing_middleware.h,sha256=d0sTmUOfq5M9FMliIKK-flJkR6-7r69NjU2TpxhfqWo,1217
|
| 255 |
+
pyarrow/include/arrow/flight/middleware.h,sha256=JPQd8JnIVcwjTH6yOBck4BWR-WV95fpnAdhHyEYvfKE,2254
|
| 256 |
+
pyarrow/include/arrow/flight/otel_logging.h,sha256=riS9sZM2C3mH6VMbESizJ6lGmudqdJhfdCY9_cJJqMA,1139
|
| 257 |
+
pyarrow/include/arrow/flight/platform.h,sha256=1ZfzVaollAZosGyH_1JvzEA8iNR0hi9cUGz5eyLT1zc,1209
|
| 258 |
+
pyarrow/include/arrow/flight/server.h,sha256=GAcV0-THuBuj-bXfwqYrZ1P2bwZgKQSJLbu8ToltRvU,13185
|
| 259 |
+
pyarrow/include/arrow/flight/server_auth.h,sha256=xXkot_fmnEZ0yXHEBmiezAQCxM7vQem1Vo1V0vEwcW4,4457
|
| 260 |
+
pyarrow/include/arrow/flight/server_middleware.h,sha256=kRXm15c1mjPduoS7N61m0TG8nGIhN_ielsjK9yFlsgs,3155
|
| 261 |
+
pyarrow/include/arrow/flight/server_tracing_middleware.h,sha256=NzyufqTwzcTZ32FNuY-rwse4KmH8zoyoc1RhZxUMwFs,2186
|
| 262 |
+
pyarrow/include/arrow/flight/test_auth_handlers.h,sha256=XkvMWucv9GQjlt2ttvYxshym4kUubUdMh-timlQIt1I,3315
|
| 263 |
+
pyarrow/include/arrow/flight/test_definitions.h,sha256=U_HhBnNdNZmojraYzICBmBvuef0bTT5eYzFXp8iGFzc,13110
|
| 264 |
+
pyarrow/include/arrow/flight/test_flight_server.h,sha256=SbRhZP0U4ILnbg7lYQvGeXmvPM_B6bai12FTM_HD4RQ,3930
|
| 265 |
+
pyarrow/include/arrow/flight/test_util.h,sha256=1Tv0Yl5lth2j3fIZT7iI8n_kexzGgJHGxplV4xeu7TE,6668
|
| 266 |
+
pyarrow/include/arrow/flight/transport.h,sha256=ZDXc-f8o00TFWESwsGU1My7rR9OfM3X7OZjDcGXTwIA,12181
|
| 267 |
+
pyarrow/include/arrow/flight/transport_server.h,sha256=iVdXmrb2pemh4o6BxwvB7OZAV4UeoWrbhe4ePZ5Pi4s,5268
|
| 268 |
+
pyarrow/include/arrow/flight/type_fwd.h,sha256=tQFAM3QNKPdzB4VqUGdEUFjNPYXVZLApwGnSus2GQx8,1797
|
| 269 |
+
pyarrow/include/arrow/flight/types.h,sha256=BwMWMwRPSxdyYPcR1ocdi2KXpJvAXRepkz6vUfZVCmc,47383
|
| 270 |
+
pyarrow/include/arrow/flight/types_async.h,sha256=3nIQqwCYO4Ir3Mt2bG7BNntXxuNHYQNNpz-Yl3EaFTQ,2599
|
| 271 |
+
pyarrow/include/arrow/flight/visibility.h,sha256=N1k74cwyRvOaYFa_tCjdgUjiSdPBhmy20UuVGu0wTg0,1596
|
| 272 |
+
pyarrow/include/arrow/io/api.h,sha256=Pn4jZSTsLW8MAlMyXUokmJdupX54u154GYI5AvD5ByA,996
|
| 273 |
+
pyarrow/include/arrow/io/buffered.h,sha256=PHaMwCMaXu3vAjhDpZMC2xt5hKooJXVeMffhoDzTxNc,5912
|
| 274 |
+
pyarrow/include/arrow/io/caching.h,sha256=AAjoyKwQ06m2XiglFS6Ch_cdg2p4-wkA7GakGI_eX1E,6708
|
| 275 |
+
pyarrow/include/arrow/io/compressed.h,sha256=3JxIOo1q8VhjIErfwVM5ZLVkwwQKXd-FT5517j58etA,3774
|
| 276 |
+
pyarrow/include/arrow/io/concurrency.h,sha256=SmIr0OWCgMUR3j9ngVbjMJhWOUrU15jQf_jz2rUw7r4,7934
|
| 277 |
+
pyarrow/include/arrow/io/file.h,sha256=-ZEklW1Q0sj3pYCQLQ1ebirKd3s2GI3vUEIszFr8mVU,7625
|
| 278 |
+
pyarrow/include/arrow/io/hdfs.h,sha256=2s3f49ggAYgSCsX5SoqnomwsXd24_IZhW-VSBJclqTg,8559
|
| 279 |
+
pyarrow/include/arrow/io/interfaces.h,sha256=QIBHTJUobEkwcqnKMT_GEKu5ArzpeGmK-8v7z4qGHIQ,13428
|
| 280 |
+
pyarrow/include/arrow/io/memory.h,sha256=SY535DEFEOIXojttrsGmMtK5PClwGx5sHK8E_TlCGCQ,6321
|
| 281 |
+
pyarrow/include/arrow/io/mman.h,sha256=qoLBAGFcvpYTy96Ga7FNWDJKT3uhxpFAF3hbXIaDSiY,4111
|
| 282 |
+
pyarrow/include/arrow/io/slow.h,sha256=8-ZjQJq49EQJ4esQ6qHHjlKCeZNg4BSND7ire-ZtLYQ,3942
|
| 283 |
+
pyarrow/include/arrow/io/stdio.h,sha256=dqMTHoJbmiXcyNa2fN60tSWQsx0GPphZVCLdGiZNt8I,2095
|
| 284 |
+
pyarrow/include/arrow/io/test_common.h,sha256=SF59odb0E3rtGju5jABsQzZcUi9gl5TwHuKg4f0EQ5Y,2146
|
| 285 |
+
pyarrow/include/arrow/io/transform.h,sha256=W9XWonw69VymQAaQptfW7jD-6ry7VCpfPXlkB7aZzOE,1890
|
| 286 |
+
pyarrow/include/arrow/io/type_fwd.h,sha256=Pi7EFpFvBXsFN1xKOyZjTSP95xNDs6W5hxb5GucoVVE,2315
|
| 287 |
+
pyarrow/include/arrow/ipc/api.h,sha256=sbbb-uYHZtqE59AUlwNnAzUkP41h3Et9Rnu20gNKm9w,972
|
| 288 |
+
pyarrow/include/arrow/ipc/dictionary.h,sha256=UTjZPIG8mLZOk9IW2QnR9RZGr1npexZOp103fv-O70E,6104
|
| 289 |
+
pyarrow/include/arrow/ipc/feather.h,sha256=uCnxwO7eUH18kJ-lWz9IWwSj6AjfejqqLdoifJ-UBDo,4918
|
| 290 |
+
pyarrow/include/arrow/ipc/message.h,sha256=KtMCbIC2J4-5iyPG5Sijqu_MALxiuKWBYZhGnw0jxOQ,20011
|
| 291 |
+
pyarrow/include/arrow/ipc/options.h,sha256=rAnPbL2wXRg4tZpnC3FNkxWxPdhRR5xUM2tYkc1crZ4,7900
|
| 292 |
+
pyarrow/include/arrow/ipc/reader.h,sha256=NqdrqqAEItO1ecYUINRO7-qhKlYy-CHSJKGI2hdXlRQ,24106
|
| 293 |
+
pyarrow/include/arrow/ipc/test_common.h,sha256=kd6-NmmaT__0cDYIwes8lnOqbQDSqFZn8eg2N-SHfE4,6559
|
| 294 |
+
pyarrow/include/arrow/ipc/type_fwd.h,sha256=Ty8ET7nLI4JJeTqDMyP0pEH9QVj9xs7BpJkZrnrpaPY,1440
|
| 295 |
+
pyarrow/include/arrow/ipc/util.h,sha256=wTkfC9YFKZlAAjyzlmQVZcW90oOj_JatjDN4qz0IxHg,1414
|
| 296 |
+
pyarrow/include/arrow/ipc/writer.h,sha256=hum8E_orkG_X38vgyfyKhGbyvcLJ3AkXEykyBjAXIYg,18870
|
| 297 |
+
pyarrow/include/arrow/json/api.h,sha256=XRW1fP43zVqwy1yabaKctNK9MDZqnxkoHDH1fx5B3Y4,879
|
| 298 |
+
pyarrow/include/arrow/json/chunked_builder.h,sha256=DDuMwrImMECw6Mhfncn2xMOjkFcKUV1O1597_fSFSAs,2365
|
| 299 |
+
pyarrow/include/arrow/json/chunker.h,sha256=dkZOcxsF1Q3ek58P7IoA8f3lQyBQpFvGSFeynNV2Olc,1119
|
| 300 |
+
pyarrow/include/arrow/json/converter.h,sha256=3lXsP3BSdpLPIkFAJnYW9vP8BbX3neVYR_W0zFKClQ0,3134
|
| 301 |
+
pyarrow/include/arrow/json/from_string.h,sha256=y--AK08e-EivbrilSGU6xtPH1VpqBNZIYvCMUT2_V_E,4106
|
| 302 |
+
pyarrow/include/arrow/json/object_parser.h,sha256=Y_6Oceya06aUyeo-1k047dm2-JUMJa2_w9iyZ-goIRQ,1627
|
| 303 |
+
pyarrow/include/arrow/json/object_writer.h,sha256=UrIrjCkIz7Q5n_FpV5NNPD96gHHdTkvTJaekuGBHwTo,1428
|
| 304 |
+
pyarrow/include/arrow/json/options.h,sha256=EypQgDwLZQbrPnAh45nSPfpGGYrxvLgfp1eAG_l0p3Q,2227
|
| 305 |
+
pyarrow/include/arrow/json/parser.h,sha256=3oIzO5kUs2Takc7t_d5mH7bp1uIcc1M-qbuHmPoSI34,3383
|
| 306 |
+
pyarrow/include/arrow/json/rapidjson_defs.h,sha256=lBJlfuYWIeQQ8awPd3bk4jJc81efr_KzKwG8Klw7t1s,1474
|
| 307 |
+
pyarrow/include/arrow/json/reader.h,sha256=KNO9dCyc2RZs7WxUSEW7bpCYBh_h1C3U52YHYxBnP0M,5212
|
| 308 |
+
pyarrow/include/arrow/json/test_common.h,sha256=YiiY_jswpp7Nu6IW1Y2lBhqWSFRoNaNEy1jHd5qkYHQ,10874
|
| 309 |
+
pyarrow/include/arrow/json/type_fwd.h,sha256=o9aigB5losknJFFei1k25pDVYZgkC2elmRMX1C6aTjo,942
|
| 310 |
+
pyarrow/include/arrow/memory_pool.h,sha256=sKBdu-Aidm_X3qbPnfpur5LX7nuwlsnCraPsGR2Up70,12911
|
| 311 |
+
pyarrow/include/arrow/memory_pool_test.h,sha256=qv7csk6hZiO2ELFF-1yukpppjETDDX0nuBFBbPFHtMU,3350
|
| 312 |
+
pyarrow/include/arrow/pretty_print.h,sha256=Z36O7Rp3wp8gCG51YHh-x8ytrrENDpFZSPmSSXs9TAo,5716
|
| 313 |
+
pyarrow/include/arrow/python/api.h,sha256=2XyYOFAmorPGXrTVYZkiKL67nuH8w1ha6D1reU7K-Vs,1179
|
| 314 |
+
pyarrow/include/arrow/python/arrow_to_pandas.h,sha256=jQiSTN8IL95onwaclaWqCR5Nb2RHrBtubRyEOJR9eRE,6215
|
| 315 |
+
pyarrow/include/arrow/python/async.h,sha256=C0f8YYmgwBGgDau4xEFsdjukiZB4YvpylETHEZryHOo,2352
|
| 316 |
+
pyarrow/include/arrow/python/benchmark.h,sha256=f-kzyMOlPKDse2bcLWhyMrDEMZrG_JHAPpDJgGW0bXU,1192
|
| 317 |
+
pyarrow/include/arrow/python/common.h,sha256=9IQC__JUqTRXv5MfAqKM6ivMwuQ-uMZKEguGDEODkiA,14389
|
| 318 |
+
pyarrow/include/arrow/python/config.h,sha256=SQa6SuM3oAfQ7wEbwVJqlPfqslqlq2DXK_FK6-K08Kg,1150
|
| 319 |
+
pyarrow/include/arrow/python/csv.h,sha256=QxU3B-Hv_RsoEcMGS9-1434ugouL2ygC64Lq6FgviNM,1397
|
| 320 |
+
pyarrow/include/arrow/python/datetime.h,sha256=Bny_THGi2tyUeHxcOuw01O7hNE8B_gave5ABAZQtwTQ,7931
|
| 321 |
+
pyarrow/include/arrow/python/decimal.h,sha256=K9ScmzSa7XCuuwpXKnq0GPbRDTuRU5yXfWr9zGtOchc,6362
|
| 322 |
+
pyarrow/include/arrow/python/extension_type.h,sha256=0gzb42y_mbw4fsYs3u8cwPFLBRlG-kkHQLgbvGtrY0U,3181
|
| 323 |
+
pyarrow/include/arrow/python/filesystem.h,sha256=FG0AcLekqaDf9IQPqKixAfIcY_ZLgIKP5NvvXdtBVUM,5126
|
| 324 |
+
pyarrow/include/arrow/python/flight.h,sha256=t4ZD8gWaubbO_mBDv0XZ58TCo1VQl0hzHn1_7w4U64I,14450
|
| 325 |
+
pyarrow/include/arrow/python/gdb.h,sha256=H-qvM-nU8a_3Z5tk8PvppTwQtBMSZhQKQIVgRAsRfFg,972
|
| 326 |
+
pyarrow/include/arrow/python/helpers.h,sha256=Q3TmwyffFpVYQEp55ZoWTDDhnte7zQKiXylsfbEMCuI,5479
|
| 327 |
+
pyarrow/include/arrow/python/inference.h,sha256=FUFvB4Zy7V-tueXdmbDcqTeLK4xj5GZEeRW5yhiJlsU,2038
|
| 328 |
+
pyarrow/include/arrow/python/io.h,sha256=4jGnodpSUlnVqAVh9fWId7H4WldlLPkXyroABpdaW6w,3858
|
| 329 |
+
pyarrow/include/arrow/python/ipc.h,sha256=SZbw6jCCqLiLNCY3k632GmwHeD_r_xrDS0dhqV49VhY,2259
|
| 330 |
+
pyarrow/include/arrow/python/iterators.h,sha256=Ugfm3JvetAH0l-oAjjpZfhrUBqRimVMaw4-xusvqLSg,7327
|
| 331 |
+
pyarrow/include/arrow/python/lib.h,sha256=NSqX1jl5ZWssVm0SmNFHp4PckJYy8YCJxlL02MKa4Uc,4562
|
| 332 |
+
pyarrow/include/arrow/python/lib_api.h,sha256=rm6EBrvNbQHNzt_TJGbbdIo5T_1IC2WBAXIQnpMzsNA,20132
|
| 333 |
+
pyarrow/include/arrow/python/numpy_convert.h,sha256=y13eHwfe1lJKzadoTr2-GyX6xPsE6Z7FN31s7PN-2Rk,4870
|
| 334 |
+
pyarrow/include/arrow/python/numpy_init.h,sha256=FniVHP7W2YBlenoMYhQrODvoqqvDMSls2JANGtNPQts,999
|
| 335 |
+
pyarrow/include/arrow/python/numpy_interop.h,sha256=rI6ek8JTOYtjo7gEADSDBS6QuAOHa2A0YQPZ2GeypFw,3418
|
| 336 |
+
pyarrow/include/arrow/python/numpy_to_arrow.h,sha256=z9KapsuoOSpWILPt9bea7GR4BL6AQ28T6DUO0mSkh3k,2760
|
| 337 |
+
pyarrow/include/arrow/python/parquet_encryption.h,sha256=7KjqRuxbO0UxxHikTDvrLH733UVe0uvTf_bQMiI_xCA,5596
|
| 338 |
+
pyarrow/include/arrow/python/platform.h,sha256=AtkGgpUVqPHs9Z8Tm07yb2zN_wOtb2cvlf-5xFBkc4k,1268
|
| 339 |
+
pyarrow/include/arrow/python/pyarrow.h,sha256=TK3BtD9n3QKOQ9dX3LXbQc0hu9alWcufV0O93iQW7B0,2761
|
| 340 |
+
pyarrow/include/arrow/python/pyarrow_api.h,sha256=7l0G4-_m9yALYoifsY8Z6qh3HHD0PgkpVSgCn_JaGU4,867
|
| 341 |
+
pyarrow/include/arrow/python/pyarrow_lib.h,sha256=-70_Ckj3_0ImlzaXSJOE_d3w9pGM66lXiGPyln9c96Y,863
|
| 342 |
+
pyarrow/include/arrow/python/python_test.h,sha256=ea32mM20uHySlygi9MtVxr26O-ydTZHCUQIlxaIMjT4,1195
|
| 343 |
+
pyarrow/include/arrow/python/python_to_arrow.h,sha256=BoVytf6P7PBYXyznchElKZSFvEsFyimB-tLFdw0AUNo,2521
|
| 344 |
+
pyarrow/include/arrow/python/type_traits.h,sha256=U7dW4sajVVmjXALsP-B8ZZwI4GgIUG3t-rbp2fwrHWI,10236
|
| 345 |
+
pyarrow/include/arrow/python/udf.h,sha256=de3R8PhNJO5lT9oCqRxe8e2_SE3jBpHOkwbNqCrlgjQ,3104
|
| 346 |
+
pyarrow/include/arrow/python/util.h,sha256=sP2CEGG7NNqwjrEeNKB-VFqkKxn5P2Tsc0jPUMXQuLg,1732
|
| 347 |
+
pyarrow/include/arrow/python/vendored/pythoncapi_compat.h,sha256=bzMnlHTCfjk5DQRIxwytunYh5aQxU3iSElaaDyNnAY8,40900
|
| 348 |
+
pyarrow/include/arrow/python/visibility.h,sha256=hwJw5sGrWJckQkNaAuLe4Tf-VDjQbXknyzNOVgZI3FI,1381
|
| 349 |
+
pyarrow/include/arrow/record_batch.h,sha256=DZ_GZUGTEBv7uJeNnxPoY1ZnB-m7tfSYcHuNdL6iXVU,18947
|
| 350 |
+
pyarrow/include/arrow/result.h,sha256=sh0Yp4pFT07H-ro8CFzK-Iye_0PF-unu-vz4C0hcoHA,18357
|
| 351 |
+
pyarrow/include/arrow/scalar.h,sha256=rsZGG1akIQJRRTw-_dlXLjkPT6NTONiwv70L_1zPxho,37320
|
| 352 |
+
pyarrow/include/arrow/sparse_tensor.h,sha256=1EetIzwI_JvNITcy3LS9Ra0wFiDWLB0hXjy26VOCg2s,25205
|
| 353 |
+
pyarrow/include/arrow/status.h,sha256=r9B963ikSEuSQpbnuGBV-pl1Dtfi5Co0gFd7hI0AMUE,17392
|
| 354 |
+
pyarrow/include/arrow/stl.h,sha256=2PEb_N_ZOWrwBJnFWah96GuLmEBc5Vl4_IFws9NCF2k,19343
|
| 355 |
+
pyarrow/include/arrow/stl_allocator.h,sha256=TBbvjbuQIH9y88FI2SaqAL7pOIt3wZ1xMKwXqeKNiJE,4956
|
| 356 |
+
pyarrow/include/arrow/stl_iterator.h,sha256=RelNQrADHupKWTuFBCCkqVlyuGHXU3yB6gcsDpQpra8,9953
|
| 357 |
+
pyarrow/include/arrow/table.h,sha256=0RFiXqJcNfcdH9jcDcBiRunPdWcHZn4A0blWdSR-MqE,15300
|
| 358 |
+
pyarrow/include/arrow/table_builder.h,sha256=LRcLCL2iUrj6vF4f9AjPswVjqtqlMw7z_8VBAfUJeCo,3763
|
| 359 |
+
pyarrow/include/arrow/tensor.h,sha256=t5qdeufYoYG1Tl4DCiDzeZkOhyiQQPOGbMKCLa0u7WM,9089
|
| 360 |
+
pyarrow/include/arrow/tensor/converter.h,sha256=RZq0Try_kiZ085_d_CvhewMsd57InGb2TCeiveaf-Oo,2891
|
| 361 |
+
pyarrow/include/arrow/testing/async_test_util.h,sha256=IrHWfPeIyhrgeTGHUPLt92LdsofmFX6khjngWsZv3dY,2262
|
| 362 |
+
pyarrow/include/arrow/testing/builder.h,sha256=4x0bWOedaVomWU0m7dF99irOv3flR-_p-IMofTDZtwo,8556
|
| 363 |
+
pyarrow/include/arrow/testing/executor_util.h,sha256=38_rF-V_9zF1ttJMspkPiI-34VU1RDjg1ADBS8lUFHk,1885
|
| 364 |
+
pyarrow/include/arrow/testing/extension_type.h,sha256=2xHmtD1bnK-u8Or38keTBvDuXhgKvsVyiiO-exlWHXg,8113
|
| 365 |
+
pyarrow/include/arrow/testing/fixed_width_test_util.h,sha256=g6yB7RkziU7HEhNJnxOhkn2nE5HeXaFX3tbBX3q9_sE,3091
|
| 366 |
+
pyarrow/include/arrow/testing/future_util.h,sha256=qIhi417OGMWSMUSDHjkGTYd-ihZbqw8ZSIRwJ01vbKg,6246
|
| 367 |
+
pyarrow/include/arrow/testing/generator.h,sha256=zwEI_ZS-nxOIoYZUW_X9VE0wg5ILk8PzBpeo6kqXUDM,13525
|
| 368 |
+
pyarrow/include/arrow/testing/gtest_compat.h,sha256=0NqH39my7m1FMpsrQYnxQx4bdEE10SCXZaysN6yjQFA,1311
|
| 369 |
+
pyarrow/include/arrow/testing/gtest_util.h,sha256=s6hzot0wcsaVvajwRlBYmWGUjSvJ13o8AlNGLhEtPr4,24381
|
| 370 |
+
pyarrow/include/arrow/testing/matchers.h,sha256=Z6jJW4fGlvtpc7oWpPlx5ynLk2tnLwF-dhv5fQIcvqc,16832
|
| 371 |
+
pyarrow/include/arrow/testing/math.h,sha256=YLDNNqYpSHBT1jZo06pYN-TG_RtOJFOJ29YJ0hSP8g0,1424
|
| 372 |
+
pyarrow/include/arrow/testing/process.h,sha256=AzPW3Lh2R4sTm-RUUi4Od3aSba9zoLcS_zHBxztv4zI,1372
|
| 373 |
+
pyarrow/include/arrow/testing/random.h,sha256=U17nEG1fl4vAMGULYVMWUtdIv15R87EoK-SKZirujAc,38331
|
| 374 |
+
pyarrow/include/arrow/testing/uniform_real.h,sha256=-G_2J9cvevoCtB55vsCsWtJkMUHLIMyOwdT6G8ZW45Y,2970
|
| 375 |
+
pyarrow/include/arrow/testing/util.h,sha256=bvrOS5Uvcfn4Crb-bf_4_02Jb5MPQsItf9AnWC6CKmA,5662
|
| 376 |
+
pyarrow/include/arrow/testing/visibility.h,sha256=-wjc00QIhygXJa7tknbIL685AQ1wnyCPr-EtVzkzmq0,1606
|
| 377 |
+
pyarrow/include/arrow/type.h,sha256=7VaBkMx1Ot4wgXtcUVunB5ZC4txMagh71bopSFbwy08,96952
|
| 378 |
+
pyarrow/include/arrow/type_fwd.h,sha256=04ZjJ5UYWHsFofNPN5yx94VEeFh3__906P5J1QHQaqc,23665
|
| 379 |
+
pyarrow/include/arrow/type_traits.h,sha256=nKDVrC4_4EBfyEbHQdVr4mgmAaSvdp6cJE2XPZfUwaA,56056
|
| 380 |
+
pyarrow/include/arrow/util/algorithm.h,sha256=045EVzsC9rThlRVFaCoBmmtWZmFy5y28PR9yapn9sXY,1229
|
| 381 |
+
pyarrow/include/arrow/util/align_util.h,sha256=DG2L24KReTiU8nFpXLigbflkKouKWTPUf6osQs6mxiY,10669
|
| 382 |
+
pyarrow/include/arrow/util/aligned_storage.h,sha256=e0pCTBZ9hn9VAVTnENubbEii_witF73xUeBZNIQd73I,4254
|
| 383 |
+
pyarrow/include/arrow/util/async_generator.h,sha256=avVH3JPaDk_vrEh8uhPLopVN3LSn-29yst23GoptZR8,78200
|
| 384 |
+
pyarrow/include/arrow/util/async_generator_fwd.h,sha256=Q8sueYZWwdxkaVDabuglHM3XuP--NerYgq8UxsVHgFY,1728
|
| 385 |
+
pyarrow/include/arrow/util/async_util.h,sha256=1nnAJZ22iK7wSzmvZDo3PMhuWqJIt2qKdlXzTyhoCK4,19759
|
| 386 |
+
pyarrow/include/arrow/util/base64.h,sha256=qzcBE98cg8Tx5iPJAvQ4Pdf2yc6R2r-4yGJS1_DEIeY,1095
|
| 387 |
+
pyarrow/include/arrow/util/basic_decimal.h,sha256=Q2zfksUdYc92TL8po81I_aQOmwHTwZGPjqXvJM7cgek,33569
|
| 388 |
+
pyarrow/include/arrow/util/benchmark_util.h,sha256=SG3gfwE-wGNZAwpL3TvffnSiZGM2cztV5xRBnbqy2Mw,7641
|
| 389 |
+
pyarrow/include/arrow/util/binary_view_util.h,sha256=-sFAQX9cnfWmmZJo8stFX5vkJki7T2UloAvDzYO0MN8,4625
|
| 390 |
+
pyarrow/include/arrow/util/bit_block_counter.h,sha256=iSIemzizxVokwC0Ze6SjSi-al_nrP2ViXF6JPoIVUWc,20162
|
| 391 |
+
pyarrow/include/arrow/util/bit_run_reader.h,sha256=1G9jN387hUCm0q9LvoSPEjY5v4fBOC8Aq_-riu-Sklw,17290
|
| 392 |
+
pyarrow/include/arrow/util/bit_util.h,sha256=gABDSW-EqgHu559EFfYvPkR7feICKR7YDbLx-Kh10uU,16397
|
| 393 |
+
pyarrow/include/arrow/util/bitmap.h,sha256=eGjGlh6s4Dubhfrk-Kp931YgR8KyaHNcxbTW1rqtqbI,17459
|
| 394 |
+
pyarrow/include/arrow/util/bitmap_builders.h,sha256=28rjB9AGwG-VMzuen9FARssdMul0RJx2ZmPFQL9SV1E,1596
|
| 395 |
+
pyarrow/include/arrow/util/bitmap_generate.h,sha256=m6ZsNwx1GhsEktQr63NxXHQkX2B7Nti011XYsPg2xfo,3661
|
| 396 |
+
pyarrow/include/arrow/util/bitmap_ops.h,sha256=fPPD_cvXebYLrAeQOCCYydU1AwF0faN5DwQKV8op-Es,10877
|
| 397 |
+
pyarrow/include/arrow/util/bitmap_reader.h,sha256=-EePBZDJyoF1GDQLHi5a9GK6rPQ-NRZS8iZZUSw6WmE,8392
|
| 398 |
+
pyarrow/include/arrow/util/bitmap_visit.h,sha256=myn8k66VrvZnL6R6VW6IDPTfO68VxjbJ8Up5IuSjFL4,3470
|
| 399 |
+
pyarrow/include/arrow/util/bitmap_writer.h,sha256=a4goXhLlY0qcfvYxbfbGD_HZ8Au1wFcbV1tVF3BPaXs,9383
|
| 400 |
+
pyarrow/include/arrow/util/byte_size.h,sha256=Pd2c_3a0IeSOUevhPIlXNkDmgoB06g4c9YCsuRwwSKM,3997
|
| 401 |
+
pyarrow/include/arrow/util/cancel.h,sha256=SgAy5S0TBISnCypp4R_OI-jPUQ997qtsLOSdXo8l5bM,3659
|
| 402 |
+
pyarrow/include/arrow/util/checked_cast.h,sha256=SR9Qg8NuLSBJw2w1UfgeGvCfT8k7wrbN7BzADQOZfAU,2076
|
| 403 |
+
pyarrow/include/arrow/util/compare.h,sha256=OLrSSyllkY4Sv00IK-37A2d68gr4OwnWJsxn1aF9xTU,1982
|
| 404 |
+
pyarrow/include/arrow/util/compression.h,sha256=fvlURoWJsgO8Hr6Xs_VNaqiOatmIGn9ktVUkYv7pIu4,8427
|
| 405 |
+
pyarrow/include/arrow/util/concurrent_map.h,sha256=wMi9WDHfRuJ_aSFgcJPpsVwGJ9vIJ5agaZ3rVUlwGe4,1775
|
| 406 |
+
pyarrow/include/arrow/util/config.h,sha256=ZE_Im-wQOptNBjJAZo7M7CBz844xm8xwJhi6pfm7yB0,2090
|
| 407 |
+
pyarrow/include/arrow/util/converter.h,sha256=PILfos6VlnLK6fOFMfLIUhiKl3o1dJo9T4HJXeR7V5E,14637
|
| 408 |
+
pyarrow/include/arrow/util/cpu_info.h,sha256=MqLdJabBZkzDjiScaQ7if9dmoAGvXT2QavGoGkho3lU,3964
|
| 409 |
+
pyarrow/include/arrow/util/crc32.h,sha256=4gN0M-SRnxaGKci2ATPbMWZG2TG3YULXjaTpadV0Udk,1337
|
| 410 |
+
pyarrow/include/arrow/util/debug.h,sha256=CPB_oDOuZ_u89e9wM8bGn88mGvClgfa7UDxDph6v9sY,971
|
| 411 |
+
pyarrow/include/arrow/util/decimal.h,sha256=cEQRH5x5kN_MAsWNOPCLjz57QjW4ErfppMHG4b-0EOA,20291
|
| 412 |
+
pyarrow/include/arrow/util/delimiting.h,sha256=JYe9YcWMeFT_ISuojx_VgVqOYLvZ2TiiR2sNn-WdeBQ,7317
|
| 413 |
+
pyarrow/include/arrow/util/endian.h,sha256=PPai9ig8DtGVouKksjTq7H_anm0BjgoTMaVTkWlMKWY,8236
|
| 414 |
+
pyarrow/include/arrow/util/float16.h,sha256=3RfWoQ0sIPCk2yXniIYw-g7X-EEmaos_IG9z8cnXCmQ,7454
|
| 415 |
+
pyarrow/include/arrow/util/formatting.h,sha256=3D0xE7sTcJR6XEUb12LKSqL-A3bX_Pyp1oVkPScjCwQ,22516
|
| 416 |
+
pyarrow/include/arrow/util/functional.h,sha256=4ljKXSWX3G_lBT2BfLXuG44pzZwVKeaojpLWCniqKyc,5612
|
| 417 |
+
pyarrow/include/arrow/util/future.h,sha256=tsSVDEH2dhXKyvIKl6R9BVBolpPdZXoRRf2-YRbtdxg,32296
|
| 418 |
+
pyarrow/include/arrow/util/hash_util.h,sha256=CjiNVPUJPxXvVJy7ys79aIb7YB6Bm-5nTJAR4DHsxcs,1918
|
| 419 |
+
pyarrow/include/arrow/util/hashing.h,sha256=2rIuTiAhMVsIt52fc9RR6vVM9NNfzeFJPsAPWCd6vX8,34224
|
| 420 |
+
pyarrow/include/arrow/util/int_util.h,sha256=zTOAq57M4pUe469WpnW6I5hNtxe3vGRHlZWhngA1DzM,4859
|
| 421 |
+
pyarrow/include/arrow/util/int_util_overflow.h,sha256=D6jgHvnNeVtYeczWiip_BExTVjnN683vRQ_YAF7OihU,7469
|
| 422 |
+
pyarrow/include/arrow/util/io_util.h,sha256=2s53VCM_Rd7j7IsXzDHK6-Hwqx5bp6BlKFUybn75ebM,13762
|
| 423 |
+
pyarrow/include/arrow/util/iterator.h,sha256=FymwfXvx9akIj1hAvLgrFQ01BWJbvAv4xx06TNDc9dc,18345
|
| 424 |
+
pyarrow/include/arrow/util/key_value_metadata.h,sha256=wjU6uQGcSmy-YFqMs6rwLP7E4X-0IFBjPrWZstistzQ,3590
|
| 425 |
+
pyarrow/include/arrow/util/launder.h,sha256=C3rNBRh4reuUp8YuRdGQU95WPc8vl4bAY-z5LXgDiuA,1046
|
| 426 |
+
pyarrow/include/arrow/util/list_util.h,sha256=_OmtsDqe-mnZ_7tVWxB2yHdgCJhpiME_RP3nXHzKbdI,2028
|
| 427 |
+
pyarrow/include/arrow/util/logger.h,sha256=p9i4dNgne36LWpFmNSYBYgTQ4kFSao20dJ40LgRRZKQ,6693
|
| 428 |
+
pyarrow/include/arrow/util/logging.h,sha256=63wlnOug1zSd1ur7caDp0F0z2IG7QjHbUFGChE8f-nA,9139
|
| 429 |
+
pyarrow/include/arrow/util/macros.h,sha256=a5_NbnOnb2z4MYLM3mXSRk0oMH-CfkrOa7lzNJKjNy0,9884
|
| 430 |
+
pyarrow/include/arrow/util/math_constants.h,sha256=2sfWoVc8syHz8X26XgBmejzXStl7hmvKiOh9622oUZA,1112
|
| 431 |
+
pyarrow/include/arrow/util/mutex.h,sha256=n4bsrHK2Q8zbYsQEyNaFqNu__vvqgwo1AfrLLCxfkpU,2554
|
| 432 |
+
pyarrow/include/arrow/util/parallel.h,sha256=_43wTVSrtJwOkRt3KJcJF1DyYHwhoWbWPsrAswftP-Q,3817
|
| 433 |
+
pyarrow/include/arrow/util/pcg_random.h,sha256=nbXowfCJFiy4GjVfF9I8VvB6fxkyR5zNB1FKdnFsYTQ,1252
|
| 434 |
+
pyarrow/include/arrow/util/prefetch.h,sha256=vaE4FPdscbtO0cPbzl8F1PzB1NDO18ytYlEmZCHDjHs,1251
|
| 435 |
+
pyarrow/include/arrow/util/queue.h,sha256=X9vRZQX3YL_a2Lzwe-zcNNHguR7FoGYmD-Q0THqsCBM,1017
|
| 436 |
+
pyarrow/include/arrow/util/range.h,sha256=WJ1v4BaQ4iMLuh-fgdGyWqY88rzR6Z9rqDQj5RC84XE,8725
|
| 437 |
+
pyarrow/include/arrow/util/ree_util.h,sha256=NO71naM7twCfCrX52vPmWoNhL90XP4PFEdc6AI9-OCs,22397
|
| 438 |
+
pyarrow/include/arrow/util/regex.h,sha256=Tj92CttOh2HxS0EKQ_9-sxMBAsQrDOUKNP0ngIJFdP8,1742
|
| 439 |
+
pyarrow/include/arrow/util/rows_to_batches.h,sha256=PZNoLeMCfJJdeHVvUny0UHc5AtS0hctUCi7zUztJpeE,7120
|
| 440 |
+
pyarrow/include/arrow/util/secure_string.h,sha256=0T9JxwkqXpGszGfcrstxJyRZztV9VRsFqVcGhDcEmhM,2476
|
| 441 |
+
pyarrow/include/arrow/util/simd.h,sha256=PpKm-aWpZYIYP0NnyGrQceOO9m3_7JbN4uro0IhIT9w,1679
|
| 442 |
+
pyarrow/include/arrow/util/small_vector.h,sha256=hXkuEMONoYd7vFS_6lLPwP49SVdBpAhSlvMK-1d3PrE,14439
|
| 443 |
+
pyarrow/include/arrow/util/span.h,sha256=FjFcz8VzZDSF-nR-dFbyd1wzL5XQpupI0db2-r0FyP4,4298
|
| 444 |
+
pyarrow/include/arrow/util/string.h,sha256=UStQlZ3Fkhmwm5IcKDsbUABENDRnjV1cU5dRXnEv8IQ,5296
|
| 445 |
+
pyarrow/include/arrow/util/string_util.h,sha256=0IUIcjSf2zMP8rVoVx5y1satijO7cr0PvOgG32d0lFA,2364
|
| 446 |
+
pyarrow/include/arrow/util/task_group.h,sha256=fI330NoJT8u84AEUA6pSxWrE7UBKn2LaM4DfPFoalqA,4362
|
| 447 |
+
pyarrow/include/arrow/util/test_common.h,sha256=OqhWyOEVmWbzhr2JfiaMn1flC84pU6kHL5vYZV1bhUM,2981
|
| 448 |
+
pyarrow/include/arrow/util/thread_pool.h,sha256=Q2KzKTxcikTEgdNAouFwjwsorFa3wE9IVkKqYd8o_Lw,25530
|
| 449 |
+
pyarrow/include/arrow/util/time.h,sha256=_s6yyeTNkNPiLjtaWceItyD8_yGTx2GMiXj1ICVlzyU,3439
|
| 450 |
+
pyarrow/include/arrow/util/tracing.h,sha256=sVfC_Rj2gwkWKVSKT0l0FOO5c2EGsfYwlkZX4d9ncxA,1286
|
| 451 |
+
pyarrow/include/arrow/util/type_fwd.h,sha256=JeZ1muIiVKxHcAXzBikMCmk_7SxFz_IqmzuT6yY1F-A,1803
|
| 452 |
+
pyarrow/include/arrow/util/type_traits.h,sha256=iRrIf4YhuMOGL5DJWIJoV2bUEhZRHWuce8TXm-JMkns,2155
|
| 453 |
+
pyarrow/include/arrow/util/ubsan.h,sha256=dJiINEVEdpLSr5-Z_a7BxoYGvA1-pCfHia_xiF0TfYo,3228
|
| 454 |
+
pyarrow/include/arrow/util/union_util.h,sha256=PSssBiw-v-PDen_q75c6OkNO5PwyIPhGbf9PMJj7P2M,1211
|
| 455 |
+
pyarrow/include/arrow/util/unreachable.h,sha256=O1TG4ozCYT3_xvDpJouKWrlFADIEpIemQ28y4DqIwu4,1070
|
| 456 |
+
pyarrow/include/arrow/util/uri.h,sha256=D24zebazFcrKGt7iGpkcGQ87DuF-2AbjPKVkDlq9Nuk,3886
|
| 457 |
+
pyarrow/include/arrow/util/utf8.h,sha256=flGZ786kHo33Xg_zw0zVA9GAT8jYdPUHTVhIPHGjOj8,2031
|
| 458 |
+
pyarrow/include/arrow/util/value_parsing.h,sha256=p_7p_fUUw3jfUkiVnKADdHb3KCdJ7Xg2JQnc39uQHMI,30654
|
| 459 |
+
pyarrow/include/arrow/util/vector.h,sha256=OKnWECz72otbpw6UZSzZIZHJXCXGb9IsPiFI-l3wODY,5609
|
| 460 |
+
pyarrow/include/arrow/util/visibility.h,sha256=zuHLTwNcR34LcCtbhj1YXzfNL8NxO-3XHY_UgUJgdZY,3238
|
| 461 |
+
pyarrow/include/arrow/util/windows_compatibility.h,sha256=Chme9fWRqYRzfIbLw7V_yeiIWd3F4dFeG6ImHHr4Xqw,1255
|
| 462 |
+
pyarrow/include/arrow/util/windows_fixup.h,sha256=hjoh6zvB8u8OVUQqLtdcrmohMzoAoLy6XJFLxcfFhK0,1435
|
| 463 |
+
pyarrow/include/arrow/vendored/ProducerConsumerQueue.h,sha256=Bz1ks3NDgXXLfT8TMUkE38RpMOSwKRRtwU1e37Y1CUw,6101
|
| 464 |
+
pyarrow/include/arrow/vendored/datetime.h,sha256=tsFbz8LKBFzRzTEOAKZyWRbdFLfnCnZRCK9Tyi1PANs,1103
|
| 465 |
+
pyarrow/include/arrow/vendored/datetime/date.h,sha256=fa_tmkMHwmx9vZHjH5lZVhZFCYEcHi5xmueW3F1tDE4,237808
|
| 466 |
+
pyarrow/include/arrow/vendored/datetime/ios.h,sha256=Qnu0iuy2-ein9KkVoSL1t71_W_VFZkdjDVsOnYTnP38,1641
|
| 467 |
+
pyarrow/include/arrow/vendored/datetime/tz.h,sha256=m5JJv7LE7Vukp8h50r90sCfbOSAD2bMVIVQUUxNZeDQ,85347
|
| 468 |
+
pyarrow/include/arrow/vendored/datetime/tz_private.h,sha256=pDkKXYdzfzQ5uh-jcUhURBLqHo00t0UnlimUdiM53Cs,10706
|
| 469 |
+
pyarrow/include/arrow/vendored/datetime/visibility.h,sha256=VCGKzhQOgL1zwGXKl_7lLULfSy0OsPt8FLWHwA4sOtU,1002
|
| 470 |
+
pyarrow/include/arrow/vendored/double-conversion/bignum-dtoa.h,sha256=imGhcg0RywMsFNMYTqp6rlXw2HZCIAla8SC_n92gCqE,4358
|
| 471 |
+
pyarrow/include/arrow/vendored/double-conversion/bignum.h,sha256=RnQ2CPL8Pt6fVCGh_8VDF11e_GyrrwO0IH0uMnTcsEs,5949
|
| 472 |
+
pyarrow/include/arrow/vendored/double-conversion/cached-powers.h,sha256=jjwfR3bue7mNlE5lbTrFR2KlgjRew2OkmjBa7oQO0Qg,3079
|
| 473 |
+
pyarrow/include/arrow/vendored/double-conversion/diy-fp.h,sha256=J-RgqH27jspT5Ubth9pTA9NAZH6e7n1OVhxModgi8Sc,5088
|
| 474 |
+
pyarrow/include/arrow/vendored/double-conversion/double-conversion.h,sha256=J1Tl5-8aFY0A9SnaA9z5Q90jnMxw55illPIuE-jdD5Q,1804
|
| 475 |
+
pyarrow/include/arrow/vendored/double-conversion/double-to-string.h,sha256=C-tKRi0IuLycXgS6CC1oiFkCroOo_-AO0VOjmfe0tlE,23925
|
| 476 |
+
pyarrow/include/arrow/vendored/double-conversion/fast-dtoa.h,sha256=ZAho25fqeP3t2RM0XgqfhTBXQIIicACLpdyHHMRX3JU,4122
|
| 477 |
+
pyarrow/include/arrow/vendored/double-conversion/fixed-dtoa.h,sha256=HLnpxkHjKldm-FBiDRbADYljJBSYbQGP4Gz-sVbiSJU,2828
|
| 478 |
+
pyarrow/include/arrow/vendored/double-conversion/ieee.h,sha256=CVKA9RXSjv4ZygqDHMiF-H2hUh3QHQvp1GZYC3MAhkE,15281
|
| 479 |
+
pyarrow/include/arrow/vendored/double-conversion/string-to-double.h,sha256=Ul6b-2R0pjUaAWNM3Ki4kH933LqrW6_XfPz4BSiE2v8,10906
|
| 480 |
+
pyarrow/include/arrow/vendored/double-conversion/strtod.h,sha256=6xCRm47vmcghYJug5mhhTVbsZ3m3Y6tQfMehEyVZNx0,3096
|
| 481 |
+
pyarrow/include/arrow/vendored/double-conversion/utils.h,sha256=wFRb5cGABiNoUSCnvKmdv_KIMcBtX1PX89tPFfvgbQI,15614
|
| 482 |
+
pyarrow/include/arrow/vendored/pcg/pcg_extras.hpp,sha256=FEYzq8NFxPfdJyLs4kVtTBLkaD6iO71INz9EJnaxTdc,19784
|
| 483 |
+
pyarrow/include/arrow/vendored/pcg/pcg_random.hpp,sha256=7TaV3nZhcwpf6XxlZ6cod1GaW5gm-iUn67t2fiMPNbA,73501
|
| 484 |
+
pyarrow/include/arrow/vendored/pcg/pcg_uint128.hpp,sha256=DyavmKgq9ob13z--Lee8WKfiMBk1cvKhkZlDxQyQNOA,28750
|
| 485 |
+
pyarrow/include/arrow/vendored/portable-snippets/debug-trap.h,sha256=9KphJ9gRtDT9DXR9iZ7aS23xa2T8tLmLsFEJMg0pLDQ,3081
|
| 486 |
+
pyarrow/include/arrow/vendored/safeint/safe_math.h,sha256=HgcHut9A9VZGoZe6A-669uv1N8ydMJE9a3bJzZiOwFA,78099
|
| 487 |
+
pyarrow/include/arrow/vendored/safeint/safe_math_impl.h,sha256=wzI4AvijLrtEg9aTtqoY1SQNOZ1XxsP5GyuN3juC6K4,61119
|
| 488 |
+
pyarrow/include/arrow/vendored/strptime.h,sha256=q1IZi5CvyUp_PNzbQ4_XLroAV24VEovBEz2TkpwUJ9c,1212
|
| 489 |
+
pyarrow/include/arrow/vendored/xxhash.h,sha256=MUwtyzu7xjkx9mBcS65SaDcCK7tgeqQgj-KYEMxcHWc,844
|
| 490 |
+
pyarrow/include/arrow/vendored/xxhash/xxhash.h,sha256=PDFiHmNL4ul4A0wiSLDpY9JSrDS73RMulr1W9aNEW8s,279426
|
| 491 |
+
pyarrow/include/arrow/visit_array_inline.h,sha256=XuQjuME8XZeJp7W86YuCsuoVVgmG1NulXAA0KJkmmB0,2446
|
| 492 |
+
pyarrow/include/arrow/visit_data_inline.h,sha256=4MkdFVsrjhMyTDNrScQtOYV_nwzqR2ddSS2yYnbyLt0,12460
|
| 493 |
+
pyarrow/include/arrow/visit_scalar_inline.h,sha256=KvNY0j8nE9gs_805LXMV3ATgvxvUqW4UeKpXUxR3rMA,2419
|
| 494 |
+
pyarrow/include/arrow/visit_type_inline.h,sha256=O0BURx2TowqdO61W9DJEr5cKP5BsVkUt8Bpc8VuiXec,4387
|
| 495 |
+
pyarrow/include/arrow/visitor.h,sha256=NKos98j54uY9tdXzctI_n_nwFRrXNOwanxLDqDZONw4,8690
|
| 496 |
+
pyarrow/include/arrow/visitor_generate.h,sha256=n2YKZW-5hY7ICQSwEUBZIYh2eg9ZoTfD54XRd9OlNDo,3324
|
| 497 |
+
pyarrow/include/parquet/api/io.h,sha256=Ricq0d2R4QXHiGZCbjxZ_0F_QmKq0IrfTidNu5NoXPI,847
|
| 498 |
+
pyarrow/include/parquet/api/reader.h,sha256=vnM5XDPn1TVsDJk4SDgb3ZU2Ta4vdrRzCpDWO90rYHk,1204
|
| 499 |
+
pyarrow/include/parquet/api/schema.h,sha256=KsNJ529pEh7bGUa0rLUCcfanI9rW2uSTirgpvKq0hdc,855
|
| 500 |
+
pyarrow/include/parquet/api/writer.h,sha256=UJZbY8QGVRMtAmozzjoM9TnI4gssqlNFUKCXBw2IfuI,1007
|
| 501 |
+
pyarrow/include/parquet/arrow/reader.h,sha256=oZXb2Oof-MH37vKuq58SucwtWnBlZ57M5PsrgUnURBw,16361
|
| 502 |
+
pyarrow/include/parquet/arrow/schema.h,sha256=Mi56ul7itNS6NDbMpKOJCufjHVqaSY5_rbsNRNLE560,6204
|
| 503 |
+
pyarrow/include/parquet/arrow/test_util.h,sha256=qCUHfC-7P2D32n2__AV35MbzKoL5KEgNHJQaiElFx6M,18849
|
| 504 |
+
pyarrow/include/parquet/arrow/writer.h,sha256=0edx0fgyze6uxTgpDyacSljKMUay86pRqvIRQ7AZpXk,7005
|
| 505 |
+
pyarrow/include/parquet/benchmark_util.h,sha256=emDpaIbtfUNlK0M2zMP-oTy2S2raQ-LpQULK_G74OtM,1758
|
| 506 |
+
pyarrow/include/parquet/bloom_filter.h,sha256=TC3OxK0J2v6tHxT_Bbw7mlYtM0603KXgBoHRvmzM9aA,14999
|
| 507 |
+
pyarrow/include/parquet/bloom_filter_reader.h,sha256=63kpHYKs5TPrbRamkBLZsDYbD-I9UeVhF-R8d7JHeLg,2892
|
| 508 |
+
pyarrow/include/parquet/column_page.h,sha256=7w2hQDqkIhqpHLRh2LHk0ujnuknSPHVtuvJ21LS--n0,6942
|
| 509 |
+
pyarrow/include/parquet/column_reader.h,sha256=HQPo-owohtevjPItqajvEDWj8OR1u6oW6i9xvjP9Yiw,19255
|
| 510 |
+
pyarrow/include/parquet/column_scanner.h,sha256=HecBvh-z0n_1HJsD-GIdcGHQAvDOHKlLzppB9RBsD9s,8863
|
| 511 |
+
pyarrow/include/parquet/column_writer.h,sha256=lDOsSuqIxI8e8hTdAvZfBm-b0D6uMfpC1L5HLykE3bo,12452
|
| 512 |
+
pyarrow/include/parquet/encoding.h,sha256=SDGAMKCvNwOz92WiadNmhVO2bPG-IVUJJ4vb_pShtpo,16872
|
| 513 |
+
pyarrow/include/parquet/encryption/crypto_factory.h,sha256=NutbypTw9971ju95UkWtW-g8TYnR94TWZAnx5-dznPA,7064
|
| 514 |
+
pyarrow/include/parquet/encryption/encryption.h,sha256=pXcGO8WhWVzaS8hDrphLS_M2sHX0mtGMCs4G9d3ZA1c,16552
|
| 515 |
+
pyarrow/include/parquet/encryption/file_key_material_store.h,sha256=YzAVO3M2H5v5Fz2b_WlmB3GE5wVbMEnFTL3S9XPH6k0,2200
|
| 516 |
+
pyarrow/include/parquet/encryption/file_key_unwrapper.h,sha256=VBuBwYeLqYHq_WGnjL2tfwB6mH3jjFVb-TpPKa6lb50,4717
|
| 517 |
+
pyarrow/include/parquet/encryption/file_key_wrapper.h,sha256=xXlS-yyYhUW20S31REsSj5JxbVbij_td0WlPbgxNaYg,3778
|
| 518 |
+
pyarrow/include/parquet/encryption/file_system_key_material_store.h,sha256=xAccp-7Il2UrnItxLmOE4ywhQKgeapyxVNwshDpan0Y,3695
|
| 519 |
+
pyarrow/include/parquet/encryption/key_encryption_key.h,sha256=6dJNBYA_4Z_dyMph71Q5KI0axe-yzdjTnRgG_zj2OX0,2318
|
| 520 |
+
pyarrow/include/parquet/encryption/key_material.h,sha256=kPTSIuRFYOnH4BCPIB33zG9hp5D2Ba-5kZVlq3rFnRI,6221
|
| 521 |
+
pyarrow/include/parquet/encryption/key_metadata.h,sha256=Pc0nA9LW3Fc9NLMMxz7osbw8si2jSiOVTES-J-9R0y0,4003
|
| 522 |
+
pyarrow/include/parquet/encryption/key_toolkit.h,sha256=xLHCsTK6bcrXd_MQv7GDTrLoZNeE_-WFb192LdYpcH0,4645
|
| 523 |
+
pyarrow/include/parquet/encryption/kms_client.h,sha256=MM870qRC_yc4hkzx7xVPaPm12ErR8sqFgDTHLWHcRX0,3222
|
| 524 |
+
pyarrow/include/parquet/encryption/kms_client_factory.h,sha256=VZ97CMgDQxx5oZWFGprjXsaM1hZ0wNudPmFU1_lniAc,1293
|
| 525 |
+
pyarrow/include/parquet/encryption/local_wrap_kms_client.h,sha256=dW5Fe3lUHP8dmsSPDGMbldGl2GlnER4I9zWhCU6g_78,4037
|
| 526 |
+
pyarrow/include/parquet/encryption/test_encryption_util.h,sha256=rYdlDq1nmZu3gsc7vPcBDVOwdxESyVcnVTDCNMPdmoA,5349
|
| 527 |
+
pyarrow/include/parquet/encryption/test_in_memory_kms.h,sha256=c6GA-eObXQtCtzehYKr4uGMpjtLRUW0C5VIQQk8EynM,3743
|
| 528 |
+
pyarrow/include/parquet/encryption/two_level_cache_with_expiration.h,sha256=2kNvixV36bYjUlUJquqnaaOO-NI7e8O3Vm1x-xDPyDA,4818
|
| 529 |
+
pyarrow/include/parquet/encryption/type_fwd.h,sha256=dL8snyUwNjhTQE2FQ2dXAUjTboEXhH2JOehQovHfixc,955
|
| 530 |
+
pyarrow/include/parquet/exception.h,sha256=TJbx6X_khxV6e61rUfHY0Pr65EoxKTu2xpvOAdh9BMo,6104
|
| 531 |
+
pyarrow/include/parquet/file_reader.h,sha256=Z1RiOP74Y9tMv7kZ7FWX05IR05qzgSOTRKrY71pLOJE,11185
|
| 532 |
+
pyarrow/include/parquet/file_writer.h,sha256=6fK6Mn-MdiQ-J4oo8BTi_eVVVshlffoQiJzFaLRrqco,9343
|
| 533 |
+
pyarrow/include/parquet/geospatial/statistics.h,sha256=77ieKxQcY46FB7jgCZhk03fa2G_J2S9NJ8R0_JU-qGs,8892
|
| 534 |
+
pyarrow/include/parquet/hasher.h,sha256=z_U9ojA6y_f4AQtYP6DhuUWp-MX3uywCHd4aWDXAqyE,5242
|
| 535 |
+
pyarrow/include/parquet/level_comparison.h,sha256=5z4fUJJPWq9W60l2CsAI7T7E2auGYD7m0fpR5rfLmsw,1306
|
| 536 |
+
pyarrow/include/parquet/level_comparison_inc.h,sha256=r20_6Rv5L7UmFGJ68f-JaZ5hLXb87wvZa80hZNQoF-I,2494
|
| 537 |
+
pyarrow/include/parquet/level_conversion.h,sha256=OsuqK1xiUnEnOLPKwfm9X-pXTaXRMlDIkj3lwGb2ggI,9432
|
| 538 |
+
pyarrow/include/parquet/level_conversion_inc.h,sha256=Q_ZZ-Ody9s8rSZlBzIwNcgcPikXtnAcv475gCgqRk5o,14248
|
| 539 |
+
pyarrow/include/parquet/metadata.h,sha256=-4WKrWLuxUQR_lcvqmD5k2v3C1tdGBnoJ20Y89XT_ms,20927
|
| 540 |
+
pyarrow/include/parquet/page_index.h,sha256=AqvLT6M81jY13YbpX-s-hOzCVz0AGNkZJ9om3_tp4Vk,17307
|
| 541 |
+
pyarrow/include/parquet/parquet_version.h,sha256=jYdc-Ubl_Z59OjOfGrnyzHFKYLhdoNSHn516vZGyvJg,1164
|
| 542 |
+
pyarrow/include/parquet/platform.h,sha256=DUf6vCMAV4eS-dOZzHDE7G_EAGIwDaQ-J3X3bpY8rgk,3939
|
| 543 |
+
pyarrow/include/parquet/printer.h,sha256=hXqzwuj5p1oKY2awZkVOq7qXx-Rsoo6QPH1oTE94AHU,1548
|
| 544 |
+
pyarrow/include/parquet/properties.h,sha256=YNL9gevyuQMsCjo3znl5xyleCDsI-KnFA8_G6JWn_n8,57689
|
| 545 |
+
pyarrow/include/parquet/schema.h,sha256=CjZh2i9WN5VeoDbLqy7M1AZtopZ43_C9blWG3OT2IfU,18222
|
| 546 |
+
pyarrow/include/parquet/size_statistics.h,sha256=Ahr8qyIVre8U_JVRLHL0BbSoYpdJjo2OUeE1UD4I1tw,4327
|
| 547 |
+
pyarrow/include/parquet/statistics.h,sha256=3LFLy_k0KuIjsYBZWFJJShrkHIEm8Zk_QRDfRKj_9XA,18005
|
| 548 |
+
pyarrow/include/parquet/stream_reader.h,sha256=1WmN0vYCqTz1Lwb_Di4xPWTE-VbCQQuzZralSpWQm3U,8791
|
| 549 |
+
pyarrow/include/parquet/stream_writer.h,sha256=NIC3WYnGNPZxJm3k8Bms5A5wtg8OXj1li9JPbdPSGxA,7831
|
| 550 |
+
pyarrow/include/parquet/test_util.h,sha256=VHF8cjNduIW8P6Kw2sLUJmvbL7tmTG_kWIWOaC7G5OA,33538
|
| 551 |
+
pyarrow/include/parquet/type_fwd.h,sha256=xmvMW2wSIFvoEZBwVql7hzcPBzOHZnmTlEtIjwp_pzM,3065
|
| 552 |
+
pyarrow/include/parquet/types.h,sha256=mOx1d2y3BhZv5CXdAtylBFBvkMflOdJG_uWNamBFJKQ,27304
|
| 553 |
+
pyarrow/include/parquet/windows_compatibility.h,sha256=xIEGHW354URgdIP9A4V303TJL8A1IkCEvp08bMKsHTU,897
|
| 554 |
+
pyarrow/include/parquet/windows_fixup.h,sha256=DpyWCywx8YIqouun6BJcgMrHFMTCBgowWdJ1mnJnQ2s,1052
|
| 555 |
+
pyarrow/include/parquet/xxhasher.h,sha256=QAa7ZE7S3UFtU_Voz3oi3YclIYhbhviJkafLOYgiuWg,2074
|
| 556 |
+
pyarrow/includes/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 557 |
+
pyarrow/includes/common.pxd,sha256=me4htiESPFmZok1M8eDXk9OS-7p9Om_1pazNowvttuc,4950
|
| 558 |
+
pyarrow/includes/libarrow.pxd,sha256=fP5_tqqVqGtS1my5j9-UxTv3NHNI4oBDPjbBcikTu2A,121041
|
| 559 |
+
pyarrow/includes/libarrow_acero.pxd,sha256=c84RdYfIuFWW_36-1RELJsowfQwXhgUxbdC_xKQyFCI,5298
|
| 560 |
+
pyarrow/includes/libarrow_cuda.pxd,sha256=0fRcHbCZY_gFdwIXIElnpGvTxeA5xVxZH1-vwZh16SM,4942
|
| 561 |
+
pyarrow/includes/libarrow_dataset.pxd,sha256=cqV1LQvfsKtRwePFaWUh8dCFlb6JED8tLGCsrtS_Ml8,17270
|
| 562 |
+
pyarrow/includes/libarrow_dataset_parquet.pxd,sha256=PW8g6CD2yjwgwoJgYQ9Ntg2e2v6Vfu4AYL5kiM4sq0Q,4584
|
| 563 |
+
pyarrow/includes/libarrow_feather.pxd,sha256=MTJUDQbfKP8Ir700Fobl7xcbjX7WcrsUV4mxFXlfwn0,2140
|
| 564 |
+
pyarrow/includes/libarrow_flight.pxd,sha256=QO7RJ5TUVA65gtkJLenjIOEW2eIbPuKLw-nGWD9oHRY,24724
|
| 565 |
+
pyarrow/includes/libarrow_fs.pxd,sha256=PHdXeBI1oD-fLV_POryp-kcyt5084X0DdP3N0aLRmNQ,15379
|
| 566 |
+
pyarrow/includes/libarrow_python.pxd,sha256=6RxtLurxWwDzN-GtJ7Mo0qXoNnP3mOU8DcavIdumXM4,11647
|
| 567 |
+
pyarrow/includes/libarrow_substrait.pxd,sha256=PtgwVFqsCQBzCHzK-VqhQOdTyU9J4SziQ_lnxRwChfs,4061
|
| 568 |
+
pyarrow/includes/libgandiva.pxd,sha256=o28v4Q43dYXQEcwldKO6RYs0tke2U6GZVxQmjq4rAt4,11530
|
| 569 |
+
pyarrow/includes/libparquet.pxd,sha256=dDV_i74prFbqBrYQ8bn2Jfp1CCChHznNAckD81VJZkw,26321
|
| 570 |
+
pyarrow/includes/libparquet_encryption.pxd,sha256=oyvw0ZLyLWrHwMiOt6mbWYyTKb3rN9kmjOMMW1P2EsM,8690
|
| 571 |
+
pyarrow/interchange/__init__.py,sha256=DH0bwbKpdjD1WCW1VinnXEuVLY098uHKkirv7DFc9JM,845
|
| 572 |
+
pyarrow/interchange/__pycache__/__init__.cpython-310.pyc,,
|
| 573 |
+
pyarrow/interchange/__pycache__/buffer.cpython-310.pyc,,
|
| 574 |
+
pyarrow/interchange/__pycache__/column.cpython-310.pyc,,
|
| 575 |
+
pyarrow/interchange/__pycache__/dataframe.cpython-310.pyc,,
|
| 576 |
+
pyarrow/interchange/__pycache__/from_dataframe.cpython-310.pyc,,
|
| 577 |
+
pyarrow/interchange/buffer.py,sha256=NF_GU1uQ6INqHqCwzY6XQQqRxKDh6znEeDHiRqaEIQ0,3359
|
| 578 |
+
pyarrow/interchange/column.py,sha256=n9f3mlViqUFOa3Kofdwoo52qC-WYVpyF2YilRsl4uaw,19350
|
| 579 |
+
pyarrow/interchange/dataframe.py,sha256=tmSMmBvBAc-ZSUzE8tBNbvQLHuuxLuBkMkK6KYwtS8M,8405
|
| 580 |
+
pyarrow/interchange/from_dataframe.py,sha256=JfkP4wuY_9x76H6RDtmsOzs6B6qe-1WS7zxpKeD481s,19709
|
| 581 |
+
pyarrow/io.pxi,sha256=gDtFPrwdBrxT88jpNwddg9mM-KSt_XFv333W2IbF3I4,86228
|
| 582 |
+
pyarrow/ipc.pxi,sha256=NTZxt0qAu-HIjDbbczp91sKUJoJQBz48z-IxcKn9b6w,44752
|
| 583 |
+
pyarrow/ipc.py,sha256=ssicn1x2jRZt2m1nQZ4sB70sa1FB3d8PoqiOnWO-tzg,9603
|
| 584 |
+
pyarrow/json.py,sha256=JMEXB5jNZp-DOYmGBrzs2RtwOCLdKCRa3E5kUfH0Ceg,869
|
| 585 |
+
pyarrow/jvm.py,sha256=_cyen6Bi-cBUlg-OAb_RTG6nj2W57kMrR1HuAWVcEQs,9577
|
| 586 |
+
pyarrow/lib.cpython-310-x86_64-linux-gnu.so,sha256=59XLWu9ikm0WxzQEZjEeRjfo0E6fUvySqYRdXSenLCc,4283368
|
| 587 |
+
pyarrow/lib.h,sha256=NSqX1jl5ZWssVm0SmNFHp4PckJYy8YCJxlL02MKa4Uc,4562
|
| 588 |
+
pyarrow/lib.pxd,sha256=HHKBlMGhU4NkQKqPcTCkYPojbExu2jSt8C4YTeCWdck,17838
|
| 589 |
+
pyarrow/lib.pyx,sha256=cssmzMbq2cOOgMLKQUSkLwvXRmS46ED6U-8d4B91bUo,6174
|
| 590 |
+
pyarrow/lib_api.h,sha256=rm6EBrvNbQHNzt_TJGbbdIo5T_1IC2WBAXIQnpMzsNA,20132
|
| 591 |
+
pyarrow/libarrow.so.2300,sha256=7vTlflQNVtOVKsz8kvxRiiQU-XXBAqWQBvtndcOJWZk,52322984
|
| 592 |
+
pyarrow/libarrow_acero.so.2300,sha256=bpsqCjL8Fp1diKCNfJH5FvZzVff9Ks_jlv9FEzic4T4,1899056
|
| 593 |
+
pyarrow/libarrow_compute.so.2300,sha256=K0xSJnlFmhYopvdcPEojr1iSJutmPhzCAh6f6sr2vEQ,18887496
|
| 594 |
+
pyarrow/libarrow_dataset.so.2300,sha256=KRgRLNGSuhCKjqdqPdIYOw0vozKKIqDHC5rqBbjzlnU,2331344
|
| 595 |
+
pyarrow/libarrow_flight.so.2300,sha256=SejsvYsT4cuOAzX7_dF715ClfMSrbbDhpaKaw__g5cY,26444520
|
| 596 |
+
pyarrow/libarrow_python.so,sha256=IUO7OhzaWJk7G0ptfwsdECSFUlfv723dv2h_F1EEKm0,2342392
|
| 597 |
+
pyarrow/libarrow_python.so.2300,sha256=IUO7OhzaWJk7G0ptfwsdECSFUlfv723dv2h_F1EEKm0,2342392
|
| 598 |
+
pyarrow/libarrow_python.so.2300.0.0,sha256=IUO7OhzaWJk7G0ptfwsdECSFUlfv723dv2h_F1EEKm0,2342392
|
| 599 |
+
pyarrow/libarrow_python_flight.so,sha256=B52L6RjU5pvT7_o2AmoeV2Tr1uPJmhl-A6vGO6YJy8I,104024
|
| 600 |
+
pyarrow/libarrow_python_flight.so.2300,sha256=B52L6RjU5pvT7_o2AmoeV2Tr1uPJmhl-A6vGO6YJy8I,104024
|
| 601 |
+
pyarrow/libarrow_python_flight.so.2300.0.0,sha256=B52L6RjU5pvT7_o2AmoeV2Tr1uPJmhl-A6vGO6YJy8I,104024
|
| 602 |
+
pyarrow/libarrow_python_parquet_encryption.so,sha256=e3JVUNOPI0fCLFXewNtovNzMTMXXZAnAy9vSgb9x7H4,38448
|
| 603 |
+
pyarrow/libarrow_python_parquet_encryption.so.2300,sha256=e3JVUNOPI0fCLFXewNtovNzMTMXXZAnAy9vSgb9x7H4,38448
|
| 604 |
+
pyarrow/libarrow_python_parquet_encryption.so.2300.0.0,sha256=e3JVUNOPI0fCLFXewNtovNzMTMXXZAnAy9vSgb9x7H4,38448
|
| 605 |
+
pyarrow/libarrow_substrait.so.2300,sha256=RBpdd1C8B9s5t7wDcr8_OOe34qEcW45r0-g1NO5aXuo,5761616
|
| 606 |
+
pyarrow/libparquet.so.2300,sha256=ASif1MeNdeEAW0dzgSRxfgvN8pnWVioqtEeTEpRn4Js,12415840
|
| 607 |
+
pyarrow/memory.pxi,sha256=cZSlJ8Brteb9aWa7VzvCrpnw26wRkplF9KtF2nqtH8M,8806
|
| 608 |
+
pyarrow/orc.py,sha256=yDp3vD4gOdOsOBmXKFe24Kq3xO3FDBfIOHvsvzQUkKY,12602
|
| 609 |
+
pyarrow/pandas-shim.pxi,sha256=RM38cacj1TlQ5IN79CprIr4AUbbY5GiWdiLsnx0zn3g,8817
|
| 610 |
+
pyarrow/pandas_compat.py,sha256=y1dLv-lrnpJleFwWnSO5_rBM-Uwky6ZgtKUMYTPhbN8,45916
|
| 611 |
+
pyarrow/parquet/__init__.py,sha256=4W64CbvwvO60tG58nfNtyCwMVCfuPumtu82p-kiGPaE,822
|
| 612 |
+
pyarrow/parquet/__pycache__/__init__.cpython-310.pyc,,
|
| 613 |
+
pyarrow/parquet/__pycache__/core.cpython-310.pyc,,
|
| 614 |
+
pyarrow/parquet/__pycache__/encryption.cpython-310.pyc,,
|
| 615 |
+
pyarrow/parquet/core.py,sha256=0-Te7kjeh7zKT3jd4VBK2IMOycQ3uHwjzqgqRFY6aro,95541
|
| 616 |
+
pyarrow/parquet/encryption.py,sha256=-XW7Qcbl-jQhpZsR610uQ8-z9ZVE_NL045Jdnp1TZ9M,1153
|
| 617 |
+
pyarrow/public-api.pxi,sha256=G6tk0gOWMBoQaQGo4lyp0OLSkqEZqMhB0z27MoQR3rU,14064
|
| 618 |
+
pyarrow/scalar.pxi,sha256=2-ttwuILFVqcf8gcMBWbEkwA-3vdnxGN-8ah6YDvrlA,52384
|
| 619 |
+
pyarrow/src/arrow/python/CMakeLists.txt,sha256=D4Ypror_508aAd_juYkrS9Qu2maeirK4QXzwGEZEj0M,855
|
| 620 |
+
pyarrow/src/arrow/python/api.h,sha256=2XyYOFAmorPGXrTVYZkiKL67nuH8w1ha6D1reU7K-Vs,1179
|
| 621 |
+
pyarrow/src/arrow/python/arrow_to_pandas.cc,sha256=0lQ5wG_eqXa76QfuHdCr7Uex1yDM7nneD5G62ykDCzg,96642
|
| 622 |
+
pyarrow/src/arrow/python/arrow_to_pandas.h,sha256=jQiSTN8IL95onwaclaWqCR5Nb2RHrBtubRyEOJR9eRE,6215
|
| 623 |
+
pyarrow/src/arrow/python/arrow_to_python_internal.h,sha256=nQXPZTL3xa4Sm-a-Gv-8bpFs-qAOZHkqWmA_m-dSLVw,1740
|
| 624 |
+
pyarrow/src/arrow/python/async.h,sha256=C0f8YYmgwBGgDau4xEFsdjukiZB4YvpylETHEZryHOo,2352
|
| 625 |
+
pyarrow/src/arrow/python/benchmark.cc,sha256=z6qYRx4qMuNXPaC8fuPJlQd92aosMN85u1aD50R1-UU,1293
|
| 626 |
+
pyarrow/src/arrow/python/benchmark.h,sha256=f-kzyMOlPKDse2bcLWhyMrDEMZrG_JHAPpDJgGW0bXU,1192
|
| 627 |
+
pyarrow/src/arrow/python/common.cc,sha256=HExYdSkfggXu96XWNXBvK1XukCfPotLVFtk8D9FVaOw,7603
|
| 628 |
+
pyarrow/src/arrow/python/common.h,sha256=9IQC__JUqTRXv5MfAqKM6ivMwuQ-uMZKEguGDEODkiA,14389
|
| 629 |
+
pyarrow/src/arrow/python/config.cc,sha256=yRQYqXioit9N4uAVyLrBbb70Bto79wh6ZAwvyeX9HBs,1097
|
| 630 |
+
pyarrow/src/arrow/python/config.h,sha256=SQa6SuM3oAfQ7wEbwVJqlPfqslqlq2DXK_FK6-K08Kg,1150
|
| 631 |
+
pyarrow/src/arrow/python/config_internal.h.cmake,sha256=kU0GNa9lLgI7_eJseYzfo-C9s8762Tb1sep47Oux3hk,855
|
| 632 |
+
pyarrow/src/arrow/python/csv.cc,sha256=ql5AY76AqiFksWsrmzSl551k5s9vS8YcmypM2A9rhw8,1803
|
| 633 |
+
pyarrow/src/arrow/python/csv.h,sha256=QxU3B-Hv_RsoEcMGS9-1434ugouL2ygC64Lq6FgviNM,1397
|
| 634 |
+
pyarrow/src/arrow/python/datetime.cc,sha256=WQoJT6a1ocd3SItRC_q8EA5-4Z9sWNdGFxXen3m0xeU,23013
|
| 635 |
+
pyarrow/src/arrow/python/datetime.h,sha256=Bny_THGi2tyUeHxcOuw01O7hNE8B_gave5ABAZQtwTQ,7931
|
| 636 |
+
pyarrow/src/arrow/python/decimal.cc,sha256=4CNaLDOWZelTllSIPdIKDlIhUy6AgKJxKG0WmzJyq94,9699
|
| 637 |
+
pyarrow/src/arrow/python/decimal.h,sha256=K9ScmzSa7XCuuwpXKnq0GPbRDTuRU5yXfWr9zGtOchc,6362
|
| 638 |
+
pyarrow/src/arrow/python/extension_type.cc,sha256=SOhG7u7MNnJkSe-dWi5-ZsGuzQC-M7PihaYFAr6x6hA,7033
|
| 639 |
+
pyarrow/src/arrow/python/extension_type.h,sha256=0gzb42y_mbw4fsYs3u8cwPFLBRlG-kkHQLgbvGtrY0U,3181
|
| 640 |
+
pyarrow/src/arrow/python/filesystem.cc,sha256=0twavI91TE20Otq5kkVUwnN5sindU_mBWoVAvz1ZMgI,6152
|
| 641 |
+
pyarrow/src/arrow/python/filesystem.h,sha256=FG0AcLekqaDf9IQPqKixAfIcY_ZLgIKP5NvvXdtBVUM,5126
|
| 642 |
+
pyarrow/src/arrow/python/flight.cc,sha256=tL3nFVTjDlmiuqDOSxf7HODdpqIMUSbSsNc1vaveP1w,14192
|
| 643 |
+
pyarrow/src/arrow/python/flight.h,sha256=t4ZD8gWaubbO_mBDv0XZ58TCo1VQl0hzHn1_7w4U64I,14450
|
| 644 |
+
pyarrow/src/arrow/python/gdb.cc,sha256=hkATQV6YlpxkBaLfY9_C24XJ6qYSg2T0DfQX4XfpvFY,22556
|
| 645 |
+
pyarrow/src/arrow/python/gdb.h,sha256=H-qvM-nU8a_3Z5tk8PvppTwQtBMSZhQKQIVgRAsRfFg,972
|
| 646 |
+
pyarrow/src/arrow/python/helpers.cc,sha256=MqeJ1PD1g97tKL9suvE1LWD2cO-MWMwo8-ag3FXAauY,16934
|
| 647 |
+
pyarrow/src/arrow/python/helpers.h,sha256=Q3TmwyffFpVYQEp55ZoWTDDhnte7zQKiXylsfbEMCuI,5479
|
| 648 |
+
pyarrow/src/arrow/python/inference.cc,sha256=Wz_zlalsCa4_BWntagf6l7QLb_nONJZKl5TQa4YVMWE,26293
|
| 649 |
+
pyarrow/src/arrow/python/inference.h,sha256=FUFvB4Zy7V-tueXdmbDcqTeLK4xj5GZEeRW5yhiJlsU,2038
|
| 650 |
+
pyarrow/src/arrow/python/io.cc,sha256=k2pgFsCFXaI7naqXcxDtZJJp7K06NnEhsDEoMQvbaxc,11948
|
| 651 |
+
pyarrow/src/arrow/python/io.h,sha256=4jGnodpSUlnVqAVh9fWId7H4WldlLPkXyroABpdaW6w,3858
|
| 652 |
+
pyarrow/src/arrow/python/ipc.cc,sha256=3D9iMbOFHlhNXX4432wsfbfjWvDryZWgdA0Ak19V_8Q,4472
|
| 653 |
+
pyarrow/src/arrow/python/ipc.h,sha256=SZbw6jCCqLiLNCY3k632GmwHeD_r_xrDS0dhqV49VhY,2259
|
| 654 |
+
pyarrow/src/arrow/python/iterators.h,sha256=Ugfm3JvetAH0l-oAjjpZfhrUBqRimVMaw4-xusvqLSg,7327
|
| 655 |
+
pyarrow/src/arrow/python/numpy_convert.cc,sha256=166BIW7zVTRMKogxLUuhV4e5jOevmonvRtXDydNujgc,21194
|
| 656 |
+
pyarrow/src/arrow/python/numpy_convert.h,sha256=y13eHwfe1lJKzadoTr2-GyX6xPsE6Z7FN31s7PN-2Rk,4870
|
| 657 |
+
pyarrow/src/arrow/python/numpy_init.cc,sha256=cJKOH946T7VCcB-gVIoGgfbWTrbj3FPkI4TgnsLTf7s,1178
|
| 658 |
+
pyarrow/src/arrow/python/numpy_init.h,sha256=FniVHP7W2YBlenoMYhQrODvoqqvDMSls2JANGtNPQts,999
|
| 659 |
+
pyarrow/src/arrow/python/numpy_internal.h,sha256=1R_tNINnHYMGNTA5k_BMbGWFlA297f3Yj4ufrhm-yiE,5320
|
| 660 |
+
pyarrow/src/arrow/python/numpy_interop.h,sha256=rI6ek8JTOYtjo7gEADSDBS6QuAOHa2A0YQPZ2GeypFw,3418
|
| 661 |
+
pyarrow/src/arrow/python/numpy_to_arrow.cc,sha256=uuQo_rewpuc882cuFy-uMmtRLR1iMT3Ew3JystLBXfc,31961
|
| 662 |
+
pyarrow/src/arrow/python/numpy_to_arrow.h,sha256=z9KapsuoOSpWILPt9bea7GR4BL6AQ28T6DUO0mSkh3k,2760
|
| 663 |
+
pyarrow/src/arrow/python/parquet_encryption.cc,sha256=5ilofycsTj6IP0RGCUZFHucHN53oZAmx32L6el7RQh0,4408
|
| 664 |
+
pyarrow/src/arrow/python/parquet_encryption.h,sha256=7KjqRuxbO0UxxHikTDvrLH733UVe0uvTf_bQMiI_xCA,5596
|
| 665 |
+
pyarrow/src/arrow/python/platform.h,sha256=AtkGgpUVqPHs9Z8Tm07yb2zN_wOtb2cvlf-5xFBkc4k,1268
|
| 666 |
+
pyarrow/src/arrow/python/pyarrow.cc,sha256=vukhk0aEmqI2QZ54XMwyC3930mJHGUVSSW49GSgifWw,3683
|
| 667 |
+
pyarrow/src/arrow/python/pyarrow.h,sha256=TK3BtD9n3QKOQ9dX3LXbQc0hu9alWcufV0O93iQW7B0,2761
|
| 668 |
+
pyarrow/src/arrow/python/pyarrow_api.h,sha256=7l0G4-_m9yALYoifsY8Z6qh3HHD0PgkpVSgCn_JaGU4,867
|
| 669 |
+
pyarrow/src/arrow/python/pyarrow_lib.h,sha256=-70_Ckj3_0ImlzaXSJOE_d3w9pGM66lXiGPyln9c96Y,863
|
| 670 |
+
pyarrow/src/arrow/python/python_test.cc,sha256=7WZnh-qh0SvzAin20DHAAd_vdcj2EZQYCNhgqyECdN0,33047
|
| 671 |
+
pyarrow/src/arrow/python/python_test.h,sha256=ea32mM20uHySlygi9MtVxr26O-ydTZHCUQIlxaIMjT4,1195
|
| 672 |
+
pyarrow/src/arrow/python/python_to_arrow.cc,sha256=DjnP866Q8RUY9WnE8moCI5nExs5Rni4oYz2kuytZ0-8,47894
|
| 673 |
+
pyarrow/src/arrow/python/python_to_arrow.h,sha256=BoVytf6P7PBYXyznchElKZSFvEsFyimB-tLFdw0AUNo,2521
|
| 674 |
+
pyarrow/src/arrow/python/type_traits.h,sha256=U7dW4sajVVmjXALsP-B8ZZwI4GgIUG3t-rbp2fwrHWI,10236
|
| 675 |
+
pyarrow/src/arrow/python/udf.cc,sha256=tRd7cPh66N5tU4DdO70F8x1FqODcGZ3HtrYjF4BSs9w,29820
|
| 676 |
+
pyarrow/src/arrow/python/udf.h,sha256=de3R8PhNJO5lT9oCqRxe8e2_SE3jBpHOkwbNqCrlgjQ,3104
|
| 677 |
+
pyarrow/src/arrow/python/util.cc,sha256=Tkgz17XmYFzVybvQ9Vo9LChVo98R5BlbjqCNMHk86DM,1852
|
| 678 |
+
pyarrow/src/arrow/python/util.h,sha256=sP2CEGG7NNqwjrEeNKB-VFqkKxn5P2Tsc0jPUMXQuLg,1732
|
| 679 |
+
pyarrow/src/arrow/python/vendored/CMakeLists.txt,sha256=02XvDJAdKiajCEBOmnMKBpmzbRU7FPkNdlNXtw0-A24,837
|
| 680 |
+
pyarrow/src/arrow/python/vendored/pythoncapi_compat.h,sha256=bzMnlHTCfjk5DQRIxwytunYh5aQxU3iSElaaDyNnAY8,40900
|
| 681 |
+
pyarrow/src/arrow/python/visibility.h,sha256=hwJw5sGrWJckQkNaAuLe4Tf-VDjQbXknyzNOVgZI3FI,1381
|
| 682 |
+
pyarrow/substrait.py,sha256=yOMgCb-A5XW9t2DKgutRydDHpFvQkiNNq6ZIu0hIUB8,1230
|
| 683 |
+
pyarrow/table.pxi,sha256=AhMQSSsAuoRXzP2wa1BP6GEYWQs5LHdDb4MJFmUz7zo,208772
|
| 684 |
+
pyarrow/tensor.pxi,sha256=vWs4_2-xeSkFsvL0VMVciIntRWiaH-6QxZyx8j00v1U,43661
|
| 685 |
+
pyarrow/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 686 |
+
pyarrow/tests/__pycache__/__init__.cpython-310.pyc,,
|
| 687 |
+
pyarrow/tests/__pycache__/arrow_16597.cpython-310.pyc,,
|
| 688 |
+
pyarrow/tests/__pycache__/arrow_39313.cpython-310.pyc,,
|
| 689 |
+
pyarrow/tests/__pycache__/arrow_7980.cpython-310.pyc,,
|
| 690 |
+
pyarrow/tests/__pycache__/conftest.cpython-310.pyc,,
|
| 691 |
+
pyarrow/tests/__pycache__/pandas_examples.cpython-310.pyc,,
|
| 692 |
+
pyarrow/tests/__pycache__/pandas_threaded_import.cpython-310.pyc,,
|
| 693 |
+
pyarrow/tests/__pycache__/read_record_batch.cpython-310.pyc,,
|
| 694 |
+
pyarrow/tests/__pycache__/strategies.cpython-310.pyc,,
|
| 695 |
+
pyarrow/tests/__pycache__/test_acero.cpython-310.pyc,,
|
| 696 |
+
pyarrow/tests/__pycache__/test_adhoc_memory_leak.cpython-310.pyc,,
|
| 697 |
+
pyarrow/tests/__pycache__/test_array.cpython-310.pyc,,
|
| 698 |
+
pyarrow/tests/__pycache__/test_builder.cpython-310.pyc,,
|
| 699 |
+
pyarrow/tests/__pycache__/test_cffi.cpython-310.pyc,,
|
| 700 |
+
pyarrow/tests/__pycache__/test_compute.cpython-310.pyc,,
|
| 701 |
+
pyarrow/tests/__pycache__/test_convert_builtin.cpython-310.pyc,,
|
| 702 |
+
pyarrow/tests/__pycache__/test_cpp_internals.cpython-310.pyc,,
|
| 703 |
+
pyarrow/tests/__pycache__/test_csv.cpython-310.pyc,,
|
| 704 |
+
pyarrow/tests/__pycache__/test_cuda.cpython-310.pyc,,
|
| 705 |
+
pyarrow/tests/__pycache__/test_cuda_numba_interop.cpython-310.pyc,,
|
| 706 |
+
pyarrow/tests/__pycache__/test_cython.cpython-310.pyc,,
|
| 707 |
+
pyarrow/tests/__pycache__/test_dataset.cpython-310.pyc,,
|
| 708 |
+
pyarrow/tests/__pycache__/test_dataset_encryption.cpython-310.pyc,,
|
| 709 |
+
pyarrow/tests/__pycache__/test_deprecations.cpython-310.pyc,,
|
| 710 |
+
pyarrow/tests/__pycache__/test_device.cpython-310.pyc,,
|
| 711 |
+
pyarrow/tests/__pycache__/test_dlpack.cpython-310.pyc,,
|
| 712 |
+
pyarrow/tests/__pycache__/test_exec_plan.cpython-310.pyc,,
|
| 713 |
+
pyarrow/tests/__pycache__/test_extension_type.cpython-310.pyc,,
|
| 714 |
+
pyarrow/tests/__pycache__/test_feather.cpython-310.pyc,,
|
| 715 |
+
pyarrow/tests/__pycache__/test_flight.cpython-310.pyc,,
|
| 716 |
+
pyarrow/tests/__pycache__/test_flight_async.cpython-310.pyc,,
|
| 717 |
+
pyarrow/tests/__pycache__/test_fs.cpython-310.pyc,,
|
| 718 |
+
pyarrow/tests/__pycache__/test_gandiva.cpython-310.pyc,,
|
| 719 |
+
pyarrow/tests/__pycache__/test_gdb.cpython-310.pyc,,
|
| 720 |
+
pyarrow/tests/__pycache__/test_io.cpython-310.pyc,,
|
| 721 |
+
pyarrow/tests/__pycache__/test_ipc.cpython-310.pyc,,
|
| 722 |
+
pyarrow/tests/__pycache__/test_json.cpython-310.pyc,,
|
| 723 |
+
pyarrow/tests/__pycache__/test_jvm.cpython-310.pyc,,
|
| 724 |
+
pyarrow/tests/__pycache__/test_memory.cpython-310.pyc,,
|
| 725 |
+
pyarrow/tests/__pycache__/test_misc.cpython-310.pyc,,
|
| 726 |
+
pyarrow/tests/__pycache__/test_orc.cpython-310.pyc,,
|
| 727 |
+
pyarrow/tests/__pycache__/test_pandas.cpython-310.pyc,,
|
| 728 |
+
pyarrow/tests/__pycache__/test_scalars.cpython-310.pyc,,
|
| 729 |
+
pyarrow/tests/__pycache__/test_schema.cpython-310.pyc,,
|
| 730 |
+
pyarrow/tests/__pycache__/test_sparse_tensor.cpython-310.pyc,,
|
| 731 |
+
pyarrow/tests/__pycache__/test_strategies.cpython-310.pyc,,
|
| 732 |
+
pyarrow/tests/__pycache__/test_substrait.cpython-310.pyc,,
|
| 733 |
+
pyarrow/tests/__pycache__/test_table.cpython-310.pyc,,
|
| 734 |
+
pyarrow/tests/__pycache__/test_tensor.cpython-310.pyc,,
|
| 735 |
+
pyarrow/tests/__pycache__/test_types.cpython-310.pyc,,
|
| 736 |
+
pyarrow/tests/__pycache__/test_udf.cpython-310.pyc,,
|
| 737 |
+
pyarrow/tests/__pycache__/test_util.cpython-310.pyc,,
|
| 738 |
+
pyarrow/tests/__pycache__/test_without_numpy.cpython-310.pyc,,
|
| 739 |
+
pyarrow/tests/__pycache__/util.cpython-310.pyc,,
|
| 740 |
+
pyarrow/tests/__pycache__/wsgi_examples.cpython-310.pyc,,
|
| 741 |
+
pyarrow/tests/arrow_16597.py,sha256=DNb41h9E3ITGvAJJu86i5SfsKrwstQJ0E5gT_bpTS_k,1354
|
| 742 |
+
pyarrow/tests/arrow_39313.py,sha256=0pyBixoX38fldTPO1Vwshi_H0XBACrz8esYoL4o71KI,1431
|
| 743 |
+
pyarrow/tests/arrow_7980.py,sha256=tZKb_tRLfxHaosDk9Yu2GLEsJjMaruXD5CKhbK_6Hq8,1094
|
| 744 |
+
pyarrow/tests/bound_function_visit_strings.pyx,sha256=vDEFoNYR8BWNkCntKDuBUT8sXNRBex_5G2bFKogr1Bs,2026
|
| 745 |
+
pyarrow/tests/conftest.py,sha256=yhbHWUARnpRonmxVtXkPv7YBOr_K-B0DRWfkrW4wnCE,10386
|
| 746 |
+
pyarrow/tests/data/feather/v0.17.0.version.2-compression.lz4.feather,sha256=qzcc7Bo4OWBXYsyyKdDJwdTRstMqB1Zz0GiGYtndBnE,594
|
| 747 |
+
pyarrow/tests/data/orc/README.md,sha256=_4X5XszZqQtWAVEz5N1Va4VyyayGQgNDKrcdMX2Ib4s,932
|
| 748 |
+
pyarrow/tests/data/orc/TestOrcFile.emptyFile.jsn.gz,sha256=xLjAXd-3scx3DCyeAsmxTO3dv1cj9KRvYopKe5rQNiI,50
|
| 749 |
+
pyarrow/tests/data/orc/TestOrcFile.emptyFile.orc,sha256=zj0579dQBXhF7JuB-ZphkmQ81ybLo6Ca4zPV4HXoImY,523
|
| 750 |
+
pyarrow/tests/data/orc/TestOrcFile.test1.jsn.gz,sha256=kLxmwMVHtfzpHqBztFjfY_PTCloaXpfHq9DDDszb8Wk,323
|
| 751 |
+
pyarrow/tests/data/orc/TestOrcFile.test1.orc,sha256=A4JxgMCffTkz9-XT1QT1tg2TlYZRRz1g7iIMmqzovqA,1711
|
| 752 |
+
pyarrow/tests/data/orc/TestOrcFile.testDate1900.jsn.gz,sha256=oWf7eBR3ZtOA91OTvdeQJYos1an56msGsJwhGOan3lo,182453
|
| 753 |
+
pyarrow/tests/data/orc/TestOrcFile.testDate1900.orc,sha256=nYsVYhUGGOL80gHj37si_vX0dh8QhIMSeU4sHjNideM,30941
|
| 754 |
+
pyarrow/tests/data/orc/decimal.jsn.gz,sha256=kTEyYdPDAASFUX8Niyry5mRDF-Y-LsrhSAjbu453mvA,19313
|
| 755 |
+
pyarrow/tests/data/orc/decimal.orc,sha256=W5cV2WdLy4OrSTnd_Qv5ntphG4TcB-MyG4UpRFwSxJY,16337
|
| 756 |
+
pyarrow/tests/data/parquet/v0.7.1.all-named-index.parquet,sha256=YPGUXtw-TsOPbiNDieZHobNp3or7nHhAxJGjmIDAyqE,3948
|
| 757 |
+
pyarrow/tests/data/parquet/v0.7.1.column-metadata-handling.parquet,sha256=7sebZgpfdcP37QksT3FhDL6vOA9gR6GBaq44NCVtOYw,2012
|
| 758 |
+
pyarrow/tests/data/parquet/v0.7.1.parquet,sha256=vmdzhIzpBbmRkq3Gjww7KqurfSFNtQuSpSIDeQVmqys,4372
|
| 759 |
+
pyarrow/tests/data/parquet/v0.7.1.some-named-index.parquet,sha256=VGgSjqihCRtdBxlUcfP5s3BSR7aUQKukW-bGgJLf_HY,4008
|
| 760 |
+
pyarrow/tests/extensions.pyx,sha256=UVfIEnGYy2SDiYkMW6jp6zTo1tvO7gUREH4OGEWjU2k,3046
|
| 761 |
+
pyarrow/tests/interchange/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
| 762 |
+
pyarrow/tests/interchange/__pycache__/__init__.cpython-310.pyc,,
|
| 763 |
+
pyarrow/tests/interchange/__pycache__/test_conversion.cpython-310.pyc,,
|
| 764 |
+
pyarrow/tests/interchange/__pycache__/test_interchange_spec.cpython-310.pyc,,
|
| 765 |
+
pyarrow/tests/interchange/test_conversion.py,sha256=23e5tpKBL-ekA5uWpM6-f6HVPF937Hnzfune0Ty9moo,18609
|
| 766 |
+
pyarrow/tests/interchange/test_interchange_spec.py,sha256=AwqwD8b2gV1f5HERtzG6UtOIshFGafUI_9CQOVLPnho,9381
|
| 767 |
+
pyarrow/tests/pandas_examples.py,sha256=SDPL87Ea997nGi7afOqlceq6wH4Bh5IR5S0fHZV3Acs,5107
|
| 768 |
+
pyarrow/tests/pandas_threaded_import.py,sha256=b_ubLr5dj4dWJht9552qc3S3Yt3fQQgaUH6208oZvHg,1429
|
| 769 |
+
pyarrow/tests/parquet/__init__.py,sha256=dKsXU9M-sJyz2wYIuqwsKM9meOlK_qY6qhmQzIvEpCE,931
|
| 770 |
+
pyarrow/tests/parquet/__pycache__/__init__.cpython-310.pyc,,
|
| 771 |
+
pyarrow/tests/parquet/__pycache__/common.cpython-310.pyc,,
|
| 772 |
+
pyarrow/tests/parquet/__pycache__/conftest.cpython-310.pyc,,
|
| 773 |
+
pyarrow/tests/parquet/__pycache__/encryption.cpython-310.pyc,,
|
| 774 |
+
pyarrow/tests/parquet/__pycache__/test_basic.cpython-310.pyc,,
|
| 775 |
+
pyarrow/tests/parquet/__pycache__/test_compliant_nested_type.cpython-310.pyc,,
|
| 776 |
+
pyarrow/tests/parquet/__pycache__/test_data_types.cpython-310.pyc,,
|
| 777 |
+
pyarrow/tests/parquet/__pycache__/test_dataset.cpython-310.pyc,,
|
| 778 |
+
pyarrow/tests/parquet/__pycache__/test_datetime.cpython-310.pyc,,
|
| 779 |
+
pyarrow/tests/parquet/__pycache__/test_encryption.cpython-310.pyc,,
|
| 780 |
+
pyarrow/tests/parquet/__pycache__/test_metadata.cpython-310.pyc,,
|
| 781 |
+
pyarrow/tests/parquet/__pycache__/test_pandas.cpython-310.pyc,,
|
| 782 |
+
pyarrow/tests/parquet/__pycache__/test_parquet_file.cpython-310.pyc,,
|
| 783 |
+
pyarrow/tests/parquet/__pycache__/test_parquet_writer.cpython-310.pyc,,
|
| 784 |
+
pyarrow/tests/parquet/common.py,sha256=ezd4yAsRXI1R-MxE1iIbyHHIlEGyKumckQzVHAx46rM,6149
|
| 785 |
+
pyarrow/tests/parquet/conftest.py,sha256=CyKJlVT-pQNb2f2BwlUaIAoWtobcZ65Y0vgpGX2ttnA,3157
|
| 786 |
+
pyarrow/tests/parquet/encryption.py,sha256=Nr232E2ueexYXGWNZQOfQpw3LkPTbSNHWSfwf1DuBVI,5218
|
| 787 |
+
pyarrow/tests/parquet/test_basic.py,sha256=0tZ7Y8-Df2O4e-QavU2s0RR8xHuIVf3cIdAAWrJPH_0,36873
|
| 788 |
+
pyarrow/tests/parquet/test_compliant_nested_type.py,sha256=Lz7tCPrSpv9GrKPMS-eu1LehsCTwz7KdUdCYJ8tF8dE,3901
|
| 789 |
+
pyarrow/tests/parquet/test_data_types.py,sha256=Y_RqQBfDgrxQnOc0IjuHA7ueIOmotH8CMkmqQ4prz9I,19319
|
| 790 |
+
pyarrow/tests/parquet/test_dataset.py,sha256=U144J3RrIA3rCQIJXxpgy5PQVn5-7gYsy-f3pD20nPs,42020
|
| 791 |
+
pyarrow/tests/parquet/test_datetime.py,sha256=A3ZaRj88u0IrlhCNp2KY_A8txrb7y2pKPgEVvI7e7bU,16398
|
| 792 |
+
pyarrow/tests/parquet/test_encryption.py,sha256=eULJdOgRNMrd6klGgW5ElotrejsL9ev_dBz3LG2P9L8,28357
|
| 793 |
+
pyarrow/tests/parquet/test_metadata.py,sha256=340mr8FxLTVfLMSDDDRm8WWblCzRz7FD77mr4BoJodg,27732
|
| 794 |
+
pyarrow/tests/parquet/test_pandas.py,sha256=4r9sip2N0XbkBb6SZuh51SUHJn9BlAtfjbzB3d3Gk_M,23543
|
| 795 |
+
pyarrow/tests/parquet/test_parquet_file.py,sha256=VlsY4JwZUckF5uxDrVlrJRBVnvTmuuajd0h37BMkbOo,13872
|
| 796 |
+
pyarrow/tests/parquet/test_parquet_writer.py,sha256=9-BjKiXjLzgKC0IodiT8KnCtSPBo1ZKinS_spFX8uWs,18215
|
| 797 |
+
pyarrow/tests/pyarrow_cython_example.pyx,sha256=fx6zT1bUb2-cDnwKoG71K3ozpmrNJ53kKQHHJTExGz8,2115
|
| 798 |
+
pyarrow/tests/read_record_batch.py,sha256=9Y0X0h03hUXwOKZz7jBBZSwgIrjxT-FkWIw6pu38Frc,953
|
| 799 |
+
pyarrow/tests/strategies.py,sha256=eJkCeVCPB714DisrR1Q1INIUqIBX9v1rF2lNtBamlTY,15581
|
| 800 |
+
pyarrow/tests/test_acero.py,sha256=t1TIMZJ9zfCYu9V_Mg_i6SvtoIXFo2GZbxDJh3Luu60,18009
|
| 801 |
+
pyarrow/tests/test_adhoc_memory_leak.py,sha256=Pn4PcIbOBRtSJuz9Ar_ocubco0QOMZ-eAE9Bs7Wp4mA,1453
|
| 802 |
+
pyarrow/tests/test_array.py,sha256=m42aqjvL-_hLP2faOY4asW6k7Uy-L4WfhT5vyqx922o,146212
|
| 803 |
+
pyarrow/tests/test_builder.py,sha256=zNEcslLwyb40oYbG7lInQcI81QHMKDOzi1zthw1Je7c,2803
|
| 804 |
+
pyarrow/tests/test_cffi.py,sha256=ZkOKn6qfySL7LPqR-1FAlRS7n8h3npF5WmqSV8eBVg8,26339
|
| 805 |
+
pyarrow/tests/test_compute.py,sha256=cdgZXDHpTVKkuhuGP1ONc4wo_RUavcrY0hSp4V61T9U,157487
|
| 806 |
+
pyarrow/tests/test_convert_builtin.py,sha256=yhFtMOj6Sqx5TyLs6dxQQl9_ceX_Qbm5MmTyEulpDk0,82323
|
| 807 |
+
pyarrow/tests/test_cpp_internals.py,sha256=Xg4CUB6zohQkcYG64Lj_Uf2BscI27Vv0JC_CqNkDQuE,2006
|
| 808 |
+
pyarrow/tests/test_csv.py,sha256=45yAVGgLS7cS5tJpnzz-yEZbrp5PXCbDIVtv-oVZX8w,77863
|
| 809 |
+
pyarrow/tests/test_cuda.py,sha256=81lyEjUUd2UWbeFW-JJECYJ9UZKAXOTys55uMd2i0so,36153
|
| 810 |
+
pyarrow/tests/test_cuda_numba_interop.py,sha256=iHP_FE4sWbsKwNNXRcYnVozp3Wd1o0Mg6BDymx710G4,8794
|
| 811 |
+
pyarrow/tests/test_cython.py,sha256=p3Pz_w8Ysd6pMQfvjGPsBA-fYjX7os9M9B9K9UB42m8,7040
|
| 812 |
+
pyarrow/tests/test_dataset.py,sha256=TA9e4J0nL05TpISLgCzAOyY8g7vAmM4j8PYNaTkCw7U,218325
|
| 813 |
+
pyarrow/tests/test_dataset_encryption.py,sha256=EpD2zXVcLS_3i4fwli7Z45ibDFSgXCFFQ2qiXtAxBsg,18023
|
| 814 |
+
pyarrow/tests/test_deprecations.py,sha256=W_rneq4jC6zqCNoGhBDf1F28Q-0LHI7YKLgtsbV6LHM,891
|
| 815 |
+
pyarrow/tests/test_device.py,sha256=qe9Wiwo-XVazt9pdxyqQJUz6fNR0jTs9CHiyaoppNA4,2550
|
| 816 |
+
pyarrow/tests/test_dlpack.py,sha256=sdubFfaU6ZCjZFoj-vbqnT-Yf79kI2ZBOe9Qi_J0Vfk,5974
|
| 817 |
+
pyarrow/tests/test_exec_plan.py,sha256=pjOkSaWeqjN6celKxUEH3tBGXLh8kKbmSSsvKOWsbQQ,10096
|
| 818 |
+
pyarrow/tests/test_extension_type.py,sha256=q-Y3BI469ePC0aLG5LUSTObdeMqkeQtnD-oRLBx_9kM,67567
|
| 819 |
+
pyarrow/tests/test_feather.py,sha256=QMFIyOh2bGwatHq3gE1OZWIgIdfJ2i5UjhNTN0DVK5U,25616
|
| 820 |
+
pyarrow/tests/test_flight.py,sha256=kZsX-0YWYtrIrcqkdg8yNmjxMuVQSo_Ly5rqD6y2H80,102280
|
| 821 |
+
pyarrow/tests/test_flight_async.py,sha256=kP2wIrUz1HIbrr4CE0SxSg4Zc56ta3xX6EdibAI2yVM,2848
|
| 822 |
+
pyarrow/tests/test_fs.py,sha256=G97d6CLdiFCnWo18H_OHCWt-JHeSqYCv7rs5quosI3U,72758
|
| 823 |
+
pyarrow/tests/test_gandiva.py,sha256=AEf9ln-j5MmIMQ0JTQPhnZwbNh82ynSURsWPaKaNing,15623
|
| 824 |
+
pyarrow/tests/test_gdb.py,sha256=mircGfK7H3PQgn4dVYfDUYbC03CzuAXqGW4oOmd-uZw,45052
|
| 825 |
+
pyarrow/tests/test_io.py,sha256=fBEyAu9zTMHu9ovgwOwv7kEslYhY38sd0GNR78d-ECg,63736
|
| 826 |
+
pyarrow/tests/test_ipc.py,sha256=KFK4E6Ee_zZ52k9hbxS6nMFNo41asuoppiFsJW8PGEI,46053
|
| 827 |
+
pyarrow/tests/test_json.py,sha256=yTOKNdiCcJxmPCAiUfNojAOqsytj_w9uZ0YPJd3yNWU,23003
|
| 828 |
+
pyarrow/tests/test_jvm.py,sha256=QLRHeFx8Gbz1UywlnDi2akV6DBtqGHReQEuNl2vSbcE,15475
|
| 829 |
+
pyarrow/tests/test_memory.py,sha256=j8fs5HqguRobzbcHSvyRzd0ICT7IMeonMvcs147DEd4,9860
|
| 830 |
+
pyarrow/tests/test_misc.py,sha256=1febCUPe9YTPl7QU5jH8Tlo2q_5UpoYoqsg_esZpCiU,7626
|
| 831 |
+
pyarrow/tests/test_orc.py,sha256=UrDyNHJoTX72KFGVLf-WRzzC8e6nsP-GsCm97x0l43o,21565
|
| 832 |
+
pyarrow/tests/test_pandas.py,sha256=NuZGxTh6PNJM2cV2fOrEWLZexc4OSn8G10hMcEJbqyw,195140
|
| 833 |
+
pyarrow/tests/test_scalars.py,sha256=8LPIZy1LmqOTK6-e_RZjiRM9owLodVvMFtRfFSiWBrc,30289
|
| 834 |
+
pyarrow/tests/test_schema.py,sha256=x5MSVt6kOhvSPTCIMIFVTm27Lp6znJ4emk9L5ziqJwc,23347
|
| 835 |
+
pyarrow/tests/test_sparse_tensor.py,sha256=bGO7Es4D65zmGNRN013G9VUCQ_v-mPUb90sAk--3yyw,17666
|
| 836 |
+
pyarrow/tests/test_strategies.py,sha256=ZPJiWvj26qQPsR9aZCF-VUsT6PyWPrJsr6q2oXJshSs,1829
|
| 837 |
+
pyarrow/tests/test_substrait.py,sha256=rsLPNlDPDAxZ1OIu-LAINSD4q_UZJhOvtTzPfXjrWM8,32223
|
| 838 |
+
pyarrow/tests/test_table.py,sha256=aRgarP_oVThWXp41TBe6MLVPgmoZqCgwdKMVhq2KHig,123867
|
| 839 |
+
pyarrow/tests/test_tensor.py,sha256=LYSEYGUjtdnsbL0WAir9jFindo-r0bLySiDA1uAXL8E,6643
|
| 840 |
+
pyarrow/tests/test_types.py,sha256=XaGZSzq556PewtGRcUEQ6T5T6D5QidchC7RrmRQYI-8,44212
|
| 841 |
+
pyarrow/tests/test_udf.py,sha256=WA9E5skUqh7uMr_zH3rQ11LRx0SK2G3WO8HjVHGWyQY,29792
|
| 842 |
+
pyarrow/tests/test_util.py,sha256=ozTlooHBMOP3nbX5b3dG2aanrXwxXHx1giicm0QQyPM,5030
|
| 843 |
+
pyarrow/tests/test_without_numpy.py,sha256=ysbB-jML318I04ViQT4Ok7iMg1cI-NU8kguPu-FTSl4,1855
|
| 844 |
+
pyarrow/tests/util.py,sha256=o_opaXvKIDveE2cf_jjo6fHRuRk2CjLGu6OsFFbt-mM,13665
|
| 845 |
+
pyarrow/tests/wsgi_examples.py,sha256=vQIDb5989sRVLsELw-fRHhfX-dE96sTl5J2lEuEKup8,1348
|
| 846 |
+
pyarrow/types.pxi,sha256=M1_lSb4uNHl2akZkQlgOf21SnfvrWQz6rybtCIVAdYQ,162774
|
| 847 |
+
pyarrow/types.py,sha256=d79cmgr2MDz79UQy6ChoKf4MScKCtDvtOBVGIbV1644,9734
|
| 848 |
+
pyarrow/util.py,sha256=ARlwfZFK6sMKGNG2V9HcG0EC0LGHHImB9AMhoWUI4nI,8640
|
| 849 |
+
pyarrow/vendored/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
| 850 |
+
pyarrow/vendored/__pycache__/__init__.cpython-310.pyc,,
|
| 851 |
+
pyarrow/vendored/__pycache__/docscrape.cpython-310.pyc,,
|
| 852 |
+
pyarrow/vendored/__pycache__/version.cpython-310.pyc,,
|
| 853 |
+
pyarrow/vendored/docscrape.py,sha256=phTjwuzoO5hB88QerZk3uGu9c5OrZwjFzI7vEIIbCUQ,22975
|
| 854 |
+
pyarrow/vendored/version.py,sha256=5-Vo4Q3kPJrm1DSGusnMlTxuA8ynI4hAryApBd6MnpQ,14345
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (80.9.0)
|
| 3 |
+
Root-Is-Purelib: false
|
| 4 |
+
Tag: cp310-cp310-manylinux_2_28_x86_64
|
| 5 |
+
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow-23.0.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__dummy__
|
| 2 |
+
pyarrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/accumulation_queue.h
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <functional>
|
| 22 |
+
#include <optional>
|
| 23 |
+
#include <vector>
|
| 24 |
+
|
| 25 |
+
#include "arrow/acero/visibility.h"
|
| 26 |
+
#include "arrow/compute/exec.h"
|
| 27 |
+
#include "arrow/result.h"
|
| 28 |
+
|
| 29 |
+
namespace arrow {
|
| 30 |
+
namespace acero {
|
| 31 |
+
namespace util {
|
| 32 |
+
|
| 33 |
+
using arrow::compute::ExecBatch;
|
| 34 |
+
|
| 35 |
+
/// \brief A container that accumulates batches until they are ready to
|
| 36 |
+
/// be processed.
|
| 37 |
+
class ARROW_ACERO_EXPORT AccumulationQueue {
|
| 38 |
+
public:
|
| 39 |
+
AccumulationQueue() : row_count_(0) {}
|
| 40 |
+
~AccumulationQueue() = default;
|
| 41 |
+
|
| 42 |
+
// We should never be copying ExecBatch around
|
| 43 |
+
AccumulationQueue(const AccumulationQueue&) = delete;
|
| 44 |
+
AccumulationQueue& operator=(const AccumulationQueue&) = delete;
|
| 45 |
+
|
| 46 |
+
AccumulationQueue(AccumulationQueue&& that);
|
| 47 |
+
AccumulationQueue& operator=(AccumulationQueue&& that);
|
| 48 |
+
|
| 49 |
+
void Concatenate(AccumulationQueue&& that);
|
| 50 |
+
void InsertBatch(ExecBatch batch);
|
| 51 |
+
int64_t row_count() { return row_count_; }
|
| 52 |
+
size_t batch_count() { return batches_.size(); }
|
| 53 |
+
bool empty() const { return batches_.empty(); }
|
| 54 |
+
void Clear();
|
| 55 |
+
ExecBatch& operator[](size_t i);
|
| 56 |
+
|
| 57 |
+
private:
|
| 58 |
+
int64_t row_count_;
|
| 59 |
+
std::vector<ExecBatch> batches_;
|
| 60 |
+
};
|
| 61 |
+
|
| 62 |
+
/// A queue that sequences incoming batches
|
| 63 |
+
///
|
| 64 |
+
/// This can be used when a node needs to do some kind of ordered processing on
|
| 65 |
+
/// the stream.
|
| 66 |
+
///
|
| 67 |
+
/// Batches can be inserted in any order. The process_callback will be called on
|
| 68 |
+
/// the batches, in order, without reentrant calls. For this reason the callback
|
| 69 |
+
/// should be quick.
|
| 70 |
+
///
|
| 71 |
+
/// For example, in a top-n node, the process callback should determine how many
|
| 72 |
+
/// rows need to be delivered for the given batch, and then return a task to actually
|
| 73 |
+
/// deliver those rows.
|
| 74 |
+
class ARROW_ACERO_EXPORT SequencingQueue {
|
| 75 |
+
public:
|
| 76 |
+
using Task = std::function<Status()>;
|
| 77 |
+
|
| 78 |
+
/// Strategy that describes how to handle items
|
| 79 |
+
class Processor {
|
| 80 |
+
public:
|
| 81 |
+
/// Process the batch, potentially generating a task
|
| 82 |
+
///
|
| 83 |
+
/// This method will be called on each batch in order. Calls to this method
|
| 84 |
+
/// will be serialized and it will not be called reentrantly. This makes it
|
| 85 |
+
/// safe to do things that rely on order but minimal time should be spent here
|
| 86 |
+
/// to avoid becoming a bottleneck.
|
| 87 |
+
///
|
| 88 |
+
/// \return a follow-up task that will be scheduled. The follow-up task(s) are
|
| 89 |
+
/// is not guaranteed to run in any particular order. If nullopt is
|
| 90 |
+
/// returned then nothing will be scheduled.
|
| 91 |
+
virtual Result<std::optional<Task>> Process(ExecBatch batch) = 0;
|
| 92 |
+
/// Schedule a task
|
| 93 |
+
virtual void Schedule(Task task) = 0;
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
virtual ~SequencingQueue() = default;
|
| 97 |
+
|
| 98 |
+
/// Insert a batch into the queue
|
| 99 |
+
///
|
| 100 |
+
/// This will insert the batch into the queue. If this batch was the next batch
|
| 101 |
+
/// to deliver then this will trigger 1+ calls to the process callback to generate
|
| 102 |
+
/// 1+ tasks.
|
| 103 |
+
///
|
| 104 |
+
/// The task generated by this call will be executed immediately. The remaining
|
| 105 |
+
/// tasks will be scheduled using the schedule callback.
|
| 106 |
+
///
|
| 107 |
+
/// From a data pipeline perspective the sequencing queue is a "sometimes" breaker. If
|
| 108 |
+
/// a task arrives in order then this call will usually execute the downstream pipeline.
|
| 109 |
+
/// If this task arrives early then this call will only queue the data.
|
| 110 |
+
virtual Status InsertBatch(ExecBatch batch) = 0;
|
| 111 |
+
|
| 112 |
+
/// Create a queue
|
| 113 |
+
/// \param processor describes how to process the batches, must outlive the queue
|
| 114 |
+
static std::unique_ptr<SequencingQueue> Make(Processor* processor);
|
| 115 |
+
};
|
| 116 |
+
|
| 117 |
+
/// A queue that sequences incoming batches
|
| 118 |
+
///
|
| 119 |
+
/// Unlike SequencingQueue the Process method is not expected to schedule new tasks.
|
| 120 |
+
///
|
| 121 |
+
/// If a batch arrives and another thread is currently processing then the batch
|
| 122 |
+
/// will be queued and control will return. In other words, delivery of batches will
|
| 123 |
+
/// not block on the Process method.
|
| 124 |
+
///
|
| 125 |
+
/// It can be helpful to think of this as if a dedicated thread is running Process as
|
| 126 |
+
/// batches arrive
|
| 127 |
+
class ARROW_ACERO_EXPORT SerialSequencingQueue {
|
| 128 |
+
public:
|
| 129 |
+
/// Strategy that describes how to handle items
|
| 130 |
+
class Processor {
|
| 131 |
+
public:
|
| 132 |
+
virtual ~Processor() = default;
|
| 133 |
+
/// Process the batch
|
| 134 |
+
///
|
| 135 |
+
/// This method will be called on each batch in order. Calls to this method
|
| 136 |
+
/// will be serialized and it will not be called reentrantly. This makes it
|
| 137 |
+
/// safe to do things that rely on order.
|
| 138 |
+
///
|
| 139 |
+
/// If this falls behind then data may accumulate
|
| 140 |
+
///
|
| 141 |
+
/// TODO: Could add backpressure if needed but right now all uses of this should
|
| 142 |
+
/// be pretty fast and so are unlikely to block.
|
| 143 |
+
virtual Status Process(ExecBatch batch) = 0;
|
| 144 |
+
};
|
| 145 |
+
|
| 146 |
+
virtual ~SerialSequencingQueue() = default;
|
| 147 |
+
|
| 148 |
+
/// Insert a batch into the queue
|
| 149 |
+
///
|
| 150 |
+
/// This will insert the batch into the queue. If this batch was the next batch
|
| 151 |
+
/// to deliver then this may trigger calls to the processor which will be run
|
| 152 |
+
/// as part of this call.
|
| 153 |
+
virtual Status InsertBatch(ExecBatch batch) = 0;
|
| 154 |
+
|
| 155 |
+
/// Create a queue
|
| 156 |
+
/// \param processor describes how to process the batches, must outlive the queue
|
| 157 |
+
static std::unique_ptr<SerialSequencingQueue> Make(Processor* processor);
|
| 158 |
+
};
|
| 159 |
+
|
| 160 |
+
} // namespace util
|
| 161 |
+
} // namespace acero
|
| 162 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/aggregate_node.h
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// This API is EXPERIMENTAL.
|
| 19 |
+
|
| 20 |
+
#pragma once
|
| 21 |
+
|
| 22 |
+
#include <memory>
|
| 23 |
+
#include <vector>
|
| 24 |
+
|
| 25 |
+
#include "arrow/acero/visibility.h"
|
| 26 |
+
#include "arrow/compute/api_aggregate.h"
|
| 27 |
+
#include "arrow/compute/test_util_internal.h"
|
| 28 |
+
#include "arrow/compute/type_fwd.h"
|
| 29 |
+
#include "arrow/result.h"
|
| 30 |
+
#include "arrow/type_fwd.h"
|
| 31 |
+
|
| 32 |
+
namespace arrow {
|
| 33 |
+
namespace acero {
|
| 34 |
+
namespace aggregate {
|
| 35 |
+
|
| 36 |
+
using compute::Aggregate;
|
| 37 |
+
using compute::default_exec_context;
|
| 38 |
+
using compute::ExecContext;
|
| 39 |
+
|
| 40 |
+
/// \brief Make the output schema of an aggregate node
|
| 41 |
+
///
|
| 42 |
+
/// The output schema is determined by the aggregation kernels, which may depend on the
|
| 43 |
+
/// ExecContext argument. To guarantee correct results, the same ExecContext argument
|
| 44 |
+
/// should be used in execution.
|
| 45 |
+
///
|
| 46 |
+
/// \param[in] input_schema the schema of the input to the node
|
| 47 |
+
/// \param[in] keys the grouping keys for the aggregation
|
| 48 |
+
/// \param[in] segment_keys the segmenting keys for the aggregation
|
| 49 |
+
/// \param[in] aggregates the aggregates for the aggregation
|
| 50 |
+
/// \param[in] exec_ctx the execution context for the aggregation
|
| 51 |
+
ARROW_ACERO_EXPORT Result<std::shared_ptr<Schema>> MakeOutputSchema(
|
| 52 |
+
const std::shared_ptr<Schema>& input_schema, const std::vector<FieldRef>& keys,
|
| 53 |
+
const std::vector<FieldRef>& segment_keys, const std::vector<Aggregate>& aggregates,
|
| 54 |
+
ExecContext* exec_ctx = default_exec_context());
|
| 55 |
+
|
| 56 |
+
} // namespace aggregate
|
| 57 |
+
} // namespace acero
|
| 58 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/api.h
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// NOTE: API is EXPERIMENTAL and will change without going through a
|
| 19 |
+
// deprecation cycle
|
| 20 |
+
|
| 21 |
+
#pragma once
|
| 22 |
+
|
| 23 |
+
/// \defgroup acero-api Utilities for creating and executing execution plans
|
| 24 |
+
/// @{
|
| 25 |
+
/// @}
|
| 26 |
+
|
| 27 |
+
/// \defgroup acero-nodes Options classes for the various exec nodes
|
| 28 |
+
/// @{
|
| 29 |
+
/// @}
|
| 30 |
+
|
| 31 |
+
#include "arrow/acero/exec_plan.h"
|
| 32 |
+
#include "arrow/acero/options.h"
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/asof_join_node.h
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#include <vector>
|
| 19 |
+
|
| 20 |
+
#include "arrow/acero/options.h"
|
| 21 |
+
#include "arrow/acero/visibility.h"
|
| 22 |
+
#include "arrow/compute/exec.h"
|
| 23 |
+
#include "arrow/type.h"
|
| 24 |
+
|
| 25 |
+
namespace arrow {
|
| 26 |
+
namespace acero {
|
| 27 |
+
namespace asofjoin {
|
| 28 |
+
|
| 29 |
+
using AsofJoinKeys = AsofJoinNodeOptions::Keys;
|
| 30 |
+
|
| 31 |
+
/// \brief Make the output schema of an as-of-join node
|
| 32 |
+
///
|
| 33 |
+
/// \param[in] input_schema the schema of each input to the node
|
| 34 |
+
/// \param[in] input_keys the key of each input to the node
|
| 35 |
+
ARROW_ACERO_EXPORT Result<std::shared_ptr<Schema>> MakeOutputSchema(
|
| 36 |
+
const std::vector<std::shared_ptr<Schema>>& input_schema,
|
| 37 |
+
const std::vector<AsofJoinKeys>& input_keys);
|
| 38 |
+
|
| 39 |
+
} // namespace asofjoin
|
| 40 |
+
} // namespace acero
|
| 41 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/backpressure_handler.h
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
#include "arrow/acero/exec_plan.h"
|
| 20 |
+
#include "arrow/acero/options.h"
|
| 21 |
+
|
| 22 |
+
#include <memory>
|
| 23 |
+
|
| 24 |
+
namespace arrow::acero {
|
| 25 |
+
|
| 26 |
+
class BackpressureHandler {
|
| 27 |
+
private:
|
| 28 |
+
BackpressureHandler(size_t low_threshold, size_t high_threshold,
|
| 29 |
+
std::unique_ptr<BackpressureControl> backpressure_control)
|
| 30 |
+
: low_threshold_(low_threshold),
|
| 31 |
+
high_threshold_(high_threshold),
|
| 32 |
+
backpressure_control_(std::move(backpressure_control)) {}
|
| 33 |
+
|
| 34 |
+
public:
|
| 35 |
+
static Result<BackpressureHandler> Make(
|
| 36 |
+
size_t low_threshold, size_t high_threshold,
|
| 37 |
+
std::unique_ptr<BackpressureControl> backpressure_control) {
|
| 38 |
+
if (low_threshold >= high_threshold) {
|
| 39 |
+
return Status::Invalid("low threshold (", low_threshold,
|
| 40 |
+
") must be less than high threshold (", high_threshold, ")");
|
| 41 |
+
}
|
| 42 |
+
if (backpressure_control == NULLPTR) {
|
| 43 |
+
return Status::Invalid("null backpressure control parameter");
|
| 44 |
+
}
|
| 45 |
+
BackpressureHandler backpressure_handler(low_threshold, high_threshold,
|
| 46 |
+
std::move(backpressure_control));
|
| 47 |
+
return backpressure_handler;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
void Handle(size_t start_level, size_t end_level) {
|
| 51 |
+
if (start_level < high_threshold_ && end_level >= high_threshold_) {
|
| 52 |
+
backpressure_control_->Pause();
|
| 53 |
+
} else if (start_level > low_threshold_ && end_level <= low_threshold_) {
|
| 54 |
+
backpressure_control_->Resume();
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
private:
|
| 59 |
+
size_t low_threshold_;
|
| 60 |
+
size_t high_threshold_;
|
| 61 |
+
std::unique_ptr<BackpressureControl> backpressure_control_;
|
| 62 |
+
};
|
| 63 |
+
|
| 64 |
+
} // namespace arrow::acero
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/benchmark_util.h
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <string>
|
| 22 |
+
#include <vector>
|
| 23 |
+
|
| 24 |
+
#include "benchmark/benchmark.h"
|
| 25 |
+
|
| 26 |
+
#include "arrow/acero/exec_plan.h"
|
| 27 |
+
#include "arrow/acero/test_util_internal.h"
|
| 28 |
+
#include "arrow/compute/exec.h"
|
| 29 |
+
|
| 30 |
+
namespace arrow {
|
| 31 |
+
|
| 32 |
+
namespace acero {
|
| 33 |
+
|
| 34 |
+
Status BenchmarkNodeOverhead(benchmark::State& state, int32_t num_batches,
|
| 35 |
+
int32_t batch_size, arrow::acero::BatchesWithSchema data,
|
| 36 |
+
std::vector<arrow::acero::Declaration>& node_declarations,
|
| 37 |
+
arrow::MemoryPool* pool = default_memory_pool());
|
| 38 |
+
|
| 39 |
+
Status BenchmarkIsolatedNodeOverhead(benchmark::State& state,
|
| 40 |
+
arrow::compute::Expression expr, int32_t num_batches,
|
| 41 |
+
int32_t batch_size,
|
| 42 |
+
arrow::acero::BatchesWithSchema data,
|
| 43 |
+
std::string factory_name,
|
| 44 |
+
arrow::acero::ExecNodeOptions& options,
|
| 45 |
+
arrow::MemoryPool* pool = default_memory_pool());
|
| 46 |
+
|
| 47 |
+
} // namespace acero
|
| 48 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/bloom_filter.h
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <atomic>
|
| 21 |
+
#include <cstdint>
|
| 22 |
+
#include <memory>
|
| 23 |
+
|
| 24 |
+
#include "arrow/acero/partition_util.h"
|
| 25 |
+
#include "arrow/acero/util.h"
|
| 26 |
+
#include "arrow/memory_pool.h"
|
| 27 |
+
#include "arrow/result.h"
|
| 28 |
+
#include "arrow/status.h"
|
| 29 |
+
#include "arrow/util/simd.h"
|
| 30 |
+
|
| 31 |
+
namespace arrow {
|
| 32 |
+
namespace acero {
|
| 33 |
+
|
| 34 |
+
// A set of pre-generated bit masks from a 64-bit word.
|
| 35 |
+
//
|
| 36 |
+
// It is used to map selected bits of hash to a bit mask that will be used in
|
| 37 |
+
// a Bloom filter.
|
| 38 |
+
//
|
| 39 |
+
// These bit masks need to look random and need to have a similar fractions of
|
| 40 |
+
// bits set in order for a Bloom filter to have a low false positives rate.
|
| 41 |
+
//
|
| 42 |
+
struct ARROW_ACERO_EXPORT BloomFilterMasks {
|
| 43 |
+
// Generate all masks as a single bit vector. Each bit offset in this bit
|
| 44 |
+
// vector corresponds to a single mask.
|
| 45 |
+
// In each consecutive kBitsPerMask bits, there must be between
|
| 46 |
+
// kMinBitsSet and kMaxBitsSet bits set.
|
| 47 |
+
//
|
| 48 |
+
BloomFilterMasks();
|
| 49 |
+
|
| 50 |
+
inline uint64_t mask(int bit_offset) {
|
| 51 |
+
#if ARROW_LITTLE_ENDIAN
|
| 52 |
+
return (arrow::util::SafeLoadAs<uint64_t>(masks_ + bit_offset / 8) >>
|
| 53 |
+
(bit_offset % 8)) &
|
| 54 |
+
kFullMask;
|
| 55 |
+
#else
|
| 56 |
+
return (BYTESWAP(arrow::util::SafeLoadAs<uint64_t>(masks_ + bit_offset / 8)) >>
|
| 57 |
+
(bit_offset % 8)) &
|
| 58 |
+
kFullMask;
|
| 59 |
+
#endif
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
// Masks are 57 bits long because then they can be accessed at an
|
| 63 |
+
// arbitrary bit offset using a single unaligned 64-bit load instruction.
|
| 64 |
+
//
|
| 65 |
+
static constexpr int kBitsPerMask = 57;
|
| 66 |
+
static constexpr uint64_t kFullMask = (1ULL << kBitsPerMask) - 1;
|
| 67 |
+
|
| 68 |
+
// Minimum and maximum number of bits set in each mask.
|
| 69 |
+
// This constraint is enforced when generating the bit masks.
|
| 70 |
+
// Values should be close to each other and chosen as to minimize a Bloom
|
| 71 |
+
// filter false positives rate.
|
| 72 |
+
//
|
| 73 |
+
static constexpr int kMinBitsSet = 4;
|
| 74 |
+
static constexpr int kMaxBitsSet = 5;
|
| 75 |
+
|
| 76 |
+
// Number of generated masks.
|
| 77 |
+
// Having more masks to choose will improve false positives rate of Bloom
|
| 78 |
+
// filter but will also use more memory, which may lead to more CPU cache
|
| 79 |
+
// misses.
|
| 80 |
+
// The chosen value results in using only a few cache-lines for mask lookups,
|
| 81 |
+
// while providing a good variety of available bit masks.
|
| 82 |
+
//
|
| 83 |
+
static constexpr int kLogNumMasks = 10;
|
| 84 |
+
static constexpr int kNumMasks = 1 << kLogNumMasks;
|
| 85 |
+
|
| 86 |
+
// Data of masks. Masks are stored in a single bit vector. Nth mask is
|
| 87 |
+
// kBitsPerMask bits starting at bit offset N.
|
| 88 |
+
//
|
| 89 |
+
static constexpr int kTotalBytes = (kNumMasks + 64) / 8;
|
| 90 |
+
uint8_t masks_[kTotalBytes];
|
| 91 |
+
};
|
| 92 |
+
|
| 93 |
+
// A variant of a blocked Bloom filter implementation.
|
| 94 |
+
// A Bloom filter is a data structure that provides approximate membership test
|
| 95 |
+
// functionality based only on the hash of the key. Membership test may return
|
| 96 |
+
// false positives but not false negatives. Approximation of the result allows
|
| 97 |
+
// in general case (for arbitrary data types of keys) to save on both memory and
|
| 98 |
+
// lookup cost compared to the accurate membership test.
|
| 99 |
+
// The accurate test may sometimes still be cheaper for a specific data types
|
| 100 |
+
// and inputs, e.g. integers from a small range.
|
| 101 |
+
//
|
| 102 |
+
// This blocked Bloom filter is optimized for use in hash joins, to achieve a
|
| 103 |
+
// good balance between the size of the filter, the cost of its building and
|
| 104 |
+
// querying and the rate of false positives.
|
| 105 |
+
//
|
| 106 |
+
class ARROW_ACERO_EXPORT BlockedBloomFilter {
|
| 107 |
+
friend class BloomFilterBuilder_SingleThreaded;
|
| 108 |
+
friend class BloomFilterBuilder_Parallel;
|
| 109 |
+
|
| 110 |
+
public:
|
| 111 |
+
BlockedBloomFilter() : log_num_blocks_(0), num_blocks_(0), blocks_(NULLPTR) {}
|
| 112 |
+
|
| 113 |
+
inline bool Find(uint64_t hash) const {
|
| 114 |
+
uint64_t m = mask(hash);
|
| 115 |
+
uint64_t b = blocks_[block_id(hash)];
|
| 116 |
+
return (b & m) == m;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
// Uses SIMD if available for smaller Bloom filters.
|
| 120 |
+
// Uses memory prefetching for larger Bloom filters.
|
| 121 |
+
//
|
| 122 |
+
void Find(int64_t hardware_flags, int64_t num_rows, const uint32_t* hashes,
|
| 123 |
+
uint8_t* result_bit_vector, bool enable_prefetch = true) const;
|
| 124 |
+
void Find(int64_t hardware_flags, int64_t num_rows, const uint64_t* hashes,
|
| 125 |
+
uint8_t* result_bit_vector, bool enable_prefetch = true) const;
|
| 126 |
+
|
| 127 |
+
int log_num_blocks() const { return log_num_blocks_; }
|
| 128 |
+
|
| 129 |
+
int NumHashBitsUsed() const;
|
| 130 |
+
|
| 131 |
+
bool IsSameAs(const BlockedBloomFilter* other) const;
|
| 132 |
+
|
| 133 |
+
int64_t NumBitsSet() const;
|
| 134 |
+
|
| 135 |
+
// Folding of a block Bloom filter after the initial version
|
| 136 |
+
// has been built.
|
| 137 |
+
//
|
| 138 |
+
// One of the parameters for creation of Bloom filter is the number
|
| 139 |
+
// of bits allocated for it. The more bits allocated, the lower the
|
| 140 |
+
// probability of false positives. A good heuristic is to aim for
|
| 141 |
+
// half of the bits set in the constructed Bloom filter. This should
|
| 142 |
+
// result in a good trade off between size (and following cost of
|
| 143 |
+
// memory accesses) and false positives rate.
|
| 144 |
+
//
|
| 145 |
+
// There might have been many duplicate keys in the input provided
|
| 146 |
+
// to Bloom filter builder. In that case the resulting bit vector
|
| 147 |
+
// would be more sparse then originally intended. It is possible to
|
| 148 |
+
// easily correct that and cut in half the size of Bloom filter
|
| 149 |
+
// after it has already been constructed. The process to do that is
|
| 150 |
+
// approximately equal to OR-ing bits from upper and lower half (the
|
| 151 |
+
// way we address these bits when inserting or querying a hash makes
|
| 152 |
+
// such folding in half possible).
|
| 153 |
+
//
|
| 154 |
+
// We will keep folding as long as the fraction of bits set is less
|
| 155 |
+
// than 1/4. The resulting bit vector density should be in the [1/4,
|
| 156 |
+
// 1/2) range.
|
| 157 |
+
//
|
| 158 |
+
void Fold();
|
| 159 |
+
|
| 160 |
+
private:
|
| 161 |
+
Status CreateEmpty(int64_t num_rows_to_insert, MemoryPool* pool);
|
| 162 |
+
|
| 163 |
+
inline void Insert(uint64_t hash) {
|
| 164 |
+
uint64_t m = mask(hash);
|
| 165 |
+
uint64_t& b = blocks_[block_id(hash)];
|
| 166 |
+
b |= m;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
void Insert(int64_t hardware_flags, int64_t num_rows, const uint32_t* hashes);
|
| 170 |
+
void Insert(int64_t hardware_flags, int64_t num_rows, const uint64_t* hashes);
|
| 171 |
+
|
| 172 |
+
inline uint64_t mask(uint64_t hash) const {
|
| 173 |
+
// The lowest bits of hash are used to pick mask index.
|
| 174 |
+
//
|
| 175 |
+
int mask_id = static_cast<int>(hash & (BloomFilterMasks::kNumMasks - 1));
|
| 176 |
+
uint64_t result = masks_.mask(mask_id);
|
| 177 |
+
|
| 178 |
+
// The next set of hash bits is used to pick the amount of bit
|
| 179 |
+
// rotation of the mask.
|
| 180 |
+
//
|
| 181 |
+
int rotation = (hash >> BloomFilterMasks::kLogNumMasks) & 63;
|
| 182 |
+
result = ROTL64(result, rotation);
|
| 183 |
+
|
| 184 |
+
return result;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
inline int64_t block_id(uint64_t hash) const {
|
| 188 |
+
// The next set of hash bits following the bits used to select a
|
| 189 |
+
// mask is used to pick block id (index of 64-bit word in a bit
|
| 190 |
+
// vector).
|
| 191 |
+
//
|
| 192 |
+
return (hash >> (BloomFilterMasks::kLogNumMasks + 6)) & (num_blocks_ - 1);
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
template <typename T>
|
| 196 |
+
inline void InsertImp(int64_t num_rows, const T* hashes);
|
| 197 |
+
|
| 198 |
+
template <typename T>
|
| 199 |
+
inline void FindImp(int64_t num_rows, const T* hashes, uint8_t* result_bit_vector,
|
| 200 |
+
bool enable_prefetch) const;
|
| 201 |
+
|
| 202 |
+
void SingleFold(int num_folds);
|
| 203 |
+
|
| 204 |
+
#if defined(ARROW_HAVE_RUNTIME_AVX2)
|
| 205 |
+
inline __m256i mask_avx2(__m256i hash) const;
|
| 206 |
+
inline __m256i block_id_avx2(__m256i hash) const;
|
| 207 |
+
int64_t Insert_avx2(int64_t num_rows, const uint32_t* hashes);
|
| 208 |
+
int64_t Insert_avx2(int64_t num_rows, const uint64_t* hashes);
|
| 209 |
+
template <typename T>
|
| 210 |
+
int64_t InsertImp_avx2(int64_t num_rows, const T* hashes);
|
| 211 |
+
int64_t Find_avx2(int64_t num_rows, const uint32_t* hashes,
|
| 212 |
+
uint8_t* result_bit_vector) const;
|
| 213 |
+
int64_t Find_avx2(int64_t num_rows, const uint64_t* hashes,
|
| 214 |
+
uint8_t* result_bit_vector) const;
|
| 215 |
+
template <typename T>
|
| 216 |
+
int64_t FindImp_avx2(int64_t num_rows, const T* hashes,
|
| 217 |
+
uint8_t* result_bit_vector) const;
|
| 218 |
+
#endif
|
| 219 |
+
|
| 220 |
+
bool UsePrefetch() const {
|
| 221 |
+
return num_blocks_ * sizeof(uint64_t) > kPrefetchLimitBytes;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
static constexpr int64_t kPrefetchLimitBytes = 256 * 1024;
|
| 225 |
+
|
| 226 |
+
static BloomFilterMasks masks_;
|
| 227 |
+
|
| 228 |
+
// Total number of bits used by block Bloom filter must be a power
|
| 229 |
+
// of 2.
|
| 230 |
+
//
|
| 231 |
+
int log_num_blocks_;
|
| 232 |
+
int64_t num_blocks_;
|
| 233 |
+
|
| 234 |
+
// Buffer allocated to store an array of power of 2 64-bit blocks.
|
| 235 |
+
//
|
| 236 |
+
std::shared_ptr<Buffer> buf_;
|
| 237 |
+
// Pointer to mutable data owned by Buffer
|
| 238 |
+
//
|
| 239 |
+
uint64_t* blocks_;
|
| 240 |
+
};
|
| 241 |
+
|
| 242 |
+
// We have two separate implementations of building a Bloom filter, multi-threaded and
|
| 243 |
+
// single-threaded.
|
| 244 |
+
//
|
| 245 |
+
// Single threaded version is useful in two ways:
|
| 246 |
+
// a) It allows to verify parallel implementation in tests (the single threaded one is
|
| 247 |
+
// simpler and can be used as the source of truth).
|
| 248 |
+
// b) It is preferred for small and medium size Bloom filters, because it skips extra
|
| 249 |
+
// synchronization related steps from parallel variant (partitioning and taking locks).
|
| 250 |
+
//
|
| 251 |
+
enum class BloomFilterBuildStrategy {
|
| 252 |
+
SINGLE_THREADED = 0,
|
| 253 |
+
PARALLEL = 1,
|
| 254 |
+
};
|
| 255 |
+
|
| 256 |
+
class ARROW_ACERO_EXPORT BloomFilterBuilder {
|
| 257 |
+
public:
|
| 258 |
+
virtual ~BloomFilterBuilder() = default;
|
| 259 |
+
virtual Status Begin(size_t num_threads, int64_t hardware_flags, MemoryPool* pool,
|
| 260 |
+
int64_t num_rows, int64_t num_batches,
|
| 261 |
+
BlockedBloomFilter* build_target) = 0;
|
| 262 |
+
virtual int64_t num_tasks() const { return 0; }
|
| 263 |
+
virtual Status PushNextBatch(size_t thread_index, int64_t num_rows,
|
| 264 |
+
const uint32_t* hashes) = 0;
|
| 265 |
+
virtual Status PushNextBatch(size_t thread_index, int64_t num_rows,
|
| 266 |
+
const uint64_t* hashes) = 0;
|
| 267 |
+
virtual void CleanUp() {}
|
| 268 |
+
static std::unique_ptr<BloomFilterBuilder> Make(BloomFilterBuildStrategy strategy);
|
| 269 |
+
};
|
| 270 |
+
|
| 271 |
+
class ARROW_ACERO_EXPORT BloomFilterBuilder_SingleThreaded : public BloomFilterBuilder {
|
| 272 |
+
public:
|
| 273 |
+
Status Begin(size_t num_threads, int64_t hardware_flags, MemoryPool* pool,
|
| 274 |
+
int64_t num_rows, int64_t num_batches,
|
| 275 |
+
BlockedBloomFilter* build_target) override;
|
| 276 |
+
|
| 277 |
+
Status PushNextBatch(size_t /*thread_index*/, int64_t num_rows,
|
| 278 |
+
const uint32_t* hashes) override;
|
| 279 |
+
|
| 280 |
+
Status PushNextBatch(size_t /*thread_index*/, int64_t num_rows,
|
| 281 |
+
const uint64_t* hashes) override;
|
| 282 |
+
|
| 283 |
+
private:
|
| 284 |
+
template <typename T>
|
| 285 |
+
void PushNextBatchImp(int64_t num_rows, const T* hashes);
|
| 286 |
+
|
| 287 |
+
int64_t hardware_flags_;
|
| 288 |
+
BlockedBloomFilter* build_target_;
|
| 289 |
+
};
|
| 290 |
+
|
| 291 |
+
class ARROW_ACERO_EXPORT BloomFilterBuilder_Parallel : public BloomFilterBuilder {
|
| 292 |
+
public:
|
| 293 |
+
Status Begin(size_t num_threads, int64_t hardware_flags, MemoryPool* pool,
|
| 294 |
+
int64_t num_rows, int64_t num_batches,
|
| 295 |
+
BlockedBloomFilter* build_target) override;
|
| 296 |
+
|
| 297 |
+
Status PushNextBatch(size_t thread_id, int64_t num_rows,
|
| 298 |
+
const uint32_t* hashes) override;
|
| 299 |
+
|
| 300 |
+
Status PushNextBatch(size_t thread_id, int64_t num_rows,
|
| 301 |
+
const uint64_t* hashes) override;
|
| 302 |
+
|
| 303 |
+
void CleanUp() override;
|
| 304 |
+
|
| 305 |
+
private:
|
| 306 |
+
template <typename T>
|
| 307 |
+
void PushNextBatchImp(size_t thread_id, int64_t num_rows, const T* hashes);
|
| 308 |
+
|
| 309 |
+
int64_t hardware_flags_;
|
| 310 |
+
BlockedBloomFilter* build_target_;
|
| 311 |
+
int log_num_prtns_;
|
| 312 |
+
struct ThreadLocalState {
|
| 313 |
+
std::vector<uint32_t> partitioned_hashes_32;
|
| 314 |
+
std::vector<uint64_t> partitioned_hashes_64;
|
| 315 |
+
std::vector<uint16_t> partition_ranges;
|
| 316 |
+
std::vector<int> unprocessed_partition_ids;
|
| 317 |
+
};
|
| 318 |
+
std::vector<ThreadLocalState> thread_local_states_;
|
| 319 |
+
PartitionLocks prtn_locks_;
|
| 320 |
+
};
|
| 321 |
+
|
| 322 |
+
} // namespace acero
|
| 323 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/exec_plan.h
ADDED
|
@@ -0,0 +1,819 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstddef>
|
| 21 |
+
#include <cstdint>
|
| 22 |
+
#include <functional>
|
| 23 |
+
#include <memory>
|
| 24 |
+
#include <optional>
|
| 25 |
+
#include <string>
|
| 26 |
+
#include <utility>
|
| 27 |
+
#include <vector>
|
| 28 |
+
|
| 29 |
+
#include "arrow/acero/type_fwd.h"
|
| 30 |
+
#include "arrow/acero/visibility.h"
|
| 31 |
+
#include "arrow/compute/api_vector.h"
|
| 32 |
+
#include "arrow/compute/exec.h"
|
| 33 |
+
#include "arrow/compute/ordering.h"
|
| 34 |
+
#include "arrow/type_fwd.h"
|
| 35 |
+
#include "arrow/util/future.h"
|
| 36 |
+
#include "arrow/util/macros.h"
|
| 37 |
+
#include "arrow/util/tracing.h"
|
| 38 |
+
#include "arrow/util/type_fwd.h"
|
| 39 |
+
|
| 40 |
+
namespace arrow {
|
| 41 |
+
|
| 42 |
+
using compute::ExecBatch;
|
| 43 |
+
using compute::ExecContext;
|
| 44 |
+
using compute::FunctionRegistry;
|
| 45 |
+
using compute::GetFunctionRegistry;
|
| 46 |
+
using compute::Ordering;
|
| 47 |
+
using compute::threaded_exec_context;
|
| 48 |
+
|
| 49 |
+
namespace acero {
|
| 50 |
+
|
| 51 |
+
/// \addtogroup acero-internals
|
| 52 |
+
/// @{
|
| 53 |
+
|
| 54 |
+
class ARROW_ACERO_EXPORT ExecPlan : public std::enable_shared_from_this<ExecPlan> {
|
| 55 |
+
public:
|
| 56 |
+
// This allows operators to rely on signed 16-bit indices
|
| 57 |
+
static const uint32_t kMaxBatchSize = 1 << 15;
|
| 58 |
+
using NodeVector = std::vector<ExecNode*>;
|
| 59 |
+
|
| 60 |
+
virtual ~ExecPlan() = default;
|
| 61 |
+
|
| 62 |
+
QueryContext* query_context();
|
| 63 |
+
|
| 64 |
+
/// \brief retrieve the nodes in the plan
|
| 65 |
+
const NodeVector& nodes() const;
|
| 66 |
+
|
| 67 |
+
/// Make an empty exec plan
|
| 68 |
+
static Result<std::shared_ptr<ExecPlan>> Make(
|
| 69 |
+
QueryOptions options, ExecContext exec_context = *threaded_exec_context(),
|
| 70 |
+
std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
|
| 71 |
+
|
| 72 |
+
static Result<std::shared_ptr<ExecPlan>> Make(
|
| 73 |
+
ExecContext exec_context = *threaded_exec_context(),
|
| 74 |
+
std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
|
| 75 |
+
|
| 76 |
+
static Result<std::shared_ptr<ExecPlan>> Make(
|
| 77 |
+
QueryOptions options, ExecContext* exec_context,
|
| 78 |
+
std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
|
| 79 |
+
|
| 80 |
+
static Result<std::shared_ptr<ExecPlan>> Make(
|
| 81 |
+
ExecContext* exec_context,
|
| 82 |
+
std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
|
| 83 |
+
|
| 84 |
+
ExecNode* AddNode(std::unique_ptr<ExecNode> node);
|
| 85 |
+
|
| 86 |
+
template <typename Node, typename... Args>
|
| 87 |
+
Node* EmplaceNode(Args&&... args) {
|
| 88 |
+
std::unique_ptr<Node> node{new Node{std::forward<Args>(args)...}};
|
| 89 |
+
auto out = node.get();
|
| 90 |
+
AddNode(std::move(node));
|
| 91 |
+
return out;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
Status Validate();
|
| 95 |
+
|
| 96 |
+
/// \brief Start producing on all nodes
|
| 97 |
+
///
|
| 98 |
+
/// Nodes are started in reverse topological order, such that any node
|
| 99 |
+
/// is started before all of its inputs.
|
| 100 |
+
void StartProducing();
|
| 101 |
+
|
| 102 |
+
/// \brief Stop producing on all nodes
|
| 103 |
+
///
|
| 104 |
+
/// Triggers all sources to stop producing new data. In order to cleanly stop the plan
|
| 105 |
+
/// will continue to run any tasks that are already in progress. The caller should
|
| 106 |
+
/// still wait for `finished` to complete before destroying the plan.
|
| 107 |
+
void StopProducing();
|
| 108 |
+
|
| 109 |
+
/// \brief A future which will be marked finished when all tasks have finished.
|
| 110 |
+
Future<> finished();
|
| 111 |
+
|
| 112 |
+
/// \brief Return whether the plan has non-empty metadata
|
| 113 |
+
bool HasMetadata() const;
|
| 114 |
+
|
| 115 |
+
/// \brief Return the plan's attached metadata
|
| 116 |
+
std::shared_ptr<const KeyValueMetadata> metadata() const;
|
| 117 |
+
|
| 118 |
+
std::string ToString() const;
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
// Acero can be extended by providing custom implementations of ExecNode. The methods
|
| 122 |
+
// below are documented in detail and provide careful instruction on how to fulfill the
|
| 123 |
+
// ExecNode contract. It's suggested you familiarize yourself with the Acero
|
| 124 |
+
// documentation in the C++ user guide.
|
| 125 |
+
class ARROW_ACERO_EXPORT ExecNode {
|
| 126 |
+
public:
|
| 127 |
+
using NodeVector = std::vector<ExecNode*>;
|
| 128 |
+
|
| 129 |
+
virtual ~ExecNode() = default;
|
| 130 |
+
|
| 131 |
+
virtual const char* kind_name() const = 0;
|
| 132 |
+
|
| 133 |
+
// The number of inputs expected by this node
|
| 134 |
+
int num_inputs() const { return static_cast<int>(inputs_.size()); }
|
| 135 |
+
|
| 136 |
+
/// This node's predecessors in the exec plan
|
| 137 |
+
const NodeVector& inputs() const { return inputs_; }
|
| 138 |
+
|
| 139 |
+
/// True if the plan has no output schema (is a sink)
|
| 140 |
+
bool is_sink() const { return !output_schema_; }
|
| 141 |
+
|
| 142 |
+
/// \brief Labels identifying the function of each input.
|
| 143 |
+
const std::vector<std::string>& input_labels() const { return input_labels_; }
|
| 144 |
+
|
| 145 |
+
/// This node's successor in the exec plan
|
| 146 |
+
const ExecNode* output() const { return output_; }
|
| 147 |
+
|
| 148 |
+
/// The datatypes for batches produced by this node
|
| 149 |
+
const std::shared_ptr<Schema>& output_schema() const { return output_schema_; }
|
| 150 |
+
|
| 151 |
+
/// This node's exec plan
|
| 152 |
+
ExecPlan* plan() { return plan_; }
|
| 153 |
+
|
| 154 |
+
/// \brief An optional label, for display and debugging
|
| 155 |
+
///
|
| 156 |
+
/// There is no guarantee that this value is non-empty or unique.
|
| 157 |
+
const std::string& label() const { return label_; }
|
| 158 |
+
void SetLabel(std::string label) { label_ = std::move(label); }
|
| 159 |
+
|
| 160 |
+
virtual Status Validate() const;
|
| 161 |
+
|
| 162 |
+
/// \brief the ordering of the output batches
|
| 163 |
+
///
|
| 164 |
+
/// This does not guarantee the batches will be emitted by this node
|
| 165 |
+
/// in order. Instead it guarantees that the batches will have their
|
| 166 |
+
/// ExecBatch::index property set in a way that respects this ordering.
|
| 167 |
+
///
|
| 168 |
+
/// In other words, given the ordering {{"x", SortOrder::Ascending}} we
|
| 169 |
+
/// know that all values of x in a batch with index N will be less than
|
| 170 |
+
/// or equal to all values of x in a batch with index N+k (assuming k > 0).
|
| 171 |
+
/// Furthermore, we also know that values will be sorted within a batch.
|
| 172 |
+
/// Any row N will have a value of x that is less than the value for
|
| 173 |
+
/// any row N+k.
|
| 174 |
+
///
|
| 175 |
+
/// Note that an ordering can be both Ordering::Unordered and Ordering::Implicit.
|
| 176 |
+
/// A node's output should be marked Ordering::Unordered if the order is
|
| 177 |
+
/// non-deterministic. For example, a hash-join has no predictable output order.
|
| 178 |
+
///
|
| 179 |
+
/// If the ordering is Ordering::Implicit then there is a meaningful order but that
|
| 180 |
+
/// ordering is not represented by any column in the data. The most common case for
|
| 181 |
+
/// this is when reading data from an in-memory table. The data has an implicit "row
|
| 182 |
+
/// order" which is not necessarily represented in the data set.
|
| 183 |
+
///
|
| 184 |
+
/// A filter or project node will not modify the ordering. Nothing needs to be done
|
| 185 |
+
/// other than ensure the index assigned to output batches is the same as the
|
| 186 |
+
/// input batch that was mapped.
|
| 187 |
+
///
|
| 188 |
+
/// Other nodes may introduce order. For example, an order-by node will emit
|
| 189 |
+
/// a brand new ordering independent of the input ordering.
|
| 190 |
+
///
|
| 191 |
+
/// Finally, as described above, such as a hash-join or aggregation may may
|
| 192 |
+
/// destroy ordering (although these nodes could also choose to establish a
|
| 193 |
+
/// new ordering based on the hash keys).
|
| 194 |
+
///
|
| 195 |
+
/// Some nodes will require an ordering. For example, a fetch node or an
|
| 196 |
+
/// asof join node will only function if the input data is ordered (for fetch
|
| 197 |
+
/// it is enough to be implicitly ordered. For an asof join the ordering must
|
| 198 |
+
/// be explicit and compatible with the on key.)
|
| 199 |
+
///
|
| 200 |
+
/// Nodes that maintain ordering should be careful to avoid introducing gaps
|
| 201 |
+
/// in the batch index. This may require emitting empty batches in order to
|
| 202 |
+
/// maintain continuity.
|
| 203 |
+
virtual const Ordering& ordering() const;
|
| 204 |
+
|
| 205 |
+
/// Upstream API:
|
| 206 |
+
/// These functions are called by input nodes that want to inform this node
|
| 207 |
+
/// about an updated condition (a new input batch or an impending
|
| 208 |
+
/// end of stream).
|
| 209 |
+
///
|
| 210 |
+
/// Implementation rules:
|
| 211 |
+
/// - these may be called anytime after StartProducing() has succeeded
|
| 212 |
+
/// (and even during or after StopProducing())
|
| 213 |
+
/// - these may be called concurrently
|
| 214 |
+
/// - these are allowed to call back into PauseProducing(), ResumeProducing()
|
| 215 |
+
/// and StopProducing()
|
| 216 |
+
|
| 217 |
+
/// Transfer input batch to ExecNode
|
| 218 |
+
///
|
| 219 |
+
/// A node will typically perform some kind of operation on the batch
|
| 220 |
+
/// and then call InputReceived on its outputs with the result.
|
| 221 |
+
///
|
| 222 |
+
/// Other nodes may need to accumulate some number of inputs before any
|
| 223 |
+
/// output can be produced. These nodes will add the batch to some kind
|
| 224 |
+
/// of in-memory accumulation queue and return.
|
| 225 |
+
virtual Status InputReceived(ExecNode* input, ExecBatch batch) = 0;
|
| 226 |
+
|
| 227 |
+
/// Mark the inputs finished after the given number of batches.
|
| 228 |
+
///
|
| 229 |
+
/// This may be called before all inputs are received. This simply fixes
|
| 230 |
+
/// the total number of incoming batches for an input, so that the ExecNode
|
| 231 |
+
/// knows when it has received all input, regardless of order.
|
| 232 |
+
virtual Status InputFinished(ExecNode* input, int total_batches) = 0;
|
| 233 |
+
|
| 234 |
+
/// \brief Perform any needed initialization
|
| 235 |
+
///
|
| 236 |
+
/// This hook performs any actions in between creation of ExecPlan and the call to
|
| 237 |
+
/// StartProducing. An example could be Bloom filter pushdown. The order of ExecNodes
|
| 238 |
+
/// that executes this method is undefined, but the calls are made synchronously.
|
| 239 |
+
///
|
| 240 |
+
/// At this point a node can rely on all inputs & outputs (and the input schemas)
|
| 241 |
+
/// being well defined.
|
| 242 |
+
virtual Status Init();
|
| 243 |
+
|
| 244 |
+
/// Lifecycle API:
|
| 245 |
+
/// - start / stop to initiate and terminate production
|
| 246 |
+
/// - pause / resume to apply backpressure
|
| 247 |
+
///
|
| 248 |
+
/// Implementation rules:
|
| 249 |
+
/// - StartProducing() should not recurse into the inputs, as it is
|
| 250 |
+
/// handled by ExecPlan::StartProducing()
|
| 251 |
+
/// - PauseProducing(), ResumeProducing(), StopProducing() may be called
|
| 252 |
+
/// concurrently, potentially even before the call to StartProducing
|
| 253 |
+
/// has finished.
|
| 254 |
+
/// - PauseProducing(), ResumeProducing(), StopProducing() may be called
|
| 255 |
+
/// by the downstream nodes' InputReceived(), InputFinished() methods
|
| 256 |
+
///
|
| 257 |
+
/// StopProducing may be called due to an error, by the user (e.g. cancel), or
|
| 258 |
+
/// because a node has all the data it needs (e.g. limit, top-k on sorted data).
|
| 259 |
+
/// This means the method may be called multiple times and we have the following
|
| 260 |
+
/// additional rules
|
| 261 |
+
/// - StopProducing() must be idempotent
|
| 262 |
+
/// - StopProducing() must be forwarded to inputs (this is needed for the limit/top-k
|
| 263 |
+
/// case because we may not be stopping the entire plan)
|
| 264 |
+
|
| 265 |
+
// Right now, since synchronous calls happen in both directions (input to
|
| 266 |
+
// output and then output to input), a node must be careful to be reentrant
|
| 267 |
+
// against synchronous calls from its output, *and* also concurrent calls from
|
| 268 |
+
// other threads. The most reliable solution is to update the internal state
|
| 269 |
+
// first, and notify outputs only at the end.
|
| 270 |
+
//
|
| 271 |
+
// Concurrent calls to PauseProducing and ResumeProducing can be hard to sequence
|
| 272 |
+
// as they may travel at different speeds through the plan.
|
| 273 |
+
//
|
| 274 |
+
// For example, consider a resume that comes quickly after a pause. If the source
|
| 275 |
+
// receives the resume before the pause the source may think the destination is full
|
| 276 |
+
// and halt production which would lead to deadlock.
|
| 277 |
+
//
|
| 278 |
+
// To resolve this a counter is sent for all calls to pause/resume. Only the call with
|
| 279 |
+
// the highest counter value is valid. So if a call to PauseProducing(5) comes after
|
| 280 |
+
// a call to ResumeProducing(6) then the source should continue producing.
|
| 281 |
+
|
| 282 |
+
/// \brief Start producing
|
| 283 |
+
///
|
| 284 |
+
/// This must only be called once.
|
| 285 |
+
///
|
| 286 |
+
/// This is typically called automatically by ExecPlan::StartProducing().
|
| 287 |
+
virtual Status StartProducing() = 0;
|
| 288 |
+
|
| 289 |
+
/// \brief Pause producing temporarily
|
| 290 |
+
///
|
| 291 |
+
/// \param output Pointer to the output that is full
|
| 292 |
+
/// \param counter Counter used to sequence calls to pause/resume
|
| 293 |
+
///
|
| 294 |
+
/// This call is a hint that an output node is currently not willing
|
| 295 |
+
/// to receive data.
|
| 296 |
+
///
|
| 297 |
+
/// This may be called any number of times.
|
| 298 |
+
/// However, the node is still free to produce data (which may be difficult
|
| 299 |
+
/// to prevent anyway if data is produced using multiple threads).
|
| 300 |
+
virtual void PauseProducing(ExecNode* output, int32_t counter) = 0;
|
| 301 |
+
|
| 302 |
+
/// \brief Resume producing after a temporary pause
|
| 303 |
+
///
|
| 304 |
+
/// \param output Pointer to the output that is now free
|
| 305 |
+
/// \param counter Counter used to sequence calls to pause/resume
|
| 306 |
+
///
|
| 307 |
+
/// This call is a hint that an output node is willing to receive data again.
|
| 308 |
+
///
|
| 309 |
+
/// This may be called any number of times.
|
| 310 |
+
virtual void ResumeProducing(ExecNode* output, int32_t counter) = 0;
|
| 311 |
+
|
| 312 |
+
/// \brief Stop producing new data
|
| 313 |
+
///
|
| 314 |
+
/// If this node is a source then the source should stop generating data
|
| 315 |
+
/// as quickly as possible. If this node is not a source then there is typically
|
| 316 |
+
/// nothing that needs to be done although a node may choose to start ignoring incoming
|
| 317 |
+
/// data.
|
| 318 |
+
///
|
| 319 |
+
/// This method will be called when an error occurs in the plan
|
| 320 |
+
/// This method may also be called by the user if they wish to end a plan early
|
| 321 |
+
/// Finally, this method may be called if a node determines it no longer needs any more
|
| 322 |
+
/// input (for example, a limit node).
|
| 323 |
+
///
|
| 324 |
+
/// This method may be called multiple times.
|
| 325 |
+
///
|
| 326 |
+
/// This is not a pause. There will be no way to start the source again after this has
|
| 327 |
+
/// been called.
|
| 328 |
+
virtual Status StopProducing();
|
| 329 |
+
|
| 330 |
+
std::string ToString(int indent = 0) const;
|
| 331 |
+
|
| 332 |
+
protected:
|
| 333 |
+
ExecNode(ExecPlan* plan, NodeVector inputs, std::vector<std::string> input_labels,
|
| 334 |
+
std::shared_ptr<Schema> output_schema);
|
| 335 |
+
|
| 336 |
+
virtual Status StopProducingImpl() = 0;
|
| 337 |
+
|
| 338 |
+
/// Provide extra info to include in the string representation.
|
| 339 |
+
virtual std::string ToStringExtra(int indent = 0) const;
|
| 340 |
+
|
| 341 |
+
std::atomic<bool> stopped_;
|
| 342 |
+
ExecPlan* plan_;
|
| 343 |
+
std::string label_;
|
| 344 |
+
|
| 345 |
+
NodeVector inputs_;
|
| 346 |
+
std::vector<std::string> input_labels_;
|
| 347 |
+
|
| 348 |
+
std::shared_ptr<Schema> output_schema_;
|
| 349 |
+
ExecNode* output_ = NULLPTR;
|
| 350 |
+
};
|
| 351 |
+
|
| 352 |
+
/// \brief An extensible registry for factories of ExecNodes
|
| 353 |
+
class ARROW_ACERO_EXPORT ExecFactoryRegistry {
|
| 354 |
+
public:
|
| 355 |
+
using Factory = std::function<Result<ExecNode*>(ExecPlan*, std::vector<ExecNode*>,
|
| 356 |
+
const ExecNodeOptions&)>;
|
| 357 |
+
|
| 358 |
+
virtual ~ExecFactoryRegistry() = default;
|
| 359 |
+
|
| 360 |
+
/// \brief Get the named factory from this registry
|
| 361 |
+
///
|
| 362 |
+
/// will raise if factory_name is not found
|
| 363 |
+
virtual Result<Factory> GetFactory(const std::string& factory_name) = 0;
|
| 364 |
+
|
| 365 |
+
/// \brief Add a factory to this registry with the provided name
|
| 366 |
+
///
|
| 367 |
+
/// will raise if factory_name is already in the registry
|
| 368 |
+
virtual Status AddFactory(std::string factory_name, Factory factory) = 0;
|
| 369 |
+
};
|
| 370 |
+
|
| 371 |
+
/// The default registry, which includes built-in factories.
|
| 372 |
+
ARROW_ACERO_EXPORT
|
| 373 |
+
ExecFactoryRegistry* default_exec_factory_registry();
|
| 374 |
+
|
| 375 |
+
/// \brief Construct an ExecNode using the named factory
|
| 376 |
+
inline Result<ExecNode*> MakeExecNode(
|
| 377 |
+
const std::string& factory_name, ExecPlan* plan, std::vector<ExecNode*> inputs,
|
| 378 |
+
const ExecNodeOptions& options,
|
| 379 |
+
ExecFactoryRegistry* registry = default_exec_factory_registry()) {
|
| 380 |
+
ARROW_ASSIGN_OR_RAISE(auto factory, registry->GetFactory(factory_name));
|
| 381 |
+
return factory(plan, std::move(inputs), options);
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
/// @}
|
| 385 |
+
|
| 386 |
+
/// \addtogroup acero-api
|
| 387 |
+
/// @{
|
| 388 |
+
|
| 389 |
+
/// \brief Helper class for declaring execution nodes
|
| 390 |
+
///
|
| 391 |
+
/// A Declaration represents an unconstructed ExecNode (and potentially an entire graph
|
| 392 |
+
/// since its inputs may also be Declarations)
|
| 393 |
+
///
|
| 394 |
+
/// A Declaration can be converted to a plan and executed using one of the
|
| 395 |
+
/// DeclarationToXyz methods.
|
| 396 |
+
///
|
| 397 |
+
/// For more direct control, a Declaration can be added to an existing execution
|
| 398 |
+
/// plan with Declaration::AddToPlan, which will recursively construct any inputs as
|
| 399 |
+
/// necessary.
|
| 400 |
+
struct ARROW_ACERO_EXPORT Declaration {
|
| 401 |
+
using Input = std::variant<ExecNode*, Declaration>;
|
| 402 |
+
|
| 403 |
+
Declaration() {}
|
| 404 |
+
|
| 405 |
+
/// \brief construct a declaration
|
| 406 |
+
/// \param factory_name the name of the exec node to construct. The node must have
|
| 407 |
+
/// been added to the exec node registry with this name.
|
| 408 |
+
/// \param inputs the inputs to the node, these should be other declarations
|
| 409 |
+
/// \param options options that control the behavior of the node. You must use
|
| 410 |
+
/// the appropriate subclass. For example, if `factory_name` is
|
| 411 |
+
/// "project" then `options` should be ProjectNodeOptions.
|
| 412 |
+
/// \param label a label to give the node. Can be used to distinguish it from other
|
| 413 |
+
/// nodes of the same type in the plan.
|
| 414 |
+
Declaration(std::string factory_name, std::vector<Input> inputs,
|
| 415 |
+
std::shared_ptr<ExecNodeOptions> options, std::string label)
|
| 416 |
+
: factory_name{std::move(factory_name)},
|
| 417 |
+
inputs{std::move(inputs)},
|
| 418 |
+
options{std::move(options)},
|
| 419 |
+
label{std::move(label)} {}
|
| 420 |
+
|
| 421 |
+
template <typename Options>
|
| 422 |
+
Declaration(std::string factory_name, std::vector<Input> inputs, Options options,
|
| 423 |
+
std::string label)
|
| 424 |
+
: Declaration{std::move(factory_name), std::move(inputs),
|
| 425 |
+
std::shared_ptr<ExecNodeOptions>(
|
| 426 |
+
std::make_shared<Options>(std::move(options))),
|
| 427 |
+
std::move(label)} {}
|
| 428 |
+
|
| 429 |
+
template <typename Options>
|
| 430 |
+
Declaration(std::string factory_name, std::vector<Input> inputs, Options options)
|
| 431 |
+
: Declaration{std::move(factory_name), std::move(inputs), std::move(options),
|
| 432 |
+
/*label=*/""} {}
|
| 433 |
+
|
| 434 |
+
template <typename Options>
|
| 435 |
+
Declaration(std::string factory_name, Options options)
|
| 436 |
+
: Declaration{std::move(factory_name), {}, std::move(options), /*label=*/""} {}
|
| 437 |
+
|
| 438 |
+
template <typename Options>
|
| 439 |
+
Declaration(std::string factory_name, Options options, std::string label)
|
| 440 |
+
: Declaration{std::move(factory_name), {}, std::move(options), std::move(label)} {}
|
| 441 |
+
|
| 442 |
+
/// \brief Convenience factory for the common case of a simple sequence of nodes.
|
| 443 |
+
///
|
| 444 |
+
/// Each of decls will be appended to the inputs of the subsequent declaration,
|
| 445 |
+
/// and the final modified declaration will be returned.
|
| 446 |
+
///
|
| 447 |
+
/// Without this convenience factory, constructing a sequence would require explicit,
|
| 448 |
+
/// difficult-to-read nesting:
|
| 449 |
+
///
|
| 450 |
+
/// Declaration{"n3",
|
| 451 |
+
/// {
|
| 452 |
+
/// Declaration{"n2",
|
| 453 |
+
/// {
|
| 454 |
+
/// Declaration{"n1",
|
| 455 |
+
/// {
|
| 456 |
+
/// Declaration{"n0", N0Opts{}},
|
| 457 |
+
/// },
|
| 458 |
+
/// N1Opts{}},
|
| 459 |
+
/// },
|
| 460 |
+
/// N2Opts{}},
|
| 461 |
+
/// },
|
| 462 |
+
/// N3Opts{}};
|
| 463 |
+
///
|
| 464 |
+
/// An equivalent Declaration can be constructed more tersely using Sequence:
|
| 465 |
+
///
|
| 466 |
+
/// Declaration::Sequence({
|
| 467 |
+
/// {"n0", N0Opts{}},
|
| 468 |
+
/// {"n1", N1Opts{}},
|
| 469 |
+
/// {"n2", N2Opts{}},
|
| 470 |
+
/// {"n3", N3Opts{}},
|
| 471 |
+
/// });
|
| 472 |
+
static Declaration Sequence(std::vector<Declaration> decls);
|
| 473 |
+
|
| 474 |
+
/// \brief add the declaration to an already created execution plan
|
| 475 |
+
/// \param plan the plan to add the node to
|
| 476 |
+
/// \param registry the registry to use to lookup the node factory
|
| 477 |
+
///
|
| 478 |
+
/// This method will recursively call AddToPlan on all of the declaration's inputs.
|
| 479 |
+
/// This method is only for advanced use when the DeclarationToXyz methods are not
|
| 480 |
+
/// sufficient.
|
| 481 |
+
///
|
| 482 |
+
/// \return the instantiated execution node
|
| 483 |
+
Result<ExecNode*> AddToPlan(ExecPlan* plan, ExecFactoryRegistry* registry =
|
| 484 |
+
default_exec_factory_registry()) const;
|
| 485 |
+
|
| 486 |
+
// Validate a declaration
|
| 487 |
+
bool IsValid(ExecFactoryRegistry* registry = default_exec_factory_registry()) const;
|
| 488 |
+
|
| 489 |
+
/// \brief the name of the factory to use when creating a node
|
| 490 |
+
std::string factory_name;
|
| 491 |
+
/// \brief the declarations's inputs
|
| 492 |
+
std::vector<Input> inputs;
|
| 493 |
+
/// \brief options to control the behavior of the node
|
| 494 |
+
std::shared_ptr<ExecNodeOptions> options;
|
| 495 |
+
/// \brief a label to give the node in the plan
|
| 496 |
+
std::string label;
|
| 497 |
+
};
|
| 498 |
+
|
| 499 |
+
/// \brief How to handle unaligned buffers
|
| 500 |
+
enum class UnalignedBufferHandling { kWarn, kIgnore, kReallocate, kError };
|
| 501 |
+
|
| 502 |
+
/// \brief get the default behavior of unaligned buffer handling
|
| 503 |
+
///
|
| 504 |
+
/// This is configurable via the ACERO_ALIGNMENT_HANDLING environment variable which
|
| 505 |
+
/// can be set to "warn", "ignore", "reallocate", or "error". If the environment
|
| 506 |
+
/// variable is not set, or is set to an invalid value, this will return kWarn
|
| 507 |
+
UnalignedBufferHandling GetDefaultUnalignedBufferHandling();
|
| 508 |
+
|
| 509 |
+
/// \brief plan-wide options that can be specified when executing an execution plan
|
| 510 |
+
struct ARROW_ACERO_EXPORT QueryOptions {
|
| 511 |
+
/// \brief Should the plan use a legacy batching strategy
|
| 512 |
+
///
|
| 513 |
+
/// This is currently in place only to support the Scanner::ToTable
|
| 514 |
+
/// method. This method relies on batch indices from the scanner
|
| 515 |
+
/// remaining consistent. This is impractical in the ExecPlan which
|
| 516 |
+
/// might slice batches as needed (e.g. for a join)
|
| 517 |
+
///
|
| 518 |
+
/// However, it still works for simple plans and this is the only way
|
| 519 |
+
/// we have at the moment for maintaining implicit order.
|
| 520 |
+
bool use_legacy_batching = false;
|
| 521 |
+
|
| 522 |
+
/// If the output has a meaningful order then sequence the output of the plan
|
| 523 |
+
///
|
| 524 |
+
/// The default behavior (std::nullopt) will sequence output batches if there
|
| 525 |
+
/// is a meaningful ordering in the final node and will emit batches immediately
|
| 526 |
+
/// otherwise.
|
| 527 |
+
///
|
| 528 |
+
/// If explicitly set to true then plan execution will fail if there is no
|
| 529 |
+
/// meaningful ordering. This can be useful to validate a query that should
|
| 530 |
+
/// be emitting ordered results.
|
| 531 |
+
///
|
| 532 |
+
/// If explicitly set to false then batches will be emit immediately even if there
|
| 533 |
+
/// is a meaningful ordering. This could cause batches to be emit out of order but
|
| 534 |
+
/// may offer a small decrease to latency.
|
| 535 |
+
std::optional<bool> sequence_output = std::nullopt;
|
| 536 |
+
|
| 537 |
+
/// \brief should the plan use multiple background threads for CPU-intensive work
|
| 538 |
+
///
|
| 539 |
+
/// If this is false then all CPU work will be done on the calling thread. I/O tasks
|
| 540 |
+
/// will still happen on the I/O executor and may be multi-threaded (but should not use
|
| 541 |
+
/// significant CPU resources).
|
| 542 |
+
///
|
| 543 |
+
/// Will be ignored if custom_cpu_executor is set
|
| 544 |
+
bool use_threads = true;
|
| 545 |
+
|
| 546 |
+
/// \brief custom executor to use for CPU-intensive work
|
| 547 |
+
///
|
| 548 |
+
/// Must be null or remain valid for the duration of the plan. If this is null then
|
| 549 |
+
/// a default thread pool will be chosen whose behavior will be controlled by
|
| 550 |
+
/// the `use_threads` option.
|
| 551 |
+
::arrow::internal::Executor* custom_cpu_executor = NULLPTR;
|
| 552 |
+
|
| 553 |
+
/// \brief custom executor to use for IO work
|
| 554 |
+
///
|
| 555 |
+
/// Must be null or remain valid for the duration of the plan. If this is null then
|
| 556 |
+
/// the global io thread pool will be chosen whose behavior will be controlled by
|
| 557 |
+
/// the "ARROW_IO_THREADS" environment.
|
| 558 |
+
::arrow::internal::Executor* custom_io_executor = NULLPTR;
|
| 559 |
+
|
| 560 |
+
/// \brief a memory pool to use for allocations
|
| 561 |
+
///
|
| 562 |
+
/// Must remain valid for the duration of the plan.
|
| 563 |
+
MemoryPool* memory_pool = default_memory_pool();
|
| 564 |
+
|
| 565 |
+
/// \brief a function registry to use for the plan
|
| 566 |
+
///
|
| 567 |
+
/// Must remain valid for the duration of the plan.
|
| 568 |
+
FunctionRegistry* function_registry = GetFunctionRegistry();
|
| 569 |
+
/// \brief the names of the output columns
|
| 570 |
+
///
|
| 571 |
+
/// If this is empty then names will be generated based on the input columns
|
| 572 |
+
///
|
| 573 |
+
/// If set then the number of names must equal the number of output columns
|
| 574 |
+
std::vector<std::string> field_names;
|
| 575 |
+
|
| 576 |
+
/// \brief Policy for unaligned buffers in source data
|
| 577 |
+
///
|
| 578 |
+
/// Various compute functions and acero internals will type pun array
|
| 579 |
+
/// buffers from uint8_t* to some kind of value type (e.g. we might
|
| 580 |
+
/// cast to int32_t* to add two int32 arrays)
|
| 581 |
+
///
|
| 582 |
+
/// If the buffer is poorly aligned (e.g. an int32 array is not aligned
|
| 583 |
+
/// on a 4-byte boundary) then this is technically undefined behavior in C++.
|
| 584 |
+
/// However, most modern compilers and CPUs are fairly tolerant of this
|
| 585 |
+
/// behavior and nothing bad (beyond a small hit to performance) is likely
|
| 586 |
+
/// to happen.
|
| 587 |
+
///
|
| 588 |
+
/// Note that this only applies to source buffers. All buffers allocated internally
|
| 589 |
+
/// by Acero will be suitably aligned.
|
| 590 |
+
///
|
| 591 |
+
/// If this field is set to kWarn then Acero will check if any buffers are unaligned
|
| 592 |
+
/// and, if they are, will emit a warning.
|
| 593 |
+
///
|
| 594 |
+
/// If this field is set to kReallocate then Acero will allocate a new, suitably aligned
|
| 595 |
+
/// buffer and copy the contents from the old buffer into this new buffer.
|
| 596 |
+
///
|
| 597 |
+
/// If this field is set to kError then Acero will gracefully abort the plan instead.
|
| 598 |
+
///
|
| 599 |
+
/// If this field is set to kIgnore then Acero will not even check if the buffers are
|
| 600 |
+
/// unaligned.
|
| 601 |
+
///
|
| 602 |
+
/// If this field is not set then it will be treated as kWarn unless overridden
|
| 603 |
+
/// by the ACERO_ALIGNMENT_HANDLING environment variable
|
| 604 |
+
std::optional<UnalignedBufferHandling> unaligned_buffer_handling;
|
| 605 |
+
};
|
| 606 |
+
|
| 607 |
+
/// \brief Calculate the output schema of a declaration
|
| 608 |
+
///
|
| 609 |
+
/// This does not actually execute the plan. This operation may fail if the
|
| 610 |
+
/// declaration represents an invalid plan (e.g. a project node with multiple inputs)
|
| 611 |
+
///
|
| 612 |
+
/// \param declaration A declaration describing an execution plan
|
| 613 |
+
/// \param function_registry The function registry to use for function execution. If null
|
| 614 |
+
/// then the default function registry will be used.
|
| 615 |
+
///
|
| 616 |
+
/// \return the schema that batches would have after going through the execution plan
|
| 617 |
+
ARROW_ACERO_EXPORT Result<std::shared_ptr<Schema>> DeclarationToSchema(
|
| 618 |
+
const Declaration& declaration, FunctionRegistry* function_registry = NULLPTR);
|
| 619 |
+
|
| 620 |
+
/// \brief Create a string representation of a plan
|
| 621 |
+
///
|
| 622 |
+
/// This representation is for debug purposes only.
|
| 623 |
+
///
|
| 624 |
+
/// Conversion to a string may fail if the declaration represents an
|
| 625 |
+
/// invalid plan.
|
| 626 |
+
///
|
| 627 |
+
/// Use Substrait for complete serialization of plans
|
| 628 |
+
///
|
| 629 |
+
/// \param declaration A declaration describing an execution plan
|
| 630 |
+
/// \param function_registry The function registry to use for function execution. If null
|
| 631 |
+
/// then the default function registry will be used.
|
| 632 |
+
///
|
| 633 |
+
/// \return a string representation of the plan suitable for debugging output
|
| 634 |
+
ARROW_ACERO_EXPORT Result<std::string> DeclarationToString(
|
| 635 |
+
const Declaration& declaration, FunctionRegistry* function_registry = NULLPTR);
|
| 636 |
+
|
| 637 |
+
/// \brief Utility method to run a declaration and collect the results into a table
|
| 638 |
+
///
|
| 639 |
+
/// \param declaration A declaration describing the plan to run
|
| 640 |
+
/// \param use_threads If `use_threads` is false then all CPU work will be done on the
|
| 641 |
+
/// calling thread. I/O tasks will still happen on the I/O executor
|
| 642 |
+
/// and may be multi-threaded (but should not use significant CPU
|
| 643 |
+
/// resources).
|
| 644 |
+
/// \param memory_pool The memory pool to use for allocations made while running the plan.
|
| 645 |
+
/// \param function_registry The function registry to use for function execution. If null
|
| 646 |
+
/// then the default function registry will be used.
|
| 647 |
+
///
|
| 648 |
+
/// This method will add a sink node to the declaration to collect results into a
|
| 649 |
+
/// table. It will then create an ExecPlan from the declaration, start the exec plan,
|
| 650 |
+
/// block until the plan has finished, and return the created table.
|
| 651 |
+
ARROW_ACERO_EXPORT Result<std::shared_ptr<Table>> DeclarationToTable(
|
| 652 |
+
Declaration declaration, bool use_threads = true,
|
| 653 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 654 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 655 |
+
|
| 656 |
+
ARROW_ACERO_EXPORT Result<std::shared_ptr<Table>> DeclarationToTable(
|
| 657 |
+
Declaration declaration, QueryOptions query_options);
|
| 658 |
+
|
| 659 |
+
/// \brief Asynchronous version of \see DeclarationToTable
|
| 660 |
+
///
|
| 661 |
+
/// \param declaration A declaration describing the plan to run
|
| 662 |
+
/// \param use_threads The behavior of use_threads is slightly different than the
|
| 663 |
+
/// synchronous version since we cannot run synchronously on the
|
| 664 |
+
/// calling thread. Instead, if use_threads=false then a new thread
|
| 665 |
+
/// pool will be created with a single thread and this will be used for
|
| 666 |
+
/// all compute work.
|
| 667 |
+
/// \param memory_pool The memory pool to use for allocations made while running the plan.
|
| 668 |
+
/// \param function_registry The function registry to use for function execution. If null
|
| 669 |
+
/// then the default function registry will be used.
|
| 670 |
+
ARROW_ACERO_EXPORT Future<std::shared_ptr<Table>> DeclarationToTableAsync(
|
| 671 |
+
Declaration declaration, bool use_threads = true,
|
| 672 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 673 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 674 |
+
|
| 675 |
+
/// \brief Overload of \see DeclarationToTableAsync accepting a custom exec context
|
| 676 |
+
///
|
| 677 |
+
/// The executor must be specified (cannot be null) and must be kept alive until the
|
| 678 |
+
/// returned future finishes.
|
| 679 |
+
ARROW_ACERO_EXPORT Future<std::shared_ptr<Table>> DeclarationToTableAsync(
|
| 680 |
+
Declaration declaration, ExecContext custom_exec_context);
|
| 681 |
+
|
| 682 |
+
/// \brief a collection of exec batches with a common schema
|
| 683 |
+
struct BatchesWithCommonSchema {
|
| 684 |
+
std::vector<ExecBatch> batches;
|
| 685 |
+
std::shared_ptr<Schema> schema;
|
| 686 |
+
};
|
| 687 |
+
|
| 688 |
+
/// \brief Utility method to run a declaration and collect the results into ExecBatch
|
| 689 |
+
/// vector
|
| 690 |
+
///
|
| 691 |
+
/// \see DeclarationToTable for details on threading & execution
|
| 692 |
+
ARROW_ACERO_EXPORT Result<BatchesWithCommonSchema> DeclarationToExecBatches(
|
| 693 |
+
Declaration declaration, bool use_threads = true,
|
| 694 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 695 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 696 |
+
|
| 697 |
+
ARROW_ACERO_EXPORT Result<BatchesWithCommonSchema> DeclarationToExecBatches(
|
| 698 |
+
Declaration declaration, QueryOptions query_options);
|
| 699 |
+
|
| 700 |
+
/// \brief Asynchronous version of \see DeclarationToExecBatches
|
| 701 |
+
///
|
| 702 |
+
/// \see DeclarationToTableAsync for details on threading & execution
|
| 703 |
+
ARROW_ACERO_EXPORT Future<BatchesWithCommonSchema> DeclarationToExecBatchesAsync(
|
| 704 |
+
Declaration declaration, bool use_threads = true,
|
| 705 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 706 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 707 |
+
|
| 708 |
+
/// \brief Overload of \see DeclarationToExecBatchesAsync accepting a custom exec context
|
| 709 |
+
///
|
| 710 |
+
/// \see DeclarationToTableAsync for details on threading & execution
|
| 711 |
+
ARROW_ACERO_EXPORT Future<BatchesWithCommonSchema> DeclarationToExecBatchesAsync(
|
| 712 |
+
Declaration declaration, ExecContext custom_exec_context);
|
| 713 |
+
|
| 714 |
+
/// \brief Utility method to run a declaration and collect the results into a vector
|
| 715 |
+
///
|
| 716 |
+
/// \see DeclarationToTable for details on threading & execution
|
| 717 |
+
ARROW_ACERO_EXPORT Result<std::vector<std::shared_ptr<RecordBatch>>> DeclarationToBatches(
|
| 718 |
+
Declaration declaration, bool use_threads = true,
|
| 719 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 720 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 721 |
+
|
| 722 |
+
ARROW_ACERO_EXPORT Result<std::vector<std::shared_ptr<RecordBatch>>> DeclarationToBatches(
|
| 723 |
+
Declaration declaration, QueryOptions query_options);
|
| 724 |
+
|
| 725 |
+
/// \brief Asynchronous version of \see DeclarationToBatches
|
| 726 |
+
///
|
| 727 |
+
/// \see DeclarationToTableAsync for details on threading & execution
|
| 728 |
+
ARROW_ACERO_EXPORT Future<std::vector<std::shared_ptr<RecordBatch>>>
|
| 729 |
+
DeclarationToBatchesAsync(Declaration declaration, bool use_threads = true,
|
| 730 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 731 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 732 |
+
|
| 733 |
+
/// \brief Overload of \see DeclarationToBatchesAsync accepting a custom exec context
|
| 734 |
+
///
|
| 735 |
+
/// \see DeclarationToTableAsync for details on threading & execution
|
| 736 |
+
ARROW_ACERO_EXPORT Future<std::vector<std::shared_ptr<RecordBatch>>>
|
| 737 |
+
DeclarationToBatchesAsync(Declaration declaration, ExecContext exec_context);
|
| 738 |
+
|
| 739 |
+
/// \brief Utility method to run a declaration and return results as a RecordBatchReader
|
| 740 |
+
///
|
| 741 |
+
/// If an exec context is not provided then a default exec context will be used based
|
| 742 |
+
/// on the value of `use_threads`. If `use_threads` is false then the CPU executor will
|
| 743 |
+
/// be a serial executor and all CPU work will be done on the calling thread. I/O tasks
|
| 744 |
+
/// will still happen on the I/O executor and may be multi-threaded.
|
| 745 |
+
///
|
| 746 |
+
/// If `use_threads` is false then all CPU work will happen during the calls to
|
| 747 |
+
/// RecordBatchReader::Next and no CPU work will happen in the background. If
|
| 748 |
+
/// `use_threads` is true then CPU work will happen on the CPU thread pool and tasks may
|
| 749 |
+
/// run in between calls to RecordBatchReader::Next. If the returned reader is not
|
| 750 |
+
/// consumed quickly enough then the plan will eventually pause as the backpressure queue
|
| 751 |
+
/// fills up.
|
| 752 |
+
///
|
| 753 |
+
/// If a custom exec context is provided then the value of `use_threads` will be ignored.
|
| 754 |
+
///
|
| 755 |
+
/// The returned RecordBatchReader can be closed early to cancel the computation of record
|
| 756 |
+
/// batches. In this case, only errors encountered by the computation may be reported. In
|
| 757 |
+
/// particular, no cancellation error may be reported.
|
| 758 |
+
ARROW_ACERO_EXPORT Result<std::unique_ptr<RecordBatchReader>> DeclarationToReader(
|
| 759 |
+
Declaration declaration, bool use_threads = true,
|
| 760 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 761 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 762 |
+
|
| 763 |
+
ARROW_ACERO_EXPORT Result<std::unique_ptr<RecordBatchReader>> DeclarationToReader(
|
| 764 |
+
Declaration declaration, QueryOptions query_options);
|
| 765 |
+
|
| 766 |
+
/// \brief Utility method to run a declaration and ignore results
|
| 767 |
+
///
|
| 768 |
+
/// This can be useful when the data are consumed as part of the plan itself, for
|
| 769 |
+
/// example, when the plan ends with a write node.
|
| 770 |
+
///
|
| 771 |
+
/// \see DeclarationToTable for details on threading & execution
|
| 772 |
+
ARROW_ACERO_EXPORT Status
|
| 773 |
+
DeclarationToStatus(Declaration declaration, bool use_threads = true,
|
| 774 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 775 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 776 |
+
|
| 777 |
+
ARROW_ACERO_EXPORT Status DeclarationToStatus(Declaration declaration,
|
| 778 |
+
QueryOptions query_options);
|
| 779 |
+
|
| 780 |
+
/// \brief Asynchronous version of \see DeclarationToStatus
|
| 781 |
+
///
|
| 782 |
+
/// This can be useful when the data are consumed as part of the plan itself, for
|
| 783 |
+
/// example, when the plan ends with a write node.
|
| 784 |
+
///
|
| 785 |
+
/// \see DeclarationToTableAsync for details on threading & execution
|
| 786 |
+
ARROW_ACERO_EXPORT Future<> DeclarationToStatusAsync(
|
| 787 |
+
Declaration declaration, bool use_threads = true,
|
| 788 |
+
MemoryPool* memory_pool = default_memory_pool(),
|
| 789 |
+
FunctionRegistry* function_registry = NULLPTR);
|
| 790 |
+
|
| 791 |
+
/// \brief Overload of \see DeclarationToStatusAsync accepting a custom exec context
|
| 792 |
+
///
|
| 793 |
+
/// \see DeclarationToTableAsync for details on threading & execution
|
| 794 |
+
ARROW_ACERO_EXPORT Future<> DeclarationToStatusAsync(Declaration declaration,
|
| 795 |
+
ExecContext exec_context);
|
| 796 |
+
|
| 797 |
+
/// @}
|
| 798 |
+
|
| 799 |
+
/// \brief Wrap an ExecBatch generator in a RecordBatchReader.
|
| 800 |
+
///
|
| 801 |
+
/// The RecordBatchReader does not impose any ordering on emitted batches.
|
| 802 |
+
ARROW_ACERO_EXPORT
|
| 803 |
+
std::shared_ptr<RecordBatchReader> MakeGeneratorReader(
|
| 804 |
+
std::shared_ptr<Schema>, std::function<Future<std::optional<ExecBatch>>()>,
|
| 805 |
+
MemoryPool*);
|
| 806 |
+
|
| 807 |
+
constexpr int kDefaultBackgroundMaxQ = 32;
|
| 808 |
+
constexpr int kDefaultBackgroundQRestart = 16;
|
| 809 |
+
|
| 810 |
+
/// \brief Make a generator of RecordBatchReaders
|
| 811 |
+
///
|
| 812 |
+
/// Useful as a source node for an Exec plan
|
| 813 |
+
ARROW_ACERO_EXPORT
|
| 814 |
+
Result<std::function<Future<std::optional<ExecBatch>>()>> MakeReaderGenerator(
|
| 815 |
+
std::shared_ptr<RecordBatchReader> reader, arrow::internal::Executor* io_executor,
|
| 816 |
+
int max_q = kDefaultBackgroundMaxQ, int q_restart = kDefaultBackgroundQRestart);
|
| 817 |
+
|
| 818 |
+
} // namespace acero
|
| 819 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/hash_join.h
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <functional>
|
| 21 |
+
#include <memory>
|
| 22 |
+
#include <vector>
|
| 23 |
+
|
| 24 |
+
#include "arrow/acero/accumulation_queue.h"
|
| 25 |
+
#include "arrow/acero/bloom_filter.h"
|
| 26 |
+
#include "arrow/acero/options.h"
|
| 27 |
+
#include "arrow/acero/query_context.h"
|
| 28 |
+
#include "arrow/acero/schema_util.h"
|
| 29 |
+
#include "arrow/acero/task_util.h"
|
| 30 |
+
#include "arrow/result.h"
|
| 31 |
+
#include "arrow/status.h"
|
| 32 |
+
#include "arrow/type.h"
|
| 33 |
+
#include "arrow/util/tracing.h"
|
| 34 |
+
|
| 35 |
+
namespace arrow {
|
| 36 |
+
namespace acero {
|
| 37 |
+
|
| 38 |
+
using util::AccumulationQueue;
|
| 39 |
+
|
| 40 |
+
class ARROW_ACERO_EXPORT HashJoinImpl {
|
| 41 |
+
public:
|
| 42 |
+
using OutputBatchCallback = std::function<Status(int64_t, ExecBatch)>;
|
| 43 |
+
using BuildFinishedCallback = std::function<Status(size_t)>;
|
| 44 |
+
using FinishedCallback = std::function<Status(int64_t)>;
|
| 45 |
+
using RegisterTaskGroupCallback = std::function<int(
|
| 46 |
+
std::function<Status(size_t, int64_t)>, std::function<Status(size_t)>)>;
|
| 47 |
+
using StartTaskGroupCallback = std::function<Status(int, int64_t)>;
|
| 48 |
+
using AbortContinuationImpl = std::function<void()>;
|
| 49 |
+
|
| 50 |
+
virtual ~HashJoinImpl() = default;
|
| 51 |
+
virtual Status Init(QueryContext* ctx, JoinType join_type, size_t num_threads,
|
| 52 |
+
const HashJoinProjectionMaps* proj_map_left,
|
| 53 |
+
const HashJoinProjectionMaps* proj_map_right,
|
| 54 |
+
std::vector<JoinKeyCmp> key_cmp, Expression filter,
|
| 55 |
+
RegisterTaskGroupCallback register_task_group_callback,
|
| 56 |
+
StartTaskGroupCallback start_task_group_callback,
|
| 57 |
+
OutputBatchCallback output_batch_callback,
|
| 58 |
+
FinishedCallback finished_callback) = 0;
|
| 59 |
+
|
| 60 |
+
virtual Status BuildHashTable(size_t thread_index, AccumulationQueue batches,
|
| 61 |
+
BuildFinishedCallback on_finished) = 0;
|
| 62 |
+
virtual Status ProbeSingleBatch(size_t thread_index, ExecBatch batch) = 0;
|
| 63 |
+
virtual Status ProbingFinished(size_t thread_index) = 0;
|
| 64 |
+
virtual void Abort(TaskScheduler::AbortContinuationImpl pos_abort_callback) = 0;
|
| 65 |
+
virtual std::string ToString() const = 0;
|
| 66 |
+
|
| 67 |
+
static Result<std::unique_ptr<HashJoinImpl>> MakeBasic();
|
| 68 |
+
static Result<std::unique_ptr<HashJoinImpl>> MakeSwiss();
|
| 69 |
+
|
| 70 |
+
protected:
|
| 71 |
+
arrow::util::tracing::Span span_;
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
} // namespace acero
|
| 75 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/hash_join_dict.h
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <memory>
|
| 21 |
+
#include <unordered_map>
|
| 22 |
+
|
| 23 |
+
#include "arrow/acero/schema_util.h"
|
| 24 |
+
#include "arrow/compute/exec.h"
|
| 25 |
+
#include "arrow/compute/row/row_encoder_internal.h"
|
| 26 |
+
#include "arrow/result.h"
|
| 27 |
+
#include "arrow/status.h"
|
| 28 |
+
#include "arrow/type.h"
|
| 29 |
+
|
| 30 |
+
// This file contains hash join logic related to handling of dictionary encoded key
|
| 31 |
+
// columns.
|
| 32 |
+
//
|
| 33 |
+
// A key column from probe side of the join can be matched against a key column from build
|
| 34 |
+
// side of the join, as long as the underlying value types are equal. That means that:
|
| 35 |
+
// - both scalars and arrays can be used and even mixed in the same column
|
| 36 |
+
// - dictionary column can be matched against non-dictionary column if underlying value
|
| 37 |
+
// types are equal
|
| 38 |
+
// - dictionary column can be matched against dictionary column with a different index
|
| 39 |
+
// type, and potentially using a different dictionary, if underlying value types are equal
|
| 40 |
+
//
|
| 41 |
+
// We currently require in hash join that for all dictionary encoded columns, the same
|
| 42 |
+
// dictionary is used in all input exec batches.
|
| 43 |
+
//
|
| 44 |
+
// In order to allow matching columns with different dictionaries, different dictionary
|
| 45 |
+
// index types, and dictionary key against non-dictionary key, internally comparisons will
|
| 46 |
+
// be evaluated after remapping values on both sides of the join to a common
|
| 47 |
+
// representation (which will be called "unified representation"). This common
|
| 48 |
+
// representation is a column of int32() type (not a dictionary column). It represents an
|
| 49 |
+
// index in the unified dictionary computed for the (only) dictionary present on build
|
| 50 |
+
// side (an empty dictionary is still created for an empty build side). Null value is
|
| 51 |
+
// always represented in this common representation as null int32 value, unified
|
| 52 |
+
// dictionary will never contain a null value (so there is no ambiguity of representing
|
| 53 |
+
// nulls as either index to a null entry in the dictionary or null index).
|
| 54 |
+
//
|
| 55 |
+
// Unified dictionary represents values present on build side. There may be values on
|
| 56 |
+
// probe side that are not present in it. All such values, that are not null, are mapped
|
| 57 |
+
// in the common representation to a special constant kMissingValueId.
|
| 58 |
+
//
|
| 59 |
+
|
| 60 |
+
namespace arrow {
|
| 61 |
+
|
| 62 |
+
using compute::ExecBatch;
|
| 63 |
+
using compute::ExecContext;
|
| 64 |
+
using compute::internal::RowEncoder;
|
| 65 |
+
|
| 66 |
+
namespace acero {
|
| 67 |
+
|
| 68 |
+
/// Helper class with operations that are stateless and common to processing of dictionary
|
| 69 |
+
/// keys on both build and probe side.
|
| 70 |
+
class HashJoinDictUtil {
|
| 71 |
+
public:
|
| 72 |
+
// Null values in unified representation are always represented as null that has
|
| 73 |
+
// corresponding integer set to this constant
|
| 74 |
+
static constexpr int32_t kNullId = 0;
|
| 75 |
+
// Constant representing a value, that is not null, missing on the build side, in
|
| 76 |
+
// unified representation.
|
| 77 |
+
static constexpr int32_t kMissingValueId = -1;
|
| 78 |
+
|
| 79 |
+
// Check if data types of corresponding pair of key column on build and probe side are
|
| 80 |
+
// compatible
|
| 81 |
+
static bool KeyDataTypesValid(const std::shared_ptr<DataType>& probe_data_type,
|
| 82 |
+
const std::shared_ptr<DataType>& build_data_type);
|
| 83 |
+
|
| 84 |
+
// Input must be dictionary array or dictionary scalar.
|
| 85 |
+
// A precomputed and provided here lookup table in the form of int32() array will be
|
| 86 |
+
// used to remap input indices to unified representation.
|
| 87 |
+
//
|
| 88 |
+
static Result<std::shared_ptr<ArrayData>> IndexRemapUsingLUT(
|
| 89 |
+
ExecContext* ctx, const Datum& indices, int64_t batch_length,
|
| 90 |
+
const std::shared_ptr<ArrayData>& map_array,
|
| 91 |
+
const std::shared_ptr<DataType>& data_type);
|
| 92 |
+
|
| 93 |
+
// Return int32() array that contains indices of input dictionary array or scalar after
|
| 94 |
+
// type casting.
|
| 95 |
+
static Result<std::shared_ptr<ArrayData>> ConvertToInt32(
|
| 96 |
+
const std::shared_ptr<DataType>& from_type, const Datum& input,
|
| 97 |
+
int64_t batch_length, ExecContext* ctx);
|
| 98 |
+
|
| 99 |
+
// Return an array that contains elements of input int32() array after casting to a
|
| 100 |
+
// given integer type. This is used for mapping unified representation stored in the
|
| 101 |
+
// hash table on build side back to original input data type of hash join, when
|
| 102 |
+
// outputting hash join results to parent exec node.
|
| 103 |
+
//
|
| 104 |
+
static Result<std::shared_ptr<ArrayData>> ConvertFromInt32(
|
| 105 |
+
const std::shared_ptr<DataType>& to_type, const Datum& input, int64_t batch_length,
|
| 106 |
+
ExecContext* ctx);
|
| 107 |
+
|
| 108 |
+
// Return dictionary referenced in either dictionary array or dictionary scalar
|
| 109 |
+
static std::shared_ptr<Array> ExtractDictionary(const Datum& data);
|
| 110 |
+
};
|
| 111 |
+
|
| 112 |
+
/// Implements processing of dictionary arrays/scalars in key columns on the build side of
|
| 113 |
+
/// a hash join.
|
| 114 |
+
/// Each instance of this class corresponds to a single column and stores and
|
| 115 |
+
/// processes only the information related to that column.
|
| 116 |
+
/// Const methods are thread-safe, non-const methods are not (the caller must make sure
|
| 117 |
+
/// that only one thread at any time will access them).
|
| 118 |
+
///
|
| 119 |
+
class HashJoinDictBuild {
|
| 120 |
+
public:
|
| 121 |
+
// Returns true if the key column (described in input by its data type) requires any
|
| 122 |
+
// pre- or post-processing related to handling dictionaries.
|
| 123 |
+
//
|
| 124 |
+
static bool KeyNeedsProcessing(const std::shared_ptr<DataType>& build_data_type) {
|
| 125 |
+
return (build_data_type->id() == Type::DICTIONARY);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
// Data type of unified representation
|
| 129 |
+
static std::shared_ptr<DataType> DataTypeAfterRemapping() { return int32(); }
|
| 130 |
+
|
| 131 |
+
// Should be called only once in hash join, before processing any build or probe
|
| 132 |
+
// batches.
|
| 133 |
+
//
|
| 134 |
+
// Takes a pointer to the dictionary for a corresponding key column on the build side as
|
| 135 |
+
// an input. If the build side is empty, it still needs to be called, but with
|
| 136 |
+
// dictionary pointer set to null.
|
| 137 |
+
//
|
| 138 |
+
// Currently it is required that all input batches on build side share the same
|
| 139 |
+
// dictionary. For each input batch during its pre-processing, dictionary will be
|
| 140 |
+
// checked and error will be returned if it is different then the one provided in the
|
| 141 |
+
// call to this method.
|
| 142 |
+
//
|
| 143 |
+
// Unifies the dictionary. The order of the values is still preserved.
|
| 144 |
+
// Null and duplicate entries are removed. If the dictionary is already unified, its
|
| 145 |
+
// copy will be produced and stored within this class.
|
| 146 |
+
//
|
| 147 |
+
// Prepares the mapping from ids within original dictionary to the ids in the resulting
|
| 148 |
+
// dictionary. This is used later on to pre-process (map to unified representation) key
|
| 149 |
+
// column on build side.
|
| 150 |
+
//
|
| 151 |
+
// Prepares the reverse mapping (in the form of hash table) from values to the ids in
|
| 152 |
+
// the resulting dictionary. This will be used later on to pre-process (map to unified
|
| 153 |
+
// representation) key column on probe side. Values on probe side that are not present
|
| 154 |
+
// in the original dictionary will be mapped to a special constant kMissingValueId. The
|
| 155 |
+
// exception is made for nulls, which get always mapped to nulls (both when null is
|
| 156 |
+
// represented as a dictionary id pointing to a null and a null dictionary id).
|
| 157 |
+
//
|
| 158 |
+
Status Init(ExecContext* ctx, std::shared_ptr<Array> dictionary,
|
| 159 |
+
std::shared_ptr<DataType> index_type, std::shared_ptr<DataType> value_type);
|
| 160 |
+
|
| 161 |
+
// Remap array or scalar values into unified representation (array of int32()).
|
| 162 |
+
// Outputs kMissingValueId if input value is not found in the unified dictionary.
|
| 163 |
+
// Outputs null for null input value (with corresponding data set to kNullId).
|
| 164 |
+
//
|
| 165 |
+
Result<std::shared_ptr<ArrayData>> RemapInputValues(ExecContext* ctx,
|
| 166 |
+
const Datum& values,
|
| 167 |
+
int64_t batch_length) const;
|
| 168 |
+
|
| 169 |
+
// Remap dictionary array or dictionary scalar on build side to unified representation.
|
| 170 |
+
// Dictionary referenced in the input must match the dictionary that was
|
| 171 |
+
// given during initialization.
|
| 172 |
+
// The output is a dictionary array that references unified dictionary.
|
| 173 |
+
//
|
| 174 |
+
Result<std::shared_ptr<ArrayData>> RemapInput(
|
| 175 |
+
ExecContext* ctx, const Datum& indices, int64_t batch_length,
|
| 176 |
+
const std::shared_ptr<DataType>& data_type) const;
|
| 177 |
+
|
| 178 |
+
// Outputs dictionary array referencing unified dictionary, given an array with 32-bit
|
| 179 |
+
// ids.
|
| 180 |
+
// Used to post-process values looked up in a hash table on build side of the hash join
|
| 181 |
+
// before outputting to the parent exec node.
|
| 182 |
+
//
|
| 183 |
+
Result<std::shared_ptr<ArrayData>> RemapOutput(const ArrayData& indices32Bit,
|
| 184 |
+
ExecContext* ctx) const;
|
| 185 |
+
|
| 186 |
+
// Release shared pointers and memory
|
| 187 |
+
void CleanUp();
|
| 188 |
+
|
| 189 |
+
private:
|
| 190 |
+
// Data type of dictionary ids for the input dictionary on build side
|
| 191 |
+
std::shared_ptr<DataType> index_type_;
|
| 192 |
+
// Data type of values for the input dictionary on build side
|
| 193 |
+
std::shared_ptr<DataType> value_type_;
|
| 194 |
+
// Mapping from (encoded as string) values to the ids in unified dictionary
|
| 195 |
+
std::unordered_map<std::string, int32_t> hash_table_;
|
| 196 |
+
// Mapping from input dictionary ids to unified dictionary ids
|
| 197 |
+
std::shared_ptr<ArrayData> remapped_ids_;
|
| 198 |
+
// Input dictionary
|
| 199 |
+
std::shared_ptr<Array> dictionary_;
|
| 200 |
+
// Unified dictionary
|
| 201 |
+
std::shared_ptr<ArrayData> unified_dictionary_;
|
| 202 |
+
};
|
| 203 |
+
|
| 204 |
+
/// Implements processing of dictionary arrays/scalars in key columns on the probe side of
|
| 205 |
+
/// a hash join.
|
| 206 |
+
/// Each instance of this class corresponds to a single column and stores and
|
| 207 |
+
/// processes only the information related to that column.
|
| 208 |
+
/// It is not thread-safe - every participating thread should use its own instance of
|
| 209 |
+
/// this class.
|
| 210 |
+
///
|
| 211 |
+
class HashJoinDictProbe {
|
| 212 |
+
public:
|
| 213 |
+
static bool KeyNeedsProcessing(const std::shared_ptr<DataType>& probe_data_type,
|
| 214 |
+
const std::shared_ptr<DataType>& build_data_type);
|
| 215 |
+
|
| 216 |
+
// Data type of the result of remapping input key column.
|
| 217 |
+
//
|
| 218 |
+
// The result of remapping is what is used in hash join for matching keys on build and
|
| 219 |
+
// probe side. The exact data types may be different, as described below, and therefore
|
| 220 |
+
// a common representation is needed for simplifying comparisons of pairs of keys on
|
| 221 |
+
// both sides.
|
| 222 |
+
//
|
| 223 |
+
// We support matching key that is of non-dictionary type with key that is of dictionary
|
| 224 |
+
// type, as long as the underlying value types are equal. We support matching when both
|
| 225 |
+
// keys are of dictionary type, regardless whether underlying dictionary index types are
|
| 226 |
+
// the same or not.
|
| 227 |
+
//
|
| 228 |
+
static std::shared_ptr<DataType> DataTypeAfterRemapping(
|
| 229 |
+
const std::shared_ptr<DataType>& build_data_type);
|
| 230 |
+
|
| 231 |
+
// Should only be called if KeyNeedsProcessing method returns true for a pair of
|
| 232 |
+
// corresponding key columns from build and probe side.
|
| 233 |
+
// Converts values in order to match the common representation for
|
| 234 |
+
// both build and probe side used in hash table comparison.
|
| 235 |
+
// Supports arrays and scalars as input.
|
| 236 |
+
// Argument opt_build_side should be null if dictionary key on probe side is matched
|
| 237 |
+
// with non-dictionary key on build side.
|
| 238 |
+
//
|
| 239 |
+
Result<std::shared_ptr<ArrayData>> RemapInput(
|
| 240 |
+
const HashJoinDictBuild* opt_build_side, const Datum& data, int64_t batch_length,
|
| 241 |
+
const std::shared_ptr<DataType>& probe_data_type,
|
| 242 |
+
const std::shared_ptr<DataType>& build_data_type, ExecContext* ctx);
|
| 243 |
+
|
| 244 |
+
void CleanUp();
|
| 245 |
+
|
| 246 |
+
private:
|
| 247 |
+
// May be null if probe side key is non-dictionary. Otherwise it is used to verify that
|
| 248 |
+
// only a single dictionary is referenced in exec batch on probe side of hash join.
|
| 249 |
+
std::shared_ptr<Array> dictionary_;
|
| 250 |
+
// Mapping from dictionary on probe side of hash join (if it is used) to unified
|
| 251 |
+
// representation.
|
| 252 |
+
std::shared_ptr<ArrayData> remapped_ids_;
|
| 253 |
+
// Encoder of key columns that uses unified representation instead of original data type
|
| 254 |
+
// for key columns that need to use it (have dictionaries on either side of the join).
|
| 255 |
+
RowEncoder encoder_;
|
| 256 |
+
};
|
| 257 |
+
|
| 258 |
+
// Encapsulates dictionary handling logic for build side of hash join.
|
| 259 |
+
//
|
| 260 |
+
class HashJoinDictBuildMulti {
|
| 261 |
+
public:
|
| 262 |
+
Status Init(const SchemaProjectionMaps<HashJoinProjection>& proj_map,
|
| 263 |
+
const ExecBatch* opt_non_empty_batch, ExecContext* ctx);
|
| 264 |
+
static void InitEncoder(const SchemaProjectionMaps<HashJoinProjection>& proj_map,
|
| 265 |
+
RowEncoder* encoder, ExecContext* ctx);
|
| 266 |
+
Status EncodeBatch(size_t thread_index,
|
| 267 |
+
const SchemaProjectionMaps<HashJoinProjection>& proj_map,
|
| 268 |
+
const ExecBatch& batch, RowEncoder* encoder, ExecContext* ctx) const;
|
| 269 |
+
Status PostDecode(const SchemaProjectionMaps<HashJoinProjection>& proj_map,
|
| 270 |
+
ExecBatch* decoded_key_batch, ExecContext* ctx);
|
| 271 |
+
const HashJoinDictBuild& get_dict_build(int icol) const { return remap_imp_[icol]; }
|
| 272 |
+
|
| 273 |
+
private:
|
| 274 |
+
std::vector<bool> needs_remap_;
|
| 275 |
+
std::vector<HashJoinDictBuild> remap_imp_;
|
| 276 |
+
};
|
| 277 |
+
|
| 278 |
+
// Encapsulates dictionary handling logic for probe side of hash join
|
| 279 |
+
//
|
| 280 |
+
class HashJoinDictProbeMulti {
|
| 281 |
+
public:
|
| 282 |
+
void Init(size_t num_threads);
|
| 283 |
+
bool BatchRemapNeeded(size_t thread_index,
|
| 284 |
+
const SchemaProjectionMaps<HashJoinProjection>& proj_map_probe,
|
| 285 |
+
const SchemaProjectionMaps<HashJoinProjection>& proj_map_build,
|
| 286 |
+
ExecContext* ctx);
|
| 287 |
+
Status EncodeBatch(size_t thread_index,
|
| 288 |
+
const SchemaProjectionMaps<HashJoinProjection>& proj_map_probe,
|
| 289 |
+
const SchemaProjectionMaps<HashJoinProjection>& proj_map_build,
|
| 290 |
+
const HashJoinDictBuildMulti& dict_build, const ExecBatch& batch,
|
| 291 |
+
RowEncoder** out_encoder, ExecBatch* opt_out_key_batch,
|
| 292 |
+
ExecContext* ctx);
|
| 293 |
+
|
| 294 |
+
private:
|
| 295 |
+
void InitLocalStateIfNeeded(
|
| 296 |
+
size_t thread_index, const SchemaProjectionMaps<HashJoinProjection>& proj_map_probe,
|
| 297 |
+
const SchemaProjectionMaps<HashJoinProjection>& proj_map_build, ExecContext* ctx);
|
| 298 |
+
static void InitEncoder(const SchemaProjectionMaps<HashJoinProjection>& proj_map_probe,
|
| 299 |
+
const SchemaProjectionMaps<HashJoinProjection>& proj_map_build,
|
| 300 |
+
RowEncoder* encoder, ExecContext* ctx);
|
| 301 |
+
struct ThreadLocalState {
|
| 302 |
+
bool is_initialized;
|
| 303 |
+
// Whether any key column needs remapping (because of dictionaries used) before doing
|
| 304 |
+
// join hash table lookups
|
| 305 |
+
bool any_needs_remap;
|
| 306 |
+
// Whether each key column needs remapping before doing join hash table lookups
|
| 307 |
+
std::vector<bool> needs_remap;
|
| 308 |
+
std::vector<HashJoinDictProbe> remap_imp;
|
| 309 |
+
// Encoder of key columns that uses unified representation instead of original data
|
| 310 |
+
// type for key columns that need to use it (have dictionaries on either side of the
|
| 311 |
+
// join).
|
| 312 |
+
RowEncoder post_remap_encoder;
|
| 313 |
+
};
|
| 314 |
+
std::vector<ThreadLocalState> local_states_;
|
| 315 |
+
};
|
| 316 |
+
|
| 317 |
+
} // namespace acero
|
| 318 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/hash_join_node.h
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cassert>
|
| 21 |
+
#include <vector>
|
| 22 |
+
|
| 23 |
+
#include "arrow/acero/options.h"
|
| 24 |
+
#include "arrow/acero/schema_util.h"
|
| 25 |
+
#include "arrow/result.h"
|
| 26 |
+
#include "arrow/status.h"
|
| 27 |
+
|
| 28 |
+
namespace arrow {
|
| 29 |
+
|
| 30 |
+
using compute::ExecContext;
|
| 31 |
+
|
| 32 |
+
namespace acero {
|
| 33 |
+
|
| 34 |
+
class ARROW_ACERO_EXPORT HashJoinSchema {
|
| 35 |
+
public:
|
| 36 |
+
Status Init(JoinType join_type, const Schema& left_schema,
|
| 37 |
+
const std::vector<FieldRef>& left_keys, const Schema& right_schema,
|
| 38 |
+
const std::vector<FieldRef>& right_keys, const Expression& filter,
|
| 39 |
+
const std::string& left_field_name_prefix,
|
| 40 |
+
const std::string& right_field_name_prefix);
|
| 41 |
+
|
| 42 |
+
Status Init(JoinType join_type, const Schema& left_schema,
|
| 43 |
+
const std::vector<FieldRef>& left_keys,
|
| 44 |
+
const std::vector<FieldRef>& left_output, const Schema& right_schema,
|
| 45 |
+
const std::vector<FieldRef>& right_keys,
|
| 46 |
+
const std::vector<FieldRef>& right_output, const Expression& filter,
|
| 47 |
+
const std::string& left_field_name_prefix,
|
| 48 |
+
const std::string& right_field_name_prefix);
|
| 49 |
+
|
| 50 |
+
static Status ValidateSchemas(JoinType join_type, const Schema& left_schema,
|
| 51 |
+
const std::vector<FieldRef>& left_keys,
|
| 52 |
+
const std::vector<FieldRef>& left_output,
|
| 53 |
+
const Schema& right_schema,
|
| 54 |
+
const std::vector<FieldRef>& right_keys,
|
| 55 |
+
const std::vector<FieldRef>& right_output,
|
| 56 |
+
const std::string& left_field_name_prefix,
|
| 57 |
+
const std::string& right_field_name_prefix);
|
| 58 |
+
|
| 59 |
+
bool HasDictionaries() const;
|
| 60 |
+
|
| 61 |
+
bool HasLargeBinary() const;
|
| 62 |
+
|
| 63 |
+
Result<Expression> BindFilter(Expression filter, const Schema& left_schema,
|
| 64 |
+
const Schema& right_schema, ExecContext* exec_context);
|
| 65 |
+
std::shared_ptr<Schema> MakeOutputSchema(const std::string& left_field_name_suffix,
|
| 66 |
+
const std::string& right_field_name_suffix);
|
| 67 |
+
|
| 68 |
+
bool LeftPayloadIsEmpty() const { return PayloadIsEmpty(0); }
|
| 69 |
+
|
| 70 |
+
bool RightPayloadIsEmpty() const { return PayloadIsEmpty(1); }
|
| 71 |
+
|
| 72 |
+
static int kMissingField() {
|
| 73 |
+
return SchemaProjectionMaps<HashJoinProjection>::kMissingField;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
SchemaProjectionMaps<HashJoinProjection> proj_maps[2];
|
| 77 |
+
|
| 78 |
+
private:
|
| 79 |
+
static bool IsTypeSupported(const DataType& type);
|
| 80 |
+
|
| 81 |
+
Status CollectFilterColumns(std::vector<FieldRef>& left_filter,
|
| 82 |
+
std::vector<FieldRef>& right_filter,
|
| 83 |
+
const Expression& filter, const Schema& left_schema,
|
| 84 |
+
const Schema& right_schema);
|
| 85 |
+
|
| 86 |
+
Expression RewriteFilterToUseFilterSchema(int right_filter_offset,
|
| 87 |
+
const SchemaProjectionMap& left_to_filter,
|
| 88 |
+
const SchemaProjectionMap& right_to_filter,
|
| 89 |
+
const Expression& filter);
|
| 90 |
+
|
| 91 |
+
bool PayloadIsEmpty(int side) const {
|
| 92 |
+
assert(side == 0 || side == 1);
|
| 93 |
+
return proj_maps[side].num_cols(HashJoinProjection::PAYLOAD) == 0;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
static Result<std::vector<FieldRef>> ComputePayload(const Schema& schema,
|
| 97 |
+
const std::vector<FieldRef>& output,
|
| 98 |
+
const std::vector<FieldRef>& filter,
|
| 99 |
+
const std::vector<FieldRef>& key);
|
| 100 |
+
};
|
| 101 |
+
|
| 102 |
+
} // namespace acero
|
| 103 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/map_node.h
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <functional>
|
| 22 |
+
#include <memory>
|
| 23 |
+
#include <vector>
|
| 24 |
+
|
| 25 |
+
#include "arrow/acero/exec_plan.h"
|
| 26 |
+
#include "arrow/acero/util.h"
|
| 27 |
+
#include "arrow/acero/visibility.h"
|
| 28 |
+
#include "arrow/compute/type_fwd.h"
|
| 29 |
+
#include "arrow/status.h"
|
| 30 |
+
#include "arrow/type_fwd.h"
|
| 31 |
+
#include "arrow/util/cancel.h"
|
| 32 |
+
#include "arrow/util/type_fwd.h"
|
| 33 |
+
|
| 34 |
+
namespace arrow {
|
| 35 |
+
namespace acero {
|
| 36 |
+
|
| 37 |
+
/// A utility base class for simple exec nodes with one input
|
| 38 |
+
///
|
| 39 |
+
/// Pause/Resume Producing are forwarded appropriately
|
| 40 |
+
/// There is nothing to do in StopProducingImpl
|
| 41 |
+
///
|
| 42 |
+
/// An AtomicCounter is used to keep track of when all data has arrived. When it
|
| 43 |
+
/// has the Finish() method will be invoked
|
| 44 |
+
class ARROW_ACERO_EXPORT MapNode : public ExecNode, public TracedNode {
|
| 45 |
+
public:
|
| 46 |
+
MapNode(ExecPlan* plan, std::vector<ExecNode*> inputs,
|
| 47 |
+
std::shared_ptr<Schema> output_schema);
|
| 48 |
+
|
| 49 |
+
Status InputFinished(ExecNode* input, int total_batches) override;
|
| 50 |
+
|
| 51 |
+
Status StartProducing() override;
|
| 52 |
+
|
| 53 |
+
void PauseProducing(ExecNode* output, int32_t counter) override;
|
| 54 |
+
|
| 55 |
+
void ResumeProducing(ExecNode* output, int32_t counter) override;
|
| 56 |
+
|
| 57 |
+
Status InputReceived(ExecNode* input, ExecBatch batch) override;
|
| 58 |
+
|
| 59 |
+
const Ordering& ordering() const override;
|
| 60 |
+
|
| 61 |
+
protected:
|
| 62 |
+
Status StopProducingImpl() override;
|
| 63 |
+
|
| 64 |
+
/// Transform a batch
|
| 65 |
+
///
|
| 66 |
+
/// The output batch will have the same guarantee as the input batch
|
| 67 |
+
/// If this was the last batch this call may trigger Finish()
|
| 68 |
+
virtual Result<ExecBatch> ProcessBatch(ExecBatch batch) = 0;
|
| 69 |
+
|
| 70 |
+
/// Function called after all data has been received
|
| 71 |
+
///
|
| 72 |
+
/// By default this does nothing. Override this to provide a custom implementation.
|
| 73 |
+
virtual void Finish();
|
| 74 |
+
|
| 75 |
+
protected:
|
| 76 |
+
// Counter for the number of batches received
|
| 77 |
+
AtomicCounter input_counter_;
|
| 78 |
+
};
|
| 79 |
+
|
| 80 |
+
} // namespace acero
|
| 81 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <functional>
|
| 21 |
+
#include <memory>
|
| 22 |
+
#include <optional>
|
| 23 |
+
#include <string>
|
| 24 |
+
#include <vector>
|
| 25 |
+
|
| 26 |
+
#include "arrow/acero/type_fwd.h"
|
| 27 |
+
#include "arrow/acero/visibility.h"
|
| 28 |
+
#include "arrow/compute/api_aggregate.h"
|
| 29 |
+
#include "arrow/compute/api_vector.h"
|
| 30 |
+
#include "arrow/compute/exec.h"
|
| 31 |
+
#include "arrow/compute/expression.h"
|
| 32 |
+
#include "arrow/result.h"
|
| 33 |
+
#include "arrow/util/future.h"
|
| 34 |
+
|
| 35 |
+
namespace arrow {
|
| 36 |
+
|
| 37 |
+
using compute::Aggregate;
|
| 38 |
+
using compute::ExecBatch;
|
| 39 |
+
using compute::Expression;
|
| 40 |
+
using compute::literal;
|
| 41 |
+
using compute::Ordering;
|
| 42 |
+
using compute::SelectKOptions;
|
| 43 |
+
using compute::SortOptions;
|
| 44 |
+
|
| 45 |
+
namespace internal {
|
| 46 |
+
|
| 47 |
+
class Executor;
|
| 48 |
+
|
| 49 |
+
} // namespace internal
|
| 50 |
+
|
| 51 |
+
namespace acero {
|
| 52 |
+
|
| 53 |
+
/// \brief This must not be used in release-mode
|
| 54 |
+
struct DebugOptions;
|
| 55 |
+
|
| 56 |
+
using AsyncExecBatchGenerator = std::function<Future<std::optional<ExecBatch>>()>;
|
| 57 |
+
|
| 58 |
+
/// \addtogroup acero-nodes
|
| 59 |
+
/// @{
|
| 60 |
+
|
| 61 |
+
/// \brief A base class for all options objects
|
| 62 |
+
///
|
| 63 |
+
/// The only time this is used directly is when a node has no configuration
|
| 64 |
+
class ARROW_ACERO_EXPORT ExecNodeOptions {
|
| 65 |
+
public:
|
| 66 |
+
virtual ~ExecNodeOptions() = default;
|
| 67 |
+
|
| 68 |
+
/// \brief This must not be used in release-mode
|
| 69 |
+
std::shared_ptr<DebugOptions> debug_opts;
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
/// \brief A node representing a generic source of data for Acero
|
| 73 |
+
///
|
| 74 |
+
/// The source node will start calling `generator` during StartProducing. An initial
|
| 75 |
+
/// task will be created that will call `generator`. It will not call `generator`
|
| 76 |
+
/// reentrantly. If the source can be read in parallel then those details should be
|
| 77 |
+
/// encapsulated within `generator`.
|
| 78 |
+
///
|
| 79 |
+
/// For each batch received a new task will be created to push that batch downstream.
|
| 80 |
+
/// This task will slice smaller units of size `ExecPlan::kMaxBatchSize` from the
|
| 81 |
+
/// parent batch and call InputReceived. Thus, if the `generator` yields a large
|
| 82 |
+
/// batch it may result in several calls to InputReceived.
|
| 83 |
+
///
|
| 84 |
+
/// The SourceNode will, by default, assign an implicit ordering to outgoing batches.
|
| 85 |
+
/// This is valid as long as the generator generates batches in a deterministic fashion.
|
| 86 |
+
/// Currently, the only way to override this is to subclass the SourceNode.
|
| 87 |
+
///
|
| 88 |
+
/// This node is not generally used directly but can serve as the basis for various
|
| 89 |
+
/// specialized nodes.
|
| 90 |
+
class ARROW_ACERO_EXPORT SourceNodeOptions : public ExecNodeOptions {
|
| 91 |
+
public:
|
| 92 |
+
/// Create an instance from values
|
| 93 |
+
SourceNodeOptions(std::shared_ptr<Schema> output_schema,
|
| 94 |
+
std::function<Future<std::optional<ExecBatch>>()> generator,
|
| 95 |
+
Ordering ordering = Ordering::Unordered())
|
| 96 |
+
: output_schema(std::move(output_schema)),
|
| 97 |
+
generator(std::move(generator)),
|
| 98 |
+
ordering(std::move(ordering)) {}
|
| 99 |
+
|
| 100 |
+
/// \brief the schema for batches that will be generated by this source
|
| 101 |
+
std::shared_ptr<Schema> output_schema;
|
| 102 |
+
/// \brief an asynchronous stream of batches ending with std::nullopt
|
| 103 |
+
std::function<Future<std::optional<ExecBatch>>()> generator;
|
| 104 |
+
/// \brief the order of the data, defaults to Ordering::Unordered
|
| 105 |
+
Ordering ordering;
|
| 106 |
+
};
|
| 107 |
+
|
| 108 |
+
/// \brief a node that generates data from a table already loaded in memory
|
| 109 |
+
///
|
| 110 |
+
/// The table source node will slice off chunks, defined by `max_batch_size`
|
| 111 |
+
/// for parallel processing. The table source node extends source node and so these
|
| 112 |
+
/// chunks will be iteratively processed in small batches. \see SourceNodeOptions
|
| 113 |
+
/// for details.
|
| 114 |
+
class ARROW_ACERO_EXPORT TableSourceNodeOptions : public ExecNodeOptions {
|
| 115 |
+
public:
|
| 116 |
+
static constexpr int64_t kDefaultMaxBatchSize = 1 << 20;
|
| 117 |
+
|
| 118 |
+
/// Create an instance from values
|
| 119 |
+
TableSourceNodeOptions(std::shared_ptr<Table> table,
|
| 120 |
+
int64_t max_batch_size = kDefaultMaxBatchSize)
|
| 121 |
+
: table(std::move(table)), max_batch_size(max_batch_size) {}
|
| 122 |
+
|
| 123 |
+
/// \brief a table which acts as the data source
|
| 124 |
+
std::shared_ptr<Table> table;
|
| 125 |
+
/// \brief size of batches to emit from this node
|
| 126 |
+
/// If the table is larger the node will emit multiple batches from the
|
| 127 |
+
/// the table to be processed in parallel.
|
| 128 |
+
int64_t max_batch_size;
|
| 129 |
+
};
|
| 130 |
+
|
| 131 |
+
/// \brief define a lazily resolved Arrow table.
|
| 132 |
+
///
|
| 133 |
+
/// The table uniquely identified by the names can typically be resolved at the time when
|
| 134 |
+
/// the plan is to be consumed.
|
| 135 |
+
///
|
| 136 |
+
/// This node is for serialization purposes only and can never be executed.
|
| 137 |
+
class ARROW_ACERO_EXPORT NamedTableNodeOptions : public ExecNodeOptions {
|
| 138 |
+
public:
|
| 139 |
+
/// Create an instance from values
|
| 140 |
+
NamedTableNodeOptions(std::vector<std::string> names, std::shared_ptr<Schema> schema)
|
| 141 |
+
: names(std::move(names)), schema(std::move(schema)) {}
|
| 142 |
+
|
| 143 |
+
/// \brief the names to put in the serialized plan
|
| 144 |
+
std::vector<std::string> names;
|
| 145 |
+
/// \brief the output schema of the table
|
| 146 |
+
std::shared_ptr<Schema> schema;
|
| 147 |
+
};
|
| 148 |
+
|
| 149 |
+
/// \brief a source node which feeds data from a synchronous iterator of batches
|
| 150 |
+
///
|
| 151 |
+
/// ItMaker is a maker of an iterator of tabular data.
|
| 152 |
+
///
|
| 153 |
+
/// The node can be configured to use an I/O executor. If set then each time the
|
| 154 |
+
/// iterator is polled a new I/O thread task will be created to do the polling. This
|
| 155 |
+
/// allows a blocking iterator to stay off the CPU thread pool.
|
| 156 |
+
template <typename ItMaker>
|
| 157 |
+
class ARROW_ACERO_EXPORT SchemaSourceNodeOptions : public ExecNodeOptions {
|
| 158 |
+
public:
|
| 159 |
+
/// Create an instance that will create a new task on io_executor for each iteration
|
| 160 |
+
SchemaSourceNodeOptions(std::shared_ptr<Schema> schema, ItMaker it_maker,
|
| 161 |
+
arrow::internal::Executor* io_executor)
|
| 162 |
+
: schema(std::move(schema)),
|
| 163 |
+
it_maker(std::move(it_maker)),
|
| 164 |
+
io_executor(io_executor),
|
| 165 |
+
requires_io(true) {}
|
| 166 |
+
|
| 167 |
+
/// Create an instance that will either iterate synchronously or use the default I/O
|
| 168 |
+
/// executor
|
| 169 |
+
SchemaSourceNodeOptions(std::shared_ptr<Schema> schema, ItMaker it_maker,
|
| 170 |
+
bool requires_io = false)
|
| 171 |
+
: schema(std::move(schema)),
|
| 172 |
+
it_maker(std::move(it_maker)),
|
| 173 |
+
io_executor(NULLPTR),
|
| 174 |
+
requires_io(requires_io) {}
|
| 175 |
+
|
| 176 |
+
/// \brief The schema of the record batches from the iterator
|
| 177 |
+
std::shared_ptr<Schema> schema;
|
| 178 |
+
|
| 179 |
+
/// \brief A maker of an iterator which acts as the data source
|
| 180 |
+
ItMaker it_maker;
|
| 181 |
+
|
| 182 |
+
/// \brief The executor to use for scanning the iterator
|
| 183 |
+
///
|
| 184 |
+
/// Defaults to the default I/O executor. Only used if requires_io is true.
|
| 185 |
+
/// If requires_io is false then this MUST be nullptr.
|
| 186 |
+
arrow::internal::Executor* io_executor;
|
| 187 |
+
|
| 188 |
+
/// \brief If true then items will be fetched from the iterator on a dedicated I/O
|
| 189 |
+
/// thread to keep I/O off the CPU thread
|
| 190 |
+
bool requires_io;
|
| 191 |
+
};
|
| 192 |
+
|
| 193 |
+
/// a source node that reads from a RecordBatchReader
|
| 194 |
+
///
|
| 195 |
+
/// Each iteration of the RecordBatchReader will be run on a new thread task created
|
| 196 |
+
/// on the I/O thread pool.
|
| 197 |
+
class ARROW_ACERO_EXPORT RecordBatchReaderSourceNodeOptions : public ExecNodeOptions {
|
| 198 |
+
public:
|
| 199 |
+
/// Create an instance from values
|
| 200 |
+
RecordBatchReaderSourceNodeOptions(std::shared_ptr<RecordBatchReader> reader,
|
| 201 |
+
arrow::internal::Executor* io_executor = NULLPTR)
|
| 202 |
+
: reader(std::move(reader)), io_executor(io_executor) {}
|
| 203 |
+
|
| 204 |
+
/// \brief The RecordBatchReader which acts as the data source
|
| 205 |
+
std::shared_ptr<RecordBatchReader> reader;
|
| 206 |
+
|
| 207 |
+
/// \brief The executor to use for the reader
|
| 208 |
+
///
|
| 209 |
+
/// Defaults to the default I/O executor.
|
| 210 |
+
arrow::internal::Executor* io_executor;
|
| 211 |
+
};
|
| 212 |
+
|
| 213 |
+
/// a source node that reads from an iterator of array vectors
|
| 214 |
+
using ArrayVectorIteratorMaker = std::function<Iterator<std::shared_ptr<ArrayVector>>()>;
|
| 215 |
+
/// \brief An extended Source node which accepts a schema and array-vectors
|
| 216 |
+
class ARROW_ACERO_EXPORT ArrayVectorSourceNodeOptions
|
| 217 |
+
: public SchemaSourceNodeOptions<ArrayVectorIteratorMaker> {
|
| 218 |
+
using SchemaSourceNodeOptions::SchemaSourceNodeOptions;
|
| 219 |
+
};
|
| 220 |
+
|
| 221 |
+
/// a source node that reads from an iterator of ExecBatch
|
| 222 |
+
using ExecBatchIteratorMaker = std::function<Iterator<std::shared_ptr<ExecBatch>>()>;
|
| 223 |
+
/// \brief An extended Source node which accepts a schema and exec-batches
|
| 224 |
+
class ARROW_ACERO_EXPORT ExecBatchSourceNodeOptions
|
| 225 |
+
: public SchemaSourceNodeOptions<ExecBatchIteratorMaker> {
|
| 226 |
+
public:
|
| 227 |
+
using SchemaSourceNodeOptions::SchemaSourceNodeOptions;
|
| 228 |
+
ExecBatchSourceNodeOptions(std::shared_ptr<Schema> schema,
|
| 229 |
+
std::vector<ExecBatch> batches,
|
| 230 |
+
::arrow::internal::Executor* io_executor);
|
| 231 |
+
ExecBatchSourceNodeOptions(std::shared_ptr<Schema> schema,
|
| 232 |
+
std::vector<ExecBatch> batches, bool requires_io = false);
|
| 233 |
+
};
|
| 234 |
+
|
| 235 |
+
using RecordBatchIteratorMaker = std::function<Iterator<std::shared_ptr<RecordBatch>>()>;
|
| 236 |
+
/// a source node that reads from an iterator of RecordBatch
|
| 237 |
+
class ARROW_ACERO_EXPORT RecordBatchSourceNodeOptions
|
| 238 |
+
: public SchemaSourceNodeOptions<RecordBatchIteratorMaker> {
|
| 239 |
+
using SchemaSourceNodeOptions::SchemaSourceNodeOptions;
|
| 240 |
+
};
|
| 241 |
+
|
| 242 |
+
/// \brief a node which excludes some rows from batches passed through it
|
| 243 |
+
///
|
| 244 |
+
/// filter_expression will be evaluated against each batch which is pushed to
|
| 245 |
+
/// this node. Any rows for which filter_expression does not evaluate to `true` will be
|
| 246 |
+
/// excluded in the batch emitted by this node.
|
| 247 |
+
///
|
| 248 |
+
/// This node will emit empty batches if all rows are excluded. This is done
|
| 249 |
+
/// to avoid gaps in the ordering.
|
| 250 |
+
class ARROW_ACERO_EXPORT FilterNodeOptions : public ExecNodeOptions {
|
| 251 |
+
public:
|
| 252 |
+
/// \brief create an instance from values
|
| 253 |
+
explicit FilterNodeOptions(Expression filter_expression)
|
| 254 |
+
: filter_expression(std::move(filter_expression)) {}
|
| 255 |
+
|
| 256 |
+
/// \brief the expression to filter batches
|
| 257 |
+
///
|
| 258 |
+
/// The return type of this expression must be boolean
|
| 259 |
+
Expression filter_expression;
|
| 260 |
+
};
|
| 261 |
+
|
| 262 |
+
/// \brief a node which selects a specified subset from the input
|
| 263 |
+
class ARROW_ACERO_EXPORT FetchNodeOptions : public ExecNodeOptions {
|
| 264 |
+
public:
|
| 265 |
+
static constexpr std::string_view kName = "fetch";
|
| 266 |
+
/// \brief create an instance from values
|
| 267 |
+
FetchNodeOptions(int64_t offset, int64_t count) : offset(offset), count(count) {}
|
| 268 |
+
/// \brief the number of rows to skip
|
| 269 |
+
int64_t offset;
|
| 270 |
+
/// \brief the number of rows to keep (not counting skipped rows)
|
| 271 |
+
int64_t count;
|
| 272 |
+
};
|
| 273 |
+
|
| 274 |
+
/// \brief a node which executes expressions on input batches, producing batches
|
| 275 |
+
/// of the same length with new columns.
|
| 276 |
+
///
|
| 277 |
+
/// Each expression will be evaluated against each batch which is pushed to
|
| 278 |
+
/// this node to produce a corresponding output column.
|
| 279 |
+
///
|
| 280 |
+
/// If names are not provided, the string representations of exprs will be used.
|
| 281 |
+
class ARROW_ACERO_EXPORT ProjectNodeOptions : public ExecNodeOptions {
|
| 282 |
+
public:
|
| 283 |
+
/// \brief create an instance from values
|
| 284 |
+
explicit ProjectNodeOptions(std::vector<Expression> expressions,
|
| 285 |
+
std::vector<std::string> names = {})
|
| 286 |
+
: expressions(std::move(expressions)), names(std::move(names)) {}
|
| 287 |
+
|
| 288 |
+
/// \brief the expressions to run on the batches
|
| 289 |
+
///
|
| 290 |
+
/// The output will have one column for each expression. If you wish to keep any of
|
| 291 |
+
/// the columns from the input then you should create a simple field_ref expression
|
| 292 |
+
/// for that column.
|
| 293 |
+
std::vector<Expression> expressions;
|
| 294 |
+
/// \brief the names of the output columns
|
| 295 |
+
///
|
| 296 |
+
/// If this is not specified then the result of calling ToString on the expression will
|
| 297 |
+
/// be used instead
|
| 298 |
+
///
|
| 299 |
+
/// This list should either be empty or have the same length as `expressions`
|
| 300 |
+
std::vector<std::string> names;
|
| 301 |
+
};
|
| 302 |
+
|
| 303 |
+
/// \brief a node which aggregates input batches and calculates summary statistics
|
| 304 |
+
///
|
| 305 |
+
/// The node can summarize the entire input or it can group the input with grouping keys
|
| 306 |
+
/// and segment keys.
|
| 307 |
+
///
|
| 308 |
+
/// By default, the aggregate node is a pipeline breaker. It must accumulate all input
|
| 309 |
+
/// before any output is produced. Segment keys are a performance optimization. If
|
| 310 |
+
/// you know your input is already partitioned by one or more columns then you can
|
| 311 |
+
/// specify these as segment keys. At each change in the segment keys the node will
|
| 312 |
+
/// emit values for all data seen so far.
|
| 313 |
+
///
|
| 314 |
+
/// Segment keys are currently limited to single-threaded mode.
|
| 315 |
+
///
|
| 316 |
+
/// Both keys and segment-keys determine the group. However segment-keys are also used
|
| 317 |
+
/// for determining grouping segments, which should be large, and allow streaming a
|
| 318 |
+
/// partial aggregation result after processing each segment. One common use-case for
|
| 319 |
+
/// segment-keys is ordered aggregation, in which the segment-key attribute specifies a
|
| 320 |
+
/// column with non-decreasing values or a lexicographically-ordered set of such columns.
|
| 321 |
+
///
|
| 322 |
+
/// If the keys attribute is a non-empty vector, then each aggregate in `aggregates` is
|
| 323 |
+
/// expected to be a HashAggregate function. If the keys attribute is an empty vector,
|
| 324 |
+
/// then each aggregate is assumed to be a ScalarAggregate function.
|
| 325 |
+
///
|
| 326 |
+
/// If the segment_keys attribute is a non-empty vector, then segmented aggregation, as
|
| 327 |
+
/// described above, applies.
|
| 328 |
+
///
|
| 329 |
+
/// The keys and segment_keys vectors must be disjoint.
|
| 330 |
+
///
|
| 331 |
+
/// If no measures are provided then you will simply get the list of unique keys.
|
| 332 |
+
///
|
| 333 |
+
/// This node outputs segment keys first, followed by regular keys, followed by one
|
| 334 |
+
/// column for each aggregate.
|
| 335 |
+
class ARROW_ACERO_EXPORT AggregateNodeOptions : public ExecNodeOptions {
|
| 336 |
+
public:
|
| 337 |
+
/// \brief create an instance from values
|
| 338 |
+
explicit AggregateNodeOptions(std::vector<Aggregate> aggregates,
|
| 339 |
+
std::vector<FieldRef> keys = {},
|
| 340 |
+
std::vector<FieldRef> segment_keys = {})
|
| 341 |
+
: aggregates(std::move(aggregates)),
|
| 342 |
+
keys(std::move(keys)),
|
| 343 |
+
segment_keys(std::move(segment_keys)) {}
|
| 344 |
+
|
| 345 |
+
// aggregations which will be applied to the targeted fields
|
| 346 |
+
std::vector<Aggregate> aggregates;
|
| 347 |
+
// keys by which aggregations will be grouped (optional)
|
| 348 |
+
std::vector<FieldRef> keys;
|
| 349 |
+
// keys by which aggregations will be segmented (optional)
|
| 350 |
+
std::vector<FieldRef> segment_keys;
|
| 351 |
+
};
|
| 352 |
+
|
| 353 |
+
/// \brief a default value at which backpressure will be applied
|
| 354 |
+
constexpr int32_t kDefaultBackpressureHighBytes = 1 << 30; // 1GiB
|
| 355 |
+
/// \brief a default value at which backpressure will be removed
|
| 356 |
+
constexpr int32_t kDefaultBackpressureLowBytes = 1 << 28; // 256MiB
|
| 357 |
+
|
| 358 |
+
/// \brief an interface that can be queried for backpressure statistics
|
| 359 |
+
class ARROW_ACERO_EXPORT BackpressureMonitor {
|
| 360 |
+
public:
|
| 361 |
+
virtual ~BackpressureMonitor() = default;
|
| 362 |
+
/// \brief fetches the number of bytes currently queued up
|
| 363 |
+
virtual uint64_t bytes_in_use() = 0;
|
| 364 |
+
/// \brief checks to see if backpressure is currently applied
|
| 365 |
+
virtual bool is_paused() = 0;
|
| 366 |
+
};
|
| 367 |
+
|
| 368 |
+
/// \brief Options to control backpressure behavior
|
| 369 |
+
struct ARROW_ACERO_EXPORT BackpressureOptions {
|
| 370 |
+
/// \brief Create default options that perform no backpressure
|
| 371 |
+
BackpressureOptions() : resume_if_below(0), pause_if_above(0) {}
|
| 372 |
+
/// \brief Create options that will perform backpressure
|
| 373 |
+
///
|
| 374 |
+
/// \param resume_if_below The producer should resume producing if the backpressure
|
| 375 |
+
/// queue has fewer than resume_if_below items.
|
| 376 |
+
/// \param pause_if_above The producer should pause producing if the backpressure
|
| 377 |
+
/// queue has more than pause_if_above items
|
| 378 |
+
BackpressureOptions(uint64_t resume_if_below, uint64_t pause_if_above)
|
| 379 |
+
: resume_if_below(resume_if_below), pause_if_above(pause_if_above) {}
|
| 380 |
+
|
| 381 |
+
/// \brief create an instance using default values for backpressure limits
|
| 382 |
+
static BackpressureOptions DefaultBackpressure() {
|
| 383 |
+
return BackpressureOptions(kDefaultBackpressureLowBytes,
|
| 384 |
+
kDefaultBackpressureHighBytes);
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
/// \brief helper method to determine if backpressure is disabled
|
| 388 |
+
/// \return true if pause_if_above is greater than zero, false otherwise
|
| 389 |
+
bool should_apply_backpressure() const { return pause_if_above > 0; }
|
| 390 |
+
|
| 391 |
+
/// \brief the number of bytes at which the producer should resume producing
|
| 392 |
+
uint64_t resume_if_below;
|
| 393 |
+
/// \brief the number of bytes at which the producer should pause producing
|
| 394 |
+
///
|
| 395 |
+
/// If this is <= 0 then backpressure will be disabled
|
| 396 |
+
uint64_t pause_if_above;
|
| 397 |
+
};
|
| 398 |
+
|
| 399 |
+
/// \brief a sink node which collects results in a queue
|
| 400 |
+
///
|
| 401 |
+
/// Emitted batches will only be ordered if there is a meaningful ordering
|
| 402 |
+
/// and sequence_output is not set to false.
|
| 403 |
+
class ARROW_ACERO_EXPORT SinkNodeOptions : public ExecNodeOptions {
|
| 404 |
+
public:
|
| 405 |
+
explicit SinkNodeOptions(std::function<Future<std::optional<ExecBatch>>()>* generator,
|
| 406 |
+
std::shared_ptr<Schema>* schema,
|
| 407 |
+
BackpressureOptions backpressure = {},
|
| 408 |
+
BackpressureMonitor** backpressure_monitor = NULLPTR,
|
| 409 |
+
std::optional<bool> sequence_output = std::nullopt)
|
| 410 |
+
: generator(generator),
|
| 411 |
+
schema(schema),
|
| 412 |
+
backpressure(backpressure),
|
| 413 |
+
backpressure_monitor(backpressure_monitor),
|
| 414 |
+
sequence_output(sequence_output) {}
|
| 415 |
+
|
| 416 |
+
explicit SinkNodeOptions(std::function<Future<std::optional<ExecBatch>>()>* generator,
|
| 417 |
+
BackpressureOptions backpressure = {},
|
| 418 |
+
BackpressureMonitor** backpressure_monitor = NULLPTR,
|
| 419 |
+
std::optional<bool> sequence_output = std::nullopt)
|
| 420 |
+
: generator(generator),
|
| 421 |
+
schema(NULLPTR),
|
| 422 |
+
backpressure(std::move(backpressure)),
|
| 423 |
+
backpressure_monitor(backpressure_monitor),
|
| 424 |
+
sequence_output(sequence_output) {}
|
| 425 |
+
|
| 426 |
+
/// \brief A pointer to a generator of batches.
|
| 427 |
+
///
|
| 428 |
+
/// This will be set when the node is added to the plan and should be used to consume
|
| 429 |
+
/// data from the plan. If this function is not called frequently enough then the sink
|
| 430 |
+
/// node will start to accumulate data and may apply backpressure.
|
| 431 |
+
std::function<Future<std::optional<ExecBatch>>()>* generator;
|
| 432 |
+
/// \brief A pointer which will be set to the schema of the generated batches
|
| 433 |
+
///
|
| 434 |
+
/// This is optional, if nullptr is passed in then it will be ignored.
|
| 435 |
+
/// This will be set when the node is added to the plan, before StartProducing is called
|
| 436 |
+
std::shared_ptr<Schema>* schema;
|
| 437 |
+
/// \brief Options to control when to apply backpressure
|
| 438 |
+
///
|
| 439 |
+
/// This is optional, the default is to never apply backpressure. If the plan is not
|
| 440 |
+
/// consumed quickly enough the system may eventually run out of memory.
|
| 441 |
+
BackpressureOptions backpressure;
|
| 442 |
+
/// \brief A pointer to a backpressure monitor
|
| 443 |
+
///
|
| 444 |
+
/// This will be set when the node is added to the plan. This can be used to inspect
|
| 445 |
+
/// the amount of data currently queued in the sink node. This is an optional utility
|
| 446 |
+
/// and backpressure can be applied even if this is not used.
|
| 447 |
+
BackpressureMonitor** backpressure_monitor;
|
| 448 |
+
/// \brief Controls whether batches should be emitted immediately or sequenced in order
|
| 449 |
+
///
|
| 450 |
+
/// \see QueryOptions for more details
|
| 451 |
+
std::optional<bool> sequence_output;
|
| 452 |
+
};
|
| 453 |
+
|
| 454 |
+
/// \brief Control used by a SinkNodeConsumer to pause & resume
|
| 455 |
+
///
|
| 456 |
+
/// Callers should ensure that they do not call Pause and Resume simultaneously and they
|
| 457 |
+
/// should sequence things so that a call to Pause() is always followed by an eventual
|
| 458 |
+
/// call to Resume()
|
| 459 |
+
class ARROW_ACERO_EXPORT BackpressureControl {
|
| 460 |
+
public:
|
| 461 |
+
virtual ~BackpressureControl() = default;
|
| 462 |
+
/// \brief Ask the input to pause
|
| 463 |
+
///
|
| 464 |
+
/// This is best effort, batches may continue to arrive
|
| 465 |
+
/// Must eventually be followed by a call to Resume() or deadlock will occur
|
| 466 |
+
virtual void Pause() = 0;
|
| 467 |
+
/// \brief Ask the input to resume
|
| 468 |
+
virtual void Resume() = 0;
|
| 469 |
+
};
|
| 470 |
+
|
| 471 |
+
/// \brief a sink node that consumes the data as part of the plan using callbacks
|
| 472 |
+
class ARROW_ACERO_EXPORT SinkNodeConsumer {
|
| 473 |
+
public:
|
| 474 |
+
virtual ~SinkNodeConsumer() = default;
|
| 475 |
+
/// \brief Prepare any consumer state
|
| 476 |
+
///
|
| 477 |
+
/// This will be run once the schema is finalized as the plan is starting and
|
| 478 |
+
/// before any calls to Consume. A common use is to save off the schema so that
|
| 479 |
+
/// batches can be interpreted.
|
| 480 |
+
virtual Status Init(const std::shared_ptr<Schema>& schema,
|
| 481 |
+
BackpressureControl* backpressure_control, ExecPlan* plan) = 0;
|
| 482 |
+
/// \brief Consume a batch of data
|
| 483 |
+
virtual Status Consume(ExecBatch batch) = 0;
|
| 484 |
+
/// \brief Signal to the consumer that the last batch has been delivered
|
| 485 |
+
///
|
| 486 |
+
/// The returned future should only finish when all outstanding tasks have completed
|
| 487 |
+
///
|
| 488 |
+
/// If the plan is ended early or aborts due to an error then this will not be
|
| 489 |
+
/// called.
|
| 490 |
+
virtual Future<> Finish() = 0;
|
| 491 |
+
};
|
| 492 |
+
|
| 493 |
+
/// \brief Add a sink node which consumes data within the exec plan run
|
| 494 |
+
class ARROW_ACERO_EXPORT ConsumingSinkNodeOptions : public ExecNodeOptions {
|
| 495 |
+
public:
|
| 496 |
+
explicit ConsumingSinkNodeOptions(std::shared_ptr<SinkNodeConsumer> consumer,
|
| 497 |
+
std::vector<std::string> names = {},
|
| 498 |
+
std::optional<bool> sequence_output = std::nullopt)
|
| 499 |
+
: consumer(std::move(consumer)),
|
| 500 |
+
names(std::move(names)),
|
| 501 |
+
sequence_output(sequence_output) {}
|
| 502 |
+
|
| 503 |
+
std::shared_ptr<SinkNodeConsumer> consumer;
|
| 504 |
+
/// \brief Names to rename the sink's schema fields to
|
| 505 |
+
///
|
| 506 |
+
/// If specified then names must be provided for all fields. Currently, only a flat
|
| 507 |
+
/// schema is supported (see GH-31875).
|
| 508 |
+
///
|
| 509 |
+
/// If not specified then names will be generated based on the source data.
|
| 510 |
+
std::vector<std::string> names;
|
| 511 |
+
/// \brief Controls whether batches should be emitted immediately or sequenced in order
|
| 512 |
+
///
|
| 513 |
+
/// \see QueryOptions for more details
|
| 514 |
+
std::optional<bool> sequence_output;
|
| 515 |
+
};
|
| 516 |
+
|
| 517 |
+
/// \brief Make a node which sorts rows passed through it
|
| 518 |
+
///
|
| 519 |
+
/// All batches pushed to this node will be accumulated, then sorted, by the given
|
| 520 |
+
/// fields. Then sorted batches will be forwarded to the generator in sorted order.
|
| 521 |
+
class ARROW_ACERO_EXPORT OrderBySinkNodeOptions : public SinkNodeOptions {
|
| 522 |
+
public:
|
| 523 |
+
/// \brief create an instance from values
|
| 524 |
+
explicit OrderBySinkNodeOptions(
|
| 525 |
+
SortOptions sort_options,
|
| 526 |
+
std::function<Future<std::optional<ExecBatch>>()>* generator)
|
| 527 |
+
: SinkNodeOptions(generator), sort_options(std::move(sort_options)) {}
|
| 528 |
+
|
| 529 |
+
/// \brief options describing which columns and direction to sort
|
| 530 |
+
SortOptions sort_options;
|
| 531 |
+
};
|
| 532 |
+
|
| 533 |
+
/// \brief Apply a new ordering to data
|
| 534 |
+
///
|
| 535 |
+
/// Currently this node works by accumulating all data, sorting, and then emitting
|
| 536 |
+
/// the new data with an updated batch index.
|
| 537 |
+
///
|
| 538 |
+
/// Larger-than-memory sort is not currently supported.
|
| 539 |
+
class ARROW_ACERO_EXPORT OrderByNodeOptions : public ExecNodeOptions {
|
| 540 |
+
public:
|
| 541 |
+
static constexpr std::string_view kName = "order_by";
|
| 542 |
+
explicit OrderByNodeOptions(Ordering ordering) : ordering(std::move(ordering)) {}
|
| 543 |
+
|
| 544 |
+
/// \brief The new ordering to apply to outgoing data
|
| 545 |
+
Ordering ordering;
|
| 546 |
+
};
|
| 547 |
+
|
| 548 |
+
enum class JoinType {
|
| 549 |
+
LEFT_SEMI,
|
| 550 |
+
RIGHT_SEMI,
|
| 551 |
+
LEFT_ANTI,
|
| 552 |
+
RIGHT_ANTI,
|
| 553 |
+
INNER,
|
| 554 |
+
LEFT_OUTER,
|
| 555 |
+
RIGHT_OUTER,
|
| 556 |
+
FULL_OUTER
|
| 557 |
+
};
|
| 558 |
+
|
| 559 |
+
std::string ToString(JoinType t);
|
| 560 |
+
|
| 561 |
+
enum class JoinKeyCmp { EQ, IS };
|
| 562 |
+
|
| 563 |
+
/// \brief a node which implements a join operation using a hash table
|
| 564 |
+
class ARROW_ACERO_EXPORT HashJoinNodeOptions : public ExecNodeOptions {
|
| 565 |
+
public:
|
| 566 |
+
static constexpr const char* default_output_suffix_for_left = "";
|
| 567 |
+
static constexpr const char* default_output_suffix_for_right = "";
|
| 568 |
+
/// \brief create an instance from values that outputs all columns
|
| 569 |
+
HashJoinNodeOptions(
|
| 570 |
+
JoinType in_join_type, std::vector<FieldRef> in_left_keys,
|
| 571 |
+
std::vector<FieldRef> in_right_keys, Expression filter = literal(true),
|
| 572 |
+
std::string output_suffix_for_left = default_output_suffix_for_left,
|
| 573 |
+
std::string output_suffix_for_right = default_output_suffix_for_right,
|
| 574 |
+
bool disable_bloom_filter = false)
|
| 575 |
+
: join_type(in_join_type),
|
| 576 |
+
left_keys(std::move(in_left_keys)),
|
| 577 |
+
right_keys(std::move(in_right_keys)),
|
| 578 |
+
output_all(true),
|
| 579 |
+
output_suffix_for_left(std::move(output_suffix_for_left)),
|
| 580 |
+
output_suffix_for_right(std::move(output_suffix_for_right)),
|
| 581 |
+
filter(std::move(filter)),
|
| 582 |
+
disable_bloom_filter(disable_bloom_filter) {
|
| 583 |
+
this->key_cmp.resize(this->left_keys.size());
|
| 584 |
+
for (size_t i = 0; i < this->left_keys.size(); ++i) {
|
| 585 |
+
this->key_cmp[i] = JoinKeyCmp::EQ;
|
| 586 |
+
}
|
| 587 |
+
}
|
| 588 |
+
/// \brief create an instance from keys
|
| 589 |
+
///
|
| 590 |
+
/// This will create an inner join that outputs all columns and has no post join filter
|
| 591 |
+
///
|
| 592 |
+
/// `in_left_keys` should have the same length and types as `in_right_keys`
|
| 593 |
+
/// @param in_left_keys the keys in the left input
|
| 594 |
+
/// @param in_right_keys the keys in the right input
|
| 595 |
+
HashJoinNodeOptions(std::vector<FieldRef> in_left_keys,
|
| 596 |
+
std::vector<FieldRef> in_right_keys)
|
| 597 |
+
: left_keys(std::move(in_left_keys)), right_keys(std::move(in_right_keys)) {
|
| 598 |
+
this->join_type = JoinType::INNER;
|
| 599 |
+
this->output_all = true;
|
| 600 |
+
this->output_suffix_for_left = default_output_suffix_for_left;
|
| 601 |
+
this->output_suffix_for_right = default_output_suffix_for_right;
|
| 602 |
+
this->key_cmp.resize(this->left_keys.size());
|
| 603 |
+
for (size_t i = 0; i < this->left_keys.size(); ++i) {
|
| 604 |
+
this->key_cmp[i] = JoinKeyCmp::EQ;
|
| 605 |
+
}
|
| 606 |
+
this->filter = literal(true);
|
| 607 |
+
}
|
| 608 |
+
/// \brief create an instance from values using JoinKeyCmp::EQ for all comparisons
|
| 609 |
+
HashJoinNodeOptions(
|
| 610 |
+
JoinType join_type, std::vector<FieldRef> left_keys,
|
| 611 |
+
std::vector<FieldRef> right_keys, std::vector<FieldRef> left_output,
|
| 612 |
+
std::vector<FieldRef> right_output, Expression filter = literal(true),
|
| 613 |
+
std::string output_suffix_for_left = default_output_suffix_for_left,
|
| 614 |
+
std::string output_suffix_for_right = default_output_suffix_for_right,
|
| 615 |
+
bool disable_bloom_filter = false)
|
| 616 |
+
: join_type(join_type),
|
| 617 |
+
left_keys(std::move(left_keys)),
|
| 618 |
+
right_keys(std::move(right_keys)),
|
| 619 |
+
output_all(false),
|
| 620 |
+
left_output(std::move(left_output)),
|
| 621 |
+
right_output(std::move(right_output)),
|
| 622 |
+
output_suffix_for_left(std::move(output_suffix_for_left)),
|
| 623 |
+
output_suffix_for_right(std::move(output_suffix_for_right)),
|
| 624 |
+
filter(std::move(filter)),
|
| 625 |
+
disable_bloom_filter(disable_bloom_filter) {
|
| 626 |
+
this->key_cmp.resize(this->left_keys.size());
|
| 627 |
+
for (size_t i = 0; i < this->left_keys.size(); ++i) {
|
| 628 |
+
this->key_cmp[i] = JoinKeyCmp::EQ;
|
| 629 |
+
}
|
| 630 |
+
}
|
| 631 |
+
/// \brief create an instance from values
|
| 632 |
+
HashJoinNodeOptions(
|
| 633 |
+
JoinType join_type, std::vector<FieldRef> left_keys,
|
| 634 |
+
std::vector<FieldRef> right_keys, std::vector<FieldRef> left_output,
|
| 635 |
+
std::vector<FieldRef> right_output, std::vector<JoinKeyCmp> key_cmp,
|
| 636 |
+
Expression filter = literal(true),
|
| 637 |
+
std::string output_suffix_for_left = default_output_suffix_for_left,
|
| 638 |
+
std::string output_suffix_for_right = default_output_suffix_for_right,
|
| 639 |
+
bool disable_bloom_filter = false)
|
| 640 |
+
: join_type(join_type),
|
| 641 |
+
left_keys(std::move(left_keys)),
|
| 642 |
+
right_keys(std::move(right_keys)),
|
| 643 |
+
output_all(false),
|
| 644 |
+
left_output(std::move(left_output)),
|
| 645 |
+
right_output(std::move(right_output)),
|
| 646 |
+
key_cmp(std::move(key_cmp)),
|
| 647 |
+
output_suffix_for_left(std::move(output_suffix_for_left)),
|
| 648 |
+
output_suffix_for_right(std::move(output_suffix_for_right)),
|
| 649 |
+
filter(std::move(filter)),
|
| 650 |
+
disable_bloom_filter(disable_bloom_filter) {}
|
| 651 |
+
|
| 652 |
+
HashJoinNodeOptions() = default;
|
| 653 |
+
|
| 654 |
+
// type of join (inner, left, semi...)
|
| 655 |
+
JoinType join_type = JoinType::INNER;
|
| 656 |
+
// key fields from left input
|
| 657 |
+
std::vector<FieldRef> left_keys;
|
| 658 |
+
// key fields from right input
|
| 659 |
+
std::vector<FieldRef> right_keys;
|
| 660 |
+
// if set all valid fields from both left and right input will be output
|
| 661 |
+
// (and field ref vectors for output fields will be ignored)
|
| 662 |
+
bool output_all = false;
|
| 663 |
+
// output fields passed from left input
|
| 664 |
+
std::vector<FieldRef> left_output;
|
| 665 |
+
// output fields passed from right input
|
| 666 |
+
std::vector<FieldRef> right_output;
|
| 667 |
+
// key comparison function (determines whether a null key is equal another null
|
| 668 |
+
// key or not)
|
| 669 |
+
std::vector<JoinKeyCmp> key_cmp;
|
| 670 |
+
// suffix added to names of output fields coming from left input (used to distinguish,
|
| 671 |
+
// if necessary, between fields of the same name in left and right input and can be left
|
| 672 |
+
// empty if there are no name collisions)
|
| 673 |
+
std::string output_suffix_for_left;
|
| 674 |
+
// suffix added to names of output fields coming from right input
|
| 675 |
+
std::string output_suffix_for_right;
|
| 676 |
+
// residual filter which is applied to matching rows. Rows that do not match
|
| 677 |
+
// the filter are not included. The filter is applied against the
|
| 678 |
+
// concatenated input schema (left fields then right fields) and can reference
|
| 679 |
+
// fields that are not included in the output.
|
| 680 |
+
Expression filter = literal(true);
|
| 681 |
+
// whether or not to disable Bloom filters in this join
|
| 682 |
+
bool disable_bloom_filter = false;
|
| 683 |
+
};
|
| 684 |
+
|
| 685 |
+
/// \brief a node which implements the asof join operation
|
| 686 |
+
///
|
| 687 |
+
/// Note, this API is experimental and will change in the future
|
| 688 |
+
///
|
| 689 |
+
/// This node takes one left table and any number of right tables, and asof joins them
|
| 690 |
+
/// together. Batches produced by each input must be ordered by the "on" key.
|
| 691 |
+
/// This node will output one row for each row in the left table.
|
| 692 |
+
class ARROW_ACERO_EXPORT AsofJoinNodeOptions : public ExecNodeOptions {
|
| 693 |
+
public:
|
| 694 |
+
/// \brief Keys for one input table of the AsofJoin operation
|
| 695 |
+
///
|
| 696 |
+
/// The keys must be consistent across the input tables:
|
| 697 |
+
/// Each "on" key must refer to a field of the same type and units across the tables.
|
| 698 |
+
/// Each "by" key must refer to a list of fields of the same types across the tables.
|
| 699 |
+
struct Keys {
|
| 700 |
+
/// \brief "on" key for the join.
|
| 701 |
+
///
|
| 702 |
+
/// The input table must be sorted by the "on" key. Must be a single field of a common
|
| 703 |
+
/// type. An inexact match is used on the "on" key, i.e. a row is considered a
|
| 704 |
+
/// match if and only if `right.on - left.on` is in the range
|
| 705 |
+
/// `[min(0, tolerance), max(0, tolerance)]`.
|
| 706 |
+
/// Currently, the "on" key must be of an integer, date, or timestamp type.
|
| 707 |
+
FieldRef on_key;
|
| 708 |
+
/// \brief "by" key for the join.
|
| 709 |
+
///
|
| 710 |
+
/// Each input table must have each field of the "by" key. Exact equality is used for
|
| 711 |
+
/// each field of the "by" key.
|
| 712 |
+
/// Currently, each field of the "by" key must be of an integer, date, timestamp, or
|
| 713 |
+
/// base-binary type.
|
| 714 |
+
std::vector<FieldRef> by_key;
|
| 715 |
+
};
|
| 716 |
+
|
| 717 |
+
AsofJoinNodeOptions(std::vector<Keys> input_keys, int64_t tolerance)
|
| 718 |
+
: input_keys(std::move(input_keys)), tolerance(tolerance) {}
|
| 719 |
+
|
| 720 |
+
/// \brief AsofJoin keys per input table. At least two keys must be given. The first key
|
| 721 |
+
/// corresponds to a left table and all other keys correspond to right tables for the
|
| 722 |
+
/// as-of-join.
|
| 723 |
+
///
|
| 724 |
+
/// \see `Keys` for details.
|
| 725 |
+
std::vector<Keys> input_keys;
|
| 726 |
+
/// \brief Tolerance for inexact "on" key matching. A right row is considered a match
|
| 727 |
+
/// with a left row if `right.on - left.on` is in the range
|
| 728 |
+
/// `[min(0, tolerance), max(0, tolerance)]`. `tolerance` may be:
|
| 729 |
+
/// - negative, in which case a past-as-of-join occurs (match iff
|
| 730 |
+
/// `tolerance <= right.on - left.on <= 0`);
|
| 731 |
+
/// - or positive, in which case a future-as-of-join occurs (match iff
|
| 732 |
+
/// `0 <= right.on - left.on <= tolerance`);
|
| 733 |
+
/// - or zero, in which case an exact-as-of-join occurs (match iff
|
| 734 |
+
/// `right.on == left.on`).
|
| 735 |
+
///
|
| 736 |
+
/// The tolerance is interpreted in the same units as the "on" key.
|
| 737 |
+
int64_t tolerance;
|
| 738 |
+
};
|
| 739 |
+
|
| 740 |
+
/// \brief a node which select top_k/bottom_k rows passed through it
|
| 741 |
+
///
|
| 742 |
+
/// All batches pushed to this node will be accumulated, then selected, by the given
|
| 743 |
+
/// fields. Then sorted batches will be forwarded to the generator in sorted order.
|
| 744 |
+
class ARROW_ACERO_EXPORT SelectKSinkNodeOptions : public SinkNodeOptions {
|
| 745 |
+
public:
|
| 746 |
+
explicit SelectKSinkNodeOptions(
|
| 747 |
+
SelectKOptions select_k_options,
|
| 748 |
+
std::function<Future<std::optional<ExecBatch>>()>* generator)
|
| 749 |
+
: SinkNodeOptions(generator), select_k_options(std::move(select_k_options)) {}
|
| 750 |
+
|
| 751 |
+
/// SelectK options
|
| 752 |
+
SelectKOptions select_k_options;
|
| 753 |
+
};
|
| 754 |
+
|
| 755 |
+
/// \brief a sink node which accumulates all output into a table
|
| 756 |
+
class ARROW_ACERO_EXPORT TableSinkNodeOptions : public ExecNodeOptions {
|
| 757 |
+
public:
|
| 758 |
+
/// \brief create an instance from values
|
| 759 |
+
explicit TableSinkNodeOptions(std::shared_ptr<Table>* output_table,
|
| 760 |
+
std::optional<bool> sequence_output = std::nullopt)
|
| 761 |
+
: output_table(output_table), sequence_output(sequence_output) {}
|
| 762 |
+
|
| 763 |
+
/// \brief an "out parameter" specifying the table that will be created
|
| 764 |
+
///
|
| 765 |
+
/// Must not be null and remain valid for the entirety of the plan execution. After the
|
| 766 |
+
/// plan has completed this will be set to point to the result table
|
| 767 |
+
std::shared_ptr<Table>* output_table;
|
| 768 |
+
/// \brief Controls whether batches should be emitted immediately or sequenced in order
|
| 769 |
+
///
|
| 770 |
+
/// \see QueryOptions for more details
|
| 771 |
+
std::optional<bool> sequence_output;
|
| 772 |
+
/// \brief Custom names to use for the columns.
|
| 773 |
+
///
|
| 774 |
+
/// If specified then names must be provided for all fields. Currently, only a flat
|
| 775 |
+
/// schema is supported (see GH-31875).
|
| 776 |
+
///
|
| 777 |
+
/// If not specified then names will be generated based on the source data.
|
| 778 |
+
std::vector<std::string> names;
|
| 779 |
+
};
|
| 780 |
+
|
| 781 |
+
/// \brief a row template that describes one row that will be generated for each input row
|
| 782 |
+
struct ARROW_ACERO_EXPORT PivotLongerRowTemplate {
|
| 783 |
+
PivotLongerRowTemplate(std::vector<std::string> feature_values,
|
| 784 |
+
std::vector<std::optional<FieldRef>> measurement_values)
|
| 785 |
+
: feature_values(std::move(feature_values)),
|
| 786 |
+
measurement_values(std::move(measurement_values)) {}
|
| 787 |
+
/// A (typically unique) set of feature values for the template, usually derived from a
|
| 788 |
+
/// column name
|
| 789 |
+
///
|
| 790 |
+
/// These will be used to populate the feature columns
|
| 791 |
+
std::vector<std::string> feature_values;
|
| 792 |
+
/// The fields containing the measurements to use for this row
|
| 793 |
+
///
|
| 794 |
+
/// These will be used to populate the measurement columns. If nullopt then nulls
|
| 795 |
+
/// will be inserted for the given value.
|
| 796 |
+
std::vector<std::optional<FieldRef>> measurement_values;
|
| 797 |
+
};
|
| 798 |
+
|
| 799 |
+
/// \brief Reshape a table by turning some columns into additional rows
|
| 800 |
+
///
|
| 801 |
+
/// This operation is sometimes also referred to as UNPIVOT
|
| 802 |
+
///
|
| 803 |
+
/// This is typically done when there are multiple observations in each row in order to
|
| 804 |
+
/// transform to a table containing a single observation per row.
|
| 805 |
+
///
|
| 806 |
+
/// For example:
|
| 807 |
+
///
|
| 808 |
+
/// | time | left_temp | right_temp |
|
| 809 |
+
/// | ---- | --------- | ---------- |
|
| 810 |
+
/// | 1 | 10 | 20 |
|
| 811 |
+
/// | 2 | 15 | 18 |
|
| 812 |
+
///
|
| 813 |
+
/// The above table contains two observations per row. There is an implicit feature
|
| 814 |
+
/// "location" (left vs right) and a measurement "temp". What we really want is:
|
| 815 |
+
///
|
| 816 |
+
/// | time | location | temp |
|
| 817 |
+
/// | --- | --- | --- |
|
| 818 |
+
/// | 1 | left | 10 |
|
| 819 |
+
/// | 1 | right | 20 |
|
| 820 |
+
/// | 2 | left | 15 |
|
| 821 |
+
/// | 2 | right | 18 |
|
| 822 |
+
///
|
| 823 |
+
/// For a more complex example consider:
|
| 824 |
+
///
|
| 825 |
+
/// | time | ax1 | ay1 | bx1 | ay2 |
|
| 826 |
+
/// | ---- | --- | --- | --- | --- |
|
| 827 |
+
/// | 0 | 1 | 2 | 3 | 4 |
|
| 828 |
+
///
|
| 829 |
+
/// We can pretend a vs b and x vs y are features while 1 and 2 are two different
|
| 830 |
+
/// kinds of measurements. We thus want to pivot to
|
| 831 |
+
///
|
| 832 |
+
/// | time | a/b | x/y | f1 | f2 |
|
| 833 |
+
/// | ---- | --- | --- | ---- | ---- |
|
| 834 |
+
/// | 0 | a | x | 1 | null |
|
| 835 |
+
/// | 0 | a | y | 2 | 4 |
|
| 836 |
+
/// | 0 | b | x | 3 | null |
|
| 837 |
+
///
|
| 838 |
+
/// To do this we create a row template for each combination of features. One should
|
| 839 |
+
/// be able to do this purely by looking at the column names. For example, given the
|
| 840 |
+
/// above columns "ax1", "ay1", "bx1", and "ay2" we know we have three feature
|
| 841 |
+
/// combinations (a, x), (a, y), and (b, x). Similarly, we know we have two possible
|
| 842 |
+
/// measurements, "1" and "2".
|
| 843 |
+
///
|
| 844 |
+
/// For each combination of features we create a row template. In each row template we
|
| 845 |
+
/// describe the combination and then list which columns to use for the measurements.
|
| 846 |
+
/// If a measurement doesn't exist for a given combination then we use nullopt.
|
| 847 |
+
///
|
| 848 |
+
/// So, for our above example, we have:
|
| 849 |
+
///
|
| 850 |
+
/// (a, x): names={"a", "x"}, values={"ax1", nullopt}
|
| 851 |
+
/// (a, y): names={"a", "y"}, values={"ay1", "ay2"}
|
| 852 |
+
/// (b, x): names={"b", "x"}, values={"bx1", nullopt}
|
| 853 |
+
///
|
| 854 |
+
/// Finishing it off we name our new columns:
|
| 855 |
+
/// feature_field_names={"a/b","x/y"}
|
| 856 |
+
/// measurement_field_names={"f1", "f2"}
|
| 857 |
+
class ARROW_ACERO_EXPORT PivotLongerNodeOptions : public ExecNodeOptions {
|
| 858 |
+
public:
|
| 859 |
+
static constexpr std::string_view kName = "pivot_longer";
|
| 860 |
+
/// One or more row templates to create new output rows
|
| 861 |
+
///
|
| 862 |
+
/// Normally there are at least two row templates. The output # of rows
|
| 863 |
+
/// will be the input # of rows * the number of row templates
|
| 864 |
+
std::vector<PivotLongerRowTemplate> row_templates;
|
| 865 |
+
/// The names of the columns which describe the new features
|
| 866 |
+
std::vector<std::string> feature_field_names;
|
| 867 |
+
/// The names of the columns which represent the measurements
|
| 868 |
+
std::vector<std::string> measurement_field_names;
|
| 869 |
+
};
|
| 870 |
+
|
| 871 |
+
/// @}
|
| 872 |
+
|
| 873 |
+
} // namespace acero
|
| 874 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/order_by_impl.h
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <functional>
|
| 21 |
+
#include <memory>
|
| 22 |
+
#include <vector>
|
| 23 |
+
|
| 24 |
+
#include "arrow/acero/options.h"
|
| 25 |
+
#include "arrow/record_batch.h"
|
| 26 |
+
#include "arrow/result.h"
|
| 27 |
+
#include "arrow/status.h"
|
| 28 |
+
#include "arrow/type.h"
|
| 29 |
+
|
| 30 |
+
namespace arrow {
|
| 31 |
+
|
| 32 |
+
using compute::ExecContext;
|
| 33 |
+
|
| 34 |
+
namespace acero {
|
| 35 |
+
|
| 36 |
+
class OrderByImpl {
|
| 37 |
+
public:
|
| 38 |
+
virtual ~OrderByImpl() = default;
|
| 39 |
+
|
| 40 |
+
virtual void InputReceived(const std::shared_ptr<RecordBatch>& batch) = 0;
|
| 41 |
+
|
| 42 |
+
virtual Result<Datum> DoFinish() = 0;
|
| 43 |
+
|
| 44 |
+
virtual std::string ToString() const = 0;
|
| 45 |
+
|
| 46 |
+
static Result<std::unique_ptr<OrderByImpl>> MakeSort(
|
| 47 |
+
ExecContext* ctx, const std::shared_ptr<Schema>& output_schema,
|
| 48 |
+
const SortOptions& options);
|
| 49 |
+
|
| 50 |
+
static Result<std::unique_ptr<OrderByImpl>> MakeSelectK(
|
| 51 |
+
ExecContext* ctx, const std::shared_ptr<Schema>& output_schema,
|
| 52 |
+
const SelectKOptions& options);
|
| 53 |
+
};
|
| 54 |
+
|
| 55 |
+
} // namespace acero
|
| 56 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/partition_util.h
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <atomic>
|
| 21 |
+
#include <cassert>
|
| 22 |
+
#include <cstdint>
|
| 23 |
+
#include <functional>
|
| 24 |
+
#include <random>
|
| 25 |
+
|
| 26 |
+
#include "arrow/acero/util.h"
|
| 27 |
+
#include "arrow/buffer.h"
|
| 28 |
+
#include "arrow/util/pcg_random.h"
|
| 29 |
+
|
| 30 |
+
namespace arrow {
|
| 31 |
+
namespace acero {
|
| 32 |
+
|
| 33 |
+
class PartitionSort {
|
| 34 |
+
public:
|
| 35 |
+
/// \brief Bucket sort rows on partition ids in O(num_rows) time.
|
| 36 |
+
///
|
| 37 |
+
/// Include in the output exclusive cumulative sum of bucket sizes.
|
| 38 |
+
/// This corresponds to ranges in the sorted array containing all row ids for
|
| 39 |
+
/// each of the partitions.
|
| 40 |
+
///
|
| 41 |
+
/// prtn_ranges must be initialized and have at least num_prtns + 1 elements
|
| 42 |
+
/// when this method returns prtn_ranges[i] will contains the total number of
|
| 43 |
+
/// elements in partitions 0 through i. prtn_ranges[0] will be 0.
|
| 44 |
+
///
|
| 45 |
+
/// prtn_id_impl must be a function that takes in a row id (int) and returns
|
| 46 |
+
/// a partition id (int). The returned partition id must be between 0 and
|
| 47 |
+
/// num_prtns (exclusive).
|
| 48 |
+
///
|
| 49 |
+
/// output_pos_impl is a function that takes in a row id (int) and a position (int)
|
| 50 |
+
/// in the bucket sorted output. The function should insert the row in the
|
| 51 |
+
/// output.
|
| 52 |
+
///
|
| 53 |
+
/// For example:
|
| 54 |
+
///
|
| 55 |
+
/// in_arr: [5, 7, 2, 3, 5, 4]
|
| 56 |
+
/// num_prtns: 3
|
| 57 |
+
/// prtn_id_impl: [&in_arr] (int row_id) { return in_arr[row_id] / 3; }
|
| 58 |
+
/// output_pos_impl: [&sorted_row_ids] (int row_id, int pos) { sorted_row_ids[pos] =
|
| 59 |
+
/// row_id; }
|
| 60 |
+
///
|
| 61 |
+
/// After Execution
|
| 62 |
+
/// sorted_row_ids: [2, 0, 3, 4, 5, 1]
|
| 63 |
+
/// prtn_ranges: [0, 1, 5, 6]
|
| 64 |
+
template <class INPUT_PRTN_ID_FN, class OUTPUT_POS_FN>
|
| 65 |
+
static void Eval(int64_t num_rows, int num_prtns, uint16_t* prtn_ranges,
|
| 66 |
+
INPUT_PRTN_ID_FN prtn_id_impl, OUTPUT_POS_FN output_pos_impl) {
|
| 67 |
+
ARROW_DCHECK(num_rows > 0 && num_rows <= (1 << 15));
|
| 68 |
+
ARROW_DCHECK(num_prtns >= 1 && num_prtns <= (1 << 15));
|
| 69 |
+
|
| 70 |
+
memset(prtn_ranges, 0, (num_prtns + 1) * sizeof(uint16_t));
|
| 71 |
+
|
| 72 |
+
for (int64_t i = 0; i < num_rows; ++i) {
|
| 73 |
+
int prtn_id = static_cast<int>(prtn_id_impl(i));
|
| 74 |
+
++prtn_ranges[prtn_id + 1];
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
uint16_t sum = 0;
|
| 78 |
+
for (int i = 0; i < num_prtns; ++i) {
|
| 79 |
+
uint16_t sum_next = sum + prtn_ranges[i + 1];
|
| 80 |
+
prtn_ranges[i + 1] = sum;
|
| 81 |
+
sum = sum_next;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
for (int64_t i = 0; i < num_rows; ++i) {
|
| 85 |
+
int prtn_id = static_cast<int>(prtn_id_impl(i));
|
| 86 |
+
int pos = prtn_ranges[prtn_id + 1]++;
|
| 87 |
+
output_pos_impl(i, pos);
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
};
|
| 91 |
+
|
| 92 |
+
/// \brief A control for synchronizing threads on a partitionable workload
|
| 93 |
+
class PartitionLocks {
|
| 94 |
+
public:
|
| 95 |
+
PartitionLocks();
|
| 96 |
+
~PartitionLocks();
|
| 97 |
+
/// \brief Initializes the control, must be called before use
|
| 98 |
+
///
|
| 99 |
+
/// \param num_threads Maximum number of threads that will access the partitions
|
| 100 |
+
/// \param num_prtns Number of partitions to synchronize
|
| 101 |
+
void Init(size_t num_threads, int num_prtns);
|
| 102 |
+
/// \brief Cleans up the control, it should not be used after this call
|
| 103 |
+
void CleanUp();
|
| 104 |
+
/// \brief Acquire a partition to work on one
|
| 105 |
+
///
|
| 106 |
+
/// \param thread_id The index of the thread trying to acquire the partition lock
|
| 107 |
+
/// \param num_prtns Length of prtns_to_try, must be <= num_prtns used in Init
|
| 108 |
+
/// \param prtns_to_try An array of partitions that still have remaining work
|
| 109 |
+
/// \param limit_retries If false, this method will spinwait forever until success
|
| 110 |
+
/// \param max_retries Max times to attempt checking out work before returning false
|
| 111 |
+
/// \param[out] locked_prtn_id The id of the partition locked
|
| 112 |
+
/// \param[out] locked_prtn_id_pos The index of the partition locked in prtns_to_try
|
| 113 |
+
/// \return True if a partition was locked, false if max_retries was attempted
|
| 114 |
+
/// without successfully acquiring a lock
|
| 115 |
+
///
|
| 116 |
+
/// This method is thread safe
|
| 117 |
+
bool AcquirePartitionLock(size_t thread_id, int num_prtns, const int* prtns_to_try,
|
| 118 |
+
bool limit_retries, int max_retries, int* locked_prtn_id,
|
| 119 |
+
int* locked_prtn_id_pos);
|
| 120 |
+
/// \brief Release a partition so that other threads can work on it
|
| 121 |
+
void ReleasePartitionLock(int prtn_id);
|
| 122 |
+
|
| 123 |
+
// Executes (synchronously and using current thread) the same operation on a set of
|
| 124 |
+
// multiple partitions. Tries to minimize partition locking overhead by randomizing and
|
| 125 |
+
// adjusting order in which partitions are processed.
|
| 126 |
+
//
|
| 127 |
+
// PROCESS_PRTN_FN is a callback which will be executed for each partition after
|
| 128 |
+
// acquiring the lock for that partition. It gets partition id as an argument.
|
| 129 |
+
// IS_PRTN_EMPTY_FN is a callback which filters out (when returning true) partitions
|
| 130 |
+
// with specific ids from processing.
|
| 131 |
+
//
|
| 132 |
+
template <typename IS_PRTN_EMPTY_FN, typename PROCESS_PRTN_FN>
|
| 133 |
+
Status ForEachPartition(size_t thread_id,
|
| 134 |
+
/*scratch space buffer with space for one element per partition;
|
| 135 |
+
dirty in and dirty out*/
|
| 136 |
+
int* temp_unprocessed_prtns, IS_PRTN_EMPTY_FN is_prtn_empty_fn,
|
| 137 |
+
PROCESS_PRTN_FN process_prtn_fn) {
|
| 138 |
+
int num_unprocessed_partitions = 0;
|
| 139 |
+
for (int i = 0; i < num_prtns_; ++i) {
|
| 140 |
+
bool is_prtn_empty = is_prtn_empty_fn(i);
|
| 141 |
+
if (!is_prtn_empty) {
|
| 142 |
+
temp_unprocessed_prtns[num_unprocessed_partitions++] = i;
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
while (num_unprocessed_partitions > 0) {
|
| 146 |
+
int locked_prtn_id;
|
| 147 |
+
int locked_prtn_id_pos;
|
| 148 |
+
AcquirePartitionLock(thread_id, num_unprocessed_partitions, temp_unprocessed_prtns,
|
| 149 |
+
/*limit_retries=*/false, /*max_retries=*/-1, &locked_prtn_id,
|
| 150 |
+
&locked_prtn_id_pos);
|
| 151 |
+
{
|
| 152 |
+
class AutoReleaseLock {
|
| 153 |
+
public:
|
| 154 |
+
AutoReleaseLock(PartitionLocks* locks, int prtn_id)
|
| 155 |
+
: locks(locks), prtn_id(prtn_id) {}
|
| 156 |
+
~AutoReleaseLock() { locks->ReleasePartitionLock(prtn_id); }
|
| 157 |
+
PartitionLocks* locks;
|
| 158 |
+
int prtn_id;
|
| 159 |
+
} auto_release_lock(this, locked_prtn_id);
|
| 160 |
+
ARROW_RETURN_NOT_OK(process_prtn_fn(locked_prtn_id));
|
| 161 |
+
}
|
| 162 |
+
if (locked_prtn_id_pos < num_unprocessed_partitions - 1) {
|
| 163 |
+
temp_unprocessed_prtns[locked_prtn_id_pos] =
|
| 164 |
+
temp_unprocessed_prtns[num_unprocessed_partitions - 1];
|
| 165 |
+
}
|
| 166 |
+
--num_unprocessed_partitions;
|
| 167 |
+
}
|
| 168 |
+
return Status::OK();
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
private:
|
| 172 |
+
std::atomic<bool>* lock_ptr(int prtn_id);
|
| 173 |
+
int random_int(size_t thread_id, int num_values);
|
| 174 |
+
|
| 175 |
+
struct PartitionLock {
|
| 176 |
+
static constexpr int kCacheLineBytes = 64;
|
| 177 |
+
std::atomic<bool> lock;
|
| 178 |
+
uint8_t padding[kCacheLineBytes];
|
| 179 |
+
};
|
| 180 |
+
int num_prtns_;
|
| 181 |
+
std::unique_ptr<PartitionLock[]> locks_;
|
| 182 |
+
std::unique_ptr<arrow::random::pcg32_fast[]> rngs_;
|
| 183 |
+
};
|
| 184 |
+
|
| 185 |
+
} // namespace acero
|
| 186 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/query_context.h
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <string_view>
|
| 20 |
+
|
| 21 |
+
#include "arrow/acero/exec_plan.h"
|
| 22 |
+
#include "arrow/acero/task_util.h"
|
| 23 |
+
#include "arrow/acero/util.h"
|
| 24 |
+
#include "arrow/compute/exec.h"
|
| 25 |
+
#include "arrow/io/interfaces.h"
|
| 26 |
+
#include "arrow/util/async_util.h"
|
| 27 |
+
#include "arrow/util/type_fwd.h"
|
| 28 |
+
|
| 29 |
+
namespace arrow {
|
| 30 |
+
|
| 31 |
+
using compute::default_exec_context;
|
| 32 |
+
using io::IOContext;
|
| 33 |
+
|
| 34 |
+
namespace acero {
|
| 35 |
+
|
| 36 |
+
class ARROW_ACERO_EXPORT QueryContext {
|
| 37 |
+
public:
|
| 38 |
+
QueryContext(QueryOptions opts = {},
|
| 39 |
+
ExecContext exec_context = *default_exec_context());
|
| 40 |
+
|
| 41 |
+
Status Init(arrow::util::AsyncTaskScheduler* scheduler);
|
| 42 |
+
|
| 43 |
+
const ::arrow::internal::CpuInfo* cpu_info() const;
|
| 44 |
+
int64_t hardware_flags() const;
|
| 45 |
+
const QueryOptions& options() const { return options_; }
|
| 46 |
+
MemoryPool* memory_pool() const { return exec_context_.memory_pool(); }
|
| 47 |
+
::arrow::internal::Executor* executor() const { return exec_context_.executor(); }
|
| 48 |
+
ExecContext* exec_context() { return &exec_context_; }
|
| 49 |
+
IOContext* io_context() { return &io_context_; }
|
| 50 |
+
TaskScheduler* scheduler() { return task_scheduler_.get(); }
|
| 51 |
+
arrow::util::AsyncTaskScheduler* async_scheduler() { return async_scheduler_; }
|
| 52 |
+
|
| 53 |
+
size_t GetThreadIndex();
|
| 54 |
+
size_t max_concurrency() const;
|
| 55 |
+
|
| 56 |
+
/// \brief Start an external task
|
| 57 |
+
///
|
| 58 |
+
/// This should be avoided if possible. It is kept in for now for legacy
|
| 59 |
+
/// purposes. This should be called before the external task is started. If
|
| 60 |
+
/// a valid future is returned then it should be marked complete when the
|
| 61 |
+
/// external task has finished.
|
| 62 |
+
///
|
| 63 |
+
/// \param name A name to give the task for traceability and debugging
|
| 64 |
+
///
|
| 65 |
+
/// \return an invalid future if the plan has already ended, otherwise this
|
| 66 |
+
/// returns a future that must be completed when the external task
|
| 67 |
+
/// finishes.
|
| 68 |
+
Result<Future<>> BeginExternalTask(std::string_view name);
|
| 69 |
+
|
| 70 |
+
/// \brief Add a single function as a task to the query's task group
|
| 71 |
+
/// on the compute threadpool.
|
| 72 |
+
///
|
| 73 |
+
/// \param fn The task to run. Takes no arguments and returns a Status.
|
| 74 |
+
/// \param name A name to give the task for traceability and debugging
|
| 75 |
+
void ScheduleTask(std::function<Status()> fn, std::string_view name);
|
| 76 |
+
/// \brief Add a single function as a task to the query's task group
|
| 77 |
+
/// on the compute threadpool.
|
| 78 |
+
///
|
| 79 |
+
/// \param fn The task to run. Takes the thread index and returns a Status.
|
| 80 |
+
/// \param name A name to give the task for traceability and debugging
|
| 81 |
+
void ScheduleTask(std::function<Status(size_t)> fn, std::string_view name);
|
| 82 |
+
/// \brief Add a single function as a task to the query's task group on
|
| 83 |
+
/// the IO thread pool
|
| 84 |
+
///
|
| 85 |
+
/// \param fn The task to run. Returns a status.
|
| 86 |
+
/// \param name A name to give the task for traceability and debugging
|
| 87 |
+
void ScheduleIOTask(std::function<Status()> fn, std::string_view name);
|
| 88 |
+
|
| 89 |
+
// Register/Start TaskGroup is a way of performing a "Parallel For" pattern:
|
| 90 |
+
// - The task function takes the thread index and the index of the task
|
| 91 |
+
// - The on_finished function takes the thread index
|
| 92 |
+
// Returns an integer ID that will be used to reference the task group in
|
| 93 |
+
// StartTaskGroup. At runtime, call StartTaskGroup with the ID and the number of times
|
| 94 |
+
// you'd like the task to be executed. The need to register a task group before use will
|
| 95 |
+
// be removed after we rewrite the scheduler.
|
| 96 |
+
/// \brief Register a "parallel for" task group with the scheduler
|
| 97 |
+
///
|
| 98 |
+
/// \param task The function implementing the task. Takes the thread_index and
|
| 99 |
+
/// the task index.
|
| 100 |
+
/// \param on_finished The function that gets run once all tasks have been completed.
|
| 101 |
+
/// Takes the thread_index.
|
| 102 |
+
///
|
| 103 |
+
/// Must be called inside of ExecNode::Init.
|
| 104 |
+
int RegisterTaskGroup(std::function<Status(size_t, int64_t)> task,
|
| 105 |
+
std::function<Status(size_t)> on_finished);
|
| 106 |
+
|
| 107 |
+
/// \brief Start the task group with the specified ID. This can only
|
| 108 |
+
/// be called once per task_group_id.
|
| 109 |
+
///
|
| 110 |
+
/// \param task_group_id The ID of the task group to run
|
| 111 |
+
/// \param num_tasks The number of times to run the task
|
| 112 |
+
Status StartTaskGroup(int task_group_id, int64_t num_tasks);
|
| 113 |
+
|
| 114 |
+
// This is an RAII class for keeping track of in-flight file IO. Useful for getting
|
| 115 |
+
// an estimate of memory use, and how much memory we expect to be freed soon.
|
| 116 |
+
// Returned by ReportTempFileIO.
|
| 117 |
+
struct [[nodiscard]] TempFileIOMark {
|
| 118 |
+
QueryContext* ctx_;
|
| 119 |
+
size_t bytes_;
|
| 120 |
+
|
| 121 |
+
TempFileIOMark(QueryContext* ctx, size_t bytes) : ctx_(ctx), bytes_(bytes) {
|
| 122 |
+
ctx_->in_flight_bytes_to_disk_.fetch_add(bytes_, std::memory_order_acquire);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
ARROW_DISALLOW_COPY_AND_ASSIGN(TempFileIOMark);
|
| 126 |
+
|
| 127 |
+
~TempFileIOMark() {
|
| 128 |
+
ctx_->in_flight_bytes_to_disk_.fetch_sub(bytes_, std::memory_order_release);
|
| 129 |
+
}
|
| 130 |
+
};
|
| 131 |
+
|
| 132 |
+
TempFileIOMark ReportTempFileIO(size_t bytes) { return {this, bytes}; }
|
| 133 |
+
|
| 134 |
+
size_t GetCurrentTempFileIO() { return in_flight_bytes_to_disk_.load(); }
|
| 135 |
+
|
| 136 |
+
private:
|
| 137 |
+
QueryOptions options_;
|
| 138 |
+
// To be replaced with Acero-specific context once scheduler is done and
|
| 139 |
+
// we don't need ExecContext for kernels
|
| 140 |
+
ExecContext exec_context_;
|
| 141 |
+
IOContext io_context_;
|
| 142 |
+
|
| 143 |
+
arrow::util::AsyncTaskScheduler* async_scheduler_ = NULLPTR;
|
| 144 |
+
std::unique_ptr<TaskScheduler> task_scheduler_ = TaskScheduler::Make();
|
| 145 |
+
|
| 146 |
+
ThreadIndexer thread_indexer_;
|
| 147 |
+
|
| 148 |
+
std::atomic<size_t> in_flight_bytes_to_disk_{0};
|
| 149 |
+
};
|
| 150 |
+
} // namespace acero
|
| 151 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/schema_util.h
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cassert>
|
| 21 |
+
#include <cstdint>
|
| 22 |
+
#include <memory>
|
| 23 |
+
#include <string>
|
| 24 |
+
#include <vector>
|
| 25 |
+
|
| 26 |
+
#include "arrow/type.h" // for DataType, FieldRef, Field and Schema
|
| 27 |
+
|
| 28 |
+
namespace arrow {
|
| 29 |
+
|
| 30 |
+
using internal::checked_cast;
|
| 31 |
+
|
| 32 |
+
namespace acero {
|
| 33 |
+
|
| 34 |
+
// Identifiers for all different row schemas that are used in a join
|
| 35 |
+
//
|
| 36 |
+
enum class HashJoinProjection : int {
|
| 37 |
+
INPUT = 0,
|
| 38 |
+
KEY = 1,
|
| 39 |
+
PAYLOAD = 2,
|
| 40 |
+
FILTER = 3,
|
| 41 |
+
OUTPUT = 4
|
| 42 |
+
};
|
| 43 |
+
|
| 44 |
+
struct SchemaProjectionMap {
|
| 45 |
+
static constexpr int kMissingField = -1;
|
| 46 |
+
int num_cols;
|
| 47 |
+
const int* source_to_base;
|
| 48 |
+
const int* base_to_target;
|
| 49 |
+
inline int get(int i) const {
|
| 50 |
+
assert(i >= 0 && i < num_cols);
|
| 51 |
+
assert(source_to_base[i] != kMissingField);
|
| 52 |
+
return base_to_target[source_to_base[i]];
|
| 53 |
+
}
|
| 54 |
+
};
|
| 55 |
+
|
| 56 |
+
/// Helper class for managing different projections of the same row schema.
|
| 57 |
+
/// Used to efficiently map any field in one projection to a corresponding field in
|
| 58 |
+
/// another projection.
|
| 59 |
+
/// Materialized mappings are generated lazily at the time of the first access.
|
| 60 |
+
/// Thread-safe apart from initialization.
|
| 61 |
+
template <typename ProjectionIdEnum>
|
| 62 |
+
class SchemaProjectionMaps {
|
| 63 |
+
public:
|
| 64 |
+
static constexpr int kMissingField = -1;
|
| 65 |
+
|
| 66 |
+
Status Init(ProjectionIdEnum full_schema_handle, const Schema& schema,
|
| 67 |
+
const std::vector<ProjectionIdEnum>& projection_handles,
|
| 68 |
+
const std::vector<const std::vector<FieldRef>*>& projections) {
|
| 69 |
+
assert(projection_handles.size() == projections.size());
|
| 70 |
+
ARROW_RETURN_NOT_OK(RegisterSchema(full_schema_handle, schema));
|
| 71 |
+
for (size_t i = 0; i < projections.size(); ++i) {
|
| 72 |
+
ARROW_RETURN_NOT_OK(
|
| 73 |
+
RegisterProjectedSchema(projection_handles[i], *(projections[i]), schema));
|
| 74 |
+
}
|
| 75 |
+
RegisterEnd();
|
| 76 |
+
return Status::OK();
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
int num_cols(ProjectionIdEnum schema_handle) const {
|
| 80 |
+
int id = schema_id(schema_handle);
|
| 81 |
+
return static_cast<int>(schemas_[id].second.data_types.size());
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
bool is_empty(ProjectionIdEnum schema_handle) const {
|
| 85 |
+
return num_cols(schema_handle) == 0;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
const std::string& field_name(ProjectionIdEnum schema_handle, int field_id) const {
|
| 89 |
+
int id = schema_id(schema_handle);
|
| 90 |
+
return schemas_[id].second.field_names[field_id];
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
const std::shared_ptr<DataType>& data_type(ProjectionIdEnum schema_handle,
|
| 94 |
+
int field_id) const {
|
| 95 |
+
int id = schema_id(schema_handle);
|
| 96 |
+
return schemas_[id].second.data_types[field_id];
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
const std::vector<std::shared_ptr<DataType>>& data_types(
|
| 100 |
+
ProjectionIdEnum schema_handle) const {
|
| 101 |
+
int id = schema_id(schema_handle);
|
| 102 |
+
return schemas_[id].second.data_types;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
SchemaProjectionMap map(ProjectionIdEnum from, ProjectionIdEnum to) const {
|
| 106 |
+
int id_from = schema_id(from);
|
| 107 |
+
int id_to = schema_id(to);
|
| 108 |
+
SchemaProjectionMap result;
|
| 109 |
+
result.num_cols = num_cols(from);
|
| 110 |
+
result.source_to_base = mappings_[id_from].data();
|
| 111 |
+
result.base_to_target = inverse_mappings_[id_to].data();
|
| 112 |
+
return result;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
protected:
|
| 116 |
+
struct FieldInfos {
|
| 117 |
+
std::vector<int> field_paths;
|
| 118 |
+
std::vector<std::string> field_names;
|
| 119 |
+
std::vector<std::shared_ptr<DataType>> data_types;
|
| 120 |
+
};
|
| 121 |
+
|
| 122 |
+
Status RegisterSchema(ProjectionIdEnum handle, const Schema& schema) {
|
| 123 |
+
FieldInfos out_fields;
|
| 124 |
+
const FieldVector& in_fields = schema.fields();
|
| 125 |
+
out_fields.field_paths.resize(in_fields.size());
|
| 126 |
+
out_fields.field_names.resize(in_fields.size());
|
| 127 |
+
out_fields.data_types.resize(in_fields.size());
|
| 128 |
+
for (size_t i = 0; i < in_fields.size(); ++i) {
|
| 129 |
+
const std::string& name = in_fields[i]->name();
|
| 130 |
+
const std::shared_ptr<DataType>& type = in_fields[i]->type();
|
| 131 |
+
out_fields.field_paths[i] = static_cast<int>(i);
|
| 132 |
+
out_fields.field_names[i] = name;
|
| 133 |
+
out_fields.data_types[i] = type;
|
| 134 |
+
}
|
| 135 |
+
schemas_.push_back(std::make_pair(handle, out_fields));
|
| 136 |
+
return Status::OK();
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
Status RegisterProjectedSchema(ProjectionIdEnum handle,
|
| 140 |
+
const std::vector<FieldRef>& selected_fields,
|
| 141 |
+
const Schema& full_schema) {
|
| 142 |
+
FieldInfos out_fields;
|
| 143 |
+
const FieldVector& in_fields = full_schema.fields();
|
| 144 |
+
out_fields.field_paths.resize(selected_fields.size());
|
| 145 |
+
out_fields.field_names.resize(selected_fields.size());
|
| 146 |
+
out_fields.data_types.resize(selected_fields.size());
|
| 147 |
+
for (size_t i = 0; i < selected_fields.size(); ++i) {
|
| 148 |
+
// All fields must be found in schema without ambiguity
|
| 149 |
+
ARROW_ASSIGN_OR_RAISE(auto match, selected_fields[i].FindOne(full_schema));
|
| 150 |
+
const std::string& name = in_fields[match[0]]->name();
|
| 151 |
+
const std::shared_ptr<DataType>& type = in_fields[match[0]]->type();
|
| 152 |
+
out_fields.field_paths[i] = match[0];
|
| 153 |
+
out_fields.field_names[i] = name;
|
| 154 |
+
out_fields.data_types[i] = type;
|
| 155 |
+
}
|
| 156 |
+
schemas_.push_back(std::make_pair(handle, out_fields));
|
| 157 |
+
return Status::OK();
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
void RegisterEnd() {
|
| 161 |
+
size_t size = schemas_.size();
|
| 162 |
+
mappings_.resize(size);
|
| 163 |
+
inverse_mappings_.resize(size);
|
| 164 |
+
int id_base = 0;
|
| 165 |
+
for (size_t i = 0; i < size; ++i) {
|
| 166 |
+
GenerateMapForProjection(static_cast<int>(i), id_base);
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
int schema_id(ProjectionIdEnum schema_handle) const {
|
| 171 |
+
for (size_t i = 0; i < schemas_.size(); ++i) {
|
| 172 |
+
if (schemas_[i].first == schema_handle) {
|
| 173 |
+
return static_cast<int>(i);
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
// We should never get here
|
| 177 |
+
assert(false);
|
| 178 |
+
return -1;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
void GenerateMapForProjection(int id_proj, int id_base) {
|
| 182 |
+
int num_cols_proj = static_cast<int>(schemas_[id_proj].second.data_types.size());
|
| 183 |
+
int num_cols_base = static_cast<int>(schemas_[id_base].second.data_types.size());
|
| 184 |
+
|
| 185 |
+
std::vector<int>& mapping = mappings_[id_proj];
|
| 186 |
+
std::vector<int>& inverse_mapping = inverse_mappings_[id_proj];
|
| 187 |
+
mapping.resize(num_cols_proj);
|
| 188 |
+
inverse_mapping.resize(num_cols_base);
|
| 189 |
+
|
| 190 |
+
if (id_proj == id_base) {
|
| 191 |
+
for (int i = 0; i < num_cols_base; ++i) {
|
| 192 |
+
mapping[i] = inverse_mapping[i] = i;
|
| 193 |
+
}
|
| 194 |
+
} else {
|
| 195 |
+
const FieldInfos& fields_proj = schemas_[id_proj].second;
|
| 196 |
+
const FieldInfos& fields_base = schemas_[id_base].second;
|
| 197 |
+
for (int i = 0; i < num_cols_base; ++i) {
|
| 198 |
+
inverse_mapping[i] = SchemaProjectionMap::kMissingField;
|
| 199 |
+
}
|
| 200 |
+
for (int i = 0; i < num_cols_proj; ++i) {
|
| 201 |
+
int field_id = SchemaProjectionMap::kMissingField;
|
| 202 |
+
for (int j = 0; j < num_cols_base; ++j) {
|
| 203 |
+
if (fields_proj.field_paths[i] == fields_base.field_paths[j]) {
|
| 204 |
+
field_id = j;
|
| 205 |
+
// If there are multiple matches for the same input field,
|
| 206 |
+
// it will be mapped to the first match.
|
| 207 |
+
break;
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
assert(field_id != SchemaProjectionMap::kMissingField);
|
| 211 |
+
mapping[i] = field_id;
|
| 212 |
+
inverse_mapping[field_id] = i;
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
// vector used as a mapping from ProjectionIdEnum to fields
|
| 218 |
+
std::vector<std::pair<ProjectionIdEnum, FieldInfos>> schemas_;
|
| 219 |
+
std::vector<std::vector<int>> mappings_;
|
| 220 |
+
std::vector<std::vector<int>> inverse_mappings_;
|
| 221 |
+
};
|
| 222 |
+
|
| 223 |
+
using HashJoinProjectionMaps = SchemaProjectionMaps<HashJoinProjection>;
|
| 224 |
+
|
| 225 |
+
} // namespace acero
|
| 226 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/task_util.h
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <atomic>
|
| 21 |
+
#include <cstdint>
|
| 22 |
+
#include <functional>
|
| 23 |
+
#include <vector>
|
| 24 |
+
|
| 25 |
+
#include "arrow/acero/visibility.h"
|
| 26 |
+
#include "arrow/status.h"
|
| 27 |
+
#include "arrow/util/config.h"
|
| 28 |
+
#include "arrow/util/logging.h"
|
| 29 |
+
|
| 30 |
+
namespace arrow {
|
| 31 |
+
namespace acero {
|
| 32 |
+
|
| 33 |
+
// Atomic value surrounded by padding bytes to avoid cache line invalidation
|
| 34 |
+
// whenever it is modified by a concurrent thread on a different CPU core.
|
| 35 |
+
//
|
| 36 |
+
template <typename T>
|
| 37 |
+
class AtomicWithPadding {
|
| 38 |
+
private:
|
| 39 |
+
static constexpr int kCacheLineSize = 64;
|
| 40 |
+
uint8_t padding_before[kCacheLineSize];
|
| 41 |
+
|
| 42 |
+
public:
|
| 43 |
+
std::atomic<T> value;
|
| 44 |
+
|
| 45 |
+
private:
|
| 46 |
+
uint8_t padding_after[kCacheLineSize];
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
// Used for asynchronous execution of operations that can be broken into
|
| 50 |
+
// a fixed number of symmetric tasks that can be executed concurrently.
|
| 51 |
+
//
|
| 52 |
+
// Implements priorities between multiple such operations, called task groups.
|
| 53 |
+
//
|
| 54 |
+
// Allows to specify the maximum number of in-flight tasks at any moment.
|
| 55 |
+
//
|
| 56 |
+
// Also allows for executing next pending tasks immediately using a caller thread.
|
| 57 |
+
//
|
| 58 |
+
class ARROW_ACERO_EXPORT TaskScheduler {
|
| 59 |
+
public:
|
| 60 |
+
using TaskImpl = std::function<Status(size_t, int64_t)>;
|
| 61 |
+
using TaskGroupContinuationImpl = std::function<Status(size_t)>;
|
| 62 |
+
using ScheduleImpl = std::function<Status(TaskGroupContinuationImpl)>;
|
| 63 |
+
using AbortContinuationImpl = std::function<void()>;
|
| 64 |
+
|
| 65 |
+
virtual ~TaskScheduler() = default;
|
| 66 |
+
|
| 67 |
+
// Order in which task groups are registered represents priorities of their tasks
|
| 68 |
+
// (the first group has the highest priority).
|
| 69 |
+
//
|
| 70 |
+
// Returns task group identifier that is used to request operations on the task group.
|
| 71 |
+
virtual int RegisterTaskGroup(TaskImpl task_impl,
|
| 72 |
+
TaskGroupContinuationImpl cont_impl) = 0;
|
| 73 |
+
|
| 74 |
+
virtual void RegisterEnd() = 0;
|
| 75 |
+
|
| 76 |
+
// total_num_tasks may be zero, in which case task group continuation will be executed
|
| 77 |
+
// immediately
|
| 78 |
+
virtual Status StartTaskGroup(size_t thread_id, int group_id,
|
| 79 |
+
int64_t total_num_tasks) = 0;
|
| 80 |
+
|
| 81 |
+
// Execute given number of tasks immediately using caller thread
|
| 82 |
+
virtual Status ExecuteMore(size_t thread_id, int num_tasks_to_execute,
|
| 83 |
+
bool execute_all) = 0;
|
| 84 |
+
|
| 85 |
+
// Begin scheduling tasks using provided callback and
|
| 86 |
+
// the limit on the number of in-flight tasks at any moment.
|
| 87 |
+
//
|
| 88 |
+
// Scheduling will continue as long as there are waiting tasks.
|
| 89 |
+
//
|
| 90 |
+
// It will automatically resume whenever new task group gets started.
|
| 91 |
+
virtual Status StartScheduling(size_t thread_id, ScheduleImpl schedule_impl,
|
| 92 |
+
int num_concurrent_tasks, bool use_sync_execution) = 0;
|
| 93 |
+
|
| 94 |
+
// Abort scheduling and execution.
|
| 95 |
+
// Used in case of being notified about unrecoverable error for the entire query.
|
| 96 |
+
virtual void Abort(AbortContinuationImpl impl) = 0;
|
| 97 |
+
|
| 98 |
+
static std::unique_ptr<TaskScheduler> Make();
|
| 99 |
+
};
|
| 100 |
+
|
| 101 |
+
} // namespace acero
|
| 102 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/test_nodes.h
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <string>
|
| 21 |
+
|
| 22 |
+
#include "arrow/acero/options.h"
|
| 23 |
+
#include "arrow/acero/test_util_internal.h"
|
| 24 |
+
#include "arrow/testing/random.h"
|
| 25 |
+
|
| 26 |
+
namespace arrow {
|
| 27 |
+
namespace acero {
|
| 28 |
+
|
| 29 |
+
// \brief Make a delaying source that is optionally noisy (prints when it emits)
|
| 30 |
+
AsyncGenerator<std::optional<ExecBatch>> MakeDelayedGen(
|
| 31 |
+
Iterator<std::optional<ExecBatch>> src, std::string label, double delay_sec,
|
| 32 |
+
bool noisy = false);
|
| 33 |
+
|
| 34 |
+
// \brief Make a delaying source that is optionally noisy (prints when it emits)
|
| 35 |
+
AsyncGenerator<std::optional<ExecBatch>> MakeDelayedGen(
|
| 36 |
+
AsyncGenerator<std::optional<ExecBatch>> src, std::string label, double delay_sec,
|
| 37 |
+
bool noisy = false);
|
| 38 |
+
|
| 39 |
+
// \brief Make a delaying source that is optionally noisy (prints when it emits)
|
| 40 |
+
AsyncGenerator<std::optional<ExecBatch>> MakeDelayedGen(BatchesWithSchema src,
|
| 41 |
+
std::string label,
|
| 42 |
+
double delay_sec,
|
| 43 |
+
bool noisy = false);
|
| 44 |
+
|
| 45 |
+
/// A node that slightly resequences the input at random
|
| 46 |
+
struct JitterNodeOptions : public ExecNodeOptions {
|
| 47 |
+
random::SeedType seed;
|
| 48 |
+
/// The max amount to add to a node's "cost".
|
| 49 |
+
int max_jitter_modifier;
|
| 50 |
+
|
| 51 |
+
explicit JitterNodeOptions(random::SeedType seed, int max_jitter_modifier = 5)
|
| 52 |
+
: seed(seed), max_jitter_modifier(max_jitter_modifier) {}
|
| 53 |
+
static constexpr std::string_view kName = "jitter";
|
| 54 |
+
};
|
| 55 |
+
|
| 56 |
+
class GateImpl;
|
| 57 |
+
|
| 58 |
+
class Gate {
|
| 59 |
+
public:
|
| 60 |
+
static std::shared_ptr<Gate> Make();
|
| 61 |
+
|
| 62 |
+
Gate();
|
| 63 |
+
virtual ~Gate();
|
| 64 |
+
|
| 65 |
+
void ReleaseAllBatches();
|
| 66 |
+
void ReleaseOneBatch();
|
| 67 |
+
Future<> WaitForNextReleasedBatch();
|
| 68 |
+
|
| 69 |
+
private:
|
| 70 |
+
ARROW_DISALLOW_COPY_AND_ASSIGN(Gate);
|
| 71 |
+
|
| 72 |
+
GateImpl* impl_;
|
| 73 |
+
};
|
| 74 |
+
|
| 75 |
+
// A node that holds all input batches until a given gate is released
|
| 76 |
+
struct GatedNodeOptions : public ExecNodeOptions {
|
| 77 |
+
explicit GatedNodeOptions(Gate* gate) : gate(gate) {}
|
| 78 |
+
Gate* gate;
|
| 79 |
+
|
| 80 |
+
static constexpr std::string_view kName = "gated";
|
| 81 |
+
};
|
| 82 |
+
|
| 83 |
+
void RegisterTestNodes();
|
| 84 |
+
|
| 85 |
+
} // namespace acero
|
| 86 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/time_series_util.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include "arrow/record_batch.h"
|
| 21 |
+
#include "arrow/type_traits.h"
|
| 22 |
+
|
| 23 |
+
namespace arrow::acero {
|
| 24 |
+
|
| 25 |
+
// normalize the value to unsigned 64-bits while preserving ordering of values
|
| 26 |
+
template <typename T, enable_if_t<std::is_integral<T>::value, bool> = true>
|
| 27 |
+
uint64_t NormalizeTime(T t);
|
| 28 |
+
|
| 29 |
+
uint64_t GetTime(const RecordBatch* batch, Type::type time_type, int col, uint64_t row);
|
| 30 |
+
|
| 31 |
+
} // namespace arrow::acero
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/tpch_node.h
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <memory>
|
| 21 |
+
#include <optional>
|
| 22 |
+
#include <string>
|
| 23 |
+
#include <vector>
|
| 24 |
+
|
| 25 |
+
#include "arrow/acero/type_fwd.h"
|
| 26 |
+
#include "arrow/acero/visibility.h"
|
| 27 |
+
#include "arrow/result.h"
|
| 28 |
+
#include "arrow/status.h"
|
| 29 |
+
|
| 30 |
+
namespace arrow {
|
| 31 |
+
namespace acero {
|
| 32 |
+
namespace internal {
|
| 33 |
+
|
| 34 |
+
class ARROW_ACERO_EXPORT TpchGen {
|
| 35 |
+
public:
|
| 36 |
+
virtual ~TpchGen() = default;
|
| 37 |
+
|
| 38 |
+
/*
|
| 39 |
+
* \brief Create a factory for nodes that generate TPC-H data
|
| 40 |
+
*
|
| 41 |
+
* Note: Individual tables will reference each other. It is important that you only
|
| 42 |
+
* create a single TpchGen instance for each plan and then you can create nodes for each
|
| 43 |
+
* table from that single TpchGen instance. Note: Every batch will be scheduled as a new
|
| 44 |
+
* task using the ExecPlan's scheduler.
|
| 45 |
+
*/
|
| 46 |
+
static Result<std::unique_ptr<TpchGen>> Make(
|
| 47 |
+
ExecPlan* plan, double scale_factor = 1.0, int64_t batch_size = 4096,
|
| 48 |
+
std::optional<int64_t> seed = std::nullopt);
|
| 49 |
+
|
| 50 |
+
// The below methods will create and add an ExecNode to the plan that generates
|
| 51 |
+
// data for the desired table. If columns is empty, all columns will be generated.
|
| 52 |
+
// The methods return the added ExecNode, which should be used for inputs.
|
| 53 |
+
virtual Result<ExecNode*> Supplier(std::vector<std::string> columns = {}) = 0;
|
| 54 |
+
virtual Result<ExecNode*> Part(std::vector<std::string> columns = {}) = 0;
|
| 55 |
+
virtual Result<ExecNode*> PartSupp(std::vector<std::string> columns = {}) = 0;
|
| 56 |
+
virtual Result<ExecNode*> Customer(std::vector<std::string> columns = {}) = 0;
|
| 57 |
+
virtual Result<ExecNode*> Orders(std::vector<std::string> columns = {}) = 0;
|
| 58 |
+
virtual Result<ExecNode*> Lineitem(std::vector<std::string> columns = {}) = 0;
|
| 59 |
+
virtual Result<ExecNode*> Nation(std::vector<std::string> columns = {}) = 0;
|
| 60 |
+
virtual Result<ExecNode*> Region(std::vector<std::string> columns = {}) = 0;
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
} // namespace internal
|
| 64 |
+
} // namespace acero
|
| 65 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/type_fwd.h
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include "arrow/compute/type_fwd.h"
|
| 21 |
+
|
| 22 |
+
namespace arrow {
|
| 23 |
+
|
| 24 |
+
namespace acero {
|
| 25 |
+
|
| 26 |
+
class ExecNode;
|
| 27 |
+
class ExecPlan;
|
| 28 |
+
class ExecNodeOptions;
|
| 29 |
+
class ExecFactoryRegistry;
|
| 30 |
+
class QueryContext;
|
| 31 |
+
struct QueryOptions;
|
| 32 |
+
struct Declaration;
|
| 33 |
+
class SinkNodeConsumer;
|
| 34 |
+
|
| 35 |
+
} // namespace acero
|
| 36 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/util.h
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <atomic>
|
| 21 |
+
#include <cstdint>
|
| 22 |
+
#include <optional>
|
| 23 |
+
#include <thread>
|
| 24 |
+
#include <unordered_map>
|
| 25 |
+
#include <vector>
|
| 26 |
+
|
| 27 |
+
#include "arrow/acero/options.h"
|
| 28 |
+
#include "arrow/acero/type_fwd.h"
|
| 29 |
+
#include "arrow/buffer.h"
|
| 30 |
+
#include "arrow/compute/expression.h"
|
| 31 |
+
#include "arrow/compute/util.h"
|
| 32 |
+
#include "arrow/memory_pool.h"
|
| 33 |
+
#include "arrow/result.h"
|
| 34 |
+
#include "arrow/status.h"
|
| 35 |
+
#include "arrow/util/bit_util.h"
|
| 36 |
+
#include "arrow/util/cpu_info.h"
|
| 37 |
+
#include "arrow/util/logging.h"
|
| 38 |
+
#include "arrow/util/mutex.h"
|
| 39 |
+
#include "arrow/util/thread_pool.h"
|
| 40 |
+
#include "arrow/util/type_fwd.h"
|
| 41 |
+
|
| 42 |
+
namespace arrow {
|
| 43 |
+
|
| 44 |
+
namespace acero {
|
| 45 |
+
|
| 46 |
+
ARROW_ACERO_EXPORT
|
| 47 |
+
Status ValidateExecNodeInputs(ExecPlan* plan, const std::vector<ExecNode*>& inputs,
|
| 48 |
+
int expected_num_inputs, const char* kind_name);
|
| 49 |
+
|
| 50 |
+
ARROW_ACERO_EXPORT
|
| 51 |
+
Result<std::shared_ptr<Table>> TableFromExecBatches(
|
| 52 |
+
const std::shared_ptr<Schema>& schema, const std::vector<ExecBatch>& exec_batches);
|
| 53 |
+
|
| 54 |
+
class ARROW_ACERO_EXPORT AtomicCounter {
|
| 55 |
+
public:
|
| 56 |
+
AtomicCounter() = default;
|
| 57 |
+
|
| 58 |
+
int count() const { return count_.load(); }
|
| 59 |
+
|
| 60 |
+
std::optional<int> total() const {
|
| 61 |
+
int total = total_.load();
|
| 62 |
+
if (total == -1) return {};
|
| 63 |
+
return total;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
// return true if the counter is complete
|
| 67 |
+
bool Increment() {
|
| 68 |
+
ARROW_DCHECK_NE(count_.load(), total_.load());
|
| 69 |
+
int count = count_.fetch_add(1) + 1;
|
| 70 |
+
if (count != total_.load()) return false;
|
| 71 |
+
return DoneOnce();
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
// return true if the counter is complete
|
| 75 |
+
bool SetTotal(int total) {
|
| 76 |
+
total_.store(total);
|
| 77 |
+
if (count_.load() != total) return false;
|
| 78 |
+
return DoneOnce();
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// return true if the counter has not already been completed
|
| 82 |
+
bool Cancel() { return DoneOnce(); }
|
| 83 |
+
|
| 84 |
+
// return true if the counter has finished or been cancelled
|
| 85 |
+
bool Completed() { return complete_.load(); }
|
| 86 |
+
|
| 87 |
+
private:
|
| 88 |
+
// ensure there is only one true return from Increment(), SetTotal(), or Cancel()
|
| 89 |
+
bool DoneOnce() {
|
| 90 |
+
bool expected = false;
|
| 91 |
+
return complete_.compare_exchange_strong(expected, true);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
std::atomic<int> count_{0}, total_{-1};
|
| 95 |
+
std::atomic<bool> complete_{false};
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
class ARROW_ACERO_EXPORT ThreadIndexer {
|
| 99 |
+
public:
|
| 100 |
+
size_t operator()();
|
| 101 |
+
|
| 102 |
+
static size_t Capacity();
|
| 103 |
+
|
| 104 |
+
private:
|
| 105 |
+
static size_t Check(size_t thread_index);
|
| 106 |
+
|
| 107 |
+
arrow::util::Mutex mutex_;
|
| 108 |
+
std::unordered_map<std::thread::id, size_t> id_to_index_;
|
| 109 |
+
};
|
| 110 |
+
|
| 111 |
+
/// \brief A consumer that collects results into an in-memory table
|
| 112 |
+
struct ARROW_ACERO_EXPORT TableSinkNodeConsumer : public SinkNodeConsumer {
|
| 113 |
+
public:
|
| 114 |
+
TableSinkNodeConsumer(std::shared_ptr<Table>* out, MemoryPool* pool)
|
| 115 |
+
: out_(out), pool_(pool) {}
|
| 116 |
+
Status Init(const std::shared_ptr<Schema>& schema,
|
| 117 |
+
BackpressureControl* backpressure_control, ExecPlan* plan) override;
|
| 118 |
+
Status Consume(ExecBatch batch) override;
|
| 119 |
+
Future<> Finish() override;
|
| 120 |
+
|
| 121 |
+
private:
|
| 122 |
+
std::shared_ptr<Table>* out_;
|
| 123 |
+
MemoryPool* pool_;
|
| 124 |
+
std::shared_ptr<Schema> schema_;
|
| 125 |
+
std::vector<std::shared_ptr<RecordBatch>> batches_;
|
| 126 |
+
arrow::util::Mutex consume_mutex_;
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
class ARROW_ACERO_EXPORT NullSinkNodeConsumer : public SinkNodeConsumer {
|
| 130 |
+
public:
|
| 131 |
+
Status Init(const std::shared_ptr<Schema>&, BackpressureControl*,
|
| 132 |
+
ExecPlan* plan) override {
|
| 133 |
+
return Status::OK();
|
| 134 |
+
}
|
| 135 |
+
Status Consume(ExecBatch exec_batch) override { return Status::OK(); }
|
| 136 |
+
Future<> Finish() override { return Status::OK(); }
|
| 137 |
+
|
| 138 |
+
public:
|
| 139 |
+
static std::shared_ptr<NullSinkNodeConsumer> Make() {
|
| 140 |
+
return std::make_shared<NullSinkNodeConsumer>();
|
| 141 |
+
}
|
| 142 |
+
};
|
| 143 |
+
|
| 144 |
+
/// CRTP helper for tracing helper functions
|
| 145 |
+
|
| 146 |
+
class ARROW_ACERO_EXPORT TracedNode {
|
| 147 |
+
public:
|
| 148 |
+
// All nodes should call TraceStartProducing or NoteStartProducing exactly once
|
| 149 |
+
// Most nodes will be fine with a call to NoteStartProducing since the StartProducing
|
| 150 |
+
// call is usually fairly cheap and simply schedules tasks to fetch the actual data.
|
| 151 |
+
|
| 152 |
+
explicit TracedNode(ExecNode* node) : node_(node) {}
|
| 153 |
+
|
| 154 |
+
// Create a span to record the StartProducing work
|
| 155 |
+
[[nodiscard]] ::arrow::internal::tracing::Scope TraceStartProducing(
|
| 156 |
+
std::string extra_details) const;
|
| 157 |
+
|
| 158 |
+
// Record a call to StartProducing without creating with a span
|
| 159 |
+
void NoteStartProducing(std::string extra_details) const;
|
| 160 |
+
|
| 161 |
+
// All nodes should call TraceInputReceived for each batch they receive. This call
|
| 162 |
+
// should track the time spent processing the batch. NoteInputReceived is available
|
| 163 |
+
// but usually won't be used unless a node is simply adding batches to a trivial queue.
|
| 164 |
+
|
| 165 |
+
// Create a span to record the InputReceived work
|
| 166 |
+
[[nodiscard]] ::arrow::internal::tracing::Scope TraceInputReceived(
|
| 167 |
+
const ExecBatch& batch) const;
|
| 168 |
+
|
| 169 |
+
// Record a call to InputReceived without creating with a span
|
| 170 |
+
void NoteInputReceived(const ExecBatch& batch) const;
|
| 171 |
+
|
| 172 |
+
// Create a span to record any "finish" work. This should NOT be called as part of
|
| 173 |
+
// InputFinished and many nodes may not need to call this at all. This should be used
|
| 174 |
+
// when a node has some extra work that has to be done once it has received all of its
|
| 175 |
+
// data. For example, an aggregation node calculating aggregations. This will
|
| 176 |
+
// typically be called as a result of InputFinished OR InputReceived.
|
| 177 |
+
[[nodiscard]] ::arrow::internal::tracing::Scope TraceFinish() const;
|
| 178 |
+
|
| 179 |
+
private:
|
| 180 |
+
ExecNode* node_;
|
| 181 |
+
};
|
| 182 |
+
|
| 183 |
+
} // namespace acero
|
| 184 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/acero/visibility.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// This API is EXPERIMENTAL.
|
| 19 |
+
|
| 20 |
+
#pragma once
|
| 21 |
+
|
| 22 |
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
| 23 |
+
# if defined(_MSC_VER)
|
| 24 |
+
# pragma warning(push)
|
| 25 |
+
# pragma warning(disable : 4251)
|
| 26 |
+
# else
|
| 27 |
+
# pragma GCC diagnostic ignored "-Wattributes"
|
| 28 |
+
# endif
|
| 29 |
+
|
| 30 |
+
# ifdef ARROW_ACERO_STATIC
|
| 31 |
+
# define ARROW_ACERO_EXPORT
|
| 32 |
+
# elif defined(ARROW_ACERO_EXPORTING)
|
| 33 |
+
# define ARROW_ACERO_EXPORT __declspec(dllexport)
|
| 34 |
+
# else
|
| 35 |
+
# define ARROW_ACERO_EXPORT __declspec(dllimport)
|
| 36 |
+
# endif
|
| 37 |
+
|
| 38 |
+
# define ARROW_ACERO_NO_EXPORT
|
| 39 |
+
#else // Not Windows
|
| 40 |
+
# ifndef ARROW_ACERO_EXPORT
|
| 41 |
+
# define ARROW_ACERO_EXPORT __attribute__((visibility("default")))
|
| 42 |
+
# endif
|
| 43 |
+
# ifndef ARROW_ACERO_NO_EXPORT
|
| 44 |
+
# define ARROW_ACERO_NO_EXPORT __attribute__((visibility("hidden")))
|
| 45 |
+
# endif
|
| 46 |
+
#endif // Not-Windows
|
| 47 |
+
|
| 48 |
+
#if defined(_MSC_VER)
|
| 49 |
+
# pragma warning(pop)
|
| 50 |
+
#endif
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/adapters/orc/adapter.h
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <memory>
|
| 22 |
+
#include <vector>
|
| 23 |
+
|
| 24 |
+
#include "arrow/adapters/orc/options.h"
|
| 25 |
+
#include "arrow/io/interfaces.h"
|
| 26 |
+
#include "arrow/memory_pool.h"
|
| 27 |
+
#include "arrow/record_batch.h"
|
| 28 |
+
#include "arrow/status.h"
|
| 29 |
+
#include "arrow/type.h"
|
| 30 |
+
#include "arrow/type_fwd.h"
|
| 31 |
+
#include "arrow/util/macros.h"
|
| 32 |
+
#include "arrow/util/visibility.h"
|
| 33 |
+
|
| 34 |
+
namespace arrow {
|
| 35 |
+
namespace adapters {
|
| 36 |
+
namespace orc {
|
| 37 |
+
|
| 38 |
+
/// \brief Information about an ORC stripe
|
| 39 |
+
struct StripeInformation {
|
| 40 |
+
/// \brief Offset of the stripe from the start of the file, in bytes
|
| 41 |
+
int64_t offset;
|
| 42 |
+
/// \brief Length of the stripe, in bytes
|
| 43 |
+
int64_t length;
|
| 44 |
+
/// \brief Number of rows in the stripe
|
| 45 |
+
int64_t num_rows;
|
| 46 |
+
/// \brief Index of the first row of the stripe
|
| 47 |
+
int64_t first_row_id;
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
/// \class ORCFileReader
|
| 51 |
+
/// \brief Read an Arrow Table or RecordBatch from an ORC file.
|
| 52 |
+
class ARROW_EXPORT ORCFileReader {
|
| 53 |
+
public:
|
| 54 |
+
~ORCFileReader();
|
| 55 |
+
|
| 56 |
+
/// \brief Creates a new ORC reader
|
| 57 |
+
///
|
| 58 |
+
/// \param[in] file the data source
|
| 59 |
+
/// \param[in] pool a MemoryPool to use for buffer allocations
|
| 60 |
+
/// \return the returned reader object
|
| 61 |
+
static Result<std::unique_ptr<ORCFileReader>> Open(
|
| 62 |
+
const std::shared_ptr<io::RandomAccessFile>& file, MemoryPool* pool);
|
| 63 |
+
|
| 64 |
+
/// \brief Return the schema read from the ORC file
|
| 65 |
+
///
|
| 66 |
+
/// \return the returned Schema object
|
| 67 |
+
Result<std::shared_ptr<Schema>> ReadSchema();
|
| 68 |
+
|
| 69 |
+
/// \brief Read the file as a Table
|
| 70 |
+
///
|
| 71 |
+
/// The table will be composed of one record batch per stripe.
|
| 72 |
+
///
|
| 73 |
+
/// \return the returned Table
|
| 74 |
+
Result<std::shared_ptr<Table>> Read();
|
| 75 |
+
|
| 76 |
+
/// \brief Read the file as a Table
|
| 77 |
+
///
|
| 78 |
+
/// The table will be composed of one record batch per stripe.
|
| 79 |
+
///
|
| 80 |
+
/// \param[in] schema the Table schema
|
| 81 |
+
/// \return the returned Table
|
| 82 |
+
Result<std::shared_ptr<Table>> Read(const std::shared_ptr<Schema>& schema);
|
| 83 |
+
|
| 84 |
+
/// \brief Read the file as a Table
|
| 85 |
+
///
|
| 86 |
+
/// The table will be composed of one record batch per stripe.
|
| 87 |
+
///
|
| 88 |
+
/// \param[in] include_indices the selected field indices to read
|
| 89 |
+
/// \return the returned Table
|
| 90 |
+
Result<std::shared_ptr<Table>> Read(const std::vector<int>& include_indices);
|
| 91 |
+
|
| 92 |
+
/// \brief Read the file as a Table
|
| 93 |
+
///
|
| 94 |
+
/// The table will be composed of one record batch per stripe.
|
| 95 |
+
///
|
| 96 |
+
/// \param[in] include_names the selected field names to read
|
| 97 |
+
/// \return the returned Table
|
| 98 |
+
Result<std::shared_ptr<Table>> Read(const std::vector<std::string>& include_names);
|
| 99 |
+
|
| 100 |
+
/// \brief Read the file as a Table
|
| 101 |
+
///
|
| 102 |
+
/// The table will be composed of one record batch per stripe.
|
| 103 |
+
///
|
| 104 |
+
/// \param[in] schema the Table schema
|
| 105 |
+
/// \param[in] include_indices the selected field indices to read
|
| 106 |
+
/// \return the returned Table
|
| 107 |
+
Result<std::shared_ptr<Table>> Read(const std::shared_ptr<Schema>& schema,
|
| 108 |
+
const std::vector<int>& include_indices);
|
| 109 |
+
|
| 110 |
+
/// \brief Read a single stripe as a RecordBatch
|
| 111 |
+
///
|
| 112 |
+
/// \param[in] stripe the stripe index
|
| 113 |
+
/// \return the returned RecordBatch
|
| 114 |
+
Result<std::shared_ptr<RecordBatch>> ReadStripe(int64_t stripe);
|
| 115 |
+
|
| 116 |
+
/// \brief Read a single stripe as a RecordBatch
|
| 117 |
+
///
|
| 118 |
+
/// \param[in] stripe the stripe index
|
| 119 |
+
/// \param[in] include_indices the selected field indices to read
|
| 120 |
+
/// \return the returned RecordBatch
|
| 121 |
+
Result<std::shared_ptr<RecordBatch>> ReadStripe(
|
| 122 |
+
int64_t stripe, const std::vector<int>& include_indices);
|
| 123 |
+
|
| 124 |
+
/// \brief Read a single stripe as a RecordBatch
|
| 125 |
+
///
|
| 126 |
+
/// \param[in] stripe the stripe index
|
| 127 |
+
/// \param[in] include_names the selected field names to read
|
| 128 |
+
/// \return the returned RecordBatch
|
| 129 |
+
Result<std::shared_ptr<RecordBatch>> ReadStripe(
|
| 130 |
+
int64_t stripe, const std::vector<std::string>& include_names);
|
| 131 |
+
|
| 132 |
+
/// \brief Seek to designated row. Invoke NextStripeReader() after seek
|
| 133 |
+
/// will return stripe reader starting from designated row.
|
| 134 |
+
///
|
| 135 |
+
/// \param[in] row_number the rows number to seek
|
| 136 |
+
Status Seek(int64_t row_number);
|
| 137 |
+
|
| 138 |
+
/// \brief Get a stripe level record batch iterator.
|
| 139 |
+
///
|
| 140 |
+
/// Each record batch will have up to `batch_size` rows.
|
| 141 |
+
/// NextStripeReader serves as a fine-grained alternative to ReadStripe
|
| 142 |
+
/// which may cause OOM issues by loading the whole stripe into memory.
|
| 143 |
+
///
|
| 144 |
+
/// Note this will only read rows for the current stripe, not the entire
|
| 145 |
+
/// file.
|
| 146 |
+
///
|
| 147 |
+
/// \param[in] batch_size the maximum number of rows in each record batch
|
| 148 |
+
/// \return the returned stripe reader
|
| 149 |
+
Result<std::shared_ptr<RecordBatchReader>> NextStripeReader(int64_t batch_size);
|
| 150 |
+
|
| 151 |
+
/// \brief Get a stripe level record batch iterator.
|
| 152 |
+
///
|
| 153 |
+
/// Each record batch will have up to `batch_size` rows.
|
| 154 |
+
/// NextStripeReader serves as a fine-grained alternative to ReadStripe
|
| 155 |
+
/// which may cause OOM issues by loading the whole stripe into memory.
|
| 156 |
+
///
|
| 157 |
+
/// Note this will only read rows for the current stripe, not the entire
|
| 158 |
+
/// file.
|
| 159 |
+
///
|
| 160 |
+
/// \param[in] batch_size the maximum number of rows in each record batch
|
| 161 |
+
/// \param[in] include_indices the selected field indices to read
|
| 162 |
+
/// \return the stripe reader
|
| 163 |
+
Result<std::shared_ptr<RecordBatchReader>> NextStripeReader(
|
| 164 |
+
int64_t batch_size, const std::vector<int>& include_indices);
|
| 165 |
+
|
| 166 |
+
/// \brief Get a record batch iterator for the entire file.
|
| 167 |
+
///
|
| 168 |
+
/// Each record batch will have up to `batch_size` rows.
|
| 169 |
+
///
|
| 170 |
+
/// \param[in] batch_size the maximum number of rows in each record batch
|
| 171 |
+
/// \param[in] include_names the selected field names to read, if not empty
|
| 172 |
+
/// (otherwise all fields are read)
|
| 173 |
+
/// \return the record batch iterator
|
| 174 |
+
Result<std::shared_ptr<RecordBatchReader>> GetRecordBatchReader(
|
| 175 |
+
int64_t batch_size, const std::vector<std::string>& include_names);
|
| 176 |
+
|
| 177 |
+
/// \brief The number of stripes in the file
|
| 178 |
+
int64_t NumberOfStripes();
|
| 179 |
+
|
| 180 |
+
/// \brief The number of rows in the file
|
| 181 |
+
int64_t NumberOfRows();
|
| 182 |
+
|
| 183 |
+
/// \brief StripeInformation for each stripe.
|
| 184 |
+
StripeInformation GetStripeInformation(int64_t stripe);
|
| 185 |
+
|
| 186 |
+
/// \brief Get the format version of the file.
|
| 187 |
+
/// Currently known values are 0.11 and 0.12.
|
| 188 |
+
///
|
| 189 |
+
/// \return The FileVersion of the ORC file.
|
| 190 |
+
FileVersion GetFileVersion();
|
| 191 |
+
|
| 192 |
+
/// \brief Get the software instance and version that wrote this file.
|
| 193 |
+
///
|
| 194 |
+
/// \return a user-facing string that specifies the software version
|
| 195 |
+
std::string GetSoftwareVersion();
|
| 196 |
+
|
| 197 |
+
/// \brief Get the compression kind of the file.
|
| 198 |
+
///
|
| 199 |
+
/// \return The kind of compression in the ORC file.
|
| 200 |
+
Result<Compression::type> GetCompression();
|
| 201 |
+
|
| 202 |
+
/// \brief Get the buffer size for the compression.
|
| 203 |
+
///
|
| 204 |
+
/// \return Number of bytes to buffer for the compression codec.
|
| 205 |
+
int64_t GetCompressionSize();
|
| 206 |
+
|
| 207 |
+
/// \brief Get the number of rows per an entry in the row index.
|
| 208 |
+
/// \return the number of rows per an entry in the row index or 0 if there
|
| 209 |
+
/// is no row index.
|
| 210 |
+
int64_t GetRowIndexStride();
|
| 211 |
+
|
| 212 |
+
/// \brief Get ID of writer that generated the file.
|
| 213 |
+
///
|
| 214 |
+
/// \return UNKNOWN_WRITER if the writer ID is undefined
|
| 215 |
+
WriterId GetWriterId();
|
| 216 |
+
|
| 217 |
+
/// \brief Get the writer id value when getWriterId() returns an unknown writer.
|
| 218 |
+
///
|
| 219 |
+
/// \return the integer value of the writer ID.
|
| 220 |
+
int32_t GetWriterIdValue();
|
| 221 |
+
|
| 222 |
+
/// \brief Get the version of the writer.
|
| 223 |
+
///
|
| 224 |
+
/// \return the version of the writer.
|
| 225 |
+
|
| 226 |
+
WriterVersion GetWriterVersion();
|
| 227 |
+
|
| 228 |
+
/// \brief Get the number of stripe statistics in the file.
|
| 229 |
+
///
|
| 230 |
+
/// \return the number of stripe statistics
|
| 231 |
+
int64_t GetNumberOfStripeStatistics();
|
| 232 |
+
|
| 233 |
+
/// \brief Get the length of the data stripes in the file.
|
| 234 |
+
///
|
| 235 |
+
/// \return return the number of bytes in stripes
|
| 236 |
+
int64_t GetContentLength();
|
| 237 |
+
|
| 238 |
+
/// \brief Get the length of the file stripe statistics.
|
| 239 |
+
///
|
| 240 |
+
/// \return the number of compressed bytes in the file stripe statistics
|
| 241 |
+
int64_t GetStripeStatisticsLength();
|
| 242 |
+
|
| 243 |
+
/// \brief Get the length of the file footer.
|
| 244 |
+
///
|
| 245 |
+
/// \return the number of compressed bytes in the file footer
|
| 246 |
+
int64_t GetFileFooterLength();
|
| 247 |
+
|
| 248 |
+
/// \brief Get the length of the file postscript.
|
| 249 |
+
///
|
| 250 |
+
/// \return the number of bytes in the file postscript
|
| 251 |
+
int64_t GetFilePostscriptLength();
|
| 252 |
+
|
| 253 |
+
/// \brief Get the total length of the file.
|
| 254 |
+
///
|
| 255 |
+
/// \return the number of bytes in the file
|
| 256 |
+
int64_t GetFileLength();
|
| 257 |
+
|
| 258 |
+
/// \brief Get the serialized file tail.
|
| 259 |
+
/// Useful if another reader of the same file wants to avoid re-reading
|
| 260 |
+
/// the file tail. See ReadOptions.SetSerializedFileTail().
|
| 261 |
+
///
|
| 262 |
+
/// \return a string of bytes with the file tail
|
| 263 |
+
std::string GetSerializedFileTail();
|
| 264 |
+
|
| 265 |
+
/// \brief Return the metadata read from the ORC file
|
| 266 |
+
///
|
| 267 |
+
/// \return A KeyValueMetadata object containing the ORC metadata
|
| 268 |
+
Result<std::shared_ptr<const KeyValueMetadata>> ReadMetadata();
|
| 269 |
+
|
| 270 |
+
private:
|
| 271 |
+
class Impl;
|
| 272 |
+
std::unique_ptr<Impl> impl_;
|
| 273 |
+
ORCFileReader();
|
| 274 |
+
};
|
| 275 |
+
|
| 276 |
+
/// \class ORCFileWriter
|
| 277 |
+
/// \brief Write an Arrow Table or RecordBatch to an ORC file.
|
| 278 |
+
class ARROW_EXPORT ORCFileWriter {
|
| 279 |
+
public:
|
| 280 |
+
~ORCFileWriter();
|
| 281 |
+
/// \brief Creates a new ORC writer.
|
| 282 |
+
///
|
| 283 |
+
/// \param[in] output_stream a pointer to the io::OutputStream to write into
|
| 284 |
+
/// \param[in] write_options the ORC writer options for Arrow
|
| 285 |
+
/// \return the returned writer object
|
| 286 |
+
static Result<std::unique_ptr<ORCFileWriter>> Open(
|
| 287 |
+
io::OutputStream* output_stream,
|
| 288 |
+
const WriteOptions& write_options = WriteOptions());
|
| 289 |
+
|
| 290 |
+
/// \brief Write a table. This can be called multiple times.
|
| 291 |
+
///
|
| 292 |
+
/// Tables passed in subsequent calls must match the schema of the table that was
|
| 293 |
+
/// written first.
|
| 294 |
+
///
|
| 295 |
+
/// \param[in] table the Arrow table from which data is extracted.
|
| 296 |
+
/// \return Status
|
| 297 |
+
Status Write(const Table& table);
|
| 298 |
+
|
| 299 |
+
/// \brief Write a RecordBatch. This can be called multiple times.
|
| 300 |
+
///
|
| 301 |
+
/// RecordBatches passed in subsequent calls must match the schema of the
|
| 302 |
+
/// RecordBatch that was written first.
|
| 303 |
+
///
|
| 304 |
+
/// \param[in] record_batch the Arrow RecordBatch from which data is extracted.
|
| 305 |
+
/// \return Status
|
| 306 |
+
Status Write(const RecordBatch& record_batch);
|
| 307 |
+
|
| 308 |
+
/// \brief Close an ORC writer (orc::Writer)
|
| 309 |
+
///
|
| 310 |
+
/// \return Status
|
| 311 |
+
Status Close();
|
| 312 |
+
|
| 313 |
+
private:
|
| 314 |
+
class Impl;
|
| 315 |
+
std::unique_ptr<Impl> impl_;
|
| 316 |
+
|
| 317 |
+
private:
|
| 318 |
+
ORCFileWriter();
|
| 319 |
+
};
|
| 320 |
+
|
| 321 |
+
} // namespace orc
|
| 322 |
+
} // namespace adapters
|
| 323 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/adapters/orc/options.h
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <vector>
|
| 21 |
+
|
| 22 |
+
#include "arrow/io/interfaces.h"
|
| 23 |
+
#include "arrow/status.h"
|
| 24 |
+
#include "arrow/util/type_fwd.h"
|
| 25 |
+
#include "arrow/util/visibility.h"
|
| 26 |
+
|
| 27 |
+
namespace arrow {
|
| 28 |
+
|
| 29 |
+
namespace adapters {
|
| 30 |
+
|
| 31 |
+
namespace orc {
|
| 32 |
+
|
| 33 |
+
enum class WriterId : int32_t {
|
| 34 |
+
kOrcJava = 0,
|
| 35 |
+
kOrcCpp = 1,
|
| 36 |
+
kPresto = 2,
|
| 37 |
+
kScritchleyGo = 3,
|
| 38 |
+
kTrino = 4,
|
| 39 |
+
kUnknown = INT32_MAX
|
| 40 |
+
};
|
| 41 |
+
|
| 42 |
+
enum class WriterVersion : int32_t {
|
| 43 |
+
kOriginal = 0,
|
| 44 |
+
kHive8732 = 1,
|
| 45 |
+
kHive4243 = 2,
|
| 46 |
+
kHive12055 = 3,
|
| 47 |
+
kHive13083 = 4,
|
| 48 |
+
kOrc101 = 5,
|
| 49 |
+
kOrc135 = 6,
|
| 50 |
+
kOrc517 = 7,
|
| 51 |
+
kOrc203 = 8,
|
| 52 |
+
kOrc14 = 9,
|
| 53 |
+
kMax = INT32_MAX
|
| 54 |
+
};
|
| 55 |
+
|
| 56 |
+
enum class CompressionStrategy : int32_t { kSpeed = 0, kCompression };
|
| 57 |
+
|
| 58 |
+
class ARROW_EXPORT FileVersion {
|
| 59 |
+
private:
|
| 60 |
+
int32_t major_version_;
|
| 61 |
+
int32_t minor_version_;
|
| 62 |
+
|
| 63 |
+
public:
|
| 64 |
+
static const FileVersion& v_0_11();
|
| 65 |
+
static const FileVersion& v_0_12();
|
| 66 |
+
|
| 67 |
+
FileVersion(int32_t major, int32_t minor)
|
| 68 |
+
: major_version_(major), minor_version_(minor) {}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Get major version
|
| 72 |
+
*/
|
| 73 |
+
int32_t major_version() const { return this->major_version_; }
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Get minor version
|
| 77 |
+
*/
|
| 78 |
+
int32_t minor_version() const { return this->minor_version_; }
|
| 79 |
+
|
| 80 |
+
bool operator==(const FileVersion& right) const {
|
| 81 |
+
return this->major_version() == right.major_version() &&
|
| 82 |
+
this->minor_version() == right.minor_version();
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
bool operator!=(const FileVersion& right) const { return !(*this == right); }
|
| 86 |
+
|
| 87 |
+
std::string ToString() const;
|
| 88 |
+
};
|
| 89 |
+
|
| 90 |
+
/// Options for the ORC Writer
|
| 91 |
+
struct ARROW_EXPORT WriteOptions {
|
| 92 |
+
/// Number of rows the ORC writer writes at a time, default 1024
|
| 93 |
+
int64_t batch_size = 1024;
|
| 94 |
+
/// Which ORC file version to use, default FileVersion(0, 12)
|
| 95 |
+
FileVersion file_version = FileVersion(0, 12);
|
| 96 |
+
/// Size of each ORC stripe in bytes, default 64 MiB
|
| 97 |
+
int64_t stripe_size = 64 * 1024 * 1024;
|
| 98 |
+
/// The compression codec of the ORC file, there is no compression by default
|
| 99 |
+
Compression::type compression = Compression::UNCOMPRESSED;
|
| 100 |
+
/// The size of each compression block in bytes, default 64 KiB
|
| 101 |
+
int64_t compression_block_size = 64 * 1024;
|
| 102 |
+
/// The compression strategy i.e. speed vs size reduction, default
|
| 103 |
+
/// CompressionStrategy::kSpeed
|
| 104 |
+
CompressionStrategy compression_strategy = CompressionStrategy::kSpeed;
|
| 105 |
+
/// The number of rows per an entry in the row index, default 10000
|
| 106 |
+
int64_t row_index_stride = 10000;
|
| 107 |
+
/// The padding tolerance, default 0.0
|
| 108 |
+
double padding_tolerance = 0.0;
|
| 109 |
+
/// The dictionary key size threshold. 0 to disable dictionary encoding.
|
| 110 |
+
/// 1 to always enable dictionary encoding, default 0.0
|
| 111 |
+
double dictionary_key_size_threshold = 0.0;
|
| 112 |
+
/// The array of columns that use the bloom filter, default empty
|
| 113 |
+
std::vector<int64_t> bloom_filter_columns;
|
| 114 |
+
/// The upper limit of the false-positive rate of the bloom filter, default 0.05
|
| 115 |
+
double bloom_filter_fpp = 0.05;
|
| 116 |
+
};
|
| 117 |
+
|
| 118 |
+
} // namespace orc
|
| 119 |
+
} // namespace adapters
|
| 120 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/adapters/tensorflow/convert.h
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <memory>
|
| 21 |
+
|
| 22 |
+
#include "tensorflow/core/framework/op.h"
|
| 23 |
+
|
| 24 |
+
#include "arrow/type.h"
|
| 25 |
+
|
| 26 |
+
// These utilities are supposed to be included in TensorFlow operators
|
| 27 |
+
// that need to be compiled separately from Arrow because of ABI issues.
|
| 28 |
+
// They therefore need to be header-only.
|
| 29 |
+
|
| 30 |
+
namespace arrow {
|
| 31 |
+
|
| 32 |
+
namespace adapters {
|
| 33 |
+
|
| 34 |
+
namespace tensorflow {
|
| 35 |
+
|
| 36 |
+
Status GetArrowType(::tensorflow::DataType dtype, std::shared_ptr<DataType>* out) {
|
| 37 |
+
switch (dtype) {
|
| 38 |
+
case ::tensorflow::DT_BOOL:
|
| 39 |
+
*out = arrow::boolean();
|
| 40 |
+
break;
|
| 41 |
+
case ::tensorflow::DT_FLOAT:
|
| 42 |
+
*out = arrow::float32();
|
| 43 |
+
break;
|
| 44 |
+
case ::tensorflow::DT_DOUBLE:
|
| 45 |
+
*out = arrow::float64();
|
| 46 |
+
break;
|
| 47 |
+
case ::tensorflow::DT_HALF:
|
| 48 |
+
*out = arrow::float16();
|
| 49 |
+
break;
|
| 50 |
+
case ::tensorflow::DT_INT8:
|
| 51 |
+
*out = arrow::int8();
|
| 52 |
+
break;
|
| 53 |
+
case ::tensorflow::DT_INT16:
|
| 54 |
+
*out = arrow::int16();
|
| 55 |
+
break;
|
| 56 |
+
case ::tensorflow::DT_INT32:
|
| 57 |
+
*out = arrow::int32();
|
| 58 |
+
break;
|
| 59 |
+
case ::tensorflow::DT_INT64:
|
| 60 |
+
*out = arrow::int64();
|
| 61 |
+
break;
|
| 62 |
+
case ::tensorflow::DT_UINT8:
|
| 63 |
+
*out = arrow::uint8();
|
| 64 |
+
break;
|
| 65 |
+
case ::tensorflow::DT_UINT16:
|
| 66 |
+
*out = arrow::uint16();
|
| 67 |
+
break;
|
| 68 |
+
case ::tensorflow::DT_UINT32:
|
| 69 |
+
*out = arrow::uint32();
|
| 70 |
+
break;
|
| 71 |
+
case ::tensorflow::DT_UINT64:
|
| 72 |
+
*out = arrow::uint64();
|
| 73 |
+
break;
|
| 74 |
+
default:
|
| 75 |
+
return Status::TypeError("TensorFlow data type is not supported");
|
| 76 |
+
}
|
| 77 |
+
return Status::OK();
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
Status GetTensorFlowType(std::shared_ptr<DataType> dtype, ::tensorflow::DataType* out) {
|
| 81 |
+
switch (dtype->id()) {
|
| 82 |
+
case Type::BOOL:
|
| 83 |
+
*out = ::tensorflow::DT_BOOL;
|
| 84 |
+
break;
|
| 85 |
+
case Type::UINT8:
|
| 86 |
+
*out = ::tensorflow::DT_UINT8;
|
| 87 |
+
break;
|
| 88 |
+
case Type::INT8:
|
| 89 |
+
*out = ::tensorflow::DT_INT8;
|
| 90 |
+
break;
|
| 91 |
+
case Type::UINT16:
|
| 92 |
+
*out = ::tensorflow::DT_UINT16;
|
| 93 |
+
break;
|
| 94 |
+
case Type::INT16:
|
| 95 |
+
*out = ::tensorflow::DT_INT16;
|
| 96 |
+
break;
|
| 97 |
+
case Type::UINT32:
|
| 98 |
+
*out = ::tensorflow::DT_UINT32;
|
| 99 |
+
break;
|
| 100 |
+
case Type::INT32:
|
| 101 |
+
*out = ::tensorflow::DT_INT32;
|
| 102 |
+
break;
|
| 103 |
+
case Type::UINT64:
|
| 104 |
+
*out = ::tensorflow::DT_UINT64;
|
| 105 |
+
break;
|
| 106 |
+
case Type::INT64:
|
| 107 |
+
*out = ::tensorflow::DT_INT64;
|
| 108 |
+
break;
|
| 109 |
+
case Type::HALF_FLOAT:
|
| 110 |
+
*out = ::tensorflow::DT_HALF;
|
| 111 |
+
break;
|
| 112 |
+
case Type::FLOAT:
|
| 113 |
+
*out = ::tensorflow::DT_FLOAT;
|
| 114 |
+
break;
|
| 115 |
+
case Type::DOUBLE:
|
| 116 |
+
*out = ::tensorflow::DT_DOUBLE;
|
| 117 |
+
break;
|
| 118 |
+
default:
|
| 119 |
+
return Status::TypeError("Arrow data type is not supported");
|
| 120 |
+
}
|
| 121 |
+
return arrow::Status::OK();
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
} // namespace tensorflow
|
| 125 |
+
|
| 126 |
+
} // namespace adapters
|
| 127 |
+
|
| 128 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/api.h
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// Coarse public API while the library is in development
|
| 19 |
+
|
| 20 |
+
#pragma once
|
| 21 |
+
|
| 22 |
+
#include "arrow/array.h" // IWYU pragma: export
|
| 23 |
+
#include "arrow/array/array_run_end.h" // IWYU pragma: export
|
| 24 |
+
#include "arrow/array/concatenate.h" // IWYU pragma: export
|
| 25 |
+
#include "arrow/buffer.h" // IWYU pragma: export
|
| 26 |
+
#include "arrow/builder.h" // IWYU pragma: export
|
| 27 |
+
#include "arrow/chunked_array.h" // IWYU pragma: export
|
| 28 |
+
#include "arrow/compare.h" // IWYU pragma: export
|
| 29 |
+
#include "arrow/config.h" // IWYU pragma: export
|
| 30 |
+
#include "arrow/datum.h" // IWYU pragma: export
|
| 31 |
+
#include "arrow/extension_type.h" // IWYU pragma: export
|
| 32 |
+
#include "arrow/memory_pool.h" // IWYU pragma: export
|
| 33 |
+
#include "arrow/pretty_print.h" // IWYU pragma: export
|
| 34 |
+
#include "arrow/record_batch.h" // IWYU pragma: export
|
| 35 |
+
#include "arrow/result.h" // IWYU pragma: export
|
| 36 |
+
#include "arrow/status.h" // IWYU pragma: export
|
| 37 |
+
#include "arrow/table.h" // IWYU pragma: export
|
| 38 |
+
#include "arrow/table_builder.h" // IWYU pragma: export
|
| 39 |
+
#include "arrow/tensor.h" // IWYU pragma: export
|
| 40 |
+
#include "arrow/type.h" // IWYU pragma: export
|
| 41 |
+
#include "arrow/util/key_value_metadata.h" // IWYU pragma: export
|
| 42 |
+
#include "arrow/visit_array_inline.h" // IWYU pragma: export
|
| 43 |
+
#include "arrow/visit_scalar_inline.h" // IWYU pragma: export
|
| 44 |
+
#include "arrow/visitor.h" // IWYU pragma: export
|
| 45 |
+
|
| 46 |
+
/// \brief Top-level namespace for Apache Arrow C++ API
|
| 47 |
+
namespace arrow {}
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array.h
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// Kitchen-sink public API for arrow::Array data structures. C++ library code
|
| 19 |
+
// (especially header files) in Apache Arrow should use more specific headers
|
| 20 |
+
// unless it's a file that uses most or all Array types in which case using
|
| 21 |
+
// arrow/array.h is fine.
|
| 22 |
+
|
| 23 |
+
#pragma once
|
| 24 |
+
|
| 25 |
+
/// \defgroup numeric-arrays Concrete classes for numeric arrays
|
| 26 |
+
/// @{
|
| 27 |
+
/// @}
|
| 28 |
+
|
| 29 |
+
/// \defgroup binary-arrays Concrete classes for binary/string arrays
|
| 30 |
+
/// @{
|
| 31 |
+
/// @}
|
| 32 |
+
|
| 33 |
+
/// \defgroup nested-arrays Concrete classes for nested arrays
|
| 34 |
+
/// @{
|
| 35 |
+
/// @}
|
| 36 |
+
|
| 37 |
+
/// \defgroup run-end-encoded-arrays Concrete classes for run-end encoded arrays
|
| 38 |
+
/// @{
|
| 39 |
+
/// @}
|
| 40 |
+
|
| 41 |
+
#include "arrow/array/array_base.h" // IWYU pragma: keep
|
| 42 |
+
#include "arrow/array/array_binary.h" // IWYU pragma: keep
|
| 43 |
+
#include "arrow/array/array_decimal.h" // IWYU pragma: keep
|
| 44 |
+
#include "arrow/array/array_dict.h" // IWYU pragma: keep
|
| 45 |
+
#include "arrow/array/array_nested.h" // IWYU pragma: keep
|
| 46 |
+
#include "arrow/array/array_primitive.h" // IWYU pragma: keep
|
| 47 |
+
#include "arrow/array/array_run_end.h" // IWYU pragma: keep
|
| 48 |
+
#include "arrow/array/data.h" // IWYU pragma: keep
|
| 49 |
+
#include "arrow/array/util.h" // IWYU pragma: keep
|
code/LaDi-RL-old-qwen-c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ation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <iosfwd>
|
| 22 |
+
#include <memory>
|
| 23 |
+
#include <string>
|
| 24 |
+
#include <vector>
|
| 25 |
+
|
| 26 |
+
#include "arrow/array/data.h"
|
| 27 |
+
#include "arrow/buffer.h"
|
| 28 |
+
#include "arrow/compare.h"
|
| 29 |
+
#include "arrow/result.h"
|
| 30 |
+
#include "arrow/status.h"
|
| 31 |
+
#include "arrow/type.h"
|
| 32 |
+
#include "arrow/util/bit_util.h"
|
| 33 |
+
#include "arrow/util/macros.h"
|
| 34 |
+
#include "arrow/util/visibility.h"
|
| 35 |
+
#include "arrow/visitor.h"
|
| 36 |
+
|
| 37 |
+
namespace arrow {
|
| 38 |
+
|
| 39 |
+
// ----------------------------------------------------------------------
|
| 40 |
+
// User array accessor types
|
| 41 |
+
|
| 42 |
+
/// \brief Array base type
|
| 43 |
+
/// Immutable data array with some logical type and some length.
|
| 44 |
+
///
|
| 45 |
+
/// Any memory is owned by the respective Buffer instance (or its parents).
|
| 46 |
+
///
|
| 47 |
+
/// The base class is only required to have a null bitmap buffer if the null
|
| 48 |
+
/// count is greater than 0
|
| 49 |
+
///
|
| 50 |
+
/// If known, the null count can be provided in the base Array constructor. If
|
| 51 |
+
/// the null count is not known, pass -1 to indicate that the null count is to
|
| 52 |
+
/// be computed on the first call to null_count()
|
| 53 |
+
class ARROW_EXPORT Array {
|
| 54 |
+
public:
|
| 55 |
+
virtual ~Array() = default;
|
| 56 |
+
|
| 57 |
+
/// \brief Return true if value at index is null. Does not boundscheck
|
| 58 |
+
bool IsNull(int64_t i) const { return !IsValid(i); }
|
| 59 |
+
|
| 60 |
+
/// \brief Return true if value at index is valid (not null). Does not
|
| 61 |
+
/// boundscheck
|
| 62 |
+
bool IsValid(int64_t i) const {
|
| 63 |
+
if (null_bitmap_data_ != NULLPTR) {
|
| 64 |
+
return bit_util::GetBit(null_bitmap_data_, i + data_->offset);
|
| 65 |
+
}
|
| 66 |
+
// Dispatching with a few conditionals like this makes IsNull more
|
| 67 |
+
// efficient for how it is used in practice. Making IsNull virtual
|
| 68 |
+
// would add a vtable lookup to every call and prevent inlining +
|
| 69 |
+
// a potential inner-branch removal.
|
| 70 |
+
if (type_id() == Type::SPARSE_UNION) {
|
| 71 |
+
return !internal::IsNullSparseUnion(*data_, i);
|
| 72 |
+
}
|
| 73 |
+
if (type_id() == Type::DENSE_UNION) {
|
| 74 |
+
return !internal::IsNullDenseUnion(*data_, i);
|
| 75 |
+
}
|
| 76 |
+
if (type_id() == Type::RUN_END_ENCODED) {
|
| 77 |
+
return !internal::IsNullRunEndEncoded(*data_, i);
|
| 78 |
+
}
|
| 79 |
+
return data_->null_count != data_->length;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/// \brief Return a Scalar containing the value of this array at i
|
| 83 |
+
Result<std::shared_ptr<Scalar>> GetScalar(int64_t i) const;
|
| 84 |
+
|
| 85 |
+
/// Size in the number of elements this array contains.
|
| 86 |
+
int64_t length() const { return data_->length; }
|
| 87 |
+
|
| 88 |
+
/// A relative position into another array's data, to enable zero-copy
|
| 89 |
+
/// slicing. This value defaults to zero
|
| 90 |
+
int64_t offset() const { return data_->offset; }
|
| 91 |
+
|
| 92 |
+
/// The number of null entries in the array. If the null count was not known
|
| 93 |
+
/// at time of construction (and set to a negative value), then the null
|
| 94 |
+
/// count will be computed and cached on the first invocation of this
|
| 95 |
+
/// function
|
| 96 |
+
int64_t null_count() const;
|
| 97 |
+
|
| 98 |
+
/// \brief Computes the logical null count for arrays of all types including
|
| 99 |
+
/// those that do not have a validity bitmap like union and run-end encoded
|
| 100 |
+
/// arrays
|
| 101 |
+
///
|
| 102 |
+
/// If the array has a validity bitmap, this function behaves the same as
|
| 103 |
+
/// null_count(). For types that have no validity bitmap, this function will
|
| 104 |
+
/// recompute the null count every time it is called.
|
| 105 |
+
///
|
| 106 |
+
/// \see GetNullCount
|
| 107 |
+
int64_t ComputeLogicalNullCount() const;
|
| 108 |
+
|
| 109 |
+
const std::shared_ptr<DataType>& type() const { return data_->type; }
|
| 110 |
+
Type::type type_id() const { return data_->type->id(); }
|
| 111 |
+
|
| 112 |
+
/// Buffer for the validity (null) bitmap, if any. Note that Union types
|
| 113 |
+
/// never have a null bitmap.
|
| 114 |
+
///
|
| 115 |
+
/// Note that for `null_count == 0` or for null type, this will be null.
|
| 116 |
+
/// This buffer does not account for any slice offset
|
| 117 |
+
const std::shared_ptr<Buffer>& null_bitmap() const { return data_->buffers[0]; }
|
| 118 |
+
|
| 119 |
+
/// Raw pointer to the null bitmap.
|
| 120 |
+
///
|
| 121 |
+
/// Note that for `null_count == 0` or for null type, this will be null.
|
| 122 |
+
/// This buffer does not account for any slice offset
|
| 123 |
+
const uint8_t* null_bitmap_data() const { return null_bitmap_data_; }
|
| 124 |
+
|
| 125 |
+
/// Equality comparison with another array
|
| 126 |
+
///
|
| 127 |
+
/// Note that arrow::ArrayStatistics is not included in the comparison.
|
| 128 |
+
bool Equals(const Array& arr, const EqualOptions& = EqualOptions::Defaults()) const;
|
| 129 |
+
bool Equals(const std::shared_ptr<Array>& arr,
|
| 130 |
+
const EqualOptions& = EqualOptions::Defaults()) const;
|
| 131 |
+
|
| 132 |
+
/// \brief Return the formatted unified diff of arrow::Diff between this
|
| 133 |
+
/// Array and another Array
|
| 134 |
+
std::string Diff(const Array& other) const;
|
| 135 |
+
|
| 136 |
+
/// Approximate equality comparison with another array
|
| 137 |
+
///
|
| 138 |
+
/// epsilon is only used if this is FloatArray or DoubleArray
|
| 139 |
+
///
|
| 140 |
+
/// Note that arrow::ArrayStatistics is not included in the comparison.
|
| 141 |
+
bool ApproxEquals(const std::shared_ptr<Array>& arr,
|
| 142 |
+
const EqualOptions& = EqualOptions::Defaults()) const;
|
| 143 |
+
bool ApproxEquals(const Array& arr,
|
| 144 |
+
const EqualOptions& = EqualOptions::Defaults()) const;
|
| 145 |
+
|
| 146 |
+
/// Compare if the range of slots specified are equal for the given array and
|
| 147 |
+
/// this array. end_idx exclusive. This methods does not bounds check.
|
| 148 |
+
///
|
| 149 |
+
/// Note that arrow::ArrayStatistics is not included in the comparison.
|
| 150 |
+
bool RangeEquals(int64_t start_idx, int64_t end_idx, int64_t other_start_idx,
|
| 151 |
+
const Array& other,
|
| 152 |
+
const EqualOptions& = EqualOptions::Defaults()) const;
|
| 153 |
+
bool RangeEquals(int64_t start_idx, int64_t end_idx, int64_t other_start_idx,
|
| 154 |
+
const std::shared_ptr<Array>& other,
|
| 155 |
+
const EqualOptions& = EqualOptions::Defaults()) const;
|
| 156 |
+
bool RangeEquals(const Array& other, int64_t start_idx, int64_t end_idx,
|
| 157 |
+
int64_t other_start_idx,
|
| 158 |
+
const EqualOptions& = EqualOptions::Defaults()) const;
|
| 159 |
+
bool RangeEquals(const std::shared_ptr<Array>& other, int64_t start_idx,
|
| 160 |
+
int64_t end_idx, int64_t other_start_idx,
|
| 161 |
+
const EqualOptions& = EqualOptions::Defaults()) const;
|
| 162 |
+
|
| 163 |
+
/// \brief Apply the ArrayVisitor::Visit() method specialized to the array type
|
| 164 |
+
Status Accept(ArrayVisitor* visitor) const;
|
| 165 |
+
|
| 166 |
+
/// Construct a zero-copy view of this array with the given type.
|
| 167 |
+
///
|
| 168 |
+
/// This method checks if the types are layout-compatible.
|
| 169 |
+
/// Nested types are traversed in depth-first order. Data buffers must have
|
| 170 |
+
/// the same item sizes, even though the logical types may be different.
|
| 171 |
+
/// An error is returned if the types are not layout-compatible.
|
| 172 |
+
Result<std::shared_ptr<Array>> View(const std::shared_ptr<DataType>& type) const;
|
| 173 |
+
|
| 174 |
+
/// \brief Construct a copy of the array with all buffers on destination
|
| 175 |
+
/// Memory Manager
|
| 176 |
+
///
|
| 177 |
+
/// This method recursively copies the array's buffers and those of its children
|
| 178 |
+
/// onto the destination MemoryManager device and returns the new Array.
|
| 179 |
+
Result<std::shared_ptr<Array>> CopyTo(const std::shared_ptr<MemoryManager>& to) const;
|
| 180 |
+
|
| 181 |
+
/// \brief Construct a new array attempting to zero-copy view if possible.
|
| 182 |
+
///
|
| 183 |
+
/// Like CopyTo this method recursively goes through all of the array's buffers
|
| 184 |
+
/// and those of it's children and first attempts to create zero-copy
|
| 185 |
+
/// views on the destination MemoryManager device. If it can't, it falls back
|
| 186 |
+
/// to performing a copy. See Buffer::ViewOrCopy.
|
| 187 |
+
Result<std::shared_ptr<Array>> ViewOrCopyTo(
|
| 188 |
+
const std::shared_ptr<MemoryManager>& to) const;
|
| 189 |
+
|
| 190 |
+
/// Construct a zero-copy slice of the array with the indicated offset and
|
| 191 |
+
/// length
|
| 192 |
+
///
|
| 193 |
+
/// \param[in] offset the position of the first element in the constructed
|
| 194 |
+
/// slice
|
| 195 |
+
/// \param[in] length the length of the slice. If there are not enough
|
| 196 |
+
/// elements in the array, the length will be adjusted accordingly
|
| 197 |
+
///
|
| 198 |
+
/// \return a new object wrapped in std::shared_ptr<Array>
|
| 199 |
+
std::shared_ptr<Array> Slice(int64_t offset, int64_t length) const;
|
| 200 |
+
|
| 201 |
+
/// Slice from offset until end of the array
|
| 202 |
+
std::shared_ptr<Array> Slice(int64_t offset) const;
|
| 203 |
+
|
| 204 |
+
/// Input-checking variant of Array::Slice
|
| 205 |
+
Result<std::shared_ptr<Array>> SliceSafe(int64_t offset, int64_t length) const;
|
| 206 |
+
/// Input-checking variant of Array::Slice
|
| 207 |
+
Result<std::shared_ptr<Array>> SliceSafe(int64_t offset) const;
|
| 208 |
+
|
| 209 |
+
const std::shared_ptr<ArrayData>& data() const { return data_; }
|
| 210 |
+
|
| 211 |
+
int num_fields() const { return static_cast<int>(data_->child_data.size()); }
|
| 212 |
+
|
| 213 |
+
/// \return PrettyPrint representation of array suitable for debugging
|
| 214 |
+
std::string ToString() const;
|
| 215 |
+
|
| 216 |
+
/// \brief Perform cheap validation checks to determine obvious inconsistencies
|
| 217 |
+
/// within the array's internal data.
|
| 218 |
+
///
|
| 219 |
+
/// This is O(k) where k is the number of descendents.
|
| 220 |
+
///
|
| 221 |
+
/// \return Status
|
| 222 |
+
Status Validate() const;
|
| 223 |
+
|
| 224 |
+
/// \brief Perform extensive validation checks to determine inconsistencies
|
| 225 |
+
/// within the array's internal data.
|
| 226 |
+
///
|
| 227 |
+
/// This is potentially O(k*n) where k is the number of descendents and n
|
| 228 |
+
/// is the array length.
|
| 229 |
+
///
|
| 230 |
+
/// \return Status
|
| 231 |
+
Status ValidateFull() const;
|
| 232 |
+
|
| 233 |
+
/// \brief Return the device_type that this array's data is allocated on
|
| 234 |
+
///
|
| 235 |
+
/// This just delegates to calling device_type on the underlying ArrayData
|
| 236 |
+
/// object which backs this Array.
|
| 237 |
+
///
|
| 238 |
+
/// \return DeviceAllocationType
|
| 239 |
+
DeviceAllocationType device_type() const { return data_->device_type(); }
|
| 240 |
+
|
| 241 |
+
/// \brief Return the statistics of this Array
|
| 242 |
+
///
|
| 243 |
+
/// This just delegates to calling statistics on the underlying ArrayData
|
| 244 |
+
/// object which backs this Array.
|
| 245 |
+
///
|
| 246 |
+
/// \return const std::shared_ptr<ArrayStatistics>&
|
| 247 |
+
const std::shared_ptr<ArrayStatistics>& statistics() const { return data_->statistics; }
|
| 248 |
+
|
| 249 |
+
protected:
|
| 250 |
+
Array() = default;
|
| 251 |
+
ARROW_DEFAULT_MOVE_AND_ASSIGN(Array);
|
| 252 |
+
|
| 253 |
+
std::shared_ptr<ArrayData> data_;
|
| 254 |
+
const uint8_t* null_bitmap_data_ = NULLPTR;
|
| 255 |
+
|
| 256 |
+
/// Protected method for constructors
|
| 257 |
+
void SetData(const std::shared_ptr<ArrayData>& data) {
|
| 258 |
+
if (data->buffers.size() > 0) {
|
| 259 |
+
null_bitmap_data_ = data->GetValuesSafe<uint8_t>(0, /*offset=*/0);
|
| 260 |
+
} else {
|
| 261 |
+
null_bitmap_data_ = NULLPTR;
|
| 262 |
+
}
|
| 263 |
+
data_ = data;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
private:
|
| 267 |
+
ARROW_DISALLOW_COPY_AND_ASSIGN(Array);
|
| 268 |
+
};
|
| 269 |
+
|
| 270 |
+
ARROW_EXPORT void PrintTo(const Array& x, std::ostream* os);
|
| 271 |
+
|
| 272 |
+
static inline std::ostream& operator<<(std::ostream& os, const Array& x) {
|
| 273 |
+
os << x.ToString();
|
| 274 |
+
return os;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
/// Base class for non-nested arrays
|
| 278 |
+
class ARROW_EXPORT FlatArray : public Array {
|
| 279 |
+
protected:
|
| 280 |
+
using Array::Array;
|
| 281 |
+
};
|
| 282 |
+
|
| 283 |
+
/// Base class for arrays of fixed-size logical types
|
| 284 |
+
class ARROW_EXPORT PrimitiveArray : public FlatArray {
|
| 285 |
+
public:
|
| 286 |
+
/// Does not account for any slice offset
|
| 287 |
+
const std::shared_ptr<Buffer>& values() const { return data_->buffers[1]; }
|
| 288 |
+
|
| 289 |
+
protected:
|
| 290 |
+
PrimitiveArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 291 |
+
const std::shared_ptr<Buffer>& data,
|
| 292 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 293 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 294 |
+
|
| 295 |
+
PrimitiveArray() : raw_values_(NULLPTR) {}
|
| 296 |
+
|
| 297 |
+
void SetData(const std::shared_ptr<ArrayData>& data) {
|
| 298 |
+
this->Array::SetData(data);
|
| 299 |
+
raw_values_ = data->GetValuesSafe<uint8_t>(1, /*offset=*/0);
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
explicit PrimitiveArray(const std::shared_ptr<ArrayData>& data) { SetData(data); }
|
| 303 |
+
|
| 304 |
+
const uint8_t* raw_values_;
|
| 305 |
+
};
|
| 306 |
+
|
| 307 |
+
/// Degenerate null type Array
|
| 308 |
+
class ARROW_EXPORT NullArray : public FlatArray {
|
| 309 |
+
public:
|
| 310 |
+
using TypeClass = NullType;
|
| 311 |
+
|
| 312 |
+
explicit NullArray(const std::shared_ptr<ArrayData>& data) { SetData(data); }
|
| 313 |
+
explicit NullArray(int64_t length);
|
| 314 |
+
|
| 315 |
+
private:
|
| 316 |
+
void SetData(const std::shared_ptr<ArrayData>& data) {
|
| 317 |
+
null_bitmap_data_ = NULLPTR;
|
| 318 |
+
data->null_count = data->length;
|
| 319 |
+
data_ = data;
|
| 320 |
+
}
|
| 321 |
+
};
|
| 322 |
+
|
| 323 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_binary.h
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// Array accessor classes for Binary, LargeBinary, String, LargeString,
|
| 19 |
+
// FixedSizeBinary
|
| 20 |
+
|
| 21 |
+
#pragma once
|
| 22 |
+
|
| 23 |
+
#include <cstdint>
|
| 24 |
+
#include <memory>
|
| 25 |
+
#include <optional>
|
| 26 |
+
#include <string>
|
| 27 |
+
#include <string_view>
|
| 28 |
+
#include <vector>
|
| 29 |
+
|
| 30 |
+
#include "arrow/array/array_base.h"
|
| 31 |
+
#include "arrow/array/data.h"
|
| 32 |
+
#include "arrow/buffer.h"
|
| 33 |
+
#include "arrow/stl_iterator.h"
|
| 34 |
+
#include "arrow/type.h"
|
| 35 |
+
#include "arrow/util/checked_cast.h"
|
| 36 |
+
#include "arrow/util/macros.h"
|
| 37 |
+
#include "arrow/util/visibility.h"
|
| 38 |
+
|
| 39 |
+
namespace arrow {
|
| 40 |
+
|
| 41 |
+
/// \addtogroup binary-arrays
|
| 42 |
+
///
|
| 43 |
+
/// @{
|
| 44 |
+
|
| 45 |
+
// ----------------------------------------------------------------------
|
| 46 |
+
// Binary and String
|
| 47 |
+
|
| 48 |
+
/// Base class for variable-sized binary arrays, regardless of offset size
|
| 49 |
+
/// and logical interpretation.
|
| 50 |
+
template <typename TYPE>
|
| 51 |
+
class BaseBinaryArray : public FlatArray {
|
| 52 |
+
public:
|
| 53 |
+
using TypeClass = TYPE;
|
| 54 |
+
using offset_type = typename TypeClass::offset_type;
|
| 55 |
+
using IteratorType = stl::ArrayIterator<BaseBinaryArray<TYPE>>;
|
| 56 |
+
|
| 57 |
+
/// Return the pointer to the given elements bytes
|
| 58 |
+
// XXX should GetValue(int64_t i) return a string_view?
|
| 59 |
+
const uint8_t* GetValue(int64_t i, offset_type* out_length) const {
|
| 60 |
+
const offset_type pos = raw_value_offsets_[i];
|
| 61 |
+
*out_length = raw_value_offsets_[i + 1] - pos;
|
| 62 |
+
return raw_data_ + pos;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/// \brief Get binary value as a string_view
|
| 66 |
+
///
|
| 67 |
+
/// \param i the value index
|
| 68 |
+
/// \return the view over the selected value
|
| 69 |
+
std::string_view GetView(int64_t i) const {
|
| 70 |
+
const offset_type pos = raw_value_offsets_[i];
|
| 71 |
+
return std::string_view(reinterpret_cast<const char*>(raw_data_ + pos),
|
| 72 |
+
raw_value_offsets_[i + 1] - pos);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
std::optional<std::string_view> operator[](int64_t i) const {
|
| 76 |
+
return *IteratorType(*this, i);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/// \brief Get binary value as a string_view
|
| 80 |
+
/// Provided for consistency with other arrays.
|
| 81 |
+
///
|
| 82 |
+
/// \param i the value index
|
| 83 |
+
/// \return the view over the selected value
|
| 84 |
+
std::string_view Value(int64_t i) const { return GetView(i); }
|
| 85 |
+
|
| 86 |
+
/// \brief Get binary value as a std::string
|
| 87 |
+
///
|
| 88 |
+
/// \param i the value index
|
| 89 |
+
/// \return the value copied into a std::string
|
| 90 |
+
std::string GetString(int64_t i) const { return std::string(GetView(i)); }
|
| 91 |
+
|
| 92 |
+
/// Note that this buffer does not account for any slice offset
|
| 93 |
+
std::shared_ptr<Buffer> value_offsets() const { return data_->buffers[1]; }
|
| 94 |
+
|
| 95 |
+
/// Note that this buffer does not account for any slice offset
|
| 96 |
+
std::shared_ptr<Buffer> value_data() const { return data_->buffers[2]; }
|
| 97 |
+
|
| 98 |
+
const offset_type* raw_value_offsets() const { return raw_value_offsets_; }
|
| 99 |
+
|
| 100 |
+
const uint8_t* raw_data() const { return raw_data_; }
|
| 101 |
+
|
| 102 |
+
/// \brief Return the data buffer absolute offset of the data for the value
|
| 103 |
+
/// at the passed index.
|
| 104 |
+
///
|
| 105 |
+
/// Does not perform boundschecking
|
| 106 |
+
offset_type value_offset(int64_t i) const { return raw_value_offsets_[i]; }
|
| 107 |
+
|
| 108 |
+
/// \brief Return the length of the data for the value at the passed index.
|
| 109 |
+
///
|
| 110 |
+
/// Does not perform boundschecking
|
| 111 |
+
offset_type value_length(int64_t i) const {
|
| 112 |
+
return raw_value_offsets_[i + 1] - raw_value_offsets_[i];
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/// \brief Return the total length of the memory in the data buffer
|
| 116 |
+
/// referenced by this array. If the array has been sliced then this may be
|
| 117 |
+
/// less than the size of the data buffer (data_->buffers[2]).
|
| 118 |
+
offset_type total_values_length() const {
|
| 119 |
+
if (data_->length > 0) {
|
| 120 |
+
return raw_value_offsets_[data_->length] - raw_value_offsets_[0];
|
| 121 |
+
} else {
|
| 122 |
+
return 0;
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
IteratorType begin() const { return IteratorType(*this); }
|
| 127 |
+
|
| 128 |
+
IteratorType end() const { return IteratorType(*this, length()); }
|
| 129 |
+
|
| 130 |
+
protected:
|
| 131 |
+
// For subclasses
|
| 132 |
+
BaseBinaryArray() = default;
|
| 133 |
+
|
| 134 |
+
// Protected method for constructors
|
| 135 |
+
void SetData(const std::shared_ptr<ArrayData>& data) {
|
| 136 |
+
this->Array::SetData(data);
|
| 137 |
+
raw_value_offsets_ = data->GetValuesSafe<offset_type>(1);
|
| 138 |
+
raw_data_ = data->GetValuesSafe<uint8_t>(2, /*offset=*/0);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
const offset_type* raw_value_offsets_ = NULLPTR;
|
| 142 |
+
const uint8_t* raw_data_ = NULLPTR;
|
| 143 |
+
};
|
| 144 |
+
|
| 145 |
+
/// Concrete Array class for variable-size binary data
|
| 146 |
+
class ARROW_EXPORT BinaryArray : public BaseBinaryArray<BinaryType> {
|
| 147 |
+
public:
|
| 148 |
+
explicit BinaryArray(const std::shared_ptr<ArrayData>& data);
|
| 149 |
+
|
| 150 |
+
BinaryArray(int64_t length, const std::shared_ptr<Buffer>& value_offsets,
|
| 151 |
+
const std::shared_ptr<Buffer>& data,
|
| 152 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 153 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 154 |
+
|
| 155 |
+
protected:
|
| 156 |
+
// For subclasses such as StringArray
|
| 157 |
+
BinaryArray() : BaseBinaryArray() {}
|
| 158 |
+
};
|
| 159 |
+
|
| 160 |
+
/// Concrete Array class for variable-size string (utf-8) data
|
| 161 |
+
class ARROW_EXPORT StringArray : public BinaryArray {
|
| 162 |
+
public:
|
| 163 |
+
using TypeClass = StringType;
|
| 164 |
+
|
| 165 |
+
explicit StringArray(const std::shared_ptr<ArrayData>& data);
|
| 166 |
+
|
| 167 |
+
StringArray(int64_t length, const std::shared_ptr<Buffer>& value_offsets,
|
| 168 |
+
const std::shared_ptr<Buffer>& data,
|
| 169 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 170 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 171 |
+
|
| 172 |
+
/// \brief Validate that this array contains only valid UTF8 entries
|
| 173 |
+
///
|
| 174 |
+
/// This check is also implied by ValidateFull()
|
| 175 |
+
Status ValidateUTF8() const;
|
| 176 |
+
};
|
| 177 |
+
|
| 178 |
+
/// Concrete Array class for large variable-size binary data
|
| 179 |
+
class ARROW_EXPORT LargeBinaryArray : public BaseBinaryArray<LargeBinaryType> {
|
| 180 |
+
public:
|
| 181 |
+
explicit LargeBinaryArray(const std::shared_ptr<ArrayData>& data);
|
| 182 |
+
|
| 183 |
+
LargeBinaryArray(int64_t length, const std::shared_ptr<Buffer>& value_offsets,
|
| 184 |
+
const std::shared_ptr<Buffer>& data,
|
| 185 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 186 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 187 |
+
|
| 188 |
+
protected:
|
| 189 |
+
// For subclasses such as LargeStringArray
|
| 190 |
+
LargeBinaryArray() : BaseBinaryArray() {}
|
| 191 |
+
};
|
| 192 |
+
|
| 193 |
+
/// Concrete Array class for large variable-size string (utf-8) data
|
| 194 |
+
class ARROW_EXPORT LargeStringArray : public LargeBinaryArray {
|
| 195 |
+
public:
|
| 196 |
+
using TypeClass = LargeStringType;
|
| 197 |
+
|
| 198 |
+
explicit LargeStringArray(const std::shared_ptr<ArrayData>& data);
|
| 199 |
+
|
| 200 |
+
LargeStringArray(int64_t length, const std::shared_ptr<Buffer>& value_offsets,
|
| 201 |
+
const std::shared_ptr<Buffer>& data,
|
| 202 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 203 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 204 |
+
|
| 205 |
+
/// \brief Validate that this array contains only valid UTF8 entries
|
| 206 |
+
///
|
| 207 |
+
/// This check is also implied by ValidateFull()
|
| 208 |
+
Status ValidateUTF8() const;
|
| 209 |
+
};
|
| 210 |
+
|
| 211 |
+
// ----------------------------------------------------------------------
|
| 212 |
+
// BinaryView and StringView
|
| 213 |
+
|
| 214 |
+
/// Concrete Array class for variable-size binary view data using the
|
| 215 |
+
/// BinaryViewType::c_type struct to reference in-line or out-of-line string values
|
| 216 |
+
class ARROW_EXPORT BinaryViewArray : public FlatArray {
|
| 217 |
+
public:
|
| 218 |
+
using TypeClass = BinaryViewType;
|
| 219 |
+
using IteratorType = stl::ArrayIterator<BinaryViewArray>;
|
| 220 |
+
using c_type = BinaryViewType::c_type;
|
| 221 |
+
|
| 222 |
+
explicit BinaryViewArray(std::shared_ptr<ArrayData> data);
|
| 223 |
+
|
| 224 |
+
BinaryViewArray(std::shared_ptr<DataType> type, int64_t length,
|
| 225 |
+
std::shared_ptr<Buffer> views, BufferVector data_buffers,
|
| 226 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 227 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 228 |
+
|
| 229 |
+
// For API compatibility with BinaryArray etc.
|
| 230 |
+
std::string_view GetView(int64_t i) const;
|
| 231 |
+
std::string GetString(int64_t i) const { return std::string{GetView(i)}; }
|
| 232 |
+
|
| 233 |
+
const auto& values() const { return data_->buffers[1]; }
|
| 234 |
+
const c_type* raw_values() const { return raw_values_; }
|
| 235 |
+
|
| 236 |
+
std::optional<std::string_view> operator[](int64_t i) const {
|
| 237 |
+
return *IteratorType(*this, i);
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
IteratorType begin() const { return IteratorType(*this); }
|
| 241 |
+
IteratorType end() const { return IteratorType(*this, length()); }
|
| 242 |
+
|
| 243 |
+
protected:
|
| 244 |
+
using FlatArray::FlatArray;
|
| 245 |
+
|
| 246 |
+
void SetData(std::shared_ptr<ArrayData> data) {
|
| 247 |
+
FlatArray::SetData(std::move(data));
|
| 248 |
+
raw_values_ = data_->GetValuesSafe<c_type>(1);
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
const c_type* raw_values_;
|
| 252 |
+
};
|
| 253 |
+
|
| 254 |
+
/// Concrete Array class for variable-size string view (utf-8) data using
|
| 255 |
+
/// BinaryViewType::c_type to reference in-line or out-of-line string values
|
| 256 |
+
class ARROW_EXPORT StringViewArray : public BinaryViewArray {
|
| 257 |
+
public:
|
| 258 |
+
using TypeClass = StringViewType;
|
| 259 |
+
|
| 260 |
+
explicit StringViewArray(std::shared_ptr<ArrayData> data);
|
| 261 |
+
|
| 262 |
+
using BinaryViewArray::BinaryViewArray;
|
| 263 |
+
|
| 264 |
+
/// \brief Validate that this array contains only valid UTF8 entries
|
| 265 |
+
///
|
| 266 |
+
/// This check is also implied by ValidateFull()
|
| 267 |
+
Status ValidateUTF8() const;
|
| 268 |
+
};
|
| 269 |
+
|
| 270 |
+
// ----------------------------------------------------------------------
|
| 271 |
+
// Fixed width binary
|
| 272 |
+
|
| 273 |
+
/// Concrete Array class for fixed-size binary data
|
| 274 |
+
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
|
| 275 |
+
public:
|
| 276 |
+
using TypeClass = FixedSizeBinaryType;
|
| 277 |
+
using IteratorType = stl::ArrayIterator<FixedSizeBinaryArray>;
|
| 278 |
+
|
| 279 |
+
explicit FixedSizeBinaryArray(const std::shared_ptr<ArrayData>& data);
|
| 280 |
+
|
| 281 |
+
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 282 |
+
const std::shared_ptr<Buffer>& data,
|
| 283 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 284 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 285 |
+
|
| 286 |
+
const uint8_t* GetValue(int64_t i) const { return values_ + i * byte_width_; }
|
| 287 |
+
const uint8_t* Value(int64_t i) const { return GetValue(i); }
|
| 288 |
+
|
| 289 |
+
std::string_view GetView(int64_t i) const {
|
| 290 |
+
return std::string_view(reinterpret_cast<const char*>(GetValue(i)), byte_width_);
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
std::optional<std::string_view> operator[](int64_t i) const {
|
| 294 |
+
return *IteratorType(*this, i);
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
std::string GetString(int64_t i) const { return std::string(GetView(i)); }
|
| 298 |
+
|
| 299 |
+
int32_t byte_width() const { return byte_width_; }
|
| 300 |
+
|
| 301 |
+
const uint8_t* raw_values() const { return values_; }
|
| 302 |
+
|
| 303 |
+
IteratorType begin() const { return IteratorType(*this); }
|
| 304 |
+
|
| 305 |
+
IteratorType end() const { return IteratorType(*this, length()); }
|
| 306 |
+
|
| 307 |
+
protected:
|
| 308 |
+
void SetData(const std::shared_ptr<ArrayData>& data) {
|
| 309 |
+
this->PrimitiveArray::SetData(data);
|
| 310 |
+
byte_width_ =
|
| 311 |
+
internal::checked_cast<const FixedSizeBinaryType&>(*type()).byte_width();
|
| 312 |
+
values_ = raw_values_ + data_->offset * byte_width_;
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
const uint8_t* values_;
|
| 316 |
+
int32_t byte_width_;
|
| 317 |
+
};
|
| 318 |
+
|
| 319 |
+
/// @}
|
| 320 |
+
|
| 321 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_decimal.h
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <memory>
|
| 22 |
+
#include <string>
|
| 23 |
+
|
| 24 |
+
#include "arrow/array/array_binary.h"
|
| 25 |
+
#include "arrow/array/data.h"
|
| 26 |
+
#include "arrow/type.h"
|
| 27 |
+
#include "arrow/util/visibility.h"
|
| 28 |
+
|
| 29 |
+
namespace arrow {
|
| 30 |
+
|
| 31 |
+
/// \addtogroup numeric-arrays
|
| 32 |
+
///
|
| 33 |
+
/// @{
|
| 34 |
+
|
| 35 |
+
// ----------------------------------------------------------------------
|
| 36 |
+
// Decimal32Array
|
| 37 |
+
|
| 38 |
+
/// Concrete Array class for 32-bit decimal data
|
| 39 |
+
class ARROW_EXPORT Decimal32Array : public FixedSizeBinaryArray {
|
| 40 |
+
public:
|
| 41 |
+
using TypeClass = Decimal32Type;
|
| 42 |
+
|
| 43 |
+
using FixedSizeBinaryArray::FixedSizeBinaryArray;
|
| 44 |
+
|
| 45 |
+
/// \brief Construct Decimal32Array from ArrayData instance
|
| 46 |
+
explicit Decimal32Array(const std::shared_ptr<ArrayData>& data);
|
| 47 |
+
|
| 48 |
+
std::string FormatValue(int64_t i) const;
|
| 49 |
+
};
|
| 50 |
+
|
| 51 |
+
// ----------------------------------------------------------------------
|
| 52 |
+
// Decimal64Array
|
| 53 |
+
|
| 54 |
+
/// Concrete Array class for 64-bit decimal data
|
| 55 |
+
class ARROW_EXPORT Decimal64Array : public FixedSizeBinaryArray {
|
| 56 |
+
public:
|
| 57 |
+
using TypeClass = Decimal64Type;
|
| 58 |
+
|
| 59 |
+
using FixedSizeBinaryArray::FixedSizeBinaryArray;
|
| 60 |
+
|
| 61 |
+
/// \brief Construct Decimal64Array from ArrayData instance
|
| 62 |
+
explicit Decimal64Array(const std::shared_ptr<ArrayData>& data);
|
| 63 |
+
|
| 64 |
+
std::string FormatValue(int64_t i) const;
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
// ----------------------------------------------------------------------
|
| 68 |
+
// Decimal128Array
|
| 69 |
+
|
| 70 |
+
/// Concrete Array class for 128-bit decimal data
|
| 71 |
+
class ARROW_EXPORT Decimal128Array : public FixedSizeBinaryArray {
|
| 72 |
+
public:
|
| 73 |
+
using TypeClass = Decimal128Type;
|
| 74 |
+
|
| 75 |
+
using FixedSizeBinaryArray::FixedSizeBinaryArray;
|
| 76 |
+
|
| 77 |
+
/// \brief Construct Decimal128Array from ArrayData instance
|
| 78 |
+
explicit Decimal128Array(const std::shared_ptr<ArrayData>& data);
|
| 79 |
+
|
| 80 |
+
std::string FormatValue(int64_t i) const;
|
| 81 |
+
};
|
| 82 |
+
|
| 83 |
+
// Backward compatibility
|
| 84 |
+
using DecimalArray = Decimal128Array;
|
| 85 |
+
|
| 86 |
+
// ----------------------------------------------------------------------
|
| 87 |
+
// Decimal256Array
|
| 88 |
+
|
| 89 |
+
/// Concrete Array class for 256-bit decimal data
|
| 90 |
+
class ARROW_EXPORT Decimal256Array : public FixedSizeBinaryArray {
|
| 91 |
+
public:
|
| 92 |
+
using TypeClass = Decimal256Type;
|
| 93 |
+
|
| 94 |
+
using FixedSizeBinaryArray::FixedSizeBinaryArray;
|
| 95 |
+
|
| 96 |
+
/// \brief Construct Decimal256Array from ArrayData instance
|
| 97 |
+
explicit Decimal256Array(const std::shared_ptr<ArrayData>& data);
|
| 98 |
+
|
| 99 |
+
std::string FormatValue(int64_t i) const;
|
| 100 |
+
};
|
| 101 |
+
|
| 102 |
+
/// @}
|
| 103 |
+
|
| 104 |
+
} // namespace arrow
|
code/LaDi-R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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <memory>
|
| 22 |
+
|
| 23 |
+
#include "arrow/array/array_base.h"
|
| 24 |
+
#include "arrow/array/data.h"
|
| 25 |
+
#include "arrow/result.h"
|
| 26 |
+
#include "arrow/status.h"
|
| 27 |
+
#include "arrow/type.h"
|
| 28 |
+
#include "arrow/util/macros.h"
|
| 29 |
+
#include "arrow/util/visibility.h"
|
| 30 |
+
|
| 31 |
+
namespace arrow {
|
| 32 |
+
|
| 33 |
+
// ----------------------------------------------------------------------
|
| 34 |
+
// DictionaryArray
|
| 35 |
+
|
| 36 |
+
/// \brief Array type for dictionary-encoded data with a
|
| 37 |
+
/// data-dependent dictionary
|
| 38 |
+
///
|
| 39 |
+
/// A dictionary array contains an array of non-negative integers (the
|
| 40 |
+
/// "dictionary indices") along with a data type containing a "dictionary"
|
| 41 |
+
/// corresponding to the distinct values represented in the data.
|
| 42 |
+
///
|
| 43 |
+
/// For example, the array
|
| 44 |
+
///
|
| 45 |
+
/// ["foo", "bar", "foo", "bar", "foo", "bar"]
|
| 46 |
+
///
|
| 47 |
+
/// with dictionary ["bar", "foo"], would have dictionary array representation
|
| 48 |
+
///
|
| 49 |
+
/// indices: [1, 0, 1, 0, 1, 0]
|
| 50 |
+
/// dictionary: ["bar", "foo"]
|
| 51 |
+
///
|
| 52 |
+
/// The indices in principle may be any integer type.
|
| 53 |
+
class ARROW_EXPORT DictionaryArray : public Array {
|
| 54 |
+
public:
|
| 55 |
+
using TypeClass = DictionaryType;
|
| 56 |
+
|
| 57 |
+
explicit DictionaryArray(const std::shared_ptr<ArrayData>& data);
|
| 58 |
+
|
| 59 |
+
DictionaryArray(const std::shared_ptr<DataType>& type,
|
| 60 |
+
const std::shared_ptr<Array>& indices,
|
| 61 |
+
const std::shared_ptr<Array>& dictionary);
|
| 62 |
+
|
| 63 |
+
/// \brief Construct DictionaryArray from dictionary and indices
|
| 64 |
+
/// array and validate
|
| 65 |
+
///
|
| 66 |
+
/// This function does the validation of the indices and input type. It checks if
|
| 67 |
+
/// all indices are non-negative and smaller than the size of the dictionary.
|
| 68 |
+
///
|
| 69 |
+
/// \param[in] type a dictionary type
|
| 70 |
+
/// \param[in] dictionary the dictionary with same value type as the
|
| 71 |
+
/// type object
|
| 72 |
+
/// \param[in] indices an array of non-negative integers smaller than the
|
| 73 |
+
/// size of the dictionary
|
| 74 |
+
static Result<std::shared_ptr<Array>> FromArrays(
|
| 75 |
+
const std::shared_ptr<DataType>& type, const std::shared_ptr<Array>& indices,
|
| 76 |
+
const std::shared_ptr<Array>& dictionary);
|
| 77 |
+
|
| 78 |
+
static Result<std::shared_ptr<Array>> FromArrays(
|
| 79 |
+
const std::shared_ptr<Array>& indices, const std::shared_ptr<Array>& dictionary) {
|
| 80 |
+
return FromArrays(::arrow::dictionary(indices->type(), dictionary->type()), indices,
|
| 81 |
+
dictionary);
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/// \brief Transpose this DictionaryArray
|
| 85 |
+
///
|
| 86 |
+
/// This method constructs a new dictionary array with the given dictionary
|
| 87 |
+
/// type, transposing indices using the transpose map. The type and the
|
| 88 |
+
/// transpose map are typically computed using DictionaryUnifier.
|
| 89 |
+
///
|
| 90 |
+
/// \param[in] type the new type object
|
| 91 |
+
/// \param[in] dictionary the new dictionary
|
| 92 |
+
/// \param[in] transpose_map transposition array of this array's indices
|
| 93 |
+
/// into the target array's indices
|
| 94 |
+
/// \param[in] pool a pool to allocate the array data from
|
| 95 |
+
Result<std::shared_ptr<Array>> Transpose(
|
| 96 |
+
const std::shared_ptr<DataType>& type, const std::shared_ptr<Array>& dictionary,
|
| 97 |
+
const int32_t* transpose_map, MemoryPool* pool = default_memory_pool()) const;
|
| 98 |
+
|
| 99 |
+
Result<std::shared_ptr<Array>> Compact(MemoryPool* pool = default_memory_pool()) const;
|
| 100 |
+
|
| 101 |
+
/// \brief Determine whether dictionary arrays may be compared without unification
|
| 102 |
+
bool CanCompareIndices(const DictionaryArray& other) const;
|
| 103 |
+
|
| 104 |
+
/// \brief Return the dictionary for this array, which is stored as
|
| 105 |
+
/// a member of the ArrayData internal structure
|
| 106 |
+
const std::shared_ptr<Array>& dictionary() const;
|
| 107 |
+
const std::shared_ptr<Array>& indices() const;
|
| 108 |
+
|
| 109 |
+
/// \brief Return the ith value of indices, cast to int64_t. Not recommended
|
| 110 |
+
/// for use in performance-sensitive code. Does not validate whether the
|
| 111 |
+
/// value is null or out-of-bounds.
|
| 112 |
+
int64_t GetValueIndex(int64_t i) const;
|
| 113 |
+
|
| 114 |
+
const DictionaryType* dict_type() const { return dict_type_; }
|
| 115 |
+
|
| 116 |
+
private:
|
| 117 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 118 |
+
const DictionaryType* dict_type_;
|
| 119 |
+
std::shared_ptr<Array> indices_;
|
| 120 |
+
|
| 121 |
+
// Lazily initialized when invoking dictionary()
|
| 122 |
+
mutable std::shared_ptr<Array> dictionary_;
|
| 123 |
+
};
|
| 124 |
+
|
| 125 |
+
/// \brief Helper class for incremental dictionary unification
|
| 126 |
+
class ARROW_EXPORT DictionaryUnifier {
|
| 127 |
+
public:
|
| 128 |
+
virtual ~DictionaryUnifier() = default;
|
| 129 |
+
|
| 130 |
+
/// \brief Construct a DictionaryUnifier
|
| 131 |
+
/// \param[in] value_type the data type of the dictionaries
|
| 132 |
+
/// \param[in] pool MemoryPool to use for memory allocations
|
| 133 |
+
static Result<std::unique_ptr<DictionaryUnifier>> Make(
|
| 134 |
+
std::shared_ptr<DataType> value_type, MemoryPool* pool = default_memory_pool());
|
| 135 |
+
|
| 136 |
+
/// \brief Unify dictionaries across array chunks
|
| 137 |
+
///
|
| 138 |
+
/// The dictionaries in the array chunks will be unified, their indices
|
| 139 |
+
/// accordingly transposed.
|
| 140 |
+
///
|
| 141 |
+
/// Only dictionaries with a primitive value type are currently supported.
|
| 142 |
+
/// However, dictionaries nested inside a more complex type are correctly unified.
|
| 143 |
+
static Result<std::shared_ptr<ChunkedArray>> UnifyChunkedArray(
|
| 144 |
+
const std::shared_ptr<ChunkedArray>& array,
|
| 145 |
+
MemoryPool* pool = default_memory_pool());
|
| 146 |
+
|
| 147 |
+
/// \brief Unify dictionaries across the chunks of each table column
|
| 148 |
+
///
|
| 149 |
+
/// The dictionaries in each table column will be unified, their indices
|
| 150 |
+
/// accordingly transposed.
|
| 151 |
+
///
|
| 152 |
+
/// Only dictionaries with a primitive value type are currently supported.
|
| 153 |
+
/// However, dictionaries nested inside a more complex type are correctly unified.
|
| 154 |
+
static Result<std::shared_ptr<Table>> UnifyTable(
|
| 155 |
+
const Table& table, MemoryPool* pool = default_memory_pool());
|
| 156 |
+
|
| 157 |
+
/// \brief Append dictionary to the internal memo
|
| 158 |
+
virtual Status Unify(const Array& dictionary) = 0;
|
| 159 |
+
|
| 160 |
+
/// \brief Append dictionary and compute transpose indices
|
| 161 |
+
/// \param[in] dictionary the dictionary values to unify
|
| 162 |
+
/// \param[out] out_transpose a Buffer containing computed transpose indices
|
| 163 |
+
/// as int32_t values equal in length to the passed dictionary. The value in
|
| 164 |
+
/// each slot corresponds to the new index value for each original index
|
| 165 |
+
/// for a DictionaryArray with the old dictionary
|
| 166 |
+
virtual Status Unify(const Array& dictionary,
|
| 167 |
+
std::shared_ptr<Buffer>* out_transpose) = 0;
|
| 168 |
+
|
| 169 |
+
/// \brief Return a result DictionaryType with the smallest possible index
|
| 170 |
+
/// type to accommodate the unified dictionary. The unifier cannot be used
|
| 171 |
+
/// after this is called
|
| 172 |
+
virtual Status GetResult(std::shared_ptr<DataType>* out_type,
|
| 173 |
+
std::shared_ptr<Array>* out_dict) = 0;
|
| 174 |
+
|
| 175 |
+
/// \brief Return a unified dictionary with the given index type. If
|
| 176 |
+
/// the index type is not large enough then an invalid status will be returned.
|
| 177 |
+
/// The unifier cannot be used after this is called
|
| 178 |
+
virtual Status GetResultWithIndexType(const std::shared_ptr<DataType>& index_type,
|
| 179 |
+
std::shared_ptr<Array>* out_dict) = 0;
|
| 180 |
+
};
|
| 181 |
+
|
| 182 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_nested.h
ADDED
|
@@ -0,0 +1,899 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// Array accessor classes for List, LargeList, ListView, LargeListView, FixedSizeList,
|
| 19 |
+
// Map, Struct, and Union
|
| 20 |
+
|
| 21 |
+
#pragma once
|
| 22 |
+
|
| 23 |
+
#include <cstdint>
|
| 24 |
+
#include <memory>
|
| 25 |
+
#include <string>
|
| 26 |
+
#include <utility>
|
| 27 |
+
#include <vector>
|
| 28 |
+
|
| 29 |
+
#include "arrow/array/array_base.h"
|
| 30 |
+
#include "arrow/array/data.h"
|
| 31 |
+
#include "arrow/result.h"
|
| 32 |
+
#include "arrow/status.h"
|
| 33 |
+
#include "arrow/type.h"
|
| 34 |
+
#include "arrow/type_fwd.h"
|
| 35 |
+
#include "arrow/util/checked_cast.h"
|
| 36 |
+
#include "arrow/util/macros.h"
|
| 37 |
+
#include "arrow/util/visibility.h"
|
| 38 |
+
|
| 39 |
+
namespace arrow {
|
| 40 |
+
|
| 41 |
+
/// \addtogroup nested-arrays
|
| 42 |
+
///
|
| 43 |
+
/// @{
|
| 44 |
+
|
| 45 |
+
// ----------------------------------------------------------------------
|
| 46 |
+
// VarLengthListLikeArray
|
| 47 |
+
|
| 48 |
+
template <typename TYPE>
|
| 49 |
+
class VarLengthListLikeArray;
|
| 50 |
+
|
| 51 |
+
namespace internal {
|
| 52 |
+
|
| 53 |
+
// Private helper for [Large]List[View]Array::SetData.
|
| 54 |
+
// Unfortunately, trying to define VarLengthListLikeArray::SetData outside of this header
|
| 55 |
+
// doesn't play well with MSVC.
|
| 56 |
+
template <typename TYPE>
|
| 57 |
+
void SetListData(VarLengthListLikeArray<TYPE>* self,
|
| 58 |
+
const std::shared_ptr<ArrayData>& data,
|
| 59 |
+
Type::type expected_type_id = TYPE::type_id);
|
| 60 |
+
|
| 61 |
+
/// \brief A version of Flatten that keeps recursively flattening until an array of
|
| 62 |
+
/// non-list values is reached.
|
| 63 |
+
///
|
| 64 |
+
/// Array types considered to be lists by this function:
|
| 65 |
+
/// - list
|
| 66 |
+
/// - large_list
|
| 67 |
+
/// - list_view
|
| 68 |
+
/// - large_list_view
|
| 69 |
+
/// - fixed_size_list
|
| 70 |
+
///
|
| 71 |
+
/// \see ListArray::Flatten
|
| 72 |
+
ARROW_EXPORT Result<std::shared_ptr<Array>> FlattenLogicalListRecursively(
|
| 73 |
+
const Array& in_array, MemoryPool* memory_pool);
|
| 74 |
+
|
| 75 |
+
} // namespace internal
|
| 76 |
+
|
| 77 |
+
/// Base class for variable-sized list and list-view arrays, regardless of offset size.
|
| 78 |
+
template <typename TYPE>
|
| 79 |
+
class VarLengthListLikeArray : public Array {
|
| 80 |
+
public:
|
| 81 |
+
using TypeClass = TYPE;
|
| 82 |
+
using offset_type = typename TypeClass::offset_type;
|
| 83 |
+
|
| 84 |
+
const TypeClass* var_length_list_like_type() const { return this->list_type_; }
|
| 85 |
+
|
| 86 |
+
/// \brief Return array object containing the list's values
|
| 87 |
+
///
|
| 88 |
+
/// Note that this buffer does not account for any slice offset or length.
|
| 89 |
+
const std::shared_ptr<Array>& values() const { return values_; }
|
| 90 |
+
|
| 91 |
+
/// Note that this buffer does not account for any slice offset or length.
|
| 92 |
+
const std::shared_ptr<Buffer>& value_offsets() const { return data_->buffers[1]; }
|
| 93 |
+
|
| 94 |
+
const std::shared_ptr<DataType>& value_type() const { return list_type_->value_type(); }
|
| 95 |
+
|
| 96 |
+
/// Return pointer to raw value offsets accounting for any slice offset
|
| 97 |
+
const offset_type* raw_value_offsets() const { return raw_value_offsets_; }
|
| 98 |
+
|
| 99 |
+
// The following functions will not perform boundschecking
|
| 100 |
+
|
| 101 |
+
offset_type value_offset(int64_t i) const { return raw_value_offsets_[i]; }
|
| 102 |
+
|
| 103 |
+
/// \brief Return the size of the value at a particular index
|
| 104 |
+
///
|
| 105 |
+
/// Since non-empty null lists and list-views are possible, avoid calling this
|
| 106 |
+
/// function when the list at slot i is null.
|
| 107 |
+
///
|
| 108 |
+
/// \pre IsValid(i)
|
| 109 |
+
virtual offset_type value_length(int64_t i) const = 0;
|
| 110 |
+
|
| 111 |
+
/// \pre IsValid(i)
|
| 112 |
+
std::shared_ptr<Array> value_slice(int64_t i) const {
|
| 113 |
+
return values_->Slice(value_offset(i), value_length(i));
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/// \brief Flatten all level recursively until reach a non-list type, and return
|
| 117 |
+
/// a non-list type Array.
|
| 118 |
+
///
|
| 119 |
+
/// \see internal::FlattenLogicalListRecursively
|
| 120 |
+
Result<std::shared_ptr<Array>> FlattenRecursively(
|
| 121 |
+
MemoryPool* memory_pool = default_memory_pool()) const {
|
| 122 |
+
return internal::FlattenLogicalListRecursively(*this, memory_pool);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
protected:
|
| 126 |
+
friend void internal::SetListData<TYPE>(VarLengthListLikeArray<TYPE>* self,
|
| 127 |
+
const std::shared_ptr<ArrayData>& data,
|
| 128 |
+
Type::type expected_type_id);
|
| 129 |
+
|
| 130 |
+
const TypeClass* list_type_ = NULLPTR;
|
| 131 |
+
std::shared_ptr<Array> values_;
|
| 132 |
+
const offset_type* raw_value_offsets_ = NULLPTR;
|
| 133 |
+
};
|
| 134 |
+
|
| 135 |
+
// ----------------------------------------------------------------------
|
| 136 |
+
// ListArray / LargeListArray
|
| 137 |
+
|
| 138 |
+
template <typename TYPE>
|
| 139 |
+
class BaseListArray : public VarLengthListLikeArray<TYPE> {
|
| 140 |
+
public:
|
| 141 |
+
using TypeClass = TYPE;
|
| 142 |
+
using offset_type = typename TYPE::offset_type;
|
| 143 |
+
|
| 144 |
+
const TypeClass* list_type() const { return this->var_length_list_like_type(); }
|
| 145 |
+
|
| 146 |
+
/// \brief Return the size of the value at a particular index
|
| 147 |
+
///
|
| 148 |
+
/// Since non-empty null lists are possible, avoid calling this
|
| 149 |
+
/// function when the list at slot i is null.
|
| 150 |
+
///
|
| 151 |
+
/// \pre IsValid(i)
|
| 152 |
+
offset_type value_length(int64_t i) const final {
|
| 153 |
+
return this->raw_value_offsets_[i + 1] - this->raw_value_offsets_[i];
|
| 154 |
+
}
|
| 155 |
+
};
|
| 156 |
+
|
| 157 |
+
/// Concrete Array class for list data
|
| 158 |
+
class ARROW_EXPORT ListArray : public BaseListArray<ListType> {
|
| 159 |
+
public:
|
| 160 |
+
explicit ListArray(std::shared_ptr<ArrayData> data);
|
| 161 |
+
|
| 162 |
+
ListArray(std::shared_ptr<DataType> type, int64_t length,
|
| 163 |
+
std::shared_ptr<Buffer> value_offsets, std::shared_ptr<Array> values,
|
| 164 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 165 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 166 |
+
|
| 167 |
+
/// \brief Construct ListArray from array of offsets and child value array
|
| 168 |
+
///
|
| 169 |
+
/// This function does the bare minimum of validation of the offsets and
|
| 170 |
+
/// input types, and will allocate a new offsets array if necessary (i.e. if
|
| 171 |
+
/// the offsets contain any nulls). If the offsets do not have nulls, they
|
| 172 |
+
/// are assumed to be well-formed.
|
| 173 |
+
///
|
| 174 |
+
/// If a null_bitmap is not provided, the nulls will be inferred from the offsets'
|
| 175 |
+
/// null bitmap. But if a null_bitmap is provided, the offsets array can't have nulls.
|
| 176 |
+
///
|
| 177 |
+
/// And when a null_bitmap is provided, the offsets array cannot be a slice (i.e. an
|
| 178 |
+
/// array with offset() > 0).
|
| 179 |
+
///
|
| 180 |
+
/// \param[in] offsets Array containing n + 1 offsets encoding length and
|
| 181 |
+
/// size. Must be of int32 type
|
| 182 |
+
/// \param[in] values Array containing list values
|
| 183 |
+
/// \param[in] pool MemoryPool in case new offsets array needs to be
|
| 184 |
+
/// allocated because of null values
|
| 185 |
+
/// \param[in] null_bitmap Optional validity bitmap
|
| 186 |
+
/// \param[in] null_count Optional null count in null_bitmap
|
| 187 |
+
static Result<std::shared_ptr<ListArray>> FromArrays(
|
| 188 |
+
const Array& offsets, const Array& values, MemoryPool* pool = default_memory_pool(),
|
| 189 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 190 |
+
int64_t null_count = kUnknownNullCount);
|
| 191 |
+
|
| 192 |
+
static Result<std::shared_ptr<ListArray>> FromArrays(
|
| 193 |
+
std::shared_ptr<DataType> type, const Array& offsets, const Array& values,
|
| 194 |
+
MemoryPool* pool = default_memory_pool(),
|
| 195 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 196 |
+
int64_t null_count = kUnknownNullCount);
|
| 197 |
+
|
| 198 |
+
/// \brief Build a ListArray from a ListViewArray
|
| 199 |
+
static Result<std::shared_ptr<ListArray>> FromListView(const ListViewArray& source,
|
| 200 |
+
MemoryPool* pool);
|
| 201 |
+
|
| 202 |
+
/// \brief Return an Array that is a concatenation of the lists in this array.
|
| 203 |
+
///
|
| 204 |
+
/// Note that it's different from `values()` in that it takes into
|
| 205 |
+
/// consideration of this array's offsets as well as null elements backed
|
| 206 |
+
/// by non-empty lists (they are skipped, thus copying may be needed).
|
| 207 |
+
Result<std::shared_ptr<Array>> Flatten(
|
| 208 |
+
MemoryPool* memory_pool = default_memory_pool()) const;
|
| 209 |
+
|
| 210 |
+
/// \brief Return list offsets as an Int32Array
|
| 211 |
+
///
|
| 212 |
+
/// The returned array will not have a validity bitmap, so you cannot expect
|
| 213 |
+
/// to pass it to ListArray::FromArrays() and get back the same list array
|
| 214 |
+
/// if the original one has nulls.
|
| 215 |
+
std::shared_ptr<Array> offsets() const;
|
| 216 |
+
|
| 217 |
+
protected:
|
| 218 |
+
// This constructor defers SetData to a derived array class
|
| 219 |
+
ListArray() = default;
|
| 220 |
+
|
| 221 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 222 |
+
};
|
| 223 |
+
|
| 224 |
+
/// Concrete Array class for large list data (with 64-bit offsets)
|
| 225 |
+
class ARROW_EXPORT LargeListArray : public BaseListArray<LargeListType> {
|
| 226 |
+
public:
|
| 227 |
+
explicit LargeListArray(const std::shared_ptr<ArrayData>& data);
|
| 228 |
+
|
| 229 |
+
LargeListArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 230 |
+
const std::shared_ptr<Buffer>& value_offsets,
|
| 231 |
+
const std::shared_ptr<Array>& values,
|
| 232 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 233 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 234 |
+
|
| 235 |
+
/// \brief Construct LargeListArray from array of offsets and child value array
|
| 236 |
+
///
|
| 237 |
+
/// This function does the bare minimum of validation of the offsets and
|
| 238 |
+
/// input types, and will allocate a new offsets array if necessary (i.e. if
|
| 239 |
+
/// the offsets contain any nulls). If the offsets do not have nulls, they
|
| 240 |
+
/// are assumed to be well-formed.
|
| 241 |
+
///
|
| 242 |
+
/// If a null_bitmap is not provided, the nulls will be inferred from the offsets'
|
| 243 |
+
/// null bitmap. But if a null_bitmap is provided, the offsets array can't have nulls.
|
| 244 |
+
///
|
| 245 |
+
/// And when a null_bitmap is provided, the offsets array cannot be a slice (i.e. an
|
| 246 |
+
/// array with offset() > 0).
|
| 247 |
+
///
|
| 248 |
+
/// \param[in] offsets Array containing n + 1 offsets encoding length and
|
| 249 |
+
/// size. Must be of int64 type
|
| 250 |
+
/// \param[in] values Array containing list values
|
| 251 |
+
/// \param[in] pool MemoryPool in case new offsets array needs to be
|
| 252 |
+
/// allocated because of null values
|
| 253 |
+
/// \param[in] null_bitmap Optional validity bitmap
|
| 254 |
+
/// \param[in] null_count Optional null count in null_bitmap
|
| 255 |
+
static Result<std::shared_ptr<LargeListArray>> FromArrays(
|
| 256 |
+
const Array& offsets, const Array& values, MemoryPool* pool = default_memory_pool(),
|
| 257 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 258 |
+
int64_t null_count = kUnknownNullCount);
|
| 259 |
+
|
| 260 |
+
static Result<std::shared_ptr<LargeListArray>> FromArrays(
|
| 261 |
+
std::shared_ptr<DataType> type, const Array& offsets, const Array& values,
|
| 262 |
+
MemoryPool* pool = default_memory_pool(),
|
| 263 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 264 |
+
int64_t null_count = kUnknownNullCount);
|
| 265 |
+
|
| 266 |
+
/// \brief Build a LargeListArray from a LargeListViewArray
|
| 267 |
+
static Result<std::shared_ptr<LargeListArray>> FromListView(
|
| 268 |
+
const LargeListViewArray& source, MemoryPool* pool);
|
| 269 |
+
|
| 270 |
+
/// \brief Return an Array that is a concatenation of the lists in this array.
|
| 271 |
+
///
|
| 272 |
+
/// Note that it's different from `values()` in that it takes into
|
| 273 |
+
/// consideration of this array's offsets as well as null elements backed
|
| 274 |
+
/// by non-empty lists (they are skipped, thus copying may be needed).
|
| 275 |
+
Result<std::shared_ptr<Array>> Flatten(
|
| 276 |
+
MemoryPool* memory_pool = default_memory_pool()) const;
|
| 277 |
+
|
| 278 |
+
/// \brief Return list offsets as an Int64Array
|
| 279 |
+
std::shared_ptr<Array> offsets() const;
|
| 280 |
+
|
| 281 |
+
protected:
|
| 282 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 283 |
+
};
|
| 284 |
+
|
| 285 |
+
// ----------------------------------------------------------------------
|
| 286 |
+
// ListViewArray / LargeListViewArray
|
| 287 |
+
|
| 288 |
+
template <typename TYPE>
|
| 289 |
+
class BaseListViewArray : public VarLengthListLikeArray<TYPE> {
|
| 290 |
+
public:
|
| 291 |
+
using TypeClass = TYPE;
|
| 292 |
+
using offset_type = typename TYPE::offset_type;
|
| 293 |
+
|
| 294 |
+
const TypeClass* list_view_type() const { return this->var_length_list_like_type(); }
|
| 295 |
+
|
| 296 |
+
/// \brief Note that this buffer does not account for any slice offset or length.
|
| 297 |
+
const std::shared_ptr<Buffer>& value_sizes() const { return this->data_->buffers[2]; }
|
| 298 |
+
|
| 299 |
+
/// \brief Return pointer to raw value offsets accounting for any slice offset
|
| 300 |
+
const offset_type* raw_value_sizes() const { return raw_value_sizes_; }
|
| 301 |
+
|
| 302 |
+
/// \brief Return the size of the value at a particular index
|
| 303 |
+
///
|
| 304 |
+
/// This should not be called if the list-view at slot i is null.
|
| 305 |
+
/// The returned size in those cases could be any value from 0 to the
|
| 306 |
+
/// length of the child values array.
|
| 307 |
+
///
|
| 308 |
+
/// \pre IsValid(i)
|
| 309 |
+
offset_type value_length(int64_t i) const final { return this->raw_value_sizes_[i]; }
|
| 310 |
+
|
| 311 |
+
protected:
|
| 312 |
+
const offset_type* raw_value_sizes_ = NULLPTR;
|
| 313 |
+
};
|
| 314 |
+
|
| 315 |
+
/// \brief Concrete Array class for list-view data
|
| 316 |
+
class ARROW_EXPORT ListViewArray : public BaseListViewArray<ListViewType> {
|
| 317 |
+
public:
|
| 318 |
+
explicit ListViewArray(std::shared_ptr<ArrayData> data);
|
| 319 |
+
|
| 320 |
+
ListViewArray(std::shared_ptr<DataType> type, int64_t length,
|
| 321 |
+
std::shared_ptr<Buffer> value_offsets,
|
| 322 |
+
std::shared_ptr<Buffer> value_sizes, std::shared_ptr<Array> values,
|
| 323 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 324 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 325 |
+
|
| 326 |
+
/// \brief Construct ListViewArray from array of offsets, sizes, and child
|
| 327 |
+
/// value array
|
| 328 |
+
///
|
| 329 |
+
/// Construct a ListViewArray using buffers from offsets and sizes arrays
|
| 330 |
+
/// that project views into the child values array.
|
| 331 |
+
///
|
| 332 |
+
/// This function does the bare minimum of validation of the offsets/sizes and
|
| 333 |
+
/// input types. The offset and length of the offsets and sizes arrays must
|
| 334 |
+
/// match and that will be checked, but their contents will be assumed to be
|
| 335 |
+
/// well-formed.
|
| 336 |
+
///
|
| 337 |
+
/// If a null_bitmap is not provided, the nulls will be inferred from the
|
| 338 |
+
/// offsets's null bitmap. But if a null_bitmap is provided, the offsets array
|
| 339 |
+
/// can't have nulls.
|
| 340 |
+
///
|
| 341 |
+
/// And when a null_bitmap is provided, neither the offsets or sizes array can be a
|
| 342 |
+
/// slice (i.e. an array with offset() > 0).
|
| 343 |
+
///
|
| 344 |
+
/// \param[in] offsets An array of int32 offsets into the values array. NULL values are
|
| 345 |
+
/// supported if the corresponding values in sizes is NULL or 0.
|
| 346 |
+
/// \param[in] sizes An array containing the int32 sizes of every view. NULL values are
|
| 347 |
+
/// taken to represent a NULL list-view in the array being created.
|
| 348 |
+
/// \param[in] values Array containing list values
|
| 349 |
+
/// \param[in] pool MemoryPool
|
| 350 |
+
/// \param[in] null_bitmap Optional validity bitmap
|
| 351 |
+
/// \param[in] null_count Optional null count in null_bitmap
|
| 352 |
+
static Result<std::shared_ptr<ListViewArray>> FromArrays(
|
| 353 |
+
const Array& offsets, const Array& sizes, const Array& values,
|
| 354 |
+
MemoryPool* pool = default_memory_pool(),
|
| 355 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 356 |
+
int64_t null_count = kUnknownNullCount);
|
| 357 |
+
|
| 358 |
+
static Result<std::shared_ptr<ListViewArray>> FromArrays(
|
| 359 |
+
std::shared_ptr<DataType> type, const Array& offsets, const Array& sizes,
|
| 360 |
+
const Array& values, MemoryPool* pool = default_memory_pool(),
|
| 361 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 362 |
+
int64_t null_count = kUnknownNullCount);
|
| 363 |
+
|
| 364 |
+
/// \brief Build a ListViewArray from a ListArray
|
| 365 |
+
static Result<std::shared_ptr<ListViewArray>> FromList(const ListArray& list_array,
|
| 366 |
+
MemoryPool* pool);
|
| 367 |
+
|
| 368 |
+
/// \brief Return an Array that is a concatenation of the list-views in this array.
|
| 369 |
+
///
|
| 370 |
+
/// Note that it's different from `values()` in that it takes into
|
| 371 |
+
/// consideration this array's offsets (which can be in any order)
|
| 372 |
+
/// and sizes. Nulls are skipped.
|
| 373 |
+
///
|
| 374 |
+
/// This function invokes Concatenate() if list-views are non-contiguous. It
|
| 375 |
+
/// will try to minimize the number of array slices passed to Concatenate() by
|
| 376 |
+
/// maximizing the size of each slice (containing as many contiguous
|
| 377 |
+
/// list-views as possible).
|
| 378 |
+
Result<std::shared_ptr<Array>> Flatten(
|
| 379 |
+
MemoryPool* memory_pool = default_memory_pool()) const;
|
| 380 |
+
|
| 381 |
+
/// \brief Return list-view offsets as an Int32Array
|
| 382 |
+
///
|
| 383 |
+
/// The returned array will not have a validity bitmap, so you cannot expect
|
| 384 |
+
/// to pass it to ListArray::FromArrays() and get back the same list array
|
| 385 |
+
/// if the original one has nulls.
|
| 386 |
+
std::shared_ptr<Array> offsets() const;
|
| 387 |
+
|
| 388 |
+
/// \brief Return list-view sizes as an Int32Array
|
| 389 |
+
///
|
| 390 |
+
/// The returned array will not have a validity bitmap, so you cannot expect
|
| 391 |
+
/// to pass it to ListViewArray::FromArrays() and get back the same list
|
| 392 |
+
/// array if the original one has nulls.
|
| 393 |
+
std::shared_ptr<Array> sizes() const;
|
| 394 |
+
|
| 395 |
+
protected:
|
| 396 |
+
// This constructor defers SetData to a derived array class
|
| 397 |
+
ListViewArray() = default;
|
| 398 |
+
|
| 399 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 400 |
+
};
|
| 401 |
+
|
| 402 |
+
/// \brief Concrete Array class for large list-view data (with 64-bit offsets
|
| 403 |
+
/// and sizes)
|
| 404 |
+
class ARROW_EXPORT LargeListViewArray : public BaseListViewArray<LargeListViewType> {
|
| 405 |
+
public:
|
| 406 |
+
explicit LargeListViewArray(std::shared_ptr<ArrayData> data);
|
| 407 |
+
|
| 408 |
+
LargeListViewArray(std::shared_ptr<DataType> type, int64_t length,
|
| 409 |
+
std::shared_ptr<Buffer> value_offsets,
|
| 410 |
+
std::shared_ptr<Buffer> value_sizes, std::shared_ptr<Array> values,
|
| 411 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 412 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 413 |
+
|
| 414 |
+
/// \brief Construct LargeListViewArray from array of offsets, sizes, and child
|
| 415 |
+
/// value array
|
| 416 |
+
///
|
| 417 |
+
/// Construct an LargeListViewArray using buffers from offsets and sizes arrays
|
| 418 |
+
/// that project views into the values array.
|
| 419 |
+
///
|
| 420 |
+
/// This function does the bare minimum of validation of the offsets/sizes and
|
| 421 |
+
/// input types. The offset and length of the offsets and sizes arrays must
|
| 422 |
+
/// match and that will be checked, but their contents will be assumed to be
|
| 423 |
+
/// well-formed.
|
| 424 |
+
///
|
| 425 |
+
/// If a null_bitmap is not provided, the nulls will be inferred from the offsets' or
|
| 426 |
+
/// sizes' null bitmap. Only one of these two is allowed to have a null bitmap. But if a
|
| 427 |
+
/// null_bitmap is provided, the offsets array and the sizes array can't have nulls.
|
| 428 |
+
///
|
| 429 |
+
/// And when a null_bitmap is provided, neither the offsets or sizes array can be a
|
| 430 |
+
/// slice (i.e. an array with offset() > 0).
|
| 431 |
+
///
|
| 432 |
+
/// \param[in] offsets An array of int64 offsets into the values array. NULL values are
|
| 433 |
+
/// supported if the corresponding values in sizes is NULL or 0.
|
| 434 |
+
/// \param[in] sizes An array containing the int64 sizes of every view. NULL values are
|
| 435 |
+
/// taken to represent a NULL list-view in the array being created.
|
| 436 |
+
/// \param[in] values Array containing list values
|
| 437 |
+
/// \param[in] pool MemoryPool
|
| 438 |
+
/// \param[in] null_bitmap Optional validity bitmap
|
| 439 |
+
/// \param[in] null_count Optional null count in null_bitmap
|
| 440 |
+
static Result<std::shared_ptr<LargeListViewArray>> FromArrays(
|
| 441 |
+
const Array& offsets, const Array& sizes, const Array& values,
|
| 442 |
+
MemoryPool* pool = default_memory_pool(),
|
| 443 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 444 |
+
int64_t null_count = kUnknownNullCount);
|
| 445 |
+
|
| 446 |
+
static Result<std::shared_ptr<LargeListViewArray>> FromArrays(
|
| 447 |
+
std::shared_ptr<DataType> type, const Array& offsets, const Array& sizes,
|
| 448 |
+
const Array& values, MemoryPool* pool = default_memory_pool(),
|
| 449 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 450 |
+
int64_t null_count = kUnknownNullCount);
|
| 451 |
+
|
| 452 |
+
/// \brief Build a LargeListViewArray from a LargeListArray
|
| 453 |
+
static Result<std::shared_ptr<LargeListViewArray>> FromList(
|
| 454 |
+
const LargeListArray& list_array, MemoryPool* pool);
|
| 455 |
+
|
| 456 |
+
/// \brief Return an Array that is a concatenation of the large list-views in this
|
| 457 |
+
/// array.
|
| 458 |
+
///
|
| 459 |
+
/// Note that it's different from `values()` in that it takes into
|
| 460 |
+
/// consideration this array's offsets (which can be in any order)
|
| 461 |
+
/// and sizes. Nulls are skipped.
|
| 462 |
+
Result<std::shared_ptr<Array>> Flatten(
|
| 463 |
+
MemoryPool* memory_pool = default_memory_pool()) const;
|
| 464 |
+
|
| 465 |
+
/// \brief Return list-view offsets as an Int64Array
|
| 466 |
+
///
|
| 467 |
+
/// The returned array will not have a validity bitmap, so you cannot expect
|
| 468 |
+
/// to pass it to LargeListArray::FromArrays() and get back the same list array
|
| 469 |
+
/// if the original one has nulls.
|
| 470 |
+
std::shared_ptr<Array> offsets() const;
|
| 471 |
+
|
| 472 |
+
/// \brief Return list-view sizes as an Int64Array
|
| 473 |
+
///
|
| 474 |
+
/// The returned array will not have a validity bitmap, so you cannot expect
|
| 475 |
+
/// to pass it to LargeListViewArray::FromArrays() and get back the same list
|
| 476 |
+
/// array if the original one has nulls.
|
| 477 |
+
std::shared_ptr<Array> sizes() const;
|
| 478 |
+
|
| 479 |
+
protected:
|
| 480 |
+
// This constructor defers SetData to a derived array class
|
| 481 |
+
LargeListViewArray() = default;
|
| 482 |
+
|
| 483 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 484 |
+
};
|
| 485 |
+
|
| 486 |
+
// ----------------------------------------------------------------------
|
| 487 |
+
// MapArray
|
| 488 |
+
|
| 489 |
+
/// Concrete Array class for map data
|
| 490 |
+
///
|
| 491 |
+
/// NB: "value" in this context refers to a pair of a key and the corresponding item
|
| 492 |
+
class ARROW_EXPORT MapArray : public ListArray {
|
| 493 |
+
public:
|
| 494 |
+
using TypeClass = MapType;
|
| 495 |
+
|
| 496 |
+
explicit MapArray(const std::shared_ptr<ArrayData>& data);
|
| 497 |
+
|
| 498 |
+
MapArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 499 |
+
const std::shared_ptr<Buffer>& value_offsets,
|
| 500 |
+
const std::shared_ptr<Array>& keys, const std::shared_ptr<Array>& items,
|
| 501 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 502 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 503 |
+
|
| 504 |
+
MapArray(const std::shared_ptr<DataType>& type, int64_t length, BufferVector buffers,
|
| 505 |
+
const std::shared_ptr<Array>& keys, const std::shared_ptr<Array>& items,
|
| 506 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 507 |
+
|
| 508 |
+
MapArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 509 |
+
const std::shared_ptr<Buffer>& value_offsets,
|
| 510 |
+
const std::shared_ptr<Array>& values,
|
| 511 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 512 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 513 |
+
|
| 514 |
+
/// \brief Construct MapArray from array of offsets and child key, item arrays
|
| 515 |
+
///
|
| 516 |
+
/// This function does the bare minimum of validation of the offsets and
|
| 517 |
+
/// input types, and will allocate a new offsets array if necessary (i.e. if
|
| 518 |
+
/// the offsets contain any nulls). If the offsets do not have nulls, they
|
| 519 |
+
/// are assumed to be well-formed
|
| 520 |
+
///
|
| 521 |
+
/// \param[in] offsets Array containing n + 1 offsets encoding length and
|
| 522 |
+
/// size. Must be of int32 type
|
| 523 |
+
/// \param[in] keys Array containing key values
|
| 524 |
+
/// \param[in] items Array containing item values
|
| 525 |
+
/// \param[in] pool MemoryPool in case new offsets array needs to be
|
| 526 |
+
/// \param[in] null_bitmap Optional validity bitmap
|
| 527 |
+
/// allocated because of null values
|
| 528 |
+
static Result<std::shared_ptr<Array>> FromArrays(
|
| 529 |
+
const std::shared_ptr<Array>& offsets, const std::shared_ptr<Array>& keys,
|
| 530 |
+
const std::shared_ptr<Array>& items, MemoryPool* pool = default_memory_pool(),
|
| 531 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR);
|
| 532 |
+
|
| 533 |
+
static Result<std::shared_ptr<Array>> FromArrays(
|
| 534 |
+
std::shared_ptr<DataType> type, const std::shared_ptr<Array>& offsets,
|
| 535 |
+
const std::shared_ptr<Array>& keys, const std::shared_ptr<Array>& items,
|
| 536 |
+
MemoryPool* pool = default_memory_pool(),
|
| 537 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR);
|
| 538 |
+
|
| 539 |
+
const MapType* map_type() const { return map_type_; }
|
| 540 |
+
|
| 541 |
+
/// \brief Return array object containing all map keys
|
| 542 |
+
const std::shared_ptr<Array>& keys() const { return keys_; }
|
| 543 |
+
|
| 544 |
+
/// \brief Return array object containing all mapped items
|
| 545 |
+
const std::shared_ptr<Array>& items() const { return items_; }
|
| 546 |
+
|
| 547 |
+
/// Validate child data before constructing the actual MapArray.
|
| 548 |
+
static Status ValidateChildData(
|
| 549 |
+
const std::vector<std::shared_ptr<ArrayData>>& child_data);
|
| 550 |
+
|
| 551 |
+
protected:
|
| 552 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 553 |
+
|
| 554 |
+
static Result<std::shared_ptr<Array>> FromArraysInternal(
|
| 555 |
+
std::shared_ptr<DataType> type, const std::shared_ptr<Array>& offsets,
|
| 556 |
+
const std::shared_ptr<Array>& keys, const std::shared_ptr<Array>& items,
|
| 557 |
+
MemoryPool* pool, std::shared_ptr<Buffer> null_bitmap = NULLPTR);
|
| 558 |
+
|
| 559 |
+
private:
|
| 560 |
+
const MapType* map_type_;
|
| 561 |
+
std::shared_ptr<Array> keys_, items_;
|
| 562 |
+
};
|
| 563 |
+
|
| 564 |
+
// ----------------------------------------------------------------------
|
| 565 |
+
// FixedSizeListArray
|
| 566 |
+
|
| 567 |
+
/// Concrete Array class for fixed size list data
|
| 568 |
+
class ARROW_EXPORT FixedSizeListArray : public Array {
|
| 569 |
+
public:
|
| 570 |
+
using TypeClass = FixedSizeListType;
|
| 571 |
+
using offset_type = TypeClass::offset_type;
|
| 572 |
+
|
| 573 |
+
explicit FixedSizeListArray(const std::shared_ptr<ArrayData>& data);
|
| 574 |
+
|
| 575 |
+
FixedSizeListArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 576 |
+
const std::shared_ptr<Array>& values,
|
| 577 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 578 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 579 |
+
|
| 580 |
+
const FixedSizeListType* list_type() const;
|
| 581 |
+
|
| 582 |
+
/// \brief Return array object containing the list's values
|
| 583 |
+
const std::shared_ptr<Array>& values() const;
|
| 584 |
+
|
| 585 |
+
const std::shared_ptr<DataType>& value_type() const;
|
| 586 |
+
|
| 587 |
+
// The following functions will not perform boundschecking
|
| 588 |
+
int64_t value_offset(int64_t i) const {
|
| 589 |
+
i += data_->offset;
|
| 590 |
+
return list_size_ * i;
|
| 591 |
+
}
|
| 592 |
+
/// \brief Return the fixed-size of the values
|
| 593 |
+
///
|
| 594 |
+
/// No matter the value of the index parameter, the result is the same.
|
| 595 |
+
/// So even when the value at slot i is null, this function will return a
|
| 596 |
+
/// non-zero size.
|
| 597 |
+
///
|
| 598 |
+
/// \pre IsValid(i)
|
| 599 |
+
int32_t value_length(int64_t i = 0) const {
|
| 600 |
+
ARROW_UNUSED(i);
|
| 601 |
+
return list_size_;
|
| 602 |
+
}
|
| 603 |
+
/// \pre IsValid(i)
|
| 604 |
+
std::shared_ptr<Array> value_slice(int64_t i) const {
|
| 605 |
+
return values_->Slice(value_offset(i), value_length(i));
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
/// \brief Return an Array that is a concatenation of the lists in this array.
|
| 609 |
+
///
|
| 610 |
+
/// Note that it's different from `values()` in that it takes into
|
| 611 |
+
/// consideration null elements (they are skipped, thus copying may be needed).
|
| 612 |
+
Result<std::shared_ptr<Array>> Flatten(
|
| 613 |
+
MemoryPool* memory_pool = default_memory_pool()) const;
|
| 614 |
+
|
| 615 |
+
/// \brief Flatten all level recursively until reach a non-list type, and return
|
| 616 |
+
/// a non-list type Array.
|
| 617 |
+
///
|
| 618 |
+
/// \see internal::FlattenLogicalListRecursively
|
| 619 |
+
Result<std::shared_ptr<Array>> FlattenRecursively(
|
| 620 |
+
MemoryPool* memory_pool = default_memory_pool()) const {
|
| 621 |
+
return internal::FlattenLogicalListRecursively(*this, memory_pool);
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
/// \brief Construct FixedSizeListArray from child value array and value_length
|
| 625 |
+
///
|
| 626 |
+
/// \param[in] values Array containing list values
|
| 627 |
+
/// \param[in] list_size The fixed length of each list
|
| 628 |
+
/// \param[in] null_bitmap Optional validity bitmap
|
| 629 |
+
/// \param[in] null_count Optional null count in null_bitmap
|
| 630 |
+
/// \return Will have length equal to values.length() / list_size
|
| 631 |
+
static Result<std::shared_ptr<Array>> FromArrays(
|
| 632 |
+
const std::shared_ptr<Array>& values, int32_t list_size,
|
| 633 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 634 |
+
int64_t null_count = kUnknownNullCount);
|
| 635 |
+
|
| 636 |
+
/// \brief Construct FixedSizeListArray from child value array and type
|
| 637 |
+
///
|
| 638 |
+
/// \param[in] values Array containing list values
|
| 639 |
+
/// \param[in] type The fixed sized list type
|
| 640 |
+
/// \param[in] null_bitmap Optional validity bitmap
|
| 641 |
+
/// \param[in] null_count Optional null count in null_bitmap
|
| 642 |
+
/// \return Will have length equal to values.length() / type.list_size()
|
| 643 |
+
static Result<std::shared_ptr<Array>> FromArrays(
|
| 644 |
+
const std::shared_ptr<Array>& values, std::shared_ptr<DataType> type,
|
| 645 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 646 |
+
int64_t null_count = kUnknownNullCount);
|
| 647 |
+
|
| 648 |
+
protected:
|
| 649 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 650 |
+
int32_t list_size_;
|
| 651 |
+
|
| 652 |
+
private:
|
| 653 |
+
std::shared_ptr<Array> values_;
|
| 654 |
+
};
|
| 655 |
+
|
| 656 |
+
// ----------------------------------------------------------------------
|
| 657 |
+
// Struct
|
| 658 |
+
|
| 659 |
+
/// Concrete Array class for struct data
|
| 660 |
+
class ARROW_EXPORT StructArray : public Array {
|
| 661 |
+
public:
|
| 662 |
+
using TypeClass = StructType;
|
| 663 |
+
|
| 664 |
+
~StructArray() override;
|
| 665 |
+
|
| 666 |
+
explicit StructArray(const std::shared_ptr<ArrayData>& data);
|
| 667 |
+
|
| 668 |
+
StructArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 669 |
+
const std::vector<std::shared_ptr<Array>>& children,
|
| 670 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 671 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 672 |
+
|
| 673 |
+
/// \brief Return a StructArray from child arrays and field names.
|
| 674 |
+
///
|
| 675 |
+
/// The length and data type are automatically inferred from the arguments.
|
| 676 |
+
/// There should be at least one child array.
|
| 677 |
+
static Result<std::shared_ptr<StructArray>> Make(
|
| 678 |
+
const ArrayVector& children, const std::vector<std::string>& field_names,
|
| 679 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 680 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 681 |
+
|
| 682 |
+
/// \brief Return a StructArray from child arrays and fields.
|
| 683 |
+
///
|
| 684 |
+
/// The length is automatically inferred from the arguments.
|
| 685 |
+
/// There should be at least one child array. This method does not
|
| 686 |
+
/// check that field types and child array types are consistent.
|
| 687 |
+
static Result<std::shared_ptr<StructArray>> Make(
|
| 688 |
+
const ArrayVector& children, const FieldVector& fields,
|
| 689 |
+
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
|
| 690 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 691 |
+
|
| 692 |
+
const StructType* struct_type() const;
|
| 693 |
+
|
| 694 |
+
// Return a shared pointer in case the requestor desires to share ownership
|
| 695 |
+
// with this array. The returned array has its offset, length and null
|
| 696 |
+
// count adjusted.
|
| 697 |
+
std::shared_ptr<Array> field(int pos) const;
|
| 698 |
+
|
| 699 |
+
const ArrayVector& fields() const;
|
| 700 |
+
|
| 701 |
+
/// Returns null if name not found
|
| 702 |
+
std::shared_ptr<Array> GetFieldByName(const std::string& name) const;
|
| 703 |
+
|
| 704 |
+
/// Indicate if field named `name` can be found unambiguously in the struct.
|
| 705 |
+
Status CanReferenceFieldByName(const std::string& name) const;
|
| 706 |
+
|
| 707 |
+
/// Indicate if fields named `names` can be found unambiguously in the struct.
|
| 708 |
+
Status CanReferenceFieldsByNames(const std::vector<std::string>& names) const;
|
| 709 |
+
|
| 710 |
+
/// \brief Flatten this array as a vector of arrays, one for each field
|
| 711 |
+
///
|
| 712 |
+
/// \param[in] pool The pool to allocate null bitmaps from, if necessary
|
| 713 |
+
Result<ArrayVector> Flatten(MemoryPool* pool = default_memory_pool()) const;
|
| 714 |
+
|
| 715 |
+
/// \brief Get one of the child arrays, combining its null bitmap
|
| 716 |
+
/// with the parent struct array's bitmap.
|
| 717 |
+
///
|
| 718 |
+
/// \param[in] index Which child array to get
|
| 719 |
+
/// \param[in] pool The pool to allocate null bitmaps from, if necessary
|
| 720 |
+
Result<std::shared_ptr<Array>> GetFlattenedField(
|
| 721 |
+
int index, MemoryPool* pool = default_memory_pool()) const;
|
| 722 |
+
|
| 723 |
+
private:
|
| 724 |
+
// For caching boxed child data
|
| 725 |
+
struct ARROW_NO_EXPORT Impl;
|
| 726 |
+
std::unique_ptr<Impl> impl_;
|
| 727 |
+
};
|
| 728 |
+
|
| 729 |
+
// ----------------------------------------------------------------------
|
| 730 |
+
// Union
|
| 731 |
+
|
| 732 |
+
/// Base class for SparseUnionArray and DenseUnionArray
|
| 733 |
+
class ARROW_EXPORT UnionArray : public Array {
|
| 734 |
+
public:
|
| 735 |
+
using type_code_t = int8_t;
|
| 736 |
+
|
| 737 |
+
~UnionArray() override;
|
| 738 |
+
|
| 739 |
+
/// Note that this buffer does not account for any slice offset
|
| 740 |
+
const std::shared_ptr<Buffer>& type_codes() const { return data_->buffers[1]; }
|
| 741 |
+
|
| 742 |
+
const type_code_t* raw_type_codes() const { return raw_type_codes_; }
|
| 743 |
+
|
| 744 |
+
/// The logical type code of the value at index.
|
| 745 |
+
type_code_t type_code(int64_t i) const { return raw_type_codes_[i]; }
|
| 746 |
+
|
| 747 |
+
/// The physical child id containing value at index.
|
| 748 |
+
int child_id(int64_t i) const { return union_type_->child_ids()[raw_type_codes_[i]]; }
|
| 749 |
+
|
| 750 |
+
const UnionType* union_type() const { return union_type_; }
|
| 751 |
+
|
| 752 |
+
UnionMode::type mode() const { return union_type_->mode(); }
|
| 753 |
+
|
| 754 |
+
/// \brief Return the given field as an individual array.
|
| 755 |
+
///
|
| 756 |
+
/// For sparse unions, the returned array has its offset, length and null
|
| 757 |
+
/// count adjusted.
|
| 758 |
+
std::shared_ptr<Array> field(int pos) const;
|
| 759 |
+
|
| 760 |
+
protected:
|
| 761 |
+
UnionArray();
|
| 762 |
+
|
| 763 |
+
void SetData(std::shared_ptr<ArrayData> data);
|
| 764 |
+
|
| 765 |
+
const type_code_t* raw_type_codes_;
|
| 766 |
+
const UnionType* union_type_;
|
| 767 |
+
|
| 768 |
+
private:
|
| 769 |
+
// For caching boxed child data
|
| 770 |
+
struct ARROW_NO_EXPORT Impl;
|
| 771 |
+
std::unique_ptr<Impl> impl_;
|
| 772 |
+
};
|
| 773 |
+
|
| 774 |
+
/// Concrete Array class for sparse union data
|
| 775 |
+
class ARROW_EXPORT SparseUnionArray : public UnionArray {
|
| 776 |
+
public:
|
| 777 |
+
using TypeClass = SparseUnionType;
|
| 778 |
+
|
| 779 |
+
~SparseUnionArray() override;
|
| 780 |
+
|
| 781 |
+
explicit SparseUnionArray(std::shared_ptr<ArrayData> data);
|
| 782 |
+
|
| 783 |
+
SparseUnionArray(std::shared_ptr<DataType> type, int64_t length, ArrayVector children,
|
| 784 |
+
std::shared_ptr<Buffer> type_ids, int64_t offset = 0);
|
| 785 |
+
|
| 786 |
+
/// \brief Construct SparseUnionArray from type_ids and children
|
| 787 |
+
///
|
| 788 |
+
/// This function does the bare minimum of validation of the input types.
|
| 789 |
+
///
|
| 790 |
+
/// \param[in] type_ids An array of logical type ids for the union type
|
| 791 |
+
/// \param[in] children Vector of children Arrays containing the data for each type.
|
| 792 |
+
/// \param[in] type_codes Vector of type codes.
|
| 793 |
+
static Result<std::shared_ptr<Array>> Make(const Array& type_ids, ArrayVector children,
|
| 794 |
+
std::vector<type_code_t> type_codes) {
|
| 795 |
+
return Make(std::move(type_ids), std::move(children), std::vector<std::string>{},
|
| 796 |
+
std::move(type_codes));
|
| 797 |
+
}
|
| 798 |
+
|
| 799 |
+
/// \brief Construct SparseUnionArray with custom field names from type_ids and children
|
| 800 |
+
///
|
| 801 |
+
/// This function does the bare minimum of validation of the input types.
|
| 802 |
+
///
|
| 803 |
+
/// \param[in] type_ids An array of logical type ids for the union type
|
| 804 |
+
/// \param[in] children Vector of children Arrays containing the data for each type.
|
| 805 |
+
/// \param[in] field_names Vector of strings containing the name of each field.
|
| 806 |
+
/// \param[in] type_codes Vector of type codes.
|
| 807 |
+
static Result<std::shared_ptr<Array>> Make(const Array& type_ids, ArrayVector children,
|
| 808 |
+
std::vector<std::string> field_names = {},
|
| 809 |
+
std::vector<type_code_t> type_codes = {});
|
| 810 |
+
|
| 811 |
+
const SparseUnionType* union_type() const {
|
| 812 |
+
return internal::checked_cast<const SparseUnionType*>(union_type_);
|
| 813 |
+
}
|
| 814 |
+
|
| 815 |
+
/// \brief Get one of the child arrays, adjusting its null bitmap
|
| 816 |
+
/// where the union array type code does not match.
|
| 817 |
+
///
|
| 818 |
+
/// \param[in] index Which child array to get (i.e. the physical index, not the type
|
| 819 |
+
/// code) \param[in] pool The pool to allocate null bitmaps from, if necessary
|
| 820 |
+
Result<std::shared_ptr<Array>> GetFlattenedField(
|
| 821 |
+
int index, MemoryPool* pool = default_memory_pool()) const;
|
| 822 |
+
|
| 823 |
+
protected:
|
| 824 |
+
void SetData(std::shared_ptr<ArrayData> data);
|
| 825 |
+
};
|
| 826 |
+
|
| 827 |
+
/// \brief Concrete Array class for dense union data
|
| 828 |
+
///
|
| 829 |
+
/// Note that union types do not have a validity bitmap
|
| 830 |
+
class ARROW_EXPORT DenseUnionArray : public UnionArray {
|
| 831 |
+
public:
|
| 832 |
+
using TypeClass = DenseUnionType;
|
| 833 |
+
|
| 834 |
+
~DenseUnionArray() override;
|
| 835 |
+
|
| 836 |
+
explicit DenseUnionArray(const std::shared_ptr<ArrayData>& data);
|
| 837 |
+
|
| 838 |
+
DenseUnionArray(std::shared_ptr<DataType> type, int64_t length, ArrayVector children,
|
| 839 |
+
std::shared_ptr<Buffer> type_ids,
|
| 840 |
+
std::shared_ptr<Buffer> value_offsets = NULLPTR, int64_t offset = 0);
|
| 841 |
+
|
| 842 |
+
/// \brief Construct DenseUnionArray from type_ids, value_offsets, and children
|
| 843 |
+
///
|
| 844 |
+
/// This function does the bare minimum of validation of the offsets and
|
| 845 |
+
/// input types.
|
| 846 |
+
///
|
| 847 |
+
/// \param[in] type_ids An array of logical type ids for the union type
|
| 848 |
+
/// \param[in] value_offsets An array of signed int32 values indicating the
|
| 849 |
+
/// relative offset into the respective child array for the type in a given slot.
|
| 850 |
+
/// The respective offsets for each child value array must be in order / increasing.
|
| 851 |
+
/// \param[in] children Vector of children Arrays containing the data for each type.
|
| 852 |
+
/// \param[in] type_codes Vector of type codes.
|
| 853 |
+
static Result<std::shared_ptr<Array>> Make(const Array& type_ids,
|
| 854 |
+
const Array& value_offsets,
|
| 855 |
+
ArrayVector children,
|
| 856 |
+
std::vector<type_code_t> type_codes) {
|
| 857 |
+
return Make(type_ids, value_offsets, std::move(children), std::vector<std::string>{},
|
| 858 |
+
std::move(type_codes));
|
| 859 |
+
}
|
| 860 |
+
|
| 861 |
+
/// \brief Construct DenseUnionArray with custom field names from type_ids,
|
| 862 |
+
/// value_offsets, and children
|
| 863 |
+
///
|
| 864 |
+
/// This function does the bare minimum of validation of the offsets and
|
| 865 |
+
/// input types.
|
| 866 |
+
///
|
| 867 |
+
/// \param[in] type_ids An array of logical type ids for the union type
|
| 868 |
+
/// \param[in] value_offsets An array of signed int32 values indicating the
|
| 869 |
+
/// relative offset into the respective child array for the type in a given slot.
|
| 870 |
+
/// The respective offsets for each child value array must be in order / increasing.
|
| 871 |
+
/// \param[in] children Vector of children Arrays containing the data for each type.
|
| 872 |
+
/// \param[in] field_names Vector of strings containing the name of each field.
|
| 873 |
+
/// \param[in] type_codes Vector of type codes.
|
| 874 |
+
static Result<std::shared_ptr<Array>> Make(const Array& type_ids,
|
| 875 |
+
const Array& value_offsets,
|
| 876 |
+
ArrayVector children,
|
| 877 |
+
std::vector<std::string> field_names = {},
|
| 878 |
+
std::vector<type_code_t> type_codes = {});
|
| 879 |
+
|
| 880 |
+
const DenseUnionType* union_type() const {
|
| 881 |
+
return internal::checked_cast<const DenseUnionType*>(union_type_);
|
| 882 |
+
}
|
| 883 |
+
|
| 884 |
+
/// Note that this buffer does not account for any slice offset
|
| 885 |
+
const std::shared_ptr<Buffer>& value_offsets() const { return data_->buffers[2]; }
|
| 886 |
+
|
| 887 |
+
int32_t value_offset(int64_t i) const { return raw_value_offsets_[i]; }
|
| 888 |
+
|
| 889 |
+
const int32_t* raw_value_offsets() const { return raw_value_offsets_; }
|
| 890 |
+
|
| 891 |
+
protected:
|
| 892 |
+
const int32_t* raw_value_offsets_;
|
| 893 |
+
|
| 894 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 895 |
+
};
|
| 896 |
+
|
| 897 |
+
/// @}
|
| 898 |
+
|
| 899 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_primitive.h
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// Array accessor types for primitive/C-type-based arrays, such as numbers,
|
| 19 |
+
// boolean, and temporal types.
|
| 20 |
+
|
| 21 |
+
#pragma once
|
| 22 |
+
|
| 23 |
+
#include <cstdint>
|
| 24 |
+
#include <memory>
|
| 25 |
+
|
| 26 |
+
#include "arrow/array/array_base.h"
|
| 27 |
+
#include "arrow/array/data.h"
|
| 28 |
+
#include "arrow/stl_iterator.h"
|
| 29 |
+
#include "arrow/type.h"
|
| 30 |
+
#include "arrow/type_fwd.h" // IWYU pragma: export
|
| 31 |
+
#include "arrow/type_traits.h"
|
| 32 |
+
#include "arrow/util/bit_util.h"
|
| 33 |
+
#include "arrow/util/macros.h"
|
| 34 |
+
#include "arrow/util/visibility.h"
|
| 35 |
+
|
| 36 |
+
namespace arrow {
|
| 37 |
+
|
| 38 |
+
/// Concrete Array class for boolean data
|
| 39 |
+
class ARROW_EXPORT BooleanArray : public PrimitiveArray {
|
| 40 |
+
public:
|
| 41 |
+
using TypeClass = BooleanType;
|
| 42 |
+
using IteratorType = stl::ArrayIterator<BooleanArray>;
|
| 43 |
+
|
| 44 |
+
explicit BooleanArray(const std::shared_ptr<ArrayData>& data);
|
| 45 |
+
|
| 46 |
+
BooleanArray(int64_t length, const std::shared_ptr<Buffer>& data,
|
| 47 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 48 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 49 |
+
|
| 50 |
+
bool Value(int64_t i) const {
|
| 51 |
+
return bit_util::GetBit(reinterpret_cast<const uint8_t*>(raw_values_),
|
| 52 |
+
i + data_->offset);
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
bool GetView(int64_t i) const { return Value(i); }
|
| 56 |
+
|
| 57 |
+
std::optional<bool> operator[](int64_t i) const { return *IteratorType(*this, i); }
|
| 58 |
+
|
| 59 |
+
/// \brief Return the number of false (0) values among the valid
|
| 60 |
+
/// values. Result is not cached.
|
| 61 |
+
int64_t false_count() const;
|
| 62 |
+
|
| 63 |
+
/// \brief Return the number of true (1) values among the valid
|
| 64 |
+
/// values. Result is not cached.
|
| 65 |
+
int64_t true_count() const;
|
| 66 |
+
|
| 67 |
+
IteratorType begin() const { return IteratorType(*this); }
|
| 68 |
+
|
| 69 |
+
IteratorType end() const { return IteratorType(*this, length()); }
|
| 70 |
+
|
| 71 |
+
protected:
|
| 72 |
+
using PrimitiveArray::PrimitiveArray;
|
| 73 |
+
};
|
| 74 |
+
|
| 75 |
+
/// \addtogroup numeric-arrays
|
| 76 |
+
///
|
| 77 |
+
/// @{
|
| 78 |
+
|
| 79 |
+
/// \brief Concrete Array class for numeric data with a corresponding C type
|
| 80 |
+
///
|
| 81 |
+
/// This class is templated on the corresponding DataType subclass for the
|
| 82 |
+
/// given data, for example NumericArray<Int8Type> or NumericArray<Date32Type>.
|
| 83 |
+
///
|
| 84 |
+
/// Note that convenience aliases are available for all accepted types
|
| 85 |
+
/// (for example Int8Array for NumericArray<Int8Type>).
|
| 86 |
+
template <typename TYPE>
|
| 87 |
+
class NumericArray : public PrimitiveArray {
|
| 88 |
+
public:
|
| 89 |
+
using TypeClass = TYPE;
|
| 90 |
+
using value_type = typename TypeClass::c_type;
|
| 91 |
+
using IteratorType = stl::ArrayIterator<NumericArray<TYPE>>;
|
| 92 |
+
|
| 93 |
+
explicit NumericArray(const std::shared_ptr<ArrayData>& data) {
|
| 94 |
+
NumericArray::SetData(data);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
// Only enable this constructor without a type argument for types without additional
|
| 98 |
+
// metadata
|
| 99 |
+
template <typename T1 = TYPE>
|
| 100 |
+
NumericArray(enable_if_parameter_free<T1, int64_t> length,
|
| 101 |
+
const std::shared_ptr<Buffer>& data,
|
| 102 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 103 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0) {
|
| 104 |
+
NumericArray::SetData(ArrayData::Make(TypeTraits<T1>::type_singleton(), length,
|
| 105 |
+
{null_bitmap, data}, null_count, offset));
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
NumericArray(std::shared_ptr<DataType> type, int64_t length,
|
| 109 |
+
const std::shared_ptr<Buffer>& data,
|
| 110 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 111 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0) {
|
| 112 |
+
NumericArray::SetData(ArrayData::Make(std::move(type), length, {null_bitmap, data},
|
| 113 |
+
null_count, offset));
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
const value_type* raw_values() const { return values_; }
|
| 117 |
+
|
| 118 |
+
value_type Value(int64_t i) const { return values_[i]; }
|
| 119 |
+
|
| 120 |
+
// For API compatibility with BinaryArray etc.
|
| 121 |
+
value_type GetView(int64_t i) const { return values_[i]; }
|
| 122 |
+
|
| 123 |
+
std::optional<value_type> operator[](int64_t i) const {
|
| 124 |
+
return *IteratorType(*this, i);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
IteratorType begin() const { return IteratorType(*this); }
|
| 128 |
+
|
| 129 |
+
IteratorType end() const { return IteratorType(*this, length()); }
|
| 130 |
+
|
| 131 |
+
protected:
|
| 132 |
+
NumericArray() : values_(NULLPTR) {}
|
| 133 |
+
|
| 134 |
+
void SetData(const std::shared_ptr<ArrayData>& data) {
|
| 135 |
+
this->PrimitiveArray::SetData(data);
|
| 136 |
+
values_ = raw_values_
|
| 137 |
+
? (reinterpret_cast<const value_type*>(raw_values_) + data_->offset)
|
| 138 |
+
: NULLPTR;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
const value_type* values_;
|
| 142 |
+
};
|
| 143 |
+
|
| 144 |
+
/// DayTimeArray
|
| 145 |
+
/// ---------------------
|
| 146 |
+
/// \brief Array of Day and Millisecond values.
|
| 147 |
+
class ARROW_EXPORT DayTimeIntervalArray : public PrimitiveArray {
|
| 148 |
+
public:
|
| 149 |
+
using TypeClass = DayTimeIntervalType;
|
| 150 |
+
using IteratorType = stl::ArrayIterator<DayTimeIntervalArray>;
|
| 151 |
+
|
| 152 |
+
explicit DayTimeIntervalArray(const std::shared_ptr<ArrayData>& data);
|
| 153 |
+
|
| 154 |
+
DayTimeIntervalArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 155 |
+
const std::shared_ptr<Buffer>& data,
|
| 156 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 157 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 158 |
+
|
| 159 |
+
DayTimeIntervalArray(int64_t length, const std::shared_ptr<Buffer>& data,
|
| 160 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 161 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 162 |
+
|
| 163 |
+
TypeClass::DayMilliseconds GetValue(int64_t i) const;
|
| 164 |
+
TypeClass::DayMilliseconds Value(int64_t i) const { return GetValue(i); }
|
| 165 |
+
|
| 166 |
+
// For compatibility with Take kernel.
|
| 167 |
+
TypeClass::DayMilliseconds GetView(int64_t i) const { return GetValue(i); }
|
| 168 |
+
|
| 169 |
+
IteratorType begin() const { return IteratorType(*this); }
|
| 170 |
+
|
| 171 |
+
IteratorType end() const { return IteratorType(*this, length()); }
|
| 172 |
+
|
| 173 |
+
std::optional<TypeClass::DayMilliseconds> operator[](int64_t i) const {
|
| 174 |
+
return *IteratorType(*this, i);
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
int32_t byte_width() const { return sizeof(TypeClass::DayMilliseconds); }
|
| 178 |
+
|
| 179 |
+
const uint8_t* raw_values() const { return raw_values_ + data_->offset * byte_width(); }
|
| 180 |
+
};
|
| 181 |
+
|
| 182 |
+
/// \brief Array of Month, Day and nanosecond values.
|
| 183 |
+
class ARROW_EXPORT MonthDayNanoIntervalArray : public PrimitiveArray {
|
| 184 |
+
public:
|
| 185 |
+
using TypeClass = MonthDayNanoIntervalType;
|
| 186 |
+
using IteratorType = stl::ArrayIterator<MonthDayNanoIntervalArray>;
|
| 187 |
+
|
| 188 |
+
explicit MonthDayNanoIntervalArray(const std::shared_ptr<ArrayData>& data);
|
| 189 |
+
|
| 190 |
+
MonthDayNanoIntervalArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 191 |
+
const std::shared_ptr<Buffer>& data,
|
| 192 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 193 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 194 |
+
|
| 195 |
+
MonthDayNanoIntervalArray(int64_t length, const std::shared_ptr<Buffer>& data,
|
| 196 |
+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
|
| 197 |
+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
|
| 198 |
+
|
| 199 |
+
TypeClass::MonthDayNanos GetValue(int64_t i) const;
|
| 200 |
+
TypeClass::MonthDayNanos Value(int64_t i) const { return GetValue(i); }
|
| 201 |
+
|
| 202 |
+
// For compatibility with Take kernel.
|
| 203 |
+
TypeClass::MonthDayNanos GetView(int64_t i) const { return GetValue(i); }
|
| 204 |
+
|
| 205 |
+
IteratorType begin() const { return IteratorType(*this); }
|
| 206 |
+
|
| 207 |
+
IteratorType end() const { return IteratorType(*this, length()); }
|
| 208 |
+
|
| 209 |
+
std::optional<TypeClass::MonthDayNanos> operator[](int64_t i) const {
|
| 210 |
+
return *IteratorType(*this, i);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
int32_t byte_width() const { return sizeof(TypeClass::MonthDayNanos); }
|
| 214 |
+
|
| 215 |
+
const uint8_t* raw_values() const { return raw_values_ + data_->offset * byte_width(); }
|
| 216 |
+
};
|
| 217 |
+
|
| 218 |
+
/// @}
|
| 219 |
+
|
| 220 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/array_run_end.h
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
// Array accessor classes run-end encoded arrays
|
| 19 |
+
|
| 20 |
+
#pragma once
|
| 21 |
+
|
| 22 |
+
#include <cstdint>
|
| 23 |
+
#include <memory>
|
| 24 |
+
#include <string>
|
| 25 |
+
#include <utility>
|
| 26 |
+
#include <vector>
|
| 27 |
+
|
| 28 |
+
#include "arrow/array/array_base.h"
|
| 29 |
+
#include "arrow/array/data.h"
|
| 30 |
+
#include "arrow/result.h"
|
| 31 |
+
#include "arrow/status.h"
|
| 32 |
+
#include "arrow/type.h"
|
| 33 |
+
#include "arrow/type_fwd.h"
|
| 34 |
+
#include "arrow/util/checked_cast.h"
|
| 35 |
+
#include "arrow/util/macros.h"
|
| 36 |
+
#include "arrow/util/visibility.h"
|
| 37 |
+
|
| 38 |
+
namespace arrow {
|
| 39 |
+
|
| 40 |
+
/// \addtogroup run-end-encoded-arrays
|
| 41 |
+
///
|
| 42 |
+
/// @{
|
| 43 |
+
|
| 44 |
+
// ----------------------------------------------------------------------
|
| 45 |
+
// RunEndEncoded
|
| 46 |
+
|
| 47 |
+
/// \brief Array type for run-end encoded data
|
| 48 |
+
class ARROW_EXPORT RunEndEncodedArray : public Array {
|
| 49 |
+
private:
|
| 50 |
+
std::shared_ptr<Array> run_ends_array_;
|
| 51 |
+
std::shared_ptr<Array> values_array_;
|
| 52 |
+
|
| 53 |
+
public:
|
| 54 |
+
using TypeClass = RunEndEncodedType;
|
| 55 |
+
|
| 56 |
+
explicit RunEndEncodedArray(const std::shared_ptr<ArrayData>& data);
|
| 57 |
+
|
| 58 |
+
/// \brief Construct a RunEndEncodedArray from all parameters
|
| 59 |
+
///
|
| 60 |
+
/// The length and offset parameters refer to the dimensions of the logical
|
| 61 |
+
/// array which is the array we would get after expanding all the runs into
|
| 62 |
+
/// repeated values. As such, length can be much greater than the length of
|
| 63 |
+
/// the child run_ends and values arrays.
|
| 64 |
+
RunEndEncodedArray(const std::shared_ptr<DataType>& type, int64_t length,
|
| 65 |
+
const std::shared_ptr<Array>& run_ends,
|
| 66 |
+
const std::shared_ptr<Array>& values, int64_t offset = 0);
|
| 67 |
+
|
| 68 |
+
/// \brief Construct a RunEndEncodedArray from all parameters
|
| 69 |
+
///
|
| 70 |
+
/// The length and offset parameters refer to the dimensions of the logical
|
| 71 |
+
/// array which is the array we would get after expanding all the runs into
|
| 72 |
+
/// repeated values. As such, length can be much greater than the length of
|
| 73 |
+
/// the child run_ends and values arrays.
|
| 74 |
+
static Result<std::shared_ptr<RunEndEncodedArray>> Make(
|
| 75 |
+
const std::shared_ptr<DataType>& type, int64_t logical_length,
|
| 76 |
+
const std::shared_ptr<Array>& run_ends, const std::shared_ptr<Array>& values,
|
| 77 |
+
int64_t logical_offset = 0);
|
| 78 |
+
|
| 79 |
+
/// \brief Construct a RunEndEncodedArray from values and run ends arrays
|
| 80 |
+
///
|
| 81 |
+
/// The data type is automatically inferred from the arguments.
|
| 82 |
+
/// The run_ends and values arrays must have the same length.
|
| 83 |
+
static Result<std::shared_ptr<RunEndEncodedArray>> Make(
|
| 84 |
+
int64_t logical_length, const std::shared_ptr<Array>& run_ends,
|
| 85 |
+
const std::shared_ptr<Array>& values, int64_t logical_offset = 0);
|
| 86 |
+
|
| 87 |
+
protected:
|
| 88 |
+
void SetData(const std::shared_ptr<ArrayData>& data);
|
| 89 |
+
|
| 90 |
+
public:
|
| 91 |
+
/// \brief Returns an array holding the logical indexes of each run-end
|
| 92 |
+
///
|
| 93 |
+
/// The physical offset to the array is applied.
|
| 94 |
+
const std::shared_ptr<Array>& run_ends() const { return run_ends_array_; }
|
| 95 |
+
|
| 96 |
+
/// \brief Returns an array holding the values of each run
|
| 97 |
+
///
|
| 98 |
+
/// The physical offset to the array is applied.
|
| 99 |
+
const std::shared_ptr<Array>& values() const { return values_array_; }
|
| 100 |
+
|
| 101 |
+
/// \brief Returns an array holding the logical indexes of each run end
|
| 102 |
+
///
|
| 103 |
+
/// If a non-zero logical offset is set, this function allocates a new
|
| 104 |
+
/// array and rewrites all the run end values to be relative to the logical
|
| 105 |
+
/// offset and cuts the end of the array to the logical length.
|
| 106 |
+
Result<std::shared_ptr<Array>> LogicalRunEnds(MemoryPool* pool) const;
|
| 107 |
+
|
| 108 |
+
/// \brief Returns an array holding the values of each run
|
| 109 |
+
///
|
| 110 |
+
/// If a non-zero logical offset is set, this function allocates a new
|
| 111 |
+
/// array containing only the values within the logical range.
|
| 112 |
+
std::shared_ptr<Array> LogicalValues() const;
|
| 113 |
+
|
| 114 |
+
/// \brief Find the physical offset of this REE array
|
| 115 |
+
///
|
| 116 |
+
/// This function uses binary-search, so it has a O(log N) cost.
|
| 117 |
+
int64_t FindPhysicalOffset() const;
|
| 118 |
+
|
| 119 |
+
/// \brief Find the physical length of this REE array
|
| 120 |
+
///
|
| 121 |
+
/// The physical length of an REE is the number of physical values (and
|
| 122 |
+
/// run-ends) necessary to represent the logical range of values from offset
|
| 123 |
+
/// to length.
|
| 124 |
+
///
|
| 125 |
+
/// Avoid calling this function if the physical length can be established in
|
| 126 |
+
/// some other way (e.g. when iterating over the runs sequentially until the
|
| 127 |
+
/// end). This function uses binary-search, so it has a O(log N) cost.
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <cstring>
|
| 22 |
+
#include <memory>
|
| 23 |
+
#include <type_traits>
|
| 24 |
+
|
| 25 |
+
#include "arrow/array/builder_base.h"
|
| 26 |
+
#include "arrow/buffer.h"
|
| 27 |
+
#include "arrow/status.h"
|
| 28 |
+
#include "arrow/type.h"
|
| 29 |
+
#include "arrow/util/macros.h"
|
| 30 |
+
#include "arrow/util/visibility.h"
|
| 31 |
+
|
| 32 |
+
namespace arrow {
|
| 33 |
+
|
| 34 |
+
/// \addtogroup numeric-builders
|
| 35 |
+
///
|
| 36 |
+
/// @{
|
| 37 |
+
|
| 38 |
+
namespace internal {
|
| 39 |
+
|
| 40 |
+
class ARROW_EXPORT AdaptiveIntBuilderBase : public ArrayBuilder {
|
| 41 |
+
public:
|
| 42 |
+
AdaptiveIntBuilderBase(uint8_t start_int_size, MemoryPool* pool,
|
| 43 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 44 |
+
|
| 45 |
+
explicit AdaptiveIntBuilderBase(MemoryPool* pool,
|
| 46 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 47 |
+
: AdaptiveIntBuilderBase(sizeof(uint8_t), pool, alignment) {}
|
| 48 |
+
|
| 49 |
+
/// \brief Append multiple nulls
|
| 50 |
+
/// \param[in] length the number of nulls to append
|
| 51 |
+
Status AppendNulls(int64_t length) final {
|
| 52 |
+
ARROW_RETURN_NOT_OK(CommitPendingData());
|
| 53 |
+
if (ARROW_PREDICT_TRUE(length > 0)) {
|
| 54 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 55 |
+
memset(data_->mutable_data() + length_ * int_size_, 0, int_size_ * length);
|
| 56 |
+
UnsafeSetNull(length);
|
| 57 |
+
}
|
| 58 |
+
return Status::OK();
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
Status AppendNull() final {
|
| 62 |
+
pending_data_[pending_pos_] = 0;
|
| 63 |
+
pending_valid_[pending_pos_] = 0;
|
| 64 |
+
pending_has_nulls_ = true;
|
| 65 |
+
++pending_pos_;
|
| 66 |
+
++length_;
|
| 67 |
+
++null_count_;
|
| 68 |
+
|
| 69 |
+
if (ARROW_PREDICT_FALSE(pending_pos_ >= pending_size_)) {
|
| 70 |
+
return CommitPendingData();
|
| 71 |
+
}
|
| 72 |
+
return Status::OK();
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 76 |
+
ARROW_RETURN_NOT_OK(CommitPendingData());
|
| 77 |
+
if (ARROW_PREDICT_TRUE(length > 0)) {
|
| 78 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 79 |
+
memset(data_->mutable_data() + length_ * int_size_, 0, int_size_ * length);
|
| 80 |
+
UnsafeSetNotNull(length);
|
| 81 |
+
}
|
| 82 |
+
return Status::OK();
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
Status AppendEmptyValue() final {
|
| 86 |
+
pending_data_[pending_pos_] = 0;
|
| 87 |
+
pending_valid_[pending_pos_] = 1;
|
| 88 |
+
++pending_pos_;
|
| 89 |
+
++length_;
|
| 90 |
+
|
| 91 |
+
if (ARROW_PREDICT_FALSE(pending_pos_ >= pending_size_)) {
|
| 92 |
+
return CommitPendingData();
|
| 93 |
+
}
|
| 94 |
+
return Status::OK();
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
void Reset() override;
|
| 98 |
+
Status Resize(int64_t capacity) override;
|
| 99 |
+
|
| 100 |
+
protected:
|
| 101 |
+
Status AppendInternal(const uint64_t val) {
|
| 102 |
+
pending_data_[pending_pos_] = val;
|
| 103 |
+
pending_valid_[pending_pos_] = 1;
|
| 104 |
+
++pending_pos_;
|
| 105 |
+
++length_;
|
| 106 |
+
|
| 107 |
+
if (ARROW_PREDICT_FALSE(pending_pos_ >= pending_size_)) {
|
| 108 |
+
return CommitPendingData();
|
| 109 |
+
}
|
| 110 |
+
return Status::OK();
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
virtual Status CommitPendingData() = 0;
|
| 114 |
+
|
| 115 |
+
template <typename new_type, typename old_type>
|
| 116 |
+
typename std::enable_if<sizeof(old_type) >= sizeof(new_type), Status>::type
|
| 117 |
+
ExpandIntSizeInternal();
|
| 118 |
+
template <typename new_type, typename old_type>
|
| 119 |
+
typename std::enable_if<(sizeof(old_type) < sizeof(new_type)), Status>::type
|
| 120 |
+
ExpandIntSizeInternal();
|
| 121 |
+
|
| 122 |
+
std::shared_ptr<ResizableBuffer> data_;
|
| 123 |
+
uint8_t* raw_data_ = NULLPTR;
|
| 124 |
+
|
| 125 |
+
const uint8_t start_int_size_;
|
| 126 |
+
uint8_t int_size_;
|
| 127 |
+
|
| 128 |
+
static constexpr int32_t pending_size_ = 1024;
|
| 129 |
+
uint8_t pending_valid_[pending_size_];
|
| 130 |
+
uint64_t pending_data_[pending_size_];
|
| 131 |
+
int32_t pending_pos_ = 0;
|
| 132 |
+
bool pending_has_nulls_ = false;
|
| 133 |
+
};
|
| 134 |
+
|
| 135 |
+
} // namespace internal
|
| 136 |
+
|
| 137 |
+
class ARROW_EXPORT AdaptiveUIntBuilder : public internal::AdaptiveIntBuilderBase {
|
| 138 |
+
public:
|
| 139 |
+
explicit AdaptiveUIntBuilder(uint8_t start_int_size,
|
| 140 |
+
MemoryPool* pool = default_memory_pool());
|
| 141 |
+
|
| 142 |
+
explicit AdaptiveUIntBuilder(MemoryPool* pool = default_memory_pool())
|
| 143 |
+
: AdaptiveUIntBuilder(sizeof(uint8_t), pool) {}
|
| 144 |
+
|
| 145 |
+
using internal::AdaptiveIntBuilderBase::Reset;
|
| 146 |
+
|
| 147 |
+
/// Scalar append
|
| 148 |
+
Status Append(const uint64_t val) { return AppendInternal(val); }
|
| 149 |
+
|
| 150 |
+
/// \brief Append a sequence of elements in one shot
|
| 151 |
+
/// \param[in] values a contiguous C array of values
|
| 152 |
+
/// \param[in] length the number of values to append
|
| 153 |
+
/// \param[in] valid_bytes an optional sequence of bytes where non-zero
|
| 154 |
+
/// indicates a valid (non-null) value
|
| 155 |
+
/// \return Status
|
| 156 |
+
Status AppendValues(const uint64_t* values, int64_t length,
|
| 157 |
+
const uint8_t* valid_bytes = NULLPTR);
|
| 158 |
+
|
| 159 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 160 |
+
|
| 161 |
+
std::shared_ptr<DataType> type() const override;
|
| 162 |
+
|
| 163 |
+
protected:
|
| 164 |
+
Status CommitPendingData() override;
|
| 165 |
+
Status ExpandIntSize(uint8_t new_int_size);
|
| 166 |
+
|
| 167 |
+
Status AppendValuesInternal(const uint64_t* values, int64_t length,
|
| 168 |
+
const uint8_t* valid_bytes);
|
| 169 |
+
|
| 170 |
+
template <typename new_type>
|
| 171 |
+
Status ExpandIntSizeN();
|
| 172 |
+
};
|
| 173 |
+
|
| 174 |
+
class ARROW_EXPORT AdaptiveIntBuilder : public internal::AdaptiveIntBuilderBase {
|
| 175 |
+
public:
|
| 176 |
+
explicit AdaptiveIntBuilder(uint8_t start_int_size,
|
| 177 |
+
MemoryPool* pool = default_memory_pool(),
|
| 178 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 179 |
+
|
| 180 |
+
explicit AdaptiveIntBuilder(MemoryPool* pool = default_memory_pool(),
|
| 181 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 182 |
+
: AdaptiveIntBuilder(sizeof(uint8_t), pool, alignment) {}
|
| 183 |
+
|
| 184 |
+
using internal::AdaptiveIntBuilderBase::Reset;
|
| 185 |
+
|
| 186 |
+
/// Scalar append
|
| 187 |
+
Status Append(const int64_t val) { return AppendInternal(static_cast<uint64_t>(val)); }
|
| 188 |
+
|
| 189 |
+
/// \brief Append a sequence of elements in one shot
|
| 190 |
+
/// \param[in] values a contiguous C array of values
|
| 191 |
+
/// \param[in] length the number of values to append
|
| 192 |
+
/// \param[in] valid_bytes an optional sequence of bytes where non-zero
|
| 193 |
+
/// indicates a valid (non-null) value
|
| 194 |
+
/// \return Status
|
| 195 |
+
Status AppendValues(const int64_t* values, int64_t length,
|
| 196 |
+
const uint8_t* valid_bytes = NULLPTR);
|
| 197 |
+
|
| 198 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 199 |
+
|
| 200 |
+
std::shared_ptr<DataType> type() const override;
|
| 201 |
+
|
| 202 |
+
protected:
|
| 203 |
+
Status CommitPendingData() override;
|
| 204 |
+
Status ExpandIntSize(uint8_t new_int_size);
|
| 205 |
+
|
| 206 |
+
Status AppendValuesInternal(const int64_t* values, int64_t length,
|
| 207 |
+
const uint8_t* valid_bytes);
|
| 208 |
+
|
| 209 |
+
template <typename new_type>
|
| 210 |
+
Status ExpandIntSizeN();
|
| 211 |
+
};
|
| 212 |
+
|
| 213 |
+
/// @}
|
| 214 |
+
|
| 215 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_base.h
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <algorithm> // IWYU pragma: keep
|
| 21 |
+
#include <cstdint>
|
| 22 |
+
#include <limits>
|
| 23 |
+
#include <memory>
|
| 24 |
+
#include <utility>
|
| 25 |
+
#include <vector>
|
| 26 |
+
|
| 27 |
+
#include "arrow/array/array_base.h"
|
| 28 |
+
#include "arrow/array/array_primitive.h"
|
| 29 |
+
#include "arrow/buffer.h"
|
| 30 |
+
#include "arrow/buffer_builder.h"
|
| 31 |
+
#include "arrow/result.h"
|
| 32 |
+
#include "arrow/status.h"
|
| 33 |
+
#include "arrow/type_fwd.h"
|
| 34 |
+
#include "arrow/util/macros.h"
|
| 35 |
+
#include "arrow/util/visibility.h"
|
| 36 |
+
|
| 37 |
+
namespace arrow {
|
| 38 |
+
|
| 39 |
+
namespace internal {
|
| 40 |
+
|
| 41 |
+
template <class Builder, class V>
|
| 42 |
+
class ArrayBuilderExtraOps {
|
| 43 |
+
public:
|
| 44 |
+
/// \brief Append a value from an optional or null if it has no value.
|
| 45 |
+
Status AppendOrNull(const std::optional<V>& value) {
|
| 46 |
+
auto* self = static_cast<Builder*>(this);
|
| 47 |
+
return value.has_value() ? self->Append(*value) : self->AppendNull();
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/// \brief Append a value from an optional or null if it has no value.
|
| 51 |
+
///
|
| 52 |
+
/// Unsafe methods don't check existing size.
|
| 53 |
+
void UnsafeAppendOrNull(const std::optional<V>& value) {
|
| 54 |
+
auto* self = static_cast<Builder*>(this);
|
| 55 |
+
return value.has_value() ? self->UnsafeAppend(*value) : self->UnsafeAppendNull();
|
| 56 |
+
}
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
} // namespace internal
|
| 60 |
+
|
| 61 |
+
/// \defgroup numeric-builders Concrete builder subclasses for numeric types
|
| 62 |
+
/// @{
|
| 63 |
+
/// @}
|
| 64 |
+
|
| 65 |
+
/// \defgroup temporal-builders Concrete builder subclasses for temporal types
|
| 66 |
+
/// @{
|
| 67 |
+
/// @}
|
| 68 |
+
|
| 69 |
+
/// \defgroup binary-builders Concrete builder subclasses for binary types
|
| 70 |
+
/// @{
|
| 71 |
+
/// @}
|
| 72 |
+
|
| 73 |
+
/// \defgroup nested-builders Concrete builder subclasses for nested types
|
| 74 |
+
/// @{
|
| 75 |
+
/// @}
|
| 76 |
+
|
| 77 |
+
/// \defgroup dictionary-builders Concrete builder subclasses for dictionary types
|
| 78 |
+
/// @{
|
| 79 |
+
/// @}
|
| 80 |
+
|
| 81 |
+
/// \defgroup run-end-encoded-builders Concrete builder subclasses for run-end encoded
|
| 82 |
+
/// arrays
|
| 83 |
+
/// @{
|
| 84 |
+
/// @}
|
| 85 |
+
|
| 86 |
+
constexpr int64_t kMinBuilderCapacity = 1 << 5;
|
| 87 |
+
constexpr int64_t kListMaximumElements = std::numeric_limits<int32_t>::max() - 1;
|
| 88 |
+
|
| 89 |
+
/// Base class for all data array builders.
|
| 90 |
+
///
|
| 91 |
+
/// This class provides a facilities for incrementally building the null bitmap
|
| 92 |
+
/// (see Append methods) and as a side effect the current number of slots and
|
| 93 |
+
/// the null count.
|
| 94 |
+
///
|
| 95 |
+
/// \note Users are expected to use builders as one of the concrete types below.
|
| 96 |
+
/// For example, ArrayBuilder* pointing to BinaryBuilder should be downcast before use.
|
| 97 |
+
class ARROW_EXPORT ArrayBuilder {
|
| 98 |
+
public:
|
| 99 |
+
explicit ArrayBuilder(MemoryPool* pool, int64_t alignment = kDefaultBufferAlignment)
|
| 100 |
+
: pool_(pool), alignment_(alignment), null_bitmap_builder_(pool, alignment) {}
|
| 101 |
+
|
| 102 |
+
ARROW_DEFAULT_MOVE_AND_ASSIGN(ArrayBuilder);
|
| 103 |
+
|
| 104 |
+
virtual ~ArrayBuilder() = default;
|
| 105 |
+
|
| 106 |
+
/// For nested types. Since the objects are owned by this class instance, we
|
| 107 |
+
/// skip shared pointers and just return a raw pointer
|
| 108 |
+
ArrayBuilder* child(int i) { return children_[i].get(); }
|
| 109 |
+
|
| 110 |
+
const std::shared_ptr<ArrayBuilder>& child_builder(int i) const { return children_[i]; }
|
| 111 |
+
|
| 112 |
+
int num_children() const { return static_cast<int>(children_.size()); }
|
| 113 |
+
|
| 114 |
+
virtual int64_t length() const { return length_; }
|
| 115 |
+
int64_t null_count() const { return null_count_; }
|
| 116 |
+
int64_t capacity() const { return capacity_; }
|
| 117 |
+
|
| 118 |
+
/// \brief Ensure that enough memory has been allocated to fit the indicated
|
| 119 |
+
/// number of total elements in the builder, including any that have already
|
| 120 |
+
/// been appended. Does not account for reallocations that may be due to
|
| 121 |
+
/// variable size data, like binary values. To make space for incremental
|
| 122 |
+
/// appends, use Reserve instead.
|
| 123 |
+
///
|
| 124 |
+
/// \param[in] capacity the minimum number of total array values to
|
| 125 |
+
/// accommodate. Must be greater than the current capacity.
|
| 126 |
+
/// \return Status
|
| 127 |
+
virtual Status Resize(int64_t capacity);
|
| 128 |
+
|
| 129 |
+
/// \brief Ensure that there is enough space allocated to append the indicated
|
| 130 |
+
/// number of elements without any further reallocation. Overallocation is
|
| 131 |
+
/// used in order to minimize the impact of incremental Reserve() calls.
|
| 132 |
+
/// Note that additional_capacity is relative to the current number of elements
|
| 133 |
+
/// rather than to the current capacity, so calls to Reserve() which are not
|
| 134 |
+
/// interspersed with addition of new elements may not increase the capacity.
|
| 135 |
+
///
|
| 136 |
+
/// \param[in] additional_capacity the number of additional array values
|
| 137 |
+
/// \return Status
|
| 138 |
+
Status Reserve(int64_t additional_capacity) {
|
| 139 |
+
auto current_capacity = capacity();
|
| 140 |
+
auto min_capacity = length() + additional_capacity;
|
| 141 |
+
if (min_capacity <= current_capacity) return Status::OK();
|
| 142 |
+
|
| 143 |
+
// leave growth factor up to BufferBuilder
|
| 144 |
+
auto new_capacity = BufferBuilder::GrowByFactor(current_capacity, min_capacity);
|
| 145 |
+
return Resize(new_capacity);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
/// Reset the builder.
|
| 149 |
+
virtual void Reset();
|
| 150 |
+
|
| 151 |
+
/// \brief Append a null value to builder
|
| 152 |
+
virtual Status AppendNull() = 0;
|
| 153 |
+
/// \brief Append a number of null values to builder
|
| 154 |
+
virtual Status AppendNulls(int64_t length) = 0;
|
| 155 |
+
|
| 156 |
+
/// \brief Append a non-null value to builder
|
| 157 |
+
///
|
| 158 |
+
/// The appended value is an implementation detail, but the corresponding
|
| 159 |
+
/// memory slot is guaranteed to be initialized.
|
| 160 |
+
/// This method is useful when appending a null value to a parent nested type.
|
| 161 |
+
virtual Status AppendEmptyValue() = 0;
|
| 162 |
+
|
| 163 |
+
/// \brief Append a number of non-null values to builder
|
| 164 |
+
///
|
| 165 |
+
/// The appended values are an implementation detail, but the corresponding
|
| 166 |
+
/// memory slot is guaranteed to be initialized.
|
| 167 |
+
/// This method is useful when appending null values to a parent nested type.
|
| 168 |
+
virtual Status AppendEmptyValues(int64_t length) = 0;
|
| 169 |
+
|
| 170 |
+
/// \brief Append a value from a scalar
|
| 171 |
+
Status AppendScalar(const Scalar& scalar) { return AppendScalar(scalar, 1); }
|
| 172 |
+
virtual Status AppendScalar(const Scalar& scalar, int64_t n_repeats);
|
| 173 |
+
virtual Status AppendScalars(const ScalarVector& scalars);
|
| 174 |
+
|
| 175 |
+
/// \brief Append a range of values from an array.
|
| 176 |
+
///
|
| 177 |
+
/// The given array must be the same type as the builder.
|
| 178 |
+
virtual Status AppendArraySlice(const ArraySpan& ARROW_ARG_UNUSED(array),
|
| 179 |
+
int64_t ARROW_ARG_UNUSED(offset),
|
| 180 |
+
int64_t ARROW_ARG_UNUSED(length)) {
|
| 181 |
+
return Status::NotImplemented("AppendArraySlice for builder for ", *type());
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/// \brief Return result of builder as an internal generic ArrayData
|
| 185 |
+
/// object. Resets builder except for dictionary builder
|
| 186 |
+
///
|
| 187 |
+
/// \param[out] out the finalized ArrayData object
|
| 188 |
+
/// \return Status
|
| 189 |
+
virtual Status FinishInternal(std::shared_ptr<ArrayData>* out) = 0;
|
| 190 |
+
|
| 191 |
+
/// \brief Return result of builder as an Array object.
|
| 192 |
+
///
|
| 193 |
+
/// The builder is reset except for DictionaryBuilder.
|
| 194 |
+
///
|
| 195 |
+
/// \param[out] out the finalized Array object
|
| 196 |
+
/// \return Status
|
| 197 |
+
Status Finish(std::shared_ptr<Array>* out);
|
| 198 |
+
|
| 199 |
+
/// \brief Return result of builder as an Array object.
|
| 200 |
+
///
|
| 201 |
+
/// The builder is reset except for DictionaryBuilder.
|
| 202 |
+
///
|
| 203 |
+
/// \return The finalized Array object
|
| 204 |
+
Result<std::shared_ptr<Array>> Finish();
|
| 205 |
+
|
| 206 |
+
/// \brief Return the type of the built Array
|
| 207 |
+
virtual std::shared_ptr<DataType> type() const = 0;
|
| 208 |
+
|
| 209 |
+
protected:
|
| 210 |
+
/// Append to null bitmap
|
| 211 |
+
Status AppendToBitmap(bool is_valid);
|
| 212 |
+
|
| 213 |
+
/// Vector append. Treat each zero byte as a null. If valid_bytes is null
|
| 214 |
+
/// assume all of length bits are valid.
|
| 215 |
+
Status AppendToBitmap(const uint8_t* valid_bytes, int64_t length);
|
| 216 |
+
|
| 217 |
+
/// Uniform append. Append N times the same validity bit.
|
| 218 |
+
Status AppendToBitmap(int64_t num_bits, bool value);
|
| 219 |
+
|
| 220 |
+
/// Set the next length bits to not null (i.e. valid).
|
| 221 |
+
Status SetNotNull(int64_t length);
|
| 222 |
+
|
| 223 |
+
// Unsafe operations (don't check capacity/don't resize)
|
| 224 |
+
|
| 225 |
+
void UnsafeAppendNull() { UnsafeAppendToBitmap(false); }
|
| 226 |
+
|
| 227 |
+
// Append to null bitmap, update the length
|
| 228 |
+
void UnsafeAppendToBitmap(bool is_valid) {
|
| 229 |
+
null_bitmap_builder_.UnsafeAppend(is_valid);
|
| 230 |
+
++length_;
|
| 231 |
+
if (!is_valid) ++null_count_;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
// Vector append. Treat each zero byte as a nullzero. If valid_bytes is null
|
| 235 |
+
// assume all of length bits are valid.
|
| 236 |
+
void UnsafeAppendToBitmap(const uint8_t* valid_bytes, int64_t length) {
|
| 237 |
+
if (valid_bytes == NULLPTR) {
|
| 238 |
+
return UnsafeSetNotNull(length);
|
| 239 |
+
}
|
| 240 |
+
null_bitmap_builder_.UnsafeAppend(valid_bytes, length);
|
| 241 |
+
length_ += length;
|
| 242 |
+
null_count_ = null_bitmap_builder_.false_count();
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
// Vector append. Copy from a given bitmap. If bitmap is null assume
|
| 246 |
+
// all of length bits are valid.
|
| 247 |
+
void UnsafeAppendToBitmap(const uint8_t* bitmap, int64_t offset, int64_t length) {
|
| 248 |
+
if (bitmap == NULLPTR) {
|
| 249 |
+
return UnsafeSetNotNull(length);
|
| 250 |
+
}
|
| 251 |
+
null_bitmap_builder_.UnsafeAppend(bitmap, offset, length);
|
| 252 |
+
length_ += length;
|
| 253 |
+
null_count_ = null_bitmap_builder_.false_count();
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
// Append the same validity value a given number of times.
|
| 257 |
+
void UnsafeAppendToBitmap(const int64_t num_bits, bool value) {
|
| 258 |
+
if (value) {
|
| 259 |
+
UnsafeSetNotNull(num_bits);
|
| 260 |
+
} else {
|
| 261 |
+
UnsafeSetNull(num_bits);
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
void UnsafeAppendToBitmap(const std::vector<bool>& is_valid);
|
| 266 |
+
|
| 267 |
+
// Set the next validity bits to not null (i.e. valid).
|
| 268 |
+
void UnsafeSetNotNull(int64_t length);
|
| 269 |
+
|
| 270 |
+
// Set the next validity bits to null (i.e. invalid).
|
| 271 |
+
void UnsafeSetNull(int64_t length);
|
| 272 |
+
|
| 273 |
+
static Status TrimBuffer(const int64_t bytes_filled, ResizableBuffer* buffer);
|
| 274 |
+
|
| 275 |
+
/// \brief Finish to an array of the specified ArrayType
|
| 276 |
+
template <typename ArrayType>
|
| 277 |
+
Status FinishTyped(std::shared_ptr<ArrayType>* out) {
|
| 278 |
+
std::shared_ptr<Array> out_untyped;
|
| 279 |
+
ARROW_RETURN_NOT_OK(Finish(&out_untyped));
|
| 280 |
+
*out = std::static_pointer_cast<ArrayType>(std::move(out_untyped));
|
| 281 |
+
return Status::OK();
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
// Check the requested capacity for validity
|
| 285 |
+
Status CheckCapacity(int64_t new_capacity) {
|
| 286 |
+
if (ARROW_PREDICT_FALSE(new_capacity < 0)) {
|
| 287 |
+
return Status::Invalid(
|
| 288 |
+
"Resize capacity must be positive (requested: ", new_capacity, ")");
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
if (ARROW_PREDICT_FALSE(new_capacity < length_)) {
|
| 292 |
+
return Status::Invalid("Resize cannot downsize (requested: ", new_capacity,
|
| 293 |
+
", current length: ", length_, ")");
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
return Status::OK();
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
// Check for array type
|
| 300 |
+
Status CheckArrayType(const std::shared_ptr<DataType>& expected_type,
|
| 301 |
+
const Array& array, const char* message);
|
| 302 |
+
Status CheckArrayType(Type::type expected_type, const Array& array,
|
| 303 |
+
const char* message);
|
| 304 |
+
|
| 305 |
+
MemoryPool* pool_;
|
| 306 |
+
int64_t alignment_;
|
| 307 |
+
|
| 308 |
+
TypedBufferBuilder<bool> null_bitmap_builder_;
|
| 309 |
+
int64_t null_count_ = 0;
|
| 310 |
+
|
| 311 |
+
// Array length, so far. Also, the index of the next element to be added
|
| 312 |
+
int64_t length_ = 0;
|
| 313 |
+
int64_t capacity_ = 0;
|
| 314 |
+
|
| 315 |
+
// Child value array builders. These are owned by this class
|
| 316 |
+
std::vector<std::shared_ptr<ArrayBuilder>> children_;
|
| 317 |
+
|
| 318 |
+
private:
|
| 319 |
+
ARROW_DISALLOW_COPY_AND_ASSIGN(ArrayBuilder);
|
| 320 |
+
};
|
| 321 |
+
|
| 322 |
+
/// \brief Construct an empty ArrayBuilder corresponding to the data
|
| 323 |
+
/// type
|
| 324 |
+
/// \param[in] pool the MemoryPool to use for allocations
|
| 325 |
+
/// \param[in] type the data type to create the builder for
|
| 326 |
+
/// \param[out] out the created ArrayBuilder
|
| 327 |
+
ARROW_EXPORT
|
| 328 |
+
Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
|
| 329 |
+
std::unique_ptr<ArrayBuilder>* out);
|
| 330 |
+
|
| 331 |
+
inline Result<std::unique_ptr<ArrayBuilder>> MakeBuilder(
|
| 332 |
+
const std::shared_ptr<DataType>& type, MemoryPool* pool = default_memory_pool()) {
|
| 333 |
+
std::unique_ptr<ArrayBuilder> out;
|
| 334 |
+
ARROW_RETURN_NOT_OK(MakeBuilder(pool, type, &out));
|
| 335 |
+
return out;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
/// \brief Construct an empty ArrayBuilder corresponding to the data
|
| 339 |
+
/// type, where any top-level or nested dictionary builders return the
|
| 340 |
+
/// exact index type specified by the type.
|
| 341 |
+
ARROW_EXPORT
|
| 342 |
+
Status MakeBuilderExactIndex(MemoryPool* pool, const std::shared_ptr<DataType>& type,
|
| 343 |
+
std::unique_ptr<ArrayBuilder>* out);
|
| 344 |
+
|
| 345 |
+
inline Result<std::unique_ptr<ArrayBuilder>> MakeBuilderExactIndex(
|
| 346 |
+
const std::shared_ptr<DataType>& type, MemoryPool* pool = default_memory_pool()) {
|
| 347 |
+
std::unique_ptr<ArrayBuilder> out;
|
| 348 |
+
ARROW_RETURN_NOT_OK(MakeBuilderExactIndex(pool, type, &out));
|
| 349 |
+
return out;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
/// \brief Construct an empty DictionaryBuilder initialized optionally
|
| 353 |
+
/// with a preexisting dictionary
|
| 354 |
+
/// \param[in] pool the MemoryPool to use for allocations
|
| 355 |
+
/// \param[in] type the dictionary type to create the builder for
|
| 356 |
+
/// \param[in] dictionary the initial dictionary, if any. May be nullptr
|
| 357 |
+
/// \param[out] out the created ArrayBuilder
|
| 358 |
+
ARROW_EXPORT
|
| 359 |
+
Status MakeDictionaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
|
| 360 |
+
const std::shared_ptr<Array>& dictionary,
|
| 361 |
+
std::unique_ptr<ArrayBuilder>* out);
|
| 362 |
+
|
| 363 |
+
inline Result<std::unique_ptr<ArrayBuilder>> MakeDictionaryBuilder(
|
| 364 |
+
const std::shared_ptr<DataType>& type, const std::shared_ptr<Array>& dictionary,
|
| 365 |
+
MemoryPool* pool = default_memory_pool()) {
|
| 366 |
+
std::unique_ptr<ArrayBuilder> out;
|
| 367 |
+
ARROW_RETURN_NOT_OK(MakeDictionaryBuilder(pool, type, dictionary, &out));
|
| 368 |
+
return out;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_binary.h
ADDED
|
@@ -0,0 +1,993 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <array>
|
| 21 |
+
#include <cstddef>
|
| 22 |
+
#include <cstdint>
|
| 23 |
+
#include <cstring>
|
| 24 |
+
#include <limits>
|
| 25 |
+
#include <memory>
|
| 26 |
+
#include <numeric>
|
| 27 |
+
#include <string>
|
| 28 |
+
#include <string_view>
|
| 29 |
+
#include <vector>
|
| 30 |
+
|
| 31 |
+
#include "arrow/array/array_base.h"
|
| 32 |
+
#include "arrow/array/array_binary.h"
|
| 33 |
+
#include "arrow/array/builder_base.h"
|
| 34 |
+
#include "arrow/array/data.h"
|
| 35 |
+
#include "arrow/buffer.h"
|
| 36 |
+
#include "arrow/buffer_builder.h"
|
| 37 |
+
#include "arrow/status.h"
|
| 38 |
+
#include "arrow/type.h"
|
| 39 |
+
#include "arrow/util/binary_view_util.h"
|
| 40 |
+
#include "arrow/util/macros.h"
|
| 41 |
+
#include "arrow/util/visibility.h"
|
| 42 |
+
|
| 43 |
+
namespace arrow {
|
| 44 |
+
|
| 45 |
+
/// \addtogroup binary-builders
|
| 46 |
+
///
|
| 47 |
+
/// @{
|
| 48 |
+
|
| 49 |
+
// ----------------------------------------------------------------------
|
| 50 |
+
// Binary and String
|
| 51 |
+
|
| 52 |
+
template <typename TYPE>
|
| 53 |
+
class BaseBinaryBuilder
|
| 54 |
+
: public ArrayBuilder,
|
| 55 |
+
public internal::ArrayBuilderExtraOps<BaseBinaryBuilder<TYPE>, std::string_view> {
|
| 56 |
+
public:
|
| 57 |
+
using TypeClass = TYPE;
|
| 58 |
+
using offset_type = typename TypeClass::offset_type;
|
| 59 |
+
|
| 60 |
+
explicit BaseBinaryBuilder(MemoryPool* pool = default_memory_pool(),
|
| 61 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 62 |
+
: ArrayBuilder(pool, alignment),
|
| 63 |
+
offsets_builder_(pool, alignment),
|
| 64 |
+
value_data_builder_(pool, alignment) {}
|
| 65 |
+
|
| 66 |
+
BaseBinaryBuilder(const std::shared_ptr<DataType>& type, MemoryPool* pool)
|
| 67 |
+
: BaseBinaryBuilder(pool) {}
|
| 68 |
+
|
| 69 |
+
Status Append(const uint8_t* value, offset_type length) {
|
| 70 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 71 |
+
UnsafeAppendNextOffset();
|
| 72 |
+
// Safety check for UBSAN.
|
| 73 |
+
if (ARROW_PREDICT_TRUE(length > 0)) {
|
| 74 |
+
ARROW_RETURN_NOT_OK(ValidateOverflow(length));
|
| 75 |
+
ARROW_RETURN_NOT_OK(value_data_builder_.Append(value, length));
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
UnsafeAppendToBitmap(true);
|
| 79 |
+
return Status::OK();
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
Status Append(const char* value, offset_type length) {
|
| 83 |
+
return Append(reinterpret_cast<const uint8_t*>(value), length);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
Status Append(std::string_view value) {
|
| 87 |
+
return Append(value.data(), static_cast<offset_type>(value.size()));
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/// Extend the last appended value by appending more data at the end
|
| 91 |
+
///
|
| 92 |
+
/// Unlike Append, this does not create a new offset.
|
| 93 |
+
Status ExtendCurrent(const uint8_t* value, offset_type length) {
|
| 94 |
+
// Safety check for UBSAN.
|
| 95 |
+
if (ARROW_PREDICT_TRUE(length > 0)) {
|
| 96 |
+
ARROW_RETURN_NOT_OK(ValidateOverflow(length));
|
| 97 |
+
ARROW_RETURN_NOT_OK(value_data_builder_.Append(value, length));
|
| 98 |
+
}
|
| 99 |
+
return Status::OK();
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
Status ExtendCurrent(std::string_view value) {
|
| 103 |
+
return ExtendCurrent(reinterpret_cast<const uint8_t*>(value.data()),
|
| 104 |
+
static_cast<offset_type>(value.size()));
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
Status AppendNulls(int64_t length) final {
|
| 108 |
+
const int64_t num_bytes = value_data_builder_.length();
|
| 109 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 110 |
+
for (int64_t i = 0; i < length; ++i) {
|
| 111 |
+
offsets_builder_.UnsafeAppend(static_cast<offset_type>(num_bytes));
|
| 112 |
+
}
|
| 113 |
+
UnsafeAppendToBitmap(length, false);
|
| 114 |
+
return Status::OK();
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
Status AppendNull() final {
|
| 118 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 119 |
+
UnsafeAppendNextOffset();
|
| 120 |
+
UnsafeAppendToBitmap(false);
|
| 121 |
+
return Status::OK();
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
Status AppendEmptyValue() final {
|
| 125 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 126 |
+
UnsafeAppendNextOffset();
|
| 127 |
+
UnsafeAppendToBitmap(true);
|
| 128 |
+
return Status::OK();
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 132 |
+
const int64_t num_bytes = value_data_builder_.length();
|
| 133 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 134 |
+
for (int64_t i = 0; i < length; ++i) {
|
| 135 |
+
offsets_builder_.UnsafeAppend(static_cast<offset_type>(num_bytes));
|
| 136 |
+
}
|
| 137 |
+
UnsafeAppendToBitmap(length, true);
|
| 138 |
+
return Status::OK();
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/// \brief Append without checking capacity
|
| 142 |
+
///
|
| 143 |
+
/// Offsets and data should have been presized using Reserve() and
|
| 144 |
+
/// ReserveData(), respectively.
|
| 145 |
+
void UnsafeAppend(const uint8_t* value, offset_type length) {
|
| 146 |
+
UnsafeAppendNextOffset();
|
| 147 |
+
value_data_builder_.UnsafeAppend(value, length);
|
| 148 |
+
UnsafeAppendToBitmap(true);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
void UnsafeAppend(const char* value, offset_type length) {
|
| 152 |
+
UnsafeAppend(reinterpret_cast<const uint8_t*>(value), length);
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
void UnsafeAppend(const std::string& value) {
|
| 156 |
+
UnsafeAppend(value.c_str(), static_cast<offset_type>(value.size()));
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
void UnsafeAppend(std::string_view value) {
|
| 160 |
+
UnsafeAppend(value.data(), static_cast<offset_type>(value.size()));
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/// Like ExtendCurrent, but do not check capacity
|
| 164 |
+
void UnsafeExtendCurrent(const uint8_t* value, offset_type length) {
|
| 165 |
+
value_data_builder_.UnsafeAppend(value, length);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
void UnsafeExtendCurrent(std::string_view value) {
|
| 169 |
+
UnsafeExtendCurrent(reinterpret_cast<const uint8_t*>(value.data()),
|
| 170 |
+
static_cast<offset_type>(value.size()));
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
void UnsafeAppendNull() {
|
| 174 |
+
const int64_t num_bytes = value_data_builder_.length();
|
| 175 |
+
offsets_builder_.UnsafeAppend(static_cast<offset_type>(num_bytes));
|
| 176 |
+
UnsafeAppendToBitmap(false);
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
void UnsafeAppendEmptyValue() {
|
| 180 |
+
const int64_t num_bytes = value_data_builder_.length();
|
| 181 |
+
offsets_builder_.UnsafeAppend(static_cast<offset_type>(num_bytes));
|
| 182 |
+
UnsafeAppendToBitmap(true);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
/// \brief Append a sequence of strings in one shot.
|
| 186 |
+
///
|
| 187 |
+
/// \param[in] values a vector of strings
|
| 188 |
+
/// \param[in] valid_bytes an optional sequence of bytes where non-zero
|
| 189 |
+
/// indicates a valid (non-null) value
|
| 190 |
+
/// \return Status
|
| 191 |
+
Status AppendValues(const std::vector<std::string>& values,
|
| 192 |
+
const uint8_t* valid_bytes = NULLPTR) {
|
| 193 |
+
std::size_t total_length = std::accumulate(
|
| 194 |
+
values.begin(), values.end(), 0ULL,
|
| 195 |
+
[](uint64_t sum, const std::string& str) { return sum + str.size(); });
|
| 196 |
+
ARROW_RETURN_NOT_OK(Reserve(values.size()));
|
| 197 |
+
ARROW_RETURN_NOT_OK(ReserveData(total_length));
|
| 198 |
+
|
| 199 |
+
if (valid_bytes != NULLPTR) {
|
| 200 |
+
for (std::size_t i = 0; i < values.size(); ++i) {
|
| 201 |
+
UnsafeAppendNextOffset();
|
| 202 |
+
if (valid_bytes[i]) {
|
| 203 |
+
value_data_builder_.UnsafeAppend(
|
| 204 |
+
reinterpret_cast<const uint8_t*>(values[i].data()), values[i].size());
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
} else {
|
| 208 |
+
for (const auto& value : values) {
|
| 209 |
+
UnsafeAppendNextOffset();
|
| 210 |
+
value_data_builder_.UnsafeAppend(reinterpret_cast<const uint8_t*>(value.data()),
|
| 211 |
+
value.size());
|
| 212 |
+
}
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
UnsafeAppendToBitmap(valid_bytes, values.size());
|
| 216 |
+
return Status::OK();
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
/// \brief Append a sequence of nul-terminated strings in one shot.
|
| 220 |
+
/// If one of the values is NULL, it is processed as a null
|
| 221 |
+
/// value even if the corresponding valid_bytes entry is 1.
|
| 222 |
+
///
|
| 223 |
+
/// \param[in] values a contiguous C array of nul-terminated char *
|
| 224 |
+
/// \param[in] length the number of values to append
|
| 225 |
+
/// \param[in] valid_bytes an optional sequence of bytes where non-zero
|
| 226 |
+
/// indicates a valid (non-null) value
|
| 227 |
+
/// \return Status
|
| 228 |
+
Status AppendValues(const char** values, int64_t length,
|
| 229 |
+
const uint8_t* valid_bytes = NULLPTR) {
|
| 230 |
+
std::size_t total_length = 0;
|
| 231 |
+
std::vector<std::size_t> value_lengths(length);
|
| 232 |
+
bool have_null_value = false;
|
| 233 |
+
for (int64_t i = 0; i < length; ++i) {
|
| 234 |
+
if (values[i] != NULLPTR) {
|
| 235 |
+
auto value_length = strlen(values[i]);
|
| 236 |
+
value_lengths[i] = value_length;
|
| 237 |
+
total_length += value_length;
|
| 238 |
+
} else {
|
| 239 |
+
have_null_value = true;
|
| 240 |
+
}
|
| 241 |
+
}
|
| 242 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 243 |
+
ARROW_RETURN_NOT_OK(ReserveData(total_length));
|
| 244 |
+
|
| 245 |
+
if (valid_bytes) {
|
| 246 |
+
int64_t valid_bytes_offset = 0;
|
| 247 |
+
for (int64_t i = 0; i < length; ++i) {
|
| 248 |
+
UnsafeAppendNextOffset();
|
| 249 |
+
if (valid_bytes[i]) {
|
| 250 |
+
if (values[i]) {
|
| 251 |
+
value_data_builder_.UnsafeAppend(reinterpret_cast<const uint8_t*>(values[i]),
|
| 252 |
+
value_lengths[i]);
|
| 253 |
+
} else {
|
| 254 |
+
UnsafeAppendToBitmap(valid_bytes + valid_bytes_offset,
|
| 255 |
+
i - valid_bytes_offset);
|
| 256 |
+
UnsafeAppendToBitmap(false);
|
| 257 |
+
valid_bytes_offset = i + 1;
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
}
|
| 261 |
+
UnsafeAppendToBitmap(valid_bytes + valid_bytes_offset, length - valid_bytes_offset);
|
| 262 |
+
} else {
|
| 263 |
+
if (have_null_value) {
|
| 264 |
+
std::vector<uint8_t> valid_vector(length, 0);
|
| 265 |
+
for (int64_t i = 0; i < length; ++i) {
|
| 266 |
+
UnsafeAppendNextOffset();
|
| 267 |
+
if (values[i]) {
|
| 268 |
+
value_data_builder_.UnsafeAppend(reinterpret_cast<const uint8_t*>(values[i]),
|
| 269 |
+
value_lengths[i]);
|
| 270 |
+
valid_vector[i] = 1;
|
| 271 |
+
}
|
| 272 |
+
}
|
| 273 |
+
UnsafeAppendToBitmap(valid_vector.data(), length);
|
| 274 |
+
} else {
|
| 275 |
+
for (int64_t i = 0; i < length; ++i) {
|
| 276 |
+
UnsafeAppendNextOffset();
|
| 277 |
+
value_data_builder_.UnsafeAppend(reinterpret_cast<const uint8_t*>(values[i]),
|
| 278 |
+
value_lengths[i]);
|
| 279 |
+
}
|
| 280 |
+
UnsafeAppendToBitmap(NULLPTR, length);
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
return Status::OK();
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 287 |
+
int64_t length) override {
|
| 288 |
+
auto bitmap = array.GetValues<uint8_t>(0, 0);
|
| 289 |
+
auto offsets = array.GetValues<offset_type>(1);
|
| 290 |
+
auto data = array.GetValues<uint8_t>(2, 0);
|
| 291 |
+
auto total_length = offsets[offset + length] - offsets[offset];
|
| 292 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 293 |
+
ARROW_RETURN_NOT_OK(ReserveData(total_length));
|
| 294 |
+
for (int64_t i = 0; i < length; i++) {
|
| 295 |
+
if (!bitmap || bit_util::GetBit(bitmap, array.offset + offset + i)) {
|
| 296 |
+
const offset_type start = offsets[offset + i];
|
| 297 |
+
const offset_type end = offsets[offset + i + 1];
|
| 298 |
+
UnsafeAppend(data + start, end - start);
|
| 299 |
+
} else {
|
| 300 |
+
UnsafeAppendNull();
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
return Status::OK();
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
void Reset() override {
|
| 307 |
+
ArrayBuilder::Reset();
|
| 308 |
+
offsets_builder_.Reset();
|
| 309 |
+
value_data_builder_.Reset();
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
Status ValidateOverflow(int64_t new_bytes) {
|
| 313 |
+
auto new_size = value_data_builder_.length() + new_bytes;
|
| 314 |
+
if (ARROW_PREDICT_FALSE(new_size > memory_limit())) {
|
| 315 |
+
return Status::CapacityError("array cannot contain more than ", memory_limit(),
|
| 316 |
+
" bytes, have ", new_size);
|
| 317 |
+
} else {
|
| 318 |
+
return Status::OK();
|
| 319 |
+
}
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
Status Resize(int64_t capacity) override {
|
| 323 |
+
ARROW_RETURN_NOT_OK(CheckCapacity(capacity));
|
| 324 |
+
// One more than requested for offsets
|
| 325 |
+
ARROW_RETURN_NOT_OK(offsets_builder_.Resize(capacity + 1));
|
| 326 |
+
return ArrayBuilder::Resize(capacity);
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
/// \brief Ensures there is enough allocated capacity to append the indicated
|
| 330 |
+
/// number of bytes to the value data buffer without additional allocations
|
| 331 |
+
Status ReserveData(int64_t elements) {
|
| 332 |
+
ARROW_RETURN_NOT_OK(ValidateOverflow(elements));
|
| 333 |
+
return value_data_builder_.Reserve(elements);
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override {
|
| 337 |
+
// Write final offset (values length)
|
| 338 |
+
ARROW_RETURN_NOT_OK(AppendNextOffset());
|
| 339 |
+
|
| 340 |
+
// These buffers' padding zeroed by BufferBuilder
|
| 341 |
+
std::shared_ptr<Buffer> offsets, value_data, null_bitmap;
|
| 342 |
+
ARROW_RETURN_NOT_OK(offsets_builder_.Finish(&offsets));
|
| 343 |
+
ARROW_RETURN_NOT_OK(value_data_builder_.Finish(&value_data));
|
| 344 |
+
ARROW_RETURN_NOT_OK(null_bitmap_builder_.Finish(&null_bitmap));
|
| 345 |
+
|
| 346 |
+
*out = ArrayData::Make(type(), length_, {null_bitmap, offsets, value_data},
|
| 347 |
+
null_count_, 0);
|
| 348 |
+
Reset();
|
| 349 |
+
return Status::OK();
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
/// \return data pointer of the value date builder
|
| 353 |
+
const uint8_t* value_data() const { return value_data_builder_.data(); }
|
| 354 |
+
/// \return size of values buffer so far
|
| 355 |
+
int64_t value_data_length() const { return value_data_builder_.length(); }
|
| 356 |
+
/// \return capacity of values buffer
|
| 357 |
+
int64_t value_data_capacity() const { return value_data_builder_.capacity(); }
|
| 358 |
+
|
| 359 |
+
/// \return data pointer of the value date builder
|
| 360 |
+
const offset_type* offsets_data() const { return offsets_builder_.data(); }
|
| 361 |
+
|
| 362 |
+
/// Temporary access to a value.
|
| 363 |
+
///
|
| 364 |
+
/// This pointer becomes invalid on the next modifying operation.
|
| 365 |
+
const uint8_t* GetValue(int64_t i, offset_type* out_length) const {
|
| 366 |
+
const offset_type* offsets = offsets_builder_.data();
|
| 367 |
+
const auto offset = offsets[i];
|
| 368 |
+
if (i == (length_ - 1)) {
|
| 369 |
+
*out_length = static_cast<offset_type>(value_data_builder_.length()) - offset;
|
| 370 |
+
} else {
|
| 371 |
+
*out_length = offsets[i + 1] - offset;
|
| 372 |
+
}
|
| 373 |
+
return value_data_builder_.data() + offset;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
offset_type offset(int64_t i) const { return offsets_data()[i]; }
|
| 377 |
+
|
| 378 |
+
/// Temporary access to a value.
|
| 379 |
+
///
|
| 380 |
+
/// This view becomes invalid on the next modifying operation.
|
| 381 |
+
std::string_view GetView(int64_t i) const {
|
| 382 |
+
offset_type value_length;
|
| 383 |
+
const uint8_t* value_data = GetValue(i, &value_length);
|
| 384 |
+
return std::string_view(reinterpret_cast<const char*>(value_data), value_length);
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
// Cannot make this a static attribute because of linking issues
|
| 388 |
+
static constexpr int64_t memory_limit() {
|
| 389 |
+
return std::numeric_limits<offset_type>::max() - 1;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
protected:
|
| 393 |
+
TypedBufferBuilder<offset_type> offsets_builder_;
|
| 394 |
+
TypedBufferBuilder<uint8_t> value_data_builder_;
|
| 395 |
+
|
| 396 |
+
Status AppendNextOffset() {
|
| 397 |
+
const int64_t num_bytes = value_data_builder_.length();
|
| 398 |
+
return offsets_builder_.Append(static_cast<offset_type>(num_bytes));
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
void UnsafeAppendNextOffset() {
|
| 402 |
+
const int64_t num_bytes = value_data_builder_.length();
|
| 403 |
+
offsets_builder_.UnsafeAppend(static_cast<offset_type>(num_bytes));
|
| 404 |
+
}
|
| 405 |
+
};
|
| 406 |
+
|
| 407 |
+
/// \class BinaryBuilder
|
| 408 |
+
/// \brief Builder class for variable-length binary data
|
| 409 |
+
class ARROW_EXPORT BinaryBuilder : public BaseBinaryBuilder<BinaryType> {
|
| 410 |
+
public:
|
| 411 |
+
using BaseBinaryBuilder::BaseBinaryBuilder;
|
| 412 |
+
|
| 413 |
+
/// \cond FALSE
|
| 414 |
+
using ArrayBuilder::Finish;
|
| 415 |
+
/// \endcond
|
| 416 |
+
|
| 417 |
+
Status Finish(std::shared_ptr<BinaryArray>* out) { return FinishTyped(out); }
|
| 418 |
+
|
| 419 |
+
std::shared_ptr<DataType> type() const override { return binary(); }
|
| 420 |
+
};
|
| 421 |
+
|
| 422 |
+
/// \class StringBuilder
|
| 423 |
+
/// \brief Builder class for UTF8 strings
|
| 424 |
+
class ARROW_EXPORT StringBuilder : public BinaryBuilder {
|
| 425 |
+
public:
|
| 426 |
+
using BinaryBuilder::BinaryBuilder;
|
| 427 |
+
|
| 428 |
+
/// \cond FALSE
|
| 429 |
+
using ArrayBuilder::Finish;
|
| 430 |
+
/// \endcond
|
| 431 |
+
|
| 432 |
+
Status Finish(std::shared_ptr<StringArray>* out) { return FinishTyped(out); }
|
| 433 |
+
|
| 434 |
+
std::shared_ptr<DataType> type() const override { return utf8(); }
|
| 435 |
+
};
|
| 436 |
+
|
| 437 |
+
/// \class LargeBinaryBuilder
|
| 438 |
+
/// \brief Builder class for large variable-length binary data
|
| 439 |
+
class ARROW_EXPORT LargeBinaryBuilder : public BaseBinaryBuilder<LargeBinaryType> {
|
| 440 |
+
public:
|
| 441 |
+
using BaseBinaryBuilder::BaseBinaryBuilder;
|
| 442 |
+
|
| 443 |
+
/// \cond FALSE
|
| 444 |
+
using ArrayBuilder::Finish;
|
| 445 |
+
/// \endcond
|
| 446 |
+
|
| 447 |
+
Status Finish(std::shared_ptr<LargeBinaryArray>* out) { return FinishTyped(out); }
|
| 448 |
+
|
| 449 |
+
std::shared_ptr<DataType> type() const override { return large_binary(); }
|
| 450 |
+
};
|
| 451 |
+
|
| 452 |
+
/// \class LargeStringBuilder
|
| 453 |
+
/// \brief Builder class for large UTF8 strings
|
| 454 |
+
class ARROW_EXPORT LargeStringBuilder : public LargeBinaryBuilder {
|
| 455 |
+
public:
|
| 456 |
+
using LargeBinaryBuilder::LargeBinaryBuilder;
|
| 457 |
+
|
| 458 |
+
/// \cond FALSE
|
| 459 |
+
using ArrayBuilder::Finish;
|
| 460 |
+
/// \endcond
|
| 461 |
+
|
| 462 |
+
Status Finish(std::shared_ptr<LargeStringArray>* out) { return FinishTyped(out); }
|
| 463 |
+
|
| 464 |
+
std::shared_ptr<DataType> type() const override { return large_utf8(); }
|
| 465 |
+
};
|
| 466 |
+
|
| 467 |
+
// ----------------------------------------------------------------------
|
| 468 |
+
// BinaryViewBuilder, StringViewBuilder
|
| 469 |
+
//
|
| 470 |
+
// These builders do not support building raw pointer view arrays.
|
| 471 |
+
|
| 472 |
+
namespace internal {
|
| 473 |
+
|
| 474 |
+
// We allocate medium-sized memory chunks and accumulate data in those, which
|
| 475 |
+
// may result in some waste if there are many large-ish strings. If a string
|
| 476 |
+
// comes along that does not fit into a block, we allocate a new block and
|
| 477 |
+
// write into that.
|
| 478 |
+
//
|
| 479 |
+
// Later we can implement optimizations to continuing filling underfull blocks
|
| 480 |
+
// after encountering a large string that required allocating a new block.
|
| 481 |
+
class ARROW_EXPORT StringHeapBuilder {
|
| 482 |
+
public:
|
| 483 |
+
static constexpr int64_t kDefaultBlocksize = 32 << 10; // 32KB
|
| 484 |
+
|
| 485 |
+
StringHeapBuilder(MemoryPool* pool, int64_t alignment)
|
| 486 |
+
: pool_(pool), alignment_(alignment) {}
|
| 487 |
+
|
| 488 |
+
void SetBlockSize(int64_t blocksize) { blocksize_ = blocksize; }
|
| 489 |
+
|
| 490 |
+
using c_type = BinaryViewType::c_type;
|
| 491 |
+
|
| 492 |
+
template <bool Safe>
|
| 493 |
+
std::conditional_t<Safe, Result<c_type>, c_type> Append(const uint8_t* value,
|
| 494 |
+
int64_t length) {
|
| 495 |
+
if (length <= BinaryViewType::kInlineSize) {
|
| 496 |
+
return util::ToInlineBinaryView(value, static_cast<int32_t>(length));
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
if constexpr (Safe) {
|
| 500 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
auto v = util::ToNonInlineBinaryView(value, static_cast<int32_t>(length),
|
| 504 |
+
static_cast<int32_t>(blocks_.size() - 1),
|
| 505 |
+
current_offset_);
|
| 506 |
+
|
| 507 |
+
memcpy(current_out_buffer_, value, static_cast<size_t>(length));
|
| 508 |
+
current_out_buffer_ += length;
|
| 509 |
+
current_remaining_bytes_ -= length;
|
| 510 |
+
current_offset_ += static_cast<int32_t>(length);
|
| 511 |
+
return v;
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
static constexpr int64_t ValueSizeLimit() {
|
| 515 |
+
return std::numeric_limits<int32_t>::max();
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
/// \brief Ensure that the indicated number of bytes can be appended via
|
| 519 |
+
/// UnsafeAppend operations without the need to allocate more memory
|
| 520 |
+
Status Reserve(int64_t num_bytes) {
|
| 521 |
+
if (ARROW_PREDICT_FALSE(num_bytes > ValueSizeLimit())) {
|
| 522 |
+
return Status::CapacityError(
|
| 523 |
+
"BinaryView or StringView elements cannot reference "
|
| 524 |
+
"strings larger than 2GB");
|
| 525 |
+
}
|
| 526 |
+
if (num_bytes > current_remaining_bytes_) {
|
| 527 |
+
ARROW_RETURN_NOT_OK(FinishLastBlock());
|
| 528 |
+
current_remaining_bytes_ = num_bytes > blocksize_ ? num_bytes : blocksize_;
|
| 529 |
+
ARROW_ASSIGN_OR_RAISE(
|
| 530 |
+
std::shared_ptr<ResizableBuffer> new_block,
|
| 531 |
+
AllocateResizableBuffer(current_remaining_bytes_, alignment_, pool_));
|
| 532 |
+
current_offset_ = 0;
|
| 533 |
+
current_out_buffer_ = new_block->mutable_data();
|
| 534 |
+
blocks_.emplace_back(std::move(new_block));
|
| 535 |
+
}
|
| 536 |
+
return Status::OK();
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
void Reset() {
|
| 540 |
+
current_offset_ = 0;
|
| 541 |
+
current_out_buffer_ = NULLPTR;
|
| 542 |
+
current_remaining_bytes_ = 0;
|
| 543 |
+
blocks_.clear();
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
int64_t current_remaining_bytes() const { return current_remaining_bytes_; }
|
| 547 |
+
|
| 548 |
+
Result<std::vector<std::shared_ptr<ResizableBuffer>>> Finish() {
|
| 549 |
+
if (!blocks_.empty()) {
|
| 550 |
+
ARROW_RETURN_NOT_OK(FinishLastBlock());
|
| 551 |
+
}
|
| 552 |
+
current_offset_ = 0;
|
| 553 |
+
current_out_buffer_ = NULLPTR;
|
| 554 |
+
current_remaining_bytes_ = 0;
|
| 555 |
+
return std::move(blocks_);
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
private:
|
| 559 |
+
Status FinishLastBlock() {
|
| 560 |
+
if (current_remaining_bytes_ > 0) {
|
| 561 |
+
// Avoid leaking uninitialized bytes from the allocator
|
| 562 |
+
ARROW_RETURN_NOT_OK(
|
| 563 |
+
blocks_.back()->Resize(blocks_.back()->size() - current_remaining_bytes_,
|
| 564 |
+
/*shrink_to_fit=*/true));
|
| 565 |
+
blocks_.back()->ZeroPadding();
|
| 566 |
+
}
|
| 567 |
+
return Status::OK();
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
MemoryPool* pool_;
|
| 571 |
+
int64_t alignment_;
|
| 572 |
+
int64_t blocksize_ = kDefaultBlocksize;
|
| 573 |
+
std::vector<std::shared_ptr<ResizableBuffer>> blocks_;
|
| 574 |
+
|
| 575 |
+
int32_t current_offset_ = 0;
|
| 576 |
+
uint8_t* current_out_buffer_ = NULLPTR;
|
| 577 |
+
int64_t current_remaining_bytes_ = 0;
|
| 578 |
+
};
|
| 579 |
+
|
| 580 |
+
} // namespace internal
|
| 581 |
+
|
| 582 |
+
class ARROW_EXPORT BinaryViewBuilder : public ArrayBuilder {
|
| 583 |
+
public:
|
| 584 |
+
using TypeClass = BinaryViewType;
|
| 585 |
+
|
| 586 |
+
// this constructor provided for MakeBuilder compatibility
|
| 587 |
+
BinaryViewBuilder(const std::shared_ptr<DataType>&, MemoryPool* pool);
|
| 588 |
+
|
| 589 |
+
explicit BinaryViewBuilder(MemoryPool* pool = default_memory_pool(),
|
| 590 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 591 |
+
: ArrayBuilder(pool, alignment),
|
| 592 |
+
data_builder_(pool, alignment),
|
| 593 |
+
data_heap_builder_(pool, alignment) {}
|
| 594 |
+
|
| 595 |
+
/// Set the size for future preallocated data buffers.
|
| 596 |
+
///
|
| 597 |
+
/// The default size is 32KB, so after each 32KB of string data appended to the builder
|
| 598 |
+
/// a new data buffer will be allocated. Adjust this to a larger value to decrease the
|
| 599 |
+
/// frequency of allocation, or to a smaller value to lower the overhead of each
|
| 600 |
+
/// allocation.
|
| 601 |
+
void SetBlockSize(int64_t blocksize) { data_heap_builder_.SetBlockSize(blocksize); }
|
| 602 |
+
|
| 603 |
+
/// The number of bytes which can be appended to this builder without allocating another
|
| 604 |
+
/// data buffer.
|
| 605 |
+
int64_t current_block_bytes_remaining() const {
|
| 606 |
+
return data_heap_builder_.current_remaining_bytes();
|
| 607 |
+
}
|
| 608 |
+
|
| 609 |
+
Status Append(const uint8_t* value, int64_t length) {
|
| 610 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 611 |
+
UnsafeAppendToBitmap(true);
|
| 612 |
+
ARROW_ASSIGN_OR_RAISE(auto v,
|
| 613 |
+
data_heap_builder_.Append</*Safe=*/true>(value, length));
|
| 614 |
+
data_builder_.UnsafeAppend(v);
|
| 615 |
+
return Status::OK();
|
| 616 |
+
}
|
| 617 |
+
|
| 618 |
+
Status Append(const char* value, int64_t length) {
|
| 619 |
+
return Append(reinterpret_cast<const uint8_t*>(value), length);
|
| 620 |
+
}
|
| 621 |
+
|
| 622 |
+
Status Append(std::string_view value) {
|
| 623 |
+
return Append(value.data(), static_cast<int64_t>(value.size()));
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
/// \brief Append without checking capacity
|
| 627 |
+
///
|
| 628 |
+
/// Builder should have been presized using Reserve() and ReserveData(),
|
| 629 |
+
/// respectively, and the value must not be larger than 2GB
|
| 630 |
+
void UnsafeAppend(const uint8_t* value, int64_t length) {
|
| 631 |
+
UnsafeAppendToBitmap(true);
|
| 632 |
+
auto v = data_heap_builder_.Append</*Safe=*/false>(value, length);
|
| 633 |
+
data_builder_.UnsafeAppend(v);
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
void UnsafeAppend(const char* value, int64_t length) {
|
| 637 |
+
UnsafeAppend(reinterpret_cast<const uint8_t*>(value), length);
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
void UnsafeAppend(const std::string& value) {
|
| 641 |
+
UnsafeAppend(value.c_str(), static_cast<int64_t>(value.size()));
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
void UnsafeAppend(std::string_view value) {
|
| 645 |
+
UnsafeAppend(value.data(), static_cast<int64_t>(value.size()));
|
| 646 |
+
}
|
| 647 |
+
|
| 648 |
+
/// \brief Ensures there is enough allocated available capacity in the
|
| 649 |
+
/// out-of-line data heap to append the indicated number of bytes without
|
| 650 |
+
/// additional allocations
|
| 651 |
+
Status ReserveData(int64_t length);
|
| 652 |
+
|
| 653 |
+
Status AppendNulls(int64_t length) final {
|
| 654 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 655 |
+
data_builder_.UnsafeAppend(length, BinaryViewType::c_type{});
|
| 656 |
+
UnsafeSetNull(length);
|
| 657 |
+
return Status::OK();
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
/// \brief Append a single null element
|
| 661 |
+
Status AppendNull() final {
|
| 662 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 663 |
+
data_builder_.UnsafeAppend(BinaryViewType::c_type{});
|
| 664 |
+
UnsafeAppendToBitmap(false);
|
| 665 |
+
return Status::OK();
|
| 666 |
+
}
|
| 667 |
+
|
| 668 |
+
/// \brief Append a empty element (length-0 inline string)
|
| 669 |
+
Status AppendEmptyValue() final {
|
| 670 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 671 |
+
data_builder_.UnsafeAppend(BinaryViewType::c_type{});
|
| 672 |
+
UnsafeAppendToBitmap(true);
|
| 673 |
+
return Status::OK();
|
| 674 |
+
}
|
| 675 |
+
|
| 676 |
+
/// \brief Append several empty elements
|
| 677 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 678 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 679 |
+
data_builder_.UnsafeAppend(length, BinaryViewType::c_type{});
|
| 680 |
+
UnsafeSetNotNull(length);
|
| 681 |
+
return Status::OK();
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
void UnsafeAppendNull() {
|
| 685 |
+
data_builder_.UnsafeAppend(BinaryViewType::c_type{});
|
| 686 |
+
UnsafeAppendToBitmap(false);
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
void UnsafeAppendEmptyValue() {
|
| 690 |
+
data_builder_.UnsafeAppend(BinaryViewType::c_type{});
|
| 691 |
+
UnsafeAppendToBitmap(true);
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
/// \brief Append a slice of a BinaryViewArray passed as an ArraySpan. Copies
|
| 695 |
+
/// the underlying out-of-line string memory to avoid memory lifetime issues
|
| 696 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 697 |
+
int64_t length) override;
|
| 698 |
+
|
| 699 |
+
void Reset() override;
|
| 700 |
+
|
| 701 |
+
Status Resize(int64_t capacity) override {
|
| 702 |
+
ARROW_RETURN_NOT_OK(CheckCapacity(capacity));
|
| 703 |
+
capacity = std::max(capacity, kMinBuilderCapacity);
|
| 704 |
+
ARROW_RETURN_NOT_OK(data_builder_.Resize(capacity));
|
| 705 |
+
return ArrayBuilder::Resize(capacity);
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 709 |
+
|
| 710 |
+
std::shared_ptr<DataType> type() const override { return binary_view(); }
|
| 711 |
+
|
| 712 |
+
protected:
|
| 713 |
+
TypedBufferBuilder<BinaryViewType::c_type> data_builder_;
|
| 714 |
+
|
| 715 |
+
// Accumulates out-of-line data in fixed-size chunks which are then attached
|
| 716 |
+
// to the resulting ArrayData
|
| 717 |
+
internal::StringHeapBuilder data_heap_builder_;
|
| 718 |
+
};
|
| 719 |
+
|
| 720 |
+
class ARROW_EXPORT StringViewBuilder : public BinaryViewBuilder {
|
| 721 |
+
public:
|
| 722 |
+
using BinaryViewBuilder::BinaryViewBuilder;
|
| 723 |
+
std::shared_ptr<DataType> type() const override { return utf8_view(); }
|
| 724 |
+
};
|
| 725 |
+
|
| 726 |
+
// ----------------------------------------------------------------------
|
| 727 |
+
// FixedSizeBinaryBuilder
|
| 728 |
+
|
| 729 |
+
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
|
| 730 |
+
public:
|
| 731 |
+
using TypeClass = FixedSizeBinaryType;
|
| 732 |
+
|
| 733 |
+
explicit FixedSizeBinaryBuilder(const std::shared_ptr<DataType>& type,
|
| 734 |
+
MemoryPool* pool = default_memory_pool(),
|
| 735 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 736 |
+
|
| 737 |
+
Status Append(const uint8_t* value) {
|
| 738 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 739 |
+
UnsafeAppend(value);
|
| 740 |
+
return Status::OK();
|
| 741 |
+
}
|
| 742 |
+
|
| 743 |
+
Status Append(const char* value) {
|
| 744 |
+
return Append(reinterpret_cast<const uint8_t*>(value));
|
| 745 |
+
}
|
| 746 |
+
|
| 747 |
+
Status Append(std::string_view view) {
|
| 748 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 749 |
+
UnsafeAppend(view);
|
| 750 |
+
return Status::OK();
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
Status Append(const std::string& s) {
|
| 754 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 755 |
+
UnsafeAppend(s);
|
| 756 |
+
return Status::OK();
|
| 757 |
+
}
|
| 758 |
+
|
| 759 |
+
Status Append(const Buffer& s) {
|
| 760 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 761 |
+
UnsafeAppend(s);
|
| 762 |
+
return Status::OK();
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
Status Append(const std::shared_ptr<Buffer>& s) { return Append(*s); }
|
| 766 |
+
|
| 767 |
+
template <size_t NBYTES>
|
| 768 |
+
Status Append(const std::array<uint8_t, NBYTES>& value) {
|
| 769 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 770 |
+
UnsafeAppend(
|
| 771 |
+
std::string_view(reinterpret_cast<const char*>(value.data()), value.size()));
|
| 772 |
+
return Status::OK();
|
| 773 |
+
}
|
| 774 |
+
|
| 775 |
+
Status AppendValues(const uint8_t* data, int64_t length,
|
| 776 |
+
const uint8_t* valid_bytes = NULLPTR);
|
| 777 |
+
|
| 778 |
+
Status AppendValues(const uint8_t* data, int64_t length, const uint8_t* validity,
|
| 779 |
+
int64_t bitmap_offset);
|
| 780 |
+
|
| 781 |
+
Status AppendNull() final;
|
| 782 |
+
Status AppendNulls(int64_t length) final;
|
| 783 |
+
|
| 784 |
+
Status AppendEmptyValue() final;
|
| 785 |
+
Status AppendEmptyValues(int64_t length) final;
|
| 786 |
+
|
| 787 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 788 |
+
int64_t length) override {
|
| 789 |
+
return AppendValues(
|
| 790 |
+
array.GetValues<uint8_t>(1, 0) + ((array.offset + offset) * byte_width_), length,
|
| 791 |
+
array.GetValues<uint8_t>(0, 0), array.offset + offset);
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
void UnsafeAppend(const uint8_t* value) {
|
| 795 |
+
UnsafeAppendToBitmap(true);
|
| 796 |
+
if (ARROW_PREDICT_TRUE(byte_width_ > 0)) {
|
| 797 |
+
byte_builder_.UnsafeAppend(value, byte_width_);
|
| 798 |
+
}
|
| 799 |
+
}
|
| 800 |
+
|
| 801 |
+
void UnsafeAppend(const char* value) {
|
| 802 |
+
UnsafeAppend(reinterpret_cast<const uint8_t*>(value));
|
| 803 |
+
}
|
| 804 |
+
|
| 805 |
+
void UnsafeAppend(std::string_view value) {
|
| 806 |
+
#ifndef NDEBUG
|
| 807 |
+
CheckValueSize(static_cast<size_t>(value.size()));
|
| 808 |
+
#endif
|
| 809 |
+
UnsafeAppend(reinterpret_cast<const uint8_t*>(value.data()));
|
| 810 |
+
}
|
| 811 |
+
|
| 812 |
+
void UnsafeAppend(const Buffer& s) { UnsafeAppend(std::string_view{s}); }
|
| 813 |
+
|
| 814 |
+
void UnsafeAppend(const std::shared_ptr<Buffer>& s) { UnsafeAppend(*s); }
|
| 815 |
+
|
| 816 |
+
void UnsafeAppendNull() {
|
| 817 |
+
UnsafeAppendToBitmap(false);
|
| 818 |
+
byte_builder_.UnsafeAppend(/*num_copies=*/byte_width_, 0);
|
| 819 |
+
}
|
| 820 |
+
|
| 821 |
+
Status ValidateOverflow(int64_t new_bytes) const {
|
| 822 |
+
auto new_size = byte_builder_.length() + new_bytes;
|
| 823 |
+
if (ARROW_PREDICT_FALSE(new_size > memory_limit())) {
|
| 824 |
+
return Status::CapacityError("array cannot contain more than ", memory_limit(),
|
| 825 |
+
" bytes, have ", new_size);
|
| 826 |
+
} else {
|
| 827 |
+
return Status::OK();
|
| 828 |
+
}
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
/// \brief Ensures there is enough allocated capacity to append the indicated
|
| 832 |
+
/// number of bytes to the value data buffer without additional allocations
|
| 833 |
+
Status ReserveData(int64_t elements) {
|
| 834 |
+
ARROW_RETURN_NOT_OK(ValidateOverflow(elements));
|
| 835 |
+
return byte_builder_.Reserve(elements);
|
| 836 |
+
}
|
| 837 |
+
|
| 838 |
+
void Reset() override;
|
| 839 |
+
Status Resize(int64_t capacity) override;
|
| 840 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 841 |
+
|
| 842 |
+
/// \cond FALSE
|
| 843 |
+
using ArrayBuilder::Finish;
|
| 844 |
+
/// \endcond
|
| 845 |
+
|
| 846 |
+
Status Finish(std::shared_ptr<FixedSizeBinaryArray>* out) { return FinishTyped(out); }
|
| 847 |
+
|
| 848 |
+
/// \return size of values buffer so far
|
| 849 |
+
int64_t value_data_length() const { return byte_builder_.length(); }
|
| 850 |
+
|
| 851 |
+
int32_t byte_width() const { return byte_width_; }
|
| 852 |
+
|
| 853 |
+
/// Temporary access to a value.
|
| 854 |
+
///
|
| 855 |
+
/// This pointer becomes invalid on the next modifying operation.
|
| 856 |
+
const uint8_t* GetValue(int64_t i) const;
|
| 857 |
+
|
| 858 |
+
/// Temporary mutable access to a value.
|
| 859 |
+
///
|
| 860 |
+
/// This pointer becomes invalid on the next modifying operation.
|
| 861 |
+
uint8_t* GetMutableValue(int64_t i) {
|
| 862 |
+
uint8_t* data_ptr = byte_builder_.mutable_data();
|
| 863 |
+
return data_ptr + i * byte_width_;
|
| 864 |
+
}
|
| 865 |
+
|
| 866 |
+
/// Temporary mutable access to a value.
|
| 867 |
+
///
|
| 868 |
+
/// This view becomes invalid on the next modifying operation.
|
| 869 |
+
std::string_view GetView(int64_t i) const;
|
| 870 |
+
|
| 871 |
+
/// Advance builder without allocating nor writing any values
|
| 872 |
+
///
|
| 873 |
+
/// The internal pointer is advanced by `length` values and the same number
|
| 874 |
+
/// of non-null entries are appended to the validity bitmap.
|
| 875 |
+
/// This method assumes that the `length` values were populated directly,
|
| 876 |
+
/// for example using `GetMutableValue`.
|
| 877 |
+
void UnsafeAdvance(int64_t length) {
|
| 878 |
+
byte_builder_.UnsafeAdvance(length * byte_width_);
|
| 879 |
+
UnsafeAppendToBitmap(length, true);
|
| 880 |
+
}
|
| 881 |
+
|
| 882 |
+
/// Advance builder without allocating nor writing any values
|
| 883 |
+
///
|
| 884 |
+
/// The internal pointer is advanced by `length` values and the same number
|
| 885 |
+
/// of validity bits are appended to the validity bitmap.
|
| 886 |
+
/// This method assumes that the `length` values were populated directly,
|
| 887 |
+
/// for example using `GetMutableValue`.
|
| 888 |
+
void UnsafeAdvance(int64_t length, const uint8_t* validity, int64_t valid_bits_offset) {
|
| 889 |
+
byte_builder_.UnsafeAdvance(length * byte_width_);
|
| 890 |
+
UnsafeAppendToBitmap(validity, valid_bits_offset, length);
|
| 891 |
+
}
|
| 892 |
+
|
| 893 |
+
static constexpr int64_t memory_limit() {
|
| 894 |
+
return std::numeric_limits<int64_t>::max() - 1;
|
| 895 |
+
}
|
| 896 |
+
|
| 897 |
+
std::shared_ptr<DataType> type() const override {
|
| 898 |
+
return fixed_size_binary(byte_width_);
|
| 899 |
+
}
|
| 900 |
+
|
| 901 |
+
protected:
|
| 902 |
+
int32_t byte_width_;
|
| 903 |
+
BufferBuilder byte_builder_;
|
| 904 |
+
|
| 905 |
+
void CheckValueSize(int64_t size);
|
| 906 |
+
};
|
| 907 |
+
|
| 908 |
+
/// @}
|
| 909 |
+
|
| 910 |
+
// ----------------------------------------------------------------------
|
| 911 |
+
// Chunked builders: build a sequence of BinaryArray or StringArray that are
|
| 912 |
+
// limited to a particular size (to the upper limit of 2GB)
|
| 913 |
+
|
| 914 |
+
namespace internal {
|
| 915 |
+
|
| 916 |
+
class ARROW_EXPORT ChunkedBinaryBuilder {
|
| 917 |
+
public:
|
| 918 |
+
explicit ChunkedBinaryBuilder(int32_t max_chunk_value_length,
|
| 919 |
+
MemoryPool* pool = default_memory_pool());
|
| 920 |
+
|
| 921 |
+
ChunkedBinaryBuilder(int32_t max_chunk_value_length, int32_t max_chunk_length,
|
| 922 |
+
MemoryPool* pool = default_memory_pool());
|
| 923 |
+
|
| 924 |
+
virtual ~ChunkedBinaryBuilder() = default;
|
| 925 |
+
|
| 926 |
+
Status Append(const uint8_t* value, int32_t length) {
|
| 927 |
+
if (ARROW_PREDICT_FALSE(length + builder_->value_data_length() >
|
| 928 |
+
max_chunk_value_length_)) {
|
| 929 |
+
if (builder_->value_data_length() == 0) {
|
| 930 |
+
// The current item is larger than max_chunk_size_;
|
| 931 |
+
// this chunk will be oversize and hold *only* this item
|
| 932 |
+
ARROW_RETURN_NOT_OK(builder_->Append(value, length));
|
| 933 |
+
return NextChunk();
|
| 934 |
+
}
|
| 935 |
+
// The current item would cause builder_->value_data_length() to exceed
|
| 936 |
+
// max_chunk_size_, so finish this chunk and append the current item to the next
|
| 937 |
+
// chunk
|
| 938 |
+
ARROW_RETURN_NOT_OK(NextChunk());
|
| 939 |
+
return Append(value, length);
|
| 940 |
+
}
|
| 941 |
+
|
| 942 |
+
if (ARROW_PREDICT_FALSE(builder_->length() == max_chunk_length_)) {
|
| 943 |
+
// The current item would cause builder_->length() to exceed max_chunk_length_, so
|
| 944 |
+
// finish this chunk and append the current item to the next chunk
|
| 945 |
+
ARROW_RETURN_NOT_OK(NextChunk());
|
| 946 |
+
}
|
| 947 |
+
|
| 948 |
+
return builder_->Append(value, length);
|
| 949 |
+
}
|
| 950 |
+
|
| 951 |
+
Status Append(std::string_view value) {
|
| 952 |
+
return Append(reinterpret_cast<const uint8_t*>(value.data()),
|
| 953 |
+
static_cast<int32_t>(value.size()));
|
| 954 |
+
}
|
| 955 |
+
|
| 956 |
+
Status AppendNull() {
|
| 957 |
+
if (ARROW_PREDICT_FALSE(builder_->length() == max_chunk_length_)) {
|
| 958 |
+
ARROW_RETURN_NOT_OK(NextChunk());
|
| 959 |
+
}
|
| 960 |
+
return builder_->AppendNull();
|
| 961 |
+
}
|
| 962 |
+
|
| 963 |
+
Status Reserve(int64_t values);
|
| 964 |
+
|
| 965 |
+
virtual Status Finish(ArrayVector* out);
|
| 966 |
+
|
| 967 |
+
protected:
|
| 968 |
+
Status NextChunk();
|
| 969 |
+
|
| 970 |
+
// maximum total character data size per chunk
|
| 971 |
+
int64_t max_chunk_value_length_;
|
| 972 |
+
|
| 973 |
+
// maximum elements allowed per chunk
|
| 974 |
+
int64_t max_chunk_length_ = kListMaximumElements;
|
| 975 |
+
|
| 976 |
+
// when Reserve() would cause builder_ to exceed its max_chunk_length_,
|
| 977 |
+
// add to extra_capacity_ instead and wait to reserve until the next chunk
|
| 978 |
+
int64_t extra_capacity_ = 0;
|
| 979 |
+
|
| 980 |
+
std::unique_ptr<BinaryBuilder> builder_;
|
| 981 |
+
std::vector<std::shared_ptr<Array>> chunks_;
|
| 982 |
+
};
|
| 983 |
+
|
| 984 |
+
class ARROW_EXPORT ChunkedStringBuilder : public ChunkedBinaryBuilder {
|
| 985 |
+
public:
|
| 986 |
+
using ChunkedBinaryBuilder::ChunkedBinaryBuilder;
|
| 987 |
+
|
| 988 |
+
Status Finish(ArrayVector* out) override;
|
| 989 |
+
};
|
| 990 |
+
|
| 991 |
+
} // namespace internal
|
| 992 |
+
|
| 993 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_decimal.h
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <memory>
|
| 21 |
+
|
| 22 |
+
#include "arrow/array/array_decimal.h"
|
| 23 |
+
#include "arrow/array/builder_base.h"
|
| 24 |
+
#include "arrow/array/builder_binary.h"
|
| 25 |
+
#include "arrow/array/data.h"
|
| 26 |
+
#include "arrow/status.h"
|
| 27 |
+
#include "arrow/type.h"
|
| 28 |
+
#include "arrow/util/visibility.h"
|
| 29 |
+
|
| 30 |
+
namespace arrow {
|
| 31 |
+
|
| 32 |
+
/// \addtogroup numeric-builders
|
| 33 |
+
///
|
| 34 |
+
/// @{
|
| 35 |
+
|
| 36 |
+
class ARROW_EXPORT Decimal32Builder : public FixedSizeBinaryBuilder {
|
| 37 |
+
public:
|
| 38 |
+
using TypeClass = Decimal32Type;
|
| 39 |
+
using ValueType = Decimal32;
|
| 40 |
+
|
| 41 |
+
explicit Decimal32Builder(const std::shared_ptr<DataType>& type,
|
| 42 |
+
MemoryPool* pool = default_memory_pool(),
|
| 43 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 44 |
+
|
| 45 |
+
using FixedSizeBinaryBuilder::Append;
|
| 46 |
+
using FixedSizeBinaryBuilder::AppendValues;
|
| 47 |
+
using FixedSizeBinaryBuilder::Reset;
|
| 48 |
+
|
| 49 |
+
Status Append(Decimal32 val);
|
| 50 |
+
void UnsafeAppend(Decimal32 val);
|
| 51 |
+
void UnsafeAppend(std::string_view val);
|
| 52 |
+
|
| 53 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 54 |
+
|
| 55 |
+
/// \cond FALSE
|
| 56 |
+
using ArrayBuilder::Finish;
|
| 57 |
+
/// \endcond
|
| 58 |
+
|
| 59 |
+
Status Finish(std::shared_ptr<Decimal32Array>* out) { return FinishTyped(out); }
|
| 60 |
+
|
| 61 |
+
std::shared_ptr<DataType> type() const override { return decimal_type_; }
|
| 62 |
+
|
| 63 |
+
protected:
|
| 64 |
+
std::shared_ptr<Decimal32Type> decimal_type_;
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
class ARROW_EXPORT Decimal64Builder : public FixedSizeBinaryBuilder {
|
| 68 |
+
public:
|
| 69 |
+
using TypeClass = Decimal64Type;
|
| 70 |
+
using ValueType = Decimal64;
|
| 71 |
+
|
| 72 |
+
explicit Decimal64Builder(const std::shared_ptr<DataType>& type,
|
| 73 |
+
MemoryPool* pool = default_memory_pool(),
|
| 74 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 75 |
+
|
| 76 |
+
using FixedSizeBinaryBuilder::Append;
|
| 77 |
+
using FixedSizeBinaryBuilder::AppendValues;
|
| 78 |
+
using FixedSizeBinaryBuilder::Reset;
|
| 79 |
+
|
| 80 |
+
Status Append(Decimal64 val);
|
| 81 |
+
void UnsafeAppend(Decimal64 val);
|
| 82 |
+
void UnsafeAppend(std::string_view val);
|
| 83 |
+
|
| 84 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 85 |
+
|
| 86 |
+
/// \cond FALSE
|
| 87 |
+
using ArrayBuilder::Finish;
|
| 88 |
+
/// \endcond
|
| 89 |
+
|
| 90 |
+
Status Finish(std::shared_ptr<Decimal64Array>* out) { return FinishTyped(out); }
|
| 91 |
+
|
| 92 |
+
std::shared_ptr<DataType> type() const override { return decimal_type_; }
|
| 93 |
+
|
| 94 |
+
protected:
|
| 95 |
+
std::shared_ptr<Decimal64Type> decimal_type_;
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
class ARROW_EXPORT Decimal128Builder : public FixedSizeBinaryBuilder {
|
| 99 |
+
public:
|
| 100 |
+
using TypeClass = Decimal128Type;
|
| 101 |
+
using ValueType = Decimal128;
|
| 102 |
+
|
| 103 |
+
explicit Decimal128Builder(const std::shared_ptr<DataType>& type,
|
| 104 |
+
MemoryPool* pool = default_memory_pool(),
|
| 105 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 106 |
+
|
| 107 |
+
using FixedSizeBinaryBuilder::Append;
|
| 108 |
+
using FixedSizeBinaryBuilder::AppendValues;
|
| 109 |
+
using FixedSizeBinaryBuilder::Reset;
|
| 110 |
+
|
| 111 |
+
Status Append(Decimal128 val);
|
| 112 |
+
void UnsafeAppend(Decimal128 val);
|
| 113 |
+
void UnsafeAppend(std::string_view val);
|
| 114 |
+
|
| 115 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 116 |
+
|
| 117 |
+
/// \cond FALSE
|
| 118 |
+
using ArrayBuilder::Finish;
|
| 119 |
+
/// \endcond
|
| 120 |
+
|
| 121 |
+
Status Finish(std::shared_ptr<Decimal128Array>* out) { return FinishTyped(out); }
|
| 122 |
+
|
| 123 |
+
std::shared_ptr<DataType> type() const override { return decimal_type_; }
|
| 124 |
+
|
| 125 |
+
protected:
|
| 126 |
+
std::shared_ptr<Decimal128Type> decimal_type_;
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
class ARROW_EXPORT Decimal256Builder : public FixedSizeBinaryBuilder {
|
| 130 |
+
public:
|
| 131 |
+
using TypeClass = Decimal256Type;
|
| 132 |
+
using ValueType = Decimal256;
|
| 133 |
+
|
| 134 |
+
explicit Decimal256Builder(const std::shared_ptr<DataType>& type,
|
| 135 |
+
MemoryPool* pool = default_memory_pool(),
|
| 136 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 137 |
+
|
| 138 |
+
using FixedSizeBinaryBuilder::Append;
|
| 139 |
+
using FixedSizeBinaryBuilder::AppendValues;
|
| 140 |
+
using FixedSizeBinaryBuilder::Reset;
|
| 141 |
+
|
| 142 |
+
Status Append(const Decimal256& val);
|
| 143 |
+
void UnsafeAppend(const Decimal256& val);
|
| 144 |
+
void UnsafeAppend(std::string_view val);
|
| 145 |
+
|
| 146 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 147 |
+
|
| 148 |
+
/// \cond FALSE
|
| 149 |
+
using ArrayBuilder::Finish;
|
| 150 |
+
/// \endcond
|
| 151 |
+
|
| 152 |
+
Status Finish(std::shared_ptr<Decimal256Array>* out) { return FinishTyped(out); }
|
| 153 |
+
|
| 154 |
+
std::shared_ptr<DataType> type() const override { return decimal_type_; }
|
| 155 |
+
|
| 156 |
+
protected:
|
| 157 |
+
std::shared_ptr<Decimal256Type> decimal_type_;
|
| 158 |
+
};
|
| 159 |
+
|
| 160 |
+
using DecimalBuilder = Decimal128Builder;
|
| 161 |
+
|
| 162 |
+
/// @}
|
| 163 |
+
|
| 164 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_dict.h
ADDED
|
@@ -0,0 +1,728 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <algorithm>
|
| 21 |
+
#include <cstdint>
|
| 22 |
+
#include <memory>
|
| 23 |
+
#include <type_traits>
|
| 24 |
+
|
| 25 |
+
#include "arrow/array/array_base.h"
|
| 26 |
+
#include "arrow/array/array_binary.h"
|
| 27 |
+
#include "arrow/array/builder_adaptive.h" // IWYU pragma: export
|
| 28 |
+
#include "arrow/array/builder_base.h" // IWYU pragma: export
|
| 29 |
+
#include "arrow/array/builder_primitive.h" // IWYU pragma: export
|
| 30 |
+
#include "arrow/array/data.h"
|
| 31 |
+
#include "arrow/array/util.h"
|
| 32 |
+
#include "arrow/scalar.h"
|
| 33 |
+
#include "arrow/status.h"
|
| 34 |
+
#include "arrow/type.h"
|
| 35 |
+
#include "arrow/type_traits.h"
|
| 36 |
+
#include "arrow/util/bit_block_counter.h"
|
| 37 |
+
#include "arrow/util/checked_cast.h"
|
| 38 |
+
#include "arrow/util/decimal.h"
|
| 39 |
+
#include "arrow/util/macros.h"
|
| 40 |
+
#include "arrow/util/visibility.h"
|
| 41 |
+
|
| 42 |
+
namespace arrow {
|
| 43 |
+
|
| 44 |
+
// ----------------------------------------------------------------------
|
| 45 |
+
// Dictionary builder
|
| 46 |
+
|
| 47 |
+
namespace internal {
|
| 48 |
+
|
| 49 |
+
template <typename T, typename Enable = void>
|
| 50 |
+
struct DictionaryValue {
|
| 51 |
+
using type = typename T::c_type;
|
| 52 |
+
using PhysicalType = T;
|
| 53 |
+
};
|
| 54 |
+
|
| 55 |
+
template <typename T>
|
| 56 |
+
struct DictionaryValue<T, enable_if_base_binary<T>> {
|
| 57 |
+
using type = std::string_view;
|
| 58 |
+
using PhysicalType =
|
| 59 |
+
typename std::conditional<std::is_same<typename T::offset_type, int32_t>::value,
|
| 60 |
+
BinaryType, LargeBinaryType>::type;
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
template <typename T>
|
| 64 |
+
struct DictionaryValue<T, enable_if_binary_view_like<T>> {
|
| 65 |
+
using type = std::string_view;
|
| 66 |
+
using PhysicalType = BinaryViewType;
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
template <typename T>
|
| 70 |
+
struct DictionaryValue<T, enable_if_fixed_size_binary<T>> {
|
| 71 |
+
using type = std::string_view;
|
| 72 |
+
using PhysicalType = BinaryType;
|
| 73 |
+
};
|
| 74 |
+
|
| 75 |
+
class ARROW_EXPORT DictionaryMemoTable {
|
| 76 |
+
public:
|
| 77 |
+
DictionaryMemoTable(MemoryPool* pool, const std::shared_ptr<DataType>& type);
|
| 78 |
+
DictionaryMemoTable(MemoryPool* pool, const std::shared_ptr<Array>& dictionary);
|
| 79 |
+
~DictionaryMemoTable();
|
| 80 |
+
|
| 81 |
+
Status GetArrayData(int64_t start_offset, std::shared_ptr<ArrayData>* out);
|
| 82 |
+
|
| 83 |
+
/// \brief Insert new memo values
|
| 84 |
+
Status InsertValues(const Array& values);
|
| 85 |
+
|
| 86 |
+
int32_t size() const;
|
| 87 |
+
|
| 88 |
+
template <typename T>
|
| 89 |
+
Status GetOrInsert(typename DictionaryValue<T>::type value, int32_t* out) {
|
| 90 |
+
// We want to keep the DictionaryMemoTable implementation private, also we can't
|
| 91 |
+
// use extern template classes because of compiler issues (MinGW?). Instead,
|
| 92 |
+
// we expose explicit function overrides for each supported physical type.
|
| 93 |
+
const typename DictionaryValue<T>::PhysicalType* physical_type = NULLPTR;
|
| 94 |
+
return GetOrInsert(physical_type, value, out);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
private:
|
| 98 |
+
Status GetOrInsert(const BooleanType*, bool value, int32_t* out);
|
| 99 |
+
Status GetOrInsert(const Int8Type*, int8_t value, int32_t* out);
|
| 100 |
+
Status GetOrInsert(const Int16Type*, int16_t value, int32_t* out);
|
| 101 |
+
Status GetOrInsert(const Int32Type*, int32_t value, int32_t* out);
|
| 102 |
+
Status GetOrInsert(const Int64Type*, int64_t value, int32_t* out);
|
| 103 |
+
Status GetOrInsert(const UInt8Type*, uint8_t value, int32_t* out);
|
| 104 |
+
Status GetOrInsert(const UInt16Type*, uint16_t value, int32_t* out);
|
| 105 |
+
Status GetOrInsert(const UInt32Type*, uint32_t value, int32_t* out);
|
| 106 |
+
Status GetOrInsert(const UInt64Type*, uint64_t value, int32_t* out);
|
| 107 |
+
Status GetOrInsert(const DurationType*, int64_t value, int32_t* out);
|
| 108 |
+
Status GetOrInsert(const TimestampType*, int64_t value, int32_t* out);
|
| 109 |
+
Status GetOrInsert(const Date32Type*, int32_t value, int32_t* out);
|
| 110 |
+
Status GetOrInsert(const Date64Type*, int64_t value, int32_t* out);
|
| 111 |
+
Status GetOrInsert(const Time32Type*, int32_t value, int32_t* out);
|
| 112 |
+
Status GetOrInsert(const Time64Type*, int64_t value, int32_t* out);
|
| 113 |
+
Status GetOrInsert(const MonthDayNanoIntervalType*,
|
| 114 |
+
MonthDayNanoIntervalType::MonthDayNanos value, int32_t* out);
|
| 115 |
+
Status GetOrInsert(const DayTimeIntervalType*,
|
| 116 |
+
DayTimeIntervalType::DayMilliseconds value, int32_t* out);
|
| 117 |
+
Status GetOrInsert(const MonthIntervalType*, int32_t value, int32_t* out);
|
| 118 |
+
Status GetOrInsert(const FloatType*, float value, int32_t* out);
|
| 119 |
+
Status GetOrInsert(const DoubleType*, double value, int32_t* out);
|
| 120 |
+
|
| 121 |
+
Status GetOrInsert(const BinaryType*, std::string_view value, int32_t* out);
|
| 122 |
+
Status GetOrInsert(const LargeBinaryType*, std::string_view value, int32_t* out);
|
| 123 |
+
Status GetOrInsert(const BinaryViewType*, std::string_view value, int32_t* out);
|
| 124 |
+
|
| 125 |
+
class DictionaryMemoTableImpl;
|
| 126 |
+
std::unique_ptr<DictionaryMemoTableImpl> impl_;
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
} // namespace internal
|
| 130 |
+
|
| 131 |
+
/// \addtogroup dictionary-builders
|
| 132 |
+
///
|
| 133 |
+
/// @{
|
| 134 |
+
|
| 135 |
+
namespace internal {
|
| 136 |
+
|
| 137 |
+
/// \brief Array builder for created encoded DictionaryArray from
|
| 138 |
+
/// dense array
|
| 139 |
+
///
|
| 140 |
+
/// Unlike other builders, dictionary builder does not completely
|
| 141 |
+
/// reset the state on Finish calls.
|
| 142 |
+
template <typename BuilderType, typename T>
|
| 143 |
+
class DictionaryBuilderBase : public ArrayBuilder {
|
| 144 |
+
public:
|
| 145 |
+
using TypeClass = DictionaryType;
|
| 146 |
+
using Value = typename DictionaryValue<T>::type;
|
| 147 |
+
|
| 148 |
+
// WARNING: the type given below is the value type, not the DictionaryType.
|
| 149 |
+
// The DictionaryType is instantiated on the Finish() call.
|
| 150 |
+
template <typename B = BuilderType, typename T1 = T>
|
| 151 |
+
DictionaryBuilderBase(uint8_t start_int_size,
|
| 152 |
+
enable_if_t<std::is_base_of<AdaptiveIntBuilderBase, B>::value &&
|
| 153 |
+
!is_fixed_size_binary_type<T1>::value,
|
| 154 |
+
const std::shared_ptr<DataType>&>
|
| 155 |
+
value_type,
|
| 156 |
+
MemoryPool* pool = default_memory_pool(),
|
| 157 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 158 |
+
: ArrayBuilder(pool, alignment),
|
| 159 |
+
memo_table_(new internal::DictionaryMemoTable(pool, value_type)),
|
| 160 |
+
delta_offset_(0),
|
| 161 |
+
byte_width_(-1),
|
| 162 |
+
indices_builder_(start_int_size, pool, alignment),
|
| 163 |
+
value_type_(value_type) {}
|
| 164 |
+
|
| 165 |
+
template <typename T1 = T>
|
| 166 |
+
explicit DictionaryBuilderBase(
|
| 167 |
+
enable_if_t<!is_fixed_size_binary_type<T1>::value, const std::shared_ptr<DataType>&>
|
| 168 |
+
value_type,
|
| 169 |
+
MemoryPool* pool = default_memory_pool(),
|
| 170 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 171 |
+
: ArrayBuilder(pool, alignment),
|
| 172 |
+
memo_table_(new internal::DictionaryMemoTable(pool, value_type)),
|
| 173 |
+
delta_offset_(0),
|
| 174 |
+
byte_width_(-1),
|
| 175 |
+
indices_builder_(pool, alignment),
|
| 176 |
+
value_type_(value_type) {}
|
| 177 |
+
|
| 178 |
+
template <typename T1 = T>
|
| 179 |
+
explicit DictionaryBuilderBase(
|
| 180 |
+
const std::shared_ptr<DataType>& index_type,
|
| 181 |
+
enable_if_t<!is_fixed_size_binary_type<T1>::value, const std::shared_ptr<DataType>&>
|
| 182 |
+
value_type,
|
| 183 |
+
MemoryPool* pool = default_memory_pool(),
|
| 184 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 185 |
+
: ArrayBuilder(pool, alignment),
|
| 186 |
+
memo_table_(new internal::DictionaryMemoTable(pool, value_type)),
|
| 187 |
+
delta_offset_(0),
|
| 188 |
+
byte_width_(-1),
|
| 189 |
+
indices_builder_(index_type, pool, alignment),
|
| 190 |
+
value_type_(value_type) {}
|
| 191 |
+
|
| 192 |
+
template <typename B = BuilderType, typename T1 = T>
|
| 193 |
+
DictionaryBuilderBase(uint8_t start_int_size,
|
| 194 |
+
enable_if_t<std::is_base_of<AdaptiveIntBuilderBase, B>::value &&
|
| 195 |
+
is_fixed_size_binary_type<T1>::value,
|
| 196 |
+
const std::shared_ptr<DataType>&>
|
| 197 |
+
value_type,
|
| 198 |
+
MemoryPool* pool = default_memory_pool(),
|
| 199 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 200 |
+
: ArrayBuilder(pool, alignment),
|
| 201 |
+
memo_table_(new internal::DictionaryMemoTable(pool, value_type)),
|
| 202 |
+
delta_offset_(0),
|
| 203 |
+
byte_width_(static_cast<const T1&>(*value_type).byte_width()),
|
| 204 |
+
indices_builder_(start_int_size, pool, alignment),
|
| 205 |
+
value_type_(value_type) {}
|
| 206 |
+
|
| 207 |
+
template <typename T1 = T>
|
| 208 |
+
explicit DictionaryBuilderBase(
|
| 209 |
+
enable_if_fixed_size_binary<T1, const std::shared_ptr<DataType>&> value_type,
|
| 210 |
+
MemoryPool* pool = default_memory_pool(),
|
| 211 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 212 |
+
: ArrayBuilder(pool, alignment),
|
| 213 |
+
memo_table_(new internal::DictionaryMemoTable(pool, value_type)),
|
| 214 |
+
delta_offset_(0),
|
| 215 |
+
byte_width_(static_cast<const T1&>(*value_type).byte_width()),
|
| 216 |
+
indices_builder_(pool, alignment),
|
| 217 |
+
value_type_(value_type) {}
|
| 218 |
+
|
| 219 |
+
template <typename T1 = T>
|
| 220 |
+
explicit DictionaryBuilderBase(
|
| 221 |
+
const std::shared_ptr<DataType>& index_type,
|
| 222 |
+
enable_if_fixed_size_binary<T1, const std::shared_ptr<DataType>&> value_type,
|
| 223 |
+
MemoryPool* pool = default_memory_pool(),
|
| 224 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 225 |
+
: ArrayBuilder(pool, alignment),
|
| 226 |
+
memo_table_(new internal::DictionaryMemoTable(pool, value_type)),
|
| 227 |
+
delta_offset_(0),
|
| 228 |
+
byte_width_(static_cast<const T1&>(*value_type).byte_width()),
|
| 229 |
+
indices_builder_(index_type, pool, alignment),
|
| 230 |
+
value_type_(value_type) {}
|
| 231 |
+
|
| 232 |
+
template <typename T1 = T>
|
| 233 |
+
explicit DictionaryBuilderBase(
|
| 234 |
+
enable_if_parameter_free<T1, MemoryPool*> pool = default_memory_pool())
|
| 235 |
+
: DictionaryBuilderBase<BuilderType, T1>(TypeTraits<T1>::type_singleton(), pool) {}
|
| 236 |
+
|
| 237 |
+
// This constructor doesn't check for errors. Use InsertMemoValues instead.
|
| 238 |
+
explicit DictionaryBuilderBase(const std::shared_ptr<Array>& dictionary,
|
| 239 |
+
MemoryPool* pool = default_memory_pool(),
|
| 240 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 241 |
+
: ArrayBuilder(pool, alignment),
|
| 242 |
+
memo_table_(new internal::DictionaryMemoTable(pool, dictionary)),
|
| 243 |
+
delta_offset_(0),
|
| 244 |
+
byte_width_(-1),
|
| 245 |
+
indices_builder_(pool, alignment),
|
| 246 |
+
value_type_(dictionary->type()) {}
|
| 247 |
+
|
| 248 |
+
~DictionaryBuilderBase() override = default;
|
| 249 |
+
|
| 250 |
+
/// \brief The current number of entries in the dictionary
|
| 251 |
+
int64_t dictionary_length() const { return memo_table_->size(); }
|
| 252 |
+
|
| 253 |
+
/// \brief The value byte width (for FixedSizeBinaryType)
|
| 254 |
+
template <typename T1 = T>
|
| 255 |
+
enable_if_fixed_size_binary<T1, int32_t> byte_width() const {
|
| 256 |
+
return byte_width_;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
/// \brief Append a scalar value
|
| 260 |
+
Status Append(Value value) {
|
| 261 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 262 |
+
|
| 263 |
+
int32_t memo_index;
|
| 264 |
+
ARROW_RETURN_NOT_OK(memo_table_->GetOrInsert<T>(value, &memo_index));
|
| 265 |
+
ARROW_RETURN_NOT_OK(indices_builder_.Append(memo_index));
|
| 266 |
+
length_ += 1;
|
| 267 |
+
|
| 268 |
+
return Status::OK();
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
/// \brief Append a fixed-width string (only for FixedSizeBinaryType)
|
| 272 |
+
template <typename T1 = T>
|
| 273 |
+
enable_if_fixed_size_binary<T1, Status> Append(const uint8_t* value) {
|
| 274 |
+
return Append(std::string_view(reinterpret_cast<const char*>(value), byte_width_));
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
/// \brief Append a fixed-width string (only for FixedSizeBinaryType)
|
| 278 |
+
template <typename T1 = T>
|
| 279 |
+
enable_if_fixed_size_binary<T1, Status> Append(const char* value) {
|
| 280 |
+
return Append(std::string_view(value, byte_width_));
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
/// \brief Append a string (only for binary types)
|
| 284 |
+
template <typename T1 = T>
|
| 285 |
+
enable_if_binary_like<T1, Status> Append(const uint8_t* value, int32_t length) {
|
| 286 |
+
return Append(reinterpret_cast<const char*>(value), length);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
/// \brief Append a string (only for binary types)
|
| 290 |
+
template <typename T1 = T>
|
| 291 |
+
enable_if_binary_like<T1, Status> Append(const char* value, int32_t length) {
|
| 292 |
+
return Append(std::string_view(value, length));
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
/// \brief Append a string (only for string types)
|
| 296 |
+
template <typename T1 = T>
|
| 297 |
+
enable_if_string_like<T1, Status> Append(const char* value, int32_t length) {
|
| 298 |
+
return Append(std::string_view(value, length));
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
/// \brief Append a decimal (only for Decimal32/64/128/256 Type)
|
| 302 |
+
template <typename T1 = T, typename CType = typename TypeTraits<T1>::CType>
|
| 303 |
+
enable_if_decimal<T1, Status> Append(const CType& value) {
|
| 304 |
+
auto bytes = value.ToBytes();
|
| 305 |
+
return Append(bytes.data(), static_cast<int32_t>(bytes.size()));
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
/// \brief Append a scalar null value
|
| 309 |
+
Status AppendNull() final {
|
| 310 |
+
length_ += 1;
|
| 311 |
+
null_count_ += 1;
|
| 312 |
+
|
| 313 |
+
return indices_builder_.AppendNull();
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
Status AppendNulls(int64_t length) final {
|
| 317 |
+
length_ += length;
|
| 318 |
+
null_count_ += length;
|
| 319 |
+
|
| 320 |
+
return indices_builder_.AppendNulls(length);
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
Status AppendEmptyValue() final {
|
| 324 |
+
length_ += 1;
|
| 325 |
+
|
| 326 |
+
return indices_builder_.AppendEmptyValue();
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 330 |
+
length_ += length;
|
| 331 |
+
|
| 332 |
+
return indices_builder_.AppendEmptyValues(length);
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
Status AppendScalar(const Scalar& scalar, int64_t n_repeats) override {
|
| 336 |
+
if (!scalar.is_valid) return AppendNulls(n_repeats);
|
| 337 |
+
|
| 338 |
+
const auto& dict_ty = internal::checked_cast<const DictionaryType&>(*scalar.type);
|
| 339 |
+
const DictionaryScalar& dict_scalar =
|
| 340 |
+
internal::checked_cast<const DictionaryScalar&>(scalar);
|
| 341 |
+
const auto& dict = internal::checked_cast<const typename TypeTraits<T>::ArrayType&>(
|
| 342 |
+
*dict_scalar.value.dictionary);
|
| 343 |
+
ARROW_RETURN_NOT_OK(Reserve(n_repeats));
|
| 344 |
+
switch (dict_ty.index_type()->id()) {
|
| 345 |
+
case Type::UINT8:
|
| 346 |
+
return AppendScalarImpl<UInt8Type>(dict, *dict_scalar.value.index, n_repeats);
|
| 347 |
+
case Type::INT8:
|
| 348 |
+
return AppendScalarImpl<Int8Type>(dict, *dict_scalar.value.index, n_repeats);
|
| 349 |
+
case Type::UINT16:
|
| 350 |
+
return AppendScalarImpl<UInt16Type>(dict, *dict_scalar.value.index, n_repeats);
|
| 351 |
+
case Type::INT16:
|
| 352 |
+
return AppendScalarImpl<Int16Type>(dict, *dict_scalar.value.index, n_repeats);
|
| 353 |
+
case Type::UINT32:
|
| 354 |
+
return AppendScalarImpl<UInt32Type>(dict, *dict_scalar.value.index, n_repeats);
|
| 355 |
+
case Type::INT32:
|
| 356 |
+
return AppendScalarImpl<Int32Type>(dict, *dict_scalar.value.index, n_repeats);
|
| 357 |
+
case Type::UINT64:
|
| 358 |
+
return AppendScalarImpl<UInt64Type>(dict, *dict_scalar.value.index, n_repeats);
|
| 359 |
+
case Type::INT64:
|
| 360 |
+
return AppendScalarImpl<Int64Type>(dict, *dict_scalar.value.index, n_repeats);
|
| 361 |
+
default:
|
| 362 |
+
return Status::TypeError("Invalid index type: ", dict_ty);
|
| 363 |
+
}
|
| 364 |
+
return Status::OK();
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
Status AppendScalars(const ScalarVector& scalars) override {
|
| 368 |
+
for (const auto& scalar : scalars) {
|
| 369 |
+
ARROW_RETURN_NOT_OK(AppendScalar(*scalar, /*n_repeats=*/1));
|
| 370 |
+
}
|
| 371 |
+
return Status::OK();
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset, int64_t length) final {
|
| 375 |
+
// Visit the indices and insert the unpacked values.
|
| 376 |
+
const auto& dict_ty = internal::checked_cast<const DictionaryType&>(*array.type);
|
| 377 |
+
// See if possible to avoid using ToArrayData here
|
| 378 |
+
const typename TypeTraits<T>::ArrayType dict(array.dictionary().ToArrayData());
|
| 379 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 380 |
+
switch (dict_ty.index_type()->id()) {
|
| 381 |
+
case Type::UINT8:
|
| 382 |
+
return AppendArraySliceImpl<uint8_t>(dict, array, offset, length);
|
| 383 |
+
case Type::INT8:
|
| 384 |
+
return AppendArraySliceImpl<int8_t>(dict, array, offset, length);
|
| 385 |
+
case Type::UINT16:
|
| 386 |
+
return AppendArraySliceImpl<uint16_t>(dict, array, offset, length);
|
| 387 |
+
case Type::INT16:
|
| 388 |
+
return AppendArraySliceImpl<int16_t>(dict, array, offset, length);
|
| 389 |
+
case Type::UINT32:
|
| 390 |
+
return AppendArraySliceImpl<uint32_t>(dict, array, offset, length);
|
| 391 |
+
case Type::INT32:
|
| 392 |
+
return AppendArraySliceImpl<int32_t>(dict, array, offset, length);
|
| 393 |
+
case Type::UINT64:
|
| 394 |
+
return AppendArraySliceImpl<uint64_t>(dict, array, offset, length);
|
| 395 |
+
case Type::INT64:
|
| 396 |
+
return AppendArraySliceImpl<int64_t>(dict, array, offset, length);
|
| 397 |
+
default:
|
| 398 |
+
return Status::TypeError("Invalid index type: ", dict_ty);
|
| 399 |
+
}
|
| 400 |
+
return Status::OK();
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
/// \brief Insert values into the dictionary's memo, but do not append any
|
| 404 |
+
/// indices. Can be used to initialize a new builder with known dictionary
|
| 405 |
+
/// values
|
| 406 |
+
/// \param[in] values dictionary values to add to memo. Type must match
|
| 407 |
+
/// builder type
|
| 408 |
+
Status InsertMemoValues(const Array& values) {
|
| 409 |
+
return memo_table_->InsertValues(values);
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
/// \brief Append a whole dense array to the builder
|
| 413 |
+
template <typename T1 = T>
|
| 414 |
+
enable_if_t<!is_fixed_size_binary_type<T1>::value, Status> AppendArray(
|
| 415 |
+
const Array& array) {
|
| 416 |
+
using ArrayType = typename TypeTraits<T>::ArrayType;
|
| 417 |
+
|
| 418 |
+
#ifndef NDEBUG
|
| 419 |
+
ARROW_RETURN_NOT_OK(ArrayBuilder::CheckArrayType(
|
| 420 |
+
value_type_, array, "Wrong value type of array to be appended"));
|
| 421 |
+
#endif
|
| 422 |
+
|
| 423 |
+
const auto& concrete_array = static_cast<const ArrayType&>(array);
|
| 424 |
+
for (int64_t i = 0; i < array.length(); i++) {
|
| 425 |
+
if (array.IsNull(i)) {
|
| 426 |
+
ARROW_RETURN_NOT_OK(AppendNull());
|
| 427 |
+
} else {
|
| 428 |
+
ARROW_RETURN_NOT_OK(Append(concrete_array.GetView(i)));
|
| 429 |
+
}
|
| 430 |
+
}
|
| 431 |
+
return Status::OK();
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
template <typename T1 = T>
|
| 435 |
+
enable_if_fixed_size_binary<T1, Status> AppendArray(const Array& array) {
|
| 436 |
+
#ifndef NDEBUG
|
| 437 |
+
ARROW_RETURN_NOT_OK(ArrayBuilder::CheckArrayType(
|
| 438 |
+
value_type_, array, "Wrong value type of array to be appended"));
|
| 439 |
+
#endif
|
| 440 |
+
|
| 441 |
+
const auto& concrete_array = static_cast<const FixedSizeBinaryArray&>(array);
|
| 442 |
+
for (int64_t i = 0; i < array.length(); i++) {
|
| 443 |
+
if (array.IsNull(i)) {
|
| 444 |
+
ARROW_RETURN_NOT_OK(AppendNull());
|
| 445 |
+
} else {
|
| 446 |
+
ARROW_RETURN_NOT_OK(Append(concrete_array.GetValue(i)));
|
| 447 |
+
}
|
| 448 |
+
}
|
| 449 |
+
return Status::OK();
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
void Reset() override {
|
| 453 |
+
// Perform a partial reset. Call ResetFull to also reset the accumulated
|
| 454 |
+
// dictionary values
|
| 455 |
+
ArrayBuilder::Reset();
|
| 456 |
+
indices_builder_.Reset();
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
/// \brief Reset and also clear accumulated dictionary values in memo table
|
| 460 |
+
void ResetFull() {
|
| 461 |
+
Reset();
|
| 462 |
+
memo_table_.reset(new internal::DictionaryMemoTable(pool_, value_type_));
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
Status Resize(int64_t capacity) override {
|
| 466 |
+
ARROW_RETURN_NOT_OK(CheckCapacity(capacity));
|
| 467 |
+
capacity = std::max(capacity, kMinBuilderCapacity);
|
| 468 |
+
ARROW_RETURN_NOT_OK(indices_builder_.Resize(capacity));
|
| 469 |
+
capacity_ = indices_builder_.capacity();
|
| 470 |
+
return Status::OK();
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
/// \brief Return dictionary indices and a delta dictionary since the last
|
| 474 |
+
/// time that Finish or FinishDelta were called, and reset state of builder
|
| 475 |
+
/// (except the memo table)
|
| 476 |
+
Status FinishDelta(std::shared_ptr<Array>* out_indices,
|
| 477 |
+
std::shared_ptr<Array>* out_delta) {
|
| 478 |
+
std::shared_ptr<ArrayData> indices_data;
|
| 479 |
+
std::shared_ptr<ArrayData> delta_data;
|
| 480 |
+
ARROW_RETURN_NOT_OK(FinishWithDictOffset(delta_offset_, &indices_data, &delta_data));
|
| 481 |
+
*out_indices = MakeArray(indices_data);
|
| 482 |
+
*out_delta = MakeArray(delta_data);
|
| 483 |
+
return Status::OK();
|
| 484 |
+
}
|
| 485 |
+
|
| 486 |
+
/// \cond FALSE
|
| 487 |
+
using ArrayBuilder::Finish;
|
| 488 |
+
/// \endcond
|
| 489 |
+
|
| 490 |
+
Status Finish(std::shared_ptr<DictionaryArray>* out) { return FinishTyped(out); }
|
| 491 |
+
|
| 492 |
+
std::shared_ptr<DataType> type() const override {
|
| 493 |
+
return ::arrow::dictionary(indices_builder_.type(), value_type_);
|
| 494 |
+
}
|
| 495 |
+
|
| 496 |
+
protected:
|
| 497 |
+
template <typename c_type>
|
| 498 |
+
Status AppendArraySliceImpl(const typename TypeTraits<T>::ArrayType& dict,
|
| 499 |
+
const ArraySpan& array, int64_t offset, int64_t length) {
|
| 500 |
+
const c_type* values = array.GetValues<c_type>(1) + offset;
|
| 501 |
+
return VisitBitBlocks(
|
| 502 |
+
array.buffers[0].data, array.offset + offset, length,
|
| 503 |
+
[&](const int64_t position) {
|
| 504 |
+
const int64_t index = static_cast<int64_t>(values[position]);
|
| 505 |
+
if (dict.IsValid(index)) {
|
| 506 |
+
return Append(dict.GetView(index));
|
| 507 |
+
}
|
| 508 |
+
return AppendNull();
|
| 509 |
+
},
|
| 510 |
+
[&]() { return AppendNull(); });
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
template <typename IndexType>
|
| 514 |
+
Status AppendScalarImpl(const typename TypeTraits<T>::ArrayType& dict,
|
| 515 |
+
const Scalar& index_scalar, int64_t n_repeats) {
|
| 516 |
+
using ScalarType = typename TypeTraits<IndexType>::ScalarType;
|
| 517 |
+
const auto index = internal::checked_cast<const ScalarType&>(index_scalar).value;
|
| 518 |
+
if (index_scalar.is_valid && dict.IsValid(index)) {
|
| 519 |
+
const auto& value = dict.GetView(index);
|
| 520 |
+
for (int64_t i = 0; i < n_repeats; i++) {
|
| 521 |
+
ARROW_RETURN_NOT_OK(Append(value));
|
| 522 |
+
}
|
| 523 |
+
return Status::OK();
|
| 524 |
+
}
|
| 525 |
+
return AppendNulls(n_repeats);
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override {
|
| 529 |
+
std::shared_ptr<ArrayData> dictionary;
|
| 530 |
+
ARROW_RETURN_NOT_OK(FinishWithDictOffset(/*offset=*/0, out, &dictionary));
|
| 531 |
+
|
| 532 |
+
// Set type of array data to the right dictionary type
|
| 533 |
+
(*out)->type = type();
|
| 534 |
+
(*out)->dictionary = dictionary;
|
| 535 |
+
return Status::OK();
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
Status FinishWithDictOffset(int64_t dict_offset,
|
| 539 |
+
std::shared_ptr<ArrayData>* out_indices,
|
| 540 |
+
std::shared_ptr<ArrayData>* out_dictionary) {
|
| 541 |
+
// Finalize indices array
|
| 542 |
+
ARROW_RETURN_NOT_OK(indices_builder_.FinishInternal(out_indices));
|
| 543 |
+
|
| 544 |
+
// Generate dictionary array from hash table contents
|
| 545 |
+
ARROW_RETURN_NOT_OK(memo_table_->GetArrayData(dict_offset, out_dictionary));
|
| 546 |
+
delta_offset_ = memo_table_->size();
|
| 547 |
+
|
| 548 |
+
// Update internals for further uses of this DictionaryBuilder
|
| 549 |
+
ArrayBuilder::Reset();
|
| 550 |
+
return Status::OK();
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
std::unique_ptr<DictionaryMemoTable> memo_table_;
|
| 554 |
+
|
| 555 |
+
// The size of the dictionary memo at last invocation of Finish, to use in
|
| 556 |
+
// FinishDelta for computing dictionary deltas
|
| 557 |
+
int32_t delta_offset_;
|
| 558 |
+
|
| 559 |
+
// Only used for FixedSizeBinaryType
|
| 560 |
+
int32_t byte_width_;
|
| 561 |
+
|
| 562 |
+
BuilderType indices_builder_;
|
| 563 |
+
std::shared_ptr<DataType> value_type_;
|
| 564 |
+
};
|
| 565 |
+
|
| 566 |
+
template <typename BuilderType>
|
| 567 |
+
class DictionaryBuilderBase<BuilderType, NullType> : public ArrayBuilder {
|
| 568 |
+
public:
|
| 569 |
+
template <typename B = BuilderType>
|
| 570 |
+
DictionaryBuilderBase(
|
| 571 |
+
enable_if_t<std::is_base_of<AdaptiveIntBuilderBase, B>::value, uint8_t>
|
| 572 |
+
start_int_size,
|
| 573 |
+
const std::shared_ptr<DataType>& value_type,
|
| 574 |
+
MemoryPool* pool = default_memory_pool())
|
| 575 |
+
: ArrayBuilder(pool), indices_builder_(start_int_size, pool) {}
|
| 576 |
+
|
| 577 |
+
explicit DictionaryBuilderBase(const std::shared_ptr<DataType>& value_type,
|
| 578 |
+
MemoryPool* pool = default_memory_pool())
|
| 579 |
+
: ArrayBuilder(pool), indices_builder_(pool) {}
|
| 580 |
+
|
| 581 |
+
explicit DictionaryBuilderBase(const std::shared_ptr<DataType>& index_type,
|
| 582 |
+
const std::shared_ptr<DataType>& value_type,
|
| 583 |
+
MemoryPool* pool = default_memory_pool())
|
| 584 |
+
: ArrayBuilder(pool), indices_builder_(index_type, pool) {}
|
| 585 |
+
|
| 586 |
+
template <typename B = BuilderType>
|
| 587 |
+
explicit DictionaryBuilderBase(
|
| 588 |
+
enable_if_t<std::is_base_of<AdaptiveIntBuilderBase, B>::value, uint8_t>
|
| 589 |
+
start_int_size,
|
| 590 |
+
MemoryPool* pool = default_memory_pool())
|
| 591 |
+
: ArrayBuilder(pool), indices_builder_(start_int_size, pool) {}
|
| 592 |
+
|
| 593 |
+
explicit DictionaryBuilderBase(MemoryPool* pool = default_memory_pool())
|
| 594 |
+
: ArrayBuilder(pool), indices_builder_(pool) {}
|
| 595 |
+
|
| 596 |
+
explicit DictionaryBuilderBase(const std::shared_ptr<Array>& dictionary,
|
| 597 |
+
MemoryPool* pool = default_memory_pool())
|
| 598 |
+
: ArrayBuilder(pool), indices_builder_(pool) {}
|
| 599 |
+
|
| 600 |
+
/// \brief Append a scalar null value
|
| 601 |
+
Status AppendNull() final {
|
| 602 |
+
length_ += 1;
|
| 603 |
+
null_count_ += 1;
|
| 604 |
+
|
| 605 |
+
return indices_builder_.AppendNull();
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
Status AppendNulls(int64_t length) final {
|
| 609 |
+
length_ += length;
|
| 610 |
+
null_count_ += length;
|
| 611 |
+
|
| 612 |
+
return indices_builder_.AppendNulls(length);
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
Status AppendEmptyValue() final {
|
| 616 |
+
length_ += 1;
|
| 617 |
+
|
| 618 |
+
return indices_builder_.AppendEmptyValue();
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 622 |
+
length_ += length;
|
| 623 |
+
|
| 624 |
+
return indices_builder_.AppendEmptyValues(length);
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
/// \brief Append a whole dense array to the builder
|
| 628 |
+
Status AppendArray(const Array& array) {
|
| 629 |
+
#ifndef NDEBUG
|
| 630 |
+
ARROW_RETURN_NOT_OK(ArrayBuilder::CheckArrayType(
|
| 631 |
+
Type::NA, array, "Wrong value type of array to be appended"));
|
| 632 |
+
#endif
|
| 633 |
+
for (int64_t i = 0; i < array.length(); i++) {
|
| 634 |
+
ARROW_RETURN_NOT_OK(AppendNull());
|
| 635 |
+
}
|
| 636 |
+
return Status::OK();
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
Status Resize(int64_t capacity) override {
|
| 640 |
+
ARROW_RETURN_NOT_OK(CheckCapacity(capacity));
|
| 641 |
+
capacity = std::max(capacity, kMinBuilderCapacity);
|
| 642 |
+
|
| 643 |
+
ARROW_RETURN_NOT_OK(indices_builder_.Resize(capacity));
|
| 644 |
+
capacity_ = indices_builder_.capacity();
|
| 645 |
+
return Status::OK();
|
| 646 |
+
}
|
| 647 |
+
|
| 648 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override {
|
| 649 |
+
ARROW_RETURN_NOT_OK(indices_builder_.FinishInternal(out));
|
| 650 |
+
(*out)->type = dictionary((*out)->type, null());
|
| 651 |
+
(*out)->dictionary = NullArray(0).data();
|
| 652 |
+
return Status::OK();
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
/// \cond FALSE
|
| 656 |
+
using ArrayBuilder::Finish;
|
| 657 |
+
/// \endcond
|
| 658 |
+
|
| 659 |
+
Status Finish(std::shared_ptr<DictionaryArray>* out) { return FinishTyped(out); }
|
| 660 |
+
|
| 661 |
+
std::shared_ptr<DataType> type() const override {
|
| 662 |
+
return ::arrow::dictionary(indices_builder_.type(), null());
|
| 663 |
+
}
|
| 664 |
+
|
| 665 |
+
protected:
|
| 666 |
+
BuilderType indices_builder_;
|
| 667 |
+
};
|
| 668 |
+
|
| 669 |
+
} // namespace internal
|
| 670 |
+
|
| 671 |
+
/// \brief A DictionaryArray builder that uses AdaptiveIntBuilder to return the
|
| 672 |
+
/// smallest index size that can accommodate the dictionary indices
|
| 673 |
+
template <typename T>
|
| 674 |
+
class DictionaryBuilder : public internal::DictionaryBuilderBase<AdaptiveIntBuilder, T> {
|
| 675 |
+
public:
|
| 676 |
+
using BASE = internal::DictionaryBuilderBase<AdaptiveIntBuilder, T>;
|
| 677 |
+
using BASE::BASE;
|
| 678 |
+
|
| 679 |
+
/// \brief Append dictionary indices directly without modifying memo
|
| 680 |
+
///
|
| 681 |
+
/// NOTE: Experimental API
|
| 682 |
+
Status AppendIndices(const int64_t* values, int64_t length,
|
| 683 |
+
const uint8_t* valid_bytes = NULLPTR) {
|
| 684 |
+
int64_t null_count_before = this->indices_builder_.null_count();
|
| 685 |
+
ARROW_RETURN_NOT_OK(this->indices_builder_.AppendValues(values, length, valid_bytes));
|
| 686 |
+
this->capacity_ = this->indices_builder_.capacity();
|
| 687 |
+
this->length_ += length;
|
| 688 |
+
this->null_count_ += this->indices_builder_.null_count() - null_count_before;
|
| 689 |
+
return Status::OK();
|
| 690 |
+
}
|
| 691 |
+
};
|
| 692 |
+
|
| 693 |
+
/// \brief A DictionaryArray builder that always returns int32 dictionary
|
| 694 |
+
/// indices so that data cast to dictionary form will have a consistent index
|
| 695 |
+
/// type, e.g. for creating a ChunkedArray
|
| 696 |
+
template <typename T>
|
| 697 |
+
class Dictionary32Builder : public internal::DictionaryBuilderBase<Int32Builder, T> {
|
| 698 |
+
public:
|
| 699 |
+
using BASE = internal::DictionaryBuilderBase<Int32Builder, T>;
|
| 700 |
+
using BASE::BASE;
|
| 701 |
+
|
| 702 |
+
/// \brief Append dictionary indices directly without modifying memo
|
| 703 |
+
///
|
| 704 |
+
/// NOTE: Experimental API
|
| 705 |
+
Status AppendIndices(const int32_t* values, int64_t length,
|
| 706 |
+
const uint8_t* valid_bytes = NULLPTR) {
|
| 707 |
+
int64_t null_count_before = this->indices_builder_.null_count();
|
| 708 |
+
ARROW_RETURN_NOT_OK(this->indices_builder_.AppendValues(values, length, valid_bytes));
|
| 709 |
+
this->capacity_ = this->indices_builder_.capacity();
|
| 710 |
+
this->length_ += length;
|
| 711 |
+
this->null_count_ += this->indices_builder_.null_count() - null_count_before;
|
| 712 |
+
return Status::OK();
|
| 713 |
+
}
|
| 714 |
+
};
|
| 715 |
+
|
| 716 |
+
// ----------------------------------------------------------------------
|
| 717 |
+
// Binary / Unicode builders
|
| 718 |
+
// (compatibility aliases; those used to be derived classes with additional
|
| 719 |
+
// Append() overloads, but they have been folded into DictionaryBuilderBase)
|
| 720 |
+
|
| 721 |
+
using BinaryDictionaryBuilder = DictionaryBuilder<BinaryType>;
|
| 722 |
+
using StringDictionaryBuilder = DictionaryBuilder<StringType>;
|
| 723 |
+
using BinaryDictionary32Builder = Dictionary32Builder<BinaryType>;
|
| 724 |
+
using StringDictionary32Builder = Dictionary32Builder<StringType>;
|
| 725 |
+
|
| 726 |
+
/// @}
|
| 727 |
+
|
| 728 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_nested.h
ADDED
|
@@ -0,0 +1,836 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <limits>
|
| 22 |
+
#include <memory>
|
| 23 |
+
#include <utility>
|
| 24 |
+
#include <vector>
|
| 25 |
+
|
| 26 |
+
#include "arrow/array/array_nested.h"
|
| 27 |
+
#include "arrow/array/builder_base.h"
|
| 28 |
+
#include "arrow/array/data.h"
|
| 29 |
+
#include "arrow/buffer.h"
|
| 30 |
+
#include "arrow/buffer_builder.h"
|
| 31 |
+
#include "arrow/status.h"
|
| 32 |
+
#include "arrow/type.h"
|
| 33 |
+
#include "arrow/util/macros.h"
|
| 34 |
+
#include "arrow/util/visibility.h"
|
| 35 |
+
|
| 36 |
+
namespace arrow {
|
| 37 |
+
|
| 38 |
+
/// \addtogroup nested-builders
|
| 39 |
+
///
|
| 40 |
+
/// @{
|
| 41 |
+
|
| 42 |
+
// ----------------------------------------------------------------------
|
| 43 |
+
// VarLengthListLikeBuilder
|
| 44 |
+
|
| 45 |
+
template <typename TYPE>
|
| 46 |
+
class VarLengthListLikeBuilder : public ArrayBuilder {
|
| 47 |
+
public:
|
| 48 |
+
using TypeClass = TYPE;
|
| 49 |
+
using offset_type = typename TypeClass::offset_type;
|
| 50 |
+
|
| 51 |
+
/// Use this constructor to incrementally build the value array along with offsets and
|
| 52 |
+
/// null bitmap.
|
| 53 |
+
VarLengthListLikeBuilder(MemoryPool* pool,
|
| 54 |
+
const std::shared_ptr<ArrayBuilder>& value_builder,
|
| 55 |
+
const std::shared_ptr<DataType>& type,
|
| 56 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 57 |
+
: ArrayBuilder(pool, alignment),
|
| 58 |
+
offsets_builder_(pool, alignment),
|
| 59 |
+
value_builder_(value_builder),
|
| 60 |
+
value_field_(type->field(0)->WithType(NULLPTR)) {}
|
| 61 |
+
|
| 62 |
+
VarLengthListLikeBuilder(MemoryPool* pool,
|
| 63 |
+
const std::shared_ptr<ArrayBuilder>& value_builder,
|
| 64 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 65 |
+
: VarLengthListLikeBuilder(pool, value_builder,
|
| 66 |
+
std::make_shared<TYPE>(value_builder->type()),
|
| 67 |
+
alignment) {}
|
| 68 |
+
|
| 69 |
+
~VarLengthListLikeBuilder() override = default;
|
| 70 |
+
|
| 71 |
+
Status Resize(int64_t capacity) override {
|
| 72 |
+
if (ARROW_PREDICT_FALSE(capacity > maximum_elements())) {
|
| 73 |
+
return Status::CapacityError(type_name(),
|
| 74 |
+
" array cannot reserve space for more than ",
|
| 75 |
+
maximum_elements(), " got ", capacity);
|
| 76 |
+
}
|
| 77 |
+
ARROW_RETURN_NOT_OK(CheckCapacity(capacity));
|
| 78 |
+
|
| 79 |
+
// One more than requested for list offsets
|
| 80 |
+
const int64_t offsets_capacity =
|
| 81 |
+
is_list_view(TYPE::type_id) ? capacity : capacity + 1;
|
| 82 |
+
ARROW_RETURN_NOT_OK(offsets_builder_.Resize(offsets_capacity));
|
| 83 |
+
return ArrayBuilder::Resize(capacity);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
void Reset() override {
|
| 87 |
+
ArrayBuilder::Reset();
|
| 88 |
+
offsets_builder_.Reset();
|
| 89 |
+
value_builder_->Reset();
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
/// \brief Start a new variable-length list slot
|
| 93 |
+
///
|
| 94 |
+
/// This function should be called before appending elements to the
|
| 95 |
+
/// value builder. Elements appended to the value builder before this function
|
| 96 |
+
/// is called for the first time, will not be members of any list value.
|
| 97 |
+
///
|
| 98 |
+
/// After this function is called, list_length elements SHOULD be appended to
|
| 99 |
+
/// the values builder. If this contract is violated, the behavior is defined by
|
| 100 |
+
/// the concrete builder implementation and SHOULD NOT be relied upon unless
|
| 101 |
+
/// the caller is specifically building a [Large]List or [Large]ListView array.
|
| 102 |
+
///
|
| 103 |
+
/// For [Large]List arrays, the list slot length will be the number of elements
|
| 104 |
+
/// appended to the values builder before the next call to Append* or Finish. For
|
| 105 |
+
/// [Large]ListView arrays, the list slot length will be exactly list_length, but if
|
| 106 |
+
/// Append* is called before at least list_length elements are appended to the values
|
| 107 |
+
/// builder, the current list slot will share elements with the next list
|
| 108 |
+
/// slots or an invalid [Large]ListView array will be generated because there
|
| 109 |
+
/// aren't enough elements in the values builder to fill the list slots.
|
| 110 |
+
///
|
| 111 |
+
/// If you're building a [Large]List and don't need to be compatible
|
| 112 |
+
/// with [Large]ListView, then `BaseListBuilder::Append(bool is_valid)`
|
| 113 |
+
/// is a simpler API.
|
| 114 |
+
///
|
| 115 |
+
/// \pre if is_valid is false, list_length MUST be 0
|
| 116 |
+
/// \param is_valid Whether the new list slot is valid
|
| 117 |
+
/// \param list_length The number of elements in the list
|
| 118 |
+
Status Append(bool is_valid, int64_t list_length) {
|
| 119 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 120 |
+
assert(is_valid || list_length == 0);
|
| 121 |
+
UnsafeAppendToBitmap(is_valid);
|
| 122 |
+
UnsafeAppendDimensions(/*offset=*/value_builder_->length(), /*size=*/list_length);
|
| 123 |
+
return Status::OK();
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
Status AppendNull() final {
|
| 127 |
+
// Append() a null list slot with list_length=0.
|
| 128 |
+
//
|
| 129 |
+
// When building [Large]List arrays, elements being appended to the values builder
|
| 130 |
+
// before the next call to Append* or Finish will extend the list slot length, but
|
| 131 |
+
// that is totally fine because list arrays admit non-empty null list slots.
|
| 132 |
+
//
|
| 133 |
+
// In the case of [Large]ListViews that's not a problem either because the
|
| 134 |
+
// list slot length remains zero.
|
| 135 |
+
return Append(false, 0);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
Status AppendNulls(int64_t length) final {
|
| 139 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 140 |
+
UnsafeAppendToBitmap(length, false);
|
| 141 |
+
UnsafeAppendEmptyDimensions(/*num_values=*/length);
|
| 142 |
+
return Status::OK();
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
/// \brief Append an empty list slot
|
| 146 |
+
///
|
| 147 |
+
/// \post Another call to Append* or Finish should be made before appending to
|
| 148 |
+
/// the values builder to ensure list slot remains empty
|
| 149 |
+
Status AppendEmptyValue() final { return Append(true, 0); }
|
| 150 |
+
|
| 151 |
+
/// \brief Append an empty list slot
|
| 152 |
+
///
|
| 153 |
+
/// \post Another call to Append* or Finish should be made before appending to
|
| 154 |
+
/// the values builder to ensure the last list slot remains empty
|
| 155 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 156 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 157 |
+
UnsafeAppendToBitmap(length, true);
|
| 158 |
+
UnsafeAppendEmptyDimensions(/*num_values=*/length);
|
| 159 |
+
return Status::OK();
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/// \brief Vector append
|
| 163 |
+
///
|
| 164 |
+
/// For list-array builders, the sizes are inferred from the offsets.
|
| 165 |
+
/// BaseListBuilder<T> provides an implementation that doesn't take sizes, but
|
| 166 |
+
/// this virtual function allows dispatching calls to both list-array and
|
| 167 |
+
/// list-view-array builders (which need the sizes)
|
| 168 |
+
///
|
| 169 |
+
/// \param offsets The offsets of the variable-length lists
|
| 170 |
+
/// \param sizes The sizes of the variable-length lists
|
| 171 |
+
/// \param length The number of offsets, sizes, and validity bits to append
|
| 172 |
+
/// \param valid_bytes If passed, valid_bytes is of equal length to values,
|
| 173 |
+
/// and any zero byte will be considered as a null for that slot
|
| 174 |
+
virtual Status AppendValues(const offset_type* offsets, const offset_type* sizes,
|
| 175 |
+
int64_t length, const uint8_t* valid_bytes) = 0;
|
| 176 |
+
|
| 177 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 178 |
+
int64_t length) override {
|
| 179 |
+
const offset_type* offsets = array.GetValues<offset_type>(1);
|
| 180 |
+
[[maybe_unused]] const offset_type* sizes = NULLPTR;
|
| 181 |
+
if constexpr (is_list_view(TYPE::type_id)) {
|
| 182 |
+
sizes = array.GetValues<offset_type>(2);
|
| 183 |
+
}
|
| 184 |
+
static_assert(internal::may_have_validity_bitmap(TYPE::type_id));
|
| 185 |
+
const uint8_t* validity = array.MayHaveNulls() ? array.buffers[0].data : NULLPTR;
|
| 186 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 187 |
+
for (int64_t row = offset; row < offset + length; row++) {
|
| 188 |
+
const bool is_valid = !validity || bit_util::GetBit(validity, array.offset + row);
|
| 189 |
+
int64_t size = 0;
|
| 190 |
+
if (is_valid) {
|
| 191 |
+
if constexpr (is_list_view(TYPE::type_id)) {
|
| 192 |
+
size = sizes[row];
|
| 193 |
+
} else {
|
| 194 |
+
size = offsets[row + 1] - offsets[row];
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
UnsafeAppendToBitmap(is_valid);
|
| 198 |
+
UnsafeAppendDimensions(/*offset=*/value_builder_->length(), size);
|
| 199 |
+
if (is_valid) {
|
| 200 |
+
ARROW_RETURN_NOT_OK(
|
| 201 |
+
value_builder_->AppendArraySlice(array.child_data[0], offsets[row], size));
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
return Status::OK();
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
Status ValidateOverflow(int64_t new_elements) const {
|
| 208 |
+
auto new_length = value_builder_->length() + new_elements;
|
| 209 |
+
if (ARROW_PREDICT_FALSE(new_length > maximum_elements())) {
|
| 210 |
+
return Status::CapacityError(type_name(), " array cannot contain more than ",
|
| 211 |
+
maximum_elements(), " elements, have ", new_elements);
|
| 212 |
+
} else {
|
| 213 |
+
return Status::OK();
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
ArrayBuilder* value_builder() const { return value_builder_.get(); }
|
| 218 |
+
|
| 219 |
+
// Cannot make this a static attribute because of linking issues
|
| 220 |
+
static constexpr int64_t maximum_elements() {
|
| 221 |
+
return std::numeric_limits<offset_type>::max() - 1;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
std::shared_ptr<DataType> type() const override {
|
| 225 |
+
return std::make_shared<TYPE>(value_field_->WithType(value_builder_->type()));
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
private:
|
| 229 |
+
static constexpr const char* type_name() {
|
| 230 |
+
if constexpr (is_list_view(TYPE::type_id)) {
|
| 231 |
+
return "ListView";
|
| 232 |
+
} else {
|
| 233 |
+
return "List";
|
| 234 |
+
}
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
protected:
|
| 238 |
+
/// \brief Append dimensions for num_values empty list slots.
|
| 239 |
+
///
|
| 240 |
+
/// ListViewBuilder overrides this to also append the sizes.
|
| 241 |
+
virtual void UnsafeAppendEmptyDimensions(int64_t num_values) {
|
| 242 |
+
const int64_t offset = value_builder_->length();
|
| 243 |
+
for (int64_t i = 0; i < num_values; ++i) {
|
| 244 |
+
offsets_builder_.UnsafeAppend(static_cast<offset_type>(offset));
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
/// \brief Append dimensions for a single list slot.
|
| 249 |
+
///
|
| 250 |
+
/// ListViewBuilder overrides this to also append the size.
|
| 251 |
+
virtual void UnsafeAppendDimensions(int64_t offset, int64_t ARROW_ARG_UNUSED(size)) {
|
| 252 |
+
offsets_builder_.UnsafeAppend(static_cast<offset_type>(offset));
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
TypedBufferBuilder<offset_type> offsets_builder_;
|
| 256 |
+
std::shared_ptr<ArrayBuilder> value_builder_;
|
| 257 |
+
std::shared_ptr<Field> value_field_;
|
| 258 |
+
};
|
| 259 |
+
|
| 260 |
+
// ----------------------------------------------------------------------
|
| 261 |
+
// ListBuilder / LargeListBuilder
|
| 262 |
+
|
| 263 |
+
template <typename TYPE>
|
| 264 |
+
class BaseListBuilder : public VarLengthListLikeBuilder<TYPE> {
|
| 265 |
+
private:
|
| 266 |
+
using BASE = VarLengthListLikeBuilder<TYPE>;
|
| 267 |
+
|
| 268 |
+
public:
|
| 269 |
+
using TypeClass = TYPE;
|
| 270 |
+
using offset_type = typename BASE::offset_type;
|
| 271 |
+
|
| 272 |
+
using BASE::BASE;
|
| 273 |
+
|
| 274 |
+
using BASE::Append;
|
| 275 |
+
|
| 276 |
+
~BaseListBuilder() override = default;
|
| 277 |
+
|
| 278 |
+
/// \brief Start a new variable-length list slot
|
| 279 |
+
///
|
| 280 |
+
/// This function should be called before beginning to append elements to the
|
| 281 |
+
/// value builder
|
| 282 |
+
Status Append(bool is_valid = true) {
|
| 283 |
+
// The value_length parameter to BASE::Append(bool, int64_t) is ignored when
|
| 284 |
+
// building a list array, so we can pass 0 here.
|
| 285 |
+
return BASE::Append(is_valid, 0);
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
/// \brief Vector append
|
| 289 |
+
///
|
| 290 |
+
/// If passed, valid_bytes is of equal length to values, and any zero byte
|
| 291 |
+
/// will be considered as a null for that slot
|
| 292 |
+
Status AppendValues(const offset_type* offsets, int64_t length,
|
| 293 |
+
const uint8_t* valid_bytes = NULLPTR) {
|
| 294 |
+
ARROW_RETURN_NOT_OK(this->Reserve(length));
|
| 295 |
+
this->UnsafeAppendToBitmap(valid_bytes, length);
|
| 296 |
+
this->offsets_builder_.UnsafeAppend(offsets, length);
|
| 297 |
+
return Status::OK();
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
Status AppendValues(const offset_type* offsets, const offset_type* sizes,
|
| 301 |
+
int64_t length, const uint8_t* valid_bytes) final {
|
| 302 |
+
// Offsets are assumed to be valid, but the first length-1 sizes have to be
|
| 303 |
+
// consistent with the offsets to partially rule out the possibility that the
|
| 304 |
+
// caller is passing sizes that could work if building a list-view, but don't
|
| 305 |
+
// work on building a list that requires offsets to be non-decreasing.
|
| 306 |
+
//
|
| 307 |
+
// CAUTION: the last size element (`sizes[length - 1]`) is not
|
| 308 |
+
// validated and could be inconsistent with the offsets given in a
|
| 309 |
+
// subsequent call to AppendValues.
|
| 310 |
+
#ifndef NDEBUG
|
| 311 |
+
if (sizes) {
|
| 312 |
+
for (int64_t i = 0; i < length - 1; ++i) {
|
| 313 |
+
if (ARROW_PREDICT_FALSE(offsets[i] != offsets[i + 1] - sizes[i])) {
|
| 314 |
+
if (!valid_bytes || valid_bytes[i]) {
|
| 315 |
+
return Status::Invalid(
|
| 316 |
+
"BaseListBuilder: sizes are inconsistent with offsets provided");
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
}
|
| 320 |
+
}
|
| 321 |
+
#endif
|
| 322 |
+
return AppendValues(offsets, length, valid_bytes);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
Status AppendValues(const offset_type* offsets, const offset_type* sizes,
|
| 326 |
+
int64_t length) {
|
| 327 |
+
return AppendValues(offsets, sizes, length, /*valid_bytes=*/NULLPTR);
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
Status AppendNextOffset() {
|
| 331 |
+
ARROW_RETURN_NOT_OK(this->ValidateOverflow(0));
|
| 332 |
+
const int64_t num_values = this->value_builder_->length();
|
| 333 |
+
return this->offsets_builder_.Append(static_cast<offset_type>(num_values));
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override {
|
| 337 |
+
ARROW_RETURN_NOT_OK(AppendNextOffset());
|
| 338 |
+
|
| 339 |
+
// Offset padding zeroed by BufferBuilder
|
| 340 |
+
std::shared_ptr<Buffer> offsets;
|
| 341 |
+
std::shared_ptr<Buffer> null_bitmap;
|
| 342 |
+
ARROW_RETURN_NOT_OK(this->offsets_builder_.Finish(&offsets));
|
| 343 |
+
ARROW_RETURN_NOT_OK(this->null_bitmap_builder_.Finish(&null_bitmap));
|
| 344 |
+
|
| 345 |
+
if (this->value_builder_->length() == 0) {
|
| 346 |
+
// Try to make sure we get a non-null values buffer (ARROW-2744)
|
| 347 |
+
ARROW_RETURN_NOT_OK(this->value_builder_->Resize(0));
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
std::shared_ptr<ArrayData> items;
|
| 351 |
+
ARROW_RETURN_NOT_OK(this->value_builder_->FinishInternal(&items));
|
| 352 |
+
|
| 353 |
+
*out = ArrayData::Make(this->type(), this->length_,
|
| 354 |
+
{std::move(null_bitmap), std::move(offsets)},
|
| 355 |
+
{std::move(items)}, this->null_count_);
|
| 356 |
+
this->Reset();
|
| 357 |
+
return Status::OK();
|
| 358 |
+
}
|
| 359 |
+
};
|
| 360 |
+
|
| 361 |
+
/// \class ListBuilder
|
| 362 |
+
/// \brief Builder class for variable-length list array value types
|
| 363 |
+
///
|
| 364 |
+
/// To use this class, you must append values to the child array builder and use
|
| 365 |
+
/// the Append function to delimit each distinct list value (once the values
|
| 366 |
+
/// have been appended to the child array) or use the bulk API to append
|
| 367 |
+
/// a sequence of offsets and null values.
|
| 368 |
+
///
|
| 369 |
+
/// A note on types. Per arrow/type.h all types in the c++ implementation are
|
| 370 |
+
/// logical so even though this class always builds list array, this can
|
| 371 |
+
/// represent multiple different logical types. If no logical type is provided
|
| 372 |
+
/// at construction time, the class defaults to List<T> where t is taken from the
|
| 373 |
+
/// value_builder/values that the object is constructed with.
|
| 374 |
+
class ARROW_EXPORT ListBuilder : public BaseListBuilder<ListType> {
|
| 375 |
+
public:
|
| 376 |
+
using BaseListBuilder::BaseListBuilder;
|
| 377 |
+
|
| 378 |
+
/// \cond FALSE
|
| 379 |
+
using ArrayBuilder::Finish;
|
| 380 |
+
/// \endcond
|
| 381 |
+
|
| 382 |
+
Status Finish(std::shared_ptr<ListArray>* out) { return FinishTyped(out); }
|
| 383 |
+
};
|
| 384 |
+
|
| 385 |
+
/// \class LargeListBuilder
|
| 386 |
+
/// \brief Builder class for large variable-length list array value types
|
| 387 |
+
///
|
| 388 |
+
/// Like ListBuilder, but to create large list arrays (with 64-bit offsets).
|
| 389 |
+
class ARROW_EXPORT LargeListBuilder : public BaseListBuilder<LargeListType> {
|
| 390 |
+
public:
|
| 391 |
+
using BaseListBuilder::BaseListBuilder;
|
| 392 |
+
|
| 393 |
+
/// \cond FALSE
|
| 394 |
+
using ArrayBuilder::Finish;
|
| 395 |
+
/// \endcond
|
| 396 |
+
|
| 397 |
+
Status Finish(std::shared_ptr<LargeListArray>* out) { return FinishTyped(out); }
|
| 398 |
+
};
|
| 399 |
+
|
| 400 |
+
// ----------------------------------------------------------------------
|
| 401 |
+
// ListViewBuilder / LargeListViewBuilder
|
| 402 |
+
|
| 403 |
+
template <typename TYPE>
|
| 404 |
+
class BaseListViewBuilder : public VarLengthListLikeBuilder<TYPE> {
|
| 405 |
+
private:
|
| 406 |
+
using BASE = VarLengthListLikeBuilder<TYPE>;
|
| 407 |
+
|
| 408 |
+
public:
|
| 409 |
+
using TypeClass = TYPE;
|
| 410 |
+
using offset_type = typename BASE::offset_type;
|
| 411 |
+
|
| 412 |
+
using BASE::BASE;
|
| 413 |
+
|
| 414 |
+
~BaseListViewBuilder() override = default;
|
| 415 |
+
|
| 416 |
+
Status Resize(int64_t capacity) override {
|
| 417 |
+
ARROW_RETURN_NOT_OK(BASE::Resize(capacity));
|
| 418 |
+
return sizes_builder_.Resize(capacity);
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
void Reset() override {
|
| 422 |
+
BASE::Reset();
|
| 423 |
+
sizes_builder_.Reset();
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
/// \brief Vector append
|
| 427 |
+
///
|
| 428 |
+
/// If passed, valid_bytes is of equal length to values, and any zero byte
|
| 429 |
+
/// will be considered as a null for that slot
|
| 430 |
+
Status AppendValues(const offset_type* offsets, const offset_type* sizes,
|
| 431 |
+
int64_t length, const uint8_t* valid_bytes) final {
|
| 432 |
+
ARROW_RETURN_NOT_OK(this->Reserve(length));
|
| 433 |
+
this->UnsafeAppendToBitmap(valid_bytes, length);
|
| 434 |
+
this->offsets_builder_.UnsafeAppend(offsets, length);
|
| 435 |
+
this->sizes_builder_.UnsafeAppend(sizes, length);
|
| 436 |
+
return Status::OK();
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
Status AppendValues(const offset_type* offsets, const offset_type* sizes,
|
| 440 |
+
int64_t length) {
|
| 441 |
+
return AppendValues(offsets, sizes, length, /*valid_bytes=*/NULLPTR);
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override {
|
| 445 |
+
// Offset and sizes padding zeroed by BufferBuilder
|
| 446 |
+
std::shared_ptr<Buffer> null_bitmap;
|
| 447 |
+
std::shared_ptr<Buffer> offsets;
|
| 448 |
+
std::shared_ptr<Buffer> sizes;
|
| 449 |
+
ARROW_RETURN_NOT_OK(this->null_bitmap_builder_.Finish(&null_bitmap));
|
| 450 |
+
ARROW_RETURN_NOT_OK(this->offsets_builder_.Finish(&offsets));
|
| 451 |
+
ARROW_RETURN_NOT_OK(this->sizes_builder_.Finish(&sizes));
|
| 452 |
+
|
| 453 |
+
if (this->value_builder_->length() == 0) {
|
| 454 |
+
// Try to make sure we get a non-null values buffer (ARROW-2744)
|
| 455 |
+
ARROW_RETURN_NOT_OK(this->value_builder_->Resize(0));
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
std::shared_ptr<ArrayData> items;
|
| 459 |
+
ARROW_RETURN_NOT_OK(this->value_builder_->FinishInternal(&items));
|
| 460 |
+
|
| 461 |
+
*out = ArrayData::Make(this->type(), this->length_,
|
| 462 |
+
{std::move(null_bitmap), std::move(offsets), std::move(sizes)},
|
| 463 |
+
{std::move(items)}, this->null_count_);
|
| 464 |
+
this->Reset();
|
| 465 |
+
return Status::OK();
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
protected:
|
| 469 |
+
void UnsafeAppendEmptyDimensions(int64_t num_values) override {
|
| 470 |
+
for (int64_t i = 0; i < num_values; ++i) {
|
| 471 |
+
this->offsets_builder_.UnsafeAppend(0);
|
| 472 |
+
}
|
| 473 |
+
for (int64_t i = 0; i < num_values; ++i) {
|
| 474 |
+
this->sizes_builder_.UnsafeAppend(0);
|
| 475 |
+
}
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
void UnsafeAppendDimensions(int64_t offset, int64_t size) override {
|
| 479 |
+
this->offsets_builder_.UnsafeAppend(static_cast<offset_type>(offset));
|
| 480 |
+
this->sizes_builder_.UnsafeAppend(static_cast<offset_type>(size));
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
private:
|
| 484 |
+
TypedBufferBuilder<offset_type> sizes_builder_;
|
| 485 |
+
};
|
| 486 |
+
|
| 487 |
+
class ARROW_EXPORT ListViewBuilder final : public BaseListViewBuilder<ListViewType> {
|
| 488 |
+
public:
|
| 489 |
+
using BaseListViewBuilder::BaseListViewBuilder;
|
| 490 |
+
|
| 491 |
+
/// \cond FALSE
|
| 492 |
+
using ArrayBuilder::Finish;
|
| 493 |
+
/// \endcond
|
| 494 |
+
|
| 495 |
+
Status Finish(std::shared_ptr<ListViewArray>* out) { return FinishTyped(out); }
|
| 496 |
+
};
|
| 497 |
+
|
| 498 |
+
class ARROW_EXPORT LargeListViewBuilder final
|
| 499 |
+
: public BaseListViewBuilder<LargeListViewType> {
|
| 500 |
+
public:
|
| 501 |
+
using BaseListViewBuilder::BaseListViewBuilder;
|
| 502 |
+
|
| 503 |
+
/// \cond FALSE
|
| 504 |
+
using ArrayBuilder::Finish;
|
| 505 |
+
/// \endcond
|
| 506 |
+
|
| 507 |
+
Status Finish(std::shared_ptr<LargeListViewArray>* out) { return FinishTyped(out); }
|
| 508 |
+
};
|
| 509 |
+
|
| 510 |
+
// ----------------------------------------------------------------------
|
| 511 |
+
// Map builder
|
| 512 |
+
|
| 513 |
+
/// \class MapBuilder
|
| 514 |
+
/// \brief Builder class for arrays of variable-size maps
|
| 515 |
+
///
|
| 516 |
+
/// To use this class, you must use the Append function to delimit each distinct
|
| 517 |
+
/// map before appending values to the key and item array builders, or use the
|
| 518 |
+
/// bulk API to append a sequence of offsets and null maps.
|
| 519 |
+
///
|
| 520 |
+
/// Key uniqueness and ordering are not validated.
|
| 521 |
+
class ARROW_EXPORT MapBuilder : public ArrayBuilder {
|
| 522 |
+
public:
|
| 523 |
+
/// Use this constructor to define the built array's type explicitly. If key_builder
|
| 524 |
+
/// or item_builder has indeterminate type, this builder will also.
|
| 525 |
+
MapBuilder(MemoryPool* pool, const std::shared_ptr<ArrayBuilder>& key_builder,
|
| 526 |
+
const std::shared_ptr<ArrayBuilder>& item_builder,
|
| 527 |
+
const std::shared_ptr<DataType>& type);
|
| 528 |
+
|
| 529 |
+
/// Use this constructor to infer the built array's type. If key_builder or
|
| 530 |
+
/// item_builder has indeterminate type, this builder will also.
|
| 531 |
+
MapBuilder(MemoryPool* pool, const std::shared_ptr<ArrayBuilder>& key_builder,
|
| 532 |
+
const std::shared_ptr<ArrayBuilder>& item_builder, bool keys_sorted = false);
|
| 533 |
+
|
| 534 |
+
MapBuilder(MemoryPool* pool, const std::shared_ptr<ArrayBuilder>& item_builder,
|
| 535 |
+
const std::shared_ptr<DataType>& type);
|
| 536 |
+
|
| 537 |
+
Status Resize(int64_t capacity) override;
|
| 538 |
+
void Reset() override;
|
| 539 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 540 |
+
|
| 541 |
+
/// \cond FALSE
|
| 542 |
+
using ArrayBuilder::Finish;
|
| 543 |
+
/// \endcond
|
| 544 |
+
|
| 545 |
+
Status Finish(std::shared_ptr<MapArray>* out) { return FinishTyped(out); }
|
| 546 |
+
|
| 547 |
+
/// \brief Vector append
|
| 548 |
+
///
|
| 549 |
+
/// If passed, valid_bytes is of equal length to values, and any zero byte
|
| 550 |
+
/// will be considered as a null for that slot
|
| 551 |
+
Status AppendValues(const int32_t* offsets, int64_t length,
|
| 552 |
+
const uint8_t* valid_bytes = NULLPTR);
|
| 553 |
+
|
| 554 |
+
/// \brief Start a new variable-length map slot
|
| 555 |
+
///
|
| 556 |
+
/// This function should be called before beginning to append elements to the
|
| 557 |
+
/// key and item builders
|
| 558 |
+
Status Append();
|
| 559 |
+
|
| 560 |
+
Status AppendNull() final;
|
| 561 |
+
|
| 562 |
+
Status AppendNulls(int64_t length) final;
|
| 563 |
+
|
| 564 |
+
Status AppendEmptyValue() final;
|
| 565 |
+
|
| 566 |
+
Status AppendEmptyValues(int64_t length) final;
|
| 567 |
+
|
| 568 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 569 |
+
int64_t length) override {
|
| 570 |
+
const auto* offsets = array.GetValues<int32_t>(1);
|
| 571 |
+
static_assert(internal::may_have_validity_bitmap(MapType::type_id));
|
| 572 |
+
const uint8_t* validity = array.MayHaveNulls() ? array.buffers[0].data : NULLPTR;
|
| 573 |
+
for (int64_t row = offset; row < offset + length; row++) {
|
| 574 |
+
const bool is_valid = !validity || bit_util::GetBit(validity, array.offset + row);
|
| 575 |
+
if (is_valid) {
|
| 576 |
+
ARROW_RETURN_NOT_OK(Append());
|
| 577 |
+
const int64_t slot_length = offsets[row + 1] - offsets[row];
|
| 578 |
+
// Add together the inner StructArray offset to the Map/List offset
|
| 579 |
+
int64_t key_value_offset = array.child_data[0].offset + offsets[row];
|
| 580 |
+
ARROW_RETURN_NOT_OK(key_builder_->AppendArraySlice(
|
| 581 |
+
array.child_data[0].child_data[0], key_value_offset, slot_length));
|
| 582 |
+
ARROW_RETURN_NOT_OK(item_builder_->AppendArraySlice(
|
| 583 |
+
array.child_data[0].child_data[1], key_value_offset, slot_length));
|
| 584 |
+
} else {
|
| 585 |
+
ARROW_RETURN_NOT_OK(AppendNull());
|
| 586 |
+
}
|
| 587 |
+
}
|
| 588 |
+
return Status::OK();
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
/// \brief Get builder to append keys.
|
| 592 |
+
///
|
| 593 |
+
/// Append a key with this builder should be followed by appending
|
| 594 |
+
/// an item or null value with item_builder().
|
| 595 |
+
ArrayBuilder* key_builder() const { return key_builder_.get(); }
|
| 596 |
+
|
| 597 |
+
/// \brief Get builder to append items
|
| 598 |
+
///
|
| 599 |
+
/// Appending an item with this builder should have been preceded
|
| 600 |
+
/// by appending a key with key_builder().
|
| 601 |
+
ArrayBuilder* item_builder() const { return item_builder_.get(); }
|
| 602 |
+
|
| 603 |
+
/// \brief Get builder to add Map entries as struct values.
|
| 604 |
+
///
|
| 605 |
+
/// This is used instead of key_builder()/item_builder() and allows
|
| 606 |
+
/// the Map to be built as a list of struct values.
|
| 607 |
+
ArrayBuilder* value_builder() const { return list_builder_->value_builder(); }
|
| 608 |
+
|
| 609 |
+
std::shared_ptr<DataType> type() const override {
|
| 610 |
+
// Key and Item builder may update types, but they don't contain the field names,
|
| 611 |
+
// so we need to reconstruct the type. (See ARROW-13735.)
|
| 612 |
+
return std::make_shared<MapType>(
|
| 613 |
+
field(entries_name_,
|
| 614 |
+
struct_({field(key_name_, key_builder_->type(), false),
|
| 615 |
+
field(item_name_, item_builder_->type(), item_nullable_)}),
|
| 616 |
+
false),
|
| 617 |
+
keys_sorted_);
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
Status ValidateOverflow(int64_t new_elements) {
|
| 621 |
+
return list_builder_->ValidateOverflow(new_elements);
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
protected:
|
| 625 |
+
inline Status AdjustStructBuilderLength();
|
| 626 |
+
|
| 627 |
+
protected:
|
| 628 |
+
bool keys_sorted_ = false;
|
| 629 |
+
bool item_nullable_ = false;
|
| 630 |
+
std::string entries_name_;
|
| 631 |
+
std::string key_name_;
|
| 632 |
+
std::string item_name_;
|
| 633 |
+
std::shared_ptr<ListBuilder> list_builder_;
|
| 634 |
+
std::shared_ptr<ArrayBuilder> key_builder_;
|
| 635 |
+
std::shared_ptr<ArrayBuilder> item_builder_;
|
| 636 |
+
};
|
| 637 |
+
|
| 638 |
+
// ----------------------------------------------------------------------
|
| 639 |
+
// FixedSizeList builder
|
| 640 |
+
|
| 641 |
+
/// \class FixedSizeListBuilder
|
| 642 |
+
/// \brief Builder class for fixed-length list array value types
|
| 643 |
+
class ARROW_EXPORT FixedSizeListBuilder : public ArrayBuilder {
|
| 644 |
+
public:
|
| 645 |
+
using TypeClass = FixedSizeListType;
|
| 646 |
+
|
| 647 |
+
/// Use this constructor to define the built array's type explicitly. If value_builder
|
| 648 |
+
/// has indeterminate type, this builder will also.
|
| 649 |
+
FixedSizeListBuilder(MemoryPool* pool,
|
| 650 |
+
const std::shared_ptr<ArrayBuilder>& value_builder,
|
| 651 |
+
int32_t list_size);
|
| 652 |
+
|
| 653 |
+
/// Use this constructor to infer the built array's type. If value_builder has
|
| 654 |
+
/// indeterminate type, this builder will also.
|
| 655 |
+
FixedSizeListBuilder(MemoryPool* pool,
|
| 656 |
+
const std::shared_ptr<ArrayBuilder>& value_builder,
|
| 657 |
+
const std::shared_ptr<DataType>& type);
|
| 658 |
+
|
| 659 |
+
Status Resize(int64_t capacity) override;
|
| 660 |
+
void Reset() override;
|
| 661 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 662 |
+
|
| 663 |
+
/// \cond FALSE
|
| 664 |
+
using ArrayBuilder::Finish;
|
| 665 |
+
/// \endcond
|
| 666 |
+
|
| 667 |
+
Status Finish(std::shared_ptr<FixedSizeListArray>* out) { return FinishTyped(out); }
|
| 668 |
+
|
| 669 |
+
/// \brief Append a valid fixed length list.
|
| 670 |
+
///
|
| 671 |
+
/// This function affects only the validity bitmap; the child values must be appended
|
| 672 |
+
/// using the child array builder.
|
| 673 |
+
Status Append();
|
| 674 |
+
|
| 675 |
+
/// \brief Vector append
|
| 676 |
+
///
|
| 677 |
+
/// If passed, valid_bytes will be read and any zero byte
|
| 678 |
+
/// will cause the corresponding slot to be null
|
| 679 |
+
///
|
| 680 |
+
/// This function affects only the validity bitmap; the child values must be appended
|
| 681 |
+
/// using the child array builder. This includes appending nulls for null lists.
|
| 682 |
+
/// XXX this restriction is confusing, should this method be omitted?
|
| 683 |
+
Status AppendValues(int64_t length, const uint8_t* valid_bytes = NULLPTR);
|
| 684 |
+
|
| 685 |
+
/// \brief Append a null fixed length list.
|
| 686 |
+
///
|
| 687 |
+
/// The child array builder will have the appropriate number of nulls appended
|
| 688 |
+
/// automatically.
|
| 689 |
+
Status AppendNull() final;
|
| 690 |
+
|
| 691 |
+
/// \brief Append length null fixed length lists.
|
| 692 |
+
///
|
| 693 |
+
/// The child array builder will have the appropriate number of nulls appended
|
| 694 |
+
/// automatically.
|
| 695 |
+
Status AppendNulls(int64_t length) final;
|
| 696 |
+
|
| 697 |
+
Status ValidateOverflow(int64_t new_elements);
|
| 698 |
+
|
| 699 |
+
Status AppendEmptyValue() final;
|
| 700 |
+
|
| 701 |
+
Status AppendEmptyValues(int64_t length) final;
|
| 702 |
+
|
| 703 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset, int64_t length) final {
|
| 704 |
+
const uint8_t* validity = array.MayHaveNulls() ? array.buffers[0].data : NULLPTR;
|
| 705 |
+
for (int64_t row = offset; row < offset + length; row++) {
|
| 706 |
+
if (!validity || bit_util::GetBit(validity, array.offset + row)) {
|
| 707 |
+
ARROW_RETURN_NOT_OK(value_builder_->AppendArraySlice(
|
| 708 |
+
array.child_data[0], list_size_ * (array.offset + row), list_size_));
|
| 709 |
+
ARROW_RETURN_NOT_OK(Append());
|
| 710 |
+
} else {
|
| 711 |
+
ARROW_RETURN_NOT_OK(AppendNull());
|
| 712 |
+
}
|
| 713 |
+
}
|
| 714 |
+
return Status::OK();
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
ArrayBuilder* value_builder() const { return value_builder_.get(); }
|
| 718 |
+
|
| 719 |
+
std::shared_ptr<DataType> type() const override {
|
| 720 |
+
return fixed_size_list(value_field_->WithType(value_builder_->type()), list_size_);
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
// Cannot make this a static attribute because of linking issues
|
| 724 |
+
static constexpr int64_t maximum_elements() {
|
| 725 |
+
return std::numeric_limits<FixedSizeListType::offset_type>::max() - 1;
|
| 726 |
+
}
|
| 727 |
+
|
| 728 |
+
protected:
|
| 729 |
+
std::shared_ptr<Field> value_field_;
|
| 730 |
+
const int32_t list_size_;
|
| 731 |
+
std::shared_ptr<ArrayBuilder> value_builder_;
|
| 732 |
+
};
|
| 733 |
+
|
| 734 |
+
// ----------------------------------------------------------------------
|
| 735 |
+
// Struct
|
| 736 |
+
|
| 737 |
+
// ---------------------------------------------------------------------------------
|
| 738 |
+
// StructArray builder
|
| 739 |
+
/// Append, Resize and Reserve methods are acting on StructBuilder.
|
| 740 |
+
/// Please make sure all these methods of all child-builders' are consistently
|
| 741 |
+
/// called to maintain data-structure consistency.
|
| 742 |
+
class ARROW_EXPORT StructBuilder : public ArrayBuilder {
|
| 743 |
+
public:
|
| 744 |
+
/// If any of field_builders has indeterminate type, this builder will also
|
| 745 |
+
StructBuilder(const std::shared_ptr<DataType>& type, MemoryPool* pool,
|
| 746 |
+
std::vector<std::shared_ptr<ArrayBuilder>> field_builders);
|
| 747 |
+
|
| 748 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 749 |
+
|
| 750 |
+
/// \cond FALSE
|
| 751 |
+
using ArrayBuilder::Finish;
|
| 752 |
+
/// \endcond
|
| 753 |
+
|
| 754 |
+
Status Finish(std::shared_ptr<StructArray>* out) { return FinishTyped(out); }
|
| 755 |
+
|
| 756 |
+
/// Null bitmap is of equal length to every child field, and any zero byte
|
| 757 |
+
/// will be considered as a null for that field, but users must using app-
|
| 758 |
+
/// end methods or advance methods of the child builders' independently to
|
| 759 |
+
/// insert data.
|
| 760 |
+
Status AppendValues(int64_t length, const uint8_t* valid_bytes) {
|
| 761 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 762 |
+
UnsafeAppendToBitmap(valid_bytes, length);
|
| 763 |
+
return Status::OK();
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
+
/// Append an element to the Struct. All child-builders' Append method must
|
| 767 |
+
/// be called independently to maintain data-structure consistency.
|
| 768 |
+
Status Append(bool is_valid = true) {
|
| 769 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 770 |
+
UnsafeAppendToBitmap(is_valid);
|
| 771 |
+
return Status::OK();
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
/// \brief Append a null value. Automatically appends an empty value to each child
|
| 775 |
+
/// builder.
|
| 776 |
+
Status AppendNull() final {
|
| 777 |
+
for (const auto& field : children_) {
|
| 778 |
+
ARROW_RETURN_NOT_OK(field->AppendEmptyValue());
|
| 779 |
+
}
|
| 780 |
+
return Append(false);
|
| 781 |
+
}
|
| 782 |
+
|
| 783 |
+
/// \brief Append multiple null values. Automatically appends empty values to each
|
| 784 |
+
/// child builder.
|
| 785 |
+
Status AppendNulls(int64_t length) final {
|
| 786 |
+
for (const auto& field : children_) {
|
| 787 |
+
ARROW_RETURN_NOT_OK(field->AppendEmptyValues(length));
|
| 788 |
+
}
|
| 789 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 790 |
+
UnsafeAppendToBitmap(length, false);
|
| 791 |
+
return Status::OK();
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
Status AppendEmptyValue() final {
|
| 795 |
+
for (const auto& field : children_) {
|
| 796 |
+
ARROW_RETURN_NOT_OK(field->AppendEmptyValue());
|
| 797 |
+
}
|
| 798 |
+
return Append(true);
|
| 799 |
+
}
|
| 800 |
+
|
| 801 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 802 |
+
for (const auto& field : children_) {
|
| 803 |
+
ARROW_RETURN_NOT_OK(field->AppendEmptyValues(length));
|
| 804 |
+
}
|
| 805 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 806 |
+
UnsafeAppendToBitmap(length, true);
|
| 807 |
+
return Status::OK();
|
| 808 |
+
}
|
| 809 |
+
|
| 810 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 811 |
+
int64_t length) override {
|
| 812 |
+
for (int i = 0; static_cast<size_t>(i) < children_.size(); i++) {
|
| 813 |
+
ARROW_RETURN_NOT_OK(children_[i]->AppendArraySlice(array.child_data[i],
|
| 814 |
+
array.offset + offset, length));
|
| 815 |
+
}
|
| 816 |
+
const uint8_t* validity = array.MayHaveNulls() ? array.buffers[0].data : NULLPTR;
|
| 817 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 818 |
+
UnsafeAppendToBitmap(validity, array.offset + offset, length);
|
| 819 |
+
return Status::OK();
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
void Reset() override;
|
| 823 |
+
|
| 824 |
+
ArrayBuilder* field_builder(int i) const { return children_[i].get(); }
|
| 825 |
+
|
| 826 |
+
int num_fields() const { return static_cast<int>(children_.size()); }
|
| 827 |
+
|
| 828 |
+
std::shared_ptr<DataType> type() const override;
|
| 829 |
+
|
| 830 |
+
private:
|
| 831 |
+
std::shared_ptr<DataType> type_;
|
| 832 |
+
};
|
| 833 |
+
|
| 834 |
+
/// @}
|
| 835 |
+
|
| 836 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_primitive.h
ADDED
|
@@ -0,0 +1,689 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <algorithm>
|
| 21 |
+
#include <memory>
|
| 22 |
+
#include <vector>
|
| 23 |
+
|
| 24 |
+
#include "arrow/array/builder_base.h"
|
| 25 |
+
#include "arrow/array/data.h"
|
| 26 |
+
#include "arrow/result.h"
|
| 27 |
+
#include "arrow/type.h"
|
| 28 |
+
#include "arrow/type_traits.h"
|
| 29 |
+
#include "arrow/util/float16.h"
|
| 30 |
+
|
| 31 |
+
namespace arrow {
|
| 32 |
+
|
| 33 |
+
class ARROW_EXPORT NullBuilder : public ArrayBuilder {
|
| 34 |
+
public:
|
| 35 |
+
explicit NullBuilder(MemoryPool* pool = default_memory_pool(),
|
| 36 |
+
int64_t ARROW_ARG_UNUSED(alignment) = kDefaultBufferAlignment)
|
| 37 |
+
: ArrayBuilder(pool) {}
|
| 38 |
+
|
| 39 |
+
explicit NullBuilder(const std::shared_ptr<DataType>& ARROW_ARG_UNUSED(type),
|
| 40 |
+
MemoryPool* pool = default_memory_pool(),
|
| 41 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 42 |
+
: NullBuilder(pool, alignment) {}
|
| 43 |
+
|
| 44 |
+
/// \brief Append the specified number of null elements
|
| 45 |
+
Status AppendNulls(int64_t length) final {
|
| 46 |
+
if (length < 0) return Status::Invalid("length must be positive");
|
| 47 |
+
null_count_ += length;
|
| 48 |
+
length_ += length;
|
| 49 |
+
return Status::OK();
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/// \brief Append a single null element
|
| 53 |
+
Status AppendNull() final { return AppendNulls(1); }
|
| 54 |
+
|
| 55 |
+
Status AppendEmptyValues(int64_t length) final { return AppendNulls(length); }
|
| 56 |
+
|
| 57 |
+
Status AppendEmptyValue() final { return AppendEmptyValues(1); }
|
| 58 |
+
|
| 59 |
+
Status Append(std::nullptr_t) { return AppendNull(); }
|
| 60 |
+
|
| 61 |
+
Status AppendArraySlice(const ArraySpan&, int64_t, int64_t length) override {
|
| 62 |
+
return AppendNulls(length);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 66 |
+
|
| 67 |
+
/// \cond FALSE
|
| 68 |
+
using ArrayBuilder::Finish;
|
| 69 |
+
/// \endcond
|
| 70 |
+
|
| 71 |
+
std::shared_ptr<DataType> type() const override { return null(); }
|
| 72 |
+
|
| 73 |
+
Status Finish(std::shared_ptr<NullArray>* out) { return FinishTyped(out); }
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
/// \addtogroup numeric-builders
|
| 77 |
+
///
|
| 78 |
+
/// @{
|
| 79 |
+
|
| 80 |
+
/// Base class for all Builders that emit an Array of a scalar numerical type.
|
| 81 |
+
template <typename T>
|
| 82 |
+
class NumericBuilder
|
| 83 |
+
: public ArrayBuilder,
|
| 84 |
+
public internal::ArrayBuilderExtraOps<NumericBuilder<T>, typename T::c_type> {
|
| 85 |
+
public:
|
| 86 |
+
using TypeClass = T;
|
| 87 |
+
using value_type = typename T::c_type;
|
| 88 |
+
using ArrayType = typename TypeTraits<T>::ArrayType;
|
| 89 |
+
|
| 90 |
+
template <typename T1 = T>
|
| 91 |
+
explicit NumericBuilder(
|
| 92 |
+
enable_if_parameter_free<T1, MemoryPool*> pool = default_memory_pool(),
|
| 93 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 94 |
+
: ArrayBuilder(pool, alignment),
|
| 95 |
+
type_(TypeTraits<T>::type_singleton()),
|
| 96 |
+
data_builder_(pool, alignment) {}
|
| 97 |
+
|
| 98 |
+
NumericBuilder(const std::shared_ptr<DataType>& type, MemoryPool* pool,
|
| 99 |
+
int64_t alignment = kDefaultBufferAlignment)
|
| 100 |
+
: ArrayBuilder(pool, alignment), type_(type), data_builder_(pool, alignment) {}
|
| 101 |
+
|
| 102 |
+
/// Append a single scalar and increase the size if necessary.
|
| 103 |
+
Status Append(const value_type val) {
|
| 104 |
+
ARROW_RETURN_NOT_OK(ArrayBuilder::Reserve(1));
|
| 105 |
+
UnsafeAppend(val);
|
| 106 |
+
return Status::OK();
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/// Write nulls as uint8_t* (0 value indicates null) into pre-allocated memory
|
| 110 |
+
/// The memory at the corresponding data slot is set to 0 to prevent
|
| 111 |
+
/// uninitialized memory access
|
| 112 |
+
Status AppendNulls(int64_t length) final {
|
| 113 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 114 |
+
data_builder_.UnsafeAppend(length, value_type{}); // zero
|
| 115 |
+
UnsafeSetNull(length);
|
| 116 |
+
return Status::OK();
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
/// \brief Append a single null element
|
| 120 |
+
Status AppendNull() final {
|
| 121 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 122 |
+
data_builder_.UnsafeAppend(value_type{}); // zero
|
| 123 |
+
UnsafeAppendToBitmap(false);
|
| 124 |
+
return Status::OK();
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/// \brief Append a empty element
|
| 128 |
+
Status AppendEmptyValue() final {
|
| 129 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 130 |
+
data_builder_.UnsafeAppend(value_type{}); // zero
|
| 131 |
+
UnsafeAppendToBitmap(true);
|
| 132 |
+
return Status::OK();
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/// \brief Append several empty elements
|
| 136 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 137 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 138 |
+
data_builder_.UnsafeAppend(length, value_type{}); // zero
|
| 139 |
+
UnsafeSetNotNull(length);
|
| 140 |
+
return Status::OK();
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
value_type GetValue(int64_t index) const { return data_builder_.data()[index]; }
|
| 144 |
+
|
| 145 |
+
value_type* GetMutableValue(int64_t index) {
|
| 146 |
+
return &data_builder_.mutable_data()[index];
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
void Reset() override {
|
| 150 |
+
data_builder_.Reset();
|
| 151 |
+
ArrayBuilder::Reset();
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
Status Resize(int64_t capacity) override {
|
| 155 |
+
ARROW_RETURN_NOT_OK(CheckCapacity(capacity));
|
| 156 |
+
capacity = std::max(capacity, kMinBuilderCapacity);
|
| 157 |
+
ARROW_RETURN_NOT_OK(data_builder_.Resize(capacity));
|
| 158 |
+
return ArrayBuilder::Resize(capacity);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
value_type operator[](int64_t index) const { return GetValue(index); }
|
| 162 |
+
|
| 163 |
+
value_type& operator[](int64_t index) {
|
| 164 |
+
return reinterpret_cast<value_type*>(data_builder_.mutable_data())[index];
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/// \brief Append a sequence of elements in one shot
|
| 168 |
+
/// \param[in] values a contiguous C array of values
|
| 169 |
+
/// \param[in] length the number of values to append
|
| 170 |
+
/// \param[in] valid_bytes an optional sequence of bytes where non-zero
|
| 171 |
+
/// indicates a valid (non-null) value
|
| 172 |
+
/// \return Status
|
| 173 |
+
Status AppendValues(const value_type* values, int64_t length,
|
| 174 |
+
const uint8_t* valid_bytes = NULLPTR) {
|
| 175 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 176 |
+
data_builder_.UnsafeAppend(values, length);
|
| 177 |
+
// length_ is update by these
|
| 178 |
+
ArrayBuilder::UnsafeAppendToBitmap(valid_bytes, length);
|
| 179 |
+
return Status::OK();
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/// \brief Append a sequence of elements in one shot
|
| 183 |
+
/// \param[in] values a contiguous C array of values
|
| 184 |
+
/// \param[in] length the number of values to append
|
| 185 |
+
/// \param[in] bitmap a validity bitmap to copy (may be null)
|
| 186 |
+
/// \param[in] bitmap_offset an offset into the validity bitmap
|
| 187 |
+
/// \return Status
|
| 188 |
+
Status AppendValues(const value_type* values, int64_t length, const uint8_t* bitmap,
|
| 189 |
+
int64_t bitmap_offset) {
|
| 190 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 191 |
+
data_builder_.UnsafeAppend(values, length);
|
| 192 |
+
// length_ is update by these
|
| 193 |
+
ArrayBuilder::UnsafeAppendToBitmap(bitmap, bitmap_offset, length);
|
| 194 |
+
return Status::OK();
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
/// \brief Append a sequence of elements in one shot
|
| 198 |
+
/// \param[in] values a contiguous C array of values
|
| 199 |
+
/// \param[in] length the number of values to append
|
| 200 |
+
/// \param[in] is_valid an std::vector<bool> indicating valid (1) or null
|
| 201 |
+
/// (0). Equal in length to values
|
| 202 |
+
/// \return Status
|
| 203 |
+
Status AppendValues(const value_type* values, int64_t length,
|
| 204 |
+
const std::vector<bool>& is_valid) {
|
| 205 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 206 |
+
data_builder_.UnsafeAppend(values, length);
|
| 207 |
+
// length_ is update by these
|
| 208 |
+
ArrayBuilder::UnsafeAppendToBitmap(is_valid);
|
| 209 |
+
return Status::OK();
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
/// \brief Append a sequence of elements in one shot
|
| 213 |
+
/// \param[in] values a std::vector of values
|
| 214 |
+
/// \param[in] is_valid an std::vector<bool> indicating valid (1) or null
|
| 215 |
+
/// (0). Equal in length to values
|
| 216 |
+
/// \return Status
|
| 217 |
+
Status AppendValues(const std::vector<value_type>& values,
|
| 218 |
+
const std::vector<bool>& is_valid) {
|
| 219 |
+
if (values.empty()) {
|
| 220 |
+
return Status::OK();
|
| 221 |
+
}
|
| 222 |
+
return AppendValues(values.data(), static_cast<int64_t>(values.size()), is_valid);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
/// \brief Append a sequence of elements in one shot
|
| 226 |
+
/// \param[in] values a std::vector of values
|
| 227 |
+
/// \return Status
|
| 228 |
+
Status AppendValues(const std::vector<value_type>& values) {
|
| 229 |
+
if (values.empty()) {
|
| 230 |
+
return Status::OK();
|
| 231 |
+
}
|
| 232 |
+
return AppendValues(values.data(), static_cast<int64_t>(values.size()));
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override {
|
| 236 |
+
ARROW_ASSIGN_OR_RAISE(auto null_bitmap,
|
| 237 |
+
null_bitmap_builder_.FinishWithLength(length_));
|
| 238 |
+
ARROW_ASSIGN_OR_RAISE(auto data, data_builder_.FinishWithLength(length_));
|
| 239 |
+
*out = ArrayData::Make(type(), length_, {null_bitmap, data}, null_count_);
|
| 240 |
+
capacity_ = length_ = null_count_ = 0;
|
| 241 |
+
return Status::OK();
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
/// \cond FALSE
|
| 245 |
+
using ArrayBuilder::Finish;
|
| 246 |
+
/// \endcond
|
| 247 |
+
|
| 248 |
+
Status Finish(std::shared_ptr<ArrayType>* out) { return FinishTyped(out); }
|
| 249 |
+
|
| 250 |
+
/// \brief Append a sequence of elements in one shot
|
| 251 |
+
/// \param[in] values_begin InputIterator to the beginning of the values
|
| 252 |
+
/// \param[in] values_end InputIterator pointing to the end of the values
|
| 253 |
+
/// \return Status
|
| 254 |
+
template <typename ValuesIter>
|
| 255 |
+
Status AppendValues(ValuesIter values_begin, ValuesIter values_end) {
|
| 256 |
+
int64_t length = static_cast<int64_t>(std::distance(values_begin, values_end));
|
| 257 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 258 |
+
data_builder_.UnsafeAppend(values_begin, values_end);
|
| 259 |
+
// this updates the length_
|
| 260 |
+
UnsafeSetNotNull(length);
|
| 261 |
+
return Status::OK();
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
/// \brief Append a sequence of elements in one shot, with a specified nullmap
|
| 265 |
+
/// \param[in] values_begin InputIterator to the beginning of the values
|
| 266 |
+
/// \param[in] values_end InputIterator pointing to the end of the values
|
| 267 |
+
/// \param[in] valid_begin InputIterator with elements indication valid(1)
|
| 268 |
+
/// or null(0) values.
|
| 269 |
+
/// \return Status
|
| 270 |
+
template <typename ValuesIter, typename ValidIter>
|
| 271 |
+
enable_if_t<!std::is_pointer<ValidIter>::value, Status> AppendValues(
|
| 272 |
+
ValuesIter values_begin, ValuesIter values_end, ValidIter valid_begin) {
|
| 273 |
+
static_assert(!internal::is_null_pointer<ValidIter>::value,
|
| 274 |
+
"Don't pass a NULLPTR directly as valid_begin, use the 2-argument "
|
| 275 |
+
"version instead");
|
| 276 |
+
int64_t length = static_cast<int64_t>(std::distance(values_begin, values_end));
|
| 277 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 278 |
+
data_builder_.UnsafeAppend(values_begin, values_end);
|
| 279 |
+
null_bitmap_builder_.UnsafeAppend<true>(
|
| 280 |
+
length, [&valid_begin]() -> bool { return *valid_begin++; });
|
| 281 |
+
length_ = null_bitmap_builder_.length();
|
| 282 |
+
null_count_ = null_bitmap_builder_.false_count();
|
| 283 |
+
return Status::OK();
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
// Same as above, with a pointer type ValidIter
|
| 287 |
+
template <typename ValuesIter, typename ValidIter>
|
| 288 |
+
enable_if_t<std::is_pointer<ValidIter>::value, Status> AppendValues(
|
| 289 |
+
ValuesIter values_begin, ValuesIter values_end, ValidIter valid_begin) {
|
| 290 |
+
int64_t length = static_cast<int64_t>(std::distance(values_begin, values_end));
|
| 291 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 292 |
+
data_builder_.UnsafeAppend(values_begin, values_end);
|
| 293 |
+
// this updates the length_
|
| 294 |
+
if (valid_begin == NULLPTR) {
|
| 295 |
+
UnsafeSetNotNull(length);
|
| 296 |
+
} else {
|
| 297 |
+
null_bitmap_builder_.UnsafeAppend<true>(
|
| 298 |
+
length, [&valid_begin]() -> bool { return *valid_begin++; });
|
| 299 |
+
length_ = null_bitmap_builder_.length();
|
| 300 |
+
null_count_ = null_bitmap_builder_.false_count();
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
return Status::OK();
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 307 |
+
int64_t length) override {
|
| 308 |
+
return AppendValues(array.GetValues<value_type>(1) + offset, length,
|
| 309 |
+
array.GetValues<uint8_t>(0, 0), array.offset + offset);
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
/// Append a single scalar under the assumption that the underlying Buffer is
|
| 313 |
+
/// large enough.
|
| 314 |
+
///
|
| 315 |
+
/// This method does not capacity-check; make sure to call Reserve
|
| 316 |
+
/// beforehand.
|
| 317 |
+
void UnsafeAppend(const value_type val) {
|
| 318 |
+
ArrayBuilder::UnsafeAppendToBitmap(true);
|
| 319 |
+
data_builder_.UnsafeAppend(val);
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
void UnsafeAppendNull() {
|
| 323 |
+
ArrayBuilder::UnsafeAppendToBitmap(false);
|
| 324 |
+
data_builder_.UnsafeAppend(value_type{}); // zero
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
/// Advance builder without allocating nor writing any values
|
| 328 |
+
///
|
| 329 |
+
/// The internal pointer is advanced by `length` values and the same number
|
| 330 |
+
/// of non-null entries are appended to the validity bitmap.
|
| 331 |
+
/// This method assumes that the `length` values were populated directly,
|
| 332 |
+
/// for example using `GetMutableValue`.
|
| 333 |
+
void UnsafeAdvance(int64_t length) {
|
| 334 |
+
data_builder_.UnsafeAdvance(length);
|
| 335 |
+
UnsafeAppendToBitmap(length, true);
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
/// Advance builder without allocating nor writing any values
|
| 339 |
+
///
|
| 340 |
+
/// The internal pointer is advanced by `length` values and the same number
|
| 341 |
+
/// of validity bits are appended to the validity bitmap.
|
| 342 |
+
/// This method assumes that the `length` values were populated directly,
|
| 343 |
+
/// for example using `GetMutableValue`.
|
| 344 |
+
void UnsafeAdvance(int64_t length, const uint8_t* validity, int64_t valid_bits_offset) {
|
| 345 |
+
data_builder_.UnsafeAdvance(length);
|
| 346 |
+
UnsafeAppendToBitmap(validity, valid_bits_offset, length);
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
std::shared_ptr<DataType> type() const override { return type_; }
|
| 350 |
+
|
| 351 |
+
protected:
|
| 352 |
+
std::shared_ptr<DataType> type_;
|
| 353 |
+
TypedBufferBuilder<value_type> data_builder_;
|
| 354 |
+
};
|
| 355 |
+
|
| 356 |
+
// Builders
|
| 357 |
+
|
| 358 |
+
using UInt8Builder = NumericBuilder<UInt8Type>;
|
| 359 |
+
using UInt16Builder = NumericBuilder<UInt16Type>;
|
| 360 |
+
using UInt32Builder = NumericBuilder<UInt32Type>;
|
| 361 |
+
using UInt64Builder = NumericBuilder<UInt64Type>;
|
| 362 |
+
|
| 363 |
+
using Int8Builder = NumericBuilder<Int8Type>;
|
| 364 |
+
using Int16Builder = NumericBuilder<Int16Type>;
|
| 365 |
+
using Int32Builder = NumericBuilder<Int32Type>;
|
| 366 |
+
using Int64Builder = NumericBuilder<Int64Type>;
|
| 367 |
+
|
| 368 |
+
using FloatBuilder = NumericBuilder<FloatType>;
|
| 369 |
+
using DoubleBuilder = NumericBuilder<DoubleType>;
|
| 370 |
+
|
| 371 |
+
/// @}
|
| 372 |
+
|
| 373 |
+
/// \addtogroup temporal-builders
|
| 374 |
+
///
|
| 375 |
+
/// @{
|
| 376 |
+
|
| 377 |
+
using Date32Builder = NumericBuilder<Date32Type>;
|
| 378 |
+
using Date64Builder = NumericBuilder<Date64Type>;
|
| 379 |
+
using Time32Builder = NumericBuilder<Time32Type>;
|
| 380 |
+
using Time64Builder = NumericBuilder<Time64Type>;
|
| 381 |
+
using TimestampBuilder = NumericBuilder<TimestampType>;
|
| 382 |
+
using MonthIntervalBuilder = NumericBuilder<MonthIntervalType>;
|
| 383 |
+
using DurationBuilder = NumericBuilder<DurationType>;
|
| 384 |
+
|
| 385 |
+
/// @}
|
| 386 |
+
|
| 387 |
+
/// \addtogroup numeric-builders
|
| 388 |
+
///
|
| 389 |
+
/// @{
|
| 390 |
+
|
| 391 |
+
class ARROW_EXPORT HalfFloatBuilder : public NumericBuilder<HalfFloatType> {
|
| 392 |
+
public:
|
| 393 |
+
using BaseClass = NumericBuilder<HalfFloatType>;
|
| 394 |
+
using Float16 = arrow::util::Float16;
|
| 395 |
+
|
| 396 |
+
using BaseClass::Append;
|
| 397 |
+
using BaseClass::AppendValues;
|
| 398 |
+
using BaseClass::BaseClass;
|
| 399 |
+
using BaseClass::GetValue;
|
| 400 |
+
using BaseClass::UnsafeAppend;
|
| 401 |
+
|
| 402 |
+
/// Scalar append a arrow::util::Float16
|
| 403 |
+
Status Append(const Float16 val) { return Append(val.bits()); }
|
| 404 |
+
|
| 405 |
+
/// Scalar append a arrow::util::Float16, without checking for capacity
|
| 406 |
+
void UnsafeAppend(const Float16 val) { UnsafeAppend(val.bits()); }
|
| 407 |
+
|
| 408 |
+
/// \brief Append a sequence of elements in one shot
|
| 409 |
+
/// \param[in] values a contiguous array of arrow::util::Float16
|
| 410 |
+
/// \param[in] length the number of values to append
|
| 411 |
+
/// \param[in] valid_bytes an optional sequence of bytes where non-zero
|
| 412 |
+
/// indicates a valid (non-null) value
|
| 413 |
+
/// \return Status
|
| 414 |
+
Status AppendValues(const Float16* values, int64_t length,
|
| 415 |
+
const uint8_t* valid_bytes = NULLPTR) {
|
| 416 |
+
return BaseClass::AppendValues(reinterpret_cast<const uint16_t*>(values), length,
|
| 417 |
+
valid_bytes);
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
/// \brief Append a sequence of elements in one shot
|
| 421 |
+
/// \param[in] values a contiguous array of arrow::util::Float16
|
| 422 |
+
/// \param[in] length the number of values to append
|
| 423 |
+
/// \param[in] bitmap a validity bitmap to copy (may be null)
|
| 424 |
+
/// \param[in] bitmap_offset an offset into the validity bitmap
|
| 425 |
+
/// \return Status
|
| 426 |
+
Status AppendValues(const Float16* values, int64_t length, const uint8_t* bitmap,
|
| 427 |
+
int64_t bitmap_offset) {
|
| 428 |
+
return BaseClass::AppendValues(reinterpret_cast<const uint16_t*>(values), length,
|
| 429 |
+
bitmap, bitmap_offset);
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
/// \brief Append a sequence of elements in one shot
|
| 433 |
+
/// \param[in] values a contiguous array of arrow::util::Float16
|
| 434 |
+
/// \param[in] length the number of values to append
|
| 435 |
+
/// \param[in] is_valid a std::vector<bool> indicating valid (1) or null
|
| 436 |
+
/// (0). Equal in length to values
|
| 437 |
+
/// \return Status
|
| 438 |
+
Status AppendValues(const Float16* values, int64_t length,
|
| 439 |
+
const std::vector<bool>& is_valid) {
|
| 440 |
+
return BaseClass::AppendValues(reinterpret_cast<const uint16_t*>(values), length,
|
| 441 |
+
is_valid);
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
/// \brief Append a sequence of elements in one shot
|
| 445 |
+
/// \param[in] values a std::vector<arrow::util::Float16>
|
| 446 |
+
/// \param[in] is_valid a std::vector<bool> indicating valid (1) or null
|
| 447 |
+
/// (0). Equal in length to values
|
| 448 |
+
/// \return Status
|
| 449 |
+
Status AppendValues(const std::vector<Float16>& values,
|
| 450 |
+
const std::vector<bool>& is_valid) {
|
| 451 |
+
return AppendValues(values.data(), static_cast<int64_t>(values.size()), is_valid);
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
/// \brief Append a sequence of elements in one shot
|
| 455 |
+
/// \param[in] values a std::vector<arrow::util::Float16>
|
| 456 |
+
/// \return Status
|
| 457 |
+
Status AppendValues(const std::vector<Float16>& values) {
|
| 458 |
+
return AppendValues(values.data(), static_cast<int64_t>(values.size()));
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
/// \brief Append one value many times in one shot
|
| 462 |
+
/// \param[in] length the number of values to append
|
| 463 |
+
/// \param[in] value a arrow::util::Float16
|
| 464 |
+
Status AppendValues(int64_t length, Float16 value) {
|
| 465 |
+
RETURN_NOT_OK(Reserve(length));
|
| 466 |
+
data_builder_.UnsafeAppend(length, value.bits());
|
| 467 |
+
ArrayBuilder::UnsafeSetNotNull(length);
|
| 468 |
+
return Status::OK();
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
/// \brief Get the value at a certain index
|
| 472 |
+
/// \param[in] index the zero-based index
|
| 473 |
+
/// @tparam T arrow::util::Float16 or value_type (uint16_t)
|
| 474 |
+
template <typename T = BaseClass::value_type>
|
| 475 |
+
T GetValue(int64_t index) const {
|
| 476 |
+
static_assert(std::is_same_v<T, BaseClass::value_type> ||
|
| 477 |
+
std::is_same_v<T, arrow::util::Float16>);
|
| 478 |
+
if constexpr (std::is_same_v<T, BaseClass::value_type>) {
|
| 479 |
+
return BaseClass::GetValue(index);
|
| 480 |
+
} else {
|
| 481 |
+
return Float16::FromBits(BaseClass::GetValue(index));
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
};
|
| 485 |
+
|
| 486 |
+
/// @}
|
| 487 |
+
|
| 488 |
+
class ARROW_EXPORT BooleanBuilder
|
| 489 |
+
: public ArrayBuilder,
|
| 490 |
+
public internal::ArrayBuilderExtraOps<BooleanBuilder, bool> {
|
| 491 |
+
public:
|
| 492 |
+
using TypeClass = BooleanType;
|
| 493 |
+
using value_type = bool;
|
| 494 |
+
|
| 495 |
+
explicit BooleanBuilder(MemoryPool* pool = default_memory_pool(),
|
| 496 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 497 |
+
|
| 498 |
+
BooleanBuilder(const std::shared_ptr<DataType>& type,
|
| 499 |
+
MemoryPool* pool = default_memory_pool(),
|
| 500 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 501 |
+
|
| 502 |
+
/// Write nulls as uint8_t* (0 value indicates null) into pre-allocated memory
|
| 503 |
+
Status AppendNulls(int64_t length) final {
|
| 504 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 505 |
+
data_builder_.UnsafeAppend(length, false);
|
| 506 |
+
UnsafeSetNull(length);
|
| 507 |
+
return Status::OK();
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
Status AppendNull() final {
|
| 511 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 512 |
+
UnsafeAppendNull();
|
| 513 |
+
return Status::OK();
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
Status AppendEmptyValue() final {
|
| 517 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 518 |
+
data_builder_.UnsafeAppend(false);
|
| 519 |
+
UnsafeSetNotNull(1);
|
| 520 |
+
return Status::OK();
|
| 521 |
+
}
|
| 522 |
+
|
| 523 |
+
Status AppendEmptyValues(int64_t length) final {
|
| 524 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 525 |
+
data_builder_.UnsafeAppend(length, false);
|
| 526 |
+
UnsafeSetNotNull(length);
|
| 527 |
+
return Status::OK();
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
/// Scalar append
|
| 531 |
+
Status Append(const bool val) {
|
| 532 |
+
ARROW_RETURN_NOT_OK(Reserve(1));
|
| 533 |
+
UnsafeAppend(val);
|
| 534 |
+
return Status::OK();
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
Status Append(const uint8_t val) { return Append(val != 0); }
|
| 538 |
+
|
| 539 |
+
/// Scalar append, without checking for capacity
|
| 540 |
+
void UnsafeAppend(const bool val) {
|
| 541 |
+
data_builder_.UnsafeAppend(val);
|
| 542 |
+
UnsafeAppendToBitmap(true);
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
void UnsafeAppendNull() {
|
| 546 |
+
data_builder_.UnsafeAppend(false);
|
| 547 |
+
UnsafeAppendToBitmap(false);
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
void UnsafeAppend(const uint8_t val) { UnsafeAppend(val != 0); }
|
| 551 |
+
|
| 552 |
+
/// \brief Append a sequence of elements in one shot
|
| 553 |
+
/// \param[in] values a contiguous array of bytes (non-zero is 1)
|
| 554 |
+
/// \param[in] length the number of values to append
|
| 555 |
+
/// \param[in] valid_bytes an optional sequence of bytes where non-zero
|
| 556 |
+
/// indicates a valid (non-null) value
|
| 557 |
+
/// \return Status
|
| 558 |
+
Status AppendValues(const uint8_t* values, int64_t length,
|
| 559 |
+
const uint8_t* valid_bytes = NULLPTR);
|
| 560 |
+
|
| 561 |
+
/// \brief Append a sequence of elements in one shot
|
| 562 |
+
/// \param[in] values a bitmap of values
|
| 563 |
+
/// \param[in] length the number of values to append
|
| 564 |
+
/// \param[in] validity a validity bitmap to copy (may be null)
|
| 565 |
+
/// \param[in] offset an offset into the values and validity bitmaps
|
| 566 |
+
/// \return Status
|
| 567 |
+
Status AppendValues(const uint8_t* values, int64_t length, const uint8_t* validity,
|
| 568 |
+
int64_t offset);
|
| 569 |
+
|
| 570 |
+
/// \brief Append a sequence of elements in one shot
|
| 571 |
+
/// \param[in] values a contiguous C array of values
|
| 572 |
+
/// \param[in] length the number of values to append
|
| 573 |
+
/// \param[in] is_valid an std::vector<bool> indicating valid (1) or null
|
| 574 |
+
/// (0). Equal in length to values
|
| 575 |
+
/// \return Status
|
| 576 |
+
Status AppendValues(const uint8_t* values, int64_t length,
|
| 577 |
+
const std::vector<bool>& is_valid);
|
| 578 |
+
|
| 579 |
+
/// \brief Append a sequence of elements in one shot
|
| 580 |
+
/// \param[in] values a std::vector of bytes
|
| 581 |
+
/// \param[in] is_valid an std::vector<bool> indicating valid (1) or null
|
| 582 |
+
/// (0). Equal in length to values
|
| 583 |
+
/// \return Status
|
| 584 |
+
Status AppendValues(const std::vector<uint8_t>& values,
|
| 585 |
+
const std::vector<bool>& is_valid);
|
| 586 |
+
|
| 587 |
+
/// \brief Append a sequence of elements in one shot
|
| 588 |
+
/// \param[in] values a std::vector of bytes
|
| 589 |
+
/// \return Status
|
| 590 |
+
Status AppendValues(const std::vector<uint8_t>& values);
|
| 591 |
+
|
| 592 |
+
/// \brief Append a sequence of elements in one shot
|
| 593 |
+
/// \param[in] values an std::vector<bool> indicating true (1) or false
|
| 594 |
+
/// \param[in] is_valid an std::vector<bool> indicating valid (1) or null
|
| 595 |
+
/// (0). Equal in length to values
|
| 596 |
+
/// \return Status
|
| 597 |
+
Status AppendValues(const std::vector<bool>& values, const std::vector<bool>& is_valid);
|
| 598 |
+
|
| 599 |
+
/// \brief Append a sequence of elements in one shot
|
| 600 |
+
/// \param[in] values an std::vector<bool> indicating true (1) or false
|
| 601 |
+
/// \return Status
|
| 602 |
+
Status AppendValues(const std::vector<bool>& values);
|
| 603 |
+
|
| 604 |
+
/// \brief Append a sequence of elements in one shot
|
| 605 |
+
/// \param[in] values_begin InputIterator to the beginning of the values
|
| 606 |
+
/// \param[in] values_end InputIterator pointing to the end of the values
|
| 607 |
+
/// or null(0) values
|
| 608 |
+
/// \return Status
|
| 609 |
+
template <typename ValuesIter>
|
| 610 |
+
Status AppendValues(ValuesIter values_begin, ValuesIter values_end) {
|
| 611 |
+
int64_t length = static_cast<int64_t>(std::distance(values_begin, values_end));
|
| 612 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 613 |
+
data_builder_.UnsafeAppend<false>(
|
| 614 |
+
length, [&values_begin]() -> bool { return *values_begin++; });
|
| 615 |
+
// this updates length_
|
| 616 |
+
UnsafeSetNotNull(length);
|
| 617 |
+
return Status::OK();
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
/// \brief Append a sequence of elements in one shot, with a specified nullmap
|
| 621 |
+
/// \param[in] values_begin InputIterator to the beginning of the values
|
| 622 |
+
/// \param[in] values_end InputIterator pointing to the end of the values
|
| 623 |
+
/// \param[in] valid_begin InputIterator with elements indication valid(1)
|
| 624 |
+
/// or null(0) values
|
| 625 |
+
/// \return Status
|
| 626 |
+
template <typename ValuesIter, typename ValidIter>
|
| 627 |
+
enable_if_t<!std::is_pointer<ValidIter>::value, Status> AppendValues(
|
| 628 |
+
ValuesIter values_begin, ValuesIter values_end, ValidIter valid_begin) {
|
| 629 |
+
static_assert(!internal::is_null_pointer<ValidIter>::value,
|
| 630 |
+
"Don't pass a NULLPTR directly as valid_begin, use the 2-argument "
|
| 631 |
+
"version instead");
|
| 632 |
+
int64_t length = static_cast<int64_t>(std::distance(values_begin, values_end));
|
| 633 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 634 |
+
|
| 635 |
+
data_builder_.UnsafeAppend<false>(
|
| 636 |
+
length, [&values_begin]() -> bool { return *values_begin++; });
|
| 637 |
+
null_bitmap_builder_.UnsafeAppend<true>(
|
| 638 |
+
length, [&valid_begin]() -> bool { return *valid_begin++; });
|
| 639 |
+
length_ = null_bitmap_builder_.length();
|
| 640 |
+
null_count_ = null_bitmap_builder_.false_count();
|
| 641 |
+
return Status::OK();
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
// Same as above, for a pointer type ValidIter
|
| 645 |
+
template <typename ValuesIter, typename ValidIter>
|
| 646 |
+
enable_if_t<std::is_pointer<ValidIter>::value, Status> AppendValues(
|
| 647 |
+
ValuesIter values_begin, ValuesIter values_end, ValidIter valid_begin) {
|
| 648 |
+
int64_t length = static_cast<int64_t>(std::distance(values_begin, values_end));
|
| 649 |
+
ARROW_RETURN_NOT_OK(Reserve(length));
|
| 650 |
+
data_builder_.UnsafeAppend<false>(
|
| 651 |
+
length, [&values_begin]() -> bool { return *values_begin++; });
|
| 652 |
+
|
| 653 |
+
if (valid_begin == NULLPTR) {
|
| 654 |
+
UnsafeSetNotNull(length);
|
| 655 |
+
} else {
|
| 656 |
+
null_bitmap_builder_.UnsafeAppend<true>(
|
| 657 |
+
length, [&valid_begin]() -> bool { return *valid_begin++; });
|
| 658 |
+
}
|
| 659 |
+
length_ = null_bitmap_builder_.length();
|
| 660 |
+
null_count_ = null_bitmap_builder_.false_count();
|
| 661 |
+
return Status::OK();
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
Status AppendValues(int64_t length, bool value);
|
| 665 |
+
|
| 666 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 667 |
+
int64_t length) override {
|
| 668 |
+
return AppendValues(array.GetValues<uint8_t>(1, 0), length,
|
| 669 |
+
array.GetValues<uint8_t>(0, 0), array.offset + offset);
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 673 |
+
|
| 674 |
+
/// \cond FALSE
|
| 675 |
+
using ArrayBuilder::Finish;
|
| 676 |
+
/// \endcond
|
| 677 |
+
|
| 678 |
+
Status Finish(std::shared_ptr<BooleanArray>* out) { return FinishTyped(out); }
|
| 679 |
+
|
| 680 |
+
void Reset() override;
|
| 681 |
+
Status Resize(int64_t capacity) override;
|
| 682 |
+
|
| 683 |
+
std::shared_ptr<DataType> type() const override { return boolean(); }
|
| 684 |
+
|
| 685 |
+
protected:
|
| 686 |
+
TypedBufferBuilder<bool> data_builder_;
|
| 687 |
+
};
|
| 688 |
+
|
| 689 |
+
} // namespace arrow
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/pyarrow/include/arrow/array/builder_run_end.h
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <limits>
|
| 22 |
+
#include <memory>
|
| 23 |
+
#include <utility>
|
| 24 |
+
#include <vector>
|
| 25 |
+
|
| 26 |
+
#include "arrow/array.h"
|
| 27 |
+
#include "arrow/array/builder_base.h"
|
| 28 |
+
|
| 29 |
+
namespace arrow {
|
| 30 |
+
|
| 31 |
+
/// \addtogroup run-end-encoded-builders
|
| 32 |
+
///
|
| 33 |
+
/// @{
|
| 34 |
+
|
| 35 |
+
namespace internal {
|
| 36 |
+
|
| 37 |
+
/// \brief An ArrayBuilder that deduplicates repeated values as they are
|
| 38 |
+
/// appended to the inner-ArrayBuilder and reports the length of the current run
|
| 39 |
+
/// of identical values.
|
| 40 |
+
///
|
| 41 |
+
/// The following sequence of calls
|
| 42 |
+
///
|
| 43 |
+
/// Append(2)
|
| 44 |
+
/// Append(2)
|
| 45 |
+
/// Append(2)
|
| 46 |
+
/// Append(7)
|
| 47 |
+
/// Append(7)
|
| 48 |
+
/// Append(2)
|
| 49 |
+
/// FinishInternal()
|
| 50 |
+
///
|
| 51 |
+
/// will cause the inner-builder to receive only 3 Append calls
|
| 52 |
+
///
|
| 53 |
+
/// Append(2)
|
| 54 |
+
/// Append(7)
|
| 55 |
+
/// Append(2)
|
| 56 |
+
/// FinishInternal()
|
| 57 |
+
///
|
| 58 |
+
/// Note that values returned by length(), null_count() and capacity() are
|
| 59 |
+
/// related to the compressed array built by the inner-ArrayBuilder.
|
| 60 |
+
class RunCompressorBuilder : public ArrayBuilder {
|
| 61 |
+
public:
|
| 62 |
+
RunCompressorBuilder(MemoryPool* pool, std::shared_ptr<ArrayBuilder> inner_builder,
|
| 63 |
+
std::shared_ptr<DataType> type);
|
| 64 |
+
|
| 65 |
+
~RunCompressorBuilder() override;
|
| 66 |
+
|
| 67 |
+
ARROW_DISALLOW_COPY_AND_ASSIGN(RunCompressorBuilder);
|
| 68 |
+
|
| 69 |
+
/// \brief Called right before a run is being closed
|
| 70 |
+
///
|
| 71 |
+
/// Subclasses can override this function to perform an additional action when
|
| 72 |
+
/// a run is closed (i.e. run-length is known and value is appended to the
|
| 73 |
+
/// inner builder).
|
| 74 |
+
///
|
| 75 |
+
/// \param value can be NULLPTR if closing a run of NULLs
|
| 76 |
+
/// \param length the greater than 0 length of the value run being closed
|
| 77 |
+
virtual Status WillCloseRun(const std::shared_ptr<const Scalar>& value,
|
| 78 |
+
int64_t length) {
|
| 79 |
+
return Status::OK();
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/// \brief Called right before a run of empty values is being closed
|
| 83 |
+
///
|
| 84 |
+
/// Subclasses can override this function to perform an additional action when
|
| 85 |
+
/// a run of empty values is appended (i.e. run-length is known and a single
|
| 86 |
+
/// empty value is appended to the inner builder).
|
| 87 |
+
///
|
| 88 |
+
/// \param length the greater than 0 length of the value run being closed
|
| 89 |
+
virtual Status WillCloseRunOfEmptyValues(int64_t length) { return Status::OK(); }
|
| 90 |
+
|
| 91 |
+
/// \brief Allocate enough memory for a given number of array elements.
|
| 92 |
+
///
|
| 93 |
+
/// NOTE: Conservatively resizing a run-length compressed array for a given
|
| 94 |
+
/// number of logical elements is not possible, since the physical length will
|
| 95 |
+
/// vary depending on the values to be appended in the future. But we can
|
| 96 |
+
/// pessimistically assume that each run will contain a single value and
|
| 97 |
+
/// allocate that number of runs.
|
| 98 |
+
Status Resize(int64_t capacity) override { return ResizePhysical(capacity); }
|
| 99 |
+
|
| 100 |
+
/// \brief Allocate enough memory for a given number of runs.
|
| 101 |
+
///
|
| 102 |
+
/// Like Resize on non-encoded builders, it does not account for variable size
|
| 103 |
+
/// data.
|
| 104 |
+
Status ResizePhysical(int64_t capacity);
|
| 105 |
+
|
| 106 |
+
Status ReservePhysical(int64_t additional_capacity) {
|
| 107 |
+
return Reserve(additional_capacity);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
void Reset() override;
|
| 111 |
+
|
| 112 |
+
Status AppendNull() final { return AppendNulls(1); }
|
| 113 |
+
Status AppendNulls(int64_t length) override;
|
| 114 |
+
|
| 115 |
+
Status AppendEmptyValue() final { return AppendEmptyValues(1); }
|
| 116 |
+
Status AppendEmptyValues(int64_t length) override;
|
| 117 |
+
|
| 118 |
+
Status AppendScalar(const Scalar& scalar, int64_t n_repeats) override;
|
| 119 |
+
Status AppendScalars(const ScalarVector& scalars) override;
|
| 120 |
+
|
| 121 |
+
// AppendArraySlice() is not implemented.
|
| 122 |
+
|
| 123 |
+
/// \brief Append a slice of an array containing values from already
|
| 124 |
+
/// compressed runs.
|
| 125 |
+
///
|
| 126 |
+
/// NOTE: WillCloseRun() is not called as the length of each run cannot be
|
| 127 |
+
/// determined at this point. Caller should ensure that !has_open_run() by
|
| 128 |
+
/// calling FinishCurrentRun() before calling this.
|
| 129 |
+
///
|
| 130 |
+
/// Pre-condition: !has_open_run()
|
| 131 |
+
Status AppendRunCompressedArraySlice(const ArraySpan& array, int64_t offset,
|
| 132 |
+
int64_t length);
|
| 133 |
+
|
| 134 |
+
/// \brief Forces the closing of the current run if one is currently open.
|
| 135 |
+
///
|
| 136 |
+
/// This can be called when one wants to ensure the current run will not be
|
| 137 |
+
/// extended. This may cause identical values to appear close to each other in
|
| 138 |
+
/// the underlying array (i.e. two runs that could be a single run) if more
|
| 139 |
+
/// values are appended after this is called.
|
| 140 |
+
///
|
| 141 |
+
/// Finish() and FinishInternal() call this automatically.
|
| 142 |
+
virtual Status FinishCurrentRun();
|
| 143 |
+
|
| 144 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 145 |
+
|
| 146 |
+
ArrayBuilder& inner_builder() const { return *inner_builder_; }
|
| 147 |
+
|
| 148 |
+
std::shared_ptr<DataType> type() const override { return inner_builder_->type(); }
|
| 149 |
+
|
| 150 |
+
bool has_open_run() const { return current_run_length_ > 0; }
|
| 151 |
+
int64_t open_run_length() const { return current_run_length_; }
|
| 152 |
+
|
| 153 |
+
private:
|
| 154 |
+
inline void UpdateDimensions() {
|
| 155 |
+
capacity_ = inner_builder_->capacity();
|
| 156 |
+
length_ = inner_builder_->length();
|
| 157 |
+
null_count_ = inner_builder_->null_count();
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
private:
|
| 161 |
+
std::shared_ptr<ArrayBuilder> inner_builder_;
|
| 162 |
+
std::shared_ptr<const Scalar> current_value_ = NULLPTR;
|
| 163 |
+
int64_t current_run_length_ = 0;
|
| 164 |
+
};
|
| 165 |
+
|
| 166 |
+
} // namespace internal
|
| 167 |
+
|
| 168 |
+
// ----------------------------------------------------------------------
|
| 169 |
+
// RunEndEncoded builder
|
| 170 |
+
|
| 171 |
+
/// \brief Run-end encoded array builder.
|
| 172 |
+
///
|
| 173 |
+
/// NOTE: the value returned by and capacity() is related to the
|
| 174 |
+
/// compressed array (physical) and not the decoded array (logical) that is
|
| 175 |
+
/// run-end encoded. null_count() always returns 0. length(), on the other hand,
|
| 176 |
+
/// returns the logical length of the run-end encoded array.
|
| 177 |
+
class ARROW_EXPORT RunEndEncodedBuilder : public ArrayBuilder {
|
| 178 |
+
private:
|
| 179 |
+
// An internal::RunCompressorBuilder that produces a run-end in the
|
| 180 |
+
// RunEndEncodedBuilder every time a value-run is closed.
|
| 181 |
+
class ValueRunBuilder : public internal::RunCompressorBuilder {
|
| 182 |
+
public:
|
| 183 |
+
ValueRunBuilder(MemoryPool* pool, const std::shared_ptr<ArrayBuilder>& value_builder,
|
| 184 |
+
const std::shared_ptr<DataType>& value_type,
|
| 185 |
+
RunEndEncodedBuilder& ree_builder);
|
| 186 |
+
|
| 187 |
+
~ValueRunBuilder() override = default;
|
| 188 |
+
|
| 189 |
+
Status WillCloseRun(const std::shared_ptr<const Scalar>&, int64_t length) override {
|
| 190 |
+
return ree_builder_.CloseRun(length);
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
Status WillCloseRunOfEmptyValues(int64_t length) override {
|
| 194 |
+
return ree_builder_.CloseRun(length);
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
private:
|
| 198 |
+
RunEndEncodedBuilder& ree_builder_;
|
| 199 |
+
};
|
| 200 |
+
|
| 201 |
+
public:
|
| 202 |
+
RunEndEncodedBuilder(MemoryPool* pool,
|
| 203 |
+
const std::shared_ptr<ArrayBuilder>& run_end_builder,
|
| 204 |
+
const std::shared_ptr<ArrayBuilder>& value_builder,
|
| 205 |
+
std::shared_ptr<DataType> type);
|
| 206 |
+
|
| 207 |
+
/// \brief Allocate enough memory for a given number of array elements.
|
| 208 |
+
///
|
| 209 |
+
/// NOTE: Conservatively resizing an REE for a given number of logical
|
| 210 |
+
/// elements is not possible, since the physical length will vary depending on
|
| 211 |
+
/// the values to be appended in the future. But we can pessimistically assume
|
| 212 |
+
/// that each run will contain a single value and allocate that number of
|
| 213 |
+
/// runs.
|
| 214 |
+
Status Resize(int64_t capacity) override { return ResizePhysical(capacity); }
|
| 215 |
+
|
| 216 |
+
/// \brief Allocate enough memory for a given number of runs.
|
| 217 |
+
Status ResizePhysical(int64_t capacity);
|
| 218 |
+
|
| 219 |
+
/// \brief Ensure that there is enough space allocated to append the indicated
|
| 220 |
+
/// number of run without any further reallocation. Overallocation is
|
| 221 |
+
/// used in order to minimize the impact of incremental ReservePhysical() calls.
|
| 222 |
+
/// Note that additional_capacity is relative to the current number of elements
|
| 223 |
+
/// rather than to the current capacity, so calls to Reserve() which are not
|
| 224 |
+
/// interspersed with addition of new elements may not increase the capacity.
|
| 225 |
+
///
|
| 226 |
+
/// \param[in] additional_capacity the number of additional runs
|
| 227 |
+
/// \return Status
|
| 228 |
+
Status ReservePhysical(int64_t additional_capacity) {
|
| 229 |
+
return Reserve(additional_capacity);
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
void Reset() override;
|
| 233 |
+
|
| 234 |
+
Status AppendNull() final { return AppendNulls(1); }
|
| 235 |
+
Status AppendNulls(int64_t length) override;
|
| 236 |
+
|
| 237 |
+
Status AppendEmptyValue() final { return AppendEmptyValues(1); }
|
| 238 |
+
Status AppendEmptyValues(int64_t length) override;
|
| 239 |
+
Status AppendScalar(const Scalar& scalar, int64_t n_repeats) override;
|
| 240 |
+
Status AppendScalars(const ScalarVector& scalars) override;
|
| 241 |
+
Status AppendArraySlice(const ArraySpan& array, int64_t offset,
|
| 242 |
+
int64_t length) override;
|
| 243 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 244 |
+
|
| 245 |
+
/// \cond FALSE
|
| 246 |
+
using ArrayBuilder::Finish;
|
| 247 |
+
/// \endcond
|
| 248 |
+
|
| 249 |
+
Status Finish(std::shared_ptr<RunEndEncodedArray>* out) { return FinishTyped(out); }
|
| 250 |
+
|
| 251 |
+
/// \brief Forces the closing of the current run if one is currently open.
|
| 252 |
+
///
|
| 253 |
+
/// This can be called when one wants to ensure the current run will not be
|
| 254 |
+
/// extended. This may cause identical values to appear close to each other in
|
| 255 |
+
/// the values array (i.e. two runs that could be a single run) if more
|
| 256 |
+
/// values are appended after this is called.
|
| 257 |
+
Status FinishCurrentRun();
|
| 258 |
+
|
| 259 |
+
std::shared_ptr<DataType> type() const override;
|
| 260 |
+
|
| 261 |
+
private:
|
| 262 |
+
/// \brief Update physical capacity and logical length
|
| 263 |
+
///
|
| 264 |
+
/// \param committed_logical_length number of logical values that have been
|
| 265 |
+
/// committed to the values array
|
| 266 |
+
/// \param open_run_length number of logical values in the currently open run if any
|
| 267 |
+
inline void UpdateDimensions(int64_t committed_logical_length,
|
| 268 |
+
int64_t open_run_length) {
|
| 269 |
+
capacity_ = run_end_builder().capacity();
|
| 270 |
+
length_ = committed_logical_length + open_run_length;
|
| 271 |
+
committed_logical_length_ = committed_logical_length;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
// Pre-condition: !value_run_builder_.has_open_run()
|
| 275 |
+
template <typename RunEndCType>
|
| 276 |
+
Status DoAppendArraySlice(const ArraySpan& array, int64_t offset, int64_t length);
|
| 277 |
+
|
| 278 |
+
template <typename RunEndCType>
|
| 279 |
+
Status DoAppendRunEnd(int64_t run_end);
|
| 280 |
+
|
| 281 |
+
/// \brief Cast run_end to the appropriate type and appends it to the run_ends
|
| 282 |
+
/// array.
|
| 283 |
+
Status AppendRunEnd(int64_t run_end);
|
| 284 |
+
|
| 285 |
+
/// \brief Close a run by appending a value to the run_ends array and updating
|
| 286 |
+
/// length_ to reflect the new run.
|
| 287 |
+
///
|
| 288 |
+
/// Pre-condition: run_length > 0.
|
| 289 |
+
[[nodiscard]] Status CloseRun(int64_t run_length);
|
| 290 |
+
|
| 291 |
+
ArrayBuilder& run_end_builder();
|
| 292 |
+
ArrayBuilder& value_builder();
|
| 293 |
+
|
| 294 |
+
private:
|
| 295 |
+
std::shared_ptr<RunEndEncodedType> type_;
|
| 296 |
+
ValueRunBuilder* value_run_builder_;
|
| 297 |
+
// The length not counting the current open run in the value_run_builder_
|
| 298 |
+
int64_t committed_logical_length_ = 0;
|
| 299 |
+
};
|
| 300 |
+
|
| 301 |
+
/// @}
|
| 302 |
+
|
| 303 |
+
} // namespace arrow
|