[ 
https://issues.apache.org/jira/browse/CALCITE-7244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18037645#comment-18037645
 ] 

Steve Carlin commented on CALCITE-7244:
---------------------------------------

Finally hit my breaking point here.

1.41 introduced a problem for me with the LIKE command.  I don't have the 
details yet and I still have to figure out how to repro in Calcite, but because 
of some new simplifyLike code, my 
LIKE($1, CAST("hello%" AS VARCHAR(MAX_INT)) 

changes to
LIKE($1, RexLIteral(RelDataType VARCHAR(MAX_INT) (with SqlType of CHAR)

and on the second pass through simplify, it changes to

LIKE($1, RexLiteral(RelDataType CHAR())
...totally losing my cast because of this line of code:
https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L525

The code in makeLiteral is generally problematic since it blindly changes 
VARCHAR to CHAR.  You won't allow me my hole, so I guess I need to figure out 
how to clean this up and still remain backward compatible, and I'm not sure 
that's possible.

> Support for VARCHAR RexLiteral
> ------------------------------
>
>                 Key: CALCITE-7244
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7244
>             Project: Calcite
>          Issue Type: Wish
>            Reporter: Steve Carlin
>            Priority: Major
>
> Oh, the powers that be:
> I would be oh so happy if we can remove this line of code:
> [https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L381|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L374]
> ...or at least allow a character RexLiteral to be created with type VARCHAR
> You see, when I do a CTAS statement with a "select 'hello'", it creates a 
> STRING datatype, not a CHAR datatype in my database.  Since I currently can't 
> create a RexLiteral VARCHAR, I have to introduce a CAST around the literal, 
> and I can't do this until RelNode/RexNode time.  Even worse, when I have a 
> Values RelNode, I have to create a Project on top of the Values with a cast.
> Please, oh please, take this into consideration and allow this.  It would 
> make my code a lot simpler.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to