Skip to content

Commit

Permalink
Update functions.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-sjayabalan committed Aug 2, 2024
1 parent 84fd6f3 commit cc26ac1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/com/snowflake/snowpark/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
/**
Expand All @@ -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.
Expand Down

0 comments on commit cc26ac1

Please sign in to comment.