This is an automated email from the ASF dual-hosted git repository.

mihaibudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new 89fb4ab4bd Addendum to [CALCITE-7475]: correction for unparse method
89fb4ab4bd is described below

commit 89fb4ab4bdb4545c428c9219b302bbd1c946dd43
Author: Mihai Budiu <[email protected]>
AuthorDate: Fri May 15 11:29:44 2026 -0700

    Addendum to [CALCITE-7475]: correction for unparse method
    
    Signed-off-by: Mihai Budiu <[email protected]>
---
 babel/src/test/java/org/apache/calcite/test/BabelParserTest.java   | 5 +++++
 core/src/main/java/org/apache/calcite/sql/fun/SqlCastOperator.java | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java 
b/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java
index d566642227..b24b619027 100644
--- a/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java
+++ b/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java
@@ -625,6 +625,11 @@ private void checkParseInfixCast(String sqlType) {
     f.sql("DISCARD TEMP").same();
   }
 
+  @Test void testColonUnparse() {
+    final SqlParserFixture f = 
fixture().withDialect(PostgresqlSqlDialect.DEFAULT);
+    f.expression().sql("1::INT").ok("(1 :: INTEGER)");
+  }
+
   @Test void testSparkLeftAntiJoin() {
     final SqlParserFixture f = fixture().withDialect(SparkSqlDialect.DEFAULT);
     final String sql = "select a.cid, a.cname, count(1) as amount\n"
diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlCastOperator.java 
b/core/src/main/java/org/apache/calcite/sql/fun/SqlCastOperator.java
index 723bb014a5..abb2a5c2ee 100644
--- a/core/src/main/java/org/apache/calcite/sql/fun/SqlCastOperator.java
+++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlCastOperator.java
@@ -49,12 +49,13 @@ class SqlCastOperator extends SqlBinaryOperator {
   }
 
   @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, 
int rightPrec) {
-    writer.sep("(");
+    writer.print("(");
     call.operand(0).unparse(writer, 0, 0);
     writer.keyword("::");
     call.operand(1).unparse(writer, 0, 0);
-    writer.sep(")");
+    writer.print(")");
   }
+
   @Override public RelDataType inferReturnType(
       SqlOperatorBinding opBinding) {
     return SqlStdOperatorTable.CAST.inferReturnType(opBinding);

Reply via email to