pub struct AvroSchema {
pub json_string: String,
}Expand description
A wrapper for an Avro schema in its JSON string representation.
Fields§
§json_string: StringThe Avro schema as a JSON string.
Implementations§
Source§impl AvroSchema
impl AvroSchema
Sourcepub fn fingerprint(
&self,
hash_type: FingerprintAlgorithm,
) -> Result<Fingerprint, ArrowError>
pub fn fingerprint( &self, hash_type: FingerprintAlgorithm, ) -> Result<Fingerprint, ArrowError>
Returns the fingerprint of the schema, computed using the specified FingerprintAlgorithm.
The fingerprint is computed over the schema’s Parsed Canonical Form
as defined by the Avro specification. Depending on hash_type, this
will return one of the supported Fingerprint variants:
Fingerprint::RabinforFingerprintAlgorithm::RabinFingerprint::MD5forFingerprintAlgorithm::MD5Fingerprint::SHA256forFingerprintAlgorithm::SHA256
Note: FingerprintAlgorithm::Id or FingerprintAlgorithm::Id64 cannot be used to generate a fingerprint
and will result in an error. If you intend to use a Schema Registry ID-based
wire format, either use SchemaStore::set or load the Fingerprint::Id directly via Fingerprint::load_fingerprint_id or for
Fingerprint::Id64 via Fingerprint::load_fingerprint_id64.
See also: https://avro.apache.org/docs/1.11.1/specification/#schema-fingerprints
§Errors
Returns an error if deserializing the schema fails, if generating the
canonical form of the schema fails, or if hash_type is FingerprintAlgorithm::Id.
§Examples
use arrow_avro::schema::{AvroSchema, FingerprintAlgorithm};
let avro = AvroSchema::new("\"string\"".to_string());
let fp = avro.fingerprint(FingerprintAlgorithm::Rabin).unwrap();Trait Implementations§
Source§impl Clone for AvroSchema
impl Clone for AvroSchema
Source§fn clone(&self) -> AvroSchema
fn clone(&self) -> AvroSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AvroSchema
impl Debug for AvroSchema
Source§impl<'de> Deserialize<'de> for AvroSchema
impl<'de> Deserialize<'de> for AvroSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AvroSchema
impl PartialEq for AvroSchema
Source§impl Serialize for AvroSchema
impl Serialize for AvroSchema
Source§impl TryFrom<&Schema> for AvroSchema
impl TryFrom<&Schema> for AvroSchema
Source§fn try_from(schema: &ArrowSchema) -> Result<Self, Self::Error>
fn try_from(schema: &ArrowSchema) -> Result<Self, Self::Error>
Converts an ArrowSchema to AvroSchema, delegating to
AvroSchema::from_arrow_with_options with None so that the
union null ordering is decided by Nullability::default().
Source§type Error = ArrowError
type Error = ArrowError
impl Eq for AvroSchema
impl StructuralPartialEq for AvroSchema
Auto Trait Implementations§
impl Freeze for AvroSchema
impl RefUnwindSafe for AvroSchema
impl Send for AvroSchema
impl Sync for AvroSchema
impl Unpin for AvroSchema
impl UnsafeUnpin for AvroSchema
impl UnwindSafe for AvroSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.