Search in sources :

Example 1 with VerificationQueryRewriterModule

use of com.facebook.presto.verifier.rewrite.VerificationQueryRewriterModule in project presto by prestodb.

the class VerifierModule method setup.

protected final void setup(Binder binder) {
    configBinder(binder).bindConfig(VerifierConfig.class);
    configBinder(binder).bindConfig(DeterminismAnalyzerConfig.class);
    configBinder(binder).bindConfig(QueryConfigurationOverridesConfig.class, ForControl.class, "control");
    configBinder(binder).bindConfig(QueryConfigurationOverridesConfig.class, ForTest.class, "test");
    binder.bind(QueryConfigurationOverrides.class).annotatedWith(ForControl.class).to(Key.get(QueryConfigurationOverridesConfig.class, ForControl.class)).in(SINGLETON);
    binder.bind(QueryConfigurationOverrides.class).annotatedWith(ForTest.class).to(Key.get(QueryConfigurationOverridesConfig.class, ForTest.class)).in(SINGLETON);
    for (Class<? extends Predicate<SourceQuery>> customQueryFilterClass : customQueryFilterClasses) {
        binder.bind(customQueryFilterClass).in(SINGLETON);
    }
    // block encoding
    binder.bind(BlockEncodingSerde.class).to(BlockEncodingManager.class).in(Scopes.SINGLETON);
    newSetBinder(binder, BlockEncoding.class);
    // catalog
    binder.bind(CatalogManager.class).in(Scopes.SINGLETON);
    // function
    binder.bind(FunctionAndTypeManager.class).in(SINGLETON);
    // handle resolver
    binder.install(new HandleJsonModule());
    // parser
    binder.bind(SqlParserOptions.class).toInstance(sqlParserOptions);
    binder.bind(SqlParser.class).in(SINGLETON);
    // transaction
    configBinder(binder).bindConfig(TransactionManagerConfig.class);
    // type
    configBinder(binder).bindConfig(FeaturesConfig.class);
    binder.bind(TypeManager.class).to(FunctionAndTypeManager.class).in(SINGLETON);
    newSetBinder(binder, Type.class);
    // verifier
    install(new VerificationQueryRewriterModule());
    install(FailureResolverModule.BUILT_IN);
    binder.bind(VerificationManager.class).in(SINGLETON);
    binder.bind(VerificationFactory.class).in(SINGLETON);
    binder.bind(ChecksumValidator.class).in(SINGLETON);
    MapBinder<Category, ColumnValidator> columnValidatorBinder = MapBinder.newMapBinder(binder, Category.class, ColumnValidator.class);
    columnValidatorBinder.addBinding(SIMPLE).to(SimpleColumnValidator.class).in(SINGLETON);
    columnValidatorBinder.addBinding(FLOATING_POINT).to(FloatingPointColumnValidator.class).in(SINGLETON);
    columnValidatorBinder.addBinding(ARRAY).to(ArrayColumnValidator.class).in(SINGLETON);
    columnValidatorBinder.addBinding(ROW).to(RowColumnValidator.class).in(SINGLETON);
    columnValidatorBinder.addBinding(MAP).to(MapColumnValidator.class).in(SINGLETON);
    binder.bind(new TypeLiteral<List<Predicate<SourceQuery>>>() {
    }).toProvider(new CustomQueryFilterProvider(customQueryFilterClasses));
}
Also used : SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) Category(com.facebook.presto.verifier.framework.Column.Category) ArrayColumnValidator(com.facebook.presto.verifier.checksum.ArrayColumnValidator) SqlParser(com.facebook.presto.sql.parser.SqlParser) FloatingPointColumnValidator(com.facebook.presto.verifier.checksum.FloatingPointColumnValidator) CatalogManager(com.facebook.presto.metadata.CatalogManager) Predicate(java.util.function.Predicate) BlockEncodingManager(com.facebook.presto.common.block.BlockEncodingManager) FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) TypeLiteral(com.google.inject.TypeLiteral) MapColumnValidator(com.facebook.presto.verifier.checksum.MapColumnValidator) ColumnValidator(com.facebook.presto.verifier.checksum.ColumnValidator) SimpleColumnValidator(com.facebook.presto.verifier.checksum.SimpleColumnValidator) RowColumnValidator(com.facebook.presto.verifier.checksum.RowColumnValidator) FloatingPointColumnValidator(com.facebook.presto.verifier.checksum.FloatingPointColumnValidator) ArrayColumnValidator(com.facebook.presto.verifier.checksum.ArrayColumnValidator) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) MapColumnValidator(com.facebook.presto.verifier.checksum.MapColumnValidator) ChecksumValidator(com.facebook.presto.verifier.checksum.ChecksumValidator) RowColumnValidator(com.facebook.presto.verifier.checksum.RowColumnValidator) SimpleColumnValidator(com.facebook.presto.verifier.checksum.SimpleColumnValidator) VerificationQueryRewriterModule(com.facebook.presto.verifier.rewrite.VerificationQueryRewriterModule)

Aggregations

BlockEncodingManager (com.facebook.presto.common.block.BlockEncodingManager)1 CatalogManager (com.facebook.presto.metadata.CatalogManager)1 FunctionAndTypeManager (com.facebook.presto.metadata.FunctionAndTypeManager)1 HandleJsonModule (com.facebook.presto.metadata.HandleJsonModule)1 SqlParser (com.facebook.presto.sql.parser.SqlParser)1 SqlParserOptions (com.facebook.presto.sql.parser.SqlParserOptions)1 ArrayColumnValidator (com.facebook.presto.verifier.checksum.ArrayColumnValidator)1 ChecksumValidator (com.facebook.presto.verifier.checksum.ChecksumValidator)1 ColumnValidator (com.facebook.presto.verifier.checksum.ColumnValidator)1 FloatingPointColumnValidator (com.facebook.presto.verifier.checksum.FloatingPointColumnValidator)1 MapColumnValidator (com.facebook.presto.verifier.checksum.MapColumnValidator)1 RowColumnValidator (com.facebook.presto.verifier.checksum.RowColumnValidator)1 SimpleColumnValidator (com.facebook.presto.verifier.checksum.SimpleColumnValidator)1 Category (com.facebook.presto.verifier.framework.Column.Category)1 VerificationQueryRewriterModule (com.facebook.presto.verifier.rewrite.VerificationQueryRewriterModule)1 TypeLiteral (com.google.inject.TypeLiteral)1 Predicate (java.util.function.Predicate)1