use of io.druid.query.lookup.LookupIntrospectHandler in project druid by druid-io.
the class CalciteTests method createOperatorTable.
public static DruidOperatorTable createOperatorTable() {
try {
final Injector injector = Guice.createInjector(new Module() {
@Override
public void configure(final Binder binder) {
// This Module is just to get a LookupReferencesManager with a usable "lookyloo" lookup.
final LookupReferencesManager mock = EasyMock.createMock(LookupReferencesManager.class);
EasyMock.expect(mock.get(EasyMock.eq("lookyloo"))).andReturn(new LookupExtractorFactory() {
@Override
public boolean start() {
throw new UnsupportedOperationException();
}
@Override
public boolean close() {
throw new UnsupportedOperationException();
}
@Override
public boolean replaces(@Nullable final LookupExtractorFactory other) {
throw new UnsupportedOperationException();
}
@Nullable
@Override
public LookupIntrospectHandler getIntrospectHandler() {
throw new UnsupportedOperationException();
}
@Override
public LookupExtractor get() {
return new MapLookupExtractor(ImmutableMap.of("a", "xa", "abc", "xabc"), false);
}
}).anyTimes();
EasyMock.replay(mock);
binder.bind(LookupReferencesManager.class).toInstance(mock);
}
});
final Set<SqlAggregator> aggregators = new HashSet<>();
final Set<SqlExtractionOperator> extractionOperators = new HashSet<>();
for (Class<? extends SqlAggregator> clazz : SqlModule.DEFAULT_AGGREGATOR_CLASSES) {
aggregators.add(injector.getInstance(clazz));
}
for (Class<? extends SqlExtractionOperator> clazz : SqlModule.DEFAULT_EXTRACTION_OPERATOR_CLASSES) {
extractionOperators.add(injector.getInstance(clazz));
}
return new DruidOperatorTable(aggregators, extractionOperators);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
Aggregations