HaoYang670 opened a new issue, #3663:
URL: https://github.com/apache/arrow-datafusion/issues/3663

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   ```sql
   ❯ create table t as select 1 as a;
   
   ❯ explain select a / 0 from t;
   +---------------+--------------------------------------------------+
   | plan_type     | plan                                             |
   +---------------+--------------------------------------------------+
   | logical_plan  | Projection: #t.a / Int64(0)                      |
   |               |   TableScan: t projection=[a]                    |
   | physical_plan | ProjectionExec: expr=[a@0 / 0 as t.a / Int64(0)] |
   |               |   MemoryExec: partitions=1, partition_sizes=[1]  |
   |               |                                                  |
   +---------------+--------------------------------------------------+
   
   ❯ select a / 0 from t;
   ArrowError(DivideByZero)
   
   ❯ explain select 1 / 0 from t;
   +---------------+----------------------------------------------------+
   | plan_type     | plan                                               |
   +---------------+----------------------------------------------------+
   | logical_plan  | Projection: Int64(NULL) AS Int64(1) / Int64(0)     |
   |               |   TableScan: t projection=[a]                      |
   | physical_plan | ProjectionExec: expr=[NULL as Int64(1) / Int64(0)] |
   |               |   MemoryExec: partitions=1, partition_sizes=[1]    |
   |               |                                                    |
   +---------------+----------------------------------------------------+
   2 rows in set. Query took 0.004 seconds.
   ```
   
   **Describe the solution you'd like**
   A clear and concise description of what you want to happen.
   
   When the divisor is the scalar zero, We could one of these:
   1. Simplify the expression to `null` -> `A / 0 -> NULL`
   2. Give the `DivideByZero` error: `A / 0 -> Err(DivideByZero)`
   
   
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features 
you've considered.
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to