Xuefu Zhang created HIVE-5656:
---------------------------------
Summary: Hive produces unclear, confusing SemanticException when
dealing with mod or pmod by zero
Key: HIVE-5656
URL: https://issues.apache.org/jira/browse/HIVE-5656
Project: Hive
Issue Type: Bug
Components: Types
Affects Versions: 0.12.0
Reporter: Xuefu Zhang
Assignee: Xuefu Zhang
{code}
hive> select 5%0 from tmp2 limit 1;
FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments '0':
org.apache.hadoop.hive.ql.metadata.HiveException: Unable to execute method
public org.apache.hadoop.io.IntWritable
org.apache.hadoop.hive.ql.udf.UDFOPMod.evaluate(org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable)
on object org.apache.hadoop.hive.ql.udf.UDFOPMod@21b594a9 of class
org.apache.hadoop.hive.ql.udf.UDFOPMod with arguments
{5:org.apache.hadoop.io.IntWritable, 0:org.apache.hadoop.io.IntWritable} of
size 2
hive> select pmod(5,0) from tmp2 limit 1;
FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments '0':
org.apache.hadoop.hive.ql.metadata.HiveException: Unable to execute method
public org.apache.hadoop.io.IntWritable
org.apache.hadoop.hive.ql.udf.UDFPosMod.evaluate(org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable)
on object org.apache.hadoop.hive.ql.udf.UDFPosMod@174ed99a of class
org.apache.hadoop.hive.ql.udf.UDFPosMod with arguments
{5:org.apache.hadoop.io.IntWritable, 0:org.apache.hadoop.io.IntWritable} of
size 2
{code}
The correct behaviour should be producing NULL.
--
This message was sent by Atlassian JIRA
(v6.1#6144)