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

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

So I already have a solution in my use of Calcite and 90% of it is basically 
exactly what you just mentioned.  There are a couple of catches to this, of 
course.  Specifically, I have to recreate the RelNodes and propagate the change 
upward if the row type changes.  I also have to deal with the LogicalValues 
which only allow RexLiterals, so I have to create a Project (and also propagate 
that upwards).

And this is coded already :) 

But yeah...that's why I put this down as a "wish".  I could get rid of a lot of 
clunky code if we could make a really small change and make this allowable 
instead of just "strict".  

I guess I sorta find this similar to how the number 2 can be represented as 
multiple different RelDataTypes.  Can we just allow this creation?  Since it 
throws an exception right now, we know that no code uses this.  I'm just asking 
to get rid of the exception throw on strict=true, allow it to always 
fall-through if it's strict or non-strict.  I don't think this would break 
anything.

> 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