Skip to content
Merged
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 @@ -17,7 +17,6 @@

package org.apache.spark.sql.hudi.command.procedures

import java.util.function.Supplier
import org.apache.hudi.HoodieCLIUtils
import org.apache.hudi.common.table.timeline.HoodieActiveTimeline
import org.apache.hudi.common.util.JsonUtils
Expand All @@ -26,6 +25,8 @@ import org.apache.spark.internal.Logging
import org.apache.spark.sql.Row
import org.apache.spark.sql.types.{DataTypes, Metadata, StructField, StructType}

import java.util.function.Supplier

class RunCleanProcedure extends BaseProcedure with ProcedureBuilder with Logging {

private val PARAMETERS = Array[ProcedureParameter](
Expand Down Expand Up @@ -76,7 +77,7 @@ class RunCleanProcedure extends BaseProcedure with ProcedureBuilder with Logging
val client = HoodieCLIUtils.createHoodieClientFromPath(sparkSession, basePath, props)
val hoodieCleanMeta = client.clean(cleanInstantTime, scheduleInLine, skipLocking)

if (hoodieCleanMeta == null) Seq(Row.empty)
if (hoodieCleanMeta == null) Seq.empty
else Seq(Row(hoodieCleanMeta.getStartCleanTime,
hoodieCleanMeta.getTimeTakenInMillis,
hoodieCleanMeta.getTotalFilesDeleted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class TestCleanProcedure extends HoodieSparkSqlTestBase {
checkAnswer(s"select id, name, price, ts from $tableName order by id") (
Seq(1, "a1", 13, 1000)
)

val result2 = spark.sql(s"call run_clean(table => '$tableName', retain_commits => 1)")
.collect()
assertResult(0)(result2.length)
}
}

Expand Down