From cc26ac14967b42f4338b9ee676e4ce0d67cff0a1 Mon Sep 17 00:00:00 2001 From: Shyamala Jayabalan Date: Fri, 2 Aug 2024 17:48:08 -0400 Subject: [PATCH] Update functions.scala --- src/main/scala/com/snowflake/snowpark/functions.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/snowflake/snowpark/functions.scala b/src/main/scala/com/snowflake/snowpark/functions.scala index dfc3a155..f3c88753 100644 --- a/src/main/scala/com/snowflake/snowpark/functions.scala +++ b/src/main/scala/com/snowflake/snowpark/functions.scala @@ -3270,7 +3270,7 @@ object functions { * when the conversion can not be performed. * The column argument must be a string column in Snowflake. */ - def try_cast(e : Column,targetType: DataType): Column = { + def try_cast(e : Column,targetType: String): Column = { try_cast(e,targetType()) } /** @@ -3286,7 +3286,7 @@ object functions { * @return Column object. */ def date_sub(start: Column, days: Int): Column = { - dateadd(start, lit(days * -1), try_cast(start,DateType())) + dateadd("DAY", lit(days * -1), sqlExpr(s"try_cast(${start.getName.get} :: STRING as DATE)")) } /** * Invokes a built-in snowflake function with the specified name and arguments.