You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by pengcheng xiong <px...@hortonworks.com> on 2016/12/02 01:23:32 UTC

Review Request 54284: StatsOptimizer should return no rows on empty table with group by

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54284/
-----------------------------------------------------------

Review request for hive and Ashutosh Chauhan.


Repository: hive-git


Description
-------

HIVE-13452


Diffs
-----

  ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java 17510e9 
  ql/src/test/queries/clientpositive/constGby.q PRE-CREATION 
  ql/src/test/results/clientpositive/constGby.q.out PRE-CREATION 

Diff: https://reviews.apache.org/r/54284/diff/


Testing
-------


Thanks,

pengcheng xiong


Re: Review Request 54284: StatsOptimizer should return no rows on empty table with group by

Posted by pengcheng xiong <px...@hortonworks.com>.

> On Dec. 2, 2016, 9:10 p.m., Ashutosh Chauhan wrote:
> > ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java, line 182
> > <https://reviews.apache.org/r/54284/diff/1/?file=1574510#file1574510line182>
> >
> >     Is there any differnce between NULL & constant? It seems you are not making use of NULL any where.

Yes, I have make use of NULL. Please See
{code}
if (getGbyKeyType(pgbyOp) == GbyKeyType.OTHER) {
          return null;
        }
        // we already check if rowCnt is null and rowCnt==0 means table is
        // empty.
        else if (getGbyKeyType(pgbyOp) == GbyKeyType.CONSTANT && rowCnt == 0) {
          return null;
        }
{code}
That means, only if it is groupby constant and rowCnt=0, we skip the StatsOptimizer.
If it is NULL, which should be the 3rd condition (if, else if, else), we continue.


- pengcheng


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54284/#review157823
-----------------------------------------------------------


On Dec. 2, 2016, 1:23 a.m., pengcheng xiong wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54284/
> -----------------------------------------------------------
> 
> (Updated Dec. 2, 2016, 1:23 a.m.)
> 
> 
> Review request for hive and Ashutosh Chauhan.
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> HIVE-13452
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java 17510e9 
>   ql/src/test/queries/clientpositive/constGby.q PRE-CREATION 
>   ql/src/test/results/clientpositive/constGby.q.out PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54284/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> pengcheng xiong
> 
>


Re: Review Request 54284: StatsOptimizer should return no rows on empty table with group by

Posted by Ashutosh Chauhan <ha...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54284/#review157823
-----------------------------------------------------------




ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java (line 182)
<https://reviews.apache.org/r/54284/#comment228426>

    Is there any differnce between NULL & constant? It seems you are not making use of NULL any where.


- Ashutosh Chauhan


On Dec. 2, 2016, 1:23 a.m., pengcheng xiong wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54284/
> -----------------------------------------------------------
> 
> (Updated Dec. 2, 2016, 1:23 a.m.)
> 
> 
> Review request for hive and Ashutosh Chauhan.
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> HIVE-13452
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java 17510e9 
>   ql/src/test/queries/clientpositive/constGby.q PRE-CREATION 
>   ql/src/test/results/clientpositive/constGby.q.out PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54284/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> pengcheng xiong
> 
>