alamb commented on a change in pull request #10005:
URL: https://github.com/apache/arrow/pull/10005#discussion_r612805624



##########
File path: rust/datafusion/src/sql/planner.rs
##########
@@ -1498,6 +1498,7 @@ pub fn convert_data_type(sql: &SQLDataType) -> 
Result<DataType> {
         SQLDataType::Double => Ok(DataType::Float64),
         SQLDataType::Char(_) | SQLDataType::Varchar(_) => Ok(DataType::Utf8),
         SQLDataType::Timestamp => Ok(DataType::Timestamp(TimeUnit::Nanosecond, 
None)),
+        SQLDataType::Time => Ok(DataType::Timestamp(TimeUnit::Millisecond, 
None)),

Review comment:
       @velvia 
   
   > Is this only for time of the day?
   
   That is my understanding 
   
   > What I really need is a convenient way to cast things 
toTimestamp(Milliseconds, None) .. what do you recommend?
   
   I recommend adding a new function that takes a string parameter that is 
interpreted at an Arrow `DataType` and calls the appropriate underlying arrow 
cast function. This way we can specify the arrow type directly without having 
to worry about an incomplete mapping of SQL type <--> Arrow type
   
   Perhaps something like
   
   ```
   select arrow_cast(my_col, 'Timestamp(Milliseconds, None)'
   ```
   
   I haven't thought carefully about how we would parse the strings back to 
`DateTime` but I think we might be able to press some existing serde code into 
use, perhaps.
   
   What do you think @jorgecarleitao , @seddonm1 , @returnString ?
   




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

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


Reply via email to