Skip to content

Commit 831a04f

Browse files
dongjoon-hyunrxin
authored andcommitted
[SPARK-16267][TEST] Replace deprecated CREATE TEMPORARY TABLE ... USING from testsuites.
## What changes were proposed in this pull request? After SPARK-15674, `DDLStrategy` prints out the following deprecation messages in the testsuites. ``` 12:10:53.284 WARN org.apache.spark.sql.execution.SparkStrategies$DDLStrategy: CREATE TEMPORARY TABLE normal_orc_source USING... is deprecated, please use CREATE TEMPORARY VIEW viewName USING... instead ``` Total : 40 - JDBCWriteSuite: 14 - DDLSuite: 6 - TableScanSuite: 6 - ParquetSourceSuite: 5 - OrcSourceSuite: 2 - SQLQuerySuite: 2 - HiveCommandSuite: 2 - JsonSuite: 1 - PrunedScanSuite: 1 - FilteredScanSuite 1 This PR replaces `CREATE TEMPORARY TABLE` with `CREATE TEMPORARY VIEW` in order to remove the deprecation messages in the above testsuites except `DDLSuite`, `SQLQuerySuite`, `HiveCommandSuite`. The Jenkins results shows only remaining 10 messages. https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61422/consoleFull ## How was this patch tested? This is a testsuite-only change. Author: Dongjoon Hyun <dongjoon@apache.org> Closes #13956 from dongjoon-hyun/SPARK-16267.
1 parent d063898 commit 831a04f

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData {
847847

848848
sql(
849849
s"""
850-
|CREATE TEMPORARY TABLE jsonTableSQL
850+
|CREATE TEMPORARY VIEW jsonTableSQL
851851
|USING org.apache.spark.sql.json
852852
|OPTIONS (
853853
| path '$path'

sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCWriteSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ class JDBCWriteSuite extends SharedSQLContext with BeforeAndAfter {
5757

5858
sql(
5959
s"""
60-
|CREATE TEMPORARY TABLE PEOPLE
60+
|CREATE OR REPLACE TEMPORARY VIEW PEOPLE
6161
|USING org.apache.spark.sql.jdbc
6262
|OPTIONS (url '$url1', dbtable 'TEST.PEOPLE', user 'testUser', password 'testPass')
6363
""".stripMargin.replaceAll("\n", " "))
6464

6565
sql(
6666
s"""
67-
|CREATE TEMPORARY TABLE PEOPLE1
67+
|CREATE OR REPLACE TEMPORARY VIEW PEOPLE1
6868
|USING org.apache.spark.sql.jdbc
6969
|OPTIONS (url '$url1', dbtable 'TEST.PEOPLE1', user 'testUser', password 'testPass')
7070
""".stripMargin.replaceAll("\n", " "))

sql/core/src/test/scala/org/apache/spark/sql/sources/FilteredScanSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class FilteredScanSuite extends DataSourceTest with SharedSQLContext with Predic
139139
super.beforeAll()
140140
sql(
141141
"""
142-
|CREATE TEMPORARY TABLE oneToTenFiltered
142+
|CREATE TEMPORARY VIEW oneToTenFiltered
143143
|USING org.apache.spark.sql.sources.FilteredScanSource
144144
|OPTIONS (
145145
| from '1',

sql/core/src/test/scala/org/apache/spark/sql/sources/PrunedScanSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class PrunedScanSuite extends DataSourceTest with SharedSQLContext {
6262
super.beforeAll()
6363
sql(
6464
"""
65-
|CREATE TEMPORARY TABLE oneToTenPruned
65+
|CREATE TEMPORARY VIEW oneToTenPruned
6666
|USING org.apache.spark.sql.sources.PrunedScanSource
6767
|OPTIONS (
6868
| from '1',

sql/core/src/test/scala/org/apache/spark/sql/sources/TableScanSuite.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class TableScanSuite extends DataSourceTest with SharedSQLContext {
137137
super.beforeAll()
138138
sql(
139139
"""
140-
|CREATE TEMPORARY TABLE oneToTen
140+
|CREATE TEMPORARY VIEW oneToTen
141141
|USING org.apache.spark.sql.sources.SimpleScanSource
142142
|OPTIONS (
143143
| From '1',
@@ -149,7 +149,7 @@ class TableScanSuite extends DataSourceTest with SharedSQLContext {
149149

150150
sql(
151151
"""
152-
|CREATE TEMPORARY TABLE tableWithSchema (
152+
|CREATE TEMPORARY VIEW tableWithSchema (
153153
|`string$%Field` stRIng,
154154
|binaryField binary,
155155
|`booleanField` boolean,
@@ -332,7 +332,7 @@ class TableScanSuite extends DataSourceTest with SharedSQLContext {
332332
test("defaultSource") {
333333
sql(
334334
"""
335-
|CREATE TEMPORARY TABLE oneToTenDef
335+
|CREATE TEMPORARY VIEW oneToTenDef
336336
|USING org.apache.spark.sql.sources
337337
|OPTIONS (
338338
| from '1',
@@ -351,7 +351,7 @@ class TableScanSuite extends DataSourceTest with SharedSQLContext {
351351
val schemaNotAllowed = intercept[Exception] {
352352
sql(
353353
"""
354-
|CREATE TEMPORARY TABLE relationProvierWithSchema (i int)
354+
|CREATE TEMPORARY VIEW relationProvierWithSchema (i int)
355355
|USING org.apache.spark.sql.sources.SimpleScanSource
356356
|OPTIONS (
357357
| From '1',
@@ -364,7 +364,7 @@ class TableScanSuite extends DataSourceTest with SharedSQLContext {
364364
val schemaNeeded = intercept[Exception] {
365365
sql(
366366
"""
367-
|CREATE TEMPORARY TABLE schemaRelationProvierWithoutSchema
367+
|CREATE TEMPORARY VIEW schemaRelationProvierWithoutSchema
368368
|USING org.apache.spark.sql.sources.AllDataTypesScanSource
369369
|OPTIONS (
370370
| From '1',
@@ -378,7 +378,7 @@ class TableScanSuite extends DataSourceTest with SharedSQLContext {
378378
test("SPARK-5196 schema field with comment") {
379379
sql(
380380
"""
381-
|CREATE TEMPORARY TABLE student(name string comment "SN", age int comment "SA", grade int)
381+
|CREATE TEMPORARY VIEW student(name string comment "SN", age int comment "SA", grade int)
382382
|USING org.apache.spark.sql.sources.AllDataTypesScanSource
383383
|OPTIONS (
384384
| from '1',

sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcSourceSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,15 @@ class OrcSourceSuite extends OrcSuite {
153153
super.beforeAll()
154154

155155
spark.sql(
156-
s"""CREATE TEMPORARY TABLE normal_orc_source
156+
s"""CREATE TEMPORARY VIEW normal_orc_source
157157
|USING org.apache.spark.sql.hive.orc
158158
|OPTIONS (
159159
| PATH '${new File(orcTableAsDir.getAbsolutePath).getCanonicalPath}'
160160
|)
161161
""".stripMargin)
162162

163163
spark.sql(
164-
s"""CREATE TEMPORARY TABLE normal_orc_as_source
164+
s"""CREATE TEMPORARY VIEW normal_orc_as_source
165165
|USING org.apache.spark.sql.hive.orc
166166
|OPTIONS (
167167
| PATH '${new File(orcTableAsDir.getAbsolutePath).getCanonicalPath}'

sql/hive/src/test/scala/org/apache/spark/sql/hive/parquetSuites.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,39 +582,39 @@ class ParquetSourceSuite extends ParquetPartitioningTest {
582582
"normal_parquet")
583583

584584
sql( s"""
585-
create temporary table partitioned_parquet
585+
CREATE TEMPORARY VIEW partitioned_parquet
586586
USING org.apache.spark.sql.parquet
587587
OPTIONS (
588588
path '${partitionedTableDir.getCanonicalPath}'
589589
)
590590
""")
591591

592592
sql( s"""
593-
create temporary table partitioned_parquet_with_key
593+
CREATE TEMPORARY VIEW partitioned_parquet_with_key
594594
USING org.apache.spark.sql.parquet
595595
OPTIONS (
596596
path '${partitionedTableDirWithKey.getCanonicalPath}'
597597
)
598598
""")
599599

600600
sql( s"""
601-
create temporary table normal_parquet
601+
CREATE TEMPORARY VIEW normal_parquet
602602
USING org.apache.spark.sql.parquet
603603
OPTIONS (
604604
path '${new File(partitionedTableDir, "p=1").getCanonicalPath}'
605605
)
606606
""")
607607

608608
sql( s"""
609-
CREATE TEMPORARY TABLE partitioned_parquet_with_key_and_complextypes
609+
CREATE TEMPORARY VIEW partitioned_parquet_with_key_and_complextypes
610610
USING org.apache.spark.sql.parquet
611611
OPTIONS (
612612
path '${partitionedTableDirWithKeyAndComplexTypes.getCanonicalPath}'
613613
)
614614
""")
615615

616616
sql( s"""
617-
CREATE TEMPORARY TABLE partitioned_parquet_with_complextypes
617+
CREATE TEMPORARY VIEW partitioned_parquet_with_complextypes
618618
USING org.apache.spark.sql.parquet
619619
OPTIONS (
620620
path '${partitionedTableDirWithComplexTypes.getCanonicalPath}'

0 commit comments

Comments
 (0)