Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement]support query when only restoring a few partitions of this table #40768

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
19 changes: 8 additions & 11 deletions fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -830,17 +830,14 @@ public TableRef resolveTableRef(TableRef tableRef) throws AnalysisException {
.getDbOrAnalysisException(tableName.getDb());
TableIf table = database.getTableOrAnalysisException(tableName.getTbl());

if (table.isManagedTable() && (((OlapTable) table).getState() == OlapTableState.RESTORE
|| ((OlapTable) table).getState() == OlapTableState.RESTORE_WITH_LOAD)) {
Boolean isAnyPartitionRestoring = ((OlapTable) table).getPartitions().stream()
.anyMatch(partition -> partition.getState() == PartitionState.RESTORE);
if (isAnyPartitionRestoring) {
// if doing restore with partitions, the status check push down to OlapScanNode::computePartitionInfo to
// support query that partitions is not restoring.
} else {
// if doing restore with table, throw exception here
ErrorReport.reportAnalysisException(ErrorCode.ERR_BAD_TABLE_STATE, "RESTORING");
}
Boolean isAllPartitionRestoring = ((OlapTable) table).getPartitions().stream()
.allMatch(partition -> partition.getState() == PartitionState.RESTORE);

// if doing restore with table, all partition state will set also, throw exception here
// if doing restore with a few of partitions, the status check push down to OlapScanNode::computePartitionInfo to
// support query that partitions is not restoring.
if (table.isManagedTable() && isAllPartitionRestoring) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_BAD_TABLE_STATE, "RESTORING");
}

// Now hms table only support a bit of table kinds in the whole hive system.
Expand Down
Loading