Gabriel39 commented on code in PR #71373:
URL: https://github.com/apache/doris/pull/71373#discussion_r4794057146
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -223,7 +223,11 @@ public void run() throws JobException {
if (mtmv.getMvPartitionInfo().getPartitionType() !=
MTMVPartitionType.SELF_MANAGE) {
Set<MTMVRelatedTableIf> pctTables =
mtmv.getMvPartitionInfo().getPctTables();
for (MTMVRelatedTableIf pctTable : pctTables) {
- if (!pctTable.isValidRelatedTable()) {
+ Optional<MvccSnapshot> snapshot = pctTable instanceof
MvccTable
+ ? Optional.ofNullable(snapshots.get(new
MvccTableInfo((MvccTable) pctTable)))
+ : Optional.empty();
+ // Qualification must describe the same files that
alignment and execution read.
+ if (!pctTable.isValidRelatedTable(snapshot)) {
Review Comment:
The previous commit restored the caller after schema analysis.
aaa5876972852879d421a6601c0c25739fade531 also seeds the temporary analysis
context with the task's already materialized pins before binding. Alignment,
freshness capture and execution therefore retain one generation, including with
partition caching disabled. Success/failure tests now assert the captured pin
inside analysis and verify temporary resources close without closing the
caller's resources. Equivalent handling is in #71365.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergUtils.java:
##########
@@ -2345,13 +2338,29 @@ static IcebergPartitionInfo
loadPartitionInfo(ExternalTable dorisTable, Table ta
static IcebergPartitionInfo loadPartitionInfo(String displayName, Table
table,
long snapshotId, long schemaId, ExecutionAuthenticator
authenticator,
boolean enableMappingVarbinary, boolean enableMappingTimestampTz)
throws AnalysisException {
- if (snapshotId == IcebergUtils.UNKNOWN_SNAPSHOT_ID) {
- return IcebergPartitionInfo.empty();
+ if (snapshotId == IcebergUtils.UNKNOWN_SNAPSHOT_ID &&
isLegacySupportedRelatedTable(table)) {
+ return new IcebergPartitionInfo(Collections.emptyMap(),
Collections.emptyMap(), Collections.emptyMap());
}
List<IcebergPartition> icebergPartitions;
List<Column> partitionColumns;
try {
- icebergPartitions = authenticator.execute(() ->
loadIcebergPartition(table, snapshotId));
+ if (IcebergMvPartitionSnapshot.supportsAllSpecs(table)) {
+ icebergPartitions = authenticator.execute(() ->
loadIcebergPartition(table, snapshotId));
+ } else {
+ IcebergMvPartitionSnapshot projection = authenticator.execute(
Review Comment:
Fixed in aaa5876972852879d421a6601c0c25739fade531. Ordinary native scan
binding skips the MV partition map when there are no MV candidates or active
SQL partition-metadata rules; Iceberg still plans the files using its
predicates. MV candidates and partition-policy consumers retain the projection,
since disabling it for them would lose compensation coverage or policy checks.
The adapter test verifies ordinary binding never requests columns/items and
checks both retained consumers. Equivalent intent is preserved by master's
plugin scan path in #71365.
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -580,6 +584,7 @@ private void beforeMTMVRefresh() throws AnalysisException,
DdlException {
if (tableIf instanceof MvccTable) {
MvccTable mvccTable = (MvccTable) tableIf;
MvccSnapshot mvccSnapshot =
mvccTable.loadSnapshot(Optional.empty(), Optional.empty());
+ mvccSnapshot =
mvccTable.materializePartitionViewForMtmv(mvccSnapshot);
Review Comment:
Fixed in aaa5876972852879d421a6601c0c25739fade531. Every dependency is still
pinned, but ordinary refresh materializes the partition view only for persisted
PCT inputs. Complete/self-managed refresh and non-PCT dimensions avoid that
hook. A partitioned SCHEMA_CHANGE refresh additionally warms newly discovered
partition candidates before table locks, since an altered view can add a PCT
dependency. Four task tests cover these cases; the same change is in #71365.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]