Package com.asakusafw.directio.hive.orc

Examples of com.asakusafw.directio.hive.orc.OrcFormatConfiguration


        });
        AbstractOrcFileFormat<?> format = load(loader, "ModelOrcFileFormat");
        assertThat(format.getDataModelDescriptor().getDataModelClass(), equalTo((Object) loader.modelType("Model")));
        assertThat(format.getTableName(), is("model"));

        OrcFormatConfiguration conf = format.getFormatConfiguration();
        assertThat(conf.getFormatVersion(), is(nullValue()));
        assertThat(conf.getCompressionKind(), is(CompressionKind.SNAPPY));
        assertThat(conf.getStripeSize(), is(64L * 1024 * 1024));

        assertThat(loader.exists(OrcFileEmitter.CATEGORY, "AbstractModelOrcFileInputDescription"), is(true));
        assertThat(loader.exists(OrcFileEmitter.CATEGORY, "AbstractModelOrcFileOutputDescription"), is(true));
    }
View Full Code Here


        });
        AbstractOrcFileFormat<?> format = load(loader, "ModelOrcFileFormat");
        assertThat(format.getDataModelDescriptor().getDataModelClass(), equalTo((Object) loader.modelType("Model")));
        assertThat(format.getTableName(), is("attributes_test"));

        OrcFormatConfiguration conf = format.getFormatConfiguration();
        assertThat(conf.getFieldMappingStrategy(), is(FieldMappingStrategy.NAME));
        assertThat(conf.getOnMissingSource(), is(ExceptionHandlingStrategy.IGNORE));
        assertThat(conf.getOnMissingTarget(), is(ExceptionHandlingStrategy.FAIL));
        assertThat(conf.getOnIncompatibleType(), is(ExceptionHandlingStrategy.LOGGING));
        assertThat(conf.getFormatVersion(), is(OrcFile.Version.V_0_11));
        assertThat(conf.getCompressionKind(), is(CompressionKind.ZLIB));
        assertThat(conf.getStripeSize(), is(123456789L));
    }
View Full Code Here

            List<Statement> statements = Lists.create();
            statements.add(new TypeBuilder(f, context.resolve(OrcFormatConfiguration.class))
                    .newObject()
                    .toLocalVariableDeclaration(context.resolve(OrcFormatConfiguration.class), result));

            OrcFormatConfiguration conf = model.getTrait(OrcFileTrait.class).configuration();
            if (conf.getFieldMappingStrategy() != null) {
                statements.add(new ExpressionBuilder(f, result)
                        .method("withFieldMappingStrategy", //$NON-NLS-1$
                                new TypeBuilder(f, context.resolve(FieldMappingStrategy.class))
                            .field(conf.getFieldMappingStrategy().name())
                            .toExpression())
                        .toStatement());
            }
            if (conf.getOnMissingSource() != null) {
                statements.add(new ExpressionBuilder(f, result)
                        .method("withOnMissingSource", //$NON-NLS-1$
                                new TypeBuilder(f, context.resolve(ExceptionHandlingStrategy.class))
                            .field(conf.getOnMissingSource().name())
                            .toExpression())
                        .toStatement());
            }
            if (conf.getOnMissingTarget() != null) {
                statements.add(new ExpressionBuilder(f, result)
                        .method("withOnMissingTarget", //$NON-NLS-1$
                                new TypeBuilder(f, context.resolve(ExceptionHandlingStrategy.class))
                            .field(conf.getOnMissingTarget().name())
                            .toExpression())
                        .toStatement());
            }
            if (conf.getOnIncompatibleType() != null) {
                statements.add(new ExpressionBuilder(f, result)
                        .method("withOnIncompatibleType", //$NON-NLS-1$
                                new TypeBuilder(f, context.resolve(ExceptionHandlingStrategy.class))
                            .field(conf.getOnIncompatibleType().name())
                            .toExpression())
                        .toStatement());
            }
            if (conf.getFormatVersion() != null) {
                statements.add(new ExpressionBuilder(f, result)
                        .method("withFormatVersion", //$NON-NLS-1$
                                new TypeBuilder(f, context.resolve(OrcFile.Version.class))
                                    .field(conf.getFormatVersion().name())
                                    .toExpression())
                        .toStatement());
            }
            if (conf.getCompressionKind() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withCompressionKind", //$NON-NLS-1$
                            new TypeBuilder(f, context.resolve(CompressionKind.class))
                                .field(conf.getCompressionKind().name())
                                .toExpression())
                    .toStatement());
            }
            if (conf.getStripeSize() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withStripeSize", Models.toLiteral(f, (long) conf.getStripeSize())) //$NON-NLS-1$
                    .toStatement());
            }
            statements.add(new ExpressionBuilder(f, result).toReturnStatement());
            return f.newMethodDeclaration(
                    null,
View Full Code Here

TOP

Related Classes of com.asakusafw.directio.hive.orc.OrcFormatConfiguration

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.