-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-19148][SQL] do not expose the external table concept in Catalog #16528
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
|
||
package org.apache.spark.sql.catalog | ||
|
||
import scala.collection.JavaConverters._ | ||
|
||
import org.apache.spark.annotation.{Experimental, InterfaceStability} | ||
import org.apache.spark.sql.{AnalysisException, DataFrame, Dataset} | ||
import org.apache.spark.sql.types.StructType | ||
|
@@ -187,82 +189,169 @@ abstract class Catalog { | |
def functionExists(dbName: String, functionName: String): Boolean | ||
|
||
/** | ||
* :: Experimental :: | ||
* Creates an external table from the given path and returns the corresponding DataFrame. | ||
* Creates a table from the given path and returns the corresponding DataFrame. | ||
* It will use the default data source configured by spark.sql.sources.default. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@deprecated("use createTable instead.", "2.2.0") | ||
def createExternalTable(tableName: String, path: String): DataFrame = { | ||
createTable(tableName, path) | ||
} | ||
|
||
/** | ||
* :: Experimental :: | ||
* Creates a table from the given path and returns the corresponding DataFrame. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can explain here to say the data files will not be dropped when dropping the table? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we already documented this in programming guide. If we wanna explain the custom path here, there are a lot of similar places we need to add comments too. So I'd like to leave it as it was. |
||
* It will use the default data source configured by spark.sql.sources.default. | ||
* | ||
* @since 2.2.0 | ||
*/ | ||
@Experimental | ||
@InterfaceStability.Evolving | ||
def createExternalTable(tableName: String, path: String): DataFrame | ||
def createTable(tableName: String, path: String): DataFrame | ||
|
||
/** | ||
* :: Experimental :: | ||
* Creates an external table from the given path based on a data source | ||
* and returns the corresponding DataFrame. | ||
* Creates a table from the given path based on a data source and returns the corresponding | ||
* DataFrame. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@deprecated("use createTable instead.", "2.2.0") | ||
def createExternalTable(tableName: String, path: String, source: String): DataFrame = { | ||
createTable(tableName, path, source) | ||
} | ||
|
||
/** | ||
* :: Experimental :: | ||
* Creates a table from the given path based on a data source and returns the corresponding | ||
* DataFrame. | ||
* | ||
* @since 2.2.0 | ||
*/ | ||
@Experimental | ||
@InterfaceStability.Evolving | ||
def createExternalTable(tableName: String, path: String, source: String): DataFrame | ||
def createTable(tableName: String, path: String, source: String): DataFrame | ||
|
||
/** | ||
* :: Experimental :: | ||
* Creates an external table from the given path based on a data source and a set of options. | ||
* Creates a table from the given path based on a data source and a set of options. | ||
* Then, returns the corresponding DataFrame. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@deprecated("use createTable instead.", "2.2.0") | ||
def createExternalTable( | ||
tableName: String, | ||
source: String, | ||
options: java.util.Map[String, String]): DataFrame = { | ||
createTable(tableName, source, options) | ||
} | ||
|
||
/** | ||
* :: Experimental :: | ||
* Creates a table from the given path based on a data source and a set of options. | ||
* Then, returns the corresponding DataFrame. | ||
* | ||
* @since 2.2.0 | ||
*/ | ||
@Experimental | ||
@InterfaceStability.Evolving | ||
def createTable( | ||
tableName: String, | ||
source: String, | ||
options: java.util.Map[String, String]): DataFrame = { | ||
createTable(tableName, source, options.asScala.toMap) | ||
} | ||
|
||
/** | ||
* (Scala-specific) | ||
* Creates a table from the given path based on a data source and a set of options. | ||
* Then, returns the corresponding DataFrame. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@deprecated("use createTable instead.", "2.2.0") | ||
def createExternalTable( | ||
tableName: String, | ||
source: String, | ||
options: java.util.Map[String, String]): DataFrame | ||
options: Map[String, String]): DataFrame = { | ||
createTable(tableName, source, options) | ||
} | ||
|
||
/** | ||
* :: Experimental :: | ||
* (Scala-specific) | ||
* Creates an external table from the given path based on a data source and a set of options. | ||
* Creates a table from the given path based on a data source and a set of options. | ||
* Then, returns the corresponding DataFrame. | ||
* | ||
* @since 2.0.0 | ||
* @since 2.2.0 | ||
*/ | ||
@Experimental | ||
@InterfaceStability.Evolving | ||
def createExternalTable( | ||
def createTable( | ||
tableName: String, | ||
source: String, | ||
options: Map[String, String]): DataFrame | ||
|
||
/** | ||
* :: Experimental :: | ||
* Create an external table from the given path based on a data source, a schema and | ||
* a set of options. Then, returns the corresponding DataFrame. | ||
* Create a table from the given path based on a data source, a schema and a set of options. | ||
* Then, returns the corresponding DataFrame. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@deprecated("use createTable instead.", "2.2.0") | ||
def createExternalTable( | ||
tableName: String, | ||
source: String, | ||
schema: StructType, | ||
options: java.util.Map[String, String]): DataFrame = { | ||
createTable(tableName, source, schema, options) | ||
} | ||
|
||
/** | ||
* :: Experimental :: | ||
* Create a table from the given path based on a data source, a schema and a set of options. | ||
* Then, returns the corresponding DataFrame. | ||
* | ||
* @since 2.2.0 | ||
*/ | ||
@Experimental | ||
@InterfaceStability.Evolving | ||
def createTable( | ||
tableName: String, | ||
source: String, | ||
schema: StructType, | ||
options: java.util.Map[String, String]): DataFrame = { | ||
createTable(tableName, source, schema, options.asScala.toMap) | ||
} | ||
|
||
/** | ||
* (Scala-specific) | ||
* Create a table from the given path based on a data source, a schema and a set of options. | ||
* Then, returns the corresponding DataFrame. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@deprecated("use createTable instead.", "2.2.0") | ||
def createExternalTable( | ||
tableName: String, | ||
source: String, | ||
schema: StructType, | ||
options: java.util.Map[String, String]): DataFrame | ||
options: Map[String, String]): DataFrame = { | ||
createTable(tableName, source, schema, options) | ||
} | ||
|
||
/** | ||
* :: Experimental :: | ||
* (Scala-specific) | ||
* Create an external table from the given path based on a data source, a schema and | ||
* a set of options. Then, returns the corresponding DataFrame. | ||
* Create a table from the given path based on a data source, a schema and a set of options. | ||
* Then, returns the corresponding DataFrame. | ||
* | ||
* @since 2.0.0 | ||
* @since 2.2.0 | ||
*/ | ||
@Experimental | ||
@InterfaceStability.Evolving | ||
def createExternalTable( | ||
def createTable( | ||
tableName: String, | ||
source: String, | ||
schema: StructType, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor code cleanup, not related to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we revert this change?