Skip to content

Commit

Permalink
[CALCITE-6705] Allow for dialect-specific unparsing for numeric literals
Browse files Browse the repository at this point in the history
  • Loading branch information
tanclary committed Nov 25, 2024
1 parent 1e6d205 commit 9bf490f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions core/src/main/java/org/apache/calcite/sql/SqlDialect.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ public void unparseDateTimeLiteral(SqlWriter writer,
writer.literal(literal.toString());
}

public void unparseNumericLiteral(SqlWriter writer,
String value, int leftPrec, int rightPrec) {
writer.literal(value);
}

public void unparseSqlDatetimeArithmetic(SqlWriter writer,
SqlCall call, SqlKind sqlKind, int leftPrec, int rightPrec) {
final SqlWriter.Frame frame = writer.startList("(", ")");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public boolean isExact() {
SqlWriter writer,
int leftPrec,
int rightPrec) {
writer.literal(toValue());
writer.getDialect().unparseNumericLiteral(writer, toValue(), leftPrec, rightPrec);
}

@Override public String toValue() {
Expand Down

0 comments on commit 9bf490f

Please sign in to comment.