/** * Creates a {@code Source<GenericData.Record>} by reading the schema of the Avro file * at the given paths using the {@code FileSystem} information contained in the given * {@code Configuration} instance. If the first path is a directory, the schema of a file in * the directory will be used to determine the schema to use. * * @param paths The path to the data on the filesystem * @param conf The configuration information * @return A new {@code Source<GenericData.Record>} instance */ public static Source<GenericData.Record> avroFile(List<Path> paths, Configuration conf) { Preconditions.checkArgument(!paths.isEmpty(), "At least one path must be supplied"); return avroFile(paths, Avros.generics(getSchemaFromPath(paths.get(0), conf))); }
/** * Creates a {@code SourceTarget<GenericData.Record>} by reading the schema of the Avro file * at the given path using the {@code FileSystem} information contained in the given * {@code Configuration} instance. If the path is a directory, the schema of a file in * the directory will be used to determine the schema to use. * * @param path The path to the data on the filesystem * @param conf The configuration information * @return A new {@code SourceTarget<GenericData.Record>} instance */ public static SourceTarget<GenericData.Record> avroFile(Path path, Configuration conf) { return avroFile(path, Avros.generics(From.getSchemaFromPath(path, conf))); }
/** * Creates a {@code Source<GenericData.Record>} by reading the schema of the Avro file * at the given path using the {@code FileSystem} information contained in the given * {@code Configuration} instance. If the path is a directory, the schema of a file in * the directory will be used to determine the schema to use. * * @param path The path to the data on the filesystem * @param conf The configuration information * @return A new {@code Source<GenericData.Record>} instance */ public static Source<GenericData.Record> avroFile(Path path, Configuration conf) { return avroFile(path, Avros.generics(getSchemaFromPath(path, conf))); }