Sujana
Sujana

Reputation: 331

Converting a String object to TEXT object in hadoop

How do I convert a String object to a Text object in hadoop without using a constructor? There is a Text to String method available, but I couldn't find a String to Text method.

Upvotes: 1

Views: 8011

Answers (2)

coderz
coderz

Reputation: 4999

Text text = new Text("your-string");

or

Text text = new Text();
text.set("your-string");

Upvotes: 1

Ankur Shanbhag
Ankur Shanbhag

Reputation: 7804

Text class constructor has this provision. Click here.

OR

You can use Text.set(String) method..

Upvotes: 0

Related Questions