Child pages
  • LanguageManual SortBy

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added links in two syntax sections for HIVE-6348 (3.0.0)

...

In Hive 2.1.0 and later, specifying the null sorting order for each of the columns in the "order by" clause is supported. The default null sorting order for ASC order is NULLS FIRST, while the default null sorting order for DESC order is NULLS LAST.

In Hive 3.0.0 and later, order by without limit in sub queries subqueries and views will be removed by the optimizer. To disable it, set hiveset hive.remove.orderby.in.subquery to false.

Syntax of Sort By

...

Hive uses the columns in SORT BY to sort the rows before feeding the rows to a reducer. The sort order will be dependent on the column types. If the column is of numeric type, then the sort order is also in numeric order. If the column is of string type, then the sort order will be lexicographical order.

In Hive 3.0.0 and later, sort by without limit in sub queries and subqueries and views will be removed be removed by the optimizer. To disable it, set hiveset hive.remove.orderby.in.subquery to false to false.

Difference between Sort By and Order By

...