yihua commented on code in PR #13868:
URL: https://github.com/apache/hudi/pull/13868#discussion_r2337672432
##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/SetAuditLockProcedure.scala:
##########
@@ -82,36 +83,48 @@ class AuditLockSetProcedure extends BaseProcedure with
ProcedureBuilder {
/**
* Executes the audit lock set procedure.
*
- * @param args Procedure arguments containing table name and desired state
+ * @param args Procedure arguments containing table name or path and desired
state
* @return Sequence containing a single Row with execution results
* @throws IllegalArgumentException if state parameter is not 'enabled' or
'disabled'
*/
override def call(args: ProcedureArgs): Seq[Row] = {
super.checkArgs(PARAMETERS, args)
- val tableName = getArgValueOrDefault(args,
PARAMETERS(0)).get.asInstanceOf[String]
- val state = getArgValueOrDefault(args,
PARAMETERS(1)).get.asInstanceOf[String].toLowerCase
+ val tableName = getArgValueOrDefault(args, PARAMETERS(0))
+ val tablePath = getArgValueOrDefault(args, PARAMETERS(1))
+ val state = getArgValueOrDefault(args,
PARAMETERS(2)).get.asInstanceOf[String].toLowerCase
+
+ // Validate that either table or path is provided, but not both
+ if (tableName.isEmpty && tablePath.isEmpty) {
+ throw new IllegalArgumentException("Either table or path parameter must
be provided")
+ }
+ if (tableName.isDefined && tablePath.isDefined) {
+ throw new IllegalArgumentException("Cannot specify both table and path
parameters")
+ }
Review Comment:
This validation can be incorporated into `BaseProcedure#getBasePath`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]