Skip to content

Commit

Permalink
Inject type analyzer into SqlQueryExecution instead of creating it
Browse files Browse the repository at this point in the history
  • Loading branch information
homar authored and findepi committed Nov 22, 2021
1 parent a0fb364 commit 16be328
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public class SqlQueryExecution
private final Slug slug;
private final Metadata metadata;
private final TypeOperators typeOperators;
private final SqlParser sqlParser;
private final SplitManager splitManager;
private final NodePartitioningManager nodePartitioningManager;
private final NodeScheduler nodeScheduler;
Expand All @@ -133,6 +132,7 @@ public class SqlQueryExecution
private final CostCalculator costCalculator;
private final DynamicFilterService dynamicFilterService;
private final TableExecuteContextManager tableExecuteContextManager;
private final TypeAnalyzer typeAnalyzer;

private SqlQueryExecution(
PreparedQuery preparedQuery,
Expand Down Expand Up @@ -161,13 +161,13 @@ private SqlQueryExecution(
CostCalculator costCalculator,
DynamicFilterService dynamicFilterService,
WarningCollector warningCollector,
TableExecuteContextManager tableExecuteContextManager)
TableExecuteContextManager tableExecuteContextManager,
TypeAnalyzer typeAnalyzer)
{
try (SetThreadName ignored = new SetThreadName("Query-%s", stateMachine.getQueryId())) {
this.slug = requireNonNull(slug, "slug is null");
this.metadata = requireNonNull(metadata, "metadata is null");
this.typeOperators = requireNonNull(typeOperators, "typeOperators is null");
this.sqlParser = requireNonNull(sqlParser, "sqlParser is null");
this.splitManager = requireNonNull(splitManager, "splitManager is null");
this.nodePartitioningManager = requireNonNull(nodePartitioningManager, "nodePartitioningManager is null");
this.nodeScheduler = requireNonNull(nodeScheduler, "nodeScheduler is null");
Expand Down Expand Up @@ -217,6 +217,7 @@ private SqlQueryExecution(
});

this.remoteTaskFactory = new MemoryTrackingRemoteTaskFactory(requireNonNull(remoteTaskFactory, "remoteTaskFactory is null"), stateMachine);
this.typeAnalyzer = requireNonNull(typeAnalyzer, "typeAnalyzer is null");
}
}

Expand Down Expand Up @@ -488,7 +489,7 @@ private PlanRoot doPlanQuery()
idAllocator,
metadata,
typeOperators,
new TypeAnalyzer(sqlParser, metadata),
typeAnalyzer,
statsCalculator,
costCalculator,
stateMachine.getWarningCollector());
Expand Down Expand Up @@ -750,6 +751,7 @@ public static class SqlQueryExecutionFactory
private final CostCalculator costCalculator;
private final DynamicFilterService dynamicFilterService;
private final TableExecuteContextManager tableExecuteContextManager;
private final TypeAnalyzer typeAnalyzer;

@Inject
SqlQueryExecutionFactory(
Expand All @@ -775,7 +777,8 @@ public static class SqlQueryExecutionFactory
StatsCalculator statsCalculator,
CostCalculator costCalculator,
DynamicFilterService dynamicFilterService,
TableExecuteContextManager tableExecuteContextManager)
TableExecuteContextManager tableExecuteContextManager,
TypeAnalyzer typeAnalyzer)
{
requireNonNull(config, "config is null");
this.schedulerStats = requireNonNull(schedulerStats, "schedulerStats is null");
Expand All @@ -801,6 +804,7 @@ public static class SqlQueryExecutionFactory
this.costCalculator = requireNonNull(costCalculator, "costCalculator is null");
this.dynamicFilterService = requireNonNull(dynamicFilterService, "dynamicFilterService is null");
this.tableExecuteContextManager = requireNonNull(tableExecuteContextManager, "tableExecuteContextManager is null");
this.typeAnalyzer = requireNonNull(typeAnalyzer, "typeAnalyzer is null");
}

@Override
Expand Down Expand Up @@ -841,7 +845,8 @@ public QueryExecution createQueryExecution(
costCalculator,
dynamicFilterService,
warningCollector,
tableExecuteContextManager);
tableExecuteContextManager,
typeAnalyzer);
}
}
}

0 comments on commit 16be328

Please sign in to comment.