Package io.deephaven.kafka.ingest
Class GenericRecordUtil
java.lang.Object
io.deephaven.kafka.ingest.GenericRecordUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]getFieldPath(String fieldName, Pattern separator) Given a composite (by nesting) field name, composed of individual names separate with the given separator, obtain aString[]path with the individual field names.static int[]getFieldPath(String fieldName, Pattern separator, org.apache.avro.Schema schema) Given a composite (by nesting) field name, composed of individual names separate with the given separator, obtain aString[]path with the individual field names.static org.apache.avro.SchemagetFieldSchema(org.apache.avro.Schema schema, String[] fieldPath) Get the schema for a particular field path (including nesting).static ObjectgetPath(org.apache.avro.generic.GenericRecord record, int[] fieldPath) Get the value out of a Generic Record for a given field path (including nesting).
-
Constructor Details
-
GenericRecordUtil
public GenericRecordUtil()
-
-
Method Details
-
getFieldPath
public static int[] getFieldPath(String fieldName, Pattern separator, org.apache.avro.Schema schema) Given a composite (by nesting) field name, composed of individual names separate with the given separator, obtain aString[]path with the individual field names.- Parameters:
fieldName- A composite (by nesting) field name.separator- The separator pattern used for composingfieldNameschema- An avro schema.- Returns:
- A
String[]path with the individual field names forfieldName
-
getFieldPath
Given a composite (by nesting) field name, composed of individual names separate with the given separator, obtain aString[]path with the individual field names.- Parameters:
fieldName- A composite (by nesting) field name.separator- The separator pattern used for composingfieldName- Returns:
- A
String[]path with the individual field names forfieldName
-
getPath
Get the value out of a Generic Record for a given field path (including nesting).- Parameters:
record- AGenericRecordfrom which to extract a value.fieldPath- An array of individual field position indices, in order according to nesting from the root representing a path to an individual desired field- Returns:
- The value in
recordfor the givenfieldPath
-
getFieldSchema
public static org.apache.avro.Schema getFieldSchema(org.apache.avro.Schema schema, String[] fieldPath) Get the schema for a particular field path (including nesting).- Parameters:
schema- ASchemato start nested field navigation fromfieldPath- An array of individual field names, in order according to nesting from the root representing a path to an individual desired field- Returns:
- The schema for the given
fieldPath
-