Skip to content

Commit

Permalink
[Spark] fix auto compaction task bug when partition are multi levels (l…
Browse files Browse the repository at this point in the history
…akesoul-io#516)

Signed-off-by: fphantam <[email protected]>
  • Loading branch information
F-PHantam authored Jul 24, 2024
1 parent b481925 commit ec7fe88
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ object CompactionTask {
val partitionDesc = jsonObj.get("table_partition_desc").getAsString
val tableNamespace = jsonObj.get("table_namespace").getAsString
if (tableNamespace.equals(database) || database.equals("")) {
val rsPartitionDesc = if (partitionDesc.equals(MetaUtils.DEFAULT_RANGE_PARTITION_VALUE)) "" else partitionDesc.replace("=",
"='") + "'"
val rsPartitionDesc = if (partitionDesc.equals(MetaUtils.DEFAULT_RANGE_PARTITION_VALUE)) "" else partitionDesc
threadPool.execute(new CompactionTableInfo(tablePath, rsPartitionDesc, notificationParameter))
}
}
Expand All @@ -94,7 +93,12 @@ object CompactionTask {
override def run(): Unit = {
try {
val table = LakeSoulTable.forPath(path)
table.compaction(partitionDesc)
val partitions = partitionDesc.split(",").map(
partition => {
partition.replace("=", "='") + "'"
}
).mkString(" and ")
table.compaction(partitions)
} catch {
case e: Exception => throw e
} finally {
Expand Down

0 comments on commit ec7fe88

Please sign in to comment.