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

Issues when creating percentage validity checks #1183

Closed
vijaykiran opened this issue Mar 28, 2022 · 1 comment
Closed

Issues when creating percentage validity checks #1183

vijaykiran opened this issue Mar 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@vijaykiran
Copy link
Contributor

This check fails:

checks for retail_orders:
   - invalid_count(discount) < 1:
       valid format:  positive percentage

With this exception:

(.venv) $soda scan -V -d aws_postgres_retail orders.yml
Soda Core 0.0.1
Reading configuration file "/Users/albin/.soda/configuration.yml"
Reading SodaCL file "orders.yml"
Scan execution starts
Query aws_postgres_retail.retail_orders.aggregation[0]:
SELECT 
  COUNT(CASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? *(\d+([\.,]\d+)?|([\.,]\d+)) *% *$') THEN 1 END) 
FROM retail_orders
Query execution error in aws_postgres_retail.retail_orders.aggregation[0]: operator does not exist: double precision ~ unknown
LINE 2: ...ASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? ...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

SELECT 
  COUNT(CASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? *(\d+([\.,]\d+)?|([\.,]\d+)) *% *$') THEN 1 END) 
FROM retail_orders
  +-> operator does not exist: double precision ~ unknown
LINE 2: ...ASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? ...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

Metrics invalid_count were not computed for check invalid_count(discount) < 1
Scan summary:
1/1 query ERROR
  aws_postgres_retail.retail_orders.aggregation[0] [ERROR] 0:00:00.617506
SELECT 
  COUNT(CASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? *(\d+([\.,]\d+)?|([\.,]\d+)) *% *$') THEN 1 END) 
FROM retail_orders
    operator does not exist: double precision ~ unknown
    LINE 2: ...ASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? ...
                                                                 ^
    HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

1/1 check NOT EVALUATED: 
    retail_orders in aws_postgres_retail
      invalid_count(discount) < 1 [NOT EVALUATED]
        check_value: None
1 checks not evaluated.
2 errors.
Oops! 2 errors. 0 failures. 0 warnings. 0 pass.
ERRORS:
Query execution error in aws_postgres_retail.retail_orders.aggregation[0]: operator does not exist: double precision ~ unknown
LINE 2: ...ASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? ...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

SELECT 
  COUNT(CASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? *(\d+([\.,]\d+)?|([\.,]\d+)) *% *$') THEN 1 END) 
FROM retail_orders
  +-> operator does not exist: double precision ~ unknown
LINE 2: ...ASE WHEN NOT (discount IS NULL) AND NOT (discount ~ '^ *\+? ...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

Metrics invalid_count were not computed for check invalid_count(discount) < 1
(.venv) $

Screenshot 2022-03-14 at 11 40 20

@vijaykiran vijaykiran added the bug Something isn't working label Mar 28, 2022
@tombaeyens
Copy link
Contributor

@vijaykiran I suggest this is a won t fix. We can't really improve the error message as we don't know the schema. If a user specifies a format, then we assume it's a text column. So then the only thing we can do is run the query and that fails. Analysing the error message to deduct that this is a text mismatch seems too complex imo. Reopen if you have concrete ideas on how we could improve the error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants