diff options
author | Sean Zhong <seanzhong@databricks.com> | 2016-05-12 15:51:53 +0800 |
---|---|---|
committer | Cheng Lian <lian@databricks.com> | 2016-05-12 15:51:53 +0800 |
commit | 33c6eb5218ce3c31cc9f632a67fd2c7057569683 (patch) | |
tree | b8c84c24107bf1ece596450ef3a3eec26df1f21d /mllib/src/main | |
parent | 5207a005cc86618907b8f467abc03eacef485ecd (diff) | |
download | spark-33c6eb5218ce3c31cc9f632a67fd2c7057569683.tar.gz spark-33c6eb5218ce3c31cc9f632a67fd2c7057569683.tar.bz2 spark-33c6eb5218ce3c31cc9f632a67fd2c7057569683.zip |
[SPARK-15171][SQL] Deprecate registerTempTable and add dataset.createTempView
## What changes were proposed in this pull request?
Deprecates registerTempTable and add dataset.createTempView, dataset.createOrReplaceTempView.
## How was this patch tested?
Unit tests.
Author: Sean Zhong <seanzhong@databricks.com>
Closes #12945 from clockfly/spark-15171.
Diffstat (limited to 'mllib/src/main')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/ml/feature/SQLTransformer.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/feature/SQLTransformer.scala b/mllib/src/main/scala/org/apache/spark/ml/feature/SQLTransformer.scala index 400435d7a9..2d4cac6dc4 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/feature/SQLTransformer.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/feature/SQLTransformer.scala @@ -48,6 +48,7 @@ class SQLTransformer @Since("1.6.0") (override val uid: String) extends Transfor /** * SQL statement parameter. The statement is provided in string form. + * * @group param */ @Since("1.6.0") @@ -66,7 +67,7 @@ class SQLTransformer @Since("1.6.0") (override val uid: String) extends Transfor @Since("2.0.0") override def transform(dataset: Dataset[_]): DataFrame = { val tableName = Identifiable.randomUID(uid) - dataset.registerTempTable(tableName) + dataset.createOrReplaceTempView(tableName) val realStatement = $(statement).replace(tableIdentifier, tableName) dataset.sparkSession.sql(realStatement) } @@ -79,7 +80,7 @@ class SQLTransformer @Since("1.6.0") (override val uid: String) extends Transfor val dummyDF = sqlContext.createDataFrame(dummyRDD, schema) val tableName = Identifiable.randomUID(uid) val realStatement = $(statement).replace(tableIdentifier, tableName) - dummyDF.registerTempTable(tableName) + dummyDF.createOrReplaceTempView(tableName) val outputSchema = sqlContext.sql(realStatement).schema sqlContext.dropTempTable(tableName) outputSchema |