You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/12/03 23:35:32 UTC

[GitHub] sunjincheng121 commented on a change in pull request #7196: [FLINK-10974] [table] Add support for flatMap to table API

sunjincheng121 commented on a change in pull request #7196: [FLINK-10974] [table] Add support for flatMap to table API
URL: https://github.com/apache/flink/pull/7196#discussion_r238476606
 
 

 ##########
 File path: docs/dev/table/tableApi.md
 ##########
 @@ -1682,6 +1682,60 @@ The `OverWindow` defines a range of rows over which aggregates are computed. `Ov
 
 {% top %}
 
+### Map
+
+Map performs a map operation with an user-defined scalar function or built-in scalar function. The output will be flattened if the output type is a composite type.
+
+<div class="codetabs" markdown="1">
+<div data-lang="java" markdown="1">
+{% highlight java %}
+ScalarFunction func = new MyMapFunction();
+tableEnv.registerFunction("func", func);
+
+Table table = input
+  .map(func("c")).as("a, b")
+{% endhighlight %}
+</div>
+
+<div data-lang="scala" markdown="1">
+{% highlight scala %}
+val func: ScalarFunction = new MyMapFunction()
+
+val table = input
+  .map(func('c)).as('a, 'b)
+{% endhighlight %}
+</div>
+</div>
+
+{% top %}
+
+### FlatMap
+
+FlatMap performs a flatMap operation with an user-defined table function.
+
+<div class="codetabs" markdown="1">
+<div data-lang="java" markdown="1">
+{% highlight java %}
+TableFunction func = new MyFlatMapFunction();
+tableEnv.registerFunction("func", func);
+
+Table table = input
+  .flatMap(func("c")).as("a, b")
+{% endhighlight %}
+</div>
+
+<div data-lang="scala" markdown="1">
+{% highlight scala %}
+val func: TableFunction = new MyFlatMapFunction()
 
 Review comment:
   `new MyFlatMapFunction()` -> `new MyFlatMapFunction`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services