[
https://issues.apache.org/jira/browse/CALCITE-5983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17762890#comment-17762890
]
Tanner Clary commented on CALCITE-5983:
---------------------------------------
[~julianhyde] This is a good point. I've written some basic tests included in a
past commit
[here|https://github.com/apache/calcite/blob/4e6c403842bebc519b1a1ededc9c2311059d7cb2/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java#L7156]
that convert those from strings, but not to them. I don't expect to encounter
any problems with that so I will include such tests in this case when I open
the PR.
For allowing them as literals, I think Postgres offers something like what's
seen in this question:
https://stackoverflow.com/questions/25927464/appropriate-values-for-infinity-infinity-in-postgres
> Add DIV and IEEE_DIVIDE functions (enabled in BigQuery library)
> ---------------------------------------------------------------
>
> Key: CALCITE-5983
> URL: https://issues.apache.org/jira/browse/CALCITE-5983
> Project: Calcite
> Issue Type: Improvement
> Reporter: Tanner Clary
> Assignee: Tanner Clary
> Priority: Major
>
> BigQuery offers the DIV function
> ([docs|https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions#div])
> and the IEEE_DIVIDE function
> ([docs|https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions#ieee_divide]).
>
> The {{DIV(x, y)}} function returns the result of integer division of X by Y.
> Division by zero returns an error. Division by -1 may overflow.
> The {{IEEE_DIVIDE(x, y)}} function divides X by Y; this function never fails.
> Returns Double. Unlike the division operator (/), this function does not
> generate errors for division by zero or overflow.
> {{DIV}} examples:
> 1. {{DIV(20, 4)}} should return {{5}}.
> 2. {{DIV(2.5, 1)}} should return {{2}} because the result is floored to the
> nearest integer.
> 3. {{DIV(20, 0)}} should throw an error like: {{Division by zero}}.
> {{IEEE_DIVIDE}} examples:
> 1. {{DIV(20, 4)}} should return {{5.0}}.
> 2. {{DIV(20, 0)}} should return {{Infinity}}.
> 3. {{DIV(0, 0)}} should return {{NaN}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)