awslabs / awslabs/python-deequ
Change message for isUnique method
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 826
- Forks
- 158
- Ø Merge
- 9 T. 22 Std.
- Gemergte PRs (30 T.)
- 3
Beschreibung
For the past day I have been using the Check methods and I have found that isUnique method when using strings is not clear when returning the message of error.
```python
from pydeequ.checks import *
from pydeequ.verification import *
import pydeequ
from pyspark.sql.types import DateType, FloatType, StringType, StructField, StructType, BooleanType
import datetime
from pyspark.sql import SparkSession, Row
from pyspark.sql import DataFrame as SparkDataFrame
from typing import Dict, List
import time
mock_orders =[
{
"date": datetime.date(2019, 12, 28),
"country_code": "FR",
"concept_id": "c73bcdcc-2669-4bf6-81d3-e4ae73fb11fd",
"id": "bar",
"gtv": 27.0,
},
{
"date": datetime.date(2019, 12, 20),
"country_code": "UK",
"concept_id": "123e4567-e89b-12d3-a456-426655440000",
"id": "bar",
"gtv": 27.0,
},
]
orders_reference_mock = spark.createDataFrame(data = mock_orders)
check = Check(spark, CheckLevel.Warning, "Review Check")
checkResult = (VerificationSuite(spark)
.onData(orders_reference_mock)
.addCheck(
check
.isUnique("gtv")
.isUnique("id")
)
.run())
checkResult_df = VerificationResult.checkResultsAsDataFrame(spark, checkResult)
checkResult_df.collect()
```
The results is:
```shell
[Row(check='Review Check', check_level='Warning', check_status='Warning', constraint='UniquenessConstraint(Uniqueness(List(gtv),None))', constraint_status='Failure', constraint_message='Value: 0.0 does not meet the constraint requirement!'),
Row(check='Review Check', check_level='Warning', check_status='Warning', constraint='UniquenessConstraint(Uniqueness(List(id),None))', constraint_status='Failure', constraint_message='Value: 0.0 does not meet the constraint requirement!')]
```
The `constraint_message` is not clear and doesn't give any information. It happens in both cases if it is string or integer.
Is it possible to have a more clear message please? I am putting this as a feature instead of a bug
Beitragsleitfaden
Rechercherichtung
Beginnen Sie mit dem Check.isUnique-Einstiegspunkt und verfolgen Sie, wie VerificationSuite.run Ergebnisse für VerificationResult.checkResultsAsDataFrame erzeugt. Reproduzieren Sie die gtv- und id-Beispiele und ermitteln Sie anschließend, wo constraint_message gebildet wird. Als erledigt gilt die Aufgabe, wenn fehlgeschlagene Eindeutigkeitsergebnisse erklären, welcher Wert oder welche Spalte den Fehler verursacht hat, statt nur 0.0 zu melden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data-engineering
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 52/100