Support Questions

Find answers, ask questions, and share your expertise

Hivecontext is providing 1 extra count than the base hive table count

New Contributor

Hello Everyone,

 

when i am executing the query in hive as "select count(1) from table Table_Name" it is providing count as 100, But when i am executing same query from spark as "var RecordCount = hiveContext.sql("select count(1) from table Table_Name")" it is providing count as 101.

Please help me to resolve this issue.

 

Regards

Manoj

2 REPLIES 2

Champion
What version of CDH and Spark are you using?

Champion
I just tested with CDH 5.11.1 and Spark 1.6. The table I used is very simple and only has 5 records. Both systems returned the same and expected value.

This query doesn't look right thought "select count(1) from table Table_Name". It shouldn't have the 'table' keyword in it.

Note: if you include more than one valid table name in the query it will query the first table only and produce no errors.