Class OneOfType
java.lang.Object
org.apache.beam.sdk.schemas.logicaltypes.OneOfType
- All Implemented Interfaces:
Serializable,Schema.LogicalType<OneOfType.Value,Row>
A logical type representing a union of fields. This logical type is initialized with a set of
field and represents a union of those fields. This logical type is backed by a Row object
containing one nullable field matching each input field, and one additional
EnumerationType logical type field that indicates which field is set.- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic OneOfTypecreate(List<Schema.Field> fields) Create anOneOfTypelogical type.static OneOfTypeCreate anOneOfTypelogical type.static OneOfTypecreate(Schema.Field... fields) Create anOneOfTypelogical type.<T extends @NonNull Object>
OneOfType.ValuecreateValue(int caseValue, T value) Create aOneOfType.Valuespecifying which field to set and the value to set.<T extends @NonNull Object>
OneOfType.ValuecreateValue(String caseValue, T value) Create aOneOfType.Valuespecifying which field to set and the value to set.<T extends @NonNull Object>
OneOfType.ValuecreateValue(EnumerationType.Value caseType, T value) Create aOneOfType.Valuespecifying which field to set and the value to set.byte[]An optional argument to configure the type.A schema type representing how to interpret the argument.The baseSchema.FieldTypeused to store values of this type.Returns theEnumerationTypethat is used to represent the case type.getFieldType(OneOfType.Value oneOneValue) The unique identifier for this type.Returns the schema of the underlyingRowthat is used to represent the union.toBaseType(OneOfType.Value input) Convert the input type to the type Java type used by the baseSchema.FieldType.toInputType(Row base) Convert the Java type used by the baseSchema.FieldTypeto the input type.toString()
-
Field Details
-
IDENTIFIER
- See Also:
-
-
Method Details
-
create
Create anOneOfTypelogical type. -
create
Create anOneOfTypelogical type. -
create
Create anOneOfTypelogical type. This method allows control over the integer values in the generated enum. -
getOneOfSchema
Returns the schema of the underlyingRowthat is used to represent the union. -
getCaseEnumType
Returns theEnumerationTypethat is used to represent the case type. -
getIdentifier
Description copied from interface:Schema.LogicalTypeThe unique identifier for this type.- Specified by:
getIdentifierin interfaceSchema.LogicalType<OneOfType.Value,Row>
-
getArgumentType
Description copied from interface:Schema.LogicalTypeA schema type representing how to interpret the argument.nullindicates this logical type is not parameterized by an argument.- Specified by:
getArgumentTypein interfaceSchema.LogicalType<OneOfType.Value,Row>
-
getArgument
public byte[] getArgument()Description copied from interface:Schema.LogicalTypeAn optional argument to configure the type.- Specified by:
getArgumentin interfaceSchema.LogicalType<OneOfType.Value,Row>
-
getBaseType
Description copied from interface:Schema.LogicalTypeThe baseSchema.FieldTypeused to store values of this type.- Specified by:
getBaseTypein interfaceSchema.LogicalType<OneOfType.Value,Row>
-
createValue
Create aOneOfType.Valuespecifying which field to set and the value to set. -
createValue
Create aOneOfType.Valuespecifying which field to set and the value to set. -
createValue
public <T extends @NonNull Object> OneOfType.Value createValue(EnumerationType.Value caseType, T value) Create aOneOfType.Valuespecifying which field to set and the value to set. -
getFieldType
-
toBaseType
Description copied from interface:Schema.LogicalTypeConvert the input type to the type Java type used by the baseSchema.FieldType.- Specified by:
toBaseTypein interfaceSchema.LogicalType<OneOfType.Value,Row>
-
toInputType
Description copied from interface:Schema.LogicalTypeConvert the Java type used by the baseSchema.FieldTypeto the input type.- Specified by:
toInputTypein interfaceSchema.LogicalType<OneOfType.Value,Row>
-
toString
-