Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9840

select count(*) <tablename> should give exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.14.0
    • None
    • None
    • hive 0.14

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pradeep_bhadani Pradeep Bhadani
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: