[
https://issues.apache.org/jira/browse/IMPALA-11555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17611346#comment-17611346
]
ZhuMinghui commented on IMPALA-11555:
-------------------------------------
[~stigahuang]
We have a function whose parameter type and return value type are both decimal.
The data is of various precisions, which may be decimal(9, 2), decimal(5, 1),
and so on. We need to write multiple functions, so It is convenient that the
function support arbitrary precision.
When creating function, use the following statement:
{code:java}
CREATE AGGREGATE FUNCTION function_name(DECIMAL(*, *), ...) RETURNS DECIMAL(*,
*) INTERMEDIATE STRING LOCATION 'xxx' serialize_fn='xxx' update_fn='xxx'
init_fn='xxx' merge_fn='xxx' finalize_fn='xxx';{code}
When deleting the function:
{code:java}
DROP FUNCTION function_name(DECIMAL(*, *), ...); {code}
When querying data of various precisions:
{code:java}
SELECT function_name(174.89, ...), function_name(10.1, ...) FROM table_name;
{code}
The precision of the returned value is the same as the parameter.
> external Udf support decimal(*,*)
> ---------------------------------
>
> Key: IMPALA-11555
> URL: https://issues.apache.org/jira/browse/IMPALA-11555
> Project: IMPALA
> Issue Type: New Feature
> Reporter: ZhuMinghui
> Assignee: ZhuMinghui
> Priority: Major
>
> External udf supports decimal(*, *), need to increase syntax parsing, and
> remove some restrictions.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]