theirix commented on PR #19303:
URL: https://github.com/apache/datafusion/pull/19303#issuecomment-3649688403

   > @theirix this now works by always casting exponents to float, this is the 
same behavior as Postgres:
   > 
   > ```sql
   > select pg_typeof(pow(2, 3));
   >     pg_typeof     
   > ------------------
   >  double precision
   > (1 row)
   > ```
   > 
   > Here is the full table of behavior:
   > 
   > ```
   >   | Base    | Exponent | DataFusion | PostgreSQL         |
   >   |---------|----------|------------|--------------------|
   >   | int     | int      | Float64    | double precision ✓ |
   >   | int     | float    | Float64    | double precision ✓ |
   >   | decimal | int      | Decimal128 | numeric ✓          |
   >   | decimal | float    | Decimal128 | numeric ✓          |
   > ```
   
   Great, it makes sense.
   
   > The only difference I can see is that `pow(2.5, 2)` returns `numeric` in 
postgres and `float64` in datafusion, but this is because `select 
pg_typeof(2.5)` is `numeric`.
   
   Yes. I suppose that after `parse_float_as_decimal` Datafusion's behaviour 
will be aligned to Postgres automatically.
   
   


-- 
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