Repository: crunch Updated Branches: refs/heads/apache-crunch-0.8 8c7cd4ac5 -> 9e18e44bd
CRUNCH-430: Re-add avroFile(AvroType) methods to From/At for binary compatability. Project: http://git-wip-us.apache.org/repos/asf/crunch/repo Commit: http://git-wip-us.apache.org/repos/asf/crunch/commit/9e18e44b Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/9e18e44b Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/9e18e44b Branch: refs/heads/apache-crunch-0.8 Commit: 9e18e44bdbcf60618f42cd03ee37d78cc1cf6ca4 Parents: 8c7cd4a Author: Josh Wills <[email protected]> Authored: Thu Jun 26 17:45:08 2014 -0700 Committer: Josh Wills <[email protected]> Committed: Mon Jun 30 09:43:53 2014 -0700 ---------------------------------------------------------------------- .../src/main/java/org/apache/crunch/io/At.java | 24 +++++++++++- .../main/java/org/apache/crunch/io/From.java | 41 ++++++++++++++++++-- 2 files changed, 60 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/crunch/blob/9e18e44b/crunch-core/src/main/java/org/apache/crunch/io/At.java ---------------------------------------------------------------------- diff --git a/crunch-core/src/main/java/org/apache/crunch/io/At.java b/crunch-core/src/main/java/org/apache/crunch/io/At.java index 9a8db2f..f0ef379 100644 --- a/crunch-core/src/main/java/org/apache/crunch/io/At.java +++ b/crunch-core/src/main/java/org/apache/crunch/io/At.java @@ -146,7 +146,29 @@ public class At { * @return A new {@code SourceTarget<T>} instance */ public static <T> SourceTarget<T> avroFile(Path path, PType<T> ptype) { - return new AvroFileSourceTarget<T>(path, (AvroType<T>) ptype); + return avroFile(path, (AvroType<T>) ptype); + } + + /** + * Creates a {@code SourceTarget<T>} instance from the Avro file(s) at the given path name. + * + * @param pathName The name of the path to the data on the filesystem + * @param ptype The {@code AvroType} for the Avro records + * @return A new {@code SourceTarget<T>} instance + */ + public static <T> SourceTarget<T> avroFile(String pathName, AvroType<T> ptype) { + return avroFile(new Path(pathName), ptype); + } + + /** + * Creates a {@code SourceTarget<T>} instance from the Avro file(s) at the given {@code Path}. + * + * @param path The {@code Path} to the data + * @param ptype The {@code AvroType} for the Avro records + * @return A new {@code SourceTarget<T>} instance + */ + public static <T> SourceTarget<T> avroFile(Path path, AvroType<T> ptype) { + return new AvroFileSourceTarget<T>(path, ptype); } /** http://git-wip-us.apache.org/repos/asf/crunch/blob/9e18e44b/crunch-core/src/main/java/org/apache/crunch/io/From.java ---------------------------------------------------------------------- diff --git a/crunch-core/src/main/java/org/apache/crunch/io/From.java b/crunch-core/src/main/java/org/apache/crunch/io/From.java index 3c892a6..6e43321 100644 --- a/crunch-core/src/main/java/org/apache/crunch/io/From.java +++ b/crunch-core/src/main/java/org/apache/crunch/io/From.java @@ -222,7 +222,7 @@ public class From { * Creates a {@code Source<T>} instance from the Avro file(s) at the given path name. * * @param pathName The name of the path to the data on the filesystem - * @param ptype The {@code AvroType} for the Avro records + * @param ptype The {@code PType} for the Avro records * @return A new {@code Source<T>} instance */ public static <T> Source<T> avroFile(String pathName, PType<T> ptype) { @@ -233,11 +233,11 @@ public class From { * Creates a {@code Source<T>} instance from the Avro file(s) at the given {@code Path}. * * @param path The {@code Path} to the data - * @param ptype The {@code AvroType} for the Avro records + * @param ptype The {@code PType} for the Avro records * @return A new {@code Source<T>} instance */ public static <T> Source<T> avroFile(Path path, PType<T> ptype) { - return new AvroFileSource<T>(path, (AvroType<T>) ptype); + return avroFile(path, (AvroType<T>) ptype); } /** @@ -248,7 +248,40 @@ public class From { * @return A new {@code Source<T>} instance */ public static <T> Source<T> avroFile(List<Path> paths, PType<T> ptype) { - return new AvroFileSource<T>(paths, (AvroType<T>) ptype); + return avroFile(paths, (AvroType<T>) ptype); + } + + /** + * Creates a {@code Source<T>} instance from the Avro file(s) at the given path name. + * + * @param pathName The name of the path to the data on the filesystem + * @param ptype The {@code AvroType} for the Avro records + * @return A new {@code Source<T>} instance + */ + public static <T> Source<T> avroFile(String pathName, AvroType<T> ptype) { + return avroFile(new Path(pathName), ptype); + } + + /** + * Creates a {@code Source<T>} instance from the Avro file(s) at the given {@code Path}. + * + * @param path The {@code Path} to the data + * @param ptype The {@code AvroType} for the Avro records + * @return A new {@code Source<T>} instance + */ + public static <T> Source<T> avroFile(Path path, AvroType<T> ptype) { + return new AvroFileSource<T>(path, ptype); + } + + /** + * Creates a {@code Source<T>} instance from the Avro file(s) at the given {@code Path}s. + * + * @param paths A list of {@code Path}s to the data + * @param ptype The {@code AvroType} for the Avro records + * @return A new {@code Source<T>} instance + */ + public static <T> Source<T> avroFile(List<Path> paths, AvroType<T> ptype) { + return new AvroFileSource<T>(paths, ptype); } /**
