You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Ashutosh Chauhan <ha...@apache.org> on 2014/01/13 22:41:37 UTC

Review Request 16829: optimize sum(1) query so that it could be answered from metadata using stats

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

Review request for hive.


Bugs: HIVE-6192
    https://issues.apache.org/jira/browse/HIVE-6192


Repository: hive-git


Description
-------

optimize sum(1) query so that it could be answered from metadata using stats


Diffs
-----

  ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java 75390e7 
  ql/src/test/queries/clientpositive/metadata_only_queries.q 7cbd148 
  ql/src/test/results/clientpositive/metadata_only_queries.q.out b6d149a 

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


Testing
-------

Added test in metadata_only_queries.q which contains other similar tests.


Thanks,

Ashutosh Chauhan


Re: Review Request 16829: optimize sum(1) query so that it could be answered from metadata using stats

Posted by Thejas Nair <th...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16829/#review31820
-----------------------------------------------------------



ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java
<https://reviews.apache.org/r/16829/#comment60532>

    I think it is better (more readable) to move this condition to an inner if statement. Going to the else to check if it is count, just because it is not ExprNodeConstantDesc does not make sense.
    
    ie
    if(aggr.getParameters().get(0) instanceof ExprNodeConstantDesc){
    return null;
    }



ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java
<https://reviews.apache.org/r/16829/#comment60533>

    can you also take care of this and other red marks ?
    



ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java
<https://reviews.apache.org/r/16829/#comment60541>

    What about the case of sum(0.2). It looks like Long.parseLong() would not work with that.



ql/src/test/results/clientpositive/metadata_only_queries.q.out
<https://reviews.apache.org/r/16829/#comment60542>

    can you also add test with sum() with other supported (ie numeric) datatypes.


- Thejas Nair


On Jan. 13, 2014, 9:41 p.m., Ashutosh Chauhan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16829/
> -----------------------------------------------------------
> 
> (Updated Jan. 13, 2014, 9:41 p.m.)
> 
> 
> Review request for hive.
> 
> 
> Bugs: HIVE-6192
>     https://issues.apache.org/jira/browse/HIVE-6192
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> optimize sum(1) query so that it could be answered from metadata using stats
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java 75390e7 
>   ql/src/test/queries/clientpositive/metadata_only_queries.q 7cbd148 
>   ql/src/test/results/clientpositive/metadata_only_queries.q.out b6d149a 
> 
> Diff: https://reviews.apache.org/r/16829/diff/
> 
> 
> Testing
> -------
> 
> Added test in metadata_only_queries.q which contains other similar tests.
> 
> 
> Thanks,
> 
> Ashutosh Chauhan
> 
>


Re: Review Request 16829: optimize sum(1) query so that it could be answered from metadata using stats

Posted by Thejas Nair <th...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16829/#review32095
-----------------------------------------------------------

Ship it!


Ship It!

- Thejas Nair


On Jan. 16, 2014, 9:48 p.m., Ashutosh Chauhan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16829/
> -----------------------------------------------------------
> 
> (Updated Jan. 16, 2014, 9:48 p.m.)
> 
> 
> Review request for hive.
> 
> 
> Bugs: HIVE-6192
>     https://issues.apache.org/jira/browse/HIVE-6192
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> optimize sum(1) query so that it could be answered from metadata using stats
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java 75390e7 
>   ql/src/test/queries/clientpositive/metadata_only_queries.q 7cbd148 
>   ql/src/test/results/clientpositive/metadata_only_queries.q.out b6d149a 
> 
> Diff: https://reviews.apache.org/r/16829/diff/
> 
> 
> Testing
> -------
> 
> Added test in metadata_only_queries.q which contains other similar tests.
> 
> 
> Thanks,
> 
> Ashutosh Chauhan
> 
>


Re: Review Request 16829: optimize sum(1) query so that it could be answered from metadata using stats

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

(Updated Jan. 16, 2014, 9:48 p.m.)


Review request for hive.


Changes
-------

* Rewrote if condition for better readability.
* Took care of red marks.
* Using HiveDecimal to take care of non-integral argument in sum.
* Added test for non-integral argument.


Bugs: HIVE-6192
    https://issues.apache.org/jira/browse/HIVE-6192


Repository: hive-git


Description
-------

optimize sum(1) query so that it could be answered from metadata using stats


Diffs (updated)
-----

  ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java 75390e7 
  ql/src/test/queries/clientpositive/metadata_only_queries.q 7cbd148 
  ql/src/test/results/clientpositive/metadata_only_queries.q.out b6d149a 

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


Testing
-------

Added test in metadata_only_queries.q which contains other similar tests.


Thanks,

Ashutosh Chauhan