BOOL types should implicitly cast to INT
----------------------------------------

                 Key: HIVE-1703
                 URL: https://issues.apache.org/jira/browse/HIVE-1703
             Project: Hadoop Hive
          Issue Type: Improvement
          Components: Query Processor
            Reporter: Adam Kramer
            Priority: Minor


>From the Wiki:
"Otherwise, the operator is probably a UDF/UDAF function. In that case, we will 
try to convert the parameters to the types that are accepted by the UDF/UDAF 
function. If the UDF/UDAF function is overloaded (with more than 1 
implementations with different types), we will try to find the one with least 
number of type conversions needed."

However,
SELECT SUM(thing=otherthing) FROM table
...fails, because thing=otherthing is a bool, and there is no system by which 
BOOL would convert to INT, as it should. INT is higher precision, so this 
should always work. Explicit casting, SUM(CAST(thing=otherthing AS INT)) works 
just fine.

(yes, in this simple case COUNT(1) WHERE thing=otherthing would do the job, but 
it serves to illustrate the bug.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to