You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dian Fu (Jira)" <ji...@apache.org> on 2022/07/07 11:14:00 UTC

[jira] [Closed] (FLINK-28015) FROM_UNIXTIME could not be used in Table API

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

Dian Fu closed FLINK-28015.
---------------------------
    Fix Version/s: 1.16.0
         Assignee: LuNing Wang
       Resolution: Fixed

Merged to master via 12615d210af90613cd380c6ff779423faeb42129

> FROM_UNIXTIME could not be used in Table API
> --------------------------------------------
>
>                 Key: FLINK-28015
>                 URL: https://issues.apache.org/jira/browse/FLINK-28015
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / API
>            Reporter: Dian Fu
>            Assignee: LuNing Wang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.16.0
>
>
> This issue is reported in [slack|https://apache-flink.slack.com/archives/C03G7LJTS2G/p1655083223954149]. 
> For the following code:
> {code}
> input_table = table_env.from_path(input_table_name)
>     sliding_window_table = (
>         input_table.window(
>             Slide.over(sliding_window_over)
>             .every(sliding_window_every)
>             .on(sliding_window_on)
>             .alias(sliding_window_alias)
>         )
>         .group_by('ticker, {}'.format(sliding_window_alias))
>         .select('FROM_UNIXTIME(28*60 * (UNIX_TIMESTAMP({0}.end) / (28*60))), ticker, MIN(price) as min_price, MAX(price) as max_price, {0}.start as utc_start, {0}.end as utc_end'.format(
>             sliding_window_alias
>         ))
>     )
> {code}
> The following exception will be thrown:
> {code}
> py4j.protocol.Py4JJavaError: An error occurred while calling o75.select.
> : org.apache.flink.table.api.ValidationException: Undefined function: FROM_UNIXTIME
> 	at org.apache.flink.table.expressions.resolver.LookupCallResolver.lambda$visit$0(LookupCallResolver.java:53)
> 	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
> 	at org.apache.flink.table.expressions.resolver.LookupCallResolver.visit(LookupCallResolver.java:49)
> 	at org.apache.flink.table.expressions.resolver.LookupCallResolver.visit(LookupCallResolver.java:36)
> 	at org.apache.flink.table.expressions.ApiExpressionVisitor.visit(ApiExpressionVisitor.java:35)
> 	at org.apache.flink.table.expressions.LookupCallExpression.accept(LookupCallExpression.java:66)
> 	at org.apache.flink.table.api.internal.TableImpl.lambda$preprocessExpressions$0(TableImpl.java:605)
> 	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
> 	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
> 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
> 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
> 	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
> 	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
> 	at org.apache.flink.table.api.internal.TableImpl.preprocessExpressions(TableImpl.java:606)
> 	at org.apache.flink.table.api.internal.TableImpl.access$300(TableImpl.java:66)
> 	at org.apache.flink.table.api.internal.TableImpl$WindowGroupedTableImpl.select(TableImpl.java:775)
> 	at org.apache.flink.table.api.internal.TableImpl$WindowGroupedTableImpl.select(TableImpl.java:770)
> {code}



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