You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Alexis Sarda-Espinosa (JIRA)" <ji...@apache.org> on 2018/09/24 09:24:00 UTC

[jira] [Updated] (FLINK-10408) Cannot use window information in Table functions

     [ https://issues.apache.org/jira/browse/FLINK-10408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexis Sarda-Espinosa updated FLINK-10408:
------------------------------------------
    Description: 
Given the examples shown in [here|[https://flink.apache.org/news/2017/03/29/table-sql-api-update.html],] I assume the following should work: 
{code:java}
ExecutionEnvironment execEnv = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(execEnv);

DataSource<Tuple3<Timestamp, String, Double>> source = execEnv.fromElements(
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:00:00"), "a", 1.3),
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:01:00"), "a", 2.1),
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:02:00"), "a", 3.0),
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:00:00"), "b", 2.2),
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:01:00"), "b", 1.8)
);

Table table = tableEnv.fromDataSet(source)
        .window(Slide.over("2.minutes").every("1.minute").on("f0").as("w"))
        .groupBy("f1, w")
        .select("(f2 * (f0 - w.start).exp() / 1.hour).sum" +
                " / ((f0 - w.start).exp() / 1.hour).sum");

tableEnv.toDataSet(table, Row.class).print();
{code}
However, I get the following exception:
{code:java}
org.apache.flink.table.api.ValidationException: Cannot resolve [w] given input [f0, f1, f2]
{code}
Maybe related to this issue?

 

  was:
Given the examples shown in [here|[https://flink.apache.org/news/2017/03/29/table-sql-api-update.html],] I assume the following should work:

 
{code:java}
ExecutionEnvironment execEnv = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(execEnv);

DataSource<Tuple3<Timestamp, String, Double>> source = execEnv.fromElements(
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:00:00"), "a", 1.3),
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:01:00"), "a", 2.1),
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:02:00"), "a", 3.0),
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:00:00"), "b", 2.2),
        new Tuple3<>(Timestamp.valueOf("2018-09-20 22:01:00"), "b", 1.8)
);

Table table = tableEnv.fromDataSet(source)
        .window(Slide.over("2.minutes").every("1.minute").on("f0").as("w"))
        .groupBy("f1, w")
        .select("(f2 * (f0 - w.start).exp() / 1.hour).sum" +
                " / ((f0 - w.start).exp() / 1.hour).sum");

tableEnv.toDataSet(table, Row.class).print();
{code}
However, I get the following exception:
{code:java}
org.apache.flink.table.api.ValidationException: Cannot resolve [w] given input [f0, f1, f2]
{code}
Maybe related to this issue?

 


> Cannot use window information in Table functions
> ------------------------------------------------
>
>                 Key: FLINK-10408
>                 URL: https://issues.apache.org/jira/browse/FLINK-10408
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API &amp; SQL
>         Environment: Flink v1.5.3
>            Reporter: Alexis Sarda-Espinosa
>            Priority: Major
>
> Given the examples shown in [here|[https://flink.apache.org/news/2017/03/29/table-sql-api-update.html],] I assume the following should work: 
> {code:java}
> ExecutionEnvironment execEnv = ExecutionEnvironment.getExecutionEnvironment();
> BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(execEnv);
> DataSource<Tuple3<Timestamp, String, Double>> source = execEnv.fromElements(
>         new Tuple3<>(Timestamp.valueOf("2018-09-20 22:00:00"), "a", 1.3),
>         new Tuple3<>(Timestamp.valueOf("2018-09-20 22:01:00"), "a", 2.1),
>         new Tuple3<>(Timestamp.valueOf("2018-09-20 22:02:00"), "a", 3.0),
>         new Tuple3<>(Timestamp.valueOf("2018-09-20 22:00:00"), "b", 2.2),
>         new Tuple3<>(Timestamp.valueOf("2018-09-20 22:01:00"), "b", 1.8)
> );
> Table table = tableEnv.fromDataSet(source)
>         .window(Slide.over("2.minutes").every("1.minute").on("f0").as("w"))
>         .groupBy("f1, w")
>         .select("(f2 * (f0 - w.start).exp() / 1.hour).sum" +
>                 " / ((f0 - w.start).exp() / 1.hour).sum");
> tableEnv.toDataSet(table, Row.class).print();
> {code}
> However, I get the following exception:
> {code:java}
> org.apache.flink.table.api.ValidationException: Cannot resolve [w] given input [f0, f1, f2]
> {code}
> Maybe related to this issue?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)