Deny specify partition for unpartitioned table (#1319)
This commit is contained in:
@ -320,7 +320,11 @@ Status BrokerScanNode::scanner_scan(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (scan_range.params.__isset.partition_ids) {
|
||||
// The reason we check if partition_expr_ctxs is empty is when loading data to
|
||||
// a unpartitioned table who has no partition_expr_ctxs, user can specify
|
||||
// a partition name. And we check here to aovid this check and make our
|
||||
// process run as normal
|
||||
if (scan_range.params.__isset.partition_ids && !partition_expr_ctxs.empty()) {
|
||||
int64_t partition_id = get_partition_id(partition_expr_ctxs, row);
|
||||
if (partition_id == -1 ||
|
||||
!std::binary_search(scan_range.params.partition_ids.begin(),
|
||||
|
||||
@ -667,6 +667,13 @@ public class Load {
|
||||
throw new DdlException("Table [" + tableName + "] is not olap table");
|
||||
}
|
||||
|
||||
// check partition
|
||||
if (dataDescription.getPartitionNames() != null &&
|
||||
!dataDescription.getPartitionNames().isEmpty() &&
|
||||
((OlapTable) table).getPartitionInfo().getType() == PartitionType.UNPARTITIONED) {
|
||||
ErrorReport.reportDdlException(ErrorCode.ERR_PARTITION_CLAUSE_NO_ALLOWED);
|
||||
}
|
||||
|
||||
if (((OlapTable) table).getState() == OlapTableState.RESTORE) {
|
||||
throw new DdlException("Table [" + tableName + "] is under restore");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user