leonardBang commented on a change in pull request #9545: [FLINK-13355][docs] 
Add documentation for Temporal Table Join in blink planner
URL: https://github.com/apache/flink/pull/9545#discussion_r318947040
 
 

 ##########
 File path: docs/dev/table/sourceSinks.zh.md
 ##########
 @@ -324,6 +324,46 @@ FilterableTableSource[T] {
 
 {% top %}
 
+### Defining a TableSource with Lookupable
+
+The `LookupableTableSource` interface adds support for the table to be 
accessed via key column(s) in a lookup fashion. This is very useful when used 
to join with a dimension table to enrich some information. If you want to use 
the `TableSource` in lookup mode, you should use the source in [temporal table 
join syntax](streaming/joins.html).
+
+The interface looks as follows:
+
+<div class="codetabs" markdown="1">
+<div data-lang="java" markdown="1">
+{% highlight java %}
+LookupableTableSource<T> implements TableSource<T> {
+
+  public TableFunction<T> getLookupFunction(String[] lookupkeys);
+
+  public AsyncTableFunction<T> getAsyncLookupFunction(String[] lookupkeys);
+
+  public boolean isAsyncEnabled();
+}
+{% endhighlight %}
+</div>
+
+<div data-lang="scala" markdown="1">
+{% highlight scala %}
+LookupableTableSource[T] extends TableSource[T] {
+
+  def getLookupFunction(lookupKeys: Array[String]): TableFunction[T]
+
+  def getAsyncLookupFunction(lookupKeys: Array[String]): AsyncTableFunction[T]
+
+  def isAsyncEnabled: Boolean
+}
+{% endhighlight %}
+</div>
+</div>
+
+* `getLookupFunction(lookupkeys)`: Returns a `TableFunction` which used to 
lookup the matched row(s) via lookup keys. The lookupkeys are the field names 
of `LookupableTableSource` in the join equal conditions. The eval method 
parameters of the returned `TableFunction`'s should be in the order which 
`lookupkeys` defined. It is recommended to define the parameters in varargs 
(e.g. `eval(Object... lookupkeys)` to match all the cases). The return type of 
the `TableFunction` must be identical to the return type defined by the 
`TableSource.getReturnType()` method.
+* `getAsyncLookupFunction(lookupkeys)`: Optional. Similar to 
`getLookupFunction`, but the `AsyncLookupFunction` lookups the matched row(s) 
asynchronously. The underlying of `AsyncLookupFunction` will be called via 
[Async I/O](/dev/stream/operators/asyncio.html). The first argument of the eval 
method of the returned `AsyncTableFunction` should be defined as 
`java.util.concurrent.CompletableFuture` to collect results asynchronously 
(e.g. `eval(CompletableFuture<Collection<String>> result, Object... 
lookupkeys)`). Can throw an exception if the TableSource doesn't support 
asynchronously lookup.
 
 Review comment:
   the same as above

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to