Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Allow for failures to be a float instead of integer #4334

Closed
1 task done
rahulbaid opened this issue Nov 24, 2021 · 3 comments
Closed
1 task done

[Feature] Allow for failures to be a float instead of integer #4334

rahulbaid opened this issue Nov 24, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@rahulbaid
Copy link

rahulbaid commented Nov 24, 2021

Is there an existing feature request for this?

  • I have searched the existing issues

Describe the Feature

In a test config , we can assign custom failure calculation with fail_calc. Suppose, with the custom failure calculation, we want to identify the number of records that have failed the test, we can just set fail_calc: count(*), which is the default behaviour. Now instead of the number, we want the proportion of records that have failed, with a similar logic we can set fail_calc: count(*) / (select count(*) as total_records from dataset_name`.`table_name`). But doing so, results in a error:

0.00125 is not of type 'integer'

Failed validating 'type' in schema['properties']['failures']:
    {'type': 'integer'}

On instance['failures']:
    0.00125

A user should have an option to return failures of type float instead of the type integer constraint.

Workaround: convert float to integer by modifying it to a percentage.

@rahulbaid rahulbaid added enhancement New feature or request triage labels Nov 24, 2021
@ChenyuLInx
Copy link
Contributor

Hey @rahulbaid, thanks for submitting this! We believe in having the failure be the count of failed records hence the int constrain. To make sure I understand your purpose correctly, you would want the test to warn/fail if a certain percentage of records doesn't meet requirements right? There's an improvement we want to add that looks like this

models:
  - name: my_view
    columns:
      - name: id
        tests:
          - unique:
              config:
                warn_if: "> 10%"
                fail_if: "> 20%"

which would be able to config warning/failure based on percentage but still keep the same failures as int. This is not implemented yet but I am wondering will this feature resolve your issue?

Also, this is the code where that int constrain is being defined.

@ChenyuLInx
Copy link
Contributor

Opened new issue to track this and closing current one

@eilone
Copy link

eilone commented Feb 6, 2024

I wonder what's up with that. still impossible to test on floats?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants