ramesh0201 commented on PR #5384:
URL: https://github.com/apache/hive/pull/5384#issuecomment-2274218902
> @ramesh0201 From what I understand, we are never going into `case VARCHAR`
when dealing with a literal. In that case, do we even need a case for varchar?
Just trying to understand if it's dead code or if there are scenarios where we
go into the varchar case for literals.
>
> Other than this, the change and the tests look good to me :)
We still need that code, it is not dead code.
1. cast(''(identified as char) as varchar) -> converting '' goes to the char
case of the switch, whereas {'' as varchar} goes to the varchar case when
converting the input to the cast(but it goes to the null block on the if
condition)
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java#L290
2. cast('test'(identified as char) as varchar) -> converting 'test' goes to
the char case of the switch, whereas {'test' as varchar} goes to the varchar
case when converting the input to the cast(this time it goes to the else block)
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java#L367
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]