pick https://github.com/apache/doris/pull/46028
This commit is contained in:
@ -51,7 +51,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(")");
|
||||
@ -82,4 +83,8 @@ public class ModifyTablePropertyOperationLog implements Writable {
|
||||
public String toJson() {
|
||||
return GsonUtils.GSON.toJson(this);
|
||||
}
|
||||
|
||||
public String toSql() {
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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\""));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user