Zhihua Deng created HIVE-24639:
----------------------------------

             Summary: Raises SemanticException other than ClassCastException 
when filter has non-boolean expressions
                 Key: HIVE-24639
                 URL: https://issues.apache.org/jira/browse/HIVE-24639
             Project: Hive
          Issue Type: Improvement
            Reporter: Zhihua Deng


Sometimes we see ClassCastException in filters when fetching some rows of a 
table or executing the query.  The 
GenericUDFOPOr/GenericUDFOPAnd/FilterOperator assume that the output of their 
conditions should be a boolean,  but there is no garanteed.  For example: 

_select * from ccn_table where src + 1;_ 

will throw ClassCastException:
{code:java}
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to 
java.lang.Boolean
    at 
org.apache.hadoop.hive.ql.exec.FilterOperator.process(FilterOperator.java:125)
    at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:888)
    at 
org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:173)
    at 
org.apache.hadoop.hive.ql.exec.MapOperator$MapOpCtx.forward(MapOperator.java:153)
    at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:553)
    ...{code}
We'd better to validate the filter during analyzing instead of at runtime and 
bring more meaningful messages.

 
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to