hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreina j <andrein...@huawei.com>
Subject RE: Problem regarding conf.set(String, String[] values) Hadoop 2.6
Date Sun, 15 Nov 2015 05:53:49 GMT
Hi Darek,

               To set a string of array as a value for a configuration property we have to
set using below api
                              conf.setStrings(String name, String... values)
               and the value can be fetched using
                              conf.get(String name)

               Note: In javadoc it is mentioned that,  can set an array of string values for
a property as a comma delimited values.

               Hence as per javadoc it is expected that if the value itself has got comma
, then it will be considered as a delimiter.

From: darekg11 [mailto:darekg11@tlen.pl]
Sent: 15 November 2015 AM 04:18
To: user@hadoop.apache.org
Subject: Problem regarding conf.set(String, String[] values) Hadoop 2.6

Hello, dear users - it is my first time on this mailing list so I hope I am asking in the
right section.
I decided to write about this issue on this mailing list because to be honest I don't know
if this is bug or feature ; )

My problem:

Addings array of strings to Configuration object via conf.set(String name, String values...)
and later retrieving it via conf.get fails for case when Your string ends with comma.

Following example:

String[] values = new String[2];
values[0] = "Test";
values[1] = "Test1,";

conf.set("Test mode", values);
String[] orginalValues = conf.get("Test mode")

Results in:
originalValues[0] = "Test"
originalValues[1] = "Test1"

I would like to know if it is bug or the way it is suppose to eb due to comma seperation of
strings in StringUtils.
View raw message