Skip to content

Commit

Permalink
Fix 6604
Browse files Browse the repository at this point in the history
  • Loading branch information
loneylee committed Jul 26, 2024
1 parent b93b098 commit 190d377
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ object MergeTreePartsPartitionsUtil extends Logging {
partition =>
partition.files.map(
fs => {
val path = fs.getPath.toString
val path = fs.getPath.toUri.toString

val ret = ClickhouseSnapshot.pathToAddMTPCache.getIfPresent(path)
if (ret == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ abstract class MergeTreeBaseDynamicPartitionDataWriter(
releaseCurrentWriter()
}

val partDir = partitionValues.map(getPartitionPath(_))
val partDir =
partitionValues.map(getPartitionPath(_)).map(str => new Path(str).toUri.toASCIIString)
partDir.foreach(updatedPartitions.add)

val bucketIdStr = bucketId.map(id => f"$id%05d").getOrElse("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2022,5 +2022,33 @@ class GlutenClickHouseMergeTreeWriteSuite
|""".stripMargin
runTPCHQueryBySQL(6, sqlStr) { _ => }
}

test("test mergetree with partition with whitespace") {
spark.sql(s"""
|DROP TABLE IF EXISTS lineitem_mergetree_partition_with_whitespace;
|""".stripMargin)

spark.sql(s"""
|CREATE TABLE IF NOT EXISTS lineitem_mergetree_partition_with_whitespace
|(
| l_returnflag string,
| l_linestatus string
|)
|USING clickhouse
|PARTITIONED BY (l_returnflag)
|LOCATION '$basePath/lineitem_mergetree_partition_with_whitespace'
|""".stripMargin)

spark.sql(s"""
| insert into table lineitem_mergetree_partition_with_whitespace
| (l_returnflag, l_linestatus) values ('a A', 'abc')
|""".stripMargin)

val sqlStr =
s"""
|SELECT * from lineitem_mergetree_partition_with_whitespace
|""".stripMargin
runSql(sqlStr) { _ => }
}
}
// scalastyle:off line.size.limit

0 comments on commit 190d377

Please sign in to comment.