Skip to content

Commit

Permalink
[CALCITE-6762] Literal Varchar
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaochen-zhou committed Jan 7, 2025
1 parent 10e2e81 commit df02345
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeSystem;
import org.apache.calcite.rex.RexCall;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexUtil;
import org.apache.calcite.sql.SqlBasicCall;
import org.apache.calcite.sql.SqlCall;
Expand All @@ -35,6 +36,7 @@
import org.apache.calcite.sql.fun.SqlMapValueConstructor;
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import org.apache.calcite.sql.parser.SqlParserPos;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.sql.type.SqlTypeUtil;
import org.apache.calcite.util.RelToSqlConverterUtil;

Expand Down Expand Up @@ -88,8 +90,10 @@ public PrestoSqlDialect(Context context) {
}

@Override public boolean supportsImplicitTypeCoercion(RexCall call) {
RexNode rexNode = call.getOperands().get(0);
return super.supportsImplicitTypeCoercion(call)
&& RexUtil.isLiteral(call.getOperands().get(0), false)
&& RexUtil.isLiteral(rexNode, false)
&& (rexNode.getType().getSqlTypeName() == SqlTypeName.VARCHAR || rexNode.getType().getSqlTypeName() == SqlTypeName.CHAR)

Check failure on line 96 in core/src/main/java/org/apache/calcite/sql/dialect/PrestoSqlDialect.java

View workflow job for this annotation

GitHub Actions / Linux (JDK 11, Avatica main)

[Task :core:checkstyleMain] [LineLength] Line is longer than 100 characters (found 128).

Check failure on line 96 in core/src/main/java/org/apache/calcite/sql/dialect/PrestoSqlDialect.java

View workflow job for this annotation

GitHub Actions / Linux (JDK 11, Pacific/Chatham Timezone)

[Task :core:checkstyleMain] [LineLength] Line is longer than 100 characters (found 128).

Check failure on line 96 in core/src/main/java/org/apache/calcite/sql/dialect/PrestoSqlDialect.java

View workflow job for this annotation

GitHub Actions / Linux (JDK 17)

[Task :core:checkstyleMain] [LineLength] Line is longer than 100 characters (found 128).

Check failure on line 96 in core/src/main/java/org/apache/calcite/sql/dialect/PrestoSqlDialect.java

View workflow job for this annotation

GitHub Actions / Linux (JDK 21)

[Task :core:checkstyleMain] [LineLength] Line is longer than 100 characters (found 128).

Check failure on line 96 in core/src/main/java/org/apache/calcite/sql/dialect/PrestoSqlDialect.java

View workflow job for this annotation

GitHub Actions / Linux (JDK 23)

[Task :core:checkstyleMain] [LineLength] Line is longer than 100 characters (found 128).

Check failure on line 96 in core/src/main/java/org/apache/calcite/sql/dialect/PrestoSqlDialect.java

View workflow job for this annotation

GitHub Actions / Linux (JDK 8, latest Guava, America/New_York Timezone)

[Task :core:checkstyleMain] [LineLength] Line is longer than 100 characters (found 128).

Check failure on line 96 in core/src/main/java/org/apache/calcite/sql/dialect/PrestoSqlDialect.java

View workflow job for this annotation

GitHub Actions / Linux (JDK 8, oldest Guava, America/New_York Timezone)

[Task :core:checkstyleMain] [LineLength] Line is longer than 100 characters (found 128).
&& !SqlTypeUtil.isNumeric(call.type)
&& !SqlTypeUtil.isDate(call.type)
&& !SqlTypeUtil.isTimestamp(call.type);
Expand Down

0 comments on commit df02345

Please sign in to comment.