zabetak commented on code in PR #4760:
URL: https://github.com/apache/hive/pull/4760#discussion_r1345783131


##########
ql/src/test/results/clientpositive/llap/date_timestamp_partition_filter.q.out:
##########
@@ -0,0 +1,214 @@
+PREHOOK: query: CREATE EXTERNAL TABLE testpd(col1 string, col2 String) 
PARTITIONED BY(PartitionDate DATE) STORED AS ORC

Review Comment:
   I will ask it differently. Is there anything in the EXPLAIN or elsewhere in 
the .q.out file that proves that we passed from the buggy code? If the EXPLAIN 
is the same with and without the changes here then it seems redundant.



##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/utils/TestMetaStoreUtils.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.metastore.utils;
+
+import org.apache.hadoop.hive.metastore.annotation.MetastoreUnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.time.ZoneId;
+import java.util.TimeZone;
+
+import static org.junit.Assert.assertEquals;
+
+@Category(MetastoreUnitTest.class)
+public class TestMetaStoreUtils {
+
+  @Test
+  public void testConvertDateToString() {
+    TimeZone defaultTZ = TimeZone.getDefault();
+    try {
+      TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("Asia/Hong_Kong")));
+      String date = 
MetaStoreUtils.convertDateToString(Date.valueOf("2023-01-01"));
+      assertEquals("2023-01-01", date);
+    } finally {
+      TimeZone.setDefault(defaultTZ);
+    }
+  }
+
+  @Test
+  public void testcConvertTimestampToString() {
+    TimeZone defaultTZ = TimeZone.getDefault();
+    try {
+      String date = 
MetaStoreUtils.convertTimestampToString(Timestamp.valueOf("2023-01-01 
10:20:30"));
+      assertEquals("2023-01-01 10:20:30", date);
+    } finally {
+      TimeZone.setDefault(defaultTZ);
+    }

Review Comment:
   I pushed a commit 
(https://github.com/apache/hive/pull/4760/commits/4ff9ba968b31ea16611ba5d5bc05bbfb3b4fe184)
 based on what I had in mind. Have a look and let me know if I missed something.
   
   With the new tests, I found a bug in `convertTimestampToString` using 
[zoneId=Europe/Paris, timestamp=9743-03-31T03:37:33] but I think this existed 
since day one so we can possibly defer it to another PR.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to