Skip to content

Commit 8c2f9f2

Browse files
authored
feat: expand arrow type conversion test (#1295)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> Helps #1277 ## What changes are included in this PR? <!-- Provide a summary of the modifications in this PR. List the main changes such as new features, bug fixes, refactoring, or any other updates. --> This expands the `test_type_conversion` test with the specific `DataType::Dictionary` type. Props to @phillipleblanc for this, as I noticed the extra coverage on his PR which I believe is very useful to capture[^1]. [^1]: I was looking to add similar to #1293, but it was merged just before I pushed the changes 😆
1 parent 47d990e commit 8c2f9f2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

crates/iceberg/src/arrow/schema.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,5 +1688,22 @@ mod tests {
16881688
]));
16891689
assert_eq!(arrow_type, type_to_arrow_type(&iceberg_type).unwrap());
16901690
}
1691+
1692+
// test dictionary type
1693+
{
1694+
let arrow_type =
1695+
DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::Int8));
1696+
let iceberg_type = Type::Primitive(PrimitiveType::Int);
1697+
assert_eq!(
1698+
iceberg_type,
1699+
arrow_type_to_type(&arrow_type).unwrap(),
1700+
"Expected dictionary conversion to use the contained value"
1701+
);
1702+
1703+
let arrow_type =
1704+
DataType::Dictionary(Box::new(DataType::Utf8), Box::new(DataType::Boolean));
1705+
let iceberg_type = Type::Primitive(PrimitiveType::Boolean);
1706+
assert_eq!(iceberg_type, arrow_type_to_type(&arrow_type).unwrap());
1707+
}
16911708
}
16921709
}

0 commit comments

Comments
 (0)