Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change 
notification.

The following page has been changed by ZhengShao:
http://wiki.apache.org/hadoop/Hive/LanguageManual/Select

------------------------------------------------------------------------------
      WHERE page_views.date >= '2008-03-01' AND page_views.date <= '2008-03-31'
  }}}
  
-  * [wiki:Self:Hive/LanguageManual/GroupBy Group By]
+  * See also [wiki:Self:Hive/LanguageManual/GroupBy Group By]
- {{{
- SELECT col1, COUNT(col2), sum(col3) FROM t1 GROUP BY col1
- }}}
  
+  * See also [wiki:Self:Hive/LanguageManual/SortBy Sort By / Cluster By / 
Distribute By / Order By]
-  * Cluster By. This construct is used mainly with the 
[wiki:Self:Hive/LanguageManual/Transform MAP and REDUCE] clauses. But, it is 
sometimes useful in SELECT statements if there is a need to partition and sort 
the output of a query for subsequent queries.
- {{{
- SELECT col1, col2 FROM t1 CLUSTER BY col1
- }}}
  
-  * Distribute By and Sort By. These constructs are mainly used with the 
[wiki:Self:Hive/LanguageManual/Transform MAP and REDUCE] clauses. But, they can 
be used to distribute and sort the output of a query. Sort By also supports ASC 
and DESC for ascending and descending order of sorting, but defaults to ASC if 
nothing is specified.
- {{{
- SELECT col1, col2 FROM t1 DISTRIBUTE BY col1
- 
- SELECT col1, col2 FROM t1 DISTRIBUTE BY col1 SORT BY col1 ASC, col2 DESC
- }}}
- 
-  * Order By - Hive currently does not support ORDER BY. A similar effect can 
be gotten by using SORT BY and setting number of reducers to 1. The following 
query does ORDER BY col1. Note however that this query can take a long time if 
the size of t1 is large since there is only one reducer.
- {{{
- SET mapred.reduce.tasks = 1
- SELECT * FROM t1 SORT BY col1
- }}}
- 
-   * Having - Hive currently does not support HAVING clause. A similar effect 
can be gotten by using a subquery. For example, 
+  * Having - Hive currently does not support HAVING clause. A similar effect 
can be gotten by using a subquery. For example, 
  {{{
  SELECT col1 FROM t1 GROUP BY col1 HAVING SUM(col2) > 10
  }}}

Reply via email to