Skip to content

Commit

Permalink
Update functions.scala
Browse files Browse the repository at this point in the history
Modified styling
  • Loading branch information
sfc-gh-sjayabalan committed Jul 31, 2024
1 parent 6b37cc5 commit 805c1cc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/scala/com/snowflake/snowpark/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3152,7 +3152,8 @@ object functions {
* <pre>
* df = session.createDataFrame(Seq(("CR", "{\"id\": 5, \"name\": \"Jose\", \"age\": 29}"))).toDF(Seq("nationality", "json_string"))
* </pre>
* When the result of this function is the only part of the select statement, no changes are needed:
* When the result of this function is the only part of
* the select statement, no changes are needed:
* <pre>
* df.select(json_tuple(col("json_string"), "id", "name", "age")).show()
* </pre>
Expand Down Expand Up @@ -3215,8 +3216,10 @@ object functions {
/**
* This function converts a JSON string to a variant in Snowflake.
*
* In Snowflake the values are converted automatically, however they're converted as variants, meaning that the printSchema function would return different datatypes.
* To convert the datatype and it to be printed as the expected datatype, it should be read on the selectExpr function as "json['relative']['age']::integer".
* In Snowflake the values are converted automatically, however they're converted as variants,
* meaning that the printSchema function would return different datatypes.
* To convert the datatype and it to be printed as the expected datatype,
* it should be read on the selectExpr function as "json['relative']['age']::integer".
* <pre>
* val data_for_json = Seq(
* (1, "{\"id\": 172319, \"age\": 41, \"relative\": {\"id\": 885471, \"age\": 29}}"),
Expand Down

0 comments on commit 805c1cc

Please sign in to comment.