This is an automated email from the ASF dual-hosted git repository.
w41ter pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new d9ef316cdbf branch-2.1: [fix](catalog) Fix infinity partition key
toSql #44834 (#44890)
d9ef316cdbf is described below
commit d9ef316cdbfe563b898d89da05e844cc9b9cf4b9
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Dec 3 14:12:47 2024 +0800
branch-2.1: [fix](catalog) Fix infinity partition key toSql #44834 (#44890)
Cherry-picked from #44834
Co-authored-by: walter <[email protected]>
---
fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java | 3 +--
.../src/test/java/org/apache/doris/catalog/PartitionKeyTest.java | 6 ++++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java
index ac2beeadb85..401111af66a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java
@@ -304,15 +304,14 @@ public class PartitionKey implements
Comparable<PartitionKey>, Writable {
if (expr == MaxLiteral.MAX_VALUE || expr.isNullLiteral()) {
value = expr.toSql();
sb.append(value);
- continue;
} else {
value = "\"" + expr.getRealValue() + "\"";
if (expr instanceof DateLiteral) {
DateLiteral dateLiteral = (DateLiteral) expr;
value = dateLiteral.toSql();
}
+ sb.append(value);
}
- sb.append(value);
if (keys.size() - 1 != i) {
sb.append(", ");
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/catalog/PartitionKeyTest.java
b/fe/fe-core/src/test/java/org/apache/doris/catalog/PartitionKeyTest.java
index 7030a237a48..05ad77788ec 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/PartitionKeyTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/PartitionKeyTest.java
@@ -269,4 +269,10 @@ public class PartitionKeyTest {
dis.close();
Files.deleteIfExists(path);
}
+
+ @Test
+ public void testMaxValueToSql() throws Exception {
+ PartitionKey key = PartitionKey.createInfinityPartitionKey(allColumns,
true);
+ Assert.assertEquals("(MAXVALUE, MAXVALUE, MAXVALUE, MAXVALUE,
MAXVALUE, MAXVALUE, MAXVALUE)", key.toSql());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]