When you apply aggregate function on a column whose data type is "void" you get the above error.
How you get "void" as datatype?
When you create a table from another table(CTAS) & hardcode NULL as column values in the base table, you get the datatype as "void" for those columns. Consider the following example. This is a bug https://issues.apache.org/jira/browse/HIVE-11217
hive> create table test1 as select null as col1, null as col2;
Query ID = hive_20161227141826_d746f7f8-f867-4376-8b58-2e03e63c9763
Total jobs = 1
Launching Job 1 out of 1
Status: Running (Executing on YARN cluster with App id application_1481936603759_0026)
--------------------------------------------------------------------------------
VERTICES STATUS TOTAL COMPLETED RUNNING PENDING FAILED KILLED
--------------------------------------------------------------------------------
Map 1 .......... SUCCEEDED 1 1 0 0 0 0
--------------------------------------------------------------------------------
VERTICES: 01/01 [==========================>>] 100% ELAPSED TIME: 6.96 s
--------------------------------------------------------------------------------
Moving data to: hdfs://mrt1.openstacklocal:8020/apps/hive/warehouse/test1
Table default.test1 stats: [numFiles=1, numRows=1, totalSize=6, rawDataSize=5]
OK
Time taken: 8.553 seconds
hive> desc test1;
OK
col1 void
col2 void
Time taken: 0.469 seconds, Fetched: 2 row(s)
Resolution:
The fix for HIVE-11217 simply disallows the table from being created in the first place if the columns are void. The fix is only available in the Hive-2 line (HSI-Hive Server Interactive) in HDP 2.5