dengzhhu653 commented on code in PR #4959:
URL: https://github.com/apache/hive/pull/4959#discussion_r1505206489


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java:
##########
@@ -1424,30 +1422,36 @@ public void visit(LeafNode node) throws MetaException {
         return;
       }
 
+      String nodeValue0 = "?";
       // if Filter.g does date parsing for quoted strings, we'd need to verify 
there's no
       // type mismatch when string col is filtered by a string that looks like 
date.
-      if (colType == FilterType.Date && valType == FilterType.String) {
-        // Filter.g cannot parse a quoted date; try to parse date here too.
+      if (colType == FilterType.Date) {
         try {
-          nodeValue = MetaStoreUtils.convertStringToDate((String)nodeValue);
+          // check the nodeValue is a valid date
+          nodeValue = MetaStoreUtils.convertDateToString(
+              MetaStoreUtils.convertStringToDate((String) nodeValue));
           valType = FilterType.Date;
-        } catch (Exception pe) { // do nothing, handled below - types will 
mismatch
+          if (dbType.isPOSTGRES() || dbType.isORACLE()) {
+            nodeValue0 = "date '" + nodeValue + "'";
+            nodeValue = null;
+          }
+        } catch (Exception e) {  // do nothing, handled below - types will 
mismatch
+        }
+      } else if (colType == FilterType.Timestamp) {
+        if (dbType.isDERBY() || dbType.isMYSQL()) {
+          filterBuffer.setError("Filter pushdown on timestamp not supported 
for " + dbType.dbType.name());

Review Comment:
   This string constant will be referenced only once, I would like to keep it 
as local variable.



-- 
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