From 6a15890bb4197763dfbc233fc2c5870c9975b804 Mon Sep 17 00:00:00 2001 From: Sagar Moghe <16164018+SagarMoghe@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:49:24 -0400 Subject: [PATCH] Update Check.scala existing isNonNegative and isPositive function does not work well with columns that have white space in between, and results in breaking of other constraints as well. I added extra quotes around the column name so columns with white space in the name does not break the final generated query. --- src/main/scala/com/amazon/deequ/checks/Check.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/amazon/deequ/checks/Check.scala b/src/main/scala/com/amazon/deequ/checks/Check.scala index 1e104892..0abf0325 100644 --- a/src/main/scala/com/amazon/deequ/checks/Check.scala +++ b/src/main/scala/com/amazon/deequ/checks/Check.scala @@ -990,7 +990,7 @@ case class Check( satisfies( // coalescing column to not count NULL values as non-compliant // NOTE: cast to DECIMAL(20, 10) is needed to handle scientific notations - s"COALESCE(CAST($column AS DECIMAL(20,10)), 0.0) >= 0", + s"COALESCE(CAST('$column' AS DECIMAL(20,10)), 0.0) >= 0", s"$column is non-negative", assertion, hint = hint, @@ -1014,7 +1014,7 @@ case class Check( // coalescing column to not count NULL values as non-compliant // NOTE: cast to DECIMAL(20, 10) is needed to handle scientific notations satisfies( - s"COALESCE(CAST($column AS DECIMAL(20,10)), 1.0) > 0", + s"COALESCE(CAST('$column' AS DECIMAL(20,10)), 1.0) > 0", s"$column is positive", assertion, hint,