Conversation
01dfcf8 to
81b718c
Compare
c307fab to
a9d2a16
Compare
7fa8be0 to
75c801b
Compare
martint
left a comment
There was a problem hiding this comment.
Reviewed up to "Remove SessionPropertyManager from Metadata"
plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/integration/ThriftQueryRunner.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/analyzer/StatementAnalyzerFactory.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/connector/ConnectorManager.java
Outdated
Show resolved
Hide resolved
2987b03 to
4b6fdd2
Compare
testing/trino-tests/src/test/java/io/trino/security/TestAccessControl.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/TestCreateMaterializedViewTask.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/TestCreateMaterializedViewTask.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/BlockEncodingManager.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/LiteralFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/TypeRegistry.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
You could convert this to LoadingCache now
core/trino-main/src/main/java/io/trino/execution/SetSessionTask.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/CreateTableTask.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Does it make sense to extract Metadata in the constructor for all of these, since that's the only field they use?
There was a problem hiding this comment.
All of these tasks actually use the planner context. The downstream services need it.
4b6fdd2 to
17fa973
Compare
| .addAll(new UnwrapRowSubscript().rules()) | ||
| .addAll(new PushCastIntoRow().rules()) | ||
| .addAll(new UnwrapCastInComparison(metadata, typeOperators, typeAnalyzer).rules()) | ||
| .addAll(new UnwrapCastInComparison(plannerContext, typeAnalyzer).rules()) |
There was a problem hiding this comment.
any reason why planner context doesn't include the type analyzer?
| new RemoveRedundantIdentityProjections(), | ||
| new PushDownProjectionsFromPatternRecognition())), | ||
| new MetadataQueryOptimizer(metadata), | ||
| new MetadataQueryOptimizer(plannerContext), |
There was a problem hiding this comment.
The choice which optimizers now take plannerContext and which continue to take metadata looks arbitrary. What's the rule?
| Session session, | ||
| Expression predicate, | ||
| TypeProvider types) | ||
| public static ExtractionResult getExtractionResult(PlannerContext plannerContext, Session session, Expression predicate, TypeProvider types) |
There was a problem hiding this comment.
Update TestDomainTranslator.testFrom*Predicate* methods
|
|
||
| @Inject | ||
| public TypeAnalyzer(SqlParser parser, Metadata metadata) | ||
| public TypeAnalyzer(PlannerContext plannerContext, StatementAnalyzerFactory statementAnalyzerFactory, AccessControl accessControl) |
There was a problem hiding this comment.
Previous TypeAnalyzer signature was: TypeAnalyzer(SqlParser parser, Metadata metadata).
That was kind of easy to understand.
Why does it need all these things now?
@martint can you perhaps explain this to me?
There was a problem hiding this comment.
In particular, in a unit test i could create TypeAnalyzer like this
TypeAnalyzer typeAnalyzer = new TypeAnalyzer(new SqlParser(), createTestMetadataManager());Now it seems this takes
Metadata metadata = createTestMetadataManager();
TypeOperators typeOperators = new TypeOperators();
InternalTypeManager typeManager = new InternalTypeManager(new TypeRegistry(typeOperators, new FeaturesConfig()));
PlannerContext plannerContext = new PlannerContext(
metadata,
typeOperators,
new InternalBlockEncodingSerde(new BlockEncodingManager(), typeManager),
TESTING_TYPE_MANAGER);
TypeAnalyzer typeAnalyzer = createTestingTypeAnalyzer(plannerContext);
to get same thing.
Metadata is being used as a dumping ground for unrelated services, because it is present in all places in the analyzer and optimizer. This PR makes more parts of the analyzer injectable, and remove most unnecessary services from metadata manager.