sqlframe 3.13.3__py3-none-any.whl → 3.13.4__py3-none-any.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.
sqlframe/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '3.13.3'
16
- __version_tuple__ = version_tuple = (3, 13, 3)
15
+ __version__ = version = '3.13.4'
16
+ __version_tuple__ = version_tuple = (3, 13, 4)
@@ -481,6 +481,7 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
481
481
  cte = cte.transform(replace_id_value, replaced_cte_names) # type: ignore
482
482
  if cte.alias_or_name in existing_cte_counts:
483
483
  existing_cte_counts[cte.alias_or_name] += 10
484
+ # Add unique where filter to ensure that the hash of the CTE is unique
484
485
  cte.set(
485
486
  "this",
486
487
  cte.this.where(
@@ -502,6 +503,7 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
502
503
  new_cte_alias, dialect=self.session.input_dialect, into=exp.TableAlias
503
504
  ),
504
505
  )
506
+ existing_cte_counts[new_cte_alias] = 0
505
507
  existing_ctes.append(cte)
506
508
  else:
507
509
  existing_ctes = ctes
@@ -755,15 +757,20 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
755
757
  ]
756
758
  cte_names_in_join = [x.this for x in join_table_identifiers]
757
759
  # If we have columns that resolve to multiple CTE expressions then we want to use each CTE left-to-right
758
- # and therefore we allow multiple columns with the same name in the result. This matches the behavior
759
- # of Spark.
760
+ # (or right to left if a right join) and therefore we allow multiple columns with the same
761
+ # name in the result. This matches the behavior of Spark.
760
762
  resolved_column_position: t.Dict[exp.Column, int] = {
761
763
  col.copy(): -1 for col in ambiguous_cols
762
764
  }
763
765
  for ambiguous_col in ambiguous_cols:
766
+ ctes = (
767
+ list(reversed(self.expression.ctes))
768
+ if self.expression.args["joins"][0].args.get("side", "") == "right"
769
+ else self.expression.ctes
770
+ )
764
771
  ctes_with_column = [
765
772
  cte
766
- for cte in self.expression.ctes
773
+ for cte in ctes
767
774
  if cte.alias_or_name in cte_names_in_join
768
775
  and ambiguous_col.alias_or_name in cte.this.named_selects
769
776
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlframe
3
- Version: 3.13.3
3
+ Version: 3.13.4
4
4
  Summary: Turning PySpark Into a Universal DataFrame API
5
5
  Home-page: https://github.com/eakmanrq/sqlframe
6
6
  Author: Ryan Eakman
@@ -1,10 +1,10 @@
1
1
  sqlframe/__init__.py,sha256=wfqm98eLoLid9oV_FzzpG5loKC6LxOhj2lXpfN7SARo,3138
2
- sqlframe/_version.py,sha256=_uZxcbQuQ0yJZqsBIcuycE0BUozIDNCyjFPeAZ7W1Ek,413
2
+ sqlframe/_version.py,sha256=7_6ZiCN2IEbqvGolC1tvkUZXIMID8-9wKt9GAmhPeyU,413
3
3
  sqlframe/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  sqlframe/base/_typing.py,sha256=b2clI5HI1zEZKB_3Msx3FeAJQyft44ubUifJwQRVXyQ,1298
5
5
  sqlframe/base/catalog.py,sha256=SzFQalTWdhWzxUY-4ut1f9TfOECp_JmJEgNPfrRKCe0,38457
6
6
  sqlframe/base/column.py,sha256=wRghgieYAA51aw4WuFQWOvl0TFOToZbBhBuIamEzxx4,18011
7
- sqlframe/base/dataframe.py,sha256=bnF8SYIDhSFPYKchGakRG_oWqgZ-66jKZsdcqUSqCDE,74940
7
+ sqlframe/base/dataframe.py,sha256=Z_ao91TOoOMtyc32VwK5lXaH_-grchMEgk-V4fDBsRQ,75363
8
8
  sqlframe/base/decorators.py,sha256=P56cgs8DANxGRIwVs5uOMnDy-BlXZZYMbf4fdnkpWPI,1889
9
9
  sqlframe/base/exceptions.py,sha256=9Uwvqn2eAkDpqm4BrRgbL61qM-GMCbJEMAW8otxO46s,370
10
10
  sqlframe/base/function_alternatives.py,sha256=8kDCh1cOXtdCcBPYBQ8byXxRAZvphS9N8GDs4txBzGg,52544
@@ -119,8 +119,8 @@ sqlframe/standalone/udf.py,sha256=azmgtUjHNIPs0WMVNId05SHwiYn41MKVBhKXsQJ5dmY,27
119
119
  sqlframe/standalone/window.py,sha256=6GKPzuxeSapJakBaKBeT9VpED1ACdjggDv9JRILDyV0,35
120
120
  sqlframe/testing/__init__.py,sha256=VVCosQhitU74A3NnE52O4mNtGZONapuEXcc20QmSlnQ,132
121
121
  sqlframe/testing/utils.py,sha256=PFsGZpwNUE_4-g_f43_vstTqsK0AQ2lBneb5Eb6NkFo,13008
122
- sqlframe-3.13.3.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
123
- sqlframe-3.13.3.dist-info/METADATA,sha256=eC3F1wnqViGgocYV5HspArMrR-eX1qu5txOdbDqMurc,8970
124
- sqlframe-3.13.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
125
- sqlframe-3.13.3.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
126
- sqlframe-3.13.3.dist-info/RECORD,,
122
+ sqlframe-3.13.4.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
123
+ sqlframe-3.13.4.dist-info/METADATA,sha256=l3ePEWivSaLRcSXkbArcgj3_ENj6eU1WT_b3XifqndA,8970
124
+ sqlframe-3.13.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
125
+ sqlframe-3.13.4.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
126
+ sqlframe-3.13.4.dist-info/RECORD,,