From 6a98df2823a42bc9eb23d86e502fa80abdec67e0 Mon Sep 17 00:00:00 2001 From: May Liu Date: Fri, 2 Oct 2026 23:39:39 +0000 Subject: [PATCH] fix undeterministic row ordering --- src/snowflake/snowpark/functions.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/snowflake/snowpark/functions.py b/src/snowflake/snowpark/functions.py index 9f35db90f9..a64fcfec6f 100644 --- a/src/snowflake/snowpark/functions.py +++ b/src/snowflake/snowpark/functions.py @@ -13062,7 +13062,7 @@ def ai_extract( ... col("text"), ... ai_extract(col("text"), [['name', 'What is the first name?'], ['city', 'What city do they work in?']]).alias("info") ... ) - >>> extracted_df.show() + >>> extracted_df.sort(col("text")).show() ------------------------------------------------------------ |"TEXT" |"INFO" | ------------------------------------------------------------ @@ -13261,7 +13261,7 @@ def ai_filter( ... ai_filter(prompt("Is {0} in Europe?", col("country"))).as_("europe"), ... ai_filter(prompt("Is {0} in North America?", col("country"))).as_("north_america"), ... ai_filter(prompt("Is {0} in Central America?", col("country"))).as_("central_america"), - ... ).show() + ... ).sort("asia").show() ----------------------------------------------------------- |"ASIA" |"EUROPE" |"NORTH_AMERICA" |"CENTRAL_AMERICA" | ----------------------------------------------------------- @@ -14279,11 +14279,11 @@ def ai_sentiment( ... ["The food was delicious but the service was slow."], ... ["The movie was great, but the acting was terrible."] ... ], schema=["review"]) - >>> df.select("review", ai_sentiment(col("review"), ['plot', 'visual effects', 'acting']).alias("sentiment")).show() + >>> df.select("review", ai_sentiment(col("review"), ['plot', 'visual effects', 'acting']).alias("sentiment")).sort("review").show() ---------------------------------------------------------------------------------------- |"REVIEW" |"SENTIMENT" | ---------------------------------------------------------------------------------------- - |The movie had amazing visual effects but the pl... |{ | + |The food was delicious but the service was slow. |{ | | | "categories": [ | | | { | | | "name": "overall", | @@ -14291,19 +14291,19 @@ def ai_sentiment( | | }, | | | { | | | "name": "acting", | - | | "sentiment": "neutral" | + | | "sentiment": "unknown" | | | }, | | | { | | | "name": "plot", | - | | "sentiment": "negative" | + | | "sentiment": "unknown" | | | }, | | | { | | | "name": "visual effects", | - | | "sentiment": "positive" | + | | "sentiment": "unknown" | | | } | | | ] | | |} | - |The food was delicious but the service was slow. |{ | + |The movie had amazing visual effects but the pl... |{ | | | "categories": [ | | | { | | | "name": "overall", | @@ -14311,15 +14311,15 @@ def ai_sentiment( | | }, | | | { | | | "name": "acting", | - | | "sentiment": "unknown" | + | | "sentiment": "neutral" | | | }, | | | { | | | "name": "plot", | - | | "sentiment": "unknown" | + | | "sentiment": "negative" | | | }, | | | { | | | "name": "visual effects", | - | | "sentiment": "unknown" | + | | "sentiment": "positive" | | | } | | | ] | | |} |