alamb commented on PR #3018:
URL: 
https://github.com/apache/arrow-datafusion/pull/3018#issuecomment-1203781577

   Not that it matters, but I found it quite neat that these casts are 
evaluated at plan time (as in after simplify_expressions we see that timestamps 
have been resolved to `1623344460000000000` etc. 🎉 
   
   ```sql
   ❯ explain verbose SELECT col1, col2 FROM (VALUES (TIMESTAMP '2021-06-10 
17:01:00Z', DATE '2004-04-09')) as t (col1, col2);
   
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | plan_type                                             | plan               
                                                                                
                                                                                
        |
   
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | initial_logical_plan                                  | Projection: 
#t.col1, #t.col2                                                                
                                                                                
               |
   |                                                       |   Projection: 
#t.column1 AS col1, #t.column2 AS col2, alias=t                                 
                                                                                
             |
   |                                                       |     Projection: 
#column1, #column2, alias=t                                                     
                                                                                
           |
   |                                                       |       Values: 
(CAST(Utf8("2021-06-10 17:01:00Z") AS Timestamp(Nanosecond, None)), 
CAST(Utf8("2004-04-09") AS Date32))                                             
                         |
   | logical_plan after simplify_expressions               | Projection: 
#t.col1, #t.col2                                                                
                                                                                
               |
   |                                                       |   Projection: 
#t.column1 AS col1, #t.column2 AS col2, alias=t                                 
                                                                                
             |
   |                                                       |     Projection: 
#column1, #column2, alias=t                                                     
                                                                                
           |
   |                                                       |       Values: 
(TimestampNanosecond(1623344460000000000, None) AS CAST(Utf8("2021-06-10 
17:01:00Z") AS Timestamp(Nanosecond, None)), Date32("12517") AS 
CAST(Utf8("2004-04-09") AS Date32)) |
   ```


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

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

Reply via email to