????????????????????????????????????????????_(:??????)_
------------------ ???????? ------------------ ??????: "user-zh" <chenye...@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" <18242988...@163.com> ?????? >?????????????????????????????? _(:??????)_ > > > > > > > >?? 2021-02-20 13:14:18??"xiaoyue" <18242988...@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; > } >} > > > > > >