awslabs / awslabs/python-deequ
Change message for isUnique method
- 主要言語
- Jupyter Notebook
- スター
- 826
- フォーク
- 158
- 平均マージ
- 9日 22時間
- マージ済み PR(30日)
- 3
説明
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
コントリビューションガイド
調査の方向性
Check.isUnique エントリーポイントから始め、VerificationSuite.run が VerificationResult.checkResultsAsDataFrame の結果を生成する流れを追跡してください。gtv と id の例を再現し、その後 constraint_message がどこで形成されるかを特定してください。完了条件は、失敗した一意性の結果が、単に 0.0 を報告するのではなく、どの値または列が失敗の原因となったのかを説明することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data-engineering
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 52/100