FAQ
Data file:
{(2985671202194220139)}

Pig script:
a = load 'data' as (list: bag{t: tuple(value: chararray)});
dump a

Output:
2008-12-13 09:08:24,831 [main] ERROR
org.apache.pig.tools.grunt.GruntParser - java.io.IOException: Unable
to open iterator for alias: a [Unable to store for alias: a [For input
string: "2985671202194220139"]]
at org.apache.pig.backend.local.executionengine.LocalExecutionEngine.execute(LocalExecutionEngine.java:178)
at org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:647)
at org.apache.pig.PigServer.store(PigServer.java:452)
at org.apache.pig.PigServer.store(PigServer.java:421)
at org.apache.pig.PigServer.openIterator(PigServer.java:384)
at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:269)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:178)
at org.apache.pig.tools.grunt.GruntParser.parseContOnError(GruntParser.java:94)
at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:58)
at org.apache.pig.Main.main(Main.java:282)
Caused by: java.io.IOException: Unable to store for alias: a [For
input string: "2985671202194220139"]
... 10 more
Caused by: org.apache.pig.backend.executionengine.ExecException: For
input string: "2985671202194220139"
... 10 more
Caused by: java.lang.NumberFormatException: For input string:
"2985671202194220139"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:459)
at java.lang.Integer.parseInt(Integer.java:497)
at org.apache.pig.data.parser.TextDataParser.AtomDatum(TextDataParser.java:291)
at org.apache.pig.data.parser.TextDataParser.Datum(TextDataParser.java:359)
at org.apache.pig.data.parser.TextDataParser.Tuple(TextDataParser.java:149)
at org.apache.pig.data.parser.TextDataParser.Bag(TextDataParser.java:85)
at org.apache.pig.data.parser.TextDataParser.Datum(TextDataParser.java:345)
at org.apache.pig.data.parser.TextDataParser.Parse(TextDataParser.java:42)
at org.apache.pig.builtin.Utf8StorageConverter.parseFromBytes(Utf8StorageConverter.java:70)
at org.apache.pig.builtin.Utf8StorageConverter.bytesToBag(Utf8StorageConverter.java:78)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POCast.getNext(POCast.java:861)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.processPlan(POForEach.java:243)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNext(POForEach.java:197)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.processInput(PhysicalOperator.java:226)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POStore.store(POStore.java:137)
at org.apache.pig.backend.local.executionengine.LocalPigLauncher.launchPig(LocalPigLauncher.java:62)
at org.apache.pig.backend.local.executionengine.LocalExecutionEngine.execute(LocalExecutionEngine.java:166)
... 9 more

2008-12-13 09:08:24,833 [main] ERROR
org.apache.pig.tools.grunt.GruntParser - Unable to open iterator for
alias: a [Unable to store for alias: a [For input string:
"2985671202194220139"]]
2008-12-13 09:08:24,834 [main] ERROR
org.apache.pig.tools.grunt.GruntParser - java.io.IOException: Unable
to open iterator for alias: a [Unable to store for alias: a [For input
string: "2985671202194220139"]]

Looks like strings are casted to integers while being read, in spite
of chararray type was stated for bag items.

Is there a way to avoid this error without quoting strings?
Thanks.

Search Discussions

  • Santhosh Srinivasan at Dec 16, 2008 at 7:15 pm
    The text data parser treats a sequence of numerals as an integer. It
    looks like the number you have is too large to fit into an integer.
    Append an L to the number to make it a long integer and then you can use
    the statements that you have in your email.

    Data file:
    {(2985671202194220139L)}
    ---------------------^

    Pig script:
    a = load 'data' as (list: bag{t: tuple(value: chararray)});
    dump a

    We need to fix the issue in our text data parser to handle these
    exceptions.

    Thanks,
    Santhosh

    -----Original Message-----
    From: radgara@gmail.com On Behalf Of
    daga@ya.ru
    Sent: Friday, December 12, 2008 10:39 PM
    To: pig-user@hadoop.apache.org
    Subject: Got NumberFormatException while reading a bag of strings

    Data file:
    {(2985671202194220139)}

    Pig script:
    a = load 'data' as (list: bag{t: tuple(value: chararray)});
    dump a

    Output:
    2008-12-13 09:08:24,831 [main] ERROR
    org.apache.pig.tools.grunt.GruntParser - java.io.IOException: Unable
    to open iterator for alias: a [Unable to store for alias: a [For input
    string: "2985671202194220139"]]
    at
    org.apache.pig.backend.local.executionengine.LocalExecutionEngine.execut
    e(LocalExecutionEngine.java:178)
    at
    org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:647)
    at org.apache.pig.PigServer.store(PigServer.java:452)
    at org.apache.pig.PigServer.store(PigServer.java:421)
    at org.apache.pig.PigServer.openIterator(PigServer.java:384)
    at
    org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:269)
    at
    org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptPar
    ser.java:178)
    at
    org.apache.pig.tools.grunt.GruntParser.parseContOnError(GruntParser.java
    :94)
    at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:58)
    at org.apache.pig.Main.main(Main.java:282)
    Caused by: java.io.IOException: Unable to store for alias: a [For
    input string: "2985671202194220139"]
    ... 10 more
    Caused by: org.apache.pig.backend.executionengine.ExecException: For
    input string: "2985671202194220139"
    ... 10 more
    Caused by: java.lang.NumberFormatException: For input string:
    "2985671202194220139"
    at
    java.lang.NumberFormatException.forInputString(NumberFormatException.jav
    a:48)
    at java.lang.Integer.parseInt(Integer.java:459)
    at java.lang.Integer.parseInt(Integer.java:497)
    at
    org.apache.pig.data.parser.TextDataParser.AtomDatum(TextDataParser.java:
    291)
    at
    org.apache.pig.data.parser.TextDataParser.Datum(TextDataParser.java:359)
    at
    org.apache.pig.data.parser.TextDataParser.Tuple(TextDataParser.java:149)
    at
    org.apache.pig.data.parser.TextDataParser.Bag(TextDataParser.java:85)
    at
    org.apache.pig.data.parser.TextDataParser.Datum(TextDataParser.java:345)
    at
    org.apache.pig.data.parser.TextDataParser.Parse(TextDataParser.java:42)
    at
    org.apache.pig.builtin.Utf8StorageConverter.parseFromBytes(Utf8StorageCo
    nverter.java:70)
    at
    org.apache.pig.builtin.Utf8StorageConverter.bytesToBag(Utf8StorageConver
    ter.java:78)
    at
    org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOp
    erators.POCast.getNext(POCast.java:861)
    at
    org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOp
    erators.POForEach.processPlan(POForEach.java:243)
    at
    org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOp
    erators.POForEach.getNext(POForEach.java:197)
    at
    org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOper
    ator.processInput(PhysicalOperator.java:226)
    at
    org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOp
    erators.POStore.store(POStore.java:137)
    at
    org.apache.pig.backend.local.executionengine.LocalPigLauncher.launchPig(
    LocalPigLauncher.java:62)
    at
    org.apache.pig.backend.local.executionengine.LocalExecutionEngine.execut
    e(LocalExecutionEngine.java:166)
    ... 9 more

    2008-12-13 09:08:24,833 [main] ERROR
    org.apache.pig.tools.grunt.GruntParser - Unable to open iterator for
    alias: a [Unable to store for alias: a [For input string:
    "2985671202194220139"]]
    2008-12-13 09:08:24,834 [main] ERROR
    org.apache.pig.tools.grunt.GruntParser - java.io.IOException: Unable
    to open iterator for alias: a [Unable to store for alias: a [For input
    string: "2985671202194220139"]]

    Looks like strings are casted to integers while being read, in spite
    of chararray type was stated for bag items.

    Is there a way to avoid this error without quoting strings?
    Thanks.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedDec 13, '08 at 5:34p
activeDec 16, '08 at 7:15p
posts2
users2
websitepig.apache.org

2 users in discussion

Daga: 1 post Santhosh Srinivasan: 1 post

People

Translate

site design / logo © 2022 Grokbase