mmuru commented on a change in pull request #969:
URL: https://github.com/apache/arrow-datafusion/pull/969#discussion_r702591953
##########
File path: python/src/types.rs
##########
@@ -53,6 +54,11 @@ fn data_type_id(id: &i32) -> Result<DataType,
errors::DataFusionError> {
12 => DataType::Float64,
13 => DataType::Utf8,
14 => DataType::Binary,
+ 16 => data_type_date(str_ob)?,
+ 17 => data_type_date(str_ob)?,
+ 18 => data_type_timestamp(str_ob)?,
+ 19 => data_type_timestamp(str_ob)?,
+ 20 => data_type_timestamp(str_ob)?,
Review comment:
These checks not required. Instead you could do the following
````
if str_ob.contains("date") {
Ok(data_type_date(str_ob)?)
} else if str_ob.contains("timestamp") {
Ok(data_type_timestamp(str_ob)?)
} else {
Ok(match id {
1 => DataType::Boolean,
2 => DataType::UInt8,
3 => DataType::Int8,
4 => DataType::UInt16,
5 => DataType::Int16,
6 => DataType::UInt32,
7 => DataType::Int32,
8 => DataType::UInt64,
9 => DataType::Int64,
10 => DataType::Float16,
11 => DataType::Float32,
12 => DataType::Float64,
13 => DataType::Utf8,
14 => DataType::Binary,
34 => DataType::LargeUtf8,
35 => DataType::LargeBinary,
other => {
return Err(errors::DataFusionError::Common(format!(
"The type {} is not valid",
other
)))
}
})
}
````
--
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]