/** Sets the {@link MatchConfiguration}. */ public Read<T> withMatchConfiguration(MatchConfiguration matchConfiguration) { return toBuilder().setMatchConfiguration(matchConfiguration).build(); }
/** * Reads records of the given type from an Avro file (or multiple Avro files matching a pattern). * * <p>The schema must be specified using one of the {@code withSchema} functions. */ public static <T> Read<T> read(Class<T> recordClass) { return new AutoValue_AvroIO_Read.Builder<T>() .setMatchConfiguration(MatchConfiguration.create(EmptyMatchTreatment.DISALLOW)) .setRecordClass(recordClass) .setSchema(ReflectData.get().getSchema(recordClass)) .setHintMatchesManyFiles(false) .build(); }
/** * Reads from the given filename or filepattern. * * <p>If it is known that the filepattern will match a very large number of files (at least tens * of thousands), use {@link #withHintMatchesManyFiles} for better performance and scalability. */ public Read<T> from(ValueProvider<String> filepattern) { return toBuilder().setFilepattern(filepattern).build(); }
/** Reads Avro file(s) containing records of the specified schema. */ public static Read<GenericRecord> readGenericRecords(Schema schema) { return new AutoValue_AvroIO_Read.Builder<GenericRecord>() .setMatchConfiguration(MatchConfiguration.create(EmptyMatchTreatment.DISALLOW)) .setRecordClass(GenericRecord.class) .setSchema(schema) .setHintMatchesManyFiles(false) .build(); }
/** * Hints that the filepattern specified in {@link #from(String)} matches a very large number of * files. * * <p>This hint may cause a runner to execute the transform differently, in a way that improves * performance for this case, but it may worsen performance if the filepattern matches only a * small number of files (e.g., in a runner that supports dynamic work rebalancing, it will * happen less efficiently within individual files). */ public Read<T> withHintMatchesManyFiles() { return toBuilder().setHintMatchesManyFiles(true).build(); }