asolimando commented on a change in pull request #2979:
URL: https://github.com/apache/hive/pull/2979#discussion_r795880229
##########
File path: ql/src/test/queries/clientpositive/order_null2.q
##########
@@ -0,0 +1,70 @@
+create table test1
+(
+ a string,
+ b timestamp,
+ c timestamp
+);
+
+INSERT INTO TABLE test1 VALUES
+('John Doe', '1990-05-10 00:00:00.0', '2022-01-10 00:00:00.0'),
+('John Doe', '1990-05-10 00:00:00.0', '2021-12-10 00:00:00.0'),
+('John Doe', '1990-05-10 00:00:00.0', '2021-11-10 00:00:00.0'),
+('John Doe', '1990-05-10 00:00:00.0', '2021-10-10 00:00:00.0'),
+('John Doe', '1990-05-10 00:00:00.0', '2021-09-10 00:00:00.0'),
+('John Doe', '1987-05-10 00:00:00.0', '2022-01-10 00:00:00.0'),
+('John Doe', '1987-05-10 00:00:00.0', '2021-12-10 00:00:00.0'),
+('John Doe', '1987-05-10 00:00:00.0', '2021-11-10 00:00:00.0'),
+('John Doe', '1987-05-10 00:00:00.0', '2021-10-10 00:00:00.0'),
+('John Doe', '1987-05-10 00:00:00.0', null);
+
+-- hive.default.nulls.last is true by default, it sets NULLS_FIRST for DESC
+EXPLAIN AST
+SELECT a, b, c, row_number() OVER (PARTITION BY a, b ORDER BY b DESC, c DESC)
+FROM test1;
+
+EXPLAIN
+SELECT a, b, c, row_number() OVER (PARTITION BY a, b ORDER BY b DESC, c DESC)
+FROM test1;
+
+SELECT a, b, c, row_number() OVER (PARTITION BY a, b ORDER BY b DESC, c DESC)
+FROM test1;
+
+-- we set hive.default.nulls.last=false, it sets NULLS_LAST for DESC
+set hive.default.nulls.last=false;
+
+EXPLAIN AST
+SELECT a, b, c, row_number() OVER (PARTITION BY a, b ORDER BY b DESC, c DESC)
+FROM test1;
+
+EXPLAIN
+SELECT a, b, c, row_number() OVER (PARTITION BY a, b ORDER BY b DESC, c DESC)
+FROM test1;
+
+SELECT a, b, c, row_number() OVER (PARTITION BY a, b ORDER BY b DESC, c DESC)
+FROM test1;
+
+-- we set hive.default.nulls.last=false but we have explicit NULLS_LAST, we
expect NULLS_LAST
+set hive.default.nulls.last=false;
Review comment:
It's mostly for clarity since there is a bit of text in between, it will
also be useful in case they get re-ordered or modified, but I am fine with
removing it if you prefer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]