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

Rohini Palaniswamy commented on PIG-4934:
-----------------------------------------

Fix would be to do 

{code}
   @Override
    public void setProperty(String property, String value) {
        Properties properties = pigContext.getProperties();
        Configuration conf = ConfigurationUtil.toConfiguration(properties);
        conf.set(property, value);
        properties.clear();
        Iterator<Map.Entry<String, String>> iter = conf.iterator();
        while (iter.hasNext()) {
            Map.Entry<String, String> entry = iter.next();
            properties.put(entry.getKey(), entry.getValue());
        }
        
    }
{code}

but that is a overkill when there are lot of set commands. 
Configuration.getAlternateNames() gives all possible deprecated and new keys 
and would be easy to check if the value if properties contains any of those 
names and overwrite or add it if none of the names are present. 
Unfortunately it is a private method.  Wondering if I should access that method 
using reflection as it would be lot simpler in terms of processing. But it will 
be hacky as we are accessing a private method. Thoughts or any other ideas?

> SET command does not work well with deprecated settings
> -------------------------------------------------------
>
>                 Key: PIG-4934
>                 URL: https://issues.apache.org/jira/browse/PIG-4934
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Rohini Palaniswamy
>
> For eg: If mapred.job.map.memory.mb was specified in the script using set 
> command and mapreduce.map.memory.mb was present in mapred-site.xml, that 
> takes effect.  This is because of the use of Properties and not Configuration.
> GruntParser.processSet() calls HExecutionEngine.setProperty which just 
> updates pigContext.getProperties()
> {code}
> public void setProperty(String property, String value) {
>         Properties properties = pigContext.getProperties();
>         properties.put(property, value);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to