Skip to content

Commit

Permalink
[fix](catalog) Fix infinity partition key toSql (apache#44834)
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter authored Dec 3, 2024
1 parent ee3f09d commit c382dcc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,14 @@ public String toSql() {
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(", ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,10 @@ public void testSerialization() throws Exception {
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());
}
}

0 comments on commit c382dcc

Please sign in to comment.