Github user chenghao-intel commented on a diff in the pull request:
https://github.com/apache/spark/pull/6143#discussion_r30308534
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala ---
@@ -1193,12 +1193,18 @@ class DataFrame private[sql](
def javaRDD: JavaRDD[Row] = toJavaRDD
/**
- * Registers this [[DataFrame]] as a temporary table using the given
name. The lifetime of this
- * temporary table is tied to the [[SQLContext]] that was used to create
this DataFrame.
- *
+ * Check if the table name already exists
+ * Registers this [[DataFrame]] as a temporary table using the given
name if
+ * no such table name present else throw an exception
+ * The lifetime of this temporary table is tied to
+ * the [[SQLContext]] that was used to create this DataFrame.
+ *
* @group basic
*/
def registerTempTable(tableName: String): Unit = {
+ if( sqlContext.catalog.tableExists(Seq(tableName)) ){
--- End diff --
Nit: space after `if`, and no space after `(` or before `)`.
Says:
```scala
if (sqlContext.catalog.tableExists(Seq(tableName))) {
```
---
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]