xupefei commented on code in PR #48958: URL: https://github.com/apache/spark/pull/48958#discussion_r1867520880
########## sql/api/src/main/scala/org/apache/spark/sql/api/SQLContext.scala: ########## @@ -0,0 +1,996 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.api + +import scala.collection.immutable +import scala.reflect.runtime.universe.TypeTag + +import _root_.java.util.{List => JavaList, Map => JavaMap, Properties} + +import org.apache.spark.SparkContext +import org.apache.spark.annotation.{DeveloperApi, Experimental, Stable, Unstable} +import org.apache.spark.api.java.JavaRDD +import org.apache.spark.internal.Logging +import org.apache.spark.rdd.RDD +import org.apache.spark.sql.{Encoder, ExperimentalMethods, Row} +import org.apache.spark.sql.api.SQLImplicits +import org.apache.spark.sql.sources.BaseRelation +import org.apache.spark.sql.types._ +import org.apache.spark.sql.util.ExecutionListenerManager + +/** + * The entry point for working with structured data (rows and columns) in Spark 1.x. + * + * As of Spark 2.0, this is replaced by [[SparkSession]]. However, we are keeping the class here + * for backward compatibility. + * + * @groupname basic Basic Operations + * @groupname ddl_ops Persistent Catalog DDL + * @groupname cachemgmt Cached Table Management + * @groupname genericdata Generic Data Sources + * @groupname specificdata Specific Data Sources + * @groupname config Configuration + * @groupname dataframes Custom DataFrame Creation + * @groupname dataset Custom Dataset Creation + * @groupname Ungrouped Support functions for language integrated queries + * @since 1.0.0 + */ +@Stable +abstract class SQLContext private[sql] (val sparkSession: SparkSession) + extends Logging + with Serializable { + + // Note: Since Spark 2.0 this class has become a wrapper of SparkSession, where the + // real functionality resides. This class remains mainly for backward compatibility. + + def sparkContext: SparkContext = sparkSession.sparkContext + + /** + * Returns a [[SQLContext]] as new session, with separated SQL configurations, temporary tables, + * registered functions, but sharing the same `SparkContext`, cached data and other things. + * + * @since 1.6.0 + */ + def newSession(): SQLContext + + /** + * An interface to register custom QueryExecutionListener that listen for execution metrics. + */ + def listenerManager: ExecutionListenerManager Review Comment: Agree, do we have tickets for them? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
