Jeremy Ber created FLINK-30830:
----------------------------------

             Summary: Temporal Table Function Samples for Java Do Not Work 
As-Is, And Some Functions Are Deprecated
                 Key: FLINK-30830
                 URL: https://issues.apache.org/jira/browse/FLINK-30830
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API
    Affects Versions: 1.16.1, 1.15.3, 1.15.2, 1.16.0, 1.15.1, 1.15.0, 1.17.0
            Reporter: Jeremy Ber


In the java documentation for the [Temporal Table 
Function|https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/concepts/temporal_table_function/],
 there are two issues with the APIs as-is.
 * Defining the temporal table calls `tEnv.registerFunction` which is a 
deprecated API since v1.11, favoring `createTemporarySystemFunction` instead.
 * In the Temporal Table Function Join syntax, calling 
`joinLateral($("rates(order_time)")` elicits the following error:

```bash

Cannot resolve field [rates(order_time)] 

```

 

For point 1, I am proposing we replace `tEnv.registerFunction()` with 
`tEnv.createTemporarySystemFunction`.

 

For point 2, I am proposing we replace:

 

```java

Table result = orders
    .joinLateral($("rates(order_time)"), $("orders.currency = rates.currency"))
    .select($("(o_amount * r_rate).sum as amount"));

```

with

```java

{{{}Table result = orders    .joinLateral(call("rates", $("o_proctime")), 
$("o_currency").isEqual($("r_currency"))){}}}{{{}.select($("(o_amount").times($("r_rate")).sum().as("amount"));
 {}}}

{{```}}

{{}}

{{Sources for corrections:}}
 * 
{{[https://nightlies.apache.org/flink/flink-docs-release-1.11/api/java/org/apache/flink/table/api/TableEnvironment.html#registerFunction-java.lang.String-org.apache.flink.table.functions.ScalarFunction-]}}
 * 
{{{}[https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/tableapi/#join-with-temporal-table]{}}}{{{}{}}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to