Skip to content

Commit 4db63fd

Browse files
dongjoon-hyunrxin
authored andcommitted
[SPARK-16383][SQL] Remove SessionState.executeSql
## What changes were proposed in this pull request? This PR removes `SessionState.executeSql` in favor of `SparkSession.sql`. We can remove this safely since the visibility `SessionState` is `private[sql]` and `executeSql` is only used in one **ignored** test, `test("Multiple Hive Instances")`. ## How was this patch tested? Pass the Jenkins tests. Author: Dongjoon Hyun <dongjoon@apache.org> Closes apache#14055 from dongjoon-hyun/SPARK-16383.
1 parent 1f0d021 commit 4db63fd

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

sql/core/src/main/scala/org/apache/spark/sql/internal/SessionState.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import org.apache.hadoop.fs.Path
2424

2525
import org.apache.spark.sql._
2626
import org.apache.spark.sql.catalyst.analysis.{Analyzer, FunctionRegistry}
27-
import org.apache.spark.sql.catalyst.catalog.{ArchiveResource, _}
27+
import org.apache.spark.sql.catalyst.catalog._
2828
import org.apache.spark.sql.catalyst.optimizer.Optimizer
2929
import org.apache.spark.sql.catalyst.parser.ParserInterface
3030
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
@@ -162,8 +162,6 @@ private[sql] class SessionState(sparkSession: SparkSession) {
162162
// Helper methods, partially leftover from pre-2.0 days
163163
// ------------------------------------------------------
164164

165-
def executeSql(sql: String): QueryExecution = executePlan(sqlParser.parsePlan(sql))
166-
167165
def executePlan(plan: LogicalPlan): QueryExecution = new QueryExecution(sparkSession, plan)
168166

169167
def refreshTable(tableName: String): Unit = {

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/ConcurrentHiveSuite.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class ConcurrentHiveSuite extends SparkFunSuite with BeforeAndAfterAll {
3030
conf.set("spark.ui.enabled", "false")
3131
val ts =
3232
new TestHiveContext(new SparkContext("local", s"TestSQLContext$i", conf))
33-
ts.sessionState.executeSql("SHOW TABLES").toRdd.collect()
34-
ts.sessionState.executeSql("SELECT * FROM src").toRdd.collect()
35-
ts.sessionState.executeSql("SHOW TABLES").toRdd.collect()
33+
ts.sparkSession.sql("SHOW TABLES").collect()
34+
ts.sparkSession.sql("SELECT * FROM src").collect()
35+
ts.sparkSession.sql("SHOW TABLES").collect()
3636
}
3737
}
3838
}

0 commit comments

Comments
 (0)