[
https://issues.apache.org/jira/browse/HIVE-7213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14056013#comment-14056013
]
Moustafa Aboul Atta commented on HIVE-7213:
-------------------------------------------
[~ashutoshc] Sorry just saw your earlier comment, I ran the query on a simple
table with 2 records, here's the result:
{code}
hive> truncate table test;
OK
Time taken: 0.371 seconds
hive> select * from test;
OK
Time taken: 0.187 seconds
hive> select count(*) from test;
OK
1
Time taken: 0.192 seconds, Fetched: 1 row(s)
hive> explain select count(*) from test;
OK
STAGE DEPENDENCIES:
Stage-0 is a root stage
STAGE PLANS:
Stage: Stage-0
Fetch Operator
limit: 1
Time taken: 0.086 seconds, Fetched: 8 row(s)
{code}
> COUNT(*) returns out-dated count value after TRUNCATE or INSERT INTO
> --------------------------------------------------------------------
>
> Key: HIVE-7213
> URL: https://issues.apache.org/jira/browse/HIVE-7213
> Project: Hive
> Issue Type: Bug
> Components: Query Processor, Statistics
> Affects Versions: 0.13.0
> Environment: HDP 2.1
> Windows Server 2012 64-bit
> Reporter: Moustafa Aboul Atta
>
> Running a query to count number of rows in a table through
> {{SELECT COUNT( * ) FROM t}}
> always returns the last number of rows added through the following statement:
> {{INSERT INTO TABLE t SELECT r FROM t2}}
> However, running
> {{SELECT * FROM t}}
> returns the expected results i.e. the old and newly added rows.
> Also running
> {{TRUNCATE TABLE t;}}
> returns the original count of rows in the table, however running
> {{SELECT * FROM t;}}
> returns nothing as expected
--
This message was sent by Atlassian JIRA
(v6.2#6252)