Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/4885#discussion_r26504850
--- Diff:
sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suites.scala
---
@@ -195,6 +195,146 @@ class HiveThriftBinaryServerSuite extends
HiveThriftJdbcTest {
}
}
}
+
+ test("test multiple session") {
+ import org.apache.spark.sql.SQLConf
+ var defaultV1: String = null
+ var defaultV2: String = null
+
+ withMultipleConnectionJdbcStatement(
+ // create table
+ { statement =>
+
+ val queries = Seq(
+ "DROP TABLE IF EXISTS test_map",
+ "CREATE TABLE test_map(key INT, value STRING)",
+ s"LOAD DATA LOCAL INPATH '${TestData.smallKv}' OVERWRITE INTO
TABLE test_map",
+ "CACHE TABLE test_table AS SELECT key FROM test_map ORDER BY
key DESC")
+
+ queries.foreach(statement.execute)
+
+ val rs1 = statement.executeQuery("SELECT key FROM test_table ORDER
BY KEY DESC")
+ val buf1 = new collection.mutable.ArrayBuffer[Int]()
+ while (rs1.next()) {
+ buf1 += rs1.getInt(1)
+ }
+ rs1.close()
+
+ val rs2 = statement.executeQuery("SELECT key FROM test_map ORDER
BY KEY DESC")
+ val buf2 = new collection.mutable.ArrayBuffer[Int]()
+ while (rs2.next()) {
+ buf2 += rs2.getInt(1)
+ }
+ rs2.close()
+
+ assert(buf1 === buf2)
+ },
+
+ // first session, we get the default value of the session status
+ { statement =>
+
+ val rs1 = statement.executeQuery(s"SET
${SQLConf.SHUFFLE_PARTITIONS}")
+ rs1.next()
+ defaultV1 = rs1.getString(1)
+ assert(defaultV1 != "200")
--- End diff --
Would be nice to add comment to indicate that the expected value should be
`"<undefined>"`. I was quite confused at first as 200 should be the default
value of "spark.sql.shuffle.partitions" :)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]