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

Ayush Saxena commented on HIVE-28110:
-------------------------------------

I don't think we can do {{toString()}} here. The correct way would be the 
client to call {{getAsString()}}  or {{getBoolVar()}}, There maybe cases where 
the defaultVal object doesn't have its own {{toString()}} in that case it would 
return the value from the Object class.

I don't think it is a bug, but a wrong way of using the method

> MetastoreConf - String casting of default values breaks Hive
> ------------------------------------------------------------
>
>                 Key: HIVE-28110
>                 URL: https://issues.apache.org/jira/browse/HIVE-28110
>             Project: Hive
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: All Versions
>         Environment: Ubuntu 22.04
> VSCode with Extension Pack for Java
> CommitHash: bee33d2018 on Apache Hive master branch 
> (https://github.com/apache/hive)
>            Reporter: Dominik Diedrich
>            Assignee: tanishqchugh
>            Priority: Minor
>              Labels: easyfix, pull-request-available
>
> When using the *getVar(Configuration conf, ConfVars var)* method of the 
> MetastoreConf class, Apache breaks when e.g. trying to retrieve the 
> environment variable "USE_SSL" and it isn't set in the system. The method 
> then tries to cast the default value, which is the boolean false for USE_SSL, 
> to a String which can't work.
>  
> {quote}{{return val == null ? conf.get(var.hiveName, 
> {color:#FF0000}*(String)var.defaultVal*{color}) : val;}}{quote}
>  
> Also in the *getStringCollection(Configuration conf, ConfVars var)* method it 
> tries to cast any default values to a String.
>  
> Strangely, e.g. in the method *get(Configuration conf, String key)* the 
> default value isn't casted but the .toString() method is called, which should 
> be also done for the 2 methods I mentioned above.
>  
> If nobody has time for that fix, I could open a PR for that.



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

Reply via email to