This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new d454fdd8e7 feat: support casting from null to float16 (#8535)
d454fdd8e7 is described below
commit d454fdd8e7262f099e8f521858053f94f4cc5b75
Author: Chen Chongchen <[email protected]>
AuthorDate: Thu Oct 2 18:43:55 2025 +0800
feat: support casting from null to float16 (#8535)
# Which issue does this PR close?
# Rationale for this change
select arrow_cast(null, 'Float16') is not supported currently.
# What changes are included in this PR?
support casting from null to float16.
# Are these changes tested?
UT
# Are there any user-facing changes?
No
---
arrow-cast/src/cast/mod.rs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arrow-cast/src/cast/mod.rs b/arrow-cast/src/cast/mod.rs
index f0e5487a66..f89b7eab7f 100644
--- a/arrow-cast/src/cast/mod.rs
+++ b/arrow-cast/src/cast/mod.rs
@@ -104,6 +104,7 @@ pub fn can_cast_types(from_type: &DataType, to_type:
&DataType) -> bool {
| UInt8
| Int16
| UInt16
+ | Float16
| Int32
| UInt32
| Float32
@@ -760,6 +761,7 @@ pub fn cast_with_options(
| UInt8
| Int16
| UInt16
+ | Float16
| Int32
| UInt32
| Float32
@@ -7979,6 +7981,7 @@ mod tests {
typed_test!(UInt32Array, UInt32, UInt32Type);
typed_test!(UInt64Array, UInt64, UInt64Type);
+ typed_test!(Float16Array, Float16, Float16Type);
typed_test!(Float32Array, Float32, Float32Type);
typed_test!(Float64Array, Float64, Float64Type);