static Object parseCell(String cell, Schema.Field field) {
    Schema.FieldType fieldType = field.getType();
    try {
      switch (fieldType.getTypeName()) {
        case STRING:
          return cell;
        case INT16:
          return Short.parseShort(cell);
        case INT32:
          return Integer.parseInt(cell);
        case INT64:
          return Long.parseLong(cell);
        case BOOLEAN:
          return Boolean.parseBoolean(cell);
        case BYTE:
          return Byte.parseByte(cell);
        case DECIMAL:
          return new BigDecimal(cell);
        case DOUBLE:
          return Double.parseDouble(cell);
        case FLOAT:
          return Float.parseFloat(cell);
        case DATETIME:
          return Instant.parse(cell);
        default:
          throw new UnsupportedOperationException(
              "Unsupported type: " + fieldType + ", consider using withCustomRecordParsing");
      }

    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException(
          e.getMessage() + " field " + field.getName() + " was received -- type mismatch");
    }
  }
@Test
  public void givenCellUnsupportedType_throws() {
    String counting = "[one,two,three]";
    Schema schema =
        Schema.builder()
            .addField("an_array", Schema.FieldType.array(Schema.FieldType.STRING))
            .addStringField("a_string")
            .build();
    UnsupportedOperationException e =
        assertThrows(
            UnsupportedOperationException.class,
            () -> CsvIOParseHelpers.parseCell(counting, schema.getField("an_array")));
    assertEquals(
        "Unsupported type: "
            + schema.getField("an_array").getType()
            + ", consider using withCustomRecordParsing",
        e.getMessage());
  }