public static class IsmFormat.IsmRecordCoder<V> extends org.apache.beam.sdk.coders.CustomCoder<IsmFormat.IsmRecord<V>>
Coder for IsmFormat.IsmRecords.
Note that this coder standalone will not produce an Ism file. This coder can be used to
materialize a PCollection of IsmFormat.IsmRecords. Only when this coder is combined with
an IsmSink will one produce an Ism file.
The IsmFormat.IsmRecord encoded format is:
| Modifier and Type | Method and Description |
|---|---|
boolean |
consistentWithEquals() |
IsmFormat.IsmRecord<V> |
decode(java.io.InputStream inStream) |
void |
encode(IsmFormat.IsmRecord<V> value,
java.io.OutputStream outStream) |
<V,T> int |
encodeAndHash(java.util.List<?> keyComponents,
RandomAccessData keyBytesToMutate)
Computes the shard id for the given key component(s).
|
<V,T> int |
encodeAndHash(java.util.List<?> keyComponents,
RandomAccessData keyBytesToMutate,
java.util.List<java.lang.Integer> keyComponentByteOffsetsToMutate)
Computes the shard id for the given key component(s).
|
boolean |
equals(java.lang.Object other) |
java.util.List<org.apache.beam.sdk.coders.Coder<?>> |
getCoderArguments() |
<T> org.apache.beam.sdk.coders.Coder<T> |
getKeyComponentCoder(int index)
Returns the key coder at the specified index.
|
java.util.List<org.apache.beam.sdk.coders.Coder<?>> |
getKeyComponentCoders()
Returns the list of key component coders.
|
int |
getNumberOfShardKeyCoders(java.util.List<?> keyComponents) |
org.apache.beam.sdk.coders.Coder<V> |
getValueCoder()
Returns the value coder.
|
<V,T> int |
hash(java.util.List<?> keyComponents)
Computes the shard id for the given key component(s).
|
int |
hashCode() |
static <V> IsmFormat.IsmRecordCoder<V> |
of(int numberOfShardKeyCoders,
int numberOfMetadataShardKeyCoders,
java.util.List<org.apache.beam.sdk.coders.Coder<?>> keyComponentCoders,
org.apache.beam.sdk.coders.Coder<V> valueCoder)
Returns an IsmRecordCoder with the specified key component coders, value coder.
|
java.lang.Object |
structuralValue(IsmFormat.IsmRecord<V> record) |
void |
verifyDeterministic() |
public static <V> IsmFormat.IsmRecordCoder<V> of(int numberOfShardKeyCoders, int numberOfMetadataShardKeyCoders, java.util.List<org.apache.beam.sdk.coders.Coder<?>> keyComponentCoders, org.apache.beam.sdk.coders.Coder<V> valueCoder)
public java.util.List<org.apache.beam.sdk.coders.Coder<?>> getKeyComponentCoders()
public <T> org.apache.beam.sdk.coders.Coder<T> getKeyComponentCoder(int index)
public org.apache.beam.sdk.coders.Coder<V> getValueCoder()
public void encode(IsmFormat.IsmRecord<V> value, java.io.OutputStream outStream) throws org.apache.beam.sdk.coders.CoderException, java.io.IOException
encode in class org.apache.beam.sdk.coders.Coder<IsmFormat.IsmRecord<V>>org.apache.beam.sdk.coders.CoderExceptionjava.io.IOExceptionpublic IsmFormat.IsmRecord<V> decode(java.io.InputStream inStream) throws org.apache.beam.sdk.coders.CoderException, java.io.IOException
decode in class org.apache.beam.sdk.coders.Coder<IsmFormat.IsmRecord<V>>org.apache.beam.sdk.coders.CoderExceptionjava.io.IOExceptionpublic int getNumberOfShardKeyCoders(java.util.List<?> keyComponents)
public <V,T> int hash(java.util.List<?> keyComponents)
The shard keys are encoded into their byte representations and hashed using the
32-bit murmur3 algorithm, x86 variant (little-endian variant),
using 1225801234 as the seed value. We ensure that shard ids for
metadata keys and normal keys do not overlap.
public <V,T> int encodeAndHash(java.util.List<?> keyComponents,
RandomAccessData keyBytesToMutate)
Mutates keyBytes such that when returned, contains the encoded
version of the key components.
public <V,T> int encodeAndHash(java.util.List<?> keyComponents,
RandomAccessData keyBytesToMutate,
java.util.List<java.lang.Integer> keyComponentByteOffsetsToMutate)
Mutates keyBytes such that when returned, contains the encoded
version of the key components. Also, mutates keyComponentByteOffsetsToMutate to
store the location where each key component's encoded byte representation ends within
keyBytes.
public java.util.List<org.apache.beam.sdk.coders.Coder<?>> getCoderArguments()
getCoderArguments in class org.apache.beam.sdk.coders.CustomCoder<IsmFormat.IsmRecord<V>>public void verifyDeterministic()
throws org.apache.beam.sdk.coders.Coder.NonDeterministicException
verifyDeterministic in class org.apache.beam.sdk.coders.CustomCoder<IsmFormat.IsmRecord<V>>org.apache.beam.sdk.coders.Coder.NonDeterministicExceptionpublic boolean consistentWithEquals()
consistentWithEquals in class org.apache.beam.sdk.coders.Coder<IsmFormat.IsmRecord<V>>public java.lang.Object structuralValue(IsmFormat.IsmRecord<V> record)
structuralValue in class org.apache.beam.sdk.coders.Coder<IsmFormat.IsmRecord<V>>public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object