Skip to content

Commit

Permalink
Add support for Glue metastore cache
Browse files Browse the repository at this point in the history
  • Loading branch information
gs-asrivastav authored and sopel39 committed Oct 1, 2019
1 parent c152592 commit e2a81a5
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import io.prestosql.plugin.hive.metastore.HiveMetastore;
import io.prestosql.plugin.hive.metastore.RecordingHiveMetastore;
import io.prestosql.plugin.hive.metastore.WriteHiveMetastoreRecordingProcedure;
import io.prestosql.plugin.hive.metastore.cache.CachingHiveMetastoreModule;
import io.prestosql.plugin.hive.metastore.cache.ForCachingHiveMetastore;
import io.prestosql.spi.procedure.Procedure;

import static com.google.inject.multibindings.Multibinder.newSetBinder;
Expand All @@ -44,17 +46,24 @@ protected void setup(Binder binder)
binder.bind(GlueHiveMetastore.class).in(Scopes.SINGLETON);
newExporter(binder).export(GlueHiveMetastore.class).withGeneratedName();

binder.bind(HiveMetastore.class).to(RecordingHiveMetastore.class).in(Scopes.SINGLETON);
binder.bind(HiveMetastore.class)
.annotatedWith(ForCachingHiveMetastore.class)
.to(RecordingHiveMetastore.class)
.in(Scopes.SINGLETON);
binder.bind(RecordingHiveMetastore.class).in(Scopes.SINGLETON);
newExporter(binder).export(RecordingHiveMetastore.class).withGeneratedName();

Multibinder<Procedure> procedures = newSetBinder(binder, Procedure.class);
procedures.addBinding().toProvider(WriteHiveMetastoreRecordingProcedure.class).in(Scopes.SINGLETON);
}
else {
binder.bind(HiveMetastore.class).to(GlueHiveMetastore.class).in(Scopes.SINGLETON);
binder.bind(HiveMetastore.class)
.annotatedWith(ForCachingHiveMetastore.class)
.to(GlueHiveMetastore.class)
.in(Scopes.SINGLETON);
newExporter(binder).export(HiveMetastore.class)
.as(generator -> generator.generatedNameOf(GlueHiveMetastore.class));
}
binder.install(new CachingHiveMetastoreModule());
}
}

0 comments on commit e2a81a5

Please sign in to comment.