Removed unused planner context parameter (#13249)

Removed unused planner context parameter
This commit is contained in:
Paul Rogers 2022-10-27 17:59:26 -07:00 committed by GitHub
parent acb9cb0227
commit 22c140251a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 7 additions and 23 deletions

View File

@ -206,11 +206,7 @@ public class DirectStatement extends AbstractStatement implements Cancelable
try (DruidPlanner planner = sqlToolbox.plannerFactory.createPlanner(
sqlToolbox.engine,
queryPlus.sql(),
queryContext,
// Context keys for authorization. Use the user-provided keys,
// NOT the keys from the query context which, by this point,
// will have been extended with internally-defined values.
queryPlus.context().keySet()
queryContext
)) {
validate(planner);
authorize(planner, authorizer());

View File

@ -68,8 +68,7 @@ public class PreparedStatement extends AbstractStatement
try (DruidPlanner planner = sqlToolbox.plannerFactory.createPlanner(
sqlToolbox.engine,
queryPlus.sql(),
queryContext,
queryPlus.context().keySet())) {
queryContext)) {
validate(planner);
authorize(planner, authorizer());

View File

@ -113,7 +113,6 @@ public class PlannerContext
final DruidSchemaCatalog rootSchema,
final SqlEngine engine,
final Map<String, Object> queryContext,
final Set<String> contextKeys,
final JoinableFactoryWrapper joinableFactoryWrapper
)
{
@ -146,7 +145,6 @@ public class PlannerContext
final DruidSchemaCatalog rootSchema,
final SqlEngine engine,
final Map<String, Object> queryContext,
final Set<String> contextKeys,
final JoinableFactoryWrapper joinableFactoryWrapper
)
{
@ -187,7 +185,6 @@ public class PlannerContext
rootSchema,
engine,
queryContext,
contextKeys,
joinableFactoryWrapper
);
}

View File

@ -51,7 +51,6 @@ import org.apache.druid.sql.calcite.schema.DruidSchemaName;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
public class PlannerFactory
{
@ -105,8 +104,7 @@ public class PlannerFactory
public DruidPlanner createPlanner(
final SqlEngine engine,
final String sql,
final Map<String, Object> queryContext,
Set<String> contextKeys
final Map<String, Object> queryContext
)
{
final PlannerContext context = PlannerContext.create(
@ -118,7 +116,6 @@ public class PlannerFactory
rootSchema,
engine,
queryContext,
contextKeys,
joinableFactoryWrapper
);
@ -132,7 +129,7 @@ public class PlannerFactory
@VisibleForTesting
public DruidPlanner createPlannerForTesting(final SqlEngine engine, final String sql, final Map<String, Object> queryContext)
{
final DruidPlanner thePlanner = createPlanner(engine, sql, queryContext, queryContext.keySet());
final DruidPlanner thePlanner = createPlanner(engine, sql, queryContext);
thePlanner.getPlannerContext()
.setAuthenticationResult(NoopEscalator.getInstance().createEscalatedAuthenticationResult());
try {

View File

@ -61,8 +61,7 @@ public class DruidViewMacro implements TableMacro
plannerFactory.createPlanner(
ViewSqlEngine.INSTANCE,
viewSql,
Collections.emptyMap(),
Collections.emptySet())) {
Collections.emptyMap())) {
planner.validate();
rowType = planner.prepare().getValidatedRowType();
}

View File

@ -88,9 +88,8 @@ class ExpressionTestHelper
NamedViewSchema.NAME, new NamedViewSchema(EasyMock.createMock(ViewSchema.class))
)
),
null /* Don't need engine */,
null, /* Don't need engine */
Collections.emptyMap(),
Collections.emptySet(),
JOINABLE_FACTORY_WRAPPER
);

View File

@ -64,7 +64,6 @@ public class ExternalTableScanRuleTest
),
engine,
Collections.emptyMap(),
Collections.emptySet(),
CalciteTests.createJoinableFactoryWrapper()
);
plannerContext.setQueryMaker(

View File

@ -179,7 +179,6 @@ public class CalcitePlannerModuleTest extends CalciteTestBase
rootSchema,
null,
Collections.emptyMap(),
Collections.emptySet(),
joinableFactoryWrapper
);
boolean containsCustomRule = injector.getInstance(CalciteRulesManager.class)

View File

@ -95,9 +95,8 @@ public class DruidRexExecutorTest extends InitializedNullHandlingTest
NamedViewSchema.NAME, new NamedViewSchema(EasyMock.createMock(ViewSchema.class))
)
),
null /* Don't need an engine */,
null, /* Don't need an engine */
Collections.emptyMap(),
Collections.emptySet(),
CalciteTests.createJoinableFactoryWrapper()
);