code: public static void checkDescriptor(DatasetDescriptor descriptor) {
      Preconditions.checkNotNull(descriptor, "Descriptor cannot be null");
  
      Schema schema = descriptor.getSchema();
      checkSchema(schema);
  
      if (descriptor.isPartitioned()) {
        // marked as [BUG] because this is checked in DatasetDescriptor
        Preconditions.checkArgument(schema.getType() == Schema.Type.RECORD,
            "[BUG] Partitioned datasets must have record schemas");
  
        Set<String> names = Sets.newHashSet();
        for (Schema.Field field : schema.getFields()) {
          names.add(field.name());
        }
  
        List<String> incompatible = Lists.newArrayList();
        List<String> duplicates = Lists.newArrayList();
        for (FieldPartitioner fp : Accessor.getDefault().getFieldPartitioners(descriptor
            .getPartitionStrategy())) {
          String name = fp.getName();
          if (!isCompatibleName(name)) {
            incompatible.add(name);
          } else if (names.contains(name)) {
            duplicates.add(name);
          } else {
            names.add(name);
          }
        }
        ValidationException.check(incompatible.isEmpty(),
            "Partition names are not alphanumeric (plus '_'): %s",
            Joiner.on(", ").join(incompatible));
        ValidationException.check(duplicates.isEmpty(),
            "Partition names duplicate data fields: %s",
            Joiner.on(", ").join(duplicates));
      }
    }
docs: Precondition-style validation that the DatasetDescriptor is compatible.
  
  @param descriptor a {@link DatasetDescriptor}