This is an automated email from the ASF dual-hosted git repository.
dataroaring 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 43f8b963553 branch-3.0: [fix](catalog) Fix infinity partition key
toSql #44834 (#44889)
43f8b963553 is described below
commit 43f8b963553f80c8215aed3bc3d4089eedf88773
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Dec 3 21:56:55 2024 +0800
branch-3.0: [fix](catalog) Fix infinity partition key toSql #44834 (#44889)
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 f9640ccae14..29bfda8b201 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
@@ -373,15 +373,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 affd5a4cc2c..c6b45c0b136 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
@@ -268,4 +268,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]