Rename MapDataSourceJoinableFactoryWarehouse (#9275)

This commit is contained in:
Suneet Saldanha 2020-01-28 19:00:07 -08:00 committed by GitHub
parent 0ccfe5ca89
commit 6ee0afa8e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View File

@ -31,12 +31,12 @@ import java.util.Optional;
* *
* Datasources can register a factory via a DruidBinder * Datasources can register a factory via a DruidBinder
*/ */
public class MapDataSourceJoinableFactoryWarehouse implements JoinableFactory public class MapJoinableFactory implements JoinableFactory
{ {
private final Map<Class<? extends DataSource>, JoinableFactory> joinableFactories; private final Map<Class<? extends DataSource>, JoinableFactory> joinableFactories;
@Inject @Inject
MapDataSourceJoinableFactoryWarehouse(Map<Class<? extends DataSource>, JoinableFactory> joinableFactories) MapJoinableFactory(Map<Class<? extends DataSource>, JoinableFactory> joinableFactories)
{ {
// Accesses to IdentityHashMap should be faster than to HashMap or ImmutableMap. // Accesses to IdentityHashMap should be faster than to HashMap or ImmutableMap.
// Class doesn't override Object.equals(). // Class doesn't override Object.equals().

View File

@ -33,7 +33,7 @@ import org.junit.runner.RunWith;
import java.util.Optional; import java.util.Optional;
@RunWith(EasyMockRunner.class) @RunWith(EasyMockRunner.class)
public class MapDataSourceJoinableFactoryWarehouseTest public class MapJoinableFactoryTest
{ {
@Mock @Mock
private InlineDataSource inlineDataSource; private InlineDataSource inlineDataSource;
@ -45,14 +45,14 @@ public class MapDataSourceJoinableFactoryWarehouseTest
@Mock @Mock
private Joinable mockJoinable; private Joinable mockJoinable;
private MapDataSourceJoinableFactoryWarehouse target; private MapJoinableFactory target;
@Before @Before
public void setUp() public void setUp()
{ {
noopDataSource = new NoopDataSource(); noopDataSource = new NoopDataSource();
target = new MapDataSourceJoinableFactoryWarehouse( target = new MapJoinableFactory(
ImmutableMap.of(NoopDataSource.class, noopJoinableFactory)); ImmutableMap.of(NoopDataSource.class, noopJoinableFactory));
} }
@Test @Test

View File

@ -28,7 +28,7 @@ import org.apache.druid.query.DataSource;
import org.apache.druid.query.InlineDataSource; import org.apache.druid.query.InlineDataSource;
import org.apache.druid.segment.join.InlineJoinableFactory; import org.apache.druid.segment.join.InlineJoinableFactory;
import org.apache.druid.segment.join.JoinableFactory; import org.apache.druid.segment.join.JoinableFactory;
import org.apache.druid.segment.join.MapDataSourceJoinableFactoryWarehouse; import org.apache.druid.segment.join.MapJoinableFactory;
import java.util.Map; import java.util.Map;
@ -54,7 +54,7 @@ public class JoinableFactoryModule implements Module
binder.bind(factory).in(LazySingleton.class); binder.bind(factory).in(LazySingleton.class);
}); });
binder.bind(JoinableFactory.class).to(MapDataSourceJoinableFactoryWarehouse.class) binder.bind(JoinableFactory.class).to(MapJoinableFactory.class)
.in(Scopes.SINGLETON); .in(Scopes.SINGLETON);
} }
} }

View File

@ -30,7 +30,7 @@ import org.apache.druid.query.DataSource;
import org.apache.druid.query.InlineDataSource; import org.apache.druid.query.InlineDataSource;
import org.apache.druid.segment.join.InlineJoinableFactory; import org.apache.druid.segment.join.InlineJoinableFactory;
import org.apache.druid.segment.join.JoinableFactory; import org.apache.druid.segment.join.JoinableFactory;
import org.apache.druid.segment.join.MapDataSourceJoinableFactoryWarehouse; import org.apache.druid.segment.join.MapJoinableFactory;
import org.apache.druid.segment.join.NoopDataSource; import org.apache.druid.segment.join.NoopDataSource;
import org.apache.druid.segment.join.NoopJoinableFactory; import org.apache.druid.segment.join.NoopJoinableFactory;
import org.junit.Assert; import org.junit.Assert;
@ -53,7 +53,7 @@ public class JoinableFactoryModuleTest
public void testInjectJoinableFactoryIsSingleton() public void testInjectJoinableFactoryIsSingleton()
{ {
JoinableFactory factory = injector.getInstance(JoinableFactory.class); JoinableFactory factory = injector.getInstance(JoinableFactory.class);
Assert.assertEquals(MapDataSourceJoinableFactoryWarehouse.class, factory.getClass()); Assert.assertEquals(MapJoinableFactory.class, factory.getClass());
JoinableFactory otherFactory = injector.getInstance(JoinableFactory.class); JoinableFactory otherFactory = injector.getInstance(JoinableFactory.class);
Assert.assertSame(factory, otherFactory); Assert.assertSame(factory, otherFactory);
} }