forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-50102][SQL][CONNECT] Add shims need for missing public SQL met…
…hods ### What changes were proposed in this pull request? This PR makes the following changes: - It adds shims for a couple of a number of classes exposed in the (classic) SQL interface: `BaseRelation` , `ExperimentalMethods`, `ExecutionListenerManager`, `SharedState`, `SessionState`, `SparkConf`, `SparkSessionExtensions`, `QueryExecution`, and `SQLContext`. - It adds all public methods involving these classes. For classic they will just work like before. For connect they will throw `SparkUnsupportedOperationExceptions` when used. - It reduces the visibility of a couple of classes added recently: `DataSourceRegistration`, and `UDTFRegistration`. - I have also reorganized all the shims into a single class. Please note that this is by no means reflects the final state: - We intent to support `SQLContext`. - We intent to support 'SparkSession.executeCommand`. - We are thinking about removing `ExperimentalMethods`, `SharedState`, `SessionState` from the public interface. - For `QueryExecution`, and `ExecutionListenerManager` we are considering adding a plan representation similar that is not tied to Catalyst. ### Why are the changes needed? We are creating a shared Scala (JVM) SQL interface for both Classic and Connect. ### Does this PR introduce _any_ user-facing change? It adds unusable public methods to the connect interface. ### How was this patch tested? I have added tests that checks if the connect client throws the proper exceptions. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#48687 from hvanhovell/SPARK-50102. Authored-by: Herman van Hovell <herman@databricks.com> Signed-off-by: Herman van Hovell <herman@databricks.com>
- Loading branch information
1 parent
e490dd7
commit 655061a
Showing
19 changed files
with
473 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...ient/jvm/src/main/scala/org/apache/spark/sql/connect/ConnectClientUnsupportedErrors.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* 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.connect | ||
|
||
import org.apache.spark.SparkUnsupportedOperationException | ||
|
||
private[sql] object ConnectClientUnsupportedErrors { | ||
|
||
private def unsupportedFeatureException( | ||
subclass: String): SparkUnsupportedOperationException = { | ||
new SparkUnsupportedOperationException( | ||
"UNSUPPORTED_CONNECT_FEATURE." + subclass, | ||
Map.empty[String, String]) | ||
} | ||
|
||
def rdd(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("RDD") | ||
|
||
def queryExecution(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("DATASET_QUERY_EXECUTION") | ||
|
||
def executeCommand(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("SESSION_EXECUTE_COMMAND") | ||
|
||
def baseRelationToDataFrame(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("SESSION_BASE_RELATION_TO_DATAFRAME") | ||
|
||
def experimental(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("SESSION_EXPERIMENTAL_METHODS") | ||
|
||
def listenerManager(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("SESSION_LISTENER_MANAGER") | ||
|
||
def sessionState(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("SESSION_SESSION_STATE") | ||
|
||
def sharedState(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("SESSION_SHARED_STATE") | ||
|
||
def sparkContext(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("SESSION_SPARK_CONTEXT") | ||
|
||
def sqlContext(): SparkUnsupportedOperationException = | ||
unsupportedFeatureException("SESSION_SQL_CONTEXT") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.