Skip to content

Commit ada2bd8

Browse files
committed
do not enable by default
1 parent a508985 commit ada2bd8

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

docs/sql-migration-guide.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ license: |
5454

5555
- In Spark 3.1, creating or altering a view will capture runtime SQL configs and store them as view properties. These configs will be applied during the parsing and analysis phases of the view resolution. To restore the behavior before Spark 3.1, you can set `spark.sql.legacy.useCurrentConfigsForView` to `true`.
5656

57-
- In Spark 3.1, `CREATE TABLE` without a specific table provider uses the value of `spark.sql.sources.default` as its table provider. In Spark version 3.0 and below, it was Hive. To restore the behavior before Spark 3.1, you can set `spark.sql.legacy.createHiveTableByDefault.enabled` to `true`.
58-
5957
## Upgrading from Spark SQL 3.0 to 3.0.1
6058

6159
- In Spark 3.0, JSON datasource and JSON function `schema_of_json` infer TimestampType from string values if they match to the pattern defined by the JSON option `timestampFormat`. Since version 3.0.1, the timestamp type inference is disabled by default. Set the JSON option `inferTimestamp` to `true` to enable such type inference.

sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2929,7 +2929,7 @@ object SQLConf {
29292929
s"instead of the value of ${DEFAULT_DATA_SOURCE_NAME.key} as the table provider.")
29302930
.version("3.1.0")
29312931
.booleanConf
2932-
.createWithDefault(false)
2932+
.createWithDefault(true)
29332933

29342934
/**
29352935
* Holds information about keys that have been deprecated.

sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,22 @@ class DataSourceV2SQLSuite
267267
}
268268

269269
test("CreateTable: without USING clause") {
270-
// unset this config to use the default v2 session catalog.
271-
spark.conf.unset(V2_SESSION_CATALOG_IMPLEMENTATION.key)
272-
val testCatalog = catalog("testcat").asTableCatalog
273-
274-
sql("CREATE TABLE testcat.t1 (id int)")
275-
val t1 = testCatalog.loadTable(Identifier.of(Array(), "t1"))
276-
// Spark shouldn't set the default provider for catalog plugins.
277-
assert(!t1.properties.containsKey(TableCatalog.PROP_PROVIDER))
278-
279-
sql("CREATE TABLE t2 (id int)")
280-
val t2 = spark.sessionState.catalogManager.v2SessionCatalog.asTableCatalog
281-
.loadTable(Identifier.of(Array("default"), "t2")).asInstanceOf[V1Table]
282-
// Spark should set the default provider as DEFAULT_DATA_SOURCE_NAME for the session catalog.
283-
assert(t2.v1Table.provider == Some(conf.defaultDataSourceName))
270+
withSQLConf(SQLConf.LEGACY_CREATE_HIVE_TABLE_BY_DEFAULT.key -> "false") {
271+
// unset this config to use the default v2 session catalog.
272+
spark.conf.unset(V2_SESSION_CATALOG_IMPLEMENTATION.key)
273+
val testCatalog = catalog("testcat").asTableCatalog
274+
275+
sql("CREATE TABLE testcat.t1 (id int)")
276+
val t1 = testCatalog.loadTable(Identifier.of(Array(), "t1"))
277+
// Spark shouldn't set the default provider for catalog plugins.
278+
assert(!t1.properties.containsKey(TableCatalog.PROP_PROVIDER))
279+
280+
sql("CREATE TABLE t2 (id int)")
281+
val t2 = spark.sessionState.catalogManager.v2SessionCatalog.asTableCatalog
282+
.loadTable(Identifier.of(Array("default"), "t2")).asInstanceOf[V1Table]
283+
// Spark should set the default provider as DEFAULT_DATA_SOURCE_NAME for the session catalog.
284+
assert(t2.v1Table.provider == Some(conf.defaultDataSourceName))
285+
}
284286
}
285287

286288
test("CreateTable/RepalceTable: invalid schema if has interval type") {

sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,9 +1967,11 @@ class PlanResolutionSuite extends AnalysisTest {
19671967
assert(desc.viewText.isEmpty)
19681968
assert(desc.viewQueryColumnNames.isEmpty)
19691969
assert(desc.storage.locationUri.isEmpty)
1970-
assert(desc.storage.inputFormat.isEmpty)
1971-
assert(desc.storage.outputFormat.isEmpty)
1972-
assert(desc.storage.serde.isEmpty)
1970+
assert(desc.storage.inputFormat ==
1971+
Some("org.apache.hadoop.mapred.TextInputFormat"))
1972+
assert(desc.storage.outputFormat ==
1973+
Some("org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"))
1974+
assert(desc.storage.serde == Some("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"))
19731975
assert(desc.storage.properties.isEmpty)
19741976
assert(desc.properties.isEmpty)
19751977
assert(desc.comment.isEmpty)

0 commit comments

Comments
 (0)