Cpaulyz commented on code in PR #14791:
URL: https://github.com/apache/iotdb/pull/14791#discussion_r1984412551
##########
iotdb-api/udf-api/src/main/java/org/apache/iotdb/udf/api/relational/TableFunction.java:
##########
@@ -19,4 +19,69 @@
package org.apache.iotdb.udf.api.relational;
-public interface TableFunction extends SQLFunction {}
+import org.apache.iotdb.udf.api.exception.UDFException;
+import org.apache.iotdb.udf.api.relational.table.TableFunctionAnalysis;
+import
org.apache.iotdb.udf.api.relational.table.TableFunctionProcessorProvider;
+import org.apache.iotdb.udf.api.relational.table.argument.Argument;
+import org.apache.iotdb.udf.api.relational.table.argument.ScalarArgument;
+import org.apache.iotdb.udf.api.relational.table.argument.TableArgument;
+import
org.apache.iotdb.udf.api.relational.table.specification.ParameterSpecification;
+import
org.apache.iotdb.udf.api.relational.table.specification.ScalarParameterSpecification;
+import
org.apache.iotdb.udf.api.relational.table.specification.TableParameterSpecification;
+
+import java.util.List;
+import java.util.Map;
+
+public interface TableFunction extends SQLFunction {
+
+ /**
+ * This method is used to define the specification of the arguments required
by the table
+ * function. Each argument is described using a {@link
ParameterSpecification} object, which
+ * encapsulates details such as the argument name, whether it is required,
its default value (if
+ * any), etc.
+ *
+ * <p>The {@link ParameterSpecification} class is abstract and has two
concrete implementations:
+ *
+ * <ul>
+ * <li>{@link TableParameterSpecification}: Used for parameters specific
to table functions.
+ * <li>{@link ScalarParameterSpecification}: Used for parameters specific
to scalar functions.
+ * </ul>
+ *
+ * @return a list of {@link ParameterSpecification} objects describing the
function's arguments.
+ * The list should include all parameters that the table function
expects, along with their
+ * constraints and default values (if applicable).
+ */
+ List<ParameterSpecification> getArgumentsSpecifications();
+
+ /**
+ * This method is responsible for analyzing the provided arguments and
constructing a {@link
+ * TableFunctionAnalysis} object in runtime. During analysis, the method
should:
+ *
+ * <ul>
+ * <li>Extract values from scalar arguments (instances of {@link
ScalarArgument}) or extract
+ * table descriptions from table arguments (instances of {@link
TableArgument}).
+ * <li>Construct a {@link TableFunctionAnalysis} object that contains:
+ * <ul>
+ * <li>A description of proper columns.
Review Comment:
Good idea! I think it is an important knowledge for UDTF developer, so I
added this explaination at the top of `TableFunction` interface.
--
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]