You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tw...@apache.org on 2019/01/04 12:52:00 UTC
[flink] branch release-1.7 updated: [FLINK-11119][docs] Correct
Scala example for Table Function in User-defined Functions docs.
This is an automated email from the ASF dual-hosted git repository.
twalthr pushed a commit to branch release-1.7
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.7 by this push:
new f9c5874 [FLINK-11119][docs] Correct Scala example for Table Function in User-defined Functions docs.
f9c5874 is described below
commit f9c587475abb0c6aeb646b068602a1d7cb2e5cf3
Author: wenhuitang <we...@yeah.net>
AuthorDate: Sat Dec 29 18:50:31 2018 +0800
[FLINK-11119][docs] Correct Scala example for Table Function in User-defined Functions docs.
This closes #7379.
---
docs/dev/table/udfs.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/dev/table/udfs.md b/docs/dev/table/udfs.md
index 20bf49d..47c44da 100644
--- a/docs/dev/table/udfs.md
+++ b/docs/dev/table/udfs.md
@@ -190,7 +190,7 @@ tableEnv.sqlQuery("SELECT a, word, length FROM MyTable LEFT JOIN LATERAL TABLE(s
class Split(separator: String) extends TableFunction[(String, Int)] {
def eval(str: String): Unit = {
// use collect(...) to emit a row.
- str.split(separator).foreach(x -> collect((x, x.length))
+ str.split(separator).foreach(x => collect((x, x.length)))
}
}
@@ -210,7 +210,7 @@ tableEnv.registerFunction("split", new Split("#"))
// CROSS JOIN a table function (equivalent to "join" in Table API)
tableEnv.sqlQuery("SELECT a, word, length FROM MyTable, LATERAL TABLE(split(a)) as T(word, length)")
// LEFT JOIN a table function (equivalent to "leftOuterJoin" in Table API)
-tableEnv.sqlQuery("SELECT a, word, length FROM MyTable LEFT JOIN TABLE(split(a)) as T(word, length) ON TRUE")
+tableEnv.sqlQuery("SELECT a, word, length FROM MyTable LEFT JOIN LATERAL TABLE(split(a)) as T(word, length) ON TRUE")
{% endhighlight %}
**IMPORTANT:** Do not implement TableFunction as a Scala object. Scala object is a singleton and will cause concurrency issues.
</div>