hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pengcheng Xiong (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-9840) select count(*) <tablename> should give exception
Date Tue, 03 Mar 2015 17:43:05 GMT

    [ https://issues.apache.org/jira/browse/HIVE-9840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14345389#comment-14345389
] 

Pengcheng Xiong commented on HIVE-9840:
---------------------------------------

[~pradeep_bhadani], I tried mysql and postgres, they returned the same results without any
exception. [~jpullokkaran] and [~ashutoshc], could you please take a look?

Mysql:

mysql> select count(*);
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) src;
+-----+
| src |
+-----+
|   1 |
+-----+
1 row in set (0.00 sec)

mysql> explain select count(*) src;
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra 
        |
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
|  1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL | No tables
used |
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
1 row in set (0.00 sec)

Postgres

tmpdb=# select count(*);
 count
-------
     1
(1 row)

tmpdb=# select count(*) src;
 src
-----
   1
(1 row)

tmpdb=# explain select count(*) src;
                   QUERY PLAN
------------------------------------------------
 Aggregate  (cost=0.01..0.03 rows=1 width=0)
   ->  Result  (cost=0.00..0.01 rows=1 width=0)
(2 rows)

> 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)

Mime
View raw message