wuchong commented on a change in pull request #15768: URL: https://github.com/apache/flink/pull/15768#discussion_r620820408
########## File path: docs/content/docs/dev/table/functions/udfs.md ########## @@ -171,6 +171,52 @@ env.createTemporarySystemFunction("SubstringFunction", new SubstringFunction(tru {{< /tab >}} {{< /tabs >}} +You can use star (*) as one argument of the function call to act as a wildcard in Table API, +all columns in the table will be passed to the function at the corresponding position. + +{{< tabs "64dd4129-6313-4904-b7e7-a1a0535822e9" >}} +{{< tab "Java" >}} +```java +import org.apache.flink.table.api.*; +import org.apache.flink.table.functions.ScalarFunction; +import static org.apache.flink.table.api.Expressions.*; + +public static class JoinFunction extends ScalarFunction { + + public String eval(String f0, String f1) { + return f0 + f1; + } +} + +TableEnvironment env = TableEnvironment.create(...); + +// call function with $("*"), if MyTable has two string fields, +// all of them will be passed to JoinFunction. +env.from("MyTable").select(call(JoinFunction.class, $("*"))); Review comment: I would suggest to show a more meaningful example here, e.g. `concat`? ```java public static class MyConcatFunction extends ScalarFunction { public String eval(Object... fields) { return Arrays.stream(fields) .map(Object::toString) .collect(Collectors.joining(",")); } } TableEnvironment env = TableEnvironment.create(...); // call function with $("*"), if MyTable has 3 fields (a, b, c), // all of them will be passed to JoinFunction. env.from("MyTable").select(call(MyConcatFunction.class, $("*"))); // it's equal to call function with explicitly selecting all columns env.from("MyTable").select(call(MyConcatFunction.class, $("a"), $("b"), $("c"))); ``` ########## File path: docs/content/docs/dev/table/functions/udfs.md ########## @@ -171,6 +171,52 @@ env.createTemporarySystemFunction("SubstringFunction", new SubstringFunction(tru {{< /tab >}} {{< /tabs >}} +You can use star (*) as one argument of the function call to act as a wildcard in Table API, +all columns in the table will be passed to the function at the corresponding position. + +{{< tabs "64dd4129-6313-4904-b7e7-a1a0535822e9" >}} +{{< tab "Java" >}} +```java +import org.apache.flink.table.api.*; +import org.apache.flink.table.functions.ScalarFunction; +import static org.apache.flink.table.api.Expressions.*; + +public static class JoinFunction extends ScalarFunction { + + public String eval(String f0, String f1) { + return f0 + f1; + } +} + +TableEnvironment env = TableEnvironment.create(...); + +// call function with $("*"), if MyTable has two string fields, +// all of them will be passed to JoinFunction. +env.from("MyTable").select(call(JoinFunction.class, $("*"))); Review comment: And please also add an IT case for this to make sure this is supported end-to-end. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org