You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Pradeep Bhadani (JIRA)" <ji...@apache.org> on 2015/03/03 17:40:04 UTC

[jira] [Created] (HIVE-9840) select count(*) should give exception

Pradeep Bhadani created HIVE-9840:
-------------------------------------

             Summary: select count(*) <tablename> should give exception
                 Key: HIVE-9840
                 URL: https://issues.apache.org/jira/browse/HIVE-9840
             Project: Hive
          Issue Type: Bug
          Components: Hive, Parser, Query Planning, Query Processor
    Affects Versions: 0.14.0
         Environment: hive 0.14
            Reporter: Pradeep Bhadani
            Priority: Minor


When I am running hive query [count (*)] with any table name or without table name ,  It spawn MR job and return result as "1"
These all command (as below) should fail with Syntax Error

hive > select count (*) <any-table-name>
hive > select count (*) <non-existing-table-name>
hive > select count (*) <existing-table-name>
hive > select count (*) 

When we provide any table name or do not supllie any argument , it spawn mapreduce job to count the row of table name "_dummy_table".

EXPLAIN of above commands :

hive> EXPLAIN select count(*)  sample;
OK
STAGE DEPENDENCIES:
  Stage-1 is a root stage
  Stage-0 depends on stages: Stage-1

STAGE PLANS:
  Stage: Stage-1
    Map Reduce
      Map Operator Tree:
          TableScan
            alias: _dummy_table
            Row Limit Per Split: 1
            Statistics: Num rows: 0 Data size: 1 Basic stats: PARTIAL Column stats: COMPLETE
            Select Operator
              Statistics: Num rows: 0 Data size: 1 Basic stats: PARTIAL Column stats: COMPLETE
              Group By Operator
                aggregations: count()
                mode: hash
                outputColumnNames: _col0
                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                Reduce Output Operator
                  sort order: 
                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                  value expressions: _col0 (type: bigint)
      Reduce Operator Tree:
        Group By Operator
          aggregations: count(VALUE._col0)
          mode: mergepartial
          outputColumnNames: _col0
          Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
          Select Operator
            expressions: _col0 (type: bigint)
            outputColumnNames: _col0
            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
            File Output Operator
              compressed: false
              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
              table:
                  input format: org.apache.hadoop.mapred.TextInputFormat
                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

  Stage: Stage-0
    Fetch Operator
      limit: -1
      Processor Tree:
        ListSink

Time taken: 0.071 seconds, Fetched: 47 row(s)

NOTE:  Table "sample" do not exist in my hive.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)