duckdb 1.5.0.dev86__cp314-cp314-macosx_10_15_universal2.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.

Files changed (52) hide show
  1. _duckdb-stubs/__init__.pyi +1443 -0
  2. _duckdb-stubs/_func.pyi +46 -0
  3. _duckdb-stubs/_sqltypes.pyi +75 -0
  4. _duckdb.cpython-314-darwin.so +0 -0
  5. adbc_driver_duckdb/__init__.py +50 -0
  6. adbc_driver_duckdb/dbapi.py +115 -0
  7. duckdb/__init__.py +381 -0
  8. duckdb/_dbapi_type_object.py +231 -0
  9. duckdb/_version.py +22 -0
  10. duckdb/bytes_io_wrapper.py +69 -0
  11. duckdb/experimental/__init__.py +3 -0
  12. duckdb/experimental/spark/LICENSE +260 -0
  13. duckdb/experimental/spark/__init__.py +6 -0
  14. duckdb/experimental/spark/_globals.py +77 -0
  15. duckdb/experimental/spark/_typing.py +46 -0
  16. duckdb/experimental/spark/conf.py +46 -0
  17. duckdb/experimental/spark/context.py +180 -0
  18. duckdb/experimental/spark/errors/__init__.py +70 -0
  19. duckdb/experimental/spark/errors/error_classes.py +918 -0
  20. duckdb/experimental/spark/errors/exceptions/__init__.py +16 -0
  21. duckdb/experimental/spark/errors/exceptions/base.py +168 -0
  22. duckdb/experimental/spark/errors/utils.py +111 -0
  23. duckdb/experimental/spark/exception.py +18 -0
  24. duckdb/experimental/spark/sql/__init__.py +7 -0
  25. duckdb/experimental/spark/sql/_typing.py +86 -0
  26. duckdb/experimental/spark/sql/catalog.py +79 -0
  27. duckdb/experimental/spark/sql/column.py +361 -0
  28. duckdb/experimental/spark/sql/conf.py +24 -0
  29. duckdb/experimental/spark/sql/dataframe.py +1389 -0
  30. duckdb/experimental/spark/sql/functions.py +6195 -0
  31. duckdb/experimental/spark/sql/group.py +424 -0
  32. duckdb/experimental/spark/sql/readwriter.py +435 -0
  33. duckdb/experimental/spark/sql/session.py +297 -0
  34. duckdb/experimental/spark/sql/streaming.py +36 -0
  35. duckdb/experimental/spark/sql/type_utils.py +107 -0
  36. duckdb/experimental/spark/sql/types.py +1239 -0
  37. duckdb/experimental/spark/sql/udf.py +37 -0
  38. duckdb/filesystem.py +33 -0
  39. duckdb/func/__init__.py +3 -0
  40. duckdb/functional/__init__.py +13 -0
  41. duckdb/polars_io.py +284 -0
  42. duckdb/py.typed +0 -0
  43. duckdb/query_graph/__main__.py +358 -0
  44. duckdb/sqltypes/__init__.py +63 -0
  45. duckdb/typing/__init__.py +71 -0
  46. duckdb/udf.py +24 -0
  47. duckdb/value/__init__.py +1 -0
  48. duckdb/value/constant/__init__.py +270 -0
  49. duckdb-1.5.0.dev86.dist-info/METADATA +88 -0
  50. duckdb-1.5.0.dev86.dist-info/RECORD +52 -0
  51. duckdb-1.5.0.dev86.dist-info/WHEEL +6 -0
  52. duckdb-1.5.0.dev86.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,231 @@
1
+ """DuckDB DB API 2.0 Type Objects Module.
2
+
3
+ This module provides DB API 2.0 compliant type objects for DuckDB, allowing applications
4
+ to check column types returned by queries against standard database API categories.
5
+
6
+ Example:
7
+ >>> import duckdb
8
+ >>>
9
+ >>> conn = duckdb.connect()
10
+ >>> cursor = conn.cursor()
11
+ >>> cursor.execute("SELECT 'hello' as text_col, 42 as num_col, CURRENT_DATE as date_col")
12
+ >>>
13
+ >>> # Check column types using DB API type objects
14
+ >>> for i, desc in enumerate(cursor.description):
15
+ >>> col_name, col_type = desc[0], desc[1]
16
+ >>> if col_type == duckdb.STRING:
17
+ >>> print(f"{col_name} is a string type")
18
+ >>> elif col_type == duckdb.NUMBER:
19
+ >>> print(f"{col_name} is a numeric type")
20
+ >>> elif col_type == duckdb.DATETIME:
21
+ >>> print(f"{col_name} is a date/time type")
22
+
23
+ See Also:
24
+ - PEP 249: https://peps.python.org/pep-0249/
25
+ - DuckDB Type System: https://duckdb.org/docs/sql/data_types/overview
26
+ """
27
+
28
+ from duckdb import sqltypes
29
+
30
+
31
+ class DBAPITypeObject:
32
+ """DB API 2.0 type object for categorizing database column types.
33
+
34
+ This class implements the type objects defined in PEP 249 (DB API 2.0).
35
+ It allows checking whether a specific DuckDB type belongs to a broader
36
+ category like STRING, NUMBER, DATETIME, etc.
37
+
38
+ The type object supports equality comparison with DuckDBPyType instances,
39
+ returning True if the type belongs to this category.
40
+
41
+ Args:
42
+ types: A list of DuckDBPyType instances that belong to this type category.
43
+
44
+ Example:
45
+ >>> string_types = DBAPITypeObject([sqltypes.VARCHAR, sqltypes.CHAR])
46
+ >>> result = sqltypes.VARCHAR == string_types # True
47
+ >>> result = sqltypes.INTEGER == string_types # False
48
+
49
+ Note:
50
+ This follows the DB API 2.0 specification where type objects are compared
51
+ using equality operators rather than isinstance() checks.
52
+ """
53
+
54
+ def __init__(self, types: list[sqltypes.DuckDBPyType]) -> None:
55
+ """Initialize a DB API type object.
56
+
57
+ Args:
58
+ types: List of DuckDB types that belong to this category.
59
+ """
60
+ self.types = types
61
+
62
+ def __eq__(self, other: object) -> bool:
63
+ """Check if a DuckDB type belongs to this type category.
64
+
65
+ This method implements the DB API 2.0 type checking mechanism.
66
+ It returns True if the other object is a DuckDBPyType that
67
+ is contained in this type category.
68
+
69
+ Args:
70
+ other: The object to compare, typically a DuckDBPyType instance.
71
+
72
+ Returns:
73
+ True if other is a DuckDBPyType in this category, False otherwise.
74
+
75
+ Example:
76
+ >>> NUMBER == sqltypes.INTEGER # True
77
+ >>> NUMBER == sqltypes.VARCHAR # False
78
+ """
79
+ if isinstance(other, sqltypes.DuckDBPyType):
80
+ return other in self.types
81
+ return False
82
+
83
+ def __repr__(self) -> str:
84
+ """Return a string representation of this type object.
85
+
86
+ Returns:
87
+ A string showing the type object and its contained DuckDB types.
88
+
89
+ Example:
90
+ >>> repr(STRING)
91
+ '<DBAPITypeObject [VARCHAR]>'
92
+ """
93
+ return f"<DBAPITypeObject [{','.join(str(x) for x in self.types)}]>"
94
+
95
+
96
+ # Define the standard DB API 2.0 type objects for DuckDB
97
+
98
+ STRING = DBAPITypeObject([sqltypes.VARCHAR])
99
+ """
100
+ STRING type object for text-based database columns.
101
+
102
+ This type object represents all string/text types in DuckDB. Currently includes:
103
+ - VARCHAR: Variable-length character strings
104
+
105
+ Use this to check if a column contains textual data that should be handled
106
+ as Python strings.
107
+
108
+ DB API 2.0 Reference:
109
+ https://peps.python.org/pep-0249/#string
110
+
111
+ Example:
112
+ >>> cursor.description[0][1] == STRING # Check if first column is text
113
+ """
114
+
115
+ NUMBER = DBAPITypeObject(
116
+ [
117
+ sqltypes.TINYINT,
118
+ sqltypes.UTINYINT,
119
+ sqltypes.SMALLINT,
120
+ sqltypes.USMALLINT,
121
+ sqltypes.INTEGER,
122
+ sqltypes.UINTEGER,
123
+ sqltypes.BIGINT,
124
+ sqltypes.UBIGINT,
125
+ sqltypes.HUGEINT,
126
+ sqltypes.UHUGEINT,
127
+ sqltypes.DuckDBPyType("BIGNUM"),
128
+ sqltypes.DuckDBPyType("DECIMAL"),
129
+ sqltypes.FLOAT,
130
+ sqltypes.DOUBLE,
131
+ ]
132
+ )
133
+ """
134
+ NUMBER type object for numeric database columns.
135
+
136
+ This type object represents all numeric types in DuckDB, including:
137
+
138
+ Integer Types:
139
+ - TINYINT, UTINYINT: 8-bit signed/unsigned integers
140
+ - SMALLINT, USMALLINT: 16-bit signed/unsigned integers
141
+ - INTEGER, UINTEGER: 32-bit signed/unsigned integers
142
+ - BIGINT, UBIGINT: 64-bit signed/unsigned integers
143
+ - HUGEINT, UHUGEINT: 128-bit signed/unsigned integers
144
+
145
+ Decimal Types:
146
+ - BIGNUM: Arbitrary precision integers
147
+ - DECIMAL: Fixed-point decimal numbers
148
+
149
+ Floating Point Types:
150
+ - FLOAT: 32-bit floating point
151
+ - DOUBLE: 64-bit floating point
152
+
153
+ Use this to check if a column contains numeric data that should be handled
154
+ as Python int, float, or Decimal objects.
155
+
156
+ DB API 2.0 Reference:
157
+ https://peps.python.org/pep-0249/#number
158
+
159
+ Example:
160
+ >>> cursor.description[1][1] == NUMBER # Check if second column is numeric
161
+ """
162
+
163
+ DATETIME = DBAPITypeObject(
164
+ [
165
+ sqltypes.DATE,
166
+ sqltypes.TIME,
167
+ sqltypes.TIME_TZ,
168
+ sqltypes.TIMESTAMP,
169
+ sqltypes.TIMESTAMP_TZ,
170
+ sqltypes.TIMESTAMP_NS,
171
+ sqltypes.TIMESTAMP_MS,
172
+ sqltypes.TIMESTAMP_S,
173
+ ]
174
+ )
175
+ """
176
+ DATETIME type object for date and time database columns.
177
+
178
+ This type object represents all date/time types in DuckDB, including:
179
+
180
+ Date Types:
181
+ - DATE: Calendar dates (year, month, day)
182
+
183
+ Time Types:
184
+ - TIME: Time of day without timezone
185
+ - TIME_TZ: Time of day with timezone
186
+
187
+ Timestamp Types:
188
+ - TIMESTAMP: Date and time without timezone (microsecond precision)
189
+ - TIMESTAMP_TZ: Date and time with timezone
190
+ - TIMESTAMP_NS: Nanosecond precision timestamps
191
+ - TIMESTAMP_MS: Millisecond precision timestamps
192
+ - TIMESTAMP_S: Second precision timestamps
193
+
194
+ Use this to check if a column contains temporal data that should be handled
195
+ as Python datetime, date, or time objects.
196
+
197
+ DB API 2.0 Reference:
198
+ https://peps.python.org/pep-0249/#datetime
199
+
200
+ Example:
201
+ >>> cursor.description[2][1] == DATETIME # Check if third column is date/time
202
+ """
203
+
204
+ BINARY = DBAPITypeObject([sqltypes.BLOB])
205
+ """
206
+ BINARY type object for binary data database columns.
207
+
208
+ This type object represents binary data types in DuckDB:
209
+ - BLOB: Binary Large Objects for storing arbitrary binary data
210
+
211
+ Use this to check if a column contains binary data that should be handled
212
+ as Python bytes objects.
213
+
214
+ DB API 2.0 Reference:
215
+ https://peps.python.org/pep-0249/#binary
216
+
217
+ Example:
218
+ >>> cursor.description[3][1] == BINARY # Check if fourth column is binary
219
+ """
220
+
221
+ ROWID = None
222
+ """
223
+ ROWID type object for row identifier columns.
224
+
225
+ DB API 2.0 Reference:
226
+ https://peps.python.org/pep-0249/#rowid
227
+
228
+ Note:
229
+ This will always be None for DuckDB connections. Applications should not
230
+ rely on ROWID functionality when using DuckDB.
231
+ """
duckdb/_version.py ADDED
@@ -0,0 +1,22 @@
1
+ # ----------------------------------------------------------------------
2
+ # Version API
3
+ #
4
+ # We provide three symbols:
5
+ # - duckdb.__version__: The version of this package
6
+ # - duckdb.__duckdb_version__: The version of duckdb that is bundled
7
+ # - duckdb.version(): A human-readable version string containing both of the above
8
+ # ----------------------------------------------------------------------
9
+ from importlib.metadata import version as _dist_version
10
+
11
+ import _duckdb
12
+
13
+ __version__: str = _dist_version("duckdb")
14
+ """Version of the DuckDB Python Package."""
15
+
16
+ __duckdb_version__: str = _duckdb.__version__
17
+ """Version of DuckDB that is bundled."""
18
+
19
+
20
+ def version() -> str:
21
+ """Human-friendly formatted version string of both the distribution package and the bundled DuckDB engine."""
22
+ return f"{__version__} (with duckdb {_duckdb.__version__})"
@@ -0,0 +1,69 @@
1
+ """StringIO buffer wrapper.
2
+
3
+ BSD 3-Clause License
4
+
5
+ Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
6
+ All rights reserved.
7
+
8
+ Copyright (c) 2011-2022, Open source contributors.
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are met:
12
+
13
+ * Redistributions of source code must retain the above copyright notice, this
14
+ list of conditions and the following disclaimer.
15
+
16
+ * Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ * Neither the name of the copyright holder nor the names of its
21
+ contributors may be used to endorse or promote products derived from
22
+ this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ """
35
+
36
+ from io import StringIO, TextIOBase
37
+ from typing import Any, Union
38
+
39
+
40
+ class BytesIOWrapper:
41
+ """Wrapper that wraps a StringIO buffer and reads bytes from it.
42
+
43
+ Created for compat with pyarrow read_csv.
44
+ """
45
+
46
+ def __init__(self, buffer: Union[StringIO, TextIOBase], encoding: str = "utf-8") -> None: # noqa: D107
47
+ self.buffer = buffer
48
+ self.encoding = encoding
49
+ # Because a character can be represented by more than 1 byte,
50
+ # it is possible that reading will produce more bytes than n
51
+ # We store the extra bytes in this overflow variable, and append the
52
+ # overflow to the front of the bytestring the next time reading is performed
53
+ self.overflow = b""
54
+
55
+ def __getattr__(self, attr: str) -> Any: # noqa: D105, ANN401
56
+ return getattr(self.buffer, attr)
57
+
58
+ def read(self, n: Union[int, None] = -1) -> bytes: # noqa: D102
59
+ assert self.buffer is not None
60
+ bytestring = self.buffer.read(n).encode(self.encoding)
61
+ # When n=-1/n greater than remaining bytes: Read entire file/rest of file
62
+ combined_bytestring = self.overflow + bytestring
63
+ if n is None or n < 0 or n >= len(combined_bytestring):
64
+ self.overflow = b""
65
+ return combined_bytestring
66
+ else:
67
+ to_return = combined_bytestring[:n]
68
+ self.overflow = combined_bytestring[n:]
69
+ return to_return
@@ -0,0 +1,3 @@
1
+ from . import spark # noqa: D104
2
+
3
+ __all__ = spark.__all__
@@ -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,6 @@
1
+ from .conf import SparkConf # noqa: D104
2
+ from .context import SparkContext
3
+ from .exception import ContributionsAcceptedError
4
+ from .sql import DataFrame, SparkSession
5
+
6
+ __all__ = ["ContributionsAcceptedError", "DataFrame", "SparkConf", "SparkContext", "SparkSession"]
@@ -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
+ """Module defining global singleton classes.
19
+
20
+ This module raises a RuntimeError if an attempt to reload it is made. In that
21
+ way the identities of the classes defined here are fixed and will remain so
22
+ even if duckdb spark itself is reloaded. In particular, a function like the following
23
+ will still work correctly after duckdb spark is reloaded:
24
+
25
+ def foo(arg=pyducdkb.spark._NoValue):
26
+ if arg is pyducdkb.spark._NoValue:
27
+ ...
28
+
29
+ See gh-7844 for a discussion of the reload problem that motivated this module.
30
+
31
+ Note that this approach is taken after from NumPy.
32
+ """
33
+
34
+ __ALL__ = ["_NoValue"]
35
+
36
+
37
+ # Disallow reloading this module so as to preserve the identities of the
38
+ # classes defined here.
39
+ if "_is_loaded" in globals():
40
+ msg = "Reloading duckdb.experimental.spark._globals is not allowed"
41
+ raise RuntimeError(msg)
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) -> "_NoValueType":
58
+ # ensure that only one instance exists
59
+ if not cls.__instance:
60
+ cls.__instance = super().__new__(cls)
61
+ return cls.__instance
62
+
63
+ # Make the _NoValue instance falsey
64
+ def __nonzero__(self) -> bool:
65
+ return False
66
+
67
+ __bool__ = __nonzero__
68
+
69
+ # needed for python 2 to preserve identity through a pickle
70
+ def __reduce__(self) -> tuple[type, tuple]:
71
+ return (self.__class__, ())
72
+
73
+ def __repr__(self) -> str:
74
+ return "<no value>"
75
+
76
+
77
+ _NoValue = _NoValueType()