Package com.asakusafw.directio.hive.parquet.mock

Examples of com.asakusafw.directio.hive.parquet.mock.WithFour


    public void mapping_by_position() throws Exception {
        ParquetFileFormat<WithFour> f1 = format(WithFour.class, "col1", "col3");
        ParquetFileFormat<WithFour> f2 = format(WithFour.class, "col2", "col3");
        f2.getFormatConfiguration().withFieldMappingStrategy(FieldMappingStrategy.POSITION);

        WithFour in = new WithFour();
        in.col0.modify(0);
        in.col1.modify(1);
        in.col2.modify(2);
        in.col3.modify(3);

        File file = save(f1, Arrays.asList(in));
        List<WithFour> results = load(f2, file);
        assertThat(results, hasSize(1));

        WithFour out = results.get(0);
        assertThat(out.col0, is(new IntOption(0)));
        assertThat(out.col1, is(new IntOption(2)));
        assertThat(out.col2, is(new IntOption()));
        assertThat(out.col3, is(new IntOption()));
    }
View Full Code Here


    public void mapping_by_name() throws Exception {
        ParquetFileFormat<WithFour> f1 = format(WithFour.class, "col1", "col3");
        ParquetFileFormat<WithFour> f2 = format(WithFour.class, "col2", "col3");
        f2.getFormatConfiguration().withFieldMappingStrategy(FieldMappingStrategy.NAME);

        WithFour in = new WithFour();
        in.col0.modify(0);
        in.col1.modify(1);
        in.col2.modify(2);
        in.col3.modify(3);

        File file = save(f1, Arrays.asList(in));
        List<WithFour> results = load(f2, file);
        assertThat(results, hasSize(1));

        WithFour out = results.get(0);
        assertThat(out.col0, is(new IntOption(0)));
        assertThat(out.col1, is(new IntOption()));
        assertThat(out.col2, is(new IntOption()));
        assertThat(out.col3, is(new IntOption()));
    }
View Full Code Here

        ParquetFileFormat<WithFour> f2 = format(WithFour.class);
        f2.getFormatConfiguration()
            .withFieldMappingStrategy(FieldMappingStrategy.NAME)
            .withOnMissingSource(ExceptionHandlingStrategy.FAIL);

        WithFour in = new WithFour();
        File file = save(f1, Arrays.asList(in));
        try {
            load(f2, file);
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

        ParquetFileFormat<WithFour> f2 = format(WithFour.class, "col3");
        f2.getFormatConfiguration()
            .withFieldMappingStrategy(FieldMappingStrategy.NAME)
            .withOnMissingTarget(ExceptionHandlingStrategy.FAIL);

        WithFour in = new WithFour();
        File file = save(f1, Arrays.asList(in));
        try {
            load(f2, file);
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

TOP

Related Classes of com.asakusafw.directio.hive.parquet.mock.WithFour

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.