Hi Pedro,

support for window aggregations in SQL and Table API is currently work in
progress.
We have a pull request for the Table API and will add this feature for the
next release.
For SQL we depend on Apache Calcite to include the TUMBLE keyword in its
parser and optimizer.

At the moment the only way to do window aggregations is by using the
DataStream API.

Best, Fabian


2016-10-12 18:51 GMT+02:00 PedroMrChaves <pedro.mr.cha...@gmail.com>:

> Hello,
>
> I am trying to build an query using the StreamTableEnvironment API. I Am
> trying to build this queries with tableEnvironment.sql("QUERY") so that I
> can in the future load those queries from a file.
>
> Code source:
>
> Table accesses = tableEnvironment.sql
>                                 ("SELECT STREAM TUMBLE_END(rowtime,
> INTERVAL '1' HOUR) AS rowtime,
> user,ip "
>                                                 + "FROM eventData "
>                                                 + "WHERE action='denied' "
>                                                 + "GROUP BY
> TUMBLE(rowtime, INTERVAL '1' HOUR) user,ip"
>                                                 + " HAVING COUNT(user,ip)
> > 5");
>
> But I always get the following error:
>
> /Caused by: org.apache.calcite.runtime.CalciteContextException: From line
> 1,
> column 120 to line 1, column 153: No match found for function signature
> TUMBLE(<TIME>, <INTERVAL_DAY_TIME>)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(
> NativeConstructorAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
> DelegatingConstructorAccessorImpl.java:45)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>         at
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(
> Resources.java:405)
>         at
> org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:765)
>         at
> org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:753)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(
> SqlValidatorImpl.java:3929)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.handleUnresolvedFunction(
> SqlValidatorImpl.java:1544)
>         at
> org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:278)
>         at
> org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:222)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(
> SqlValidatorImpl.java:4266)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(
> SqlValidatorImpl.java:4253)
>         at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:135)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(
> SqlValidatorImpl.java:1462)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.
> deriveType(SqlValidatorImpl.java:1445)
>         at org.apache.calcite.sql.SqlNode.validateExpr(SqlNode.java:233)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateGroupClause(
> SqlValidatorImpl.java:3305)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(
> SqlValidatorImpl.java:2959)
>         at
> org.apache.calcite.sql.validate.SelectNamespace.
> validateImpl(SelectNamespace.java:60)
>         at
> org.apache.calcite.sql.validate.AbstractNamespace.
> validate(AbstractNamespace.java:86)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(
> SqlValidatorImpl.java:845)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(
> SqlValidatorImpl.java:831)
>         at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:208)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(
> SqlValidatorImpl.java:807)
>         at
> org.apache.calcite.sql.validate.SqlValidatorImpl.
> validate(SqlValidatorImpl.java:523)
>         at
> org.apache.flink.api.table.FlinkPlannerImpl.validate(
> FlinkPlannerImpl.scala:84)
>         ... 10 more
> Caused by: org.apache.calcite.sql.validate.SqlValidatorException: No match
> found for function signature TUMBLE(<TIME>, <INTERVAL_DAY_TIME>)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(
> NativeConstructorAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
> DelegatingConstructorAccessorImpl.java:45)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>         at
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(
> Resources.java:405)
>         at
> org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:514)
> /
>
> What am I doing wrong?
>
> Regards.
>
>
>
> --
> View this message in context: http://apache-flink-user-
> mailing-list-archive.2336050.n4.nabble.com/Error-with-
> table-sql-query-No-match-found-for-function-signature-
> TUMBLE-TIME-INTERVAL-DAY-TIME-tp9497.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>

Reply via email to