Skip to content

Commit

Permalink
Fix dict order in logical type to be consistent with C++ (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyxu authored Jan 10, 2023
1 parent bf5cb63 commit 1b32df9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rust/src/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ impl TryFrom<&DataType> for LogicalType {
DataType::Dictionary(key_type, value_type) => {
format!(
"dict:{}:{}:{}",
Self::try_from(key_type.as_ref())?.0,
Self::try_from(value_type.as_ref())?.0,
Self::try_from(key_type.as_ref())?.0,
// Arrow C++ Dictionary has "ordered:bool" field, but it does not exist in `arrow-rs`.
false
)
}
Expand Down Expand Up @@ -179,8 +180,8 @@ impl TryFrom<&LogicalType> for DataType {
if splits.len() != 4 {
Err(Error::Schema(format!("Unsupport dictionary type: {}", lt)))
} else {
let index_type: DataType = (&LogicalType::from(splits[1])).try_into()?;
let value_type: DataType = (&LogicalType::from(splits[2])).try_into()?;
let value_type: DataType = (&LogicalType::from(splits[1])).try_into()?;
let index_type: DataType = (&LogicalType::from(splits[2])).try_into()?;
Ok(Dictionary(Box::new(index_type), Box::new(value_type)))
}
}
Expand Down

0 comments on commit 1b32df9

Please sign in to comment.