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 丁浩浩 <18...@163.com> on 2020/11/10 03:41:47 UTC

Flink sql tinyint类型使用in 报错

我使用flink sql cdc取连接 mysql表的时候,当我的mysql表type这个字段类型是tinyint类型时 使用type in(1,2,3,4,5)会报以下的错误,只有当我把字段类型改成int的时候才能使用in,这是符合预期的吗,当字段类型不匹配的时候 flink sql不会自动转换类型吗?

[ERROR] Could not execute SQL statement. Reason:
org.codehaus.commons.compiler.CompileException: Line 6, Column 88: No applicable constructor/method found for actual parameters "int"; candidates are: "org.apache.flink.table.runtime.util.collections.ByteHashSet()

Re: Flink sql tinyint类型使用in 报错

Posted by Danny Chan <da...@apache.org>.
好的 了解

丁浩浩 <18...@163.com> 于2020年11月10日周二 下午3:19写道:

> 就比如我要用flink cdc 接入mysql表,一般都是直接将mysql表的DDL稍加修改然后在flink sql中创建,一般都不会考虑到
> 类型转换的问题就直接沿用mysql中的类型,当然sql也是一样的。同样的sql在满足语法正确性的情况下,mysql中能跑,而flinksql中无法跑,
> 当然可以通过显示类型转化来完成,但是能提供自动转化会更好的提供易用性。
>
> > 在 2020年11月10日,下午2:51,Danny Chan <da...@apache.org> 写道:
> >
> > 暂时还没有 你们是什么场景需要用到隐式类型
> >
> > 丁浩浩 <18...@163.com> 于2020年11月10日周二 下午2:45写道:
> >
> >> 请问有没有计划加入隐式类型自动转化呢
> >>
> >>> 在 2020年11月10日,下午2:35,Jark Wu <im...@gmail.com> 写道:
> >>>
> >>> 是的。Flink 目前还不支持隐式类型转换。
> >>>
> >>> Best,
> >>> Jark
> >>>
> >>> On Tue, 10 Nov 2020 at 14:28, hailongwang <18...@163.com> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>>
> >>>> 从你的报错来看,是 in 不支持隐式 CAST。
> >>>> 你要么可以把 type 定义成 INT,要不把后面的值 CAST 成  TINYINT。
> >>>>
> >>>>
> >>>> Best,
> >>>> Hailong Wang
> >>>>
> >>>> 在 2020-11-10 10:41:47,"丁浩浩" <18...@163.com> 写道:
> >>>>> 我使用flink sql cdc取连接 mysql表的时候,当我的mysql表type这个字段类型是tinyint类型时 使用type
> >>>> in(1,2,3,4,5)会报以下的错误,只有当我把字段类型改成int的时候才能使用in,这是符合预期的吗,当字段类型不匹配的时候
> flink
> >>>> sql不会自动转换类型吗?
> >>>>>
> >>>>> [ERROR] Could not execute SQL statement. Reason:
> >>>>> org.codehaus.commons.compiler.CompileException: Line 6, Column 88: No
> >>>> applicable constructor/method found for actual parameters "int";
> >> candidates
> >>>> are: "org.apache.flink.table.runtime.util.collections.ByteHashSet()
> >>>>
> >>
> >>
> >>
>
>
>

Re: Flink sql tinyint类型使用in 报错

Posted by 丁浩浩 <18...@163.com>.
就比如我要用flink cdc 接入mysql表,一般都是直接将mysql表的DDL稍加修改然后在flink sql中创建,一般都不会考虑到
类型转换的问题就直接沿用mysql中的类型,当然sql也是一样的。同样的sql在满足语法正确性的情况下,mysql中能跑,而flinksql中无法跑,
当然可以通过显示类型转化来完成,但是能提供自动转化会更好的提供易用性。

> 在 2020年11月10日,下午2:51,Danny Chan <da...@apache.org> 写道:
> 
> 暂时还没有 你们是什么场景需要用到隐式类型
> 
> 丁浩浩 <18...@163.com> 于2020年11月10日周二 下午2:45写道:
> 
>> 请问有没有计划加入隐式类型自动转化呢
>> 
>>> 在 2020年11月10日,下午2:35,Jark Wu <im...@gmail.com> 写道:
>>> 
>>> 是的。Flink 目前还不支持隐式类型转换。
>>> 
>>> Best,
>>> Jark
>>> 
>>> On Tue, 10 Nov 2020 at 14:28, hailongwang <18...@163.com> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> 
>>>> 从你的报错来看,是 in 不支持隐式 CAST。
>>>> 你要么可以把 type 定义成 INT,要不把后面的值 CAST 成  TINYINT。
>>>> 
>>>> 
>>>> Best,
>>>> Hailong Wang
>>>> 
>>>> 在 2020-11-10 10:41:47,"丁浩浩" <18...@163.com> 写道:
>>>>> 我使用flink sql cdc取连接 mysql表的时候,当我的mysql表type这个字段类型是tinyint类型时 使用type
>>>> in(1,2,3,4,5)会报以下的错误,只有当我把字段类型改成int的时候才能使用in,这是符合预期的吗,当字段类型不匹配的时候 flink
>>>> sql不会自动转换类型吗?
>>>>> 
>>>>> [ERROR] Could not execute SQL statement. Reason:
>>>>> org.codehaus.commons.compiler.CompileException: Line 6, Column 88: No
>>>> applicable constructor/method found for actual parameters "int";
>> candidates
>>>> are: "org.apache.flink.table.runtime.util.collections.ByteHashSet()
>>>> 
>> 
>> 
>> 



Re: Flink sql tinyint类型使用in 报错

Posted by Danny Chan <da...@apache.org>.
暂时还没有 你们是什么场景需要用到隐式类型

丁浩浩 <18...@163.com> 于2020年11月10日周二 下午2:45写道:

> 请问有没有计划加入隐式类型自动转化呢
>
> > 在 2020年11月10日,下午2:35,Jark Wu <im...@gmail.com> 写道:
> >
> > 是的。Flink 目前还不支持隐式类型转换。
> >
> > Best,
> > Jark
> >
> > On Tue, 10 Nov 2020 at 14:28, hailongwang <18...@163.com> wrote:
> >
> >> Hi,
> >>
> >>
> >> 从你的报错来看,是 in 不支持隐式 CAST。
> >> 你要么可以把 type 定义成 INT,要不把后面的值 CAST 成  TINYINT。
> >>
> >>
> >> Best,
> >> Hailong Wang
> >>
> >> 在 2020-11-10 10:41:47,"丁浩浩" <18...@163.com> 写道:
> >>> 我使用flink sql cdc取连接 mysql表的时候,当我的mysql表type这个字段类型是tinyint类型时 使用type
> >> in(1,2,3,4,5)会报以下的错误,只有当我把字段类型改成int的时候才能使用in,这是符合预期的吗,当字段类型不匹配的时候 flink
> >> sql不会自动转换类型吗?
> >>>
> >>> [ERROR] Could not execute SQL statement. Reason:
> >>> org.codehaus.commons.compiler.CompileException: Line 6, Column 88: No
> >> applicable constructor/method found for actual parameters "int";
> candidates
> >> are: "org.apache.flink.table.runtime.util.collections.ByteHashSet()
> >>
>
>
>

Re: Flink sql tinyint类型使用in 报错

Posted by 丁浩浩 <18...@163.com>.
请问有没有计划加入隐式类型自动转化呢

> 在 2020年11月10日,下午2:35,Jark Wu <im...@gmail.com> 写道:
> 
> 是的。Flink 目前还不支持隐式类型转换。
> 
> Best,
> Jark
> 
> On Tue, 10 Nov 2020 at 14:28, hailongwang <18...@163.com> wrote:
> 
>> Hi,
>> 
>> 
>> 从你的报错来看,是 in 不支持隐式 CAST。
>> 你要么可以把 type 定义成 INT,要不把后面的值 CAST 成  TINYINT。
>> 
>> 
>> Best,
>> Hailong Wang
>> 
>> 在 2020-11-10 10:41:47,"丁浩浩" <18...@163.com> 写道:
>>> 我使用flink sql cdc取连接 mysql表的时候,当我的mysql表type这个字段类型是tinyint类型时 使用type
>> in(1,2,3,4,5)会报以下的错误,只有当我把字段类型改成int的时候才能使用in,这是符合预期的吗,当字段类型不匹配的时候 flink
>> sql不会自动转换类型吗?
>>> 
>>> [ERROR] Could not execute SQL statement. Reason:
>>> org.codehaus.commons.compiler.CompileException: Line 6, Column 88: No
>> applicable constructor/method found for actual parameters "int"; candidates
>> are: "org.apache.flink.table.runtime.util.collections.ByteHashSet()
>> 



Re: Flink sql tinyint类型使用in 报错

Posted by Jark Wu <im...@gmail.com>.
是的。Flink 目前还不支持隐式类型转换。

Best,
Jark

On Tue, 10 Nov 2020 at 14:28, hailongwang <18...@163.com> wrote:

> Hi,
>
>
>  从你的报错来看,是 in 不支持隐式 CAST。
> 你要么可以把 type 定义成 INT,要不把后面的值 CAST 成  TINYINT。
>
>
> Best,
> Hailong Wang
>
> 在 2020-11-10 10:41:47,"丁浩浩" <18...@163.com> 写道:
> >我使用flink sql cdc取连接 mysql表的时候,当我的mysql表type这个字段类型是tinyint类型时 使用type
> in(1,2,3,4,5)会报以下的错误,只有当我把字段类型改成int的时候才能使用in,这是符合预期的吗,当字段类型不匹配的时候 flink
> sql不会自动转换类型吗?
> >
> >[ERROR] Could not execute SQL statement. Reason:
> >org.codehaus.commons.compiler.CompileException: Line 6, Column 88: No
> applicable constructor/method found for actual parameters "int"; candidates
> are: "org.apache.flink.table.runtime.util.collections.ByteHashSet()
>

Re:Flink sql tinyint类型使用in 报错

Posted by hailongwang <18...@163.com>.
Hi,


 从你的报错来看,是 in 不支持隐式 CAST。
你要么可以把 type 定义成 INT,要不把后面的值 CAST 成  TINYINT。


Best,
Hailong Wang

在 2020-11-10 10:41:47,"丁浩浩" <18...@163.com> 写道:
>我使用flink sql cdc取连接 mysql表的时候,当我的mysql表type这个字段类型是tinyint类型时 使用type in(1,2,3,4,5)会报以下的错误,只有当我把字段类型改成int的时候才能使用in,这是符合预期的吗,当字段类型不匹配的时候 flink sql不会自动转换类型吗?
>
>[ERROR] Could not execute SQL statement. Reason:
>org.codehaus.commons.compiler.CompileException: Line 6, Column 88: No applicable constructor/method found for actual parameters "int"; candidates are: "org.apache.flink.table.runtime.util.collections.ByteHashSet()