[
https://issues.apache.org/jira/browse/FLINK-27952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Flink Jira Bot updated FLINK-27952:
-----------------------------------
Labels: pull-request-available stale-major (was: pull-request-available)
I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help
the community manage its development. I see this issues has been marked as
Major but is unassigned and neither itself nor its Sub-Tasks have been updated
for 60 days. I have gone ahead and added a "stale-major" to the issue". If this
ticket is a Major, please either assign yourself or give an update. Afterwards,
please remove the label or in 7 days the issue will be deprioritized.
> Table UDF fails when using Double.POSITIVE_INFINITY as parameters
> -----------------------------------------------------------------
>
> Key: FLINK-27952
> URL: https://issues.apache.org/jira/browse/FLINK-27952
> Project: Flink
> Issue Type: New Feature
> Components: Table SQL / Planner
> Reporter: Zhipeng Zhang
> Priority: Major
> Labels: pull-request-available, stale-major
> Attachments: image-2022-06-21-00-19-12-151.png
>
>
>
> The following code fails and throws NumberFormatException when casting
> Double.POSITIVE_INFINITY to BigDecimal.
> {code:java}
> @Test
> public void testTableUdf() {
> StreamExecutionEnvironment env =
> StreamExecutionEnvironment.getExecutionEnvironment();
> DataStream <Row> data = env.fromElements(Row.of(1.), Row.of(2.));
> StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);
> Table table = tEnv.fromDataStream(data).as("f0");
> Double[][] d = new Double[][]{new Double[]{1.0,
> Double.POSITIVE_INFINITY}};
> Expression[] expressions = new Expression[2];
> expressions[0] = org.apache.flink.table.api.Expressions.call(MyUDF.class,
> $("f0"), d);
> expressions[1] = org.apache.flink.table.api.Expressions.call(MyUDF.class,
> $("f0"), d);
> table.addColumns(expressions)
> .as("f0", "output", "output2")
> .execute().print();
> }
> public static class MyUDF extends ScalarFunction {
> public Integer eval(Integer num, Double[][] add) {
> return (int)(num + add[0][0]);
> }
> } {code}
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)