e6data-spark-compatibility 1.0.0__tar.gz

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 (118) hide show
  1. e6data_spark_compatibility-1.0.0/LICENSE +69 -0
  2. e6data_spark_compatibility-1.0.0/PKG-INFO +424 -0
  3. e6data_spark_compatibility-1.0.0/README.md +367 -0
  4. e6data_spark_compatibility-1.0.0/e6_spark_compat/__init__.py +50 -0
  5. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/__init__.py +35 -0
  6. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/__init__.py +180 -0
  7. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/__main__.py +96 -0
  8. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/_typing.py +17 -0
  9. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/_version.py +34 -0
  10. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/__init__.py +126 -0
  11. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/athena.py +288 -0
  12. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/bigquery.py +1443 -0
  13. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/clickhouse.py +1417 -0
  14. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/databricks.py +290 -0
  15. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/dialect.py +2004 -0
  16. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/doris.py +687 -0
  17. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/dremio.py +124 -0
  18. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/drill.py +160 -0
  19. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/druid.py +20 -0
  20. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/duckdb.py +1263 -0
  21. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/dune.py +16 -0
  22. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/e6.py +3153 -0
  23. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/exasol.py +251 -0
  24. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/fabric.py +213 -0
  25. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/hive.py +813 -0
  26. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/materialize.py +96 -0
  27. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/mysql.py +1329 -0
  28. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/oracle.py +395 -0
  29. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/postgres.py +849 -0
  30. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/presto.py +857 -0
  31. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/prql.py +209 -0
  32. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/redshift.py +464 -0
  33. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/risingwave.py +85 -0
  34. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/singlestore.py +1146 -0
  35. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/snowflake.py +1796 -0
  36. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/spark.py +261 -0
  37. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/spark2.py +456 -0
  38. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/sqlite.py +344 -0
  39. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/starrocks.py +356 -0
  40. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/tableau.py +61 -0
  41. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/teradata.py +398 -0
  42. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/trino.py +116 -0
  43. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/dialects/tsql.py +1420 -0
  44. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/diff.py +468 -0
  45. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/errors.py +93 -0
  46. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/executor/__init__.py +95 -0
  47. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/executor/context.py +101 -0
  48. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/executor/env.py +246 -0
  49. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/executor/python.py +460 -0
  50. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/executor/table.py +155 -0
  51. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/expressions.py +9186 -0
  52. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/generator.py +5147 -0
  53. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/helper.py +582 -0
  54. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/jsonpath.py +227 -0
  55. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/lineage.py +433 -0
  56. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/__init__.py +11 -0
  57. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/annotate_types.py +665 -0
  58. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/canonicalize.py +222 -0
  59. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/eliminate_ctes.py +43 -0
  60. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/eliminate_joins.py +181 -0
  61. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/eliminate_subqueries.py +189 -0
  62. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/isolate_table_selects.py +50 -0
  63. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/merge_subqueries.py +418 -0
  64. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/normalize.py +200 -0
  65. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/normalize_identifiers.py +64 -0
  66. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/optimize_joins.py +92 -0
  67. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/optimizer.py +94 -0
  68. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/pushdown_predicates.py +223 -0
  69. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/pushdown_projections.py +176 -0
  70. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/qualify.py +104 -0
  71. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/qualify_columns.py +1111 -0
  72. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/qualify_tables.py +171 -0
  73. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/scope.py +933 -0
  74. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/simplify.py +1603 -0
  75. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/optimizer/unnest_subqueries.py +302 -0
  76. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/parser.py +8817 -0
  77. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/planner.py +463 -0
  78. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/py.typed +0 -0
  79. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/schema.py +604 -0
  80. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/serde.py +68 -0
  81. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/time.py +687 -0
  82. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/tokens.py +1559 -0
  83. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/transforms.py +1044 -0
  84. e6data_spark_compatibility-1.0.0/e6_spark_compat/_vendor/sqlglot/trie.py +81 -0
  85. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/__init__.py +1 -0
  86. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/connection.py +185 -0
  87. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/e6_executor.py +81 -0
  88. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/logging_config.py +201 -0
  89. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/query_plan.py +850 -0
  90. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/schema_cache.py +73 -0
  91. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/session.py +303 -0
  92. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/sql_generator.py +2880 -0
  93. e6data_spark_compatibility-1.0.0/e6_spark_compat/core/types.py +75 -0
  94. e6data_spark_compatibility-1.0.0/e6_spark_compat/pyspark_compat.py +14 -0
  95. e6data_spark_compatibility-1.0.0/e6_spark_compat/sedona/__init__.py +85 -0
  96. e6data_spark_compatibility-1.0.0/e6_spark_compat/spatial/__init__.py +1 -0
  97. e6data_spark_compatibility-1.0.0/e6_spark_compat/spatial/functions.py +547 -0
  98. e6data_spark_compatibility-1.0.0/e6_spark_compat/spatial/sedona_registrator.py +13 -0
  99. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/__init__.py +8 -0
  100. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/column.py +780 -0
  101. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/dataframe.py +1275 -0
  102. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/functions.py +1172 -0
  103. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/group.py +117 -0
  104. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/mock_io.py +441 -0
  105. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/reader.py +369 -0
  106. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/row.py +65 -0
  107. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/types.py +298 -0
  108. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/udf_translator.py +1812 -0
  109. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/window.py +282 -0
  110. e6data_spark_compatibility-1.0.0/e6_spark_compat/sql/writer.py +545 -0
  111. e6data_spark_compatibility-1.0.0/e6data_spark_compatibility.egg-info/PKG-INFO +424 -0
  112. e6data_spark_compatibility-1.0.0/e6data_spark_compatibility.egg-info/SOURCES.txt +116 -0
  113. e6data_spark_compatibility-1.0.0/e6data_spark_compatibility.egg-info/dependency_links.txt +1 -0
  114. e6data_spark_compatibility-1.0.0/e6data_spark_compatibility.egg-info/requires.txt +15 -0
  115. e6data_spark_compatibility-1.0.0/e6data_spark_compatibility.egg-info/top_level.txt +1 -0
  116. e6data_spark_compatibility-1.0.0/setup.cfg +4 -0
  117. e6data_spark_compatibility-1.0.0/setup.py +71 -0
  118. e6data_spark_compatibility-1.0.0/tests/test_writer.py +308 -0
@@ -0,0 +1,69 @@
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, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ Copyright 2024 E6Data
58
+
59
+ Licensed under the Apache License, Version 2.0 (the "License");
60
+ you may not use this file except in compliance with the License.
61
+ You may obtain a copy of the License at
62
+
63
+ http://www.apache.org/licenses/LICENSE-2.0
64
+
65
+ Unless required by applicable law or agreed to in writing, software
66
+ distributed under the License is distributed on an "AS IS" BASIS,
67
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
68
+ See the License for the specific language governing permissions and
69
+ limitations under the License.
@@ -0,0 +1,424 @@
1
+ Metadata-Version: 2.4
2
+ Name: e6data-spark-compatibility
3
+ Version: 1.0.0
4
+ Summary: PySpark and Sedona compatibility layer for e6data
5
+ Home-page: https://github.com/e6data/e6-spark-compat
6
+ Author: E6Data
7
+ Author-email: support@e6data.com
8
+ Project-URL: Bug Reports, https://github.com/e6data/e6-spark-compat/issues
9
+ Project-URL: Source, https://github.com/e6data/e6-spark-compat
10
+ Project-URL: Documentation, https://github.com/e6data/e6-spark-compat/blob/main/README.md
11
+ Keywords: pyspark spark sql dataframe e6data compatibility sedona spatial
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Topic :: Database
16
+ Classifier: Topic :: Database :: Database Engines/Servers
17
+ Classifier: Topic :: Scientific/Engineering :: GIS
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: License :: OSI Approved :: Apache Software License
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.7
22
+ Classifier: Programming Language :: Python :: 3.8
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Operating System :: OS Independent
28
+ Requires-Python: >=3.7
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: e6data-python-connector>=2.3.10
32
+ Requires-Dist: pandas>=1.0.0
33
+ Requires-Dist: numpy>=1.18.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=6.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=2.0; extra == "dev"
37
+ Requires-Dist: pytest-html>=3.0; extra == "dev"
38
+ Requires-Dist: black>=22.0; extra == "dev"
39
+ Requires-Dist: flake8>=3.8; extra == "dev"
40
+ Requires-Dist: mypy>=0.910; extra == "dev"
41
+ Provides-Extra: spatial
42
+ Requires-Dist: geopandas>=0.10.0; extra == "spatial"
43
+ Requires-Dist: shapely>=1.8.0; extra == "spatial"
44
+ Dynamic: author
45
+ Dynamic: author-email
46
+ Dynamic: classifier
47
+ Dynamic: description
48
+ Dynamic: description-content-type
49
+ Dynamic: home-page
50
+ Dynamic: keywords
51
+ Dynamic: license-file
52
+ Dynamic: project-url
53
+ Dynamic: provides-extra
54
+ Dynamic: requires-dist
55
+ Dynamic: requires-python
56
+ Dynamic: summary
57
+
58
+ # e6-spark-compat
59
+
60
+ A PySpark and Sedona compatibility layer for e6data, providing seamless migration from PySpark to e6data with minimal code changes.
61
+
62
+ ## Overview
63
+
64
+ e6-spark-compat is a production-ready compatibility library that translates PySpark and Apache Sedona operations into optimized e6data SQL queries. The library implements lazy evaluation, professional SQL generation using SQLGlot, and comprehensive PySpark API compatibility.
65
+
66
+ ### Key Features
67
+
68
+ - **Lazy Evaluation**: Build query plans that execute only when actions are called
69
+ - **Professional SQL Generation**: SQLGlot-based AST optimization for high-performance queries
70
+ - **Complete PySpark API**: DataFrame operations, SQL functions, window functions, and aggregations
71
+ - **Spatial Operations**: Full Apache Sedona compatibility with ST_* functions
72
+ - **Window Functions**: Complete Window specification API for advanced analytics
73
+ - **Multiple File Formats**: Parquet, ORC, CSV, JSON, and GeoParquet support
74
+ - **Dual-Mode Test Suite**: 1270 tests run offline (SQL validation) and live (cluster execution)
75
+ - **CI/CD**: GitHub Actions with offline (automatic) and live (manual) test runs
76
+
77
+ ## Installation
78
+
79
+ ### For Users
80
+
81
+ ```bash
82
+ # Install from PyPI
83
+ pip install e6data-spark-compatibility
84
+
85
+ # Install from GitHub
86
+ pip install git+https://github.com/e6data/e6-spark-compat.git
87
+
88
+ # Install from local clone
89
+ git clone https://github.com/e6data/e6-spark-compat.git
90
+ cd e6-spark-compat
91
+ pip install -e .
92
+ ```
93
+
94
+ ### For Developers
95
+
96
+ ```bash
97
+ # Clone the repository
98
+ git clone https://github.com/e6data/e6-spark-compat.git
99
+ cd e6-spark-compat
100
+
101
+ # Install with development dependencies
102
+ pip install -e ".[dev]"
103
+
104
+ # Run tests
105
+ pytest tests/
106
+ ```
107
+
108
+ ## Quick Start
109
+
110
+ ### Migration from PySpark
111
+
112
+ Simply change your import statements - everything else stays the same:
113
+
114
+ ```python
115
+ # Before: PySpark imports
116
+ # from pyspark.sql import SparkSession
117
+ # from pyspark.sql.functions import col, upper, count, sum, row_number
118
+ # from pyspark.sql.window import Window
119
+
120
+ # After: e6-spark-compat imports
121
+ from e6_spark_compat import SparkSession
122
+ from e6_spark_compat.sql.functions import col, upper, count, sum, row_number
123
+ from e6_spark_compat.sql.window import Window
124
+
125
+ # Connection configuration
126
+ spark = (SparkSession.builder
127
+ .appName("E6DataExample")
128
+ .config("spark.e6data.host", "your-host")
129
+ .config("spark.e6data.username", "your-username")
130
+ .config("spark.e6data.password", "your-password")
131
+ .config("spark.e6data.database", "your-database")
132
+ .config("spark.e6data.catalog", "your-catalog")
133
+ .config("spark.e6data.cluster", "your-cluster-name")
134
+ .config("spark.e6data.secure", True)
135
+ .getOrCreate())
136
+
137
+ # All PySpark operations work identically
138
+ df = spark.read.parquet("s3://bucket/path/to/data.parquet")
139
+
140
+ # Transformations (lazy evaluation)
141
+ result = (df.filter(col("age") > 21)
142
+ .select("name", upper(col("city")).alias("city_upper"), "salary")
143
+ .groupBy("city_upper")
144
+ .agg(
145
+ count("*").alias("total_people"),
146
+ sum("salary").alias("total_salary")
147
+ )
148
+ .orderBy(col("total_people").desc()))
149
+
150
+ # Action triggers execution
151
+ result.show()
152
+ ```
153
+
154
+ ### Window Functions
155
+
156
+ ```python
157
+ from e6_spark_compat.sql.window import Window
158
+ from e6_spark_compat.sql.functions import row_number, rank, lag
159
+
160
+ # Window specifications
161
+ window_spec = Window.partitionBy("department").orderBy("salary")
162
+ frame_spec = (Window.partitionBy("team").orderBy("hire_date")
163
+ .rowsBetween(Window.UNBOUNDED_PRECEDING, Window.CURRENT_ROW))
164
+
165
+ # Window functions
166
+ df_with_analytics = df.select(
167
+ "*",
168
+ row_number().over(window_spec).alias("rank"),
169
+ lag("salary", 1).over(window_spec).alias("prev_salary"),
170
+ sum("salary").over(frame_spec).alias("running_total")
171
+ )
172
+ ```
173
+
174
+ ## Spatial Support
175
+
176
+ For spatial operations with Sedona compatibility:
177
+
178
+ ```python
179
+ from e6_spark_compat.sedona import SedonaRegistrator
180
+ from e6_spark_compat.sql.functions import expr
181
+
182
+ # Register Sedona functions
183
+ SedonaRegistrator.registerAll(spark)
184
+
185
+ # Use spatial functions
186
+ points_df = spark.read.parquet("s3://bucket/points.parquet")
187
+ polygons_df = spark.read.parquet("s3://bucket/polygons.parquet")
188
+
189
+ # Spatial join
190
+ result = points_df.join(
191
+ polygons_df,
192
+ expr("ST_Contains(polygons_df.geometry, ST_Point(points_df.lon, points_df.lat))"),
193
+ "inner"
194
+ )
195
+ ```
196
+
197
+ ## Comprehensive Feature Set
198
+
199
+ ### DataFrame Operations
200
+ - **Transformations**: `select()`, `filter()`/`where()`, `join()`, `groupBy()`, `orderBy()`/`sort()`, `limit()`, `distinct()`
201
+ - **Set Operations**: `union()`, `intersect()`, `exceptAll()`
202
+ - **Column Operations**: `withColumn()`, `withColumnRenamed()`, `drop()`, `cast()`
203
+ - **Caching**: `cache()`/`persist()`, `unpersist()`
204
+
205
+ ### Action Methods
206
+ - **Data Retrieval**: `collect()`, `count()`, `first()`, `take()`, `head()`
207
+ - **Display**: `show()`, `explain()`, `describe()`
208
+ - **Export**: `toPandas()`, `write.parquet()`, `write.orc()`, `write.csv()`, `write.json()`
209
+ - **Views**: `createOrReplaceTempView()`, `createGlobalTempView()`
210
+
211
+ ### SQL Functions (135+)
212
+ - **String Functions**: `upper`, `lower`, `concat`, `substring`, `trim`, `split`, `regexp_replace`, `length`
213
+ - **Math Functions**: `abs`, `round`, `floor`, `ceil`, `sqrt`, `pow`, `sin`, `cos`, `log`
214
+ - **Aggregate Functions**: `sum`, `avg`, `count`, `min`, `max`, `first`, `last`, `collect_list`
215
+ - **Date/Time Functions**: `year`, `month`, `dayofmonth`, `hour`, `minute`, `date_add`, `date_sub`, `datediff`
216
+ - **Window Functions**: `row_number`, `rank`, `dense_rank`, `percent_rank`, `ntile`, `lag`, `lead`
217
+ - **Conditional Functions**: `when`, `coalesce`, `isnull`, `isnan`, `greatest`, `least`
218
+ - **Hash Functions**: `md5`, `sha1`, `sha2`, `hash`, `xxhash64`
219
+ - **Array Functions**: `array`, `array_contains`, `explode`, `size`, `array_sort`, and 16 more
220
+ - **Map Functions**: `map_keys`, `map_values`, `map_from_arrays`, `map_concat`
221
+ - **JSON Functions**: `get_json_object`, `json_extract`, `from_json`, `to_json`
222
+
223
+ ### Spatial Operations (Sedona Compatible)
224
+ - **Geometry Functions**: All ST_* functions including `ST_Point`, `ST_Polygon`, `ST_Buffer`
225
+ - **Spatial Relationships**: `ST_Contains`, `ST_Intersects`, `ST_Distance`, `ST_Within`
226
+ - **Transformations**: `ST_Transform`, `ST_Centroid`, `ST_ConvexHull`
227
+ - **Indexing**: H3 and GeoHash spatial indexing support
228
+
229
+ ## Testing
230
+
231
+ ### Test Suite Overview
232
+
233
+ The test suite uses **dual-mode execution**: tests run offline by default (mock connection, SQL validation) and can also execute on a live e6data cluster when credentials are provided.
234
+
235
+ | Category | Tests | Description |
236
+ |---|---|---|
237
+ | E2E SQL Generation | 360 | Full pipeline: PySpark API → SQL string validation |
238
+ | TPC-DS Translations | 37 | Standard benchmark queries (37 of 99 TPC-DS queries) |
239
+ | TPC-DS Analytics | 22 | Complex analytics workloads (star schema, RFM, ETL pipelines) |
240
+ | SQLGlot Expressions | 288 | SQL expression generation via SQLGlot |
241
+ | Integration | 227 | Query plan node composition |
242
+ | Unit | 200 | Individual class/method tests |
243
+ | Writer | 38 | DataFrameWriter operations |
244
+ | Workloads | 94 | Customer workload pipeline tests (Kroger DQ + DFM analytics) |
245
+ | **Total** | **1270** | **1263 pass, 7 known failures** |
246
+
247
+ ### Customer Scripts
248
+
249
+ Standalone scripts that exercise real customer pipelines end-to-end:
250
+
251
+ | Script | Description | Dataset |
252
+ |---|---|---|
253
+ | `kroger_original_test.py` | Kroger pre-DQ validation pipeline | mars_full |
254
+ | `e6_dfm_on_mars_full.py` | DFM pipeline patterns (39 tests) | mars_full |
255
+ | `e6_dfm_test.py` | DFM feature coverage (42 tests) | TPC-DS |
256
+ | `*_rust.py` variants | Same scripts with FORMAT_NUMBER workaround for rust engine |
257
+
258
+ ```bash
259
+ # Run customer script on Java engine
260
+ E6DATA_HOST=... S3_READ_BASE=... python tests/customer_scripts/kroger_original_test.py
261
+
262
+ # Run on rust engine
263
+ E6DATA_HOST=... S3_READ_BASE=... python tests/customer_scripts/kroger_original_test_rust.py
264
+ ```
265
+
266
+ ### Running Tests
267
+
268
+ ```bash
269
+ # Offline (default) — fast, no cluster needed (~5 seconds)
270
+ ./run_tests.sh
271
+
272
+ # Specific file or directory
273
+ ./run_tests.sh offline 1 tests/workloads/
274
+ ./run_tests.sh offline 1 tests/workloads/test_dfm_pipeline.py
275
+ ./run_tests.sh offline 1 tests/workloads/test_dfm_pipeline.py::TestDFMMissingFunctions
276
+
277
+ # By keyword or marker
278
+ ./run_tests.sh offline 1 -k "dfm"
279
+ ./run_tests.sh offline 1 -m e2e
280
+
281
+ # Or use pytest directly
282
+ pytest tests/e2e/ # E2E tests
283
+ pytest tests/tpcds/ # TPC-DS queries
284
+ pytest tests/e2e/ -m spatial # Spatial tests
285
+ ```
286
+
287
+ ### Live Mode (cluster execution)
288
+
289
+ Set environment variables to run the same tests against a real e6data cluster:
290
+
291
+ ```bash
292
+ export E6DATA_HOST="your-cluster-host"
293
+ export E6DATA_PORT="443"
294
+ export E6DATA_USERNAME="your-user"
295
+ export E6DATA_PASSWORD="your-token"
296
+ export E6DATA_DATABASE="tpcds_1000_delta"
297
+ export E6DATA_CATALOG="your-catalog"
298
+ export E6DATA_CLUSTER="your-cluster"
299
+
300
+ # Sequential with full HTML report
301
+ ./run_tests.sh live
302
+
303
+ # Parallel with N workers
304
+ ./run_tests.sh live 4
305
+ ./run_tests.sh live 8
306
+ ```
307
+
308
+ In live mode, each test generates SQL (same as offline) **and** executes it on the cluster with `LIMIT 5`. The HTML report captures query IDs, row counts, execution times, and error details.
309
+
310
+ ### Test Reports
311
+
312
+ Reports are auto-generated on every run:
313
+
314
+ - **HTML**: `reports/test_report.html` — browsable report with expandable details per test:
315
+ - PySpark input source code
316
+ - Generated SQL
317
+ - Query ID (live mode)
318
+ - Engine error details (live mode, failures only)
319
+ - **JUnit XML**: `reports/test_results.xml` — for CI/CD integration
320
+
321
+ ### CI / GitHub Actions
322
+
323
+ Offline tests run automatically on every push/PR — no setup needed.
324
+
325
+ Live tests are triggered manually (requires GitHub secrets configured):
326
+
327
+ **From GitHub UI:**
328
+ 1. Go to **Actions** tab → **e6-spark-compat CI**
329
+ 2. Click **Run workflow**
330
+ 3. Select branch, cluster (`general` / `rust-azure-benchmark`), and worker count
331
+ 4. Click **Run workflow**
332
+
333
+ **From CLI:**
334
+ ```bash
335
+ gh workflow run tests.yml --ref main -f run_live=true -f cluster=general -f concurrency=4
336
+ ```
337
+
338
+ The CI summary includes category breakdown tables, failure details, and the `dorny/test-reporter` renders an interactive test results tab.
339
+
340
+ ## Architecture
341
+
342
+ ### Core Components
343
+
344
+ 1. **Query Plan Tree**: AST-like nodes representing SQL operations (Filter, Project, Join, Aggregate, etc.)
345
+ 2. **SQLGlot Integration**: Professional SQL generation using AST-based optimization
346
+ 3. **Lazy Evaluation**: Operations build query plans without immediate execution
347
+ 4. **Connection Management**: Efficient e6data connection handling and query execution
348
+
349
+ ### Execution Flow
350
+
351
+ 1. **Build Phase**: DataFrame operations create query plan nodes
352
+ 2. **Optimization Phase**: SQLGlot optimizes the query plan using AST transformations
353
+ 3. **Generation Phase**: Query plans generate optimized SQL via SQLGlot
354
+ 4. **Execution Phase**: Actions trigger SQL execution on e6data
355
+ 5. **Result Phase**: Results returned in PySpark-compatible format
356
+
357
+ ## Development
358
+
359
+ ### Project Structure
360
+
361
+ ```
362
+ e6_spark_compat/
363
+ ├── core/ # Session, connection, query plan, SQL generator
364
+ ├── sql/ # DataFrame, Column, functions, window, reader, writer, types
365
+ ├── spatial/ # Sedona-compatible ST_* functions
366
+ └── sedona/ # SedonaRegistrator compatibility shim
367
+
368
+ tests/
369
+ ├── e2e/ # E2E SQL generation tests (dual-mode: offline + live)
370
+ ├── tpcds/ # TPC-DS benchmark query translations (37 queries)
371
+ ├── integration/ # Query plan composition tests
372
+ ├── sqlglot_tests/ # SQLGlot expression tests
373
+ ├── unit/ # Unit tests
374
+ ├── workloads/ # Customer workload pipeline tests
375
+ ├── customer_scripts/ # Standalone customer pipeline scripts
376
+ └── live/ # Live cluster-only execution tests
377
+ ```
378
+
379
+ ### Code Quality
380
+
381
+ ```bash
382
+ # Format code
383
+ black e6_spark_compat/
384
+
385
+ # Run linting
386
+ flake8 e6_spark_compat/
387
+
388
+ # Type checking
389
+ mypy e6_spark_compat/
390
+ ```
391
+
392
+ ## Migration Guide
393
+
394
+ ### From PySpark
395
+
396
+ 1. **Update Imports**: Change `pyspark` imports to `e6_spark_compat`
397
+ 2. **Configuration**: Update SparkSession configuration for e6data connection
398
+ 3. **Test**: Run your existing PySpark code - it should work unchanged
399
+
400
+ ### From Sedona
401
+
402
+ 1. **Spatial Functions**: Replace Sedona imports with `e6_spark_compat.spatial.functions`
403
+ 2. **Registration**: Use `SedonaRegistrator.registerAll(spark)` for compatibility
404
+ 3. **Geometry Types**: Spatial operations work identically to Sedona
405
+
406
+ ## Contributing
407
+
408
+ We welcome contributions! Here's how to get started:
409
+
410
+ 1. Fork the repository
411
+ 2. Create a feature branch
412
+ 3. Add tests for new functionality
413
+ 4. Ensure all tests pass (`pytest tests/`)
414
+ 5. Submit a pull request
415
+
416
+ ## Support
417
+
418
+ - **Documentation**: See `docs/pyspark-compatibility/` for detailed guides
419
+ - **Issues**: Report bugs and feature requests on GitHub
420
+ - **Contact**: support@e6data.com for enterprise support
421
+
422
+ ## License
423
+
424
+ Apache License 2.0 - see [LICENSE](LICENSE) for details.