Krystal created PHOENIX-970:
-------------------------------

             Summary: COUNT function against character column fails with "cast 
function for type BIT is not defined"
                 Key: PHOENIX-970
                 URL: https://issues.apache.org/jira/browse/PHOENIX-970
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 1.0
            Reporter: Krystal


The following query failed:
select count(distinct(name)) from voter;

2014-05-05 14:59:18 INFO  DrillTestBase:191 - Query dispatch start time: 
2014/05/05 14:59:18.0018
java.sql.SQLException: exception while executing query
        at net.hydromatic.avatica.Helper.createException(Helper.java:40)
        at 
net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:406)
        at 
net.hydromatic.avatica.AvaticaStatement.executeQueryInternal(AvaticaStatement.java:350)
        at 
net.hydromatic.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:78)
        at 
org.apache.drill.test.framework.GenericQueryDispatcher.dispatchQueryJDBC(GenericQueryDispatcher.java:89)
        at 
org.apache.drill.test.framework.DrillTestBase$RunThread.run(DrillTestBase.java:257)
Caused by: java.sql.SQLException: Failure while trying to get next result batch.
        at org.apache.drill.jdbc.DrillCursor.next(DrillCursor.java:101)
        at org.apache.drill.jdbc.DrillResultSet.execute(DrillResultSet.java:89)
        at org.apache.drill.jdbc.DrillResultSet.execute(DrillResultSet.java:43)
        at 
net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:404)
        ... 4 more

Explicitly cast the "name" column to a varchar (select count(distinct(cast(name 
as varchar(25)))) from voter;) gave the same error.

Also, casting an integer column to a varchar with count resulted in the same 
error:
select count(cast(age as varchar(5))) from student;
Failure while running fragment. < RuntimeException:[ cast function for type BIT 
is not defined



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to