snowflake-connector-python 3.16.0__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. snowflake/connector/__init__.py +96 -0
  2. snowflake/connector/_query_context_cache.py +276 -0
  3. snowflake/connector/_sql_util.py +48 -0
  4. snowflake/connector/_utils.py +70 -0
  5. snowflake/connector/arrow_context.py +203 -0
  6. snowflake/connector/auth/__init__.py +53 -0
  7. snowflake/connector/auth/_auth.py +586 -0
  8. snowflake/connector/auth/_http_server.py +220 -0
  9. snowflake/connector/auth/_oauth_base.py +400 -0
  10. snowflake/connector/auth/by_plugin.py +219 -0
  11. snowflake/connector/auth/default.py +36 -0
  12. snowflake/connector/auth/idtoken.py +72 -0
  13. snowflake/connector/auth/keypair.py +222 -0
  14. snowflake/connector/auth/no_auth.py +39 -0
  15. snowflake/connector/auth/oauth.py +49 -0
  16. snowflake/connector/auth/oauth_code.py +479 -0
  17. snowflake/connector/auth/oauth_credentials.py +66 -0
  18. snowflake/connector/auth/okta.py +335 -0
  19. snowflake/connector/auth/pat.py +39 -0
  20. snowflake/connector/auth/usrpwdmfa.py +69 -0
  21. snowflake/connector/auth/webbrowser.py +502 -0
  22. snowflake/connector/auth/workload_identity.py +94 -0
  23. snowflake/connector/azure_storage_client.py +276 -0
  24. snowflake/connector/backoff_policies.py +141 -0
  25. snowflake/connector/bind_upload_agent.py +89 -0
  26. snowflake/connector/cache.py +696 -0
  27. snowflake/connector/compat.py +127 -0
  28. snowflake/connector/config_manager.py +496 -0
  29. snowflake/connector/connection.py +2273 -0
  30. snowflake/connector/connection_diagnostic.py +776 -0
  31. snowflake/connector/constants.py +442 -0
  32. snowflake/connector/converter.py +785 -0
  33. snowflake/connector/converter_issue23517.py +87 -0
  34. snowflake/connector/converter_null.py +14 -0
  35. snowflake/connector/converter_snowsql.py +205 -0
  36. snowflake/connector/cursor.py +1951 -0
  37. snowflake/connector/dbapi.py +53 -0
  38. snowflake/connector/description.py +19 -0
  39. snowflake/connector/direct_file_operation_utils.py +88 -0
  40. snowflake/connector/encryption_util.py +220 -0
  41. snowflake/connector/errorcode.py +91 -0
  42. snowflake/connector/errors.py +615 -0
  43. snowflake/connector/externals_utils/__init__.py +0 -0
  44. snowflake/connector/externals_utils/externals_setup.py +27 -0
  45. snowflake/connector/feature.py +4 -0
  46. snowflake/connector/file_compression_type.py +118 -0
  47. snowflake/connector/file_lock.py +72 -0
  48. snowflake/connector/file_transfer_agent.py +1215 -0
  49. snowflake/connector/file_util.py +153 -0
  50. snowflake/connector/gcs_storage_client.py +474 -0
  51. snowflake/connector/gzip_decoder.py +85 -0
  52. snowflake/connector/local_storage_client.py +90 -0
  53. snowflake/connector/log_configuration.py +60 -0
  54. snowflake/connector/logging_utils/__init__.py +0 -0
  55. snowflake/connector/logging_utils/filters.py +72 -0
  56. snowflake/connector/nanoarrow_arrow_iterator.cp313-win_amd64.pyd +0 -0
  57. snowflake/connector/nanoarrow_cpp/ArrowIterator/ArrayConverter.cpp +60 -0
  58. snowflake/connector/nanoarrow_cpp/ArrowIterator/ArrayConverter.hpp +29 -0
  59. snowflake/connector/nanoarrow_cpp/ArrowIterator/BinaryConverter.cpp +19 -0
  60. snowflake/connector/nanoarrow_cpp/ArrowIterator/BinaryConverter.hpp +26 -0
  61. snowflake/connector/nanoarrow_cpp/ArrowIterator/BooleanConverter.cpp +21 -0
  62. snowflake/connector/nanoarrow_cpp/ArrowIterator/BooleanConverter.hpp +23 -0
  63. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowChunkIterator.cpp +557 -0
  64. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowChunkIterator.hpp +98 -0
  65. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowIterator.cpp +125 -0
  66. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowIterator.hpp +115 -0
  67. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowTableIterator.cpp +1005 -0
  68. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowTableIterator.hpp +127 -0
  69. snowflake/connector/nanoarrow_cpp/ArrowIterator/DateConverter.cpp +47 -0
  70. snowflake/connector/nanoarrow_cpp/ArrowIterator/DateConverter.hpp +46 -0
  71. snowflake/connector/nanoarrow_cpp/ArrowIterator/DecFloatConverter.cpp +83 -0
  72. snowflake/connector/nanoarrow_cpp/ArrowIterator/DecFloatConverter.hpp +35 -0
  73. snowflake/connector/nanoarrow_cpp/ArrowIterator/DecimalConverter.cpp +97 -0
  74. snowflake/connector/nanoarrow_cpp/ArrowIterator/DecimalConverter.hpp +72 -0
  75. snowflake/connector/nanoarrow_cpp/ArrowIterator/FixedSizeListConverter.cpp +73 -0
  76. snowflake/connector/nanoarrow_cpp/ArrowIterator/FixedSizeListConverter.hpp +28 -0
  77. snowflake/connector/nanoarrow_cpp/ArrowIterator/FloatConverter.cpp +30 -0
  78. snowflake/connector/nanoarrow_cpp/ArrowIterator/FloatConverter.hpp +35 -0
  79. snowflake/connector/nanoarrow_cpp/ArrowIterator/IColumnConverter.hpp +17 -0
  80. snowflake/connector/nanoarrow_cpp/ArrowIterator/IntConverter.cpp +23 -0
  81. snowflake/connector/nanoarrow_cpp/ArrowIterator/IntConverter.hpp +45 -0
  82. snowflake/connector/nanoarrow_cpp/ArrowIterator/IntervalConverter.cpp +71 -0
  83. snowflake/connector/nanoarrow_cpp/ArrowIterator/IntervalConverter.hpp +56 -0
  84. snowflake/connector/nanoarrow_cpp/ArrowIterator/LICENSE.txt +209 -0
  85. snowflake/connector/nanoarrow_cpp/ArrowIterator/MapConverter.cpp +75 -0
  86. snowflake/connector/nanoarrow_cpp/ArrowIterator/MapConverter.hpp +30 -0
  87. snowflake/connector/nanoarrow_cpp/ArrowIterator/ObjectConverter.cpp +46 -0
  88. snowflake/connector/nanoarrow_cpp/ArrowIterator/ObjectConverter.hpp +29 -0
  89. snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Common.cpp +8 -0
  90. snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Common.hpp +95 -0
  91. snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Helpers.cpp +57 -0
  92. snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Helpers.hpp +36 -0
  93. snowflake/connector/nanoarrow_cpp/ArrowIterator/SnowflakeType.cpp +34 -0
  94. snowflake/connector/nanoarrow_cpp/ArrowIterator/SnowflakeType.hpp +48 -0
  95. snowflake/connector/nanoarrow_cpp/ArrowIterator/StringConverter.cpp +19 -0
  96. snowflake/connector/nanoarrow_cpp/ArrowIterator/StringConverter.hpp +26 -0
  97. snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeConverter.cpp +36 -0
  98. snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeConverter.hpp +31 -0
  99. snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeStampConverter.cpp +346 -0
  100. snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeStampConverter.hpp +145 -0
  101. snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/macros.hpp +14 -0
  102. snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/time.cpp +65 -0
  103. snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/time.hpp +68 -0
  104. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_accessors.h +101 -0
  105. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_alloc.h +127 -0
  106. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_assert.h +45 -0
  107. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_builder.h +1908 -0
  108. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_emitter.h +215 -0
  109. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_endian.h +125 -0
  110. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_epilogue.h +7 -0
  111. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_flatbuffers.h +55 -0
  112. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_identifier.h +148 -0
  113. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_iov.h +31 -0
  114. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_prologue.h +8 -0
  115. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_refmap.h +144 -0
  116. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_rtconfig.h +162 -0
  117. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_types.h +97 -0
  118. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_verifier.h +239 -0
  119. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/flatcc_portable.h +14 -0
  120. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/paligned_alloc.h +210 -0
  121. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pattributes.h +84 -0
  122. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic.h +84 -0
  123. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic_pop.h +20 -0
  124. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic_push.h +51 -0
  125. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pendian.h +206 -0
  126. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pendian_detect.h +118 -0
  127. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pinline.h +19 -0
  128. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pinttypes.h +52 -0
  129. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/portable.h +2 -0
  130. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/portable_basic.h +25 -0
  131. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstatic_assert.h +67 -0
  132. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstdalign.h +162 -0
  133. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstdint.h +898 -0
  134. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/punaligned.h +190 -0
  135. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pversion.h +6 -0
  136. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pwarnings.h +52 -0
  137. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc.c +3204 -0
  138. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.c +3217 -0
  139. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.h +3618 -0
  140. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.hpp +379 -0
  141. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_arrow_iterator.pyx +256 -0
  142. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_device.c +512 -0
  143. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_device.h +350 -0
  144. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_ipc.c +33273 -0
  145. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_ipc.h +397 -0
  146. snowflake/connector/nanoarrow_cpp/Logging/logging.cpp +100 -0
  147. snowflake/connector/nanoarrow_cpp/Logging/logging.hpp +49 -0
  148. snowflake/connector/network.py +1297 -0
  149. snowflake/connector/ocsp_asn1crypto.py +447 -0
  150. snowflake/connector/ocsp_snowflake.py +1883 -0
  151. snowflake/connector/options.py +131 -0
  152. snowflake/connector/pandas_tools.py +732 -0
  153. snowflake/connector/proxy.py +43 -0
  154. snowflake/connector/py.typed +0 -0
  155. snowflake/connector/result_batch.py +786 -0
  156. snowflake/connector/result_set.py +319 -0
  157. snowflake/connector/s3_storage_client.py +605 -0
  158. snowflake/connector/secret_detector.py +181 -0
  159. snowflake/connector/sf_dirs.py +64 -0
  160. snowflake/connector/sfbinaryformat.py +35 -0
  161. snowflake/connector/sfdatetime.py +345 -0
  162. snowflake/connector/snow_logging.py +144 -0
  163. snowflake/connector/sqlstate.py +9 -0
  164. snowflake/connector/ssd_internal_keys.py +30 -0
  165. snowflake/connector/ssl_wrap_socket.py +134 -0
  166. snowflake/connector/storage_client.py +478 -0
  167. snowflake/connector/telemetry.py +249 -0
  168. snowflake/connector/telemetry_oob.py +543 -0
  169. snowflake/connector/test_util.py +30 -0
  170. snowflake/connector/time_util.py +159 -0
  171. snowflake/connector/token_cache.py +402 -0
  172. snowflake/connector/tool/__init__.py +0 -0
  173. snowflake/connector/tool/dump_certs.py +57 -0
  174. snowflake/connector/tool/dump_ocsp_response.py +139 -0
  175. snowflake/connector/tool/dump_ocsp_response_cache.py +194 -0
  176. snowflake/connector/tool/probe_connection.py +69 -0
  177. snowflake/connector/url_util.py +49 -0
  178. snowflake/connector/util_text.py +301 -0
  179. snowflake/connector/vendored/__init__.py +3 -0
  180. snowflake/connector/vendored/requests/LICENSE +175 -0
  181. snowflake/connector/vendored/requests/__init__.py +169 -0
  182. snowflake/connector/vendored/requests/__version__.py +14 -0
  183. snowflake/connector/vendored/requests/_internal_utils.py +50 -0
  184. snowflake/connector/vendored/requests/adapters.py +537 -0
  185. snowflake/connector/vendored/requests/api.py +157 -0
  186. snowflake/connector/vendored/requests/auth.py +315 -0
  187. snowflake/connector/vendored/requests/certs.py +17 -0
  188. snowflake/connector/vendored/requests/compat.py +79 -0
  189. snowflake/connector/vendored/requests/cookies.py +561 -0
  190. snowflake/connector/vendored/requests/exceptions.py +140 -0
  191. snowflake/connector/vendored/requests/help.py +134 -0
  192. snowflake/connector/vendored/requests/hooks.py +33 -0
  193. snowflake/connector/vendored/requests/models.py +1033 -0
  194. snowflake/connector/vendored/requests/sessions.py +833 -0
  195. snowflake/connector/vendored/requests/status_codes.py +128 -0
  196. snowflake/connector/vendored/requests/structures.py +99 -0
  197. snowflake/connector/vendored/requests/utils.py +1093 -0
  198. snowflake/connector/vendored/urllib3/LICENSE.txt +21 -0
  199. snowflake/connector/vendored/urllib3/__init__.py +85 -0
  200. snowflake/connector/vendored/urllib3/_collections.py +355 -0
  201. snowflake/connector/vendored/urllib3/_version.py +2 -0
  202. snowflake/connector/vendored/urllib3/connection.py +572 -0
  203. snowflake/connector/vendored/urllib3/connectionpool.py +1137 -0
  204. snowflake/connector/vendored/urllib3/contrib/__init__.py +0 -0
  205. snowflake/connector/vendored/urllib3/contrib/_appengine_environ.py +36 -0
  206. snowflake/connector/vendored/urllib3/contrib/_securetransport/__init__.py +0 -0
  207. snowflake/connector/vendored/urllib3/contrib/_securetransport/bindings.py +519 -0
  208. snowflake/connector/vendored/urllib3/contrib/_securetransport/low_level.py +397 -0
  209. snowflake/connector/vendored/urllib3/contrib/appengine.py +314 -0
  210. snowflake/connector/vendored/urllib3/contrib/ntlmpool.py +130 -0
  211. snowflake/connector/vendored/urllib3/contrib/pyopenssl.py +509 -0
  212. snowflake/connector/vendored/urllib3/contrib/securetransport.py +920 -0
  213. snowflake/connector/vendored/urllib3/contrib/socks.py +216 -0
  214. snowflake/connector/vendored/urllib3/exceptions.py +323 -0
  215. snowflake/connector/vendored/urllib3/fields.py +274 -0
  216. snowflake/connector/vendored/urllib3/filepost.py +98 -0
  217. snowflake/connector/vendored/urllib3/packages/__init__.py +0 -0
  218. snowflake/connector/vendored/urllib3/packages/backports/__init__.py +0 -0
  219. snowflake/connector/vendored/urllib3/packages/backports/makefile.py +51 -0
  220. snowflake/connector/vendored/urllib3/packages/backports/weakref_finalize.py +155 -0
  221. snowflake/connector/vendored/urllib3/packages/six.py +1076 -0
  222. snowflake/connector/vendored/urllib3/poolmanager.py +540 -0
  223. snowflake/connector/vendored/urllib3/request.py +191 -0
  224. snowflake/connector/vendored/urllib3/response.py +885 -0
  225. snowflake/connector/vendored/urllib3/util/__init__.py +49 -0
  226. snowflake/connector/vendored/urllib3/util/connection.py +156 -0
  227. snowflake/connector/vendored/urllib3/util/proxy.py +57 -0
  228. snowflake/connector/vendored/urllib3/util/queue.py +22 -0
  229. snowflake/connector/vendored/urllib3/util/request.py +146 -0
  230. snowflake/connector/vendored/urllib3/util/response.py +107 -0
  231. snowflake/connector/vendored/urllib3/util/retry.py +620 -0
  232. snowflake/connector/vendored/urllib3/util/ssl_.py +495 -0
  233. snowflake/connector/vendored/urllib3/util/ssl_match_hostname.py +159 -0
  234. snowflake/connector/vendored/urllib3/util/ssltransport.py +221 -0
  235. snowflake/connector/vendored/urllib3/util/timeout.py +271 -0
  236. snowflake/connector/vendored/urllib3/util/url.py +435 -0
  237. snowflake/connector/vendored/urllib3/util/wait.py +152 -0
  238. snowflake/connector/version.py +3 -0
  239. snowflake/connector/wif_util.py +407 -0
  240. snowflake_connector_python-3.16.0.dist-info/METADATA +1475 -0
  241. snowflake_connector_python-3.16.0.dist-info/RECORD +246 -0
  242. snowflake_connector_python-3.16.0.dist-info/WHEEL +5 -0
  243. snowflake_connector_python-3.16.0.dist-info/entry_points.txt +4 -0
  244. snowflake_connector_python-3.16.0.dist-info/licenses/LICENSE.txt +202 -0
  245. snowflake_connector_python-3.16.0.dist-info/licenses/NOTICE +8 -0
  246. snowflake_connector_python-3.16.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,350 @@
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
+ #ifndef NANOARROW_DEVICE_H_INCLUDED
19
+ #define NANOARROW_DEVICE_H_INCLUDED
20
+
21
+ #include "nanoarrow.h"
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ /// \defgroup nanoarrow_device-arrow-cdata Arrow C Device interface
28
+ ///
29
+ /// The Arrow Device and Stream interfaces are part of the
30
+ /// Arrow C Device Data and Arrow C Device stream interfaces
31
+ /// (https://arrow.apache.org/docs/dev/format/CDeviceDataInterface.html).
32
+ /// See the Arrow documentation for detailed documentation of these structures.
33
+ ///
34
+ /// @{
35
+
36
+ #ifndef ARROW_C_DEVICE_DATA_INTERFACE
37
+ #define ARROW_C_DEVICE_DATA_INTERFACE
38
+
39
+ // Device type for the allocated memory
40
+ typedef int32_t ArrowDeviceType;
41
+
42
+ // CPU device, same as using ArrowArray directly
43
+ #define ARROW_DEVICE_CPU 1
44
+ // CUDA GPU Device
45
+ #define ARROW_DEVICE_CUDA 2
46
+ // Pinned CUDA CPU memory by cudaMallocHost
47
+ #define ARROW_DEVICE_CUDA_HOST 3
48
+ // OpenCL Device
49
+ #define ARROW_DEVICE_OPENCL 4
50
+ // Vulkan buffer for next-gen graphics
51
+ #define ARROW_DEVICE_VULKAN 7
52
+ // Metal for Apple GPU
53
+ #define ARROW_DEVICE_METAL 8
54
+ // Verilog simulator buffer
55
+ #define ARROW_DEVICE_VPI 9
56
+ // ROCm GPUs for AMD GPUs
57
+ #define ARROW_DEVICE_ROCM 10
58
+ // Pinned ROCm CPU memory allocated by hipMallocHost
59
+ #define ARROW_DEVICE_ROCM_HOST 11
60
+ // Reserved for extension
61
+ //
62
+ // used to quickly test extension devices, semantics
63
+ // can differ based on implementation
64
+ #define ARROW_DEVICE_EXT_DEV 12
65
+ // CUDA managed/unified memory allocated by cudaMallocManaged
66
+ #define ARROW_DEVICE_CUDA_MANAGED 13
67
+ // Unified shared memory allocated on a oneAPI
68
+ // non-partitioned device.
69
+ //
70
+ // A call to the oneAPI runtime is required to determine the
71
+ // device type, the USM allocation type and the sycl context
72
+ // that it is bound to.
73
+ #define ARROW_DEVICE_ONEAPI 14
74
+ // GPU support for next-gen WebGPU standard
75
+ #define ARROW_DEVICE_WEBGPU 15
76
+ // Qualcomm Hexagon DSP
77
+ #define ARROW_DEVICE_HEXAGON 16
78
+
79
+ struct ArrowDeviceArray {
80
+ struct ArrowArray array;
81
+ int64_t device_id;
82
+ ArrowDeviceType device_type;
83
+ void* sync_event;
84
+
85
+ // reserved bytes for future expansion
86
+ int64_t reserved[3];
87
+ };
88
+
89
+ #endif // ARROW_C_DEVICE_DATA_INTERFACE
90
+
91
+ #ifndef ARROW_C_DEVICE_STREAM_INTERFACE
92
+ #define ARROW_C_DEVICE_STREAM_INTERFACE
93
+
94
+ struct ArrowDeviceArrayStream {
95
+ // device type that all arrays will be accessible from
96
+ ArrowDeviceType device_type;
97
+ // callbacks
98
+ int (*get_schema)(struct ArrowDeviceArrayStream*, struct ArrowSchema*);
99
+ int (*get_next)(struct ArrowDeviceArrayStream*, struct ArrowDeviceArray*);
100
+ const char* (*get_last_error)(struct ArrowDeviceArrayStream*);
101
+
102
+ // release callback
103
+ void (*release)(struct ArrowDeviceArrayStream*);
104
+
105
+ // opaque producer-specific data
106
+ void* private_data;
107
+ };
108
+
109
+ #endif // ARROW_C_DEVICE_STREAM_INTERFACE
110
+
111
+ /// \brief Move the contents of src into dst and set src->array.release to NULL
112
+ static inline void ArrowDeviceArrayMove(struct ArrowDeviceArray* src,
113
+ struct ArrowDeviceArray* dst) {
114
+ memcpy(dst, src, sizeof(struct ArrowDeviceArray));
115
+ src->array.release = 0;
116
+ }
117
+
118
+ /// @}
119
+
120
+ #ifdef NANOARROW_NAMESPACE
121
+
122
+ #define ArrowDeviceCheckRuntime \
123
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceCheckRuntime)
124
+ #define ArrowDeviceArrayInit \
125
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceArrayInit)
126
+ #define ArrowDeviceArrayViewInit \
127
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceArrayViewInit)
128
+ #define ArrowDeviceArrayViewReset \
129
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceArrayViewReset)
130
+ #define ArrowDeviceArrayViewSetArrayMinimal \
131
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceArrayViewSetArrayMinimal)
132
+ #define ArrowDeviceArrayViewSetArray \
133
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceArrayViewSetArray)
134
+ #define ArrowDeviceArrayViewCopy \
135
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceArrayViewCopy)
136
+ #define ArrowDeviceArrayViewCopyRequired \
137
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceArrayViewCopyRequired)
138
+ #define ArrowDeviceArrayMoveToDevice \
139
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceArrayMoveToDevice)
140
+ #define ArrowDeviceResolve \
141
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceResolve)
142
+ #define ArrowDeviceCpu NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceCpu)
143
+ #define ArrowDeviceInitCpu \
144
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceInitCpu)
145
+ #define ArrowDeviceBufferInit \
146
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceBufferInit)
147
+ #define ArrowDeviceBufferMove \
148
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceBufferMove)
149
+ #define ArrowDeviceBufferCopy \
150
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceBufferCopy)
151
+ #define ArrowDeviceBasicArrayStreamInit \
152
+ NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDeviceBasicArrayStreamInit)
153
+
154
+ #endif
155
+
156
+ /// \defgroup nanoarrow_device Nanoarrow Device extension
157
+ ///
158
+ /// Except where noted, objects are not thread-safe and clients should
159
+ /// take care to serialize accesses to methods.
160
+ ///
161
+ /// @{
162
+
163
+ /// \brief Checks the nanoarrow runtime to make sure the run/build versions
164
+ /// match
165
+ ArrowErrorCode ArrowDeviceCheckRuntime(struct ArrowError* error);
166
+
167
+ /// \brief A Device wrapper with callbacks for basic memory management tasks
168
+ ///
169
+ /// All device objects are currently implemented as singletons; however, this
170
+ /// may change as implementations progress.
171
+ struct ArrowDevice {
172
+ /// \brief The device type integer identifier (see ArrowDeviceArray)
173
+ ArrowDeviceType device_type;
174
+
175
+ /// \brief The device identifier (see ArrowDeviceArray)
176
+ int64_t device_id;
177
+
178
+ /// \brief Initialize an ArrowDeviceArray from a previously allocated
179
+ /// ArrowArray
180
+ ///
181
+ /// Given a device and an uninitialized device_array, populate the fields of
182
+ /// the device_array (including sync_event) appropriately. If NANOARROW_OK is
183
+ /// returned, ownership of array is transferred to device_array. This function
184
+ /// must allocate the appropriate sync_event and make its address available as
185
+ /// device_array->sync_event (if sync_event applies to this device type).
186
+ ArrowErrorCode (*array_init)(struct ArrowDevice* device,
187
+ struct ArrowDeviceArray* device_array,
188
+ struct ArrowArray* array);
189
+
190
+ /// \brief Move an ArrowDeviceArray between devices without copying buffers
191
+ ///
192
+ /// Some devices can move an ArrowDeviceArray without an explicit buffer copy,
193
+ /// although the performance characteristics of the moved array may be
194
+ /// different than that of an explicitly copied one depending on the device.
195
+ ArrowErrorCode (*array_move)(struct ArrowDevice* device_src,
196
+ struct ArrowDeviceArray* src,
197
+ struct ArrowDevice* device_dst,
198
+ struct ArrowDeviceArray* dst);
199
+
200
+ /// \brief Initialize an owning buffer from existing content
201
+ ///
202
+ /// Creates a new buffer whose data member can be accessed by the GPU by
203
+ /// copying existing content.
204
+ /// Implementations must check device_src and device_dst and return ENOTSUP if
205
+ /// not prepared to handle this operation.
206
+ ArrowErrorCode (*buffer_init)(struct ArrowDevice* device_src,
207
+ struct ArrowBufferView src,
208
+ struct ArrowDevice* device_dst,
209
+ struct ArrowBuffer* dst);
210
+
211
+ /// \brief Move an owning buffer to a device
212
+ ///
213
+ /// Creates a new buffer whose data member can be accessed by the GPU by
214
+ /// moving an existing buffer. If NANOARROW_OK is returned, src will have
215
+ /// been released or moved by the implementation and dst must be released by
216
+ /// the caller.
217
+ /// Implementations must check device_src and device_dst and return ENOTSUP if
218
+ /// not prepared to handle this operation.
219
+ ArrowErrorCode (*buffer_move)(struct ArrowDevice* device_src,
220
+ struct ArrowBuffer* src,
221
+ struct ArrowDevice* device_dst,
222
+ struct ArrowBuffer* dst);
223
+
224
+ /// \brief Copy a section of memory into a preallocated buffer
225
+ ///
226
+ /// As opposed to the other buffer operations, this is designed to support
227
+ /// copying very small slices of memory.
228
+ /// Implementations must check device_src and device_dst and return ENOTSUP if
229
+ /// not prepared to handle this operation.
230
+ ArrowErrorCode (*buffer_copy)(struct ArrowDevice* device_src,
231
+ struct ArrowBufferView src,
232
+ struct ArrowDevice* device_dst,
233
+ struct ArrowBufferView dst);
234
+
235
+ /// \brief Wait for an event on the CPU host
236
+ ArrowErrorCode (*synchronize_event)(struct ArrowDevice* device,
237
+ void* sync_event,
238
+ struct ArrowError* error);
239
+
240
+ /// \brief Release this device and any resources it holds
241
+ void (*release)(struct ArrowDevice* device);
242
+
243
+ /// \brief Opaque, implementation-specific data.
244
+ void* private_data;
245
+ };
246
+
247
+ struct ArrowDeviceArrayView {
248
+ struct ArrowDevice* device;
249
+ struct ArrowArrayView array_view;
250
+ };
251
+
252
+ /// \brief Initialize an ArrowDeviceArray
253
+ ///
254
+ /// Given an ArrowArray whose buffers/release callback has been set
255
+ /// appropriately, initialize an ArrowDeviceArray.
256
+ ArrowErrorCode ArrowDeviceArrayInit(struct ArrowDevice* device,
257
+ struct ArrowDeviceArray* device_array,
258
+ struct ArrowArray* array);
259
+
260
+ /// \brief Initialize an ArrowDeviceArrayView
261
+ ///
262
+ /// Zeroes memory for the device array view struct. Callers must initialize the
263
+ /// array_view member using nanoarrow core functions that can initialize from
264
+ /// a type identifier or schema.
265
+ void ArrowDeviceArrayViewInit(struct ArrowDeviceArrayView* device_array_view);
266
+
267
+ /// \brief Release the underlying ArrowArrayView
268
+ void ArrowDeviceArrayViewReset(struct ArrowDeviceArrayView* device_array_view);
269
+
270
+ /// \brief Set minimal ArrowArrayView buffer information from a device array
271
+ ///
272
+ /// A thin wrapper around ArrowArrayViewSetArrayMinimal() that does not attempt
273
+ /// to resolve buffer sizes of variable-length buffers by copying data from the
274
+ /// device.
275
+ ArrowErrorCode ArrowDeviceArrayViewSetArrayMinimal(
276
+ struct ArrowDeviceArrayView* device_array_view,
277
+ struct ArrowDeviceArray* device_array, struct ArrowError* error);
278
+
279
+ /// \brief Set ArrowArrayView buffer information from a device array
280
+ ///
281
+ /// Runs ArrowDeviceArrayViewSetArrayMinimal() but also sets buffer sizes for
282
+ /// variable-length buffers by copying data from the device. This function will
283
+ /// block on the device_array's sync_event.
284
+ ArrowErrorCode ArrowDeviceArrayViewSetArray(
285
+ struct ArrowDeviceArrayView* device_array_view,
286
+ struct ArrowDeviceArray* device_array, struct ArrowError* error);
287
+
288
+ /// \brief Copy an ArrowDeviceArrayView to a device
289
+ ArrowErrorCode ArrowDeviceArrayViewCopy(struct ArrowDeviceArrayView* src,
290
+ struct ArrowDevice* device_dst,
291
+ struct ArrowDeviceArray* dst);
292
+
293
+ /// \brief Move an ArrowDeviceArray to a device if possible
294
+ ///
295
+ /// Will attempt to move a device array to a device without copying buffers.
296
+ /// This may result in a device array with different performance charateristics
297
+ /// than an array that was copied.
298
+ ArrowErrorCode ArrowDeviceArrayMoveToDevice(struct ArrowDeviceArray* src,
299
+ struct ArrowDevice* device_dst,
300
+ struct ArrowDeviceArray* dst);
301
+
302
+ /// \brief Pointer to a statically-allocated CPU device singleton
303
+ struct ArrowDevice* ArrowDeviceCpu(void);
304
+
305
+ /// \brief Initialize a user-allocated device struct with a CPU device
306
+ void ArrowDeviceInitCpu(struct ArrowDevice* device);
307
+
308
+ /// \brief Resolve a device pointer from a type + identifier
309
+ ///
310
+ /// Depending on which libraries this build of the device extension was built
311
+ /// with, some device types may or may not be supported. The CPU type is always
312
+ /// supported. Returns NULL for device that does not exist or cannot be returned
313
+ /// as a singleton. Callers must not release the pointed-to device.
314
+ struct ArrowDevice* ArrowDeviceResolve(ArrowDeviceType device_type,
315
+ int64_t device_id);
316
+
317
+ ArrowErrorCode ArrowDeviceBufferInit(struct ArrowDevice* device_src,
318
+ struct ArrowBufferView src,
319
+ struct ArrowDevice* device_dst,
320
+ struct ArrowBuffer* dst);
321
+
322
+ ArrowErrorCode ArrowDeviceBufferMove(struct ArrowDevice* device_src,
323
+ struct ArrowBuffer* src,
324
+ struct ArrowDevice* device_dst,
325
+ struct ArrowBuffer* dst);
326
+
327
+ ArrowErrorCode ArrowDeviceBufferCopy(struct ArrowDevice* device_src,
328
+ struct ArrowBufferView src,
329
+ struct ArrowDevice* device_dst,
330
+ struct ArrowBufferView dst);
331
+
332
+ /// \brief Initialize an ArrowDeviceArrayStream from an existing
333
+ /// ArrowArrayStream
334
+ ///
335
+ /// Wrap an ArrowArrayStream of ArrowDeviceArray objects already allocated by
336
+ /// the specified device as an ArrowDeviceArrayStream. This function moves the
337
+ /// ownership of array_stream to the device_array_stream. If this function
338
+ /// returns NANOARROW_OK, the caller is responsible for releasing the
339
+ /// ArrowDeviceArrayStream.
340
+ ArrowErrorCode ArrowDeviceBasicArrayStreamInit(
341
+ struct ArrowDeviceArrayStream* device_array_stream,
342
+ struct ArrowArrayStream* array_stream, struct ArrowDevice* device);
343
+
344
+ /// @}
345
+
346
+ #ifdef __cplusplus
347
+ }
348
+ #endif
349
+
350
+ #endif