You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-user@hadoop.apache.org by darekg11 <da...@tlen.pl> on 2015/11/14 23:48:12 UTC

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.

RE: Problem regarding conf.set(String, String[] values) Hadoop 2.6

Posted by andreina j <an...@huawei.com>.
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.

Thanks
Andreina
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.

RE: Problem regarding conf.set(String, String[] values) Hadoop 2.6

Posted by andreina j <an...@huawei.com>.
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.

Thanks
Andreina
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.

RE: Problem regarding conf.set(String, String[] values) Hadoop 2.6

Posted by andreina j <an...@huawei.com>.
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.

Thanks
Andreina
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.

RE: Problem regarding conf.set(String, String[] values) Hadoop 2.6

Posted by andreina j <an...@huawei.com>.
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.

Thanks
Andreina
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.