Example usage for org.apache.hadoop.fs LocatedFileStatus LocatedFileStatus

List of usage examples for org.apache.hadoop.fs LocatedFileStatus LocatedFileStatus

Introduction

In this page you can find the example usage for org.apache.hadoop.fs LocatedFileStatus LocatedFileStatus.

Prototype

@Deprecated
public LocatedFileStatus(long length, boolean isdir, int block_replication, long blocksize,
        long modification_time, long access_time, FsPermission permission, String owner, String group,
        Path symlink, Path path, BlockLocation[] locations) 

Source Link

Document

Constructor

Usage

From source file:com.facebook.presto.hive.TestBackgroundHiveSplitLoader.java

License:Apache License

private static LocatedFileStatus locatedFileStatus(Path path) {
    return new LocatedFileStatus(0L, false, 0, 0L, 0L, 0L, null, null, null, null, path,
            new BlockLocation[] { new BlockLocation() });
}

From source file:com.facebook.presto.hive.TestBackgroundHiveSplitLoader.java

License:Apache License

private static LocatedFileStatus locatedFileStatusWithNoBlocks(Path path) {
    return new LocatedFileStatus(0L, false, 0, 0L, 0L, 0L, null, null, null, null, path,
            new BlockLocation[] {});
}

From source file:com.thinkbiganalytics.spark.io.ZipStreamingOutputTest.java

License:Apache License

/**
 * Creates a new file with the specified name and parent directory.
 *///from   ww  w  .j  a v  a  2 s.c o m
@Nonnull
private LocatedFileStatus createFile(@Nonnull final String name, @Nonnull final Path parent) {
    return new LocatedFileStatus(0, false, 0, 0, 0, 0, FsPermission.getDefault(), "root", "root", null,
            new Path(parent, name), null);
}

From source file:org.apache.druid.indexer.hadoop.DatasourceInputFormatTest.java

License:Apache License

@Before
public void setUp() throws Exception {
    segments1 = ImmutableList.of(/*from   w  ww  .j av  a  2s. c om*/
            WindowedDataSegment.of(new DataSegment("test1", Intervals.of("2000/3000"), "ver",
                    ImmutableMap.of("type", "local", "path", "/tmp/index1.zip"), ImmutableList.of("host"),
                    ImmutableList.of("visited_sum", "unique_hosts"), NoneShardSpec.instance(), 9, 2)),
            WindowedDataSegment.of(new DataSegment("test1", Intervals.of("2050/3000"), "ver",
                    ImmutableMap.of("type", "hdfs", "path", "/tmp/index2.zip"), ImmutableList.of("host"),
                    ImmutableList.of("visited_sum", "unique_hosts"), NoneShardSpec.instance(), 9, 11)),
            WindowedDataSegment.of(new DataSegment("test1", Intervals.of("2030/3000"), "ver",
                    ImmutableMap.of("type", "hdfs", "path", "/tmp/index3.zip"), ImmutableList.of("host"),
                    ImmutableList.of("visited_sum", "unique_hosts"), NoneShardSpec.instance(), 9, 4)));

    segments2 = ImmutableList.of(WindowedDataSegment.of(new DataSegment("test2", Intervals.of("2000/3000"),
            "ver", ImmutableMap.of("type", "local", "path", "/tmp/index4.zip"), ImmutableList.of("host"),
            ImmutableList.of("visited_sum", "unique_hosts"), NoneShardSpec.instance(), 9, 2)));

    Path path1 = new Path(JobHelper.getURIFromSegment(segments1.get(0).getSegment()));
    Path path2 = new Path(JobHelper.getURIFromSegment(segments1.get(1).getSegment()));
    Path path3 = new Path(JobHelper.getURIFromSegment(segments1.get(2).getSegment()));
    Path path4 = new Path(JobHelper.getURIFromSegment(segments2.get(0).getSegment()));

    // dummy locations for test
    BlockLocation[] locations1 = { new BlockLocation(null, new String[] { "s1", "s2" }, 0, 600),
            new BlockLocation(null, new String[] { "s2", "s3" }, 600, 400) };
    BlockLocation[] locations2 = { new BlockLocation(null, new String[] { "s1", "s2" }, 0, 1000),
            new BlockLocation(null, new String[] { "s1", "s3" }, 1000, 1200),
            new BlockLocation(null, new String[] { "s2", "s3" }, 2200, 1100),
            new BlockLocation(null, new String[] { "s1", "s2" }, 3300, 700) };
    BlockLocation[] locations3 = { new BlockLocation(null, new String[] { "s2", "s3" }, 0, 500) };
    BlockLocation[] locations4 = { new BlockLocation(null, new String[] { "s2", "s3" }, 0, 500) };
    this.locations = ImmutableList.of(
            new LocatedFileStatus(1000, false, 0, 0, 0, 0, null, null, null, null, path1, locations1),
            new LocatedFileStatus(4000, false, 0, 0, 0, 0, null, null, null, null, path2, locations2),
            new LocatedFileStatus(500, false, 0, 0, 0, 0, null, null, null, null, path3, locations3),
            new LocatedFileStatus(500, false, 0, 0, 0, 0, null, null, null, null, path4, locations4));

    config = populateConfiguration(new JobConf(), segments1, 0);
    context = EasyMock.createMock(JobContext.class);
    EasyMock.expect(context.getConfiguration()).andReturn(config);
    EasyMock.replay(context);
}