Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deardeng committed Jun 26, 2024
1 parent e923a48 commit 520d6b2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1486,9 +1486,9 @@ public static long checkAndGetBufferSize(long indexNum, long bucketNum,
public PartitionPersistInfo addPartition(Database db, String tableName, AddPartitionClause addPartitionClause,
boolean isCreateTable, long generatedPartitionId,
boolean writeEditLog) throws DdlException {
// isCreateTable == true, create dynamic partition use, so partitionId must have been generated.
// in cloud mode, isCreateTable == true, create dynamic partition use, so partitionId must have been generated.
// isCreateTable == false, other case, partitionId generate in below, must be set 0
if (!FeConstants.runningUnitTest
if (!FeConstants.runningUnitTest && Config.isCloudMode()
&& (isCreateTable && generatedPartitionId == 0) || (!isCreateTable && generatedPartitionId != 0)) {
throw new DdlException("not impossible");
}
Expand Down Expand Up @@ -1678,7 +1678,7 @@ public PartitionPersistInfo addPartition(Database db, String tableName, AddParti
}
};
try {
long partitionId = !FeConstants.runningUnitTest && isCreateTable
long partitionId = Config.isCloudMode() && !FeConstants.runningUnitTest && isCreateTable
? generatedPartitionId : idGeneratorBuffer.getNextId();
List<Long> partitionIds = Lists.newArrayList(partitionId);
List<Long> indexIds = new ArrayList<>(indexIdToMeta.keySet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,22 +922,22 @@ public void testCreateTableWithMinLoadReplicaNum() throws Exception {

@Test
public void testCreateTableWithNerieds() throws Exception {
// ExceptionChecker.expectThrowsWithMsg(org.apache.doris.nereids.exceptions.AnalysisException.class,
// "Failed to check min load replica num",
// () -> createTable("create table test.tbl_min_load_replica_num_2_nereids\n"
// + "(k1 int, k2 int)\n"
// + "duplicate key(k1)\n"
// + "distributed by hash(k1) buckets 1\n"
// + "properties(\n"
// + " 'replication_num' = '2',\n"
// + " 'min_load_replica_num' = '3'\n"
// + ");", true));

// ExceptionChecker.expectThrowsNoException(
// () -> createTable("create table test.tbl_no_properties\n"
// + "(k1 int, k2 int)\n"
// + "duplicate key(k1)\n"
// + "distributed by hash(k1) buckets 1", true));
ExceptionChecker.expectThrowsWithMsg(org.apache.doris.nereids.exceptions.AnalysisException.class,
"Failed to check min load replica num",
() -> createTable("create table test.tbl_min_load_replica_num_2_nereids\n"
+ "(k1 int, k2 int)\n"
+ "duplicate key(k1)\n"
+ "distributed by hash(k1) buckets 1\n"
+ "properties(\n"
+ " 'replication_num' = '2',\n"
+ " 'min_load_replica_num' = '3'\n"
+ ");", true));

ExceptionChecker.expectThrowsNoException(
() -> createTable("create table test.tbl_no_properties\n"
+ "(k1 int, k2 int)\n"
+ "duplicate key(k1)\n"
+ "distributed by hash(k1) buckets 1", true));

ExceptionChecker.expectThrowsNoException(
() -> createTable("create table test.tbl_range_part_no_properties\n"
Expand Down

0 comments on commit 520d6b2

Please sign in to comment.