mirror of https://github.com/apache/druid.git
DruidViewMacro: Remove unused escalator field. (#11931)
* DruidViewMacro: Remove unused escalator field. * Remove additional unused fields.
This commit is contained in:
parent
f260bbed23
commit
b3502c3e50
|
@ -28,7 +28,6 @@ import org.apache.calcite.schema.FunctionParameter;
|
|||
import org.apache.calcite.schema.TableMacro;
|
||||
import org.apache.calcite.schema.TranslatableTable;
|
||||
import org.apache.calcite.schema.impl.ViewTable;
|
||||
import org.apache.druid.server.security.Escalator;
|
||||
import org.apache.druid.sql.calcite.planner.DruidPlanner;
|
||||
import org.apache.druid.sql.calcite.planner.PlannerFactory;
|
||||
import org.apache.druid.sql.calcite.schema.DruidSchemaName;
|
||||
|
@ -38,20 +37,17 @@ import java.util.List;
|
|||
public class DruidViewMacro implements TableMacro
|
||||
{
|
||||
private final PlannerFactory plannerFactory;
|
||||
private final Escalator escalator;
|
||||
private final String viewSql;
|
||||
private final String druidSchemaName;
|
||||
|
||||
@Inject
|
||||
public DruidViewMacro(
|
||||
@Assisted final PlannerFactory plannerFactory,
|
||||
@Assisted final Escalator escalator,
|
||||
@Assisted final String viewSql,
|
||||
@DruidSchemaName String druidSchemaName
|
||||
)
|
||||
{
|
||||
this.plannerFactory = plannerFactory;
|
||||
this.escalator = escalator;
|
||||
this.viewSql = viewSql;
|
||||
this.druidSchemaName = druidSchemaName;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.apache.druid.sql.calcite.view;
|
||||
|
||||
import org.apache.druid.server.security.Escalator;
|
||||
import org.apache.druid.sql.calcite.planner.PlannerFactory;
|
||||
|
||||
/**
|
||||
|
@ -30,5 +29,5 @@ public interface DruidViewMacroFactory
|
|||
/**
|
||||
* Creates an instance of {@link DruidViewMacro}
|
||||
*/
|
||||
DruidViewMacro create(PlannerFactory plannerFactory, Escalator escalator, String viewSql);
|
||||
DruidViewMacro create(PlannerFactory plannerFactory, String viewSql);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
import com.google.inject.Inject;
|
||||
import org.apache.calcite.schema.TableMacro;
|
||||
import org.apache.druid.java.util.common.ISE;
|
||||
import org.apache.druid.server.security.Escalator;
|
||||
import org.apache.druid.sql.calcite.planner.PlannerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -37,26 +36,20 @@ import java.util.concurrent.ConcurrentMap;
|
|||
public class InProcessViewManager implements ViewManager
|
||||
{
|
||||
private final ConcurrentMap<String, DruidViewMacro> views;
|
||||
private final Escalator escalator;
|
||||
private final DruidViewMacroFactory druidViewMacroFactory;
|
||||
|
||||
@Inject
|
||||
@VisibleForTesting
|
||||
public InProcessViewManager(
|
||||
final Escalator escalator,
|
||||
final DruidViewMacroFactory druidViewMacroFactory
|
||||
)
|
||||
public InProcessViewManager(final DruidViewMacroFactory druidViewMacroFactory)
|
||||
{
|
||||
this.views = new ConcurrentHashMap<>();
|
||||
this.escalator = escalator;
|
||||
this.druidViewMacroFactory = druidViewMacroFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createView(final PlannerFactory plannerFactory, final String viewName, final String viewSql)
|
||||
{
|
||||
final TableMacro oldValue =
|
||||
views.putIfAbsent(viewName, druidViewMacroFactory.create(plannerFactory, escalator, viewSql));
|
||||
final TableMacro oldValue = views.putIfAbsent(viewName, druidViewMacroFactory.create(plannerFactory, viewSql));
|
||||
if (oldValue != null) {
|
||||
throw new ISE("View[%s] already exists", viewName);
|
||||
}
|
||||
|
@ -65,8 +58,7 @@ public class InProcessViewManager implements ViewManager
|
|||
@Override
|
||||
public void alterView(final PlannerFactory plannerFactory, final String viewName, final String viewSql)
|
||||
{
|
||||
final TableMacro oldValue =
|
||||
views.replace(viewName, druidViewMacroFactory.create(plannerFactory, escalator, viewSql));
|
||||
final TableMacro oldValue = views.replace(viewName, druidViewMacroFactory.create(plannerFactory, viewSql));
|
||||
if (oldValue != null) {
|
||||
throw new ISE("View[%s] does not exist", viewName);
|
||||
}
|
||||
|
|
|
@ -972,8 +972,7 @@ public class BaseCalciteQueryTest extends CalciteTestBase
|
|||
ObjectMapper objectMapper
|
||||
)
|
||||
{
|
||||
final InProcessViewManager viewManager =
|
||||
new InProcessViewManager(CalciteTests.TEST_AUTHENTICATOR_ESCALATOR, CalciteTests.DRUID_VIEW_MACRO_FACTORY);
|
||||
final InProcessViewManager viewManager = new InProcessViewManager(CalciteTests.DRUID_VIEW_MACRO_FACTORY);
|
||||
DruidSchemaCatalog rootSchema = CalciteTests.createMockRootSchema(
|
||||
conglomerate,
|
||||
walker,
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.apache.druid.sql.calcite.util;
|
||||
|
||||
import org.apache.druid.server.security.Escalator;
|
||||
import org.apache.druid.sql.calcite.planner.PlannerFactory;
|
||||
import org.apache.druid.sql.calcite.view.DruidViewMacro;
|
||||
import org.apache.druid.sql.calcite.view.DruidViewMacroFactory;
|
||||
|
@ -29,10 +28,9 @@ public class TestDruidViewMacroFactory implements DruidViewMacroFactory
|
|||
@Override
|
||||
public DruidViewMacro create(
|
||||
PlannerFactory plannerFactory,
|
||||
Escalator escalator,
|
||||
String viewSql
|
||||
)
|
||||
{
|
||||
return new DruidViewMacro(plannerFactory, escalator, viewSql, CalciteTests.DRUID_SCHEMA_NAME);
|
||||
return new DruidViewMacro(plannerFactory, viewSql, CalciteTests.DRUID_SCHEMA_NAME);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue