duckdb 1.5.0.dev37__cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.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.
Potentially problematic release.
This version of duckdb might be problematic. Click here for more details.
- _duckdb.cpython-314t-aarch64-linux-gnu.so +0 -0
- duckdb/__init__.py +475 -0
- duckdb/__init__.pyi +713 -0
- duckdb/bytes_io_wrapper.py +66 -0
- duckdb/experimental/__init__.py +2 -0
- duckdb/experimental/spark/LICENSE +260 -0
- duckdb/experimental/spark/__init__.py +7 -0
- duckdb/experimental/spark/_globals.py +77 -0
- duckdb/experimental/spark/_typing.py +48 -0
- duckdb/experimental/spark/conf.py +45 -0
- duckdb/experimental/spark/context.py +164 -0
- duckdb/experimental/spark/errors/__init__.py +72 -0
- duckdb/experimental/spark/errors/error_classes.py +918 -0
- duckdb/experimental/spark/errors/exceptions/__init__.py +16 -0
- duckdb/experimental/spark/errors/exceptions/base.py +217 -0
- duckdb/experimental/spark/errors/utils.py +116 -0
- duckdb/experimental/spark/exception.py +15 -0
- duckdb/experimental/spark/sql/__init__.py +7 -0
- duckdb/experimental/spark/sql/_typing.py +93 -0
- duckdb/experimental/spark/sql/catalog.py +78 -0
- duckdb/experimental/spark/sql/column.py +368 -0
- duckdb/experimental/spark/sql/conf.py +23 -0
- duckdb/experimental/spark/sql/dataframe.py +1437 -0
- duckdb/experimental/spark/sql/functions.py +6221 -0
- duckdb/experimental/spark/sql/group.py +420 -0
- duckdb/experimental/spark/sql/readwriter.py +449 -0
- duckdb/experimental/spark/sql/session.py +292 -0
- duckdb/experimental/spark/sql/streaming.py +37 -0
- duckdb/experimental/spark/sql/type_utils.py +105 -0
- duckdb/experimental/spark/sql/types.py +1275 -0
- duckdb/experimental/spark/sql/udf.py +37 -0
- duckdb/filesystem.py +23 -0
- duckdb/functional/__init__.py +17 -0
- duckdb/functional/__init__.pyi +31 -0
- duckdb/polars_io.py +237 -0
- duckdb/query_graph/__main__.py +363 -0
- duckdb/typing/__init__.py +61 -0
- duckdb/typing/__init__.pyi +36 -0
- duckdb/udf.py +19 -0
- duckdb/value/__init__.py +0 -0
- duckdb/value/__init__.pyi +0 -0
- duckdb/value/constant/__init__.py +268 -0
- duckdb/value/constant/__init__.pyi +115 -0
- duckdb-1.5.0.dev37.dist-info/METADATA +80 -0
- duckdb-1.5.0.dev37.dist-info/RECORD +47 -0
- duckdb-1.5.0.dev37.dist-info/WHEEL +6 -0
- duckdb-1.5.0.dev37.dist-info/licenses/LICENSE +7 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from io import StringIO, TextIOBase
|
|
2
|
+
from typing import Union
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
BSD 3-Clause License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2011-2022, Open source contributors.
|
|
11
|
+
|
|
12
|
+
Redistribution and use in source and binary forms, with or without
|
|
13
|
+
modification, are permitted provided that the following conditions are met:
|
|
14
|
+
|
|
15
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
16
|
+
list of conditions and the following disclaimer.
|
|
17
|
+
|
|
18
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
19
|
+
this list of conditions and the following disclaimer in the documentation
|
|
20
|
+
and/or other materials provided with the distribution.
|
|
21
|
+
|
|
22
|
+
* Neither the name of the copyright holder nor the names of its
|
|
23
|
+
contributors may be used to endorse or promote products derived from
|
|
24
|
+
this software without specific prior written permission.
|
|
25
|
+
|
|
26
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
27
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
28
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
29
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
30
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
31
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
32
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
33
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
34
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
35
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class BytesIOWrapper:
|
|
40
|
+
# Wrapper that wraps a StringIO buffer and reads bytes from it
|
|
41
|
+
# Created for compat with pyarrow read_csv
|
|
42
|
+
def __init__(self, buffer: Union[StringIO, TextIOBase], encoding: str = "utf-8") -> None:
|
|
43
|
+
self.buffer = buffer
|
|
44
|
+
self.encoding = encoding
|
|
45
|
+
# Because a character can be represented by more than 1 byte,
|
|
46
|
+
# it is possible that reading will produce more bytes than n
|
|
47
|
+
# We store the extra bytes in this overflow variable, and append the
|
|
48
|
+
# overflow to the front of the bytestring the next time reading is performed
|
|
49
|
+
self.overflow = b""
|
|
50
|
+
|
|
51
|
+
def __getattr__(self, attr: str):
|
|
52
|
+
return getattr(self.buffer, attr)
|
|
53
|
+
|
|
54
|
+
def read(self, n: Union[int, None] = -1) -> bytes:
|
|
55
|
+
assert self.buffer is not None
|
|
56
|
+
bytestring = self.buffer.read(n).encode(self.encoding)
|
|
57
|
+
# When n=-1/n greater than remaining bytes: Read entire file/rest of file
|
|
58
|
+
combined_bytestring = self.overflow + bytestring
|
|
59
|
+
if n is None or n < 0 or n >= len(combined_bytestring):
|
|
60
|
+
self.overflow = b""
|
|
61
|
+
return combined_bytestring
|
|
62
|
+
else:
|
|
63
|
+
to_return = combined_bytestring[:n]
|
|
64
|
+
self.overflow = combined_bytestring[n:]
|
|
65
|
+
return to_return
|
|
66
|
+
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
------------------------------------------------------------------------------------
|
|
205
|
+
This product bundles various third-party components under other open source licenses.
|
|
206
|
+
This section summarizes those components and their licenses. See licenses/
|
|
207
|
+
for text of these licenses.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
Apache Software Foundation License 2.0
|
|
211
|
+
--------------------------------------
|
|
212
|
+
|
|
213
|
+
common/network-common/src/main/java/org/apache/spark/network/util/LimitedInputStream.java
|
|
214
|
+
core/src/main/java/org/apache/spark/util/collection/TimSort.java
|
|
215
|
+
core/src/main/resources/org/apache/spark/ui/static/bootstrap*
|
|
216
|
+
core/src/main/resources/org/apache/spark/ui/static/vis*
|
|
217
|
+
docs/js/vendor/bootstrap.js
|
|
218
|
+
connector/spark-ganglia-lgpl/src/main/java/com/codahale/metrics/ganglia/GangliaReporter.java
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
Python Software Foundation License
|
|
222
|
+
----------------------------------
|
|
223
|
+
|
|
224
|
+
python/docs/source/_static/copybutton.js
|
|
225
|
+
|
|
226
|
+
BSD 3-Clause
|
|
227
|
+
------------
|
|
228
|
+
|
|
229
|
+
python/lib/py4j-*-src.zip
|
|
230
|
+
python/pyspark/cloudpickle/*.py
|
|
231
|
+
python/pyspark/join.py
|
|
232
|
+
core/src/main/resources/org/apache/spark/ui/static/d3.min.js
|
|
233
|
+
|
|
234
|
+
The CSS style for the navigation sidebar of the documentation was originally
|
|
235
|
+
submitted by Óscar Nájera for the scikit-learn project. The scikit-learn project
|
|
236
|
+
is distributed under the 3-Clause BSD license.
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
MIT License
|
|
240
|
+
-----------
|
|
241
|
+
|
|
242
|
+
core/src/main/resources/org/apache/spark/ui/static/dagre-d3.min.js
|
|
243
|
+
core/src/main/resources/org/apache/spark/ui/static/*dataTables*
|
|
244
|
+
core/src/main/resources/org/apache/spark/ui/static/graphlib-dot.min.js
|
|
245
|
+
core/src/main/resources/org/apache/spark/ui/static/jquery*
|
|
246
|
+
core/src/main/resources/org/apache/spark/ui/static/sorttable.js
|
|
247
|
+
docs/js/vendor/anchor.min.js
|
|
248
|
+
docs/js/vendor/jquery*
|
|
249
|
+
docs/js/vendor/modernizer*
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
Creative Commons CC0 1.0 Universal Public Domain Dedication
|
|
253
|
+
-----------------------------------------------------------
|
|
254
|
+
(see LICENSE-CC0.txt)
|
|
255
|
+
|
|
256
|
+
data/mllib/images/kittens/29.5.a_b_EGDP022204.jpg
|
|
257
|
+
data/mllib/images/kittens/54893.jpg
|
|
258
|
+
data/mllib/images/kittens/DP153539.jpg
|
|
259
|
+
data/mllib/images/kittens/DP802813.jpg
|
|
260
|
+
data/mllib/images/multi-channel/chr30.4.184.jpg
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from .sql import SparkSession, DataFrame
|
|
2
|
+
from .conf import SparkConf
|
|
3
|
+
from .context import SparkContext
|
|
4
|
+
from ._globals import _NoValue
|
|
5
|
+
from .exception import ContributionsAcceptedError
|
|
6
|
+
|
|
7
|
+
__all__ = ["SparkSession", "DataFrame", "SparkConf", "SparkContext", "ContributionsAcceptedError"]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
+
# contributor license agreements. See the NOTICE file distributed with
|
|
4
|
+
# this work for additional information regarding copyright ownership.
|
|
5
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
6
|
+
# (the "License"); you may not use this file except in compliance with
|
|
7
|
+
# 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, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
Module defining global singleton classes.
|
|
20
|
+
|
|
21
|
+
This module raises a RuntimeError if an attempt to reload it is made. In that
|
|
22
|
+
way the identities of the classes defined here are fixed and will remain so
|
|
23
|
+
even if duckdb spark itself is reloaded. In particular, a function like the following
|
|
24
|
+
will still work correctly after duckdb spark is reloaded:
|
|
25
|
+
|
|
26
|
+
def foo(arg=pyducdkb.spark._NoValue):
|
|
27
|
+
if arg is pyducdkb.spark._NoValue:
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
See gh-7844 for a discussion of the reload problem that motivated this module.
|
|
31
|
+
|
|
32
|
+
Note that this approach is taken after from NumPy.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
__ALL__ = ["_NoValue"]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# Disallow reloading this module so as to preserve the identities of the
|
|
39
|
+
# classes defined here.
|
|
40
|
+
if "_is_loaded" in globals():
|
|
41
|
+
raise RuntimeError("Reloading duckdb.experimental.spark._globals is not allowed")
|
|
42
|
+
_is_loaded = True
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class _NoValueType:
|
|
46
|
+
"""Special keyword value.
|
|
47
|
+
|
|
48
|
+
The instance of this class may be used as the default value assigned to a
|
|
49
|
+
deprecated keyword in order to check if it has been given a user defined
|
|
50
|
+
value.
|
|
51
|
+
|
|
52
|
+
This class was copied from NumPy.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
__instance = None
|
|
56
|
+
|
|
57
|
+
def __new__(cls):
|
|
58
|
+
# ensure that only one instance exists
|
|
59
|
+
if not cls.__instance:
|
|
60
|
+
cls.__instance = super(_NoValueType, cls).__new__(cls)
|
|
61
|
+
return cls.__instance
|
|
62
|
+
|
|
63
|
+
# Make the _NoValue instance falsey
|
|
64
|
+
def __nonzero__(self):
|
|
65
|
+
return False
|
|
66
|
+
|
|
67
|
+
__bool__ = __nonzero__
|
|
68
|
+
|
|
69
|
+
# needed for python 2 to preserve identity through a pickle
|
|
70
|
+
def __reduce__(self):
|
|
71
|
+
return (self.__class__, ())
|
|
72
|
+
|
|
73
|
+
def __repr__(self):
|
|
74
|
+
return "<no value>"
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
_NoValue = _NoValueType()
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
|
4
|
+
# distributed with this work for additional information
|
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
|
7
|
+
# "License"); you may not use this file except in compliance
|
|
8
|
+
# with the License. You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
|
13
|
+
# software distributed under the License is distributed on an
|
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
# KIND, either express or implied. See the License for the
|
|
16
|
+
# specific language governing permissions and limitations
|
|
17
|
+
# under the License.
|
|
18
|
+
|
|
19
|
+
from typing import Callable, Iterable, Sized, TypeVar, Union
|
|
20
|
+
from typing_extensions import Literal, Protocol
|
|
21
|
+
|
|
22
|
+
from numpy import int32, int64, float32, float64, ndarray
|
|
23
|
+
|
|
24
|
+
F = TypeVar("F", bound=Callable)
|
|
25
|
+
T_co = TypeVar("T_co", covariant=True)
|
|
26
|
+
|
|
27
|
+
PrimitiveType = Union[bool, float, int, str]
|
|
28
|
+
|
|
29
|
+
NonUDFType = Literal[0]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class SupportsIAdd(Protocol):
|
|
33
|
+
def __iadd__(self, other: "SupportsIAdd") -> "SupportsIAdd":
|
|
34
|
+
...
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class SupportsOrdering(Protocol):
|
|
38
|
+
def __lt__(self, other: "SupportsOrdering") -> bool:
|
|
39
|
+
...
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class SizedIterable(Protocol, Sized, Iterable[T_co]):
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
S = TypeVar("S", bound=SupportsOrdering)
|
|
47
|
+
|
|
48
|
+
NumberOrArray = TypeVar("NumberOrArray", float, int, complex, int32, int64, float32, float64, ndarray)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from typing import Optional, List, Tuple
|
|
2
|
+
from duckdb.experimental.spark.exception import ContributionsAcceptedError
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class SparkConf:
|
|
6
|
+
def __init__(self):
|
|
7
|
+
raise NotImplementedError
|
|
8
|
+
|
|
9
|
+
def contains(self, key: str) -> bool:
|
|
10
|
+
raise ContributionsAcceptedError
|
|
11
|
+
|
|
12
|
+
def get(self, key: str, defaultValue: Optional[str] = None) -> Optional[str]:
|
|
13
|
+
raise ContributionsAcceptedError
|
|
14
|
+
|
|
15
|
+
def getAll(self) -> List[Tuple[str, str]]:
|
|
16
|
+
raise ContributionsAcceptedError
|
|
17
|
+
|
|
18
|
+
def set(self, key: str, value: str) -> "SparkConf":
|
|
19
|
+
raise ContributionsAcceptedError
|
|
20
|
+
|
|
21
|
+
def setAll(self, pairs: List[Tuple[str, str]]) -> "SparkConf":
|
|
22
|
+
raise ContributionsAcceptedError
|
|
23
|
+
|
|
24
|
+
def setAppName(self, value: str) -> "SparkConf":
|
|
25
|
+
raise ContributionsAcceptedError
|
|
26
|
+
|
|
27
|
+
def setExecutorEnv(
|
|
28
|
+
self, key: Optional[str] = None, value: Optional[str] = None, pairs: Optional[List[Tuple[str, str]]] = None
|
|
29
|
+
) -> "SparkConf":
|
|
30
|
+
raise ContributionsAcceptedError
|
|
31
|
+
|
|
32
|
+
def setIfMissing(self, key: str, value: str) -> "SparkConf":
|
|
33
|
+
raise ContributionsAcceptedError
|
|
34
|
+
|
|
35
|
+
def setMaster(self, value: str) -> "SparkConf":
|
|
36
|
+
raise ContributionsAcceptedError
|
|
37
|
+
|
|
38
|
+
def setSparkHome(self, value: str) -> "SparkConf":
|
|
39
|
+
raise ContributionsAcceptedError
|
|
40
|
+
|
|
41
|
+
def toDebugString(self) -> str:
|
|
42
|
+
raise ContributionsAcceptedError
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
__all__ = ["SparkConf"]
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
import duckdb
|
|
3
|
+
from duckdb import DuckDBPyConnection
|
|
4
|
+
|
|
5
|
+
from duckdb.experimental.spark.exception import ContributionsAcceptedError
|
|
6
|
+
from duckdb.experimental.spark.conf import SparkConf
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SparkContext:
|
|
10
|
+
def __init__(self, master: str):
|
|
11
|
+
self._connection = duckdb.connect(':memory:')
|
|
12
|
+
# This aligns the null ordering with Spark.
|
|
13
|
+
self._connection.execute("set default_null_order='nulls_first_on_asc_last_on_desc'")
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def connection(self) -> DuckDBPyConnection:
|
|
17
|
+
return self._connection
|
|
18
|
+
|
|
19
|
+
def stop(self) -> None:
|
|
20
|
+
self._connection.close()
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def getOrCreate(cls, conf: Optional[SparkConf] = None) -> "SparkContext":
|
|
24
|
+
raise ContributionsAcceptedError
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def setSystemProperty(cls, key: str, value: str) -> None:
|
|
28
|
+
raise ContributionsAcceptedError
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def applicationId(self) -> str:
|
|
32
|
+
raise ContributionsAcceptedError
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def defaultMinPartitions(self) -> int:
|
|
36
|
+
raise ContributionsAcceptedError
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def defaultParallelism(self) -> int:
|
|
40
|
+
raise ContributionsAcceptedError
|
|
41
|
+
|
|
42
|
+
# @property
|
|
43
|
+
# def resources(self) -> Dict[str, ResourceInformation]:
|
|
44
|
+
# raise ContributionsAcceptedError
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def startTime(self) -> str:
|
|
48
|
+
raise ContributionsAcceptedError
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def uiWebUrl(self) -> str:
|
|
52
|
+
raise ContributionsAcceptedError
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def version(self) -> str:
|
|
56
|
+
raise ContributionsAcceptedError
|
|
57
|
+
|
|
58
|
+
def __repr__(self) -> str:
|
|
59
|
+
raise ContributionsAcceptedError
|
|
60
|
+
|
|
61
|
+
# def accumulator(self, value: ~T, accum_param: Optional[ForwardRef('AccumulatorParam[T]')] = None) -> 'Accumulator[T]':
|
|
62
|
+
# pass
|
|
63
|
+
|
|
64
|
+
def addArchive(self, path: str) -> None:
|
|
65
|
+
raise ContributionsAcceptedError
|
|
66
|
+
|
|
67
|
+
def addFile(self, path: str, recursive: bool = False) -> None:
|
|
68
|
+
raise ContributionsAcceptedError
|
|
69
|
+
|
|
70
|
+
def addPyFile(self, path: str) -> None:
|
|
71
|
+
raise ContributionsAcceptedError
|
|
72
|
+
|
|
73
|
+
# def binaryFiles(self, path: str, minPartitions: Optional[int] = None) -> duckdb.experimental.spark.rdd.RDD[typing.Tuple[str, bytes]]:
|
|
74
|
+
# pass
|
|
75
|
+
|
|
76
|
+
# def binaryRecords(self, path: str, recordLength: int) -> duckdb.experimental.spark.rdd.RDD[bytes]:
|
|
77
|
+
# pass
|
|
78
|
+
|
|
79
|
+
# def broadcast(self, value: ~T) -> 'Broadcast[T]':
|
|
80
|
+
# pass
|
|
81
|
+
|
|
82
|
+
def cancelAllJobs(self) -> None:
|
|
83
|
+
raise ContributionsAcceptedError
|
|
84
|
+
|
|
85
|
+
def cancelJobGroup(self, groupId: str) -> None:
|
|
86
|
+
raise ContributionsAcceptedError
|
|
87
|
+
|
|
88
|
+
def dump_profiles(self, path: str) -> None:
|
|
89
|
+
raise ContributionsAcceptedError
|
|
90
|
+
|
|
91
|
+
# def emptyRDD(self) -> duckdb.experimental.spark.rdd.RDD[typing.Any]:
|
|
92
|
+
# pass
|
|
93
|
+
|
|
94
|
+
def getCheckpointDir(self) -> Optional[str]:
|
|
95
|
+
raise ContributionsAcceptedError
|
|
96
|
+
|
|
97
|
+
def getConf(self) -> SparkConf:
|
|
98
|
+
raise ContributionsAcceptedError
|
|
99
|
+
|
|
100
|
+
def getLocalProperty(self, key: str) -> Optional[str]:
|
|
101
|
+
raise ContributionsAcceptedError
|
|
102
|
+
|
|
103
|
+
# def hadoopFile(self, path: str, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
|
|
104
|
+
# pass
|
|
105
|
+
|
|
106
|
+
# def hadoopRDD(self, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
|
|
107
|
+
# pass
|
|
108
|
+
|
|
109
|
+
# def newAPIHadoopFile(self, path: str, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
|
|
110
|
+
# pass
|
|
111
|
+
|
|
112
|
+
# def newAPIHadoopRDD(self, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
|
|
113
|
+
# pass
|
|
114
|
+
|
|
115
|
+
# def parallelize(self, c: Iterable[~T], numSlices: Optional[int] = None) -> pyspark.rdd.RDD[~T]:
|
|
116
|
+
# pass
|
|
117
|
+
|
|
118
|
+
# def pickleFile(self, name: str, minPartitions: Optional[int] = None) -> pyspark.rdd.RDD[typing.Any]:
|
|
119
|
+
# pass
|
|
120
|
+
|
|
121
|
+
# def range(self, start: int, end: Optional[int] = None, step: int = 1, numSlices: Optional[int] = None) -> pyspark.rdd.RDD[int]:
|
|
122
|
+
# pass
|
|
123
|
+
|
|
124
|
+
# def runJob(self, rdd: pyspark.rdd.RDD[~T], partitionFunc: Callable[[Iterable[~T]], Iterable[~U]], partitions: Optional[Sequence[int]] = None, allowLocal: bool = False) -> List[~U]:
|
|
125
|
+
# pass
|
|
126
|
+
|
|
127
|
+
# def sequenceFile(self, path: str, keyClass: Optional[str] = None, valueClass: Optional[str] = None, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, minSplits: Optional[int] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
|
|
128
|
+
# pass
|
|
129
|
+
|
|
130
|
+
def setCheckpointDir(self, dirName: str) -> None:
|
|
131
|
+
raise ContributionsAcceptedError
|
|
132
|
+
|
|
133
|
+
def setJobDescription(self, value: str) -> None:
|
|
134
|
+
raise ContributionsAcceptedError
|
|
135
|
+
|
|
136
|
+
def setJobGroup(self, groupId: str, description: str, interruptOnCancel: bool = False) -> None:
|
|
137
|
+
raise ContributionsAcceptedError
|
|
138
|
+
|
|
139
|
+
def setLocalProperty(self, key: str, value: str) -> None:
|
|
140
|
+
raise ContributionsAcceptedError
|
|
141
|
+
|
|
142
|
+
def setLogLevel(self, logLevel: str) -> None:
|
|
143
|
+
raise ContributionsAcceptedError
|
|
144
|
+
|
|
145
|
+
def show_profiles(self) -> None:
|
|
146
|
+
raise ContributionsAcceptedError
|
|
147
|
+
|
|
148
|
+
def sparkUser(self) -> str:
|
|
149
|
+
raise ContributionsAcceptedError
|
|
150
|
+
|
|
151
|
+
# def statusTracker(self) -> duckdb.experimental.spark.status.StatusTracker:
|
|
152
|
+
# raise ContributionsAcceptedError
|
|
153
|
+
|
|
154
|
+
# def textFile(self, name: str, minPartitions: Optional[int] = None, use_unicode: bool = True) -> pyspark.rdd.RDD[str]:
|
|
155
|
+
# pass
|
|
156
|
+
|
|
157
|
+
# def union(self, rdds: List[pyspark.rdd.RDD[~T]]) -> pyspark.rdd.RDD[~T]:
|
|
158
|
+
# pass
|
|
159
|
+
|
|
160
|
+
# def wholeTextFiles(self, path: str, minPartitions: Optional[int] = None, use_unicode: bool = True) -> pyspark.rdd.RDD[typing.Tuple[str, str]]:
|
|
161
|
+
# pass
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
__all__ = ["SparkContext"]
|