diff --git a/be/src/exec/broker_scan_node.cpp b/be/src/exec/broker_scan_node.cpp index 3cf999a31c..e107e39d8d 100644 --- a/be/src/exec/broker_scan_node.cpp +++ b/be/src/exec/broker_scan_node.cpp @@ -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(), diff --git a/fe/src/main/java/org/apache/doris/load/Load.java b/fe/src/main/java/org/apache/doris/load/Load.java index e60cbd8a98..e8b679f177 100644 --- a/fe/src/main/java/org/apache/doris/load/Load.java +++ b/fe/src/main/java/org/apache/doris/load/Load.java @@ -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"); }