You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2016/03/02 12:00:13 UTC

[02/18] hive git commit: HIVE-12994: Implement support for NULLS FIRST/NULLS LAST (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)

http://git-wip-us.apache.org/repos/asf/hive/blob/9350b693/ql/src/test/results/clientpositive/vectorized_ptf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vectorized_ptf.q.out b/ql/src/test/results/clientpositive/vectorized_ptf.q.out
index 479953c..3b17591 100644
--- a/ql/src/test/results/clientpositive/vectorized_ptf.q.out
+++ b/ql/src/test/results/clientpositive/vectorized_ptf.q.out
@@ -157,8 +157,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -183,8 +184,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -196,8 +198,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_FUNCTION
@@ -211,8 +214,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -235,6 +239,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -306,7 +311,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -336,6 +341,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -382,7 +388,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -551,10 +557,11 @@ TOK_QUERY
                   p_mfgr
             TOK_SORTBY
                TOK_TABSORTCOLNAMEASC
-                  .
-                     TOK_TABLE_OR_COL
-                        j
-                     p_name
+                  TOK_NULLS_FIRST
+                     .
+                        TOK_TABLE_OR_COL
+                           j
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -587,8 +594,9 @@ TOK_QUERY
                               p_mfgr
                         TOK_ORDERBY
                            TOK_TABSORTCOLNAMEASC
-                              TOK_TABLE_OR_COL
-                                 p_name
+                              TOK_NULLS_FIRST
+                                 TOK_TABLE_OR_COL
+                                    p_name
             deltaSz
 
 
@@ -612,6 +620,7 @@ STAGE PLANS:
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: p_partkey (type: int)
+                null sort order: a
                 sort order: +
                 Map-reduce partition columns: p_partkey (type: int)
                 Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -628,6 +637,7 @@ STAGE PLANS:
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: p_partkey (type: int)
+                null sort order: a
                 sort order: +
                 Map-reduce partition columns: p_partkey (type: int)
                 Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -717,6 +727,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 28 Data size: 17646 Basic stats: COMPLETE Column stats: NONE
@@ -763,7 +774,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -793,6 +804,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 28 Data size: 17646 Basic stats: COMPLETE Column stats: NONE
@@ -839,7 +851,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -959,8 +971,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -991,6 +1004,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -1062,7 +1076,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -1180,8 +1194,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -1206,8 +1221,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -1219,8 +1235,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_FUNCTION
@@ -1234,8 +1251,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -1258,6 +1276,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -1329,7 +1348,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: abc
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -1359,6 +1378,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -1405,7 +1425,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -1550,8 +1570,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -1576,8 +1597,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -1589,8 +1611,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_TABLE_OR_COL
@@ -1613,8 +1636,9 @@ TOK_QUERY
                               p_mfgr
                         TOK_ORDERBY
                            TOK_TABSORTCOLNAMEASC
-                              TOK_TABLE_OR_COL
-                                 p_name
+                              TOK_NULLS_FIRST
+                                 TOK_TABLE_OR_COL
+                                    p_name
             deltaSz
 
 
@@ -1633,6 +1657,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -1704,7 +1729,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -1734,6 +1759,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -1780,7 +1806,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -1928,8 +1954,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -1954,8 +1981,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -1967,8 +1995,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_TABLE_OR_COL
@@ -1991,8 +2020,9 @@ TOK_QUERY
                               p_mfgr
                         TOK_ORDERBY
                            TOK_TABSORTCOLNAMEASC
-                              TOK_TABLE_OR_COL
-                                 p_name
+                              TOK_NULLS_FIRST
+                                 TOK_TABLE_OR_COL
+                                    p_name
             deltaSz
       TOK_GROUPBY
          TOK_TABLE_OR_COL
@@ -2018,6 +2048,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -2089,7 +2120,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -2128,6 +2159,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: int)
+              null sort order: aaa
               sort order: +++
               Map-reduce partition columns: _col0 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -2174,7 +2206,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col0
                   raw input shape:
                   window functions:
@@ -2317,8 +2349,9 @@ TOK_QUERY
                      p_mfgr
                TOK_ORDERBY
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_name
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_name
          TOK_TABREF
             TOK_TABNAME
                part_orc
@@ -2358,6 +2391,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -2429,7 +2463,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: abc
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col0: int, _col1: string, _col2: string, _col3: string, _col4: string, _col5: int, _col6: string, _col7: double, _col8: string
                   partition by: _col2
                   raw input shape:
@@ -2463,6 +2497,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col0 (type: int)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: _col0 (type: int)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -2479,6 +2514,7 @@ STAGE PLANS:
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: p_partkey (type: int)
+                null sort order: a
                 sort order: +
                 Map-reduce partition columns: p_partkey (type: int)
                 Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -2676,8 +2712,9 @@ TOK_QUERY
                      p_mfgr
                TOK_ORDERBY
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_name
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_name
          =
             .
                TOK_TABLE_OR_COL
@@ -2713,6 +2750,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -2784,7 +2822,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: abc
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col0: int, _col1: string, _col2: string, _col3: string, _col4: string, _col5: int, _col6: string, _col7: double, _col8: string
                   partition by: _col2
                   raw input shape:
@@ -2824,6 +2862,7 @@ STAGE PLANS:
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: p_partkey (type: int)
+                null sort order: a
                 sort order: +
                 Map-reduce partition columns: p_partkey (type: int)
                 Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -2833,6 +2872,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col0 (type: int)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: _col0 (type: int)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -3029,11 +3069,13 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
                TOK_TABSORTCOLNAMEDESC
-                  TOK_TABLE_OR_COL
-                     p_size
+                  TOK_NULLS_LAST
+                     TOK_TABLE_OR_COL
+                        p_size
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -3058,11 +3100,13 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                         TOK_TABSORTCOLNAMEDESC
-                           TOK_TABLE_OR_COL
-                              p_size
+                           TOK_NULLS_LAST
+                              TOK_TABLE_OR_COL
+                                 p_size
             r
 
 
@@ -3088,7 +3132,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_1
                     name: noopwithmap
-                    order by: p_name, p_size(DESC)
+                    order by: p_name ASC NULLS FIRST, p_size DESC NULLS LAST
                     output shape: p_name: string, p_mfgr: string, p_size: int
                     partition by: p_mfgr
                     raw input shape:
@@ -3097,6 +3141,7 @@ STAGE PLANS:
               Map-side function: true
               Reduce Output Operator
                 key expressions: p_mfgr (type: string), p_name (type: string), p_size (type: int)
+                null sort order: aaz
                 sort order: ++-
                 Map-reduce partition columns: p_mfgr (type: string)
                 Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -3166,7 +3211,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noopwithmap
-                  order by: _col1, _col5(DESC)
+                  order by: _col1 ASC NULLS FIRST, _col5 DESC NULLS LAST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -3197,6 +3242,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int)
+              null sort order: aaz
               sort order: ++-
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -3242,7 +3288,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1, _col5(DESC)
+                  order by: _col1 ASC NULLS FIRST, _col5 DESC NULLS LAST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -3366,8 +3412,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -3392,8 +3439,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -3405,8 +3453,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_FUNCTION
@@ -3420,8 +3469,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -3451,7 +3501,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_1
                     name: noopwithmap
-                    order by: p_name
+                    order by: p_name ASC NULLS FIRST
                     output shape: p_name: string, p_mfgr: string, p_size: int, p_retailprice: double
                     partition by: p_mfgr
                     raw input shape:
@@ -3460,6 +3510,7 @@ STAGE PLANS:
               Map-side function: true
               Reduce Output Operator
                 key expressions: p_mfgr (type: string), p_name (type: string)
+                null sort order: aa
                 sort order: ++
                 Map-reduce partition columns: p_mfgr (type: string)
                 Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -3530,7 +3581,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noopwithmap
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -3561,6 +3612,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -3607,7 +3659,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -3748,8 +3800,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -3774,8 +3827,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -3787,8 +3841,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_FUNCTION
@@ -3802,8 +3857,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -3826,6 +3882,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -3897,7 +3954,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -3927,6 +3984,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -3973,7 +4031,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -4120,11 +4178,13 @@ TOK_QUERY
                         p_mfgr
                   TOK_ORDERBY
                      TOK_TABSORTCOLNAMEASC
-                        TOK_TABLE_OR_COL
-                           p_mfgr
+                        TOK_NULLS_FIRST
+                           TOK_TABLE_OR_COL
+                              p_mfgr
                      TOK_TABSORTCOLNAMEASC
-                        TOK_TABLE_OR_COL
-                           p_name
+                        TOK_NULLS_FIRST
+                           TOK_TABLE_OR_COL
+                              p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -4149,8 +4209,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -4162,8 +4223,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_FUNCTION
@@ -4177,8 +4239,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -4202,6 +4265,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -4273,7 +4337,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -4287,7 +4351,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_1
                     name: noopwithmap
-                    order by: _col2, _col1
+                    order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                     output shape: _col1: string, _col2: string, _col5: int, _col7: double
                     partition by: _col2
                     raw input shape:
@@ -4295,7 +4359,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_2
                     name: noop
-                    order by: _col2, _col1
+                    order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                     output shape: _col1: string, _col2: string, _col5: int, _col7: double
                     partition by: _col2
                     raw input shape:
@@ -4326,6 +4390,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -4372,7 +4437,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noopwithmap
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -4380,7 +4445,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_2
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -4410,6 +4475,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -4456,7 +4522,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -4610,8 +4676,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             TOK_INSERT
                TOK_DESTINATION
                   TOK_DIR
@@ -4635,8 +4702,9 @@ TOK_QUERY
                                     p_mfgr
                               TOK_ORDERBY
                                  TOK_TABSORTCOLNAMEASC
-                                    TOK_TABLE_OR_COL
-                                       p_name
+                                    TOK_NULLS_FIRST
+                                       TOK_TABLE_OR_COL
+                                          p_name
                      cd
                   TOK_SELEXPR
                      TOK_TABLE_OR_COL
@@ -4659,8 +4727,9 @@ TOK_QUERY
                                  p_mfgr
                            TOK_ORDERBY
                               TOK_TABSORTCOLNAMEASC
-                                 TOK_TABLE_OR_COL
-                                    p_name
+                                 TOK_NULLS_FIRST
+                                    TOK_TABLE_OR_COL
+                                       p_name
                         TOK_WINDOWRANGE
                            preceding
                               2
@@ -4705,6 +4774,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -4776,7 +4846,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -4806,6 +4876,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -4852,7 +4923,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -5001,8 +5072,9 @@ TOK_QUERY
                      p_mfgr
                TOK_ORDERBY
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_name
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_name
          TOK_TABREF
             TOK_TABNAME
                part_orc
@@ -5043,10 +5115,11 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           .
-                              TOK_TABLE_OR_COL
-                                 abc
-                              p_name
+                           TOK_NULLS_FIRST
+                              .
+                                 TOK_TABLE_OR_COL
+                                    abc
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -5060,10 +5133,11 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           .
-                              TOK_TABLE_OR_COL
-                                 abc
-                              p_name
+                           TOK_NULLS_FIRST
+                              .
+                                 TOK_TABLE_OR_COL
+                                    abc
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_FUNCTION
@@ -5081,10 +5155,11 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           .
-                              TOK_TABLE_OR_COL
-                                 abc
-                              p_name
+                           TOK_NULLS_FIRST
+                              .
+                                 TOK_TABLE_OR_COL
+                                    abc
+                                 p_name
             cd
          TOK_SELEXPR
             .
@@ -5107,10 +5182,11 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           .
-                              TOK_TABLE_OR_COL
-                                 abc
-                              p_name
+                           TOK_NULLS_FIRST
+                              .
+                                 TOK_TABLE_OR_COL
+                                    abc
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -5147,10 +5223,11 @@ TOK_QUERY
                               p_mfgr
                         TOK_SORTBY
                            TOK_TABSORTCOLNAMEASC
-                              .
-                                 TOK_TABLE_OR_COL
-                                    abc
-                                 p_name
+                              TOK_NULLS_FIRST
+                                 .
+                                    TOK_TABLE_OR_COL
+                                       abc
+                                    p_name
             deltaSz
 
 
@@ -5170,6 +5247,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -5241,7 +5319,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: abc
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col0: int, _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -5275,6 +5353,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col0 (type: int)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: _col0 (type: int)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -5291,6 +5370,7 @@ STAGE PLANS:
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: p_partkey (type: int)
+                null sort order: a
                 sort order: +
                 Map-reduce partition columns: p_partkey (type: int)
                 Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -5401,6 +5481,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 28 Data size: 17646 Basic stats: COMPLETE Column stats: NONE
@@ -5447,7 +5528,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -5603,8 +5684,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -5636,6 +5718,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -5707,7 +5790,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -5746,6 +5829,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: int)
+              null sort order: aaa
               sort order: +++
               Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: int)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -5902,8 +5986,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_mfgr
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_mfgr
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -5936,8 +6021,9 @@ TOK_QUERY
                         p_mfgr
                   TOK_ORDERBY
                      TOK_TABSORTCOLNAMEASC
-                        TOK_TABLE_OR_COL
-                           p_brand
+                        TOK_NULLS_FIRST
+                           TOK_TABLE_OR_COL
+                              p_brand
                TOK_WINDOWRANGE
                   preceding
                      2
@@ -5969,6 +6055,7 @@ STAGE PLANS:
                 Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string), _col1 (type: string)
+                  null sort order: aa
                   sort order: ++
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -6042,7 +6129,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col0
+                  order by: _col0 ASC NULLS FIRST
                   output shape: _col0: string, _col1: string, _col2: double
                   partition by: _col0
                   raw input shape:
@@ -6072,6 +6159,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col0 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col0 (type: string)
               Statistics: Num rows: 13 Data size: 8021 Basic stats: COMPLETE Column stats: NONE
@@ -6118,7 +6206,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col0
                   raw input shape:
                   window functions:
@@ -6291,8 +6379,9 @@ TOK_QUERY
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_TAB
@@ -6318,8 +6407,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -6331,8 +6421,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_FUNCTION
@@ -6346,8 +6437,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -6382,8 +6474,9 @@ TOK_QUERY
                               p_mfgr
                         TOK_SORTBY
                            TOK_TABSORTCOLNAMEASC
-                              TOK_TABLE_OR_COL
-                                 p_size
+                              TOK_NULLS_FIRST
+                                 TOK_TABLE_OR_COL
+                                    p_size
                      TOK_WINDOWVALUES
                         preceding
                            5
@@ -6400,11 +6493,13 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -6416,11 +6511,13 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_FUNCTION
@@ -6432,11 +6529,13 @@ TOK_QUERY
                            p_mfgr
                      TOK_SORTBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             cud
          TOK_SELEXPR
             TOK_FUNCTION
@@ -6457,11 +6556,13 @@ TOK_QUERY
                         p_mfgr
                   TOK_SORTBY
                      TOK_TABSORTCOLNAMEASC
-                        TOK_TABLE_OR_COL
-                           p_mfgr
+                        TOK_NULLS_FIRST
+                           TOK_TABLE_OR_COL
+                              p_mfgr
                      TOK_TABSORTCOLNAMEASC
-                        TOK_TABLE_OR_COL
-                           p_name
+                        TOK_NULLS_FIRST
+                           TOK_TABLE_OR_COL
+                              p_name
                TOK_WINDOWRANGE
                   preceding
                      2
@@ -6489,6 +6590,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -6560,7 +6662,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int, _col7: double
                   partition by: _col2
                   raw input shape:
@@ -6607,6 +6709,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -6653,7 +6756,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -6742,6 +6845,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col5 (type: int)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -6788,7 +6892,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col5
+                  order by: _col5 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -6828,6 +6932,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -6874,7 +6979,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col3, _col2
+                  order by: _col3 ASC NULLS FIRST, _col2 ASC NULLS FIRST
                   partition by: _col3
                   raw input shape:
                   window functions:
@@ -7140,8 +7245,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
             TOK_PARTITIONINGSPEC
                TOK_DISTRIBUTEBY
                   TOK_TABLE_OR_COL
@@ -7150,11 +7256,13 @@ TOK_QUERY
                      p_name
                TOK_ORDERBY
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_mfgr
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_mfgr
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_name
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_name
          TOK_PARTITIONINGSPEC
             TOK_DISTRIBUTEBY
                TOK_TABLE_OR_COL
@@ -7163,11 +7271,13 @@ TOK_QUERY
                   p_name
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_mfgr
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_mfgr
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -7239,6 +7349,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -7310,14 +7421,14 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
                 Partition table definition
                   input alias: ptf_2
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -7331,7 +7442,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_1
                     name: noopwithmap
-                    order by: _col2, _col1
+                    order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                     output shape: _col1: string, _col2: string, _col5: int
                     partition by: _col2, _col1
                     raw input shape:
@@ -7339,7 +7450,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_2
                     name: noop
-                    order by: _col2, _col1
+                    order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                     output shape: _col1: string, _col2: string, _col5: int
                     partition by: _col2, _col1
                     raw input shape:
@@ -7370,6 +7481,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string), _col1 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -7416,7 +7528,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noopwithmap
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
@@ -7424,7 +7536,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_2
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
@@ -7454,6 +7566,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string), _col1 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -7500,7 +7613,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   partition by: _col2, _col1
                   raw input shape:
                   window functions:
@@ -7679,8 +7792,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
             TOK_PARTITIONINGSPEC
                TOK_DISTRIBUTEBY
                   TOK_TABLE_OR_COL
@@ -7689,19 +7803,22 @@ TOK_QUERY
                      p_name
                TOK_ORDERBY
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_mfgr
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_mfgr
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_name
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_name
          TOK_PARTITIONINGSPEC
             TOK_DISTRIBUTEBY
                TOK_TABLE_OR_COL
                   p_mfgr
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_mfgr
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_mfgr
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -7723,8 +7840,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -7736,8 +7854,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_TABLE_OR_COL
@@ -7754,8 +7873,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -7780,6 +7900,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: p_mfgr (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -7851,14 +7972,14 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
                 Partition table definition
                   input alias: ptf_2
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -7888,6 +8009,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string), _col1 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -7934,7 +8056,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
@@ -7964,6 +8086,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -8010,7 +8133,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -8040,6 +8163,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -8086,7 +8210,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -8263,19 +8387,22 @@ TOK_QUERY
                            p_name
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             TOK_PARTITIONINGSPEC
                TOK_DISTRIBUTEBY
                   TOK_TABLE_OR_COL
                      p_mfgr
                TOK_ORDERBY
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_mfgr
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_mfgr
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -8297,8 +8424,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -8310,8 +8438,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_TABLE_OR_COL
@@ -8328,8 +8457,9 @@ TOK_QUERY
                            p_mfgr
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             s1
 
 
@@ -8349,6 +8479,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string), p_name (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -8420,14 +8551,14 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
                 Partition table definition
                   input alias: ptf_2
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
@@ -8457,6 +8588,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -8503,14 +8635,14 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
                 Partition table definition
                   input alias: ptf_2
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -8540,6 +8672,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -8586,7 +8719,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col1
+                  order by: _col1 ASC NULLS FIRST
                   partition by: _col2
                   raw input shape:
                   window functions:
@@ -8763,19 +8896,22 @@ TOK_QUERY
                            p_name
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             TOK_PARTITIONINGSPEC
                TOK_DISTRIBUTEBY
                   TOK_TABLE_OR_COL
                      p_mfgr
                TOK_ORDERBY
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_mfgr
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_mfgr
          TOK_PARTITIONINGSPEC
             TOK_DISTRIBUTEBY
                TOK_TABLE_OR_COL
@@ -8784,11 +8920,13 @@ TOK_QUERY
                   p_name
             TOK_ORDERBY
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_mfgr
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_mfgr
                TOK_TABSORTCOLNAMEASC
-                  TOK_TABLE_OR_COL
-                     p_name
+                  TOK_NULLS_FIRST
+                     TOK_TABLE_OR_COL
+                        p_name
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -8861,6 +8999,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string), p_name (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -8932,14 +9071,14 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
                 Partition table definition
                   input alias: ptf_2
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
@@ -8969,6 +9108,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -9015,7 +9155,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -9029,7 +9169,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_1
                     name: noopwithmap
-                    order by: _col2, _col1
+                    order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                     output shape: _col1: string, _col2: string, _col5: int
                     partition by: _col2, _col1
                     raw input shape:
@@ -9061,6 +9201,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string), _col1 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -9107,7 +9248,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noopwithmap
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
@@ -9138,6 +9279,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string), _col1 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -9184,7 +9326,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefunction
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   partition by: _col2, _col1
                   raw input shape:
                   window functions:
@@ -9361,19 +9503,22 @@ TOK_QUERY
                         p_name
                   TOK_ORDERBY
                      TOK_TABSORTCOLNAMEASC
-                        TOK_TABLE_OR_COL
-                           p_mfgr
+                        TOK_NULLS_FIRST
+                           TOK_TABLE_OR_COL
+                              p_mfgr
                      TOK_TABSORTCOLNAMEASC
-                        TOK_TABLE_OR_COL
-                           p_name
+                        TOK_NULLS_FIRST
+                           TOK_TABLE_OR_COL
+                              p_name
             TOK_PARTITIONINGSPEC
                TOK_DISTRIBUTEBY
                   TOK_TABLE_OR_COL
                      p_mfgr
                TOK_ORDERBY
                   TOK_TABSORTCOLNAMEASC
-                     TOK_TABLE_OR_COL
-                        p_mfgr
+                     TOK_NULLS_FIRST
+                        TOK_TABLE_OR_COL
+                           p_mfgr
    TOK_INSERT
       TOK_DESTINATION
          TOK_DIR
@@ -9397,11 +9542,13 @@ TOK_QUERY
                            p_name
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             r
          TOK_SELEXPR
             TOK_FUNCTION
@@ -9415,11 +9562,13 @@ TOK_QUERY
                            p_name
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
             dr
          TOK_SELEXPR
             TOK_TABLE_OR_COL
@@ -9438,11 +9587,13 @@ TOK_QUERY
                            p_name
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -9462,11 +9613,13 @@ TOK_QUERY
                            p_name
                      TOK_ORDERBY
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_mfgr
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_mfgr
                         TOK_TABSORTCOLNAMEASC
-                           TOK_TABLE_OR_COL
-                              p_name
+                           TOK_NULLS_FIRST
+                              TOK_TABLE_OR_COL
+                                 p_name
                   TOK_WINDOWRANGE
                      preceding
                         unbounded
@@ -9490,6 +9643,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: p_mfgr (type: string), p_name (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: p_mfgr (type: string), p_name (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -9561,7 +9715,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noop
-                  order by: _col2, _col1
+                  order by: _col2 ASC NULLS FIRST, _col1 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2, _col1
                   raw input shape:
@@ -9575,7 +9729,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_1
                     name: noopwithmap
-                    order by: _col2
+                    order by: _col2 ASC NULLS FIRST
                     output shape: _col1: string, _col2: string, _col5: int
                     partition by: _col2
                     raw input shape:
@@ -9583,7 +9737,7 @@ STAGE PLANS:
                   Partition table definition
                     input alias: ptf_2
                     name: noop
-                    order by: _col2
+                    order by: _col2 ASC NULLS FIRST
                     output shape: _col1: string, _col2: string, _col5: int
                     partition by: _col2
                     raw input shape:
@@ -9614,6 +9768,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string)
+              null sort order: a
               sort order: +
               Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -9660,7 +9815,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_1
                   name: noopwithmap
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -9668,7 +9823,7 @@ STAGE PLANS:
                 Partition table definition
                   input alias: ptf_2
                   name: noop
-                  order by: _col2
+                  order by: _col2 ASC NULLS FIRST
                   output shape: _col1: string, _col2: string, _col5: int
                   partition by: _col2
                   raw input shape:
@@ -9698,6 +9853,7 @@ STAGE PLANS:
             GatherStats: false
             Reduce Output Operator
               key expressions: _col2 (type: string), _col1 (type: string)
+              null sort order: aa
               sort order: ++
               Map-reduce partition columns: _col2 (type: string), _col1 (type: string)
               Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
@@ -9744,7 +9900,7 @@ STAGE PLANS:
                 Windowing table definition
                   input alias: ptf_1
                   name: windowingtablefu

<TRUNCATED>