Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,11 @@ public static final class TableQueryOperatorChecker extends DefaultPlanVisitor<B
public Boolean visitLogicalRelation(LogicalRelation relation, Void context) {
if (relation instanceof LogicalFileScan) {
LogicalFileScan fileScan = (LogicalFileScan) relation;
// Relation scan parameters can select data different from the MV refresh input.
// Relation scan operators can select data different from the MV refresh input.
// Treat them as query operators until rewrite can prove equivalent semantics.
if (fileScan.getTableSample().isPresent() || fileScan.getScanParams().isPresent()) {
if (fileScan.getTableSample().isPresent()
|| fileScan.getScanParams().isPresent()
|| fileScan.getTableSnapshot().isPresent()) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.doris.nereids.rules.exploration.mv;

import org.apache.doris.analysis.TableScanParams;
import org.apache.doris.analysis.TableSnapshot;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.mtmv.BaseTableInfo;
Expand Down Expand Up @@ -940,6 +941,17 @@ public void containTableQueryOperatorWithFileScanParamsTest() {
.visitLogicalRelation(fileScan, null));
}

@Test
public void containTableQueryOperatorWithTableSnapshotTest() {
LogicalFileScan fileScan = Mockito.mock(LogicalFileScan.class);
Mockito.when(fileScan.getTableSample()).thenReturn(Optional.empty());
Mockito.when(fileScan.getScanParams()).thenReturn(Optional.empty());
Mockito.when(fileScan.getTableSnapshot()).thenReturn(Optional.of(TableSnapshot.versionOf("1")));

Assertions.assertTrue(MaterializedViewUtils.TableQueryOperatorChecker.INSTANCE
.visitLogicalRelation(fileScan, null));
}

@Test
public void getRelatedTableInfoWhenMultiPartitionExprs() {
PlanChecker.from(connectContext)
Expand Down
Loading