Package com.asakusafw.runtime.directio

Examples of com.asakusafw.runtime.directio.Counter


                StringOption.class,
                fs,
                path,
                0,
                fs.getFileStatus(path).getLen(),
                new Counter());
        in.close();
    }
View Full Code Here


    @Test
    public void output() throws Exception {
        final int count = 10000;
        LocalFileSystem fs = FileSystem.getLocal(conf);
        Path path = new Path(folder.newFile("testing").toURI());
        ModelOutput<StringOption> out = format.createOutput(StringOption.class, fs, path, new Counter());
        try {
            StringOption value = new StringOption();
            for (int i = 0; i < count; i++) {
                value.modify("Hello, world at " + i);
                out.write(value);
View Full Code Here

    @Test
    public void output_compressed() throws Exception {
        LocalFileSystem fs = FileSystem.getLocal(conf);
        Path path = new Path(folder.newFile("testing").toURI());
        ModelOutput<StringOption> out = format.codec(new DefaultCodec())
            .createOutput(StringOption.class, fs, path, new Counter());
        try {
            out.write(new StringOption("Hello, world!"));
        } finally {
            out.close();
        }
View Full Code Here

    @Test
    public void output_no_compressed() throws Exception {
        LocalFileSystem fs = FileSystem.getLocal(conf);
        Path path = new Path(folder.newFile("testing.gz").toURI());
        ModelOutput<StringOption> out = format.codec(null)
            .createOutput(StringOption.class, fs, path, new Counter());
        try {
            out.write(new StringOption("Hello, world!"));
        } finally {
            out.close();
        }
View Full Code Here

    @Test
    public void output_compressed_conf() throws Exception {
        LocalFileSystem fs = FileSystem.getLocal(conf);
        Path path = new Path(folder.newFile("testing").toURI());
        format.getConf().set(SequenceFileFormat.KEY_COMPRESSION_CODEC, DefaultCodec.class.getName());
        ModelOutput<StringOption> out = format.createOutput(StringOption.class, fs, path, new Counter());
        try {
            out.write(new StringOption("Hello, world!"));
        } finally {
            out.close();
        }
View Full Code Here

    @Test
    public void output_compressed_invalid() throws Exception {
        LocalFileSystem fs = FileSystem.getLocal(conf);
        Path path = new Path(folder.newFile("testing").toURI());
        format.getConf().set(SequenceFileFormat.KEY_COMPRESSION_CODEC, "__INVALID__");
        ModelOutput<StringOption> out = format.createOutput(StringOption.class, fs, path, new Counter());
        try {
            out.write(new StringOption("Hello, world!"));
        } finally {
            out.close();
        }
View Full Code Here

        assert definition != null;
        assert split != null;
        assert context != null;
        Configuration conf = context.getConfiguration();
        T buffer = ReflectionUtils.newInstance(definition.getDataClass(), conf);
        Counter counter = new Counter();
        ModelInput<T> input = createInput(context, split.group.containerPath, definition, counter, split.fragment);
        return new BridgeRecordReader<T>(input, buffer, counter, split.fragment.getSize());
    }
View Full Code Here

     */
    @Test
    public void move_simple() throws Exception {
        touch("src/a.csv");
        FileSystem fs = getTempFileSystem();
        HadoopDataSourceUtil.move(new Counter(), fs, getPath("src"), getPath("dst"));
        assertThat(collect(), is(path("dst/a.csv")));
    }
View Full Code Here

    public void move_multiple() throws Exception {
        touch("src/a.csv");
        touch("src/b.csv");
        touch("src/c.csv");
        FileSystem fs = getTempFileSystem();
        HadoopDataSourceUtil.move(new Counter(), fs, getPath("src"), getPath("dst"));
        assertThat(collect(), is(path("dst/a.csv", "dst/b.csv", "dst/c.csv")));
    }
View Full Code Here

    public void move_deep() throws Exception {
        touch("src/a.csv");
        touch("src/a/b.csv");
        touch("src/a/b/c.csv");
        FileSystem fs = getTempFileSystem();
        HadoopDataSourceUtil.move(new Counter(), fs, getPath("src"), getPath("dst"));
        assertThat(collect(), is(path("dst/a.csv", "dst/a/b.csv", "dst/a/b/c.csv")));
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.runtime.directio.Counter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.