From 4835cde02182732d0dd9cfd0606dc7a031be9aa0 Mon Sep 17 00:00:00 2001 From: Bing Li Date: Mon, 5 Aug 2024 10:26:19 -0700 Subject: [PATCH] move session parameter test to non Sproc suite --- .../DataFrameNonStoredProcSuite.scala | 22 +++++++++++++++++-- .../snowpark_test/UpdatableSuite.scala | 9 -------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/test/scala/com/snowflake/snowpark_test/DataFrameNonStoredProcSuite.scala b/src/test/scala/com/snowflake/snowpark_test/DataFrameNonStoredProcSuite.scala index 66a34b0b..47f50fd8 100644 --- a/src/test/scala/com/snowflake/snowpark_test/DataFrameNonStoredProcSuite.scala +++ b/src/test/scala/com/snowflake/snowpark_test/DataFrameNonStoredProcSuite.scala @@ -1,7 +1,7 @@ package com.snowflake.snowpark_test -import com.snowflake.snowpark.TestData -import com.snowflake.snowpark.functions.col +import com.snowflake.snowpark.{SaveMode, TestData, UpdateResult} +import com.snowflake.snowpark.functions.{col, lit} class DataFrameNonStoredProcSuite extends TestData { @@ -82,4 +82,22 @@ class DataFrameNonStoredProcSuite extends TestData { "enable", skipIfParamNotExist = true) } + + test("ERROR_ON_NONDETERMINISTIC_UPDATE = true") { + val tableName: String = randomName() + createTable(tableName, "num int") + try { + runQuery(s"insert into $tableName values(1),(2),(3)", session) + withSessionParameters(Seq(("ERROR_ON_NONDETERMINISTIC_UPDATE", "true")), session) { + testData2.write.mode(SaveMode.Overwrite).saveAsTable(tableName) + val updatable = session.table(tableName) + testData2.write.mode(SaveMode.Overwrite).saveAsTable(tableName) + assert( + updatable.update(Map(col("a") -> lit(1), col("b") -> lit(0))) == UpdateResult(6, 0)) + } + } finally { + dropTable(tableName) + } + + } } diff --git a/src/test/scala/com/snowflake/snowpark_test/UpdatableSuite.scala b/src/test/scala/com/snowflake/snowpark_test/UpdatableSuite.scala index 302f366a..b4eeb038 100644 --- a/src/test/scala/com/snowflake/snowpark_test/UpdatableSuite.scala +++ b/src/test/scala/com/snowflake/snowpark_test/UpdatableSuite.scala @@ -388,14 +388,5 @@ class UpdatableSuite extends TestData { dropTable(tableName) } } - - test("ERROR_ON_NONDETERMINISTIC_UPDATE = true") { - withSessionParameters(Seq(("ERROR_ON_NONDETERMINISTIC_UPDATE", "true")), session) { - testData2.write.mode(SaveMode.Overwrite).saveAsTable(tableName) - val updatable = session.table(tableName) - testData2.write.mode(SaveMode.Overwrite).saveAsTable(tableName) - assert(updatable.update(Map(col("a") -> lit(1), col("b") -> lit(0))) == UpdateResult(6, 0)) - } - } }