[
https://issues.apache.org/jira/browse/CALCITE-7244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18034200#comment-18034200
]
Steve Carlin commented on CALCITE-7244:
---------------------------------------
[~mbudiu] [~julianhyde] ,Wanted to ask this again with a small modification. I
think this would be a non-disruptive change and yet would really help me make
my code simpler.
I ask for 2 things:
1) Make the RexLiteral constructor protected rather than package protected. I
don't think this really affects the integrity of Calcite. In fact, RexCall is
already set in protected mode so this would make the Calcite code more
symmetric.
2) I would need to override the valuesMatchesType method to do my own thing
when called from the constructor. The only problem here is that the method is
static. So the way I can solve my problem is to introduce a non-static method
that wraps around the static method. This non-static method would also need
protected rights, but now I can overload "MyRexLiteral extends RexLiteral" with
my own version.
I'm not sure the testing policy on things like this. This doesn't really
introduce any new functionality...would I need to add a test for it?
Lemme know what you think, but it would be fantastic for me if I could add
this, thanks!
> 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)