[ https://issues.apache.org/jira/browse/FLINK-10014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16565027#comment-16565027 ]
Xingcan Cui commented on FLINK-10014: ------------------------------------- Copied from another JIRA. [~xccui]: 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. [~twalthr]: We should first investigate if we can let Calcite convert simple literals to double. Explicit casts are not a nice solution but at least they make the operation explicit. If we would automatically cast the type to double we would lose precision which might be unintended. A corresponding BigDecimal method would also return a BigDecimal and would cause high serialization overhead for Flink applications even though a simple double would do the job. > Fix the decimal literal parameter problem for arithmetic functions in Table > --------------------------------------------------------------------------- > > Key: FLINK-10014 > URL: https://issues.apache.org/jira/browse/FLINK-10014 > Project: Flink > Issue Type: Improvement > Components: Table API & SQL > Reporter: Xingcan Cui > Priority: Major > > Most of the arithmetic functions added in Flink only consider double type > parameters (e.g., def log(base: Double, x: Double): Double =...). However, by > Calcite, the decimal literals 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 seems > not an elegant solution. > We could consider automatically casting the BigDecimal type to Double or > adding the corresponding methods for BigDecimal type. -- This message was sent by Atlassian JIRA (v7.6.3#76005)