Java Code Examples for org.apache.beam.sdk.values.TypeDescriptors#rows()

The following examples show how to use org.apache.beam.sdk.values.TypeDescriptors#rows() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FieldTypeDescriptors.java    From beam with Apache License 2.0 6 votes vote down vote up
/** Get a {@link TypeDescriptor} from a {@link FieldType}. */
public static TypeDescriptor javaTypeForFieldType(FieldType fieldType) {
  switch (fieldType.getTypeName()) {
    case LOGICAL_TYPE:
      // TODO: shouldn't we handle this differently?
      return javaTypeForFieldType(fieldType.getLogicalType().getBaseType());
    case ARRAY:
      return TypeDescriptors.lists(javaTypeForFieldType(fieldType.getCollectionElementType()));
    case ITERABLE:
      return TypeDescriptors.iterables(
          javaTypeForFieldType(fieldType.getCollectionElementType()));
    case MAP:
      return TypeDescriptors.maps(
          javaTypeForFieldType(fieldType.getMapKeyType()),
          javaTypeForFieldType(fieldType.getMapValueType()));
    case ROW:
      return TypeDescriptors.rows();
    default:
      return PRIMITIVE_MAPPING.get(fieldType.getTypeName());
  }
}
 
Example 2
Source File: RowCoder.java    From beam with Apache License 2.0 5 votes vote down vote up
private RowCoder(Schema schema) {
  super(
      schema,
      TypeDescriptors.rows(),
      SerializableFunctions.identity(),
      SerializableFunctions.identity());
}