You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 夜思流年梦 <li...@163.com> on 2020/10/26 08:16:16 UTC

flinksql 不支持 % 运算

flink 版本1.11
目前flink-sql 好像不支持取余运算,会报错:
比如:SELECT * FROM Orders WHERE a % 2 = 0
Percent remainder '%' is not allowed under the current SQL conformance level


看了下flink 的issue ,已经有人碰到过了,说是要1.12版本修复




想问下:如果再1.11版本,flink-sql 要怎么操作才能支持 % 运算呢? 可以通过修改配置文件来实现么?比如flink-conf.yaml

Re: flinksql 不支持 % 运算

Posted by Danny Chan <da...@apache.org>.
%是非标准的 SQL 语法,不推荐使用。

Benchao Li <li...@apache.org> 于2020年10月26日周一 下午9:26写道:

> 1.11的话通过配置是无法实现的。可以把这个pr[1] cherry-pick到1.11的分支上编译一下来实现1.11上使用%
>
> [1] https://github.com/apache/flink/pull/12818
>
> 夜思流年梦 <li...@163.com> 于2020年10月26日周一 下午4:16写道:
>
> > flink 版本1.11
> > 目前flink-sql 好像不支持取余运算,会报错:
> > 比如:SELECT * FROM Orders WHERE a % 2 = 0
> > Percent remainder '%' is not allowed under the current SQL conformance
> > level
> >
> >
> > 看了下flink 的issue ,已经有人碰到过了,说是要1.12版本修复
> >
> >
> >
> >
> > 想问下:如果再1.11版本,flink-sql 要怎么操作才能支持 % 运算呢? 可以通过修改配置文件来实现么?比如flink-conf.yaml
>
>
>
> --
>
> Best,
> Benchao Li
>

Re: flinksql 不支持 % 运算

Posted by Benchao Li <li...@apache.org>.
1.11的话通过配置是无法实现的。可以把这个pr[1] cherry-pick到1.11的分支上编译一下来实现1.11上使用%

[1] https://github.com/apache/flink/pull/12818

夜思流年梦 <li...@163.com> 于2020年10月26日周一 下午4:16写道:

> flink 版本1.11
> 目前flink-sql 好像不支持取余运算,会报错:
> 比如:SELECT * FROM Orders WHERE a % 2 = 0
> Percent remainder '%' is not allowed under the current SQL conformance
> level
>
>
> 看了下flink 的issue ,已经有人碰到过了,说是要1.12版本修复
>
>
>
>
> 想问下:如果再1.11版本,flink-sql 要怎么操作才能支持 % 运算呢? 可以通过修改配置文件来实现么?比如flink-conf.yaml



-- 

Best,
Benchao Li

Re:flinksql 不支持 % 运算

Posted by hailongwang <18...@163.com>.
Hi liaobiao,
可以使用 MOD 函数[1].
[1]
https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/functions/systemFunctions.html#arithmetic-functions
Best,
HailongWang.

在 2020-10-26 15:16:16,"夜思流年梦" <li...@163.com> 写道:
>flink 版本1.11
>目前flink-sql 好像不支持取余运算,会报错:
>比如:SELECT * FROM Orders WHERE a % 2 = 0
>Percent remainder '%' is not allowed under the current SQL conformance level
>
>
>看了下flink 的issue ,已经有人碰到过了,说是要1.12版本修复
>
>
>
>
>想问下:如果再1.11版本,flink-sql 要怎么操作才能支持 % 运算呢? 可以通过修改配置文件来实现么?比如flink-conf.yaml