Skip to content

Commit

Permalink
SNOW-1599877 Move Session Parameter Related Tests to Non Sproc Suite (#…
Browse files Browse the repository at this point in the history
…134)

move session parameter test to non Sproc suite
  • Loading branch information
sfc-gh-bli authored Aug 5, 2024
1 parent 501da08 commit 5256e71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}

0 comments on commit 5256e71

Please sign in to comment.