Class NewPartition.Builder
- Enclosing class:
- NewPartition
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBooleanField(String name, boolean value) Add index field with Boolean type to the collection of index fields.addField(String name, IndexValue value) Add field to the collection of index fields.addHereTileField(String name, long tile) Add index field with HereTile type to the collection of index fields.addIntField(String name, long value) Add index field with Int type to the collection of index fields.addMetadata(String name, String value) Add metadata name-value pair to index metadata collection.addStringField(String name, String value) Add index field with String type to the collection of index fields.addTimeWindowField(String name, long time) Add index field with TimeWindow type to the collection of index fields.build()Builds a newNewPartition.withAdditionalMetadata(Optional<String> additionalMetadata) Deprecated.This field is not supported anymore.withChecksum(Optional<String> checksum) Sets the checksum.withCompressedDataSize(OptionalLong compressedDataSize) Sets the precomputed compressed data size.Sets the crc.withData(byte[] data) Sets the data source to be a byte array.withData(com.here.platform.data.client.scaladsl.NewPartition.Blob blob) Sets the data source from an existing blob.Sets the data source from file.withData(InputStream data) Sets the data source fromInputStream.withData(org.apache.pekko.stream.javadsl.Source<org.apache.pekko.util.ByteString, org.apache.pekko.NotUsed> data) Sets the data source fromSource.withDataSize(OptionalLong dataSize) Sets the dataSize.withFields(Map<String, IndexValue> fields) Set the index fields.Sets the layer name.withMetadata(Map<String, String> metadata) Sets the additional metadata.withPartition(String partition) Sets the partition id.withTimestamp(OptionalLong timestamp) Sets the stream record's creation timestamp.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addBooleanField
Add index field with Boolean type to the collection of index fields.- Parameters:
name- the name of index fieldvalue- the value of index field- Returns:
- this builder
-
addField
Add field to the collection of index fields.- Parameters:
name- the name of index fieldvalue- the value of index field- Returns:
- this builder
-
addHereTileField
Add index field with HereTile type to the collection of index fields.- Parameters:
name- the name of index fieldtile- the value of index field- Returns:
- this builder
-
addIntField
Add index field with Int type to the collection of index fields.- Parameters:
name- the name of index fieldvalue- the value of index field- Returns:
- this builder
-
addMetadata
Add metadata name-value pair to index metadata collection.- Parameters:
name- name of metadata fieldvalue- value of metadata field- Returns:
- this builder
-
addStringField
Add index field with String type to the collection of index fields.- Parameters:
name- the name of index fieldvalue- the value of index field- Returns:
- this builder
-
addTimeWindowField
Add index field with TimeWindow type to the collection of index fields.- Parameters:
name- the name of index fieldtime- the value of index field- Returns:
- this builder
-
build
Builds a newNewPartition.Partition id, layer name, and a data source are required.
DataSize, checksum, crc and compressedDataSize are optional. They are automatically calculated during data upload. additionalMetadata is now deprecated because it is no longer required by OLP services to route messages.
compressedDataSize is optional. It is calculated if catalog configuration has property to automatically compress data.
Some properties are tested for validity. If invalid a
IllegalArgumentExceptionis thrown. Tested properties include partition id and layer name. An invalid file (unreadable, or not found) results in an exception being thrown.- Returns:
- the NewPartition object
- Throws:
IllegalArgumentException- if any properties are not valid
-
withAdditionalMetadata
Deprecated.This field is not supported anymore. Please use the other available fields instead. Since OLP SDK > 2.1.Sets the additional metadata.- Parameters:
additionalMetadata- precomputed checksum value- Returns:
- this builder
-
withChecksum
Sets the checksum.- Parameters:
checksum- precomputed checksum value- Returns:
- this builder
-
withCompressedDataSize
Sets the precomputed compressed data size.- Parameters:
compressedDataSize- precomputed compressed data size- Returns:
- this builder
-
withCrc
Sets the crc.- Parameters:
crc- precomputed crc value- Returns:
- this builder
-
withData
public NewPartition.Builder withData(org.apache.pekko.stream.javadsl.Source<org.apache.pekko.util.ByteString, org.apache.pekko.NotUsed> data) Sets the data source fromSource.- Parameters:
data- Data for the partition, as Source- Returns:
- this builder
-
withData
Sets the data source fromInputStream. This is the less preferred method given the synchronous and blocking nature of InputStream.- Parameters:
data- Data for the partition, as an input stream- Returns:
- this builder
-
withData
Sets the data source to be a byte array.- Parameters:
data- Data for the partition, as a byte array- Returns:
- this builder
-
withData
Sets the data source from file.
- Parameters:
data- data for the partition, via a file- Returns:
- this builder
-
withData
Sets the data source from an existing blob.
- Parameters:
blob- data for the partition- Returns:
- this builder
-
withDataSize
Sets the dataSize.- Parameters:
dataSize- data size- Returns:
- this builder
-
withFields
Set the index fields.- Parameters:
fields- the index fields- Returns:
- this builder
- Note:
- The index fields are collection of name-value pairs
that are used to index new partition in Index layer.
, This method overwrites all fields added before.
-
withLayer
Sets the layer name.- Parameters:
layer- layer name- Returns:
- this builder
-
withMetadata
Sets the additional metadata.- Parameters:
metadata- the index metadata- Returns:
- this builder
- Note:
- This method overwrites all metadata values added before.
-
withPartition
Sets the partition id.- Parameters:
partition- partition id- Returns:
- this builder
-
withTimestamp
Sets the stream record's creation timestamp.- Parameters:
timestamp- the timestamp of the record, in milliseconds since epoch. Please check https://developer.here.com/documentation/data-client-library/dev_guide/client/publish-data.html chapter "Publish to a Stream Layer" for the detailed meaning of the timestamp.- Returns:
- this builder
- Note:
- Setting the timestamp is only effective when publishing to a stream layer using the
kafka-connector.
-