Top Description Inners Fields Constructors Methods
org.apache.avro

public Class SchemaNormalization

extends Object
Class Inheritance
Imports
java.util.Map, .HashMap, java.io.IOException, java.nio.charset.StandardCharsets, java.security.MessageDigest, .NoSuchAlgorithmException

Collection of static methods for generating the canonical form of schemas (see toParsingForm) -- and fingerprints of canonical forms (fingerprint).

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
pack-priv static final long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static Appendable
public static byte[]
fingerprint(String fpName, byte[] data)

Returns a fingerprint of a string of bytes.

public static long
fingerprint64(byte[] data)

Returns the 64-bit Rabin Fingerprint (as recommended in the Avro spec) of a byte string.

public static byte[]
parsingFingerprint(String fpName, Schema s)

Returns fingerprint applied to the parsing canonical form of the supplied schema.

public static long
parsingFingerprint64(Schema s)

Returns fingerprint64 applied to the parsing canonical form of the supplied schema.

public static String
toParsingForm(Schema s)

Returns "Parsing Canonical Form" of a schema as defined by Avro spec.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY64back to summary
pack-priv static final long EMPTY64

Constructor Detail

SchemaNormalizationback to summary
private SchemaNormalization()

Method Detail

buildback to summary
private static Appendable build(Map<String, String> env, Schema s, Appendable o) throws IOException
fingerprintback to summary
public static byte[] fingerprint(String fpName, byte[] data) throws NoSuchAlgorithmException

Returns a fingerprint of a string of bytes. This string is presumed to contain a canonical form of a schema. The algorithm used to compute the fingerprint is selected by the argument fpName. If fpName equals the string "CRC-64-AVRO", then the result of fingerprint64 is returned in little-endian format. Otherwise, fpName is used as an algorithm name for MessageDigest#getInstance(String), which will throw NoSuchAlgorithmException if it doesn't recognize the name.

Recommended Avro practice dictates that "CRC-64-AVRO" is used for 64-bit fingerprints, "MD5" is used for 128-bit fingerprints, and "SHA-256" is used for 256-bit fingerprints.

fingerprint64back to summary
public static long fingerprint64(byte[] data)

Returns the 64-bit Rabin Fingerprint (as recommended in the Avro spec) of a byte string.

parsingFingerprintback to summary
public static byte[] parsingFingerprint(String fpName, Schema s) throws NoSuchAlgorithmException

Returns fingerprint applied to the parsing canonical form of the supplied schema.

parsingFingerprint64back to summary
public static long parsingFingerprint64(Schema s)

Returns fingerprint64 applied to the parsing canonical form of the supplied schema.

toParsingFormback to summary
public static String toParsingForm(Schema s)

Returns "Parsing Canonical Form" of a schema as defined by Avro spec.

org.apache.avro back to summary

private Class SchemaNormalization.FP64

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long[]

Constructor Summary

AccessConstructor and Description
private
FP64()

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FP_TABLEback to summary
private static final long[] FP_TABLE

Constructor Detail

FP64back to summary
private FP64()