Skip to content

[Enhancement] fix duplicated properties is not reported #32729

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

Closed
wants to merge 7 commits into from
Closed
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 @@ -1249,14 +1249,21 @@ private static ReplicaAllocation analyzeReplicaAllocationImpl(Map<String, String
if (properties == null || properties.isEmpty()) {
return ReplicaAllocation.NOT_SET;
}
String propKey = Strings.isNullOrEmpty(prefix) ? PROPERTIES_REPLICATION_ALLOCATION
: prefix + "." + PROPERTIES_REPLICATION_ALLOCATION;

// if give "replication_num" property, return with default backend tag
Short replicaNum = analyzeReplicationNum(properties, prefix, (short) 0);
if (replicaNum > 0) {
return new ReplicaAllocation(replicaNum);
ReplicaAllocation replicaAlloc = new ReplicaAllocation(replicaNum);
if (properties.containsKey(propKey)) {
throw new AnalysisException("Invalid replication parameter: replication_num and "
+ "replication_allocation can not be used together");
}
return replicaAlloc;
}

String propKey = Strings.isNullOrEmpty(prefix) ? PROPERTIES_REPLICATION_ALLOCATION
: prefix + "." + PROPERTIES_REPLICATION_ALLOCATION;

// if not set, return default replication allocation
if (!properties.containsKey(propKey)) {
return ReplicaAllocation.NOT_SET;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ suite("add_table_policy_by_modify_partition") {
PARTITION p2 VALUES LESS THAN ("2022-02-01") ("storage_policy" = "tmp2" ,"replication_num"="1")
) DISTRIBUTED BY HASH(k2) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"storage_policy" = "created_create_table_partition_alter_policy"
);
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ suite("add_table_policy_by_modify_partition_hdfs") {
PARTITION p2 VALUES LESS THAN ("2022-02-01") ("storage_policy" = "tmp2_hdfs" ,"replication_num"="1")
) DISTRIBUTED BY HASH(k2) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"storage_policy" = "created_create_table_partition_alter_policy_hdfs"
);
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,45 @@ suite("test_create_table_properties") {
qt_select """ select * from ${tblName1} partition p5 order by DATA_STAMP"""
qt_select """ select * from ${tblName1} partition p8 order by DATA_STAMP"""

}

try {
sql "drop table if exists ${tblName1}"
sql """
CREATE TABLE ${tblName1} (
id int,
k decimal(12,2)
) ENGINE=OLAP
DISTRIBUTED BY HASH(id) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"replication_num" = "1"
);
"""
assertTrue(false, "should not be able to execute")
}
catch (Exception ex) {
assertTrue(ex.getMessage().contains("Invalid replication parameter: replication_num and replication_allocation can not be used together"))
} finally {
}


try {
sql "drop table if exists ${tblName1}"
sql """
CREATE TABLE ${tblName1} (
id int,
k decimal(12,2)
) ENGINE=OLAP
DISTRIBUTED BY HASH(id) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"replication_num" = "1"
);
"""
assertTrue(false, "should not be able to execute")
}
catch (Exception ex) {
assertTrue(ex.getMessage().contains("Invalid replication parameter: replication_num and replication_allocation can not be used together"))
} finally {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ suite ("test_alter_colocate_table") {
);
"""

def errMsg = "Cannot change replication allocation of colocate table"
def errMsg = "Invalid replication parameter: replication_num and replication_allocation can not be used together"

test {
sql """
Expand Down
Loading