[
https://issues.apache.org/jira/browse/CALCITE-7725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18105767#comment-18105767
]
Mihai Budiu commented on CALCITE-7725:
--------------------------------------
At least the CHECKED_* operators do not correspond to any Calcite functions,
they are just internal representation of other operators, such as PLUS, MINUS
etc. There's a visitor which substitutes early PLUS with CHECKED_PLUS for all
the suitable types (e.g., integers) if the conformance requires checked
arithmetic.
The SAFE_* arithmetic operators are supposed to correspond to BigQuery
operators, which have only some limited forms; I am not sure they correctly
follow the BigQuery semantics. They do correspond to explicit functions.
SAFE_CAST is special: it never produces a runtime error, even when the
corresponding CAST would - it just returns NULL instead.
> Review safety of checked arithmetic operators
> ---------------------------------------------
>
> Key: CALCITE-7725
> URL: https://issues.apache.org/jira/browse/CALCITE-7725
> Project: Calcite
> Issue Type: Task
> Reporter: Ruben Q L
> Assignee: Mihai Budiu
> Priority: Major
> Fix For: 1.43.0
>
>
> At the moment, some checked arithmetic operators (CHECKED_PLUS,
> CHECKED_MINUS, CHECKED_TIMES, CHECKED_MINUS_PREFIX) are part of the
> {{safeOps}} set in {{RexSimplify#SafeRexVisitor}}, i.e. they are considered
> "safe" by {{RexSimplify#isSafeExpression}} .
> To be reviewed if these operations should be considered actually "safe",
> since they can throw at runtime (in case of overflow), similarly to e.g. a
> division by zero, which is considered "unsafe".
--
This message was sent by Atlassian Jira
(v8.20.10#820010)