This commit is contained in:
Zoltan Haindrich 2024-05-16 11:11:55 +00:00
parent 93892b6524
commit 688611eab3
1 changed files with 11 additions and 11 deletions

View File

@ -21,8 +21,11 @@ package org.apache.druid.sql.calcite.schema;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Provides;
import com.google.inject.Scopes;
import com.google.inject.name.Named;
import com.google.inject.name.Names;
import org.apache.druid.guice.LazySingleton;
import org.apache.druid.guice.LifecycleModule;
import org.apache.druid.sql.guice.SqlBindings;
@ -31,9 +34,6 @@ import org.apache.druid.sql.guice.SqlBindings;
*/
public class DruidCalciteSchemaModule implements Module
{
public DruidCalciteSchemaModule(){
}
private static final String DRUID_SCHEMA_NAME = "druid";
private static final String INFORMATION_SCHEMA_NAME = "INFORMATION_SCHEMA";
static final String INCOMPLETE_SCHEMA = "INCOMPLETE_SCHEMA";
@ -44,7 +44,7 @@ public class DruidCalciteSchemaModule implements Module
binder.bind(String.class).annotatedWith(DruidSchemaName.class).toInstance(DRUID_SCHEMA_NAME);
// Should only be used by the information schema
binder.bind(DruidSchemaCatalog.class)
binder.bind(DruidSchemaCatalog.class)
.annotatedWith(Names.named(INCOMPLETE_SCHEMA))
.toProvider(RootSchemaProvider.class)
.in(Scopes.SINGLETON);
@ -64,11 +64,11 @@ public class DruidCalciteSchemaModule implements Module
SqlBindings.addSchema(binder, NamedViewSchema.class);
}
// @Provides
// @LazySingleton
// private DruidSchemaCatalog getRootSchema(@Named(INCOMPLETE_SCHEMA) DruidSchemaCatalog rootSchema, InformationSchema informationSchema)
// {
// rootSchema.getRootSchema().add(INFORMATION_SCHEMA_NAME, informationSchema);
// return rootSchema;
// }
@Provides
@LazySingleton
private DruidSchemaCatalog getRootSchema(@Named(INCOMPLETE_SCHEMA) DruidSchemaCatalog rootSchema, InformationSchema informationSchema)
{
rootSchema.getRootSchema().add(INFORMATION_SCHEMA_NAME, informationSchema);
return rootSchema;
}
}