aokolnychyi commented on code in PR #47190:
URL: https://github.com/apache/spark/pull/47190#discussion_r1663250258


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/Procedure.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.connector.catalog;
+
+import org.apache.spark.annotation.Experimental;
+import org.apache.spark.sql.catalyst.InternalRow;
+import org.apache.spark.sql.types.StructType;
+
+/**
+ * A stored procedure available for execution via the CALL command.
+ */
+@Experimental
+public interface Procedure {
+  /**
+   * Returns the name of this procedure.
+   */
+  String name();
+
+  /**
+   * Returns parameters of this procedure.
+   */
+  ProcedureParameter[] parameters();
+
+  /**
+   * Returns the schema of rows produced by this procedure.
+   */
+  StructType outputType();
+
+  /**
+   * Executes this procedure with the given arguments.
+   *
+   * <p>Spark validates and rearranges arguments provided by the user to 
ensure that
+   * the sequence and data types of the fields in {@code input} correspond to 
the expected
+   * sequence and types defined in the {@link #parameters() procedure 
parameters}.
+   *
+   * <p>Parameters can be of mode IN, INOUT, or OUT. Only IN parameters are 
currently supported.
+   *
+   * <p>Implementations may provide a summary of the execution by returning 
one or more rows
+   * as a result. The schema of the rows must match {@link #outputType() the 
defined output type}.
+   *
+   * @param input arguments
+   * @return the result of executing this procedure with the given arguments
+   */
+  InternalRow[] call(InternalRow input);

Review Comment:
   See how this is being used in PR #47183.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to