Skip to content

Commit 821089f

Browse files
canimusHerminio Vazquez
andauthored
Feature fix polars are unique (#460)
* Added fix to are unique in polars latest version * Added new versions --------- Co-authored-by: Herminio Vazquez <hvazquez-cano@copado.com>
1 parent d282271 commit 821089f

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Cache
1111
**__pycache__/
1212
.DS_Store
13+
uv.lock
1314

1415
# Security
1516
*.crt

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Provider | API | Versions
3535
![databricks](https://github.com/canimus/cuallee/blob/fbef98f5340279fc726b369a7ce879fd67ea1d1f/logos/databricks.svg?raw=true "PySpark DataFrame API")| `pyspark` & `spark-connect` |`3.5.x`, `3.4.0`, `3.3.x`, `3.2.x`
3636
![bigquery](https://github.com/canimus/cuallee/blob/fbef98f5340279fc726b369a7ce879fd67ea1d1f/logos/bigquery.png?raw=true "BigQuery Client API")| `bigquery` | `3.4.1`
3737
![pandas](https://github.com/canimus/cuallee/blob/fbef98f5340279fc726b369a7ce879fd67ea1d1f/logos/pandas.svg?raw=true "Pandas DataFrame API")| `pandas`| `2.0.2`, `1.5.x`, `1.4.x`
38-
![duckdb](https://github.com/canimus/cuallee/blob/fbef98f5340279fc726b369a7ce879fd67ea1d1f/logos/duckdb.png?raw=true "DuckDB API")|`duckdb` | `1.0.0`, ~~`0.10.2`~~,~~`0.9.2`~~,~~`0.8.0`~~
39-
![polars](https://github.com/canimus/cuallee/blob/fbef98f5340279fc726b369a7ce879fd67ea1d1f/logos/polars.svg?raw=true "Polars API")|`polars`| `1.0.0`, ~~`0.19.6`~~
38+
![duckdb](https://github.com/canimus/cuallee/blob/fbef98f5340279fc726b369a7ce879fd67ea1d1f/logos/duckdb.png?raw=true "DuckDB API")|`duckdb` | `1.4.0`,~~`1.0.0`~~, ~~`0.10.2`~~,~~`0.9.2`~~,~~`0.8.0`~~
39+
![polars](https://github.com/canimus/cuallee/blob/fbef98f5340279fc726b369a7ce879fd67ea1d1f/logos/polars.svg?raw=true "Polars API")|`polars`| `1.34.0`, ~~`1.0.0`~~, ~~`0.19.6`~~
4040
![daft](https://github.com/canimus/cuallee/blob/fbef98f5340279fc726b369a7ce879fd67ea1d1f/logos/daft.png?raw=true "Daft API")|`daft`| `0.2.24`, ~~`0.2.19`~~
4141

4242
<sub>Logos are trademarks of their own brands.</sub>

cuallee/polars_validation.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ def is_unique(self, rule: Rule, dataframe: pl.DataFrame) -> Union[bool, int]:
7575
def are_unique(self, rule: Rule, dataframe: pl.DataFrame) -> Union[bool, int]:
7676
"""Validate absence of duplicate in group of columns"""
7777
return Compute._result(
78-
dataframe.select(
79-
[pl.col(c).is_unique().cast(pl.Int8).sum() for c in rule.column]
80-
).sum_horizontal()
81-
/ len(rule.column)
78+
dataframe.select(pl.struct(*rule.column).is_unique().cast(pl.Int8)).sum()
8279
)
8380

8481
def is_greater_than(self, rule: Rule, dataframe: pl.DataFrame) -> Union[bool, int]:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "cuallee"
7-
version = "0.15.2"
7+
version = "0.15.3"
88

99
authors = [
1010
{ name="Herminio Vazquez", email="canimus@gmail.com"},

0 commit comments

Comments
 (0)