public static class IsmFormat.IsmRecordCoder<V> extends 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:
Coder.Context, Coder.NonDeterministicException| Modifier and Type | Method and Description |
|---|---|
boolean |
consistentWithEquals() |
IsmFormat.IsmRecord<V> |
decode(InputStream inStream) |
void |
encode(IsmFormat.IsmRecord<V> value,
OutputStream outStream) |
<V,T> int |
encodeAndHash(List<?> keyComponents,
RandomAccessData keyBytesToMutate)
Computes the shard id for the given key component(s).
|
<V,T> int |
encodeAndHash(List<?> keyComponents,
RandomAccessData keyBytesToMutate,
List<Integer> keyComponentByteOffsetsToMutate)
Computes the shard id for the given key component(s).
|
boolean |
equals(Object other) |
List<Coder<?>> |
getCoderArguments() |
<T> Coder<T> |
getKeyComponentCoder(int index)
Returns the key coder at the specified index.
|
List<Coder<?>> |
getKeyComponentCoders()
Returns the list of key component coders.
|
int |
getNumberOfShardKeyCoders(List<?> keyComponents) |
Coder<V> |
getValueCoder()
Returns the value coder.
|
<V,T> int |
hash(List<?> keyComponents)
Computes the shard id for the given key component(s).
|
int |
hashCode() |
static <V> IsmFormat.IsmRecordCoder<V> |
of(int numberOfShardKeyCoders,
int numberOfMetadataShardKeyCoders,
List<Coder<?>> keyComponentCoders,
Coder<V> valueCoder)
Returns an IsmRecordCoder with the specified key component coders, value coder.
|
Object |
structuralValue(IsmFormat.IsmRecord<V> record) |
void |
verifyDeterministic() |
decode, encode, getEncodedElementByteSize, getEncodedTypeDescriptor, isRegisterByteSizeObserverCheap, registerByteSizeObserver, verifyDeterministic, verifyDeterministicpublic static <V> IsmFormat.IsmRecordCoder<V> of(int numberOfShardKeyCoders, int numberOfMetadataShardKeyCoders, List<Coder<?>> keyComponentCoders, Coder<V> valueCoder)
public List<Coder<?>> getKeyComponentCoders()
public <T> Coder<T> getKeyComponentCoder(int index)
public void encode(IsmFormat.IsmRecord<V> value, OutputStream outStream) throws CoderException, IOException
encode in class Coder<IsmFormat.IsmRecord<V>>CoderExceptionIOExceptionpublic IsmFormat.IsmRecord<V> decode(InputStream inStream) throws CoderException, IOException
decode in class Coder<IsmFormat.IsmRecord<V>>CoderExceptionIOExceptionpublic int getNumberOfShardKeyCoders(List<?> keyComponents)
public <V,T> int hash(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(List<?> keyComponents, RandomAccessData keyBytesToMutate)
Mutates keyBytes such that when returned, contains the encoded
version of the key components.
public <V,T> int encodeAndHash(List<?> keyComponents, RandomAccessData keyBytesToMutate, List<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 List<Coder<?>> getCoderArguments()
getCoderArguments in class CustomCoder<IsmFormat.IsmRecord<V>>public void verifyDeterministic()
throws Coder.NonDeterministicException
verifyDeterministic in class CustomCoder<IsmFormat.IsmRecord<V>>Coder.NonDeterministicExceptionpublic boolean consistentWithEquals()
consistentWithEquals in class Coder<IsmFormat.IsmRecord<V>>public Object structuralValue(IsmFormat.IsmRecord<V> record)
structuralValue in class Coder<IsmFormat.IsmRecord<V>>Copyright © 2016–2017 The Apache Software Foundation. All rights reserved.