waitingkuo commented on issue #3664:
URL: https://github.com/apache/arrow-rs/issues/3664#issuecomment-1420335167

   > @tustvold sorry probably I have expressed not very clear. The entire idea 
is to cast user provided Utf8 value to Timestamp with timezone like
   > 
   > ```
   > select "2023-01-01 04:05:06.789-8"::timestamptz union all
   > select "2023-01-01 04:05:06.789-7"::timestamptz
   > ```
   > 
   > In Datafusion such transformation happens through arrow-rs `cast` function 
which has single target datatype , in this specific case I believe it would be 
`DataType::Timestamp(TimeUnit::Nanosecond, Something)` where is Something is 
not very clear for me. Presumably we can use `+00:00` or `None`, I'm struggling 
if we can lose precision in this case.
   
   I think casting to timestamptz should return the same time zone (the one 
shown in `SHOW TIME ZONE`) in the same query.
   
   i'm in UTC+8
   
   in postgresql, `select '2023-01-01 04:05:06.789-8'::timestamptz` returns 
timestamptz in UTC+8
   ```bash
   willy=# select '2023-01-01T04:05:06.789-8'::timestamptz;
           timestamptz         
   ----------------------------
    2023-01-01 20:05:06.789+08
   (1 row)
   ```
   
   ```bash
   willy=# select '2023-01-01 04:05:06.789-7'::timestamptz;
           timestamptz         
   ----------------------------
    2023-01-01 19:05:06.789+08
   (1 row)
   ```
   
   so in your query, the union return +8 time zone (my current time zone) for 
me in postgresql.
   
   I think we could consider either fix it to +00:00 or  current timezone 
   
   
   
   


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

Reply via email to