class ZetaSqlUtils {

  public static Type beamFieldTypeToZetaSqlType(FieldType fieldType) {
    switch (fieldType.getTypeName()) {
      case INT64:
        return TypeFactory.createSimpleType(TypeKind.TYPE_INT64);
      case DECIMAL:
        return TypeFactory.createSimpleType(TypeKind.TYPE_NUMERIC);
      case DOUBLE:
        return TypeFactory.createSimpleType(TypeKind.TYPE_DOUBLE);
      case STRING:
        return TypeFactory.createSimpleType(TypeKind.TYPE_STRING);
      case DATETIME:
        // TODO[BEAM-8630]: Mapping Timestamp to DATETIME results in some timezone/precision issues.
        //  Can we convert Timestamp to a LogicalType? Will it solve the problem?
        return TypeFactory.createSimpleType(TypeKind.TYPE_TIMESTAMP);
      case BOOLEAN:
        return TypeFactory.createSimpleType(TypeKind.TYPE_BOOL);
      case BYTES:
        return TypeFactory.createSimpleType(TypeKind.TYPE_BYTES);
      case ARRAY:
        return createZetaSqlArrayTypeFromBeamElementFieldType(fieldType.getCollectionElementType());
      case ROW:
        return createZetaSqlStructTypeFromBeamSchema(fieldType.getRowSchema());
      case LOGICAL_TYPE:
        switch (fieldType.getLogicalType().getIdentifier()) {
          case DateType.IDENTIFIER:
            return TypeFactory.createSimpleType(TypeKind.TYPE_DATE);
          case TimeType.IDENTIFIER:
            return TypeFactory.createSimpleType(TypeKind.TYPE_TIME);
          default:
            throw new IllegalArgumentException(
                "Unsupported Beam logical type: " + fieldType.getLogicalType().getIdentifier());
        }
      default:
        throw new UnsupportedOperationException(
            "Unsupported Beam fieldType: " + fieldType.getTypeName());
    }
  }

  private  ZetaSqlUtils();

}