pyspark-connectby 1.0.9__tar.gz → 1.1.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.

Potentially problematic release.


This version of pyspark-connectby might be problematic. Click here for more details.

@@ -1,9 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyspark-connectby
3
- Version: 1.0.9
3
+ Version: 1.1.0
4
4
  Summary: connectby hierarchy query in spark
5
5
  Author: Chen, Yu
6
- Author-email: cheny@fcc.ca
7
6
  Requires-Python: >=3.7,<4.0
8
7
  Classifier: Programming Language :: Python :: 3
9
8
  Classifier: Programming Language :: Python :: 3.7
@@ -20,7 +19,7 @@ Spark currently does not support hierarchy query `connectBy` as of version 3.5.0
20
19
  This is an attempt to add `connectBy` method to [DataFrame](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrame.html)
21
20
 
22
21
  # Concept
23
- Hierarchy query is one of the important feature that many relational databases, such as Oracle, DB2, My SQL,
22
+ Hierarchy query is one of the important feature that many relational databases, such as [Oracle](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Hierarchical-Queries.html#GUID-0118DF1D-B9A9-41EB-8556-C6E7D6A5A84E), DB2, My SQL,
24
23
  Snowflake, [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_CONNECT_BY_clause.html), etc.,
25
24
  would support directly or alternatively by using recursive CTE.
26
25
 
@@ -52,16 +51,20 @@ df2.show()
52
51
  ```
53
52
  With result:
54
53
  ```
55
- +------+-----+----------+------+
56
- |emp_id|level|manager_id| name|
57
- +------+-----+----------+------+
58
- | 1| 1| null|Carlos|
59
- | 11| 2| 1| John|
60
- | 111| 3| 11| Jorge|
61
- | 112| 3| 11| Kwaku|
62
- | 113| 3| 11| Liu|
63
- +------+-----+----------+------+
54
+ +------+----------+-----+-----------------+----------+------+
55
+ |emp_id|START_WITH|LEVEL|CONNECT_BY_ISLEAF|manager_id| name|
56
+ +------+----------+-----+-----------------+----------+------+
57
+ | 1| 1| 1| false| null|Carlos|
58
+ | 11| 1| 2| false| 1| John|
59
+ | 111| 1| 3| true| 11| Jorge|
60
+ | 112| 1| 3| true| 11| Kwaku|
61
+ | 113| 1| 3| true| 11| Liu|
62
+ +------+----------+-----+-----------------+----------+------+
64
63
  ```
64
+ Note the pseudo columns in the query result:
65
+ - START_WITH
66
+ - LEVEL
67
+ - CONNECT_BY_ISLEAF
65
68
 
66
69
  # Installation
67
70
  Python Version >= 3.7
@@ -82,8 +85,6 @@ df.transform(connectBy, prior='emp_id', to='manager_id', start_with='1') # or b
82
85
 
83
86
  df.connectBy(prior='emp_id', to='manager_id') # without start_with, it will go through each node
84
87
 
85
- df.connectBy(prior='emp_id', to='manager_id', level_col='the_level') # level column name other than `level`
86
-
87
88
  df.connectBy(prior='emp_id', to='manager_id', start_with=['1', '2']) # start_with a list of top nodes ids.
88
89
 
89
90
  ```
@@ -4,7 +4,7 @@ Spark currently does not support hierarchy query `connectBy` as of version 3.5.0
4
4
  This is an attempt to add `connectBy` method to [DataFrame](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrame.html)
5
5
 
6
6
  # Concept
7
- Hierarchy query is one of the important feature that many relational databases, such as Oracle, DB2, My SQL,
7
+ Hierarchy query is one of the important feature that many relational databases, such as [Oracle](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Hierarchical-Queries.html#GUID-0118DF1D-B9A9-41EB-8556-C6E7D6A5A84E), DB2, My SQL,
8
8
  Snowflake, [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_CONNECT_BY_clause.html), etc.,
9
9
  would support directly or alternatively by using recursive CTE.
10
10
 
@@ -36,16 +36,20 @@ df2.show()
36
36
  ```
37
37
  With result:
38
38
  ```
39
- +------+-----+----------+------+
40
- |emp_id|level|manager_id| name|
41
- +------+-----+----------+------+
42
- | 1| 1| null|Carlos|
43
- | 11| 2| 1| John|
44
- | 111| 3| 11| Jorge|
45
- | 112| 3| 11| Kwaku|
46
- | 113| 3| 11| Liu|
47
- +------+-----+----------+------+
39
+ +------+----------+-----+-----------------+----------+------+
40
+ |emp_id|START_WITH|LEVEL|CONNECT_BY_ISLEAF|manager_id| name|
41
+ +------+----------+-----+-----------------+----------+------+
42
+ | 1| 1| 1| false| null|Carlos|
43
+ | 11| 1| 2| false| 1| John|
44
+ | 111| 1| 3| true| 11| Jorge|
45
+ | 112| 1| 3| true| 11| Kwaku|
46
+ | 113| 1| 3| true| 11| Liu|
47
+ +------+----------+-----+-----------------+----------+------+
48
48
  ```
49
+ Note the pseudo columns in the query result:
50
+ - START_WITH
51
+ - LEVEL
52
+ - CONNECT_BY_ISLEAF
49
53
 
50
54
  # Installation
51
55
  Python Version >= 3.7
@@ -66,8 +70,6 @@ df.transform(connectBy, prior='emp_id', to='manager_id', start_with='1') # or b
66
70
 
67
71
  df.connectBy(prior='emp_id', to='manager_id') # without start_with, it will go through each node
68
72
 
69
- df.connectBy(prior='emp_id', to='manager_id', level_col='the_level') # level column name other than `level`
70
-
71
73
  df.connectBy(prior='emp_id', to='manager_id', start_with=['1', '2']) # start_with a list of top nodes ids.
72
74
 
73
75
  ```
@@ -1,8 +1,8 @@
1
1
  [tool.poetry]
2
2
  name = "pyspark-connectby"
3
- version = "1.0.9"
3
+ version = "1.1.0"
4
4
  description = "connectby hierarchy query in spark"
5
- authors = ["Chen, Yu <cheny@fcc.ca>"]
5
+ authors = ["Chen, Yu"]
6
6
  readme = "README.md"
7
7
  packages = [{include = "pyspark_connectby"}]
8
8