Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,8 @@ private[client] class Shim_v0_13 extends Shim_v0_12 {
.map(col => col.getName).toSet

def unapply(attr: Attribute): Option[String] = {
if (varcharKeys.contains(attr.name)) {
val resolver = SQLConf.get.resolver
if (varcharKeys.exists(c => resolver(c, attr.name))) {
None
} else if (attr.dataType.isInstanceOf[IntegralType] || attr.dataType == StringType) {
Some(attr.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2720,4 +2720,14 @@ class HiveDDLSuite
checkAnswer(sql("SHOW PARTITIONS ta_part"), Row("ts=10") :: Nil)
}
}

test("SPARK-31904: Fix case sensitive problem of char and varchar partition columns") {
withTable("t1", "t2") {
sql("CREATE TABLE t1(a STRING, B VARCHAR(10), C CHAR(10)) STORED AS parquet")
sql("CREATE TABLE t2 USING parquet PARTITIONED BY (b, c) AS SELECT * FROM t1")
// make sure there is no exception
assert(sql("SELECT * FROM t2 WHERE b = 'A'").collect().isEmpty)
assert(sql("SELECT * FROM t2 WHERE c = 'A'").collect().isEmpty)
}
}
}