Package io.deephaven.kafka.ingest
Class SchemaDiscovery
java.lang.Object
io.deephaven.kafka.ingest.SchemaDiscovery
- Direct Known Subclasses:
AvroDiscovery
,ProtobufDiscovery
@ScriptApi public abstract class SchemaDiscovery extends Object
-
Constructor Summary
Constructors Constructor Description SchemaDiscovery()
-
Method Summary
Modifier and Type Method Description static AvroDiscovery
avroFactory(File file)
static AvroDiscovery
avroFactory(String schemaString)
static AvroDiscovery
avroFactory(org.apache.avro.Schema schema)
SchemaDiscovery
columnPartition(String columnPartition)
Set the column partition name.Schema
generateDeephavenSchema()
Generates a Deephaven schema using the parameters set in this builder.abstract org.jdom2.Element
generateDeephavenXml()
Generates a Deephaven schema XML element using the parameters set in this builder.String
getColumnPartition()
String
getKafkaKeyColumn()
String
getKafkaOffsetColumn()
String
getKafkaPartitionColumn()
String
getKafkaTimestampColumn()
String
getNamespace()
String
getTableName()
io.deephaven.kafka.ingest.SchemaDiscovery.UnmappableBehavior
getUnmappableBehavior()
SchemaDiscovery
kafkaKeyColumn(String kafkaKeyColumn)
SchemaDiscovery
kafkaOffsetColumn(String kafkaOffsetColumn)
Set the name of a column to use for the Kafka offset.SchemaDiscovery
kafkaPartitionColumn(String kafkaPartitionColumn)
Set the name of a column to use for the Kafka partition.SchemaDiscovery
kafkaTimestampColumn(String kafkaTimestampColumn)
Set the name of a column to use for the Kafka timestamp.SchemaDiscovery
namespace(String namespace)
Set the resulting namespace.static ProtobufDiscovery
protobufFactory(byte[] protobufDesc)
static ProtobufDiscovery
protobufFactory(File protobufFile)
static ProtobufDiscovery
protobufFactory(String protobufPath)
SchemaDiscovery
tableName(String tableName)
Set the resulting table name.SchemaDiscovery
unmappableBehavior(io.deephaven.kafka.ingest.SchemaDiscovery.UnmappableBehavior unmappableBehavior)
Set what should happen when an unmappable type is encountered.
-
Constructor Details
-
SchemaDiscovery
public SchemaDiscovery()
-
-
Method Details
-
getNamespace
-
getTableName
-
getColumnPartition
-
getKafkaPartitionColumn
-
getKafkaOffsetColumn
-
getKafkaTimestampColumn
-
getKafkaKeyColumn
-
getUnmappableBehavior
public io.deephaven.kafka.ingest.SchemaDiscovery.UnmappableBehavior getUnmappableBehavior() -
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- Returns:
- this builder
-
kafkaPartitionColumn
@ScriptApi @NotNull public SchemaDiscovery kafkaPartitionColumn(@NotNull String 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
@ScriptApi @NotNull public SchemaDiscovery kafkaTimestampColumn(@NotNull String 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
-
kafkaKeyColumn
-
unmappableBehavior
@ScriptApi @NotNull public SchemaDiscovery unmappableBehavior(@NotNull io.deephaven.kafka.ingest.SchemaDiscovery.UnmappableBehavior unmappableBehavior)Set what should happen when an unmappable type is encountered.- Parameters:
unmappableBehavior
- the behavior on unmappable types- Returns:
- this builder
-
generateDeephavenSchema
Generates a Deephaven schema using the parameters set in this builder.- Returns:
- a Deephaven schema
-
generateDeephavenXml
Generates a Deephaven schema XML element using the parameters set in this builder.- Returns:
- a Deephaven schema XML element
-
avroFactory
@ScriptApi @NotNull public static AvroDiscovery avroFactory(@NotNull org.apache.avro.Schema schema) -
avroFactory
- Throws:
IOException
-
avroFactory
-
protobufFactory
@ScriptApi @NotNull public static ProtobufDiscovery protobufFactory(@NotNull String protobufPath) throws IOException- Throws:
IOException
-
protobufFactory
@ScriptApi @NotNull public static ProtobufDiscovery protobufFactory(@NotNull File protobufFile) throws IOException- Throws:
IOException
-
protobufFactory
@ScriptApi @NotNull public static ProtobufDiscovery protobufFactory(@NotNull byte[] protobufDesc) throws IOException- Throws:
IOException
-