[
https://issues.apache.org/jira/browse/FLINK-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16564978#comment-16564978
]
Xingcan Cui commented on FLINK-9977:
------------------------------------
It seems I've found another problem of the "Arithmetic functions". Most of the
functions added in Flink only consider double type parameters (e.g., {{def
log(base: Double, x: Double): Double =...}}). However, the decimal literals in
a SQL are automatically cast to {{BigDecimal}}, which cannot be directly
applied (e.g., {{LOG(3.0, 9.0)}} throws an unsupported call exception).
Explicit type cast can make these functions accessible, but is surely
unacceptable.
For all these functions, we could either automatically cast the {{BigDecimal}}
type to {{Double}} or add corresponding methods for {{BigDecimal}}.
Personally, I prefer the former solution because it's much easier (especially
for functions take multiple numeric params). Besides, for a great number of
functions, we could not directly calculate on {{BigDecimal}} (e.g., to
calculate log, we should first get the double value from a {{BigDecimal}} and
that's equivalent to a pre-cast). The drawback of this solution may be the
wrong return type. The later solution looks like a more formal one.
What do you think?
> Refine the docs for Table/SQL built-in functions
> ------------------------------------------------
>
> Key: FLINK-9977
> URL: https://issues.apache.org/jira/browse/FLINK-9977
> Project: Flink
> Issue Type: Improvement
> Components: Documentation
> Reporter: Xingcan Cui
> Assignee: Xingcan Cui
> Priority: Minor
>
> There exist some syntax errors or inconsistencies in documents and Scala docs
> of the Table/SQL built-in functions. This issue aims to make some
> improvements to them.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)