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 xiaoyue <18...@163.com> on 2021/02/20 05:14:18 UTC
SqlValidatorException: No match found for function signature
prod()
我在使用flinksql1.11的udaf时出现SqlValidatorException: No match found for function signature prod(<NUMERIC>),请求大佬帮忙看看_(:з」∠)_
以下是代码:
-----------------------------------------------------
...
stableEnv.createTemporarySystemFunction("prod", ProductAggregateFunction.class);
Table resultTable = stableEnv.sqlQuery("select pf_id,prod(yldrate+1)-1 as yldrate from queryData group by pf_id");
...
-----------------------------------------------------
@FunctionHint(
input = @DataTypeHint("Double"),
output = @DataTypeHint("Double")
)
public class ProductAggregateFunction extends AggregateFunction<Double, Product> {
@Override
public Double getValue(Product acc) {
return acc.prod;
}
@Override
public Product createAccumulator() {
return new Product();
}
public void accumulate(Product acc, Double iValue) {
acc.prod *= iValue;
}
public void retract(Product acc, Double iValue) {
acc.prod /= iValue;
}
public void merge(Product acc, Iterable<Product> it) {
for (Product p : it) {
accumulate(acc, p.prod);
}
}
public void resetAccumulator(Product acc) {
acc.prod = 1D;
}
}
回复:Re:SqlValidatorException: No match found for function signature prod()
Posted by Presley <ti...@foxmail.com>.
这里实现的是自定义聚合函数,而不是标量函数鸭_(:з」∠)_
------------------ 原始邮件 ------------------
发件人: "user-zh" <chenyegit@163.com>;
发送时间: 2021年2月22日(星期一) 中午11:14
收件人: "user-zh"<user-zh@flink.apache.org>;
主题: Re:Re:SqlValidatorException: No match found for function signature prod(<NUMERIC>)
应该是继承scalaFunction ?
在 2021-02-22 10:25:31,"xiaoyue" <18242988825@163.com> 写道:
>捞一下自己,在线等大佬们的回复 _(:з」∠)_
>
>
>
>
>
>
>
>在 2021-02-20 13:14:18,"xiaoyue" <18242988825@163.com> 写道:
>
>我在使用flinksql1.11的udaf时出现SqlValidatorException: No match found for function signature prod(<NUMERIC>),请求大佬帮忙看看_(:з」∠)_
>
>以下是代码:
>-----------------------------------------------------
>...
> stableEnv.createTemporarySystemFunction("prod", ProductAggregateFunction.class);
> Table resultTable = stableEnv.sqlQuery("select pf_id,prod(yldrate+1)-1 as yldrate from queryData group by pf_id");
>...
>-----------------------------------------------------
>@FunctionHint(
> input = @DataTypeHint("Double"),
> output = @DataTypeHint("Double")
>)
>public class ProductAggregateFunction extends AggregateFunction<Double, Product> {
>
>
> @Override
> public Double getValue(Product acc) {
> return acc.prod;
> }
> @Override
> public Product createAccumulator() {
> return new Product();
> }
> public void accumulate(Product acc, Double iValue) {
> acc.prod *= iValue;
> }
> public void retract(Product acc, Double iValue) {
> acc.prod /= iValue;
> }
> public void merge(Product acc, Iterable<Product> it) {
> for (Product p : it) {
> accumulate(acc, p.prod);
> }
> }
> public void resetAccumulator(Product acc) {
> acc.prod = 1D;
> }
>}
>
>
>
>
>
>
Re:Re:SqlValidatorException: No match found for function signature
prod()
Posted by Ye Chen <ch...@163.com>.
应该是继承scalaFunction ?
在 2021-02-22 10:25:31,"xiaoyue" <18...@163.com> 写道:
>捞一下自己,在线等大佬们的回复 _(:з」∠)_
>
>
>
>
>
>
>
>在 2021-02-20 13:14:18,"xiaoyue" <18...@163.com> 写道:
>
>我在使用flinksql1.11的udaf时出现SqlValidatorException: No match found for function signature prod(<NUMERIC>),请求大佬帮忙看看_(:з」∠)_
>
>以下是代码:
>-----------------------------------------------------
>...
> stableEnv.createTemporarySystemFunction("prod", ProductAggregateFunction.class);
> Table resultTable = stableEnv.sqlQuery("select pf_id,prod(yldrate+1)-1 as yldrate from queryData group by pf_id");
>...
>-----------------------------------------------------
>@FunctionHint(
> input = @DataTypeHint("Double"),
> output = @DataTypeHint("Double")
>)
>public class ProductAggregateFunction extends AggregateFunction<Double, Product> {
>
>
> @Override
> public Double getValue(Product acc) {
> return acc.prod;
> }
> @Override
> public Product createAccumulator() {
> return new Product();
> }
> public void accumulate(Product acc, Double iValue) {
> acc.prod *= iValue;
> }
> public void retract(Product acc, Double iValue) {
> acc.prod /= iValue;
> }
> public void merge(Product acc, Iterable<Product> it) {
> for (Product p : it) {
> accumulate(acc, p.prod);
> }
> }
> public void resetAccumulator(Product acc) {
> acc.prod = 1D;
> }
>}
>
>
>
>
>
>
Re:SqlValidatorException: No match found for function signature
prod()
Posted by xiaoyue <18...@163.com>.
捞一下自己,在线等大佬们的回复 _(:з」∠)_
在 2021-02-20 13:14:18,"xiaoyue" <18...@163.com> 写道:
我在使用flinksql1.11的udaf时出现SqlValidatorException: No match found for function signature prod(<NUMERIC>),请求大佬帮忙看看_(:з」∠)_
以下是代码:
-----------------------------------------------------
...
stableEnv.createTemporarySystemFunction("prod", ProductAggregateFunction.class);
Table resultTable = stableEnv.sqlQuery("select pf_id,prod(yldrate+1)-1 as yldrate from queryData group by pf_id");
...
-----------------------------------------------------
@FunctionHint(
input = @DataTypeHint("Double"),
output = @DataTypeHint("Double")
)
public class ProductAggregateFunction extends AggregateFunction<Double, Product> {
@Override
public Double getValue(Product acc) {
return acc.prod;
}
@Override
public Product createAccumulator() {
return new Product();
}
public void accumulate(Product acc, Double iValue) {
acc.prod *= iValue;
}
public void retract(Product acc, Double iValue) {
acc.prod /= iValue;
}
public void merge(Product acc, Iterable<Product> it) {
for (Product p : it) {
accumulate(acc, p.prod);
}
}
public void resetAccumulator(Product acc) {
acc.prod = 1D;
}
}