Package io.deephaven.kafka.ingest
Class AvroDiscovery
java.lang.Object
io.deephaven.kafka.ingest.AvroDiscovery
public class AvroDiscovery extends Object
A builder for generating a Deephaven schema from an Avro schema.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AvroDiscovery.UnmappableBehavior
-
Constructor Summary
Constructors Constructor Description AvroDiscovery()
-
Method Summary
Modifier and Type Method Description AvroDiscovery
avroSchema(File file)
Sets the Avro schema for this builder.AvroDiscovery
avroSchema(String schemaString)
Sets the Avro schema for this builder.AvroDiscovery
avroSchema(org.apache.avro.Schema avroSchema)
Sets the Avro schema for this builder.AvroDiscovery
columnPartition(String columnPartition)
Set the column partition name.Schema
generateDeephavenSchema()
Generates a Deephaven schema using the parameters set in this builder.org.jdom2.Element
generateDeephavenXml()
Generates a Deephaven schema XML element using the parameters set in this builder.AvroDiscovery
kafkaOffsetColumn(String kafkaOffsetColumn)
Set the name of a column to use for the Kafka offset.AvroDiscovery
kafkaPartitionColumn(String kafkaPartitionColumn)
Set the name of a column to use for the Kafka partition.AvroDiscovery
kafkaTimestampColumn(String kafkaTimestampColumn)
Set the name of a column to use for the Kafka timestamp.AvroDiscovery
namespace(String namespace)
Set the resulting namespace.AvroDiscovery
tableName(String tableName)
Set the resulting table name.AvroDiscovery
unmappableBehavior(AvroDiscovery.UnmappableBehavior unmappableBehavior)
Set what should happen when an unmappable type is encountered.
-
Constructor Details
-
AvroDiscovery
public AvroDiscovery()
-
-
Method Details
-
namespace
Set the resulting namespace.- Parameters:
namespace
- the namespace of the result schema, if not set will be discovered from Avro schema- Returns:
- this builder
-
tableName
Set the resulting table name.- Parameters:
tableName
- the name of the result schema, if not set will be discovered from Avro schema- Returns:
- this builder
-
columnPartition
Set the column partition name.- Parameters:
columnPartition
- the name of the partitioning column, if not set the schema will not have a partitioning column- Returns:
- this builder
-
kafkaPartitionColumn
Set the name of a column to use for the Kafka partition.- Parameters:
kafkaPartitionColumn
- the name of the Kafka partition column- Returns:
- this builder
-
kafkaOffsetColumn
Set the name of a column to use for the Kafka offset.- Parameters:
kafkaOffsetColumn
- the name of the Kafka offset column- Returns:
- this builder
-
kafkaTimestampColumn
Set the name of a column to use for the Kafka timestamp.- Parameters:
kafkaTimestampColumn
- the name of the Kafka timestamp column- Returns:
- this builder
-
unmappableBehavior
@NotNull public AvroDiscovery unmappableBehavior(@NotNull AvroDiscovery.UnmappableBehavior unmappableBehavior)Set what should happen when an unmappable type is encountered.- Parameters:
unmappableBehavior
- the behavior on unmappable types- Returns:
- this builder
-
avroSchema
Sets the Avro schema for this builder.- Parameters:
avroSchema
- the Avro schema object- Returns:
- this builder
-
avroSchema
Sets the Avro schema for this builder.- Parameters:
file
- a file containing a JSON encoded Avro schema, seeSchema.Parser.parse(File)
.- Returns:
- this builder
- Throws:
IOException
-
avroSchema
Sets the Avro schema for this builder.- Parameters:
schemaString
- a string containing a JSON encoded Avro schema, seeSchema.Parser.parse(String)
.- Returns:
- this builder
-
generateDeephavenSchema
Generates a Deephaven schema using the parameters set in this builder.- Returns:
- a Deephaven schema
-
generateDeephavenXml
@NotNull public org.jdom2.Element generateDeephavenXml()Generates a Deephaven schema XML element using the parameters set in this builder.- Returns:
- a Deephaven schema XML element
-