@@ -24,19 +24,28 @@ use arrow::util::display::{ArrayFormatter, DisplayIndex, FormatOptions, FormatRe
2424use arrow_schema:: extension:: { Bool8 , ExtensionType } ;
2525use std:: fmt:: Write ;
2626
27- /// Defines the extension type logic for the canonical `arrow.bool8` extension type.
27+ /// Defines the extension type logic for the canonical `arrow.bool8` extension type. This extension
28+ /// type allows storing a Boolean value in a single byte, instead of a single bit.
2829///
29- /// See [`DFExtensionType`] for information on DataFusion's extension type mechanism.
30+ /// See [`DFExtensionType`] for information on DataFusion's extension type mechanism. See also
31+ /// [`Bool8`] for the implementation of arrow-rs, which this type uses internally.
32+ ///
33+ /// <https://arrow.apache.org/docs/format/CanonicalExtensions.html#bit-boolean>
3034#[ derive( Debug , Clone ) ]
3135pub struct DFBool8 ( Bool8 ) ;
3236
3337impl DFBool8 {
3438 /// Creates a new [`DFBool8`], validating that the storage type is compatible with the
3539 /// extension type.
40+ ///
41+ /// Even though [`DFBool8`] only supports a single storage type ([`DataType::Int8`]), passing-in
42+ /// the storage type allows conveniently validating whether this extension type is compatible
43+ /// with a given [`DataType`].
3644 pub fn try_new (
3745 data_type : & DataType ,
3846 metadata : <Bool8 as ExtensionType >:: Metadata ,
3947 ) -> Result < Self > {
48+ // Validates the storage type
4049 Ok ( Self ( <Bool8 as ExtensionType >:: try_new (
4150 data_type, metadata,
4251 ) ?) )
@@ -72,7 +81,7 @@ impl DFExtensionType for DFBool8 {
7281 }
7382}
7483
75- /// Pretty printer for binary UUID values.
84+ /// Pretty printer for binary bool8 values.
7685#[ derive( Debug , Clone , Copy ) ]
7786struct Bool8ValueDisplayIndex < ' a > {
7887 array : & ' a Int8Array ,
0 commit comments