jiangjiangtian opened a new issue, #7082:
URL: https://github.com/apache/incubator-gluten/issues/7082

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   The SQL as follows will produce wrong result:
   ```SQL
   select value / (value + 0.00001) from table;
   ```
   where value is decimal(20, 0).
   The result type needs to be `decimal(38, 19)`. But during calculation, the 
actual result type is `decimal(38, 20)`:
   <img width="125" alt="image" 
src="https://github.com/user-attachments/assets/1d0b95d8-c93f-4ef9-bb79-193a8e159427";>
   The reason is that the type of the subexpression `value + 0.00001` will be 
rescaled to `decimal(27, 5)`:
   <img width="202" alt="截屏2024-09-02 17 15 29" 
src="https://github.com/user-attachments/assets/764f0009-ec13-4fe9-95ef-37e1d4bfb3d5";>
   But we don't notice it when we rescale the topmost expression:
   <img width="206" alt="截屏2024-09-02 17 16 06" 
src="https://github.com/user-attachments/assets/a73ef178-8499-4ff2-aa66-4dc7d227d3d6";>
   
   ### Spark version
   
   None
   
   ### Spark configurations
   
   _No response_
   
   ### System information
   
   _No response_
   
   ### Relevant logs
   
   _No response_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to