Package io.deephaven.kafka.ingest
Class GenericRecordConsumerRecordToTableWriterAdapter.Builder
java.lang.Object
io.deephaven.kafka.ingest.GenericRecordConsumerRecordToTableWriterAdapter.Builder
- Enclosing class:
- GenericRecordConsumerRecordToTableWriterAdapter
public static class GenericRecordConsumerRecordToTableWriterAdapter.Builder extends Object
A builder to map key and value fields to table columns.
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description GenericRecordConsumerRecordToTableWriterAdapter.Builder
addColumnToKey(String column)
Map a column to a the key of the record, the key must match the type of the column.GenericRecordConsumerRecordToTableWriterAdapter.Builder
addColumnToKeyField(String column, String field)
Map a column to a field in the key record.GenericRecordConsumerRecordToTableWriterAdapter.Builder
addColumnToKeyFunction(String column, Function<org.apache.avro.generic.GenericRecord,?> function)
Map a column to a function of the key record.GenericRecordConsumerRecordToTableWriterAdapter.Builder
addColumnToValueField(String column, String field)
Map a column to a field in the value record.GenericRecordConsumerRecordToTableWriterAdapter.Builder
addColumnToValueFunction(String column, Function<org.apache.avro.generic.GenericRecord,?> function)
Map a column to a function of the value record.GenericRecordConsumerRecordToTableWriterAdapter.Builder
allowNullKeys(boolean allowNullKeys)
If allowNullKeys is set, then records with a null key will have their columns null filled; otherwise an exception is thrown on receipt of a null key.GenericRecordConsumerRecordToTableWriterAdapter.Builder
allowNullValues(boolean allowNullValues)
If allowNullValues is set, then records with a null value will have their columns null filled; otherwise an exception is thrown on receipt of a null value.GenericRecordConsumerRecordToTableWriterAdapter.Builder
allowUnmapped(String allowUnmapped)
Allow the column with the given name to be unmapped in the output.GenericRecordConsumerRecordToTableWriterAdapter.Builder
autoValueMapping(boolean autoValueMapping)
If autoValueMapping is set, then all unused columns are mapped to a field of the same name in the generic record.GenericRecordConsumerRecordToTableWriterAdapter.Builder
caseInsensitiveSearch(boolean caseInsensitiveSearch)
IfautoValueMapping(boolean)
is set to true, then all unused columns are mapped to a field of the same name in the generic record without regard to case.GenericRecordConsumerRecordToTableWriterAdapter.Builder
kafkaPartitionColumnName(String kafkaPartitionColumnName)
Set the name of the column which stores the Kafka partition identifier of the record.GenericRecordConsumerRecordToTableWriterAdapter.Builder
offsetColumnName(String offsetColumnName)
Set the name of the column which stores the Kafka offset of the record.GenericRecordConsumerRecordToTableWriterAdapter.Builder
timestampColumnName(String timestampColumnName)
Set the name of the column which stores the Kafka timestamp of the record.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
kafkaPartitionColumnName
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder kafkaPartitionColumnName(@NotNull String kafkaPartitionColumnName)Set the name of the column which stores the Kafka partition identifier of the record.- Parameters:
kafkaPartitionColumnName
- the name of the column in the output table- Returns:
- this builder
-
offsetColumnName
public GenericRecordConsumerRecordToTableWriterAdapter.Builder offsetColumnName(@NotNull String offsetColumnName)Set the name of the column which stores the Kafka offset of the record.- Parameters:
offsetColumnName
- the name of the column in the output table- Returns:
- this builder
-
timestampColumnName
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder timestampColumnName(@NotNull String timestampColumnName)Set the name of the column which stores the Kafka timestamp of the record.- Parameters:
timestampColumnName
- the name of the column in the output table- Returns:
- this builder
-
allowUnmapped
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder allowUnmapped(@NotNull String allowUnmapped)Allow the column with the given name to be unmapped in the output. Unmapped columns will have no setter, and will thus be null filled in the output.- Parameters:
allowUnmapped
- the column name to allow to be unmapped- Returns:
- this builder
-
addColumnToKeyField
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder addColumnToKeyField(@NotNull String column, @NotNull String field)Map a column to a field in the key record.- Parameters:
column
- the name of the output columnfield
- the name of the field in the key record- Returns:
- this builder
-
addColumnToKey
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder addColumnToKey(@NotNull String column)Map a column to a the key of the record, the key must match the type of the column. This configuration is intended for when the keys of your records are not in fact GenericRecords, but rather a primitive or a String.- Parameters:
column
- the name of the output column- Returns:
- this builder
-
addColumnToValueField
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder addColumnToValueField(@NotNull String column, @NotNull String field)Map a column to a field in the value record.- Parameters:
column
- the name of the output columnfield
- the name of the field in the value record- Returns:
- this builder
-
addColumnToKeyFunction
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder addColumnToKeyFunction(@NotNull String column, @NotNull Function<org.apache.avro.generic.GenericRecord,?> function)Map a column to a function of the key record.- Parameters:
column
- the name of the output columnfunction
- the function to apply to the key record- Returns:
- this builder
-
addColumnToValueFunction
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder addColumnToValueFunction(@NotNull String column, @NotNull Function<org.apache.avro.generic.GenericRecord,?> function)Map a column to a function of the value record.- Parameters:
column
- the name of the output columnfunction
- the function to apply to the value record- Returns:
- this builder
-
allowNullKeys
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder allowNullKeys(boolean allowNullKeys)If allowNullKeys is set, then records with a null key will have their columns null filled; otherwise an exception is thrown on receipt of a null key. If no key fields are set, then no columns are taken from the value; so this flag has no effect.- Parameters:
allowNullKeys
- if null key are allowed- Returns:
- this builder
-
allowNullValues
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder allowNullValues(boolean allowNullValues)If allowNullValues is set, then records with a null value will have their columns null filled; otherwise an exception is thrown on receipt of a null value. If no value fiels are set, then no columns are taken from the value; so this flag has no effect.- Parameters:
allowNullValues
- if null values are allowed- Returns:
- this builder
-
autoValueMapping
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder autoValueMapping(boolean autoValueMapping)If autoValueMapping is set, then all unused columns are mapped to a field of the same name in the generic record.- Parameters:
autoValueMapping
- if unused columns should be automatically mapped to a field of the same name- Returns:
- this builder
-
caseInsensitiveSearch
@NotNull public GenericRecordConsumerRecordToTableWriterAdapter.Builder caseInsensitiveSearch(boolean caseInsensitiveSearch)IfautoValueMapping(boolean)
is set to true, then all unused columns are mapped to a field of the same name in the generic record without regard to case. For example, a generic record field ofwidgetId
would be matched to a table column namedWidgetID
.- Parameters:
caseInsensitiveSearch
- should a case-insensitive search for matching columns be performed?- Returns:
- this builder
-