-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-33591][SQL] Recognize null in partition spec values
#30538
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
Changes from all commits
6369247
4504ab7
80c8972
cfb2670
7f0527d
2135dc2
b0c55eb
cbf79f1
9f2e04e
4e4b6cf
343d15d
af2ec3c
8e3c69a
29d9729
167f357
17938dc
71ca35a
89c1572
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -133,6 +133,7 @@ case class InsertIntoHiveTable( | |||||
| val numDynamicPartitions = partition.values.count(_.isEmpty) | ||||||
| val numStaticPartitions = partition.values.count(_.nonEmpty) | ||||||
| val partitionSpec = partition.map { | ||||||
| case (key, Some(null)) => key -> ExternalCatalogUtils.DEFAULT_PARTITION_NAME | ||||||
|
Contributor
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. how about empty string?
Member
Author
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. The test: test("SPARK-33591: '' as a partition value") {
val t = "part_table"
withTable(t) {
sql(s"CREATE TABLE $t (col1 INT, p1 STRING) $defaultUsing PARTITIONED BY (p1)")
sql(s"INSERT INTO TABLE $t PARTITION (p1 = '') SELECT 0")
}
}fails with: at spark/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala Lines 408 to 409 in d730b6b
|
||||||
| case (key, Some(value)) => key -> value | ||||||
| case (key, None) => key -> "" | ||||||
| } | ||||||
|
|
@@ -229,6 +230,7 @@ case class InsertIntoHiveTable( | |||||
| val caseInsensitiveDpMap = CaseInsensitiveMap(dpMap) | ||||||
|
|
||||||
| val updatedPartitionSpec = partition.map { | ||||||
| case (key, Some(null)) => key -> ExternalCatalogUtils.DEFAULT_PARTITION_NAME | ||||||
| case (key, Some(value)) => key -> value | ||||||
| case (key, None) if caseInsensitiveDpMap.contains(key) => | ||||||
| key -> caseInsensitiveDpMap(key) | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.