Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ public class QueryExecutionFactoryModule
@Override
public void configure(Binder binder)
{
var executionBinder = newMapBinder(binder, new TypeLiteral<Class<? extends Statement>>() {}, new TypeLiteral<QueryExecutionFactory<?>>() {});
MapBinder<Class<? extends Statement>, QueryExecutionFactory<?>> executionBinder =
newMapBinder(binder, new TypeLiteral<Class<? extends Statement>>() {}, new TypeLiteral<QueryExecutionFactory<?>>() {});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: How about replacing types with <> here and L177?

newMapBinder(binder, new TypeLiteral<>() {}, new TypeLiteral<>() {});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the idea of TypeLiteral<T>() {} is to capture the T (hence anonymous subclass). It should be explicit.


binder.bind(SqlQueryExecutionFactory.class).in(Scopes.SINGLETON);
for (Class<? extends Statement> statement : getNonDataDefinitionStatements()) {
Expand Down Expand Up @@ -172,7 +173,8 @@ private static <T extends Statement> void bindDataDefinitionTask(
Class<? extends DataDefinitionTask<T>> task)
{
checkArgument(isDataDefinitionStatement(statement));
var taskBinder = newMapBinder(binder, new TypeLiteral<Class<? extends Statement>>() {}, new TypeLiteral<DataDefinitionTask<?>>() {});
MapBinder<Class<? extends Statement>, DataDefinitionTask<?>> taskBinder =
newMapBinder(binder, new TypeLiteral<Class<? extends Statement>>() {}, new TypeLiteral<DataDefinitionTask<?>>() {});
taskBinder.addBinding(statement).to(task).in(Scopes.SINGLETON);
executionBinder.addBinding(statement).to(DataDefinitionExecutionFactory.class).in(Scopes.SINGLETON);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private static void testPropertyGroup(String expectedErrorMessage, Set<BiConsume
testProperties(setters);

// Dropping any one property fails
for (var setter : setters) {
for (BiConsumer<HiveAzureConfig, String> setter : setters) {
assertThatThrownBy(() -> testProperties(difference(setters, Set.of(setter))))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage(expectedErrorMessage);
Expand All @@ -101,8 +101,8 @@ private static void testProperties(BiConsumer<HiveAzureConfig, String>... setter

private static void testProperties(Set<BiConsumer<HiveAzureConfig, String>> setters)
{
var config = new HiveAzureConfig();
for (var setter : setters) {
HiveAzureConfig config = new HiveAzureConfig();
for (BiConsumer<HiveAzureConfig, String> setter : setters) {
setter.accept(config, "test value");
}
new TrinoAzureConfigurationInitializer(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public void testFlushHiveMetastoreCacheProcedureCallable()
@Test
public void testIllegalFlushHiveMetastoreCacheProcedureCalls()
{
var illegalParameterMessage = "Illegal parameter set passed. ";
var validUsageExample = "Valid usages:\n - 'flush_metadata_cache()'\n - flush_metadata_cache(schema_name => ..., table_name => ..., partition_column => ARRAY['...'], partition_value => ARRAY['...'])";
String illegalParameterMessage = "Illegal parameter set passed. ";
String validUsageExample = "Valid usages:\n - 'flush_metadata_cache()'\n - flush_metadata_cache(schema_name => ..., table_name => ..., partition_column => ARRAY['...'], partition_value => ARRAY['...'])";

assertThatThrownBy(() -> getQueryRunner().execute("CALL system.flush_metadata_cache('dummy_schema')"))
.hasMessage("Procedure should only be invoked with named parameters. " + validUsageExample);
Expand Down