This is an automated email from the ASF dual-hosted git repository.
w41ter pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new ab85f294b12 branch-3.0: [fix](sql) Wrong result for alter set property
#46028 (#46140)
ab85f294b12 is described below
commit ab85f294b12fc11e62ee6f58e123691d9f76ca73
Author: Uniqueyou <[email protected]>
AuthorDate: Tue Dec 31 15:31:40 2024 +0800
branch-3.0: [fix](sql) Wrong result for alter set property #46028 (#46140)
pick https://github.com/apache/doris/pull/46028
---
.../doris/persist/ModifyTablePropertyOperationLog.java | 7 ++++++-
.../doris/persist/ModifyDynamicPartitionInfoTest.java | 13 +++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/persist/ModifyTablePropertyOperationLog.java
b/fe/fe-core/src/main/java/org/apache/doris/persist/ModifyTablePropertyOperationLog.java
index 50b49074ce1..1d64029bcfd 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/persist/ModifyTablePropertyOperationLog.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/persist/ModifyTablePropertyOperationLog.java
@@ -55,7 +55,8 @@ public class ModifyTablePropertyOperationLog implements
Writable {
StringBuilder sb = new StringBuilder();
sb.append("SET (");
for (Map.Entry<String, String> entry : properties.entrySet()) {
-
sb.append(entry.getKey()).append("=").append(entry.getValue()).append(",");
+ sb.append("\"").append(entry.getKey()).append("\"").append(" =
").append("\"").append(entry.getValue())
+ .append("\" ").append(",");
}
sb.deleteCharAt(sb.length() - 1); // remove last ','
sb.append(")");
@@ -106,4 +107,8 @@ public class ModifyTablePropertyOperationLog implements
Writable {
public String toJson() {
return GsonUtils.GSON.toJson(this);
}
+
+ public String toSql() {
+ return sql;
+ }
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/persist/ModifyDynamicPartitionInfoTest.java
b/fe/fe-core/src/test/java/org/apache/doris/persist/ModifyDynamicPartitionInfoTest.java
index bff50dcf768..a54f91dd826 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/persist/ModifyDynamicPartitionInfoTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/persist/ModifyDynamicPartitionInfoTest.java
@@ -67,4 +67,17 @@ public class ModifyDynamicPartitionInfoTest {
Assert.assertEquals(readModifyDynamicPartitionInfo.getProperties(),
properties);
in.close();
}
+
+ @Test
+ public void testToSql() {
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put(DynamicPartitionProperty.ENABLE, "true");
+ properties.put(DynamicPartitionProperty.TIME_UNIT, "day");
+ properties.put(DynamicPartitionProperty.START, "-3");
+ ModifyTablePropertyOperationLog modifyDynamicPartitionInfo = new
ModifyTablePropertyOperationLog(100L, 200L,
+ "test", properties);
+
Assert.assertTrue(modifyDynamicPartitionInfo.toSql().contains("\"dynamic_partition.enable\"
= \"true\""));
+
Assert.assertTrue(modifyDynamicPartitionInfo.toSql().contains("\"dynamic_partition.time_unit\"
= \"day\""));
+
Assert.assertTrue(modifyDynamicPartitionInfo.toSql().contains("\"dynamic_partition.start\"
= \"-3\""));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]