Package com.asakusafw.directio.hive.parquet

Examples of com.asakusafw.directio.hive.parquet.ParquetFormatConfiguration


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

        ParquetFormatConfiguration conf = format.getFormatConfiguration();
        assertThat(conf.getCompressionCodecName(), is(nullValue()));
        assertThat(conf.getBlockSize(), is(nullValue()));
        assertThat(conf.getDataPageSize(), is(nullValue()));
        assertThat(conf.getDictionaryPageSize(), is(nullValue()));
        assertThat(conf.getEnableDictionary(), is(nullValue()));
        assertThat(conf.getEnableValidation(), is(nullValue()));
        assertThat(conf.getWriterVersion(), is(nullValue()));

        assertThat(loader.exists(ParquetFileEmitter.CATEGORY, "AbstractModelParquetFileInputDescription"), is(true));
        assertThat(loader.exists(ParquetFileEmitter.CATEGORY, "AbstractModelParquetFileOutputDescription"), is(true));
    }
View Full Code Here


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

        ParquetFormatConfiguration 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.getCompressionCodecName(), is(CompressionCodecName.UNCOMPRESSED));
        assertThat(conf.getBlockSize(), is(100000000));
        assertThat(conf.getDataPageSize(), is(1000001));
        assertThat(conf.getDictionaryPageSize(), is(1000002));
        assertThat(conf.getEnableDictionary(), is(false));
        assertThat(conf.getEnableValidation(), is(true));
        assertThat(conf.getWriterVersion(), is(WriterVersion.PARQUET_2_0));
    }
View Full Code Here

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

            ParquetFormatConfiguration conf = model.getTrait(ParquetFileTrait.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.getCompressionCodecName() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withCompressionCodecName", //$NON-NLS-1$
                            new TypeBuilder(f, context.resolve(CompressionCodecName.class))
                                .field(conf.getCompressionCodecName().name())
                                .toExpression())
                    .toStatement());
            }
            if (conf.getBlockSize() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withBlockSize", Models.toLiteral(f, conf.getBlockSize())) //$NON-NLS-1$
                    .toStatement());
            }
            if (conf.getDataPageSize() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withDataPageSize", Models.toLiteral(f, conf.getDataPageSize())) //$NON-NLS-1$
                    .toStatement());
            }
            if (conf.getDictionaryPageSize() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withDictionaryPageSize", Models.toLiteral(f, conf.getDictionaryPageSize())) //$NON-NLS-1$
                    .toStatement());
            }
            if (conf.getEnableDictionary() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withEnableDictionary", Models.toLiteral(f, conf.getEnableDictionary())) //$NON-NLS-1$
                    .toStatement());
            }
            if (conf.getEnableValidation() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withEnableValidation", Models.toLiteral(f, conf.getEnableValidation())) //$NON-NLS-1$
                    .toStatement());
            }
            if (conf.getWriterVersion() != null) {
                statements.add(new ExpressionBuilder(f, result)
                    .method("withWriterVersion", //$NON-NLS-1$
                            new TypeBuilder(f, context.resolve(WriterVersion.class))
                                .field(conf.getWriterVersion().name())
                                .toExpression())
                    .toStatement());
            }
            statements.add(new ExpressionBuilder(f, result).toReturnStatement());
            return f.newMethodDeclaration(
View Full Code Here

TOP

Related Classes of com.asakusafw.directio.hive.parquet.ParquetFormatConfiguration

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.