You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Haitao Yao (JIRA)" <ji...@apache.org> on 2012/07/19 12:03:35 UTC
[jira] [Created] (PIG-2828) DataType.compare null
Haitao Yao created PIG-2828:
-------------------------------
Summary: DataType.compare null
Key: PIG-2828
URL: https://issues.apache.org/jira/browse/PIG-2828
Project: Pig
Issue Type: Bug
Affects Versions: 0.9.2
Reporter: Haitao Yao
While using TOP, and if the DataBag contains null value to compare, it will generate the following exception:
Caused by: java.lang.NullPointerException
at org.apache.pig.data.DataType.compare(DataType.java:427)
at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:97)
at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:1)
at java.util.PriorityQueue.siftUpUsingComparator(PriorityQueue.java:649)
at java.util.PriorityQueue.siftUp(PriorityQueue.java:627)
at java.util.PriorityQueue.offer(PriorityQueue.java:329)
at java.util.PriorityQueue.add(PriorityQueue.java:306)
at org.apache.pig.builtin.TOP.updateTop(TOP.java:141)
at org.apache.pig.builtin.TOP.exec(TOP.java:116)
code: (TOP.java, starts with line 91)
Object field1 = o1.get(fieldNum);
Object field2 = o2.get(fieldNum);
if (!typeFound) {
datatype = DataType.findType(field1);
typeFound = true;
}
return DataType.compare(field1, field2, datatype, datatype);
The reason is that if the typeFound is true , and the dataType is not null, and field1 is null, the script failed.
So we need to judge the field1 whether is null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIG-2828) DataType.compare null
Posted by "Haitao Yao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13418870#comment-13418870 ]
Haitao Yao commented on PIG-2828:
---------------------------------
I've read the latest code from github, and the code is patched from the github master
> DataType.compare null
> ---------------------
>
> Key: PIG-2828
> URL: https://issues.apache.org/jira/browse/PIG-2828
> Project: Pig
> Issue Type: Bug
> Reporter: Haitao Yao
> Attachments: DataType.patch
>
>
> While using TOP, and if the DataBag contains null value to compare, it will generate the following exception:
> Caused by: java.lang.NullPointerException
> at org.apache.pig.data.DataType.compare(DataType.java:427)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:97)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:1)
> at java.util.PriorityQueue.siftUpUsingComparator(PriorityQueue.java:649)
> at java.util.PriorityQueue.siftUp(PriorityQueue.java:627)
> at java.util.PriorityQueue.offer(PriorityQueue.java:329)
> at java.util.PriorityQueue.add(PriorityQueue.java:306)
> at org.apache.pig.builtin.TOP.updateTop(TOP.java:141)
> at org.apache.pig.builtin.TOP.exec(TOP.java:116)
> code: (TOP.java, starts with line 91)
> Object field1 = o1.get(fieldNum);
> Object field2 = o2.get(fieldNum);
> if (!typeFound) {
> datatype = DataType.findType(field1);
> typeFound = true;
> }
> return DataType.compare(field1, field2, datatype, datatype);
> The reason is that if the typeFound is true , and the dataType is not null, and field1 is null, the script failed.
> So we need to judge the field1 whether is null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIG-2828) DataType.compare null
Posted by "Jonathan Coveney (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13481775#comment-13481775 ]
Jonathan Coveney commented on PIG-2828:
---------------------------------------
It would be nice to add a unit test that isolates this case.
> DataType.compare null
> ---------------------
>
> Key: PIG-2828
> URL: https://issues.apache.org/jira/browse/PIG-2828
> Project: Pig
> Issue Type: Bug
> Reporter: Haitao Yao
> Attachments: DataType.patch
>
>
> While using TOP, and if the DataBag contains null value to compare, it will generate the following exception:
> Caused by: java.lang.NullPointerException
> at org.apache.pig.data.DataType.compare(DataType.java:427)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:97)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:1)
> at java.util.PriorityQueue.siftUpUsingComparator(PriorityQueue.java:649)
> at java.util.PriorityQueue.siftUp(PriorityQueue.java:627)
> at java.util.PriorityQueue.offer(PriorityQueue.java:329)
> at java.util.PriorityQueue.add(PriorityQueue.java:306)
> at org.apache.pig.builtin.TOP.updateTop(TOP.java:141)
> at org.apache.pig.builtin.TOP.exec(TOP.java:116)
> code: (TOP.java, starts with line 91)
> Object field1 = o1.get(fieldNum);
> Object field2 = o2.get(fieldNum);
> if (!typeFound) {
> datatype = DataType.findType(field1);
> typeFound = true;
> }
> return DataType.compare(field1, field2, datatype, datatype);
> The reason is that if the typeFound is true , and the dataType is not null, and field1 is null, the script failed.
> So we need to judge the field1 whether is null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIG-2828) DataType.compare null
Posted by "Haitao Yao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Haitao Yao updated PIG-2828:
----------------------------
Affects Version/s: (was: 0.9.2)
> DataType.compare null
> ---------------------
>
> Key: PIG-2828
> URL: https://issues.apache.org/jira/browse/PIG-2828
> Project: Pig
> Issue Type: Bug
> Reporter: Haitao Yao
> Attachments: DataType.patch
>
>
> While using TOP, and if the DataBag contains null value to compare, it will generate the following exception:
> Caused by: java.lang.NullPointerException
> at org.apache.pig.data.DataType.compare(DataType.java:427)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:97)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:1)
> at java.util.PriorityQueue.siftUpUsingComparator(PriorityQueue.java:649)
> at java.util.PriorityQueue.siftUp(PriorityQueue.java:627)
> at java.util.PriorityQueue.offer(PriorityQueue.java:329)
> at java.util.PriorityQueue.add(PriorityQueue.java:306)
> at org.apache.pig.builtin.TOP.updateTop(TOP.java:141)
> at org.apache.pig.builtin.TOP.exec(TOP.java:116)
> code: (TOP.java, starts with line 91)
> Object field1 = o1.get(fieldNum);
> Object field2 = o2.get(fieldNum);
> if (!typeFound) {
> datatype = DataType.findType(field1);
> typeFound = true;
> }
> return DataType.compare(field1, field2, datatype, datatype);
> The reason is that if the typeFound is true , and the dataType is not null, and field1 is null, the script failed.
> So we need to judge the field1 whether is null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIG-2828) DataType.compare null
Posted by "Haitao Yao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Haitao Yao updated PIG-2828:
----------------------------
Attachment: DataType.patch
here's my patch.
> DataType.compare null
> ---------------------
>
> Key: PIG-2828
> URL: https://issues.apache.org/jira/browse/PIG-2828
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.9.2
> Reporter: Haitao Yao
> Attachments: DataType.patch
>
>
> While using TOP, and if the DataBag contains null value to compare, it will generate the following exception:
> Caused by: java.lang.NullPointerException
> at org.apache.pig.data.DataType.compare(DataType.java:427)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:97)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:1)
> at java.util.PriorityQueue.siftUpUsingComparator(PriorityQueue.java:649)
> at java.util.PriorityQueue.siftUp(PriorityQueue.java:627)
> at java.util.PriorityQueue.offer(PriorityQueue.java:329)
> at java.util.PriorityQueue.add(PriorityQueue.java:306)
> at org.apache.pig.builtin.TOP.updateTop(TOP.java:141)
> at org.apache.pig.builtin.TOP.exec(TOP.java:116)
> code: (TOP.java, starts with line 91)
> Object field1 = o1.get(fieldNum);
> Object field2 = o2.get(fieldNum);
> if (!typeFound) {
> datatype = DataType.findType(field1);
> typeFound = true;
> }
> return DataType.compare(field1, field2, datatype, datatype);
> The reason is that if the typeFound is true , and the dataType is not null, and field1 is null, the script failed.
> So we need to judge the field1 whether is null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIG-2828) DataType.compare null
Posted by "Haitao Yao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Haitao Yao updated PIG-2828:
----------------------------
Attachment: test.patch
unit test for the DataType
> DataType.compare null
> ---------------------
>
> Key: PIG-2828
> URL: https://issues.apache.org/jira/browse/PIG-2828
> Project: Pig
> Issue Type: Bug
> Reporter: Haitao Yao
> Attachments: DataType.patch, test.patch
>
>
> While using TOP, and if the DataBag contains null value to compare, it will generate the following exception:
> Caused by: java.lang.NullPointerException
> at org.apache.pig.data.DataType.compare(DataType.java:427)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:97)
> at org.apache.pig.builtin.TOP$TupleComparator.compare(TOP.java:1)
> at java.util.PriorityQueue.siftUpUsingComparator(PriorityQueue.java:649)
> at java.util.PriorityQueue.siftUp(PriorityQueue.java:627)
> at java.util.PriorityQueue.offer(PriorityQueue.java:329)
> at java.util.PriorityQueue.add(PriorityQueue.java:306)
> at org.apache.pig.builtin.TOP.updateTop(TOP.java:141)
> at org.apache.pig.builtin.TOP.exec(TOP.java:116)
> code: (TOP.java, starts with line 91)
> Object field1 = o1.get(fieldNum);
> Object field2 = o2.get(fieldNum);
> if (!typeFound) {
> datatype = DataType.findType(field1);
> typeFound = true;
> }
> return DataType.compare(field1, field2, datatype, datatype);
> The reason is that if the typeFound is true , and the dataType is not null, and field1 is null, the script failed.
> So we need to judge the field1 whether is null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira